KStarbound/src/main/resources/shaders/vertex/configurable.vsh

39 lines
735 B
GLSL

layout (location = 0) in vec2 pos;
#ifdef TEXTURE
layout (location = TEXTURE) in vec2 uvIn;
out vec2 uvOut;
#endif
#ifdef COLOR
layout (location = COLOR) in vec4 colorIn;
out vec4 vertexColor;
#endif
#ifdef HUE_SHIFT
layout (location = HUE_SHIFT) in float hueShiftIn;
out float hueShiftOut;
#endif
uniform mat3 viewMatrix; // projection (viewport) + camera
uniform mat3 worldMatrix; // matrix stack
uniform mat3 modelMatrix; // local transformations
void main() {
vec3 result = viewMatrix * worldMatrix * modelMatrix * vec3(pos, 1.0);
gl_Position = vec4(result.x, result.y, 0.0, result.z);
#ifdef HUE_SHIFT
hueShiftOut = hueShiftIn;
#endif
#ifdef COLOR
vertexColor = colorIn;
#endif
#ifdef TEXTURE
uvOut = uvIn;
#endif
}