Adding textures capabilities

* Added Texures to the two sample cubes
* Modified mesh structure
	- mesh now contains indices and vertices
	- Vertices contain vertices and uv's (later on they will also
	contain normals)

Solution definitely not perfect and needs improvement.
This commit is contained in:
2022-06-05 01:44:54 +02:00
parent d019155d10
commit 16b61986a1
17 changed files with 8412 additions and 272 deletions

View File

@ -1,9 +1,14 @@
#version 440 core
out vec4 FragColor;
uniform vec3 MatColour;
void main(){
FragColor = vec4(MatColour, 1.0f);
#version 440 core
out vec4 FragColor;
uniform vec3 Color;
in vec2 TexCoord;
uniform sampler2D Texture;
void main(){
FragColor = mix ( texture(Texture, TexCoord), vec4(Color, 1.0f));
}

View File

@ -1,10 +1,15 @@
#version 440 core
in layout(location=0) vec3 aPos;
in layout(location=1) vec2 uv;
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
out vec2 TexCoord;
void main() {
TexCoord = uv;
gl_Position = P * V * M * vec4(aPos.x, aPos.y, aPos.z, 1.0);
}