forked from adamlwgriffiths/PyGLy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera_node.py
More file actions
executable file
·41 lines (29 loc) · 1.09 KB
/
camera_node.py
File metadata and controls
executable file
·41 lines (29 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import math
from pyrr import quaternion
from pyrr import matrix44
from pyrr import ray
from .scene_node import SceneNode
class CameraNode( SceneNode ):
"""A Scene Graph based camera.
"""
def __init__( self, name, projection_matrix ):
"""Creates a CameraNode object.
:param string name: The name to give to the node.
:param ProjectionMatrix projection_matrix: The camera's projection matrix.
"""
super( CameraNode, self ).__init__( name )
#: the camer's view matrix
self.projection_matrix = projection_matrix
@property
def model_view( self ):
"""Property for the camera's model view matrix.
This is the inverse of the camera's world matrix
and is used as the initial matrix for the model view
matrix.
This is an @property decorated method.
:rtype: numpy.array
:return: A matrix set to the camera's model view
matrix.
"""
# return the inverse of our world matrix
return matrix44.inverse( self.world_transform.matrix )