From bac80e3514f93055daa4e743fa4f8ba177f77311 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sun, 19 Dec 2021 17:00:13 +0500 Subject: Added per vertex lighting --- cwd/assets/altcraft/shaders/vert/face.vs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'cwd') diff --git a/cwd/assets/altcraft/shaders/vert/face.vs b/cwd/assets/altcraft/shaders/vert/face.vs index d3caf32..101e4d0 100644 --- a/cwd/assets/altcraft/shaders/vert/face.vs +++ b/cwd/assets/altcraft/shaders/vert/face.vs @@ -1,13 +1,11 @@ #version 330 core in vec3 pos[4]; -in vec3 normal; in vec2 uv[4]; -in float uvLayer; -in float animation; +in vec2 light[4]; +in vec3 normal; in vec3 color; -in vec2 light; -in float ambientOcclusion; +in vec3 layerAnimationAo; out vec3 faceTextureUv; out vec3 faceNormal; @@ -30,11 +28,11 @@ layout (std140) uniform Globals { void main() { gl_Position = projView * vec4(pos[gl_VertexID], 1.0f); - faceTextureUv = vec3(uv[gl_VertexID], uvLayer); - faceTextureUv.y -= (uv[2].y - uv[0].y) * trunc(mod(globalTime * 4.0f, animation)); + faceTextureUv = vec3(uv[gl_VertexID], layerAnimationAo.r); + faceTextureUv.y -= (uv[2].y - uv[0].y) * trunc(mod(globalTime * 4.0f, layerAnimationAo.g)); faceNormal = (view * vec4(normal, 0.0f)).xyz; faceAddColor = color; - faceLight = light; - faceAmbientOcclusion = ambientOcclusion; + faceLight = light[gl_VertexID]; + faceAmbientOcclusion = layerAnimationAo.b; } -- cgit v1.2.3