diff --git a/src/easymesh/easymesh.cpp b/src/easymesh/easymesh.cpp index f4a34ed3..e6c1607c 100644 --- a/src/easymesh/easymesh.cpp +++ b/src/easymesh/easymesh.cpp @@ -118,7 +118,7 @@ void EasyMesh::Render(mat4 const &model, float damage) m_gpu.shader->Bind(); m_gpu.shader->SetUniform(m_gpu.modelview, modelview); - m_gpu.shader->SetUniform(m_gpu.model, model); + m_gpu.shader->SetUniform(m_gpu.model, Scene::GetDefault()->GetViewMatrix()); m_gpu.shader->SetUniform(m_gpu.proj, Scene::GetDefault()->GetProjMatrix()); m_gpu.shader->SetUniform(m_gpu.normalmat, normalmat); m_gpu.shader->SetUniform(m_gpu.damage, damage); diff --git a/src/easymesh/shiny.lolfx b/src/easymesh/shiny.lolfx index 28929220..4c380457 100644 --- a/src/easymesh/shiny.lolfx +++ b/src/easymesh/shiny.lolfx @@ -37,6 +37,7 @@ precision highp float; #endif uniform float in_Damage; +uniform mat4 in_Model; varying vec4 pass_Eye; varying vec3 pass_TNormal; @@ -45,7 +46,7 @@ varying vec4 pass_Color; // FIXME: the light direction should be passed in the code vec3 in_LightDir = vec3(0.3, 0.3, 0.7); -vec3 in_Light2_Pos = vec3(0.0, 100.0, 0.0); +vec4 in_Light2_Pos = in_Model * vec4(0.0, 0.0, 0.0, 1.0); void main(void) { @@ -81,7 +82,7 @@ void main(void) */ //Light calculation for point light - s = normalize(pass_TPos.xyz - in_Light2_Pos); + s = normalize(pass_Eye.xyz - in_Light2_Pos.xyz); //(pass_TPos.xyz - in_Light2_Pos); v = normalize(-pass_Eye.xyz); r = reflect(-s, pass_TNormal);