瀏覽代碼

"Point light" Tweak

legacy
Benjamin ‘Touky’ Huet touky 12 年之前
父節點
當前提交
828734c3f2
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. +1
    -1
      src/easymesh/easymesh.cpp
  2. +3
    -2
      src/easymesh/shiny.lolfx

+ 1
- 1
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);


+ 3
- 2
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);



Loading…
取消
儲存