From: havoc Date: Fri, 4 Mar 2011 00:36:36 +0000 (+0000) Subject: fix zfighting on decals in D3D9 (where negative polygon offset isn't possible) X-Git-Tag: xonotic-v0.5.0~425^2~14 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=9447b928855938a53cf24ff2d057581f82915307;p=xonotic%2Fdarkplaces.git fix zfighting on decals in D3D9 (where negative polygon offset isn't possible) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10889 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 40670cd8..f89619b7 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -13031,6 +13031,7 @@ static void R_DecalSystem_SplatTriangle(decalsystem_t *decalsystem, float r, flo int index; float v[9][3]; const float *vertex3f; + const float *normal3f; int numpoints; float points[2][9][3]; float temp[3]; @@ -13042,11 +13043,12 @@ static void R_DecalSystem_SplatTriangle(decalsystem_t *decalsystem, float r, flo e = rsurface.modelelement3i + 3*triangleindex; vertex3f = rsurface.modelvertex3f; + normal3f = rsurface.modelnormal3f; for (cornerindex = 0;cornerindex < 3;cornerindex++) { index = 3*e[cornerindex]; - VectorCopy(vertex3f + index, v[cornerindex]); + VectorMA(vertex3f + index, cl_decals_bias.value, normal3f + index, v[cornerindex]); } // cull backfaces //TriangleNormal(v[0], v[1], v[2], normal); @@ -13151,7 +13153,7 @@ static void R_DecalSystem_SplatEntity(entity_render_t *ent, const vec3_t worldor R_DecalSystem_Reset(decalsystem); decalsystem->model = model; - RSurf_ActiveModelEntity(ent, false, false, false); + RSurf_ActiveModelEntity(ent, true, false, false); Matrix4x4_Transform(&rsurface.inversematrix, worldorigin, localorigin); Matrix4x4_Transform3x3(&rsurface.inversematrix, worldnormal, localnormal);