Class: Three::Light
- Inherits:
-
Object3D
- Object
- EventDispatcher
- Object3D
- Three::Light
- Defined in:
- lib/three/lights/light.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Object3D
Object3D::DEFAULT_MATRIX_AUTO_UPDATE, Object3D::DEFAULT_MATRIX_WORLD_AUTO_UPDATE, Object3D::DEFAULT_UP
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#intensity ⇒ Object
Returns the value of attribute intensity.
-
#shadow_bias ⇒ Object
Returns the value of attribute shadow_bias.
-
#shadow_map_size ⇒ Object
Returns the value of attribute shadow_map_size.
-
#shadow_normal_bias ⇒ Object
Returns the value of attribute shadow_normal_bias.
-
#shadow_radius ⇒ Object
Returns the value of attribute shadow_radius.
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
- #dispose ⇒ Object
-
#initialize(color = 0xffffff, intensity = 1) ⇒ Light
constructor
A new instance of Light.
- #to_h ⇒ Object
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_direction, #get_world_position, #get_world_quaternion, #get_world_scale, #mark_descendant_dirty!, #mark_dirty!, #remove, #remove_from_parent, #to_json, #traverse, #traverse_ancestors, #traverse_visible, #update_matrix, #update_matrix_world, #update_world_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
#initialize(color = 0xffffff, intensity = 1) ⇒ Light
Returns a new instance of Light.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/three/lights/light.rb', line 11 def initialize(color = 0xffffff, intensity = 1) super() @type = "Light" @color = Color.new(color) @intensity = intensity @shadow_map_size = [512, 512] @shadow_bias = 0 @shadow_normal_bias = 0 @shadow_radius = 1 bind_color_changes mark_dirty!(:light) end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
8 9 10 |
# File 'lib/three/lights/light.rb', line 8 def color @color end |
#intensity ⇒ Object
Returns the value of attribute intensity.
8 9 10 |
# File 'lib/three/lights/light.rb', line 8 def intensity @intensity end |
#shadow_bias ⇒ Object
Returns the value of attribute shadow_bias.
9 10 11 |
# File 'lib/three/lights/light.rb', line 9 def shadow_bias @shadow_bias end |
#shadow_map_size ⇒ Object
Returns the value of attribute shadow_map_size.
9 10 11 |
# File 'lib/three/lights/light.rb', line 9 def shadow_map_size @shadow_map_size end |
#shadow_normal_bias ⇒ Object
Returns the value of attribute shadow_normal_bias.
9 10 11 |
# File 'lib/three/lights/light.rb', line 9 def shadow_normal_bias @shadow_normal_bias end |
#shadow_radius ⇒ Object
Returns the value of attribute shadow_radius.
9 10 11 |
# File 'lib/three/lights/light.rb', line 9 def shadow_radius @shadow_radius end |
Instance Method Details
#dispose ⇒ Object
56 57 58 |
# File 'lib/three/lights/light.rb', line 56 def dispose dispatch_event(:dispose) end |
#to_h ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/three/lights/light.rb', line 60 def to_h super.merge( color: @color.hex, intensity: @intensity, shadow_map_size: @shadow_map_size.dup, shadow_bias: @shadow_bias, shadow_normal_bias: @shadow_normal_bias, shadow_radius: @shadow_radius ) end |