then align it in Radiant so only one of the animation frames can be seen on
the surface, and specify "tcmod page 4 2 0.1". DP will then display the frames
in order and the cycle will repeat every 0.8 seconds.
-
+- dppolygonoffset <factor> <offset>
+ This surface gets glPolygonOffset(factor, offset); useful for decals
Thanks to:
cvar_t mod_q3bsp_nolightmaps = {CVAR_SAVE, "mod_q3bsp_nolightmaps", "0", "do not load lightmaps in Q3BSP maps (to save video RAM, but be warned: it looks ugly)"};
cvar_t mod_q3bsp_tracelineofsight_brushes = {0, "mod_q3bsp_tracelineofsight_brushes", "0", "enables culling of entities behind detail brushes, curves, etc"};
cvar_t mod_q3shader_default_offsetmapping = {CVAR_SAVE, "mod_q3shader_default_offsetmapping", "1", "use offsetmapping by default on all surfaces"};
+cvar_t mod_q3shader_default_polygonfactor = {0, "mod_q3shader_default_polygonfactor", "0", "biases depth values of 'polygonoffset' shaders to prevent z-fighting artifacts"};
+cvar_t mod_q3shader_default_polygonoffset = {0, "mod_q3shader_default_polygonoffset", "-2", "biases depth values of 'polygonoffset' shaders to prevent z-fighting artifacts"};
cvar_t mod_q1bsp_polygoncollisions = {0, "mod_q1bsp_polygoncollisions", "0", "disables use of precomputed cliphulls and instead collides with polygons (uses Bounding Interval Hierarchy optimizations)"};
cvar_t mod_collision_bih = {0, "mod_collision_bih", "1", "enables use of generated Bounding Interval Hierarchy tree instead of compiled bsp tree in collision code"};
Cvar_RegisterVariable(&mod_q3bsp_nolightmaps);
Cvar_RegisterVariable(&mod_q3bsp_tracelineofsight_brushes);
Cvar_RegisterVariable(&mod_q3shader_default_offsetmapping);
+ Cvar_RegisterVariable(&mod_q3shader_default_polygonfactor);
+ Cvar_RegisterVariable(&mod_q3shader_default_polygonoffset);
Cvar_RegisterVariable(&mod_q1bsp_polygoncollisions);
Cvar_RegisterVariable(&mod_collision_bih);
Cvar_RegisterVariable(&mod_recalculatenodeboxes);
}
extern cvar_t mod_q3shader_default_offsetmapping;
+extern cvar_t mod_q3shader_default_polygonoffset;
+extern cvar_t mod_q3shader_default_polygonfactor;
void Mod_LoadQ3Shaders(void)
{
int j;
shader.offsetscale = 1;
shader.specularscalemod = 1;
shader.specularpowermod = 1;
+ shader.biaspolygonoffset = mod_q3shader_default_polygonoffset.value;
+ shader.biaspolygonfactor = mod_q3shader_default_polygonfactor.value;
strlcpy(shader.name, com_token, sizeof(shader.name));
if (!COM_ParseToken_QuakeC(&text, false) || strcasecmp(com_token, "{"))
shader.textureflags |= Q3TEXTUREFLAG_NOPICMIP;
else if (!strcasecmp(parameter[0], "polygonoffset"))
shader.textureflags |= Q3TEXTUREFLAG_POLYGONOFFSET;
+ else if (!strcasecmp(parameter[0], "dppolygonoffset"))
+ {
+ shader.textureflags |= Q3TEXTUREFLAG_POLYGONOFFSET;
+ if(numparameters >= 2)
+ {
+ shader.biaspolygonfactor = atof(parameter[1]);
+ if(numparameters >= 3)
+ shader.biaspolygonoffset = atof(parameter[2]);
+ else
+ shader.biaspolygonoffset = 0;
+ }
+ }
else if (!strcasecmp(parameter[0], "dprefract") && numparameters >= 5)
{
shader.textureflags |= Q3TEXTUREFLAG_REFRACTION;
if (shader->textureflags & Q3TEXTUREFLAG_TWOSIDED)
texture->basematerialflags |= MATERIALFLAG_NOSHADOW | MATERIALFLAG_NOCULLFACE;
if (shader->textureflags & Q3TEXTUREFLAG_POLYGONOFFSET)
- texture->biaspolygonoffset -= 2;
+ {
+ texture->biaspolygonoffset += shader->biaspolygonoffset;
+ texture->biaspolygonfactor += shader->biaspolygonfactor;
+ }
if (shader->textureflags & Q3TEXTUREFLAG_REFRACTION)
texture->basematerialflags |= MATERIALFLAG_REFRACTION;
if (shader->textureflags & Q3TEXTUREFLAG_REFLECTION)
dpoffsetmapping_technique_t offsetmapping;
float offsetscale;
+ // polygonoffset (only used if Q3TEXTUREFLAG_POLYGONOFFSET)
+ float biaspolygonoffset, biaspolygonfactor;
+
// gloss
float specularscalemod;
float specularpowermod;