Class: Mittsu::DirectionalLight
- Defined in:
- lib/mittsu/lights/directional_light.rb
Constant Summary
Constants inherited from Object3D
Instance Attribute Summary collapse
-
#cast_shadow ⇒ Object
Returns the value of attribute cast_shadow.
-
#shadow_bias ⇒ Object
Returns the value of attribute shadow_bias.
-
#shadow_camera ⇒ Object
Returns the value of attribute shadow_camera.
-
#shadow_camera_bottom ⇒ Object
Returns the value of attribute shadow_camera_bottom.
-
#shadow_camera_far ⇒ Object
Returns the value of attribute shadow_camera_far.
-
#shadow_camera_left ⇒ Object
Returns the value of attribute shadow_camera_left.
-
#shadow_camera_near ⇒ Object
Returns the value of attribute shadow_camera_near.
-
#shadow_camera_right ⇒ Object
Returns the value of attribute shadow_camera_right.
-
#shadow_camera_top ⇒ Object
Returns the value of attribute shadow_camera_top.
-
#shadow_camera_visible ⇒ Object
Returns the value of attribute shadow_camera_visible.
-
#shadow_cascade ⇒ Object
Returns the value of attribute shadow_cascade.
-
#shadow_cascade_array ⇒ Object
Returns the value of attribute shadow_cascade_array.
-
#shadow_cascade_bias ⇒ Object
Returns the value of attribute shadow_cascade_bias.
-
#shadow_cascade_count ⇒ Object
Returns the value of attribute shadow_cascade_count.
-
#shadow_cascade_far_z ⇒ Object
Returns the value of attribute shadow_cascade_far_z.
-
#shadow_cascade_height ⇒ Object
Returns the value of attribute shadow_cascade_height.
-
#shadow_cascade_near_z ⇒ Object
Returns the value of attribute shadow_cascade_near_z.
-
#shadow_cascade_offset ⇒ Object
Returns the value of attribute shadow_cascade_offset.
-
#shadow_cascade_width ⇒ Object
Returns the value of attribute shadow_cascade_width.
-
#shadow_darkness ⇒ Object
Returns the value of attribute shadow_darkness.
-
#shadow_map ⇒ Object
Returns the value of attribute shadow_map.
-
#shadow_map_height ⇒ Object
Returns the value of attribute shadow_map_height.
-
#shadow_map_size ⇒ Object
Returns the value of attribute shadow_map_size.
-
#shadow_map_width ⇒ Object
Returns the value of attribute shadow_map_width.
-
#shadow_matrix ⇒ Object
Returns the value of attribute shadow_matrix.
-
#target ⇒ Object
Returns the value of attribute target.
Attributes inherited from Light
#color, #distance, #intensity, #only_shadow
Attributes inherited from Object3D
#children, #frustum_culled, #geometry, #id, #matrix, #matrix_auto_update, #matrix_world, #matrix_world_needs_update, #name, #parent, #position, #quaternion, #receive_shadow, #render_order, #rotation, #rotation_auto_update, #scale, #type, #up, #user_data, #uuid, #visible
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(color = nil, intensity = 1.0) ⇒ DirectionalLight
constructor
A new instance of DirectionalLight.
- #virtual? ⇒ Boolean
Methods inherited from Object3D
#add, #apply_matrix, #get_object_by_id, #get_object_by_name, #get_object_by_property, #get_world_direction, #get_world_position, #get_world_quaternion, #get_world_rotation, #get_world_scale, #local_to_world, #look_at, #print_tree, #raycast, #remove, #rotate_on_axis, #rotate_x, #rotate_y, #rotate_z, #set_rotation_from_axis_angle, #set_rotation_from_euler, #set_rotation_from_matrix, #set_rotation_from_quaternion, #to_json, #to_s, #translate_on_axis, #translate_x, #translate_y, #translate_z, #traverse, #traverse_ancestors, #traverse_visible, #update_matrix, #update_matrix_world, #world_to_local
Methods included from EventDispatcher
#add_event_listener, #dispatch_event, #has_event_listener, #remove_event_listener
Constructor Details
#initialize(color = nil, intensity = 1.0) ⇒ DirectionalLight
Returns a new instance of DirectionalLight.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/mittsu/lights/directional_light.rb', line 32 def initialize(color = nil, intensity = 1.0) super(color) @type = 'DirectionalLight' @position.set(0.0, 1.0, 0.0) @target = Object3D.new @intensity = intensity @cast_shadow = false @only_shadow = false # @shadow_camera_near = 50.0 @shadow_camera_far = 5000.0 @shadow_camera_left = -500.0 @shadow_camera_right = 500.0 @shadow_camera_top = 500.0 @shadow_camera_bottom = -500.0 @shadow_camera_visible = false @shadow_bias = 0 @shadow_darkness = 0.5 @shadow_map_width = 512 @shadow_map_height = 512 # @shadow_cascade = false @shadow_cascade_offset = Vector3.new(0.0, 0.0, -1000.0) @shadow_cascade_count = 2 @shadow_cascade_bias = [0, 0, 0] @shadow_cascade_width = [512, 512, 512] @shadow_cascade_height = [512, 512, 512] @shadow_cascade_near_z = [-1.000, 0.990, 0.998] @shadow_cascade_far_z = [0.990, 0.998, 1.000] @shadow_cascade_array = [] # @shadow_map = nil @shadow_map_size = nil @shadow_camera = nil @shadow_matrix = nil end |
Instance Attribute Details
#cast_shadow ⇒ Object
Returns the value of attribute cast_shadow.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def cast_shadow @cast_shadow end |
#shadow_bias ⇒ Object
Returns the value of attribute shadow_bias.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_bias @shadow_bias end |
#shadow_camera ⇒ Object
Returns the value of attribute shadow_camera.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_camera @shadow_camera end |
#shadow_camera_bottom ⇒ Object
Returns the value of attribute shadow_camera_bottom.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_camera_bottom @shadow_camera_bottom end |
#shadow_camera_far ⇒ Object
Returns the value of attribute shadow_camera_far.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_camera_far @shadow_camera_far end |
#shadow_camera_left ⇒ Object
Returns the value of attribute shadow_camera_left.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_camera_left @shadow_camera_left end |
#shadow_camera_near ⇒ Object
Returns the value of attribute shadow_camera_near.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_camera_near @shadow_camera_near end |
#shadow_camera_right ⇒ Object
Returns the value of attribute shadow_camera_right.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_camera_right @shadow_camera_right end |
#shadow_camera_top ⇒ Object
Returns the value of attribute shadow_camera_top.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_camera_top @shadow_camera_top end |
#shadow_camera_visible ⇒ Object
Returns the value of attribute shadow_camera_visible.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_camera_visible @shadow_camera_visible end |
#shadow_cascade ⇒ Object
Returns the value of attribute shadow_cascade.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_cascade @shadow_cascade end |
#shadow_cascade_array ⇒ Object
Returns the value of attribute shadow_cascade_array.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_cascade_array @shadow_cascade_array end |
#shadow_cascade_bias ⇒ Object
Returns the value of attribute shadow_cascade_bias.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_cascade_bias @shadow_cascade_bias end |
#shadow_cascade_count ⇒ Object
Returns the value of attribute shadow_cascade_count.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_cascade_count @shadow_cascade_count end |
#shadow_cascade_far_z ⇒ Object
Returns the value of attribute shadow_cascade_far_z.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_cascade_far_z @shadow_cascade_far_z end |
#shadow_cascade_height ⇒ Object
Returns the value of attribute shadow_cascade_height.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_cascade_height @shadow_cascade_height end |
#shadow_cascade_near_z ⇒ Object
Returns the value of attribute shadow_cascade_near_z.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_cascade_near_z @shadow_cascade_near_z end |
#shadow_cascade_offset ⇒ Object
Returns the value of attribute shadow_cascade_offset.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_cascade_offset @shadow_cascade_offset end |
#shadow_cascade_width ⇒ Object
Returns the value of attribute shadow_cascade_width.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_cascade_width @shadow_cascade_width end |
#shadow_darkness ⇒ Object
Returns the value of attribute shadow_darkness.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_darkness @shadow_darkness end |
#shadow_map ⇒ Object
Returns the value of attribute shadow_map.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_map @shadow_map end |
#shadow_map_height ⇒ Object
Returns the value of attribute shadow_map_height.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_map_height @shadow_map_height end |
#shadow_map_size ⇒ Object
Returns the value of attribute shadow_map_size.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_map_size @shadow_map_size end |
#shadow_map_width ⇒ Object
Returns the value of attribute shadow_map_width.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_map_width @shadow_map_width end |
#shadow_matrix ⇒ Object
Returns the value of attribute shadow_matrix.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def shadow_matrix @shadow_matrix end |
#target ⇒ Object
Returns the value of attribute target.
5 6 7 |
# File 'lib/mittsu/lights/directional_light.rb', line 5 def target @target end |
Instance Method Details
#clone ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/mittsu/lights/directional_light.rb', line 87 def clone light = DirectionalLight.new super(light) light.target = @target.clone light.intensity = @intensity light.cast_shadow = @cast_shadow light.only_shadow = @only_shadow # light.shadow_camera_near = @shadow_camera_near light.shadow_camera_far = @shadow_camera_far light.shadow_camera_left = @shadow_camera_left light.shadow_camera_right = @shadow_camera_right light.shadow_camera_top = @shadow_camera_top light.shadow_camera_bottom = @shadow_camera_bottom light.shadow_camera_visible = @shadow_camera_visible light.shadow_bias = @shadow_bias light.shadow_darkness = @shadow_darkness light.shadow_map_width = @shadow_map_width light.shadow_map_height = @shadow_map_height # light.shadow_cascade = @shadow_cascade light.shadow_cascade_offset.copy(@shadow_cascade_offset) light.shadow_cascade_count = @shadow_cascade_count light.shadow_cascade_bias = @shadow_cascade_bias.dup light.shadow_cascade_width = @shadow_cascade_width.dup light.shadow_cascade_height = @shadow_cascade_height.dup light.shadow_cascade_near_z = @shadow_cascade_near_z.dup light.shadow_cascade_far_z = @shadow_cascade_far_z.dup end |
#virtual? ⇒ Boolean
131 132 133 |
# File 'lib/mittsu/lights/directional_light.rb', line 131 def virtual? false end |