Loads and loads of small improvements I added while developing on my game

This commit is contained in:
Michel Fedde 2021-03-02 19:54:19 +01:00
parent 41421b1df9
commit a7c71e7ea1
107 changed files with 2278 additions and 1023 deletions

View file

@ -0,0 +1,39 @@
#version 330
#define maxInstances //!instanceMax
#define SM_SIMPLE_EXTENSION //!extension
struct Instance {
mat4 ModelMatrix;
mat3 TextureMatrix;
};
layout(location = 0) in vec3 a_Position;
layout(location = 1) in vec2 a_Texture;
layout(location = 3) in vec4 a_Color;
uniform mat4 MVP;
uniform mat3 MasterTextureMatrix;
uniform Instance[maxInstances] Instances;
uniform bool HasVColor;
out vec3 v_VertexPosition;
out vec2 v_TexCoords;
out vec4 v_Color;
#if (SM_SIMPLE_EXTENSION == 1)
void v_Extension();
#endif
void main() {
v_Color = vec4(1);
if (HasVColor) v_Color = a_Color;
v_TexCoords = vec2(MasterTextureMatrix * Instances[gl_InstanceID].TextureMatrix * vec3(a_Texture, 1));
v_VertexPosition = a_Position;
gl_Position = MVP * Instances[gl_InstanceID].ModelMatrix * vec4(a_Position, 1);
#if (SM_SIMPLE_EXTENSION == 1)
v_Extension();
#endif
}