lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb in mittsu-0.1.2 vs lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb in mittsu-0.1.3

- old
+ new

@@ -47,14 +47,14 @@ fragment_shader: depth_shader.fragment_shader, morph_targets: true, skinning: 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 + @depth_material.shadow_pass = true + @depth_material_morph.shadow_pass = true + @depth_material_skin.shadow_pass = true + @depth_material_morph_skin.shadow_pass = true end def render(scene, camera) return unless @renderer.shadow_map_enabled @@ -120,10 +120,11 @@ end pars = { min_filter: shadow_filter, mag_filter: shadow_filter, format: RGBAFormat } light.shadow_map = OpenGLRenderTarget.new(light.shadow_map_width, light.shadow_map_height, pars) + light.shadow_map.renderer = @renderer light.shadow_map_size = Vector2.new(light.shadow_map_width, light.shadow_map_height) light.shadow_matrix = Matrix4.new end @@ -140,14 +141,13 @@ scene.add(light.shadow_camera) scene.update_matrix_world if scene.auto_update end - 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) + if light.shadow_camera_visible && !light.camera_helper + light.camera_helper = CameraHelper.new(light.shadow_camera) + scene.add(light.camera_helper) end if light.virtual? && virtual_light.original_camera == camera update_shadow_camera(camera, light) end @@ -166,12 +166,12 @@ shadow_camera.matrix_world_inverse.inverse(shadow_camera.matrix_world) # - light_impl.camera_helper.visible = light.shadow_camera_visible if light_impl.camera_helper - light_impl.camera_helper.update if light.shadow_camera_visible + light.camera_helper.visible = light.shadow_camera_visible if light.camera_helper + light.camera_helper.update_points if light.shadow_camera_visible # compute shadow matrix shadow_matrix.set( 0.5, 0.0, 0.0, 0.5, @@ -272,11 +272,10 @@ 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_impl = object.implementation(@renderer) - object_impl.model_view_matrix.multiply_matrices(shadow_camera.matrix_world_inverse, object.matrix_world) + object.model_view_matrix.multiply_matrices(shadow_camera.matrix_world_inverse, object.matrix_world) @render_list << opengl_object end end object.children.each do |child|