feat: light rendering
This commit is contained in:
@ -75,6 +75,8 @@ void Renderer::Render(entt::registry& registry) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_shader.setBool("isLight", registry.all_of<light>(entity));
|
||||||
|
|
||||||
m_model = glm::mat4(1.0f);
|
m_model = glm::mat4(1.0f);
|
||||||
|
|
||||||
// Apply translation
|
// Apply translation
|
||||||
|
@ -27,6 +27,8 @@ uniform float opacity;
|
|||||||
uniform sampler2D diffuseTex;
|
uniform sampler2D diffuseTex;
|
||||||
uniform bool useTexture;
|
uniform bool useTexture;
|
||||||
|
|
||||||
|
uniform bool isLight;
|
||||||
|
|
||||||
#define LIGHT_COLOR vec3(1.0, 1.0, 1.0)
|
#define LIGHT_COLOR vec3(1.0, 1.0, 1.0)
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
@ -57,5 +59,11 @@ void main()
|
|||||||
|
|
||||||
vec3 result = (ambient + diffuse + specular) * texColor;
|
vec3 result = (ambient + diffuse + specular) * texColor;
|
||||||
|
|
||||||
|
if (isLight) {
|
||||||
|
vec3 emissive = LIGHT_COLOR * 10.0; // big intensity
|
||||||
|
FragColor = vec4(emissive, 1.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FragColor = vec4(result, opacity);
|
FragColor = vec4(result, opacity);
|
||||||
}
|
}
|
Reference in New Issue
Block a user