#version 410 in vec3 col; in vec3 nor; in vec2 uv; in vec2 txUv; // part attrs (beyond commonDeclare'd) uniform float partIndex_colorize; uniform float partIndex_textAtlasSubrect; uniform float partIndex_textColor_o; //@ME textColor_o:r,g,b, distance uniform float partIndex_textColor2_o; //@ME textColor2_o:r,g,b,. uniform float partIndex_misc_o; //@ME misc_o:edgeDarkness, edgeLimit,.,. //in float partSlot; out vec3 colV; // ramped color from vertex color out vec3 norV; // ramped normal from vertex normal and transforms out vec2 uvV; // ramped uv from vertex uv out vec2 txUvV; // ramped uv from vertex text uv out vec4 partTextAtlasSubrectV; out vec4 partTextColorV; // r,g,b, texturedistance out vec4 partTextColor2V; // r,g,b -- second color for text. out vec4 partMiscV; #include "commonDeclare.glsl" void main(void) { #include "commonProjection.glsl" float dNoTexture = 46.0; vec4 partColorize = texture(partValues, vec2(partIndex_colorize, partSlot)); colV = mix(col, partColorize.rgb, partColorize.a); uvV = 1.0 - uv; txUvV = 1.0 - txUv; norV = mat3(viewMatrix) * nor; partTextAtlasSubrectV = texture(partValues, vec2(partIndex_textAtlasSubrect, partSlot)); // swap left & right um // dvb2015 is this a hack or a strategy? TODO: understand up, down, left, and right. float t = partTextAtlasSubrectV[0]; partTextAtlasSubrectV[0] = partTextAtlasSubrectV[2]; partTextAtlasSubrectV[2] = t; partTextColorV = texture(partValues, vec2(partIndex_textColor_o, partSlot)); partTextColor2V = texture(partValues, vec2(partIndex_textColor2_o, partSlot)); partMiscV = texture(partValues, vec2(partIndex_misc_o, partSlot)); // fourth component of text color is max-visible-distance of the texture. If nonzero. Else dflt. if(partTextColorV.a < 0.01) partTextColorV.a = dNoTexture; }