]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix zfighting on decals in D3D9 (where negative polygon offset isn't possible)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 4 Mar 2011 00:36:36 +0000 (00:36 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 4 Mar 2011 00:36:36 +0000 (00:36 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10889 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 40670cd8c120c213307e1f3454c60a61599833b9..f89619b7c5208352bcf74bd0544a41fb0798d2bd 100644 (file)
@@ -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);