lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb in mittsu-0.1.1 vs lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb in mittsu-0.1.2
- old
+ new
@@ -47,14 +47,14 @@
fragment_shader: depth_shader.fragment_shader,
morph_targets: true,
skinning: true
)
- @depth_material[:_shadow_pass] = true
- @depth_material_morph[:_shadow_pass] = true
- @depth_material_skin[:_shadow_pass] = true
- @depth_material_morph_skin[:_shadow_pass] = true
+ @depth_material.implementation(renderer).shadow_pass = true
+ @depth_material_morph.implementation(renderer).shadow_pass = true
+ @depth_material_skin.implementation(renderer).shadow_pass = true
+ @depth_material_morph_skin.implementation(renderer).shadow_pass = true
end
def render(scene, camera)
return unless @renderer.shadow_map_enabled
@@ -140,13 +140,14 @@
scene.add(light.shadow_camera)
scene.update_matrix_world if scene.auto_update
end
- if light.shadow_camera_visible && !light[:camera_helper]
- light[:camera_helper] = CameraHelper.new(light.shadow_camera)
- scene.add(light[:camera_helper])
+ light_impl = light.implementation(@renderer)
+ if light.shadow_camera_visible && !light_impl.camera_helper
+ light_impl.camera_helper = CameraHelper.new(light.shadow_camera)
+ scene.add(light_impl.camera_helper)
end
if light.virtual? && virtual_light.original_camera == camera
update_shadow_camera(camera, light)
end
@@ -165,12 +166,12 @@
shadow_camera.matrix_world_inverse.inverse(shadow_camera.matrix_world)
#
- light[:camera_helper].visible = light.shadow_camera_visible if light[:camera_helper]
- light[:camera_helper].update if light.shadow_camera_visible
+ light_impl.camera_helper.visible = light.shadow_camera_visible if light_impl.camera_helper
+ light_impl.camera_helper.update if light.shadow_camera_visible
# compute shadow matrix
shadow_matrix.set(
0.5, 0.0, 0.0, 0.5,
@@ -271,10 +272,11 @@
if object.visible
opengl_objects = @opengl_objects[object.id]
if opengl_objects && object.cast_shadow && (object.frustum_culled == false || @frustum.intersects_object?(object) == true)
opengl_objects.each do |opengl_object|
- object[:_model_view_matrix].multiply_matrices(shadow_camera.matrix_world_inverse, object.matrix_world)
+ object_impl = object.implementation(@renderer)
+ object_impl.model_view_matrix.multiply_matrices(shadow_camera.matrix_world_inverse, object.matrix_world)
@render_list << opengl_object
end
end
object.children.each do |child|