Initial commit - restart from existing code

This commit is contained in:
Tom Ray
2026-02-13 19:15:05 +01:00
parent 11df621bb2
commit 7c352bc280
1906 changed files with 491226 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
#version 330 core
// The result : color of the fragment.
out vec4 FragColor;
// The input variable from the vertex shader (same name and same type).
in vec3 color;
in vec2 TexCoords;
uniform float intensity;
uniform vec4 colorDiffuse0; // Input Color.
uniform sampler2D textureDiffuse0;
void main() {
vec3 ambient = vec3(0.7333, 0.7333, 0.7333);
vec3 diffuse = color;
FragColor = intensity * vec4(ambient + diffuse, 1.0)*colorDiffuse0 * texture(textureDiffuse0, TexCoords);
}

View File

@@ -0,0 +1,32 @@
#version 330 core
// Input : vertex attributes.
layout (location = 0) in vec3 aPos; // Position of the vertex.
layout (location = 1) in vec3 aNormal; // Normal of the vertex.
layout (location = 2) in vec2 aTexCoords; // Texture coordonate of the vertex.
layout (location = 3) in vec3 aTangent; // Texture coordonate of the vertex.
layout (location = 4) in vec3 aBitangent; // Texture coordonate of the vertex.
// The result : color of the fragment.
out vec3 color;
out vec2 TexCoords;
// Uniform input variable.
uniform mat4 projection; // Projection of the camera.
uniform mat4 model; // Transforms transformation.
uniform mat4 view; // View transformation of the camera.
uniform vec3 lightPos;
void main() {
gl_Position = projection * view * model * vec4(aPos, 1.0);
vec4 newPos = model * vec4(aPos, 1.0);
// vec4 newNormal = model * vec4(aNormal, 1.0);
vec3 newPos3 = newPos.xyz;
// vec3 newNormal3 = newNormal.xyz;
vec3 newNormal3 = mat3(transpose(inverse(model))) * aNormal;
vec3 lightVec = vec3(normalize((lightPos - newPos3)));
float diffuse = dot(lightVec, newNormal3);
//color = vec3(1,1,1);
color = vec3(diffuse);
TexCoords = aTexCoords;
}