UPD: Use texture for coloring

This commit is contained in:
sebastian 2026-08-02 08:59:30 +02:00
parent cfe51648bd
commit 0b2f7ba60f
3 changed files with 14 additions and 3 deletions

View File

@ -1,12 +1,12 @@
# Blender 5.2.0 LTS MTL File: 'chess.blend' # Blender 5.2.0 LTS MTL File: 'None'
# www.blender.org # www.blender.org
newmtl Material.002 newmtl Material.002
Ns 735.817688 Ns 735.817688
Ka 1.000000 1.000000 1.000000 Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000 Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000 Ke 0.000000 0.000000 0.000000
Ni 1.450000 Ni 1.450000
d 1.000000 d 1.000000
illum 2 illum 2
map_Kd chess_blue.png

View File

@ -1,7 +1,10 @@
#version 460 core #version 460 core
in vec2 pass_textureCoords;
uniform sampler2D textureSampler;
out vec4 fragColor; out vec4 fragColor;
void main() { void main() {
fragColor = vec4(1.0, 0.5, 0.2, 1.0); fragColor = texture(textureSampler, pass_textureCoords);
} }

View File

@ -1,11 +1,19 @@
#version 460 core #version 460 core
layout(location = 0) in vec3 position; layout(location = 0) in vec3 position;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 textureCoords;
uniform mat4 transformationMatrix; uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix; uniform mat4 projectionMatrix;
uniform mat4 viewMatrix; uniform mat4 viewMatrix;
out vec2 pass_textureCoords;
out vec3 surfaceNormal;
void main() { void main() {
vec4 worldPosition = transformationMatrix * vec4(position, 1.0f); vec4 worldPosition = transformationMatrix * vec4(position, 1.0f);
gl_Position = projectionMatrix * viewMatrix * worldPosition; gl_Position = projectionMatrix * viewMatrix * worldPosition;
pass_textureCoords = textureCoords;
surfaceNormal = (transformationMatrix * vec4(normal , 0.f)).xyz;
} }