]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
UNMERGE
authordivverent divverent@d7cf8633-e32d-0410-b094-e92efae38249 <>
Tue, 31 Aug 2010 10:53:54 +0000 (10:53 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 24 Sep 2010 20:00:21 +0000 (22:00 +0200)
generate s- and t-vector of deformVertexes only if really needed (optimization for depthfirst pass mainly)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10432 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::unmerge=c93c208ad76c4ba3cff084544d862d3285829135

gl_rmain.c

index c30a63854781fd533a9af2b9efa94ea9fbc68244..1d6571fd0864e64470184c90dcea619fd844bba1 100644 (file)
@@ -11768,7 +11768,6 @@ void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const
                                        VectorMAMAMAM(1, center, DotProduct(forward, v), newforward, DotProduct(right, v), newright, DotProduct(up, v), newup, rsurface.array_batchvertex3f + 3*(j+i));
                                }
                        }
-                       // if we get here, BATCHNEED_ARRAY_NORMAL and BATCHNEED_ARRAY_VECTOR are in batchneed, so no need to check
                        Mod_BuildNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchnormal3f, true);
                        Mod_BuildTextureVectorsFromNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchtexcoordtexture2f, rsurface.array_batchnormal3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchsvector3f, rsurface.array_batchtvector3f, true);
                        rsurface.batchvertex3f = rsurface.array_batchvertex3f;
@@ -11869,26 +11868,20 @@ void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const
                                        }
                                }
                        }
+                       Mod_BuildNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchnormal3f, true);
+                       Mod_BuildTextureVectorsFromNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchtexcoordtexture2f, rsurface.array_batchnormal3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchsvector3f, rsurface.array_batchtvector3f, true);
                        rsurface.batchvertex3f = rsurface.array_batchvertex3f;
                        rsurface.batchvertex3f_vertexbuffer = NULL;
                        rsurface.batchvertex3f_bufferoffset = 0;
-                       if(batchneed & (BATCHNEED_ARRAY_NORMAL | BATCHNEED_ARRAY_VECTOR)) // otherwise these can stay NULL
-                       {
-                               Mod_BuildNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchnormal3f, true);
-                               rsurface.batchnormal3f = rsurface.array_batchnormal3f;
-                               rsurface.batchnormal3f_vertexbuffer = NULL;
-                               rsurface.batchnormal3f_bufferoffset = 0;
-                       }
-                       if(batchneed & BATCHNEED_ARRAY_VECTOR) // otherwise these can stay NULL
-                       {
-                               Mod_BuildTextureVectorsFromNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchtexcoordtexture2f, rsurface.array_batchnormal3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchsvector3f, rsurface.array_batchtvector3f, true);
-                               rsurface.batchsvector3f = rsurface.array_batchsvector3f;
-                               rsurface.batchsvector3f_vertexbuffer = NULL;
-                               rsurface.batchsvector3f_bufferoffset = 0;
-                               rsurface.batchtvector3f = rsurface.array_batchtvector3f;
-                               rsurface.batchtvector3f_vertexbuffer = NULL;
-                               rsurface.batchtvector3f_bufferoffset = 0;
-                       }
+                       rsurface.batchsvector3f = rsurface.array_batchsvector3f;
+                       rsurface.batchsvector3f_vertexbuffer = NULL;
+                       rsurface.batchsvector3f_bufferoffset = 0;
+                       rsurface.batchtvector3f = rsurface.array_batchtvector3f;
+                       rsurface.batchtvector3f_vertexbuffer = NULL;
+                       rsurface.batchtvector3f_bufferoffset = 0;
+                       rsurface.batchnormal3f = rsurface.array_batchnormal3f;
+                       rsurface.batchnormal3f_vertexbuffer = NULL;
+                       rsurface.batchnormal3f_bufferoffset = 0;
                        break;
                case Q3DEFORM_NORMAL:
                        // deform the normals to make reflections wavey
@@ -11902,19 +11895,16 @@ void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const
                                normal[2] = rsurface.batchnormal3f[j*3+2] + deform->parms[0] * noise4f(196 + vertex[0], vertex[1], vertex[2], r_refdef.scene.time * deform->parms[1]);
                                VectorNormalize(normal);
                        }
+                       Mod_BuildTextureVectorsFromNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchtexcoordtexture2f, rsurface.array_batchnormal3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchsvector3f, rsurface.array_batchtvector3f, true);
+                       rsurface.batchsvector3f = rsurface.array_batchsvector3f;
+                       rsurface.batchsvector3f_vertexbuffer = NULL;
+                       rsurface.batchsvector3f_bufferoffset = 0;
+                       rsurface.batchtvector3f = rsurface.array_batchtvector3f;
+                       rsurface.batchtvector3f_vertexbuffer = NULL;
+                       rsurface.batchtvector3f_bufferoffset = 0;
                        rsurface.batchnormal3f = rsurface.array_batchnormal3f;
                        rsurface.batchnormal3f_vertexbuffer = NULL;
                        rsurface.batchnormal3f_bufferoffset = 0;
-                       if(batchneed & BATCHNEED_ARRAY_VECTOR) // otherwise these can stay NULL
-                       {
-                               Mod_BuildTextureVectorsFromNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchtexcoordtexture2f, rsurface.array_batchnormal3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchsvector3f, rsurface.array_batchtvector3f, true);
-                               rsurface.batchsvector3f = rsurface.array_batchsvector3f;
-                               rsurface.batchsvector3f_vertexbuffer = NULL;
-                               rsurface.batchsvector3f_bufferoffset = 0;
-                               rsurface.batchtvector3f = rsurface.array_batchtvector3f;
-                               rsurface.batchtvector3f_vertexbuffer = NULL;
-                               rsurface.batchtvector3f_bufferoffset = 0;
-                       }
                        break;
                case Q3DEFORM_WAVE:
                        // deform vertex array to make wavey water and flags and such
@@ -11937,24 +11927,20 @@ void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const
                                }
                                VectorMA(rsurface.batchvertex3f + 3*j, scale, rsurface.batchnormal3f + 3*j, rsurface.array_batchvertex3f + 3*j);
                        }
-                       // if we get here, BATCHNEED_ARRAY_NORMAL is in batchneed, so no need to check
                        Mod_BuildNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchnormal3f, true);
+                       Mod_BuildTextureVectorsFromNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchtexcoordtexture2f, rsurface.array_batchnormal3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchsvector3f, rsurface.array_batchtvector3f, true);
                        rsurface.batchvertex3f = rsurface.array_batchvertex3f;
                        rsurface.batchvertex3f_vertexbuffer = NULL;
                        rsurface.batchvertex3f_bufferoffset = 0;
+                       rsurface.batchsvector3f = rsurface.array_batchsvector3f;
+                       rsurface.batchsvector3f_vertexbuffer = NULL;
+                       rsurface.batchsvector3f_bufferoffset = 0;
+                       rsurface.batchtvector3f = rsurface.array_batchtvector3f;
+                       rsurface.batchtvector3f_vertexbuffer = NULL;
+                       rsurface.batchtvector3f_bufferoffset = 0;
                        rsurface.batchnormal3f = rsurface.array_batchnormal3f;
                        rsurface.batchnormal3f_vertexbuffer = NULL;
                        rsurface.batchnormal3f_bufferoffset = 0;
-                       if(batchneed & BATCHNEED_ARRAY_VECTOR) // otherwise these can stay NULL
-                       {
-                               Mod_BuildTextureVectorsFromNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchtexcoordtexture2f, rsurface.array_batchnormal3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchsvector3f, rsurface.array_batchtvector3f, true);
-                               rsurface.batchsvector3f = rsurface.array_batchsvector3f;
-                               rsurface.batchsvector3f_vertexbuffer = NULL;
-                               rsurface.batchsvector3f_bufferoffset = 0;
-                               rsurface.batchtvector3f = rsurface.array_batchtvector3f;
-                               rsurface.batchtvector3f_vertexbuffer = NULL;
-                               rsurface.batchtvector3f_bufferoffset = 0;
-                       }
                        break;
                case Q3DEFORM_BULGE:
                        // deform vertex array to make the surface have moving bulges
@@ -11963,24 +11949,20 @@ void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const
                                scale = sin(rsurface.batchtexcoordtexture2f[j*2+0] * deform->parms[0] + r_refdef.scene.time * deform->parms[2]) * deform->parms[1];
                                VectorMA(rsurface.batchvertex3f + 3*j, scale, rsurface.batchnormal3f + 3*j, rsurface.array_batchvertex3f + 3*j);
                        }
-                       // if we get here, BATCHNEED_ARRAY_NORMAL is in batchneed, so no need to check
                        Mod_BuildNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchnormal3f, true);
+                       Mod_BuildTextureVectorsFromNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchtexcoordtexture2f, rsurface.array_batchnormal3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchsvector3f, rsurface.array_batchtvector3f, true);
                        rsurface.batchvertex3f = rsurface.array_batchvertex3f;
                        rsurface.batchvertex3f_vertexbuffer = NULL;
                        rsurface.batchvertex3f_bufferoffset = 0;
+                       rsurface.batchsvector3f = rsurface.array_batchsvector3f;
+                       rsurface.batchsvector3f_vertexbuffer = NULL;
+                       rsurface.batchsvector3f_bufferoffset = 0;
+                       rsurface.batchtvector3f = rsurface.array_batchtvector3f;
+                       rsurface.batchtvector3f_vertexbuffer = NULL;
+                       rsurface.batchtvector3f_bufferoffset = 0;
                        rsurface.batchnormal3f = rsurface.array_batchnormal3f;
                        rsurface.batchnormal3f_vertexbuffer = NULL;
                        rsurface.batchnormal3f_bufferoffset = 0;
-                       if(batchneed & BATCHNEED_ARRAY_VECTOR) // otherwise these can stay NULL
-                       {
-                               Mod_BuildTextureVectorsFromNormals(rsurface.batchfirstvertex, rsurface.batchnumvertices, rsurface.batchnumtriangles, rsurface.array_batchvertex3f, rsurface.batchtexcoordtexture2f, rsurface.array_batchnormal3f, rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle, rsurface.array_batchsvector3f, rsurface.array_batchtvector3f, true);
-                               rsurface.batchsvector3f = rsurface.array_batchsvector3f;
-                               rsurface.batchsvector3f_vertexbuffer = NULL;
-                               rsurface.batchsvector3f_bufferoffset = 0;
-                               rsurface.batchtvector3f = rsurface.array_batchtvector3f;
-                               rsurface.batchtvector3f_vertexbuffer = NULL;
-                               rsurface.batchtvector3f_bufferoffset = 0;
-                       }
                        break;
                case Q3DEFORM_MOVE:
                        // deform vertex array