}
#endif
-void Mod_ValidateElements(const int *elements, int numtriangles, int numverts, const char *filename, int fileline)
+void Mod_ValidateElements(int *elements, int numtriangles, int numverts, const char *filename, int fileline)
{
- int i;
+ int i, warned = false;
for (i = 0;i < numtriangles * 3;i++)
+ {
if ((unsigned int)elements[i] >= (unsigned int)numverts)
- Con_Printf("Mod_ValidateElements: out of bounds element detected at %s:%d\n", filename, fileline);
+ {
+ if (!warned)
+ {
+ warned = true;
+ Con_Printf("Mod_ValidateElements: out of bounds elements detected at %s:%d\n", filename, fileline);
+ }
+ elements[i] = 0;
+ }
+ }
}
// warning: this is an expensive function!
int Mod_BuildVertexRemapTableFromElements(int numelements, const int *elements, int numvertices, int *remapvertices);
void Mod_BuildTriangleNeighbors(int *neighbors, const int *elements, int numtriangles);
-void Mod_ValidateElements(const int *elements, int numtriangles, int numverts, const char *filename, int fileline);
+void Mod_ValidateElements(int *elements, int numtriangles, int numverts, const char *filename, int fileline);
void Mod_BuildNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex3f, const int *elements, float *normal3f, qboolean areaweighting);
void Mod_BuildTextureVectorsAndNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex, const float *texcoord, const int *elements, float *svectors, float *tvectors, float *normals, qboolean areaweighting);