Pārlūkot izejas kodu

"Point light" Tweak

legacy
Benjamin ‘Touky’ Huet touky pirms 12 gadiem
vecāks
revīzija
828734c3f2
2 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. +1
    -1
      src/easymesh/easymesh.cpp
  2. +3
    -2
      src/easymesh/shiny.lolfx

+ 1
- 1
src/easymesh/easymesh.cpp Parādīt failu

@@ -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 Parādīt failu

@@ -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);



Notiek ielāde…
Atcelt
Saglabāt