SHADERPERMUTATION_BOUNCEGRIDDIRECTIONAL = 1<<26, ///< (lightmap) use 16-component pixels in bouncegrid texture for directional lighting rather than standard 4-component
SHADERPERMUTATION_TRIPPY = 1<<27, ///< use trippy vertex shader effect
SHADERPERMUTATION_DEPTHRGB = 1<<28, ///< read/write depth values in RGB color coded format for older hardware without depth samplers
- SHADERPERMUTATION_COUNT = 29 ///< size of shaderpermutationinfo array
+ SHADERPERMUTATION_ALPHAGEN_VERTEX = 1<<29, ///< alphaGen vertex
+ SHADERPERMUTATION_COUNT = 30 ///< size of shaderpermutationinfo array
}
shaderpermutation_t;
{"#define USEBOUNCEGRIDDIRECTIONAL\n", " bouncegriddirectional"}, // TODO make this a static parm
{"#define USETRIPPY\n", " trippy"},
{"#define USEDEPTHRGB\n", " depthrgb"},
+ {"#define USEALPHAGENVERTEX\n", "alphagenvertex"}
};
// NOTE: MUST MATCH ORDER OF SHADERMODE_* ENUMS!
}
if (rsurface.texture->currentmaterialflags & MATERIALFLAG_VERTEXTEXTUREBLEND)
permutation |= SHADERPERMUTATION_VERTEXTEXTUREBLEND;
+ if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHAGEN_VERTEX)
+ permutation |= SHADERPERMUTATION_ALPHAGEN_VERTEX;
// light source
mode = SHADERMODE_LIGHTSOURCE;
if (rsurface.rtlight->currentcubemap != r_texture_whitecube)
}
if (rsurface.texture->currentmaterialflags & MATERIALFLAG_VERTEXTEXTUREBLEND)
permutation |= SHADERPERMUTATION_VERTEXTEXTUREBLEND;
+ if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHAGEN_VERTEX)
+ permutation |= SHADERPERMUTATION_ALPHAGEN_VERTEX;
// unshaded geometry (fullbright or ambient model lighting)
mode = SHADERMODE_FLATCOLOR;
ambientscale = diffusescale = specularscale = 0;
}
if (rsurface.texture->currentmaterialflags & MATERIALFLAG_VERTEXTEXTUREBLEND)
permutation |= SHADERPERMUTATION_VERTEXTEXTUREBLEND;
+ if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHAGEN_VERTEX)
+ permutation |= SHADERPERMUTATION_ALPHAGEN_VERTEX;
// directional model lighting
mode = SHADERMODE_LIGHTDIRECTION;
if (rsurface.texture->glowtexture && r_hdr_glowintensity.value > 0 && !gl_lightmaps.integer)
}
if (rsurface.texture->currentmaterialflags & MATERIALFLAG_VERTEXTEXTUREBLEND)
permutation |= SHADERPERMUTATION_VERTEXTEXTUREBLEND;
+ if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHAGEN_VERTEX)
+ permutation |= SHADERPERMUTATION_ALPHAGEN_VERTEX;
// ambient model lighting
mode = SHADERMODE_LIGHTDIRECTION;
if (rsurface.texture->glowtexture && r_hdr_glowintensity.value > 0 && !gl_lightmaps.integer)
}
if (rsurface.texture->currentmaterialflags & MATERIALFLAG_VERTEXTEXTUREBLEND)
permutation |= SHADERPERMUTATION_VERTEXTEXTUREBLEND;
+ if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHAGEN_VERTEX)
+ permutation |= SHADERPERMUTATION_ALPHAGEN_VERTEX;
// lightmapped wall
if (rsurface.texture->glowtexture && r_hdr_glowintensity.value > 0 && !gl_lightmaps.integer)
permutation |= SHADERPERMUTATION_GLOW;
#define MATERIALFLAG_CAMERA 67108864
// disable rtlight on surface, use R_LightPoint instead
#define MATERIALFLAG_NORTLIGHT 134217728
+// alphagen vertex
+#define MATERIALFLAG_ALPHAGEN_VERTEX 268435456
// combined mask of all attributes that require depth sorted rendering
#define MATERIALFLAGMASK_DEPTHSORTED (MATERIALFLAG_BLENDED | MATERIALFLAG_NODEPTHTEST)
// combined mask of all attributes that cause some sort of transparency
texture->basematerialflags |= MATERIALFLAG_NOSHADOW;
if (shader->dpnortlight)
texture->basematerialflags |= MATERIALFLAG_NORTLIGHT;
+ if (shader->vertexalpha)
+ texture->basematerialflags |= MATERIALFLAG_ALPHAGEN_VERTEX;
memcpy(texture->deforms, shader->deforms, sizeof(texture->deforms));
texture->reflectmin = shader->reflectmin;
texture->reflectmax = shader->reflectmax;
"#endif\n"
"void main(void)\n"
"{\n"
-"#if defined(MODE_VERTEXCOLOR) || defined(USEVERTEXTEXTUREBLEND) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR)\n"
+"#if defined(MODE_VERTEXCOLOR) || defined(USEVERTEXTEXTUREBLEND) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR) || defined(USEALPHAGENVERTEX)\n"
" VertexColor = Attrib_Color;\n"
"#endif\n"
" // copy the surface texcoord\n"
" color.a = 1.0;\n"
" //color = mix(cast_myhalf4(1, 0, 0, 1), color, terrainblend);\n"
"#endif\n"
+"#ifdef USEALPHAGENVERTEX\n"
+" color.a *= VertexColor.a;\n"
+"#endif\n"
"\n"
" // get the surface normal\n"
"#ifdef USEVERTEXTEXTUREBLEND\n"
"#ifdef USESHADOWMAPORTHO\n"
"uniform float4x4 ShadowMapMatrix : register(c16),\n"
"#endif\n"
-"#if defined(MODE_VERTEXCOLOR) || defined(USEVERTEXTEXTUREBLEND)\n"
+"#if defined(MODE_VERTEXCOLOR) || defined(USEVERTEXTEXTUREBLEND) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR) || defined(USEALPHAGENVERTEX)\n"
"out float4 gl_FrontColor : COLOR,\n"
"#endif\n"
"out float4 TexCoordBoth : TEXCOORD0,\n"
"out float4 gl_Position : POSITION\n"
")\n"
"{\n"
-"#if defined(MODE_VERTEXCOLOR) || defined(USEVERTEXTEXTUREBLEND)\n"
+"#if defined(MODE_VERTEXCOLOR) || defined(USEVERTEXTEXTUREBLEND) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR) || defined(USEALPHAGENVERTEX)\n"
" gl_FrontColor = gl_Color;\n"
"#endif\n"
" // copy the surface texcoord\n"
" //color = half4(lerp(float4(1, 0, 0, 1), color, terrainblend));\n"
"#endif\n"
"#endif\n"
+"#ifdef USEALPHAGENVERTEX\n"
+" color.a *= gl_FrontColor.a;\n"
+"#endif\n"
"\n"
" // get the surface normal\n"
"#ifdef USEVERTEXTEXTUREBLEND\n"