diff --git a/.vs/shader/v14/.suo b/.vs/shader/v14/.suo index d2da945..ec6cbff 100644 Binary files a/.vs/shader/v14/.suo and b/.vs/shader/v14/.suo differ diff --git a/model.cpp b/model.cpp index 3f8d0cd..f7060f5 100644 --- a/model.cpp +++ b/model.cpp @@ -112,7 +112,9 @@ void Model::Init(const char*modelPath) { void Model::Draw(glm::mat4 & viewMatrix, glm::mat4 projectionMatrix) { glEnable(GL_DEPTH_TEST); mVertexBuffer->Bind(); + glm::mat4 it = glm::inverseTranspose(mModelMatrix); mShader->Bind(glm::value_ptr(mModelMatrix), glm::value_ptr(viewMatrix), glm::value_ptr(projectionMatrix)); + glUniformMatrix4fv(glGetUniformLocation(mShader->mProgram, "IT_ModelMatrix"), 1, GL_FALSE, glm::value_ptr(it)); glDrawArrays(GL_TRIANGLES, 0, mVertexBuffer->mVertexCount); mVertexBuffer->Unbind(); } diff --git a/shader.VC.db b/shader.VC.db index 9c2b5ca..78937d8 100644 Binary files a/shader.VC.db and b/shader.VC.db differ diff --git a/shader.cpp b/shader.cpp index 3615b43..73238ce 100644 --- a/shader.cpp +++ b/shader.cpp @@ -42,7 +42,9 @@ void Shader::Bind(float *M, float *V, float*P) { glBindTexture(GL_TEXTURE_2D, iter->second->mTexture); glUniform1i(iter->second->mLocation, iIndex++); } - + for (auto iter = mUniformVec4s.begin(); iter != mUniformVec4s.end(); ++iter) { + glUniform4fv(iter->second->mLocation, 1, iter->second->v); + } glEnableVertexAttribArray(mPositionLocation); glVertexAttribPointer(mPositionLocation, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);