stk-code_catmod/data/shaders/instanced_object_pass.vert

25 lines
652 B
GLSL
Raw Normal View History

uniform mat4 ViewProjectionMatrix;
2014-03-28 20:22:08 -04:00
uniform mat4 InverseViewMatrix;
in vec3 Origin;
in vec3 Orientation;
in vec3 Position;
in vec3 Normal;
in vec2 Texcoord;
out vec3 nor;
out vec2 uv;
2014-03-28 20:22:08 -04:00
mat4 getWorldMatrix(vec3 translation, vec3 rotation);
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation);
void main(void)
{
2014-03-28 20:22:08 -04:00
mat4 ModelMatrix = getWorldMatrix(Origin, Orientation);
mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin, Orientation) * InverseViewMatrix);
gl_Position = ViewProjectionMatrix * ModelMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
uv = Texcoord;
}