#pragma STAGE: VERTEX #pragma GEOMETRY: MESH #pragma FEATURES: FACE LINE V_L V_RGB V_A LIGHTING TEXTURE U_RGBA #pragma FEATURE_TOGGLES: V_L V_RGB V_A LIGHTING TEXTURE U_RGBA #ifdef V_L #ifdef V_RGB #error Vertex luminance and vertex RGB are mutually exclusive #endif #endif //------------[ Uniforms ]------------// layout (location = 0) uniform mat4 mvp_matrix; #ifdef LIGHTING layout (location = 1) uniform mat4 model_matrix; #endif #ifdef U_RGBA layout (location = 4) uniform vec4 color; #endif //------------[ Inputs ]------------// layout (location = 0) in vec3 model_vertex_position; #ifdef LIGHTING layout (location = 1) in vec3 model_vertex_normal; #endif #ifdef V_L layout (location = 2) in float model_vertex_l; #endif #ifdef V_RGB layout (location = 2) in vec3 model_vertex_rgb; #endif #ifdef V_A layout (location = 3) in float model_vertex_a; #endif #ifdef TEXTURE layout (location = 4) in vec2 model_vertex_tex_coord; #endif //------------[ Outputs ]------------// layout (location = 0) out vec4 clip_vertex_color; #ifdef LIGHTING layout (location = 1) out vec3 clip_vertex_position; layout (location = 2) out vec3 clip_vertex_normal; #endif #ifdef TEXTURE layout (location = 3) out vec2 clip_vertex_tex_coord; #endif void main() { gl_Position = mvp_matrix * vec4(model_vertex_position, 1.0); clip_vertex_color = vec4(1); #ifdef V_L clip_vertex_color.rgb *= model_vertex_l; #endif #ifdef V_RGB clip_vertex_color.rgb *= model_vertex_rgb; #endif #ifdef V_A clip_vertex_color.a *= model_vertex_a; #endif #ifdef U_RGBA clip_vertex_color *= color; #endif #ifdef LIGHTING clip_vertex_position = (model_matrix * vec4(model_vertex_position, 1.0)).xyz; clip_vertex_normal = normalize(mat3(model_matrix) * model_vertex_normal); #endif #ifdef TEXTURE clip_vertex_tex_coord = model_vertex_tex_coord; #endif }