1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #version 430
- layout (location = 0) in vec3 position;
- layout (location = 1) in vec4 color;
- layout (location = 2) in vec2 textureCoord;
- layout (location = 3) in vec3 normal;
- uniform mat4 projMatrix;
- uniform mat4 viewMatrix;
- uniform mat4 modelMatrix;
- uniform bool useTexture;
- uniform bool useColor;
- uniform bool useMixColor;
- uniform vec4 mixColor;
- uniform bool useNormals;
- out vec3 varPosition;
- out vec2 varTextureCoord;
- out vec4 varColor;
- out vec3 varNormal;
- void main(void)
- {
- varNormal = normal;
- varTextureCoord = textureCoord;
- varColor = vec4(color.xyz, 1);
- if(useNormals)
- {
- if(abs(normal.x) == 1)
- {
- varColor = varColor * 0.8;
- }
- if(abs(normal.z) == 1)
- {
- varColor = varColor * 0.9;
- }
- }
-
- vec4 worldPos = modelMatrix * vec4(position, 1.0);
- varPosition = worldPos.xyz;
- gl_Position = projMatrix * viewMatrix * worldPos;
- }
|