Grafika2023/PlanetCreator/cw 6/shaders/shader_pbr_instanced.vert
2024-02-07 18:29:06 +01:00

21 lines
519 B
GLSL

#version 430 core
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec2 inTexCoord;
uniform mat4 modelMatrix[500];
out vec2 texCoords;
out vec3 fragNormal;
out vec3 fragPosition;
uniform sampler2D colorTexture;
void main()
{
mat4 modelMat = modelMatrix[gl_InstanceID];
gl_Position = modelMat * vec4(inPosition, 1.0);
fragPosition = (modelMat* vec4(inPosition,1)).xyz;
texCoords = inTexCoord;
fragNormal = (modelMat* vec4(inNormal,0)).xyz;
}