Merge: roberto -> main

This commit is contained in:
PedroEdiaz
2024-10-17 22:30:55 -06:00
parent 252aab3dd2
commit 7c1f691b46
9 changed files with 133 additions and 59 deletions

View File

@@ -2,6 +2,7 @@ const char * vs =
"#version 330 core\n"
"layout (location = 0) in vec3 aPos;"
"layout (location = 1) in vec3 aNormal;"
"uniform float idx;"
"uniform mat4 fix;"
@@ -9,13 +10,19 @@ const char * vs =
"uniform mat4 mdl;"
"out float index;"
"out vec3 Normal;"
"out vec3 FragPos;"
"void main()"
"{"
" index=idx;"
" Normal = mat3(transpose(inverse(rot*mdl))) * aNormal;"
" gl_Position = fix * rot * mdl * vec4( aPos, 1.0 );\n"
" FragPos = vec3( rot * mdl * vec4(aPos, 1.0));"
"}";
const char * fs =
"#version 330 core\n"
@@ -23,8 +30,19 @@ const char * fs =
"in float index;"
"out vec4 FragColor;"
"in vec3 Normal;"
"in vec3 FragPos;"
"void main()"
"{"
" FragColor = texture( palette, vec3( 0, 0, index ) ).rgba;"
" vec4 color = texture( palette, vec3( 0, 0, index ) ).rgba;"
" vec3 lightPos = vec3(0,0,-15);"
" vec3 lightDir = normalize(lightPos - FragPos);"
" float diffuse = max(dot(Normal, lightDir), 0.0);"
" float ambient = 0.5;"
" FragColor = (ambient + diffuse)*color;"
"}";