mirror of
https://github.com/guezoloic/LearnOpenGL.git
synced 2026-03-28 18:03:44 +00:00
feat: replace triangle test by cube
This commit is contained in:
@@ -1,31 +1,11 @@
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
struct Material
|
||||
{
|
||||
sampler2D diffuse;
|
||||
vec3 specular;
|
||||
float shininess;
|
||||
};
|
||||
struct Light
|
||||
{
|
||||
vec3 position;
|
||||
|
||||
vec3 ambient;
|
||||
vec3 diffuse;
|
||||
vec3 specular;
|
||||
};
|
||||
|
||||
in vec3 FragPos;
|
||||
in vec3 Normal;
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform vec3 viewPos;
|
||||
uniform Material material;
|
||||
uniform Light light;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 texColor = texture(material.diffuse , TexCoords);
|
||||
FragColor = texColor;
|
||||
FragColor = vec4(0.8, 0.8, 1.0, 1.0);
|
||||
}
|
||||
|
||||
@@ -8,15 +8,7 @@ uniform mat4 projection;
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
|
||||
out vec3 Normal;
|
||||
out vec3 FragPos;
|
||||
out vec2 TexCoords;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragPos = vec3(model*vec4(aPos , 1.0));
|
||||
gl_Position = projection*view*vec4(FragPos , 1.0);
|
||||
|
||||
Normal = mat3(transpose(inverse(model)))*aNormal;
|
||||
TexCoords = aTexCoords;
|
||||
gl_Position = projection * view * model * vec4(aPos, 1.0);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#version 330 core
|
||||
|
||||
out vec4 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
color = vec4(1.0f, 0.5f, 0.2f, 1.0f);
|
||||
color = vec4(0.2, 0.51, 1.0, 1.0);
|
||||
}
|
||||
@@ -13,7 +13,6 @@ namespace mesh
|
||||
0.5f, -0.5f, 0.0f,
|
||||
0.0f, 0.5f, 0.0f
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
constexpr const std::size_t P_TRIANGLE_VERTICE_LEN =
|
||||
sizeof(P_TRIANGLE_VERTICE) / sizeof(GLfloat);
|
||||
|
||||
Reference in New Issue
Block a user