t->specularscale = 0;
}
- t->currentpolygonfactor = r_refdef.polygonfactor;
- t->currentpolygonoffset = r_refdef.polygonoffset;
+ t->currentpolygonfactor = r_refdef.polygonfactor + t->basepolygonfactor;
+ t->currentpolygonoffset = r_refdef.polygonoffset + t->basepolygonoffset;
// submodels are biased to avoid z-fighting with world surfaces that they
// may be exactly overlapping (avoids z-fighting artifacts on certain
// doors and things in Quake maps)
if (ent->model->brush.submodel)
{
- t->currentpolygonfactor = r_refdef.polygonfactor + r_polygonoffset_submodel_factor.value;
- t->currentpolygonoffset = r_refdef.polygonoffset + r_polygonoffset_submodel_offset.value;
+ t->currentpolygonfactor += r_polygonoffset_submodel_factor.value;
+ t->currentpolygonoffset += r_polygonoffset_submodel_offset.value;
}
VectorClear(t->dlightcolor);
shader->surfaceparms |= Q3SURFACEPARM_NOMIPMAPS;
else if (!strcasecmp(parameter[0], "nopicmip"))
shader->textureflags |= Q3TEXTUREFLAG_NOPICMIP;
+ else if (!strcasecmp(parameter[0], "polygonoffset"))
+ shader->textureflags |= Q3TEXTUREFLAG_POLYGONOFFSET;
else if (!strcasecmp(parameter[0], "deformvertexes") && numparameters >= 2)
{
int i, deformindex;
texture->basematerialflags |= MATERIALFLAG_ALPHATEST | MATERIALFLAG_NOSHADOW;
if (shader->textureflags & Q3TEXTUREFLAG_TWOSIDED)
texture->basematerialflags |= MATERIALFLAG_NOSHADOW | MATERIALFLAG_NOCULLFACE;
+ if (shader->textureflags & Q3TEXTUREFLAG_POLYGONOFFSET)
+ texture->basepolygonoffset -= 2;
texture->customblendfunc[0] = GL_ONE;
texture->customblendfunc[1] = GL_ZERO;
if (shader->numlayers > 0)
// TODO: support these features more directly
#define Q3TEXTUREFLAG_TWOSIDED 1
#define Q3TEXTUREFLAG_NOPICMIP 16
+#define Q3TEXTUREFLAG_POLYGONOFFSET 32
#define Q3PATHLENGTH 64
#define TEXTURE_MAXFRAMES 64
// current PolygonOffset values for rendering this material
float currentpolygonfactor;
float currentpolygonoffset;
+ float basepolygonfactor;
+ float basepolygonoffset;
// textures to use when rendering this material
skinframe_t *currentskinframe;