mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 04:25:00 +01:00
Add basic lighting
This commit is contained in:
parent
45acd4c1ac
commit
d1df7cd472
4 changed files with 58 additions and 17 deletions
16
shaders/lighting.glsl
Normal file
16
shaders/lighting.glsl
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
uniform sampler2D texture;
|
||||
uniform float ambient;
|
||||
uniform bool has_texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
// lookup the pixel in the texture
|
||||
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
|
||||
|
||||
// multiply it by the color
|
||||
vec4 col = gl_Color;
|
||||
if (has_texture) {
|
||||
col = gl_Color * pixel;
|
||||
}
|
||||
gl_FragColor = vec4(col.x * ambient, col.y * ambient, col.z * ambient, col.w);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue