diff --git a/panda/src/glstuff/glCgShaderContext_src.cxx b/panda/src/glstuff/glCgShaderContext_src.cxx index a2b867969b..50ecab80d0 100755 --- a/panda/src/glstuff/glCgShaderContext_src.cxx +++ b/panda/src/glstuff/glCgShaderContext_src.cxx @@ -370,6 +370,9 @@ issue_parameters(int altered) { GLfr(cgGLSetMatrixParameter)(p, upper3.get_data()); continue; } + case Shader::SMP_cell15: + GLf(cgGLSetParameter1)(p, data[15]); + continue; } } } diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 5b1c3effb9..940ee790c5 100755 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -374,6 +374,10 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext bind._piece = Shader::SMP_row3x3; s->_mat_spec.push_back(bind); continue; + } else if (noprefix == "Material.shininess") { + bind._piece = Shader::SMP_cell15; + s->_mat_spec.push_back(bind); + continue; } } if (noprefix == "ColorScale") { @@ -938,6 +942,9 @@ issue_parameters(int altered) { _glgsg->_glUniformMatrix3fv(p, 1, true, upper3.get_data()); continue; } + case Shader::SMP_cell15: + _glgsg->_glUniform1fv(p, 1, data+15); + continue; } } } @@ -993,6 +1000,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { Geom::NumericType numeric_type; int start, stride, num_values; int nvarying = _shader->_var_spec.size(); + for (int i = 0; i < nvarying; ++i) { InternalName *name = _shader->_var_spec[i]._name; int texslot = _shader->_var_spec[i]._append_uv; @@ -1007,8 +1015,8 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { } } if (_glgsg->_data_reader->get_array_info(name, - array_reader, num_values, numeric_type, - start, stride)) { + array_reader, num_values, numeric_type, + start, stride)) { const unsigned char *client_pointer; if (!_glgsg->setup_array_data(client_pointer, array_reader, force)) { return false; @@ -1024,6 +1032,8 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { _glgsg->_glVertexAttribPointer(p, num_values, _glgsg->get_numeric_type(numeric_type), GL_TRUE, stride, client_pointer + start); } + } else { + _glgsg->_glDisableVertexAttribArray(p); } } } diff --git a/panda/src/gobj/shader.h b/panda/src/gobj/shader.h index 44682f7c91..1fbff80bd1 100755 --- a/panda/src/gobj/shader.h +++ b/panda/src/gobj/shader.h @@ -234,6 +234,7 @@ public: SMP_row3x3, SMP_upper3x3, SMP_transpose3x3, + SMP_cell15, }; enum ShaderStateDep { @@ -362,6 +363,7 @@ public: int _dep[2]; PT(InternalName) _arg; ShaderArgInfo _info; + ShaderPtrType _type; }; class ShaderCaps {