Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Dalai Felinto
virtual_reality_viewport
Commits
1779b7a9
Commit
1779b7a9
authored
Oct 09, 2015
by
Dalai Felinto
Browse files
Take current viewport (off camera) into consideration
parent
d0941dad
Changes
1
Hide whitespace changes
Inline
Side-by-side
space_view3d_virtual_reality/hmd/__init__.py
View file @
1779b7a9
...
...
@@ -80,7 +80,7 @@ class HMD_Base:
self
.
_eye_position_raw
=
[[
i
for
i
in
range
(
3
)],
[
i
for
i
in
range
(
3
)]]
self
.
_scale
=
self
.
_calculateScale
(
context
)
self
.
_update
Camera
Clipping
(
context
)
self
.
_update
View
Clipping
(
context
)
@
property
def
width
(
self
):
...
...
@@ -147,7 +147,7 @@ class HMD_Base:
"""
Get fresh tracking data
"""
self
.
_update
Camera
Clipping
(
context
)
self
.
_update
View
Clipping
(
context
)
self
.
updateMatrices
(
context
)
def
frameReady
(
self
):
...
...
@@ -191,8 +191,7 @@ class HMD_Base:
"""
Update OpenGL drawing matrices
"""
camera_matrix
=
self
.
_getCamera
(
context
).
matrix_world
.
copy
()
camera_matrix_inv
=
camera_matrix
.
inverted
()
view_matrix
=
self
.
_getViewMatrix
(
context
)
for
i
in
range
(
2
):
rotation_raw
=
self
.
_eye_orientation_raw
[
i
]
...
...
@@ -206,17 +205,31 @@ class HMD_Base:
transformation
=
position
*
rotation
self
.
_modelview_matrix
[
i
]
=
transformation
*
camera
_matrix
_inv
self
.
_modelview_matrix
[
i
]
=
transformation
*
view
_matrix
def
_get
Camera
(
self
,
context
):
re
turn
context
.
scene
.
camer
a
def
_get
ViewMatrix
(
self
,
context
):
re
gion
=
context
.
region_dat
a
def
_updateCameraClipping
(
self
,
context
):
camera_ob
=
self
.
_getCamera
(
context
)
camera
=
camera_ob
.
data
if
region
.
view_perspective
==
'CAMERA'
:
space
=
context
.
space_data
camera
=
space
.
camera
return
camera
.
matrix_world
.
copy
().
inverted
()
else
:
return
region
.
view_matrix
.
copy
()
def
_updateViewClipping
(
self
,
context
):
space
=
context
.
space_data
region
=
context
.
region_data
self
.
_near
=
camera
.
clip_start
self
.
_far
=
camera
.
clip_end
if
region
.
view_perspective
==
'CAMERA'
:
camera_ob
=
space
.
camera
camera
=
camera_ob
.
data
self
.
_near
=
camera
.
clip_start
self
.
_far
=
camera
.
clip_end
else
:
self
.
_near
=
space
.
clip_start
self
.
_far
=
space
.
clip_end
def
_calculateScale
(
self
,
context
):
"""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment