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

- old
+ new

@@ -11,12 +11,11 @@ @id = (@@id ||= 1).tap { @@id += 1 } @renderer = renderer compile_and_link_program(material, parameters) - material_impl = material.implementation(@renderer) - cache_uniform_locations(material_impl.shader[:uniforms] || {}, parameters) + cache_uniform_locations(material.shader[:uniforms] || {}, parameters) cache_attribute_locations(material.attributes || {}, parameters) @code = code @used_times = 2 end @@ -147,11 +146,10 @@ 'ENVMAP_BLENDING_MULTIPLY' end end def compile_shaders(material, parameters) - material_impl = material.implementation(@renderer) shadow_map_type_define = get_shadow_map_define(parameters[:shadow_map_type]) env_map_type_define = get_env_map_type_define(parameters[:env_map], material) env_map_mode_define = get_env_map_mode_define(parameters[:env_map], material) env_map_blending_define = get_env_map_blending_define(parameters[:env_map], material) @@ -166,11 +164,11 @@ else prefix_vertex = File.read(File.expand_path('../../shaders/shader_templates/vertex.glsl.erb', __FILE__)) prefix_fragment = File.read(File.expand_path('../../shaders/shader_templates/fragment.glsl.erb', __FILE__)) end - @vertex_shader = OpenGLShader.new(GL_VERTEX_SHADER, compile_shader_template(prefix_vertex + material_impl.shader[:vertex_shader], binding)) - @fragment_shader = OpenGLShader.new(GL_FRAGMENT_SHADER, compile_shader_template(prefix_fragment + material_impl.shader[:fragment_shader], binding)) + @vertex_shader = OpenGLShader.new(GL_VERTEX_SHADER, compile_shader_template(prefix_vertex + material.shader[:vertex_shader], binding)) + @fragment_shader = OpenGLShader.new(GL_FRAGMENT_SHADER, compile_shader_template(prefix_fragment + material.shader[:fragment_shader], binding)) glAttachShader(@program, @vertex_shader.shader) glAttachShader(@program, @fragment_shader.shader) end