Class: Three::Camera

Inherits:
Object3D show all
Defined in:
lib/three/cameras/camera.rb

Direct Known Subclasses

OrthographicCamera, PerspectiveCamera

Constant Summary

Constants inherited from Object3D

Object3D::DEFAULT_MATRIX_AUTO_UPDATE, Object3D::DEFAULT_MATRIX_WORLD_AUTO_UPDATE, Object3D::DEFAULT_UP

Instance Attribute Summary collapse

Attributes inherited from Object3D

#cast_shadow, #children, #id, #layers, #matrix, #matrix_auto_update, #matrix_world, #matrix_world_auto_update, #matrix_world_needs_update, #name, #parent, #position, #quaternion, #receive_shadow, #rotation, #scale, #type, #up, #user_data, #uuid, #visible

Instance Method Summary collapse

Methods inherited from Object3D

#add, allocate_id, #clear, #dirty_dependency_changed, #get_object_by_id, #get_object_by_name, #get_object_by_property, #get_objects_by_property, #get_world_position, #get_world_quaternion, #get_world_scale, #mark_descendant_dirty!, #mark_dirty!, #remove, #remove_from_parent, #to_h, #to_json, #traverse, #traverse_ancestors, #traverse_visible, #update_matrix

Methods included from Dirty

#add_dirty_dependent, #dirty?, #dirty_dependents, #dirty_field?, #dirty_fields, #mark_clean!, #mark_dirty!, #remove_dirty_dependent

Methods inherited from EventDispatcher

#add_event_listener, #dispatch_event, #has_event_listener?, #remove_event_listener

Constructor Details

#initializeCamera

Returns a new instance of Camera.



9
10
11
12
13
14
15
# File 'lib/three/cameras/camera.rb', line 9

def initialize
  super
  @type = "Camera"
  @matrix_world_inverse = Matrix4.new
  @projection_matrix = Matrix4.new
  @projection_matrix_inverse = Matrix4.new
end

Instance Attribute Details

#matrix_world_inverseObject (readonly)

Returns the value of attribute matrix_world_inverse.



7
8
9
# File 'lib/three/cameras/camera.rb', line 7

def matrix_world_inverse
  @matrix_world_inverse
end

#projection_matrixObject (readonly)

Returns the value of attribute projection_matrix.



7
8
9
# File 'lib/three/cameras/camera.rb', line 7

def projection_matrix
  @projection_matrix
end

#projection_matrix_inverseObject (readonly)

Returns the value of attribute projection_matrix_inverse.



7
8
9
# File 'lib/three/cameras/camera.rb', line 7

def projection_matrix_inverse
  @projection_matrix_inverse
end

Instance Method Details

#get_world_direction(target = Vector3.new) ⇒ Object



29
30
31
# File 'lib/three/cameras/camera.rb', line 29

def get_world_direction(target = Vector3.new)
  super(target).negate
end

#update_matrix_world(force = false) ⇒ Object



17
18
19
20
21
# File 'lib/three/cameras/camera.rb', line 17

def update_matrix_world(force = false)
  super
  update_matrix_world_inverse
  self
end

#update_world_matrix(update_parents = false, update_children = false) ⇒ Object



23
24
25
26
27
# File 'lib/three/cameras/camera.rb', line 23

def update_world_matrix(update_parents = false, update_children = false)
  super
  update_matrix_world_inverse
  self
end