#version 130 in vec3 att_vert; in vec3 att_norm; in vec4 att_bgra; in vec2 att_uv; uniform mat4 mtxObjectToWorld, mtxWorldToView, mtxViewToScreen; uniform vec4 ambColor, mulColor; uniform vec2 uvScrolling; out vec3 norm; out vec4 rgba; out vec2 uv; out vec3 wrlView; out vec4 eyeView; /* swy: the magic blending recipe: Global_RGB_Mod * Vtx_Color * (Ambient_Color + Directional_Lights) + Dynamic_Lights // if No Directional -> No ambient */ void main() { mat4 mtxObjectToView = mtxWorldToView * mtxObjectToWorld; gl_Position = mtxViewToScreen * mtxObjectToView * vec4(att_vert, 1.0); eyeView = mtxObjectToView * vec4(att_vert, 1.0); norm = vec3(mtxObjectToWorld * vec4(att_norm, 0.0)); wrlView = vec3(mtxObjectToWorld * vec4(att_vert, 1.0)); /* swy: swizzle the BGR channels to RGB */ rgba.rgba = att_bgra.bgra; /* swy: the original fixed-pipeline code used MODULATE2X, so we need to emulate it or colors will appear dull, things won't get brighter than what they already are */ rgba.rgb *= 2.0; /* swy: the ambient color replaces the provided per-vertex color in dynamic objects (which otherwise is pure gray * 2.0) */ rgba.rgb *= ambColor.rgb * 2.0; /* swy: multiply the final per-vertex color by the programmatic tinting term (for damage, fades and other effects) */ rgba *= mulColor; uv = att_uv + uvScrolling; } /********/