feat: basic texture support

- add texture support (ambient, diffuse, specular)
- use opacity in fragment shader
- calculate normal matrix on cpu for matricies with big determinants
This commit is contained in:
2023-11-02 04:15:59 +02:00
committed by Illusion
parent 4b15990703
commit 08659a0a78
9 changed files with 190 additions and 181 deletions
+5 -1
View File
@@ -10,11 +10,15 @@ uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform mat3 normalMatrix;
uniform bool useNormalMatrix;
void main()
{
gl_Position = projection * view * model * vec4(aPos, 1.0f);
fragNormals = normalMatrix * aNormal;
if (useNormalMatrix)
fragNormals = normalMatrix * aNormal;
else
fragNormals = mat3(transpose(inverse(model))) * aNormal;
fragPos = vec3(model * vec4(aPos, 1.0));
texCoords = aTexCoords;
}