Fix rotation on render, change rendering code
Premultiply transformation matrix onto vertices before sending onto GPU to preserve transformation properties of entities before being batched into a general group. This removes the model matrix from the shader pipeline- instead in rendering code we deal in world space (which works out to be more intuitive). Only in the last step in GLSL we convert back to normalised coordinates.
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
#version 330 core
|
||||
in vec2 texCoord;
|
||||
|
||||
in vec2 texCoord;
|
||||
out vec4 color;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#version 330 core
|
||||
layout (location = 0) in vec4 data; // (vec2)pos, (vec2)texCoord
|
||||
layout(location = 0) in vec4 data; // (vec2)pos, (vec2)texCoord
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 projection;
|
||||
out vec2 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projection * model * vec4(data.xy, 0.0f, 1.0f);
|
||||
gl_Position = projection * vec4(data.xy, 0.0f, 1.0f);
|
||||
texCoord = data.zw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user