Show surface names in excessive vertexes and triangles warnings

Add newlines to renderergl2's R_LoadMD3 vertex and triangle warnings.
This commit is contained in:
Zack Middleton 2013-05-03 14:28:18 -05:00
parent 3a47192ba8
commit ee7bd0cae6
4 changed files with 62 additions and 32 deletions

View file

@ -459,13 +459,15 @@ static qboolean R_LoadMD3 (model_t *mod, int lod, void *buffer, const char *mod_
LL(surf->ofsEnd); LL(surf->ofsEnd);
if ( surf->numVerts > SHADER_MAX_VERTEXES ) { if ( surf->numVerts > SHADER_MAX_VERTEXES ) {
ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i verts on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i verts on %s (%i).\n",
mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface",
surf->numVerts );
return qfalse; return qfalse;
} }
if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) { if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) {
ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i triangles on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i triangles on %s (%i).\n",
mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface",
surf->numTriangles );
return qfalse; return qfalse;
} }
@ -736,14 +738,16 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char
// now do the checks that may fail. // now do the checks that may fail.
if ( surf->numVerts > SHADER_MAX_VERTEXES ) if ( surf->numVerts > SHADER_MAX_VERTEXES )
{ {
ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i verts on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i verts on %s (%i).\n",
mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface",
surf->numVerts );
return qfalse; return qfalse;
} }
if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) if ( surf->numTriangles*3 > SHADER_MAX_INDEXES )
{ {
ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i triangles on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i triangles on %s (%i).\n",
mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface",
surf->numTriangles );
return qfalse; return qfalse;
} }
// lowercase the surface name so skin compares are faster // lowercase the surface name so skin compares are faster
@ -950,13 +954,15 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name ) {
LL(surf->ofsEnd); LL(surf->ofsEnd);
if ( surf->numVerts > SHADER_MAX_VERTEXES ) { if ( surf->numVerts > SHADER_MAX_VERTEXES ) {
ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i verts on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i verts on %s (%i).\n",
mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface",
surf->numVerts );
return qfalse; return qfalse;
} }
if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) { if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) {
ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i triangles on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i triangles on %s (%i).\n",
mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface",
surf->numTriangles );
return qfalse; return qfalse;
} }

View file

@ -142,6 +142,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
size_t size, joint_names; size_t size, joint_names;
iqmData_t *iqmData; iqmData_t *iqmData;
srfIQModel_t *surface; srfIQModel_t *surface;
char meshName[MAX_QPATH];
if( filesize < sizeof(iqmHeader_t) ) { if( filesize < sizeof(iqmHeader_t) ) {
return qfalse; return qfalse;
@ -310,17 +311,25 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
LL( mesh->first_triangle ); LL( mesh->first_triangle );
LL( mesh->num_triangles ); LL( mesh->num_triangles );
if ( mesh->name < header->num_text ) {
Q_strncpyz( meshName, (char*)header + header->ofs_text + mesh->name, sizeof (meshName) );
} else {
meshName[0] = '\0';
}
// check ioq3 limits // check ioq3 limits
if ( mesh->num_vertexes > SHADER_MAX_VERTEXES ) if ( mesh->num_vertexes > SHADER_MAX_VERTEXES )
{ {
ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on %s (%i).\n",
mod_name, SHADER_MAX_VERTEXES, mesh->num_vertexes ); mod_name, SHADER_MAX_VERTEXES, meshName[0] ? meshName : "a surface",
mesh->num_vertexes );
return qfalse; return qfalse;
} }
if ( mesh->num_triangles*3 > SHADER_MAX_INDEXES ) if ( mesh->num_triangles*3 > SHADER_MAX_INDEXES )
{ {
ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on %s (%i).\n",
mod_name, SHADER_MAX_INDEXES / 3, mesh->num_triangles ); mod_name, SHADER_MAX_INDEXES / 3, meshName[0] ? meshName : "a surface",
mesh->num_triangles );
return qfalse; return qfalse;
} }

View file

@ -497,14 +497,16 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
if(md3Surf->numVerts > SHADER_MAX_VERTEXES) if(md3Surf->numVerts > SHADER_MAX_VERTEXES)
{ {
ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i verts on a surface (%i)", ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i verts on %s (%i).\n",
modName, SHADER_MAX_VERTEXES, md3Surf->numVerts); modName, SHADER_MAX_VERTEXES, md3Surf->name[0] ? md3Surf->name : "a surface",
md3Surf->numVerts );
return qfalse; return qfalse;
} }
if(md3Surf->numTriangles * 3 > SHADER_MAX_INDEXES) if(md3Surf->numTriangles * 3 > SHADER_MAX_INDEXES)
{ {
ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i triangles on a surface (%i)", ri.Printf(PRINT_WARNING, "R_LoadMD3: %s has more than %i triangles on %s (%i).\n",
modName, SHADER_MAX_INDEXES / 3, md3Surf->numTriangles); modName, SHADER_MAX_INDEXES / 3, md3Surf->name[0] ? md3Surf->name : "a surface",
md3Surf->numTriangles );
return qfalse; return qfalse;
} }
@ -996,14 +998,16 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char
// now do the checks that may fail. // now do the checks that may fail.
if ( surf->numVerts > SHADER_MAX_VERTEXES ) if ( surf->numVerts > SHADER_MAX_VERTEXES )
{ {
ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i verts on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i verts on %s (%i).\n",
mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface",
surf->numVerts );
return qfalse; return qfalse;
} }
if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) if ( surf->numTriangles*3 > SHADER_MAX_INDEXES )
{ {
ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i triangles on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i triangles on %s (%i).\n",
mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface",
surf->numTriangles );
return qfalse; return qfalse;
} }
// lowercase the surface name so skin compares are faster // lowercase the surface name so skin compares are faster
@ -1210,13 +1214,15 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name ) {
LL(surf->ofsEnd); LL(surf->ofsEnd);
if ( surf->numVerts > SHADER_MAX_VERTEXES ) { if ( surf->numVerts > SHADER_MAX_VERTEXES ) {
ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i verts on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i verts on %s (%i).\n",
mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); mod_name, SHADER_MAX_VERTEXES, surf->name[0] ? surf->name : "a surface",
surf->numVerts );
return qfalse; return qfalse;
} }
if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) { if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) {
ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i triangles on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadMD4: %s has more than %i triangles on %s (%i).\n",
mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); mod_name, SHADER_MAX_INDEXES / 3, surf->name[0] ? surf->name : "a surface",
surf->numTriangles );
return qfalse; return qfalse;
} }

View file

@ -142,6 +142,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
size_t size, joint_names; size_t size, joint_names;
iqmData_t *iqmData; iqmData_t *iqmData;
srfIQModel_t *surface; srfIQModel_t *surface;
char meshName[MAX_QPATH];
if( filesize < sizeof(iqmHeader_t) ) { if( filesize < sizeof(iqmHeader_t) ) {
return qfalse; return qfalse;
@ -310,17 +311,25 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
LL( mesh->first_triangle ); LL( mesh->first_triangle );
LL( mesh->num_triangles ); LL( mesh->num_triangles );
if ( mesh->name < header->num_text ) {
Q_strncpyz( meshName, (char*)header + header->ofs_text + mesh->name, sizeof (meshName) );
} else {
meshName[0] = '\0';
}
// check ioq3 limits // check ioq3 limits
if ( mesh->num_vertexes > SHADER_MAX_VERTEXES ) if ( mesh->num_vertexes > SHADER_MAX_VERTEXES )
{ {
ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on %s (%i).\n",
mod_name, SHADER_MAX_VERTEXES, mesh->num_vertexes ); mod_name, SHADER_MAX_VERTEXES, meshName[0] ? meshName : "a surface",
mesh->num_vertexes );
return qfalse; return qfalse;
} }
if ( mesh->num_triangles*3 > SHADER_MAX_INDEXES ) if ( mesh->num_triangles*3 > SHADER_MAX_INDEXES )
{ {
ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on a surface (%i).\n", ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on %s (%i).\n",
mod_name, SHADER_MAX_INDEXES / 3, mesh->num_triangles ); mod_name, SHADER_MAX_INDEXES / 3, meshName[0] ? meshName : "a surface",
mesh->num_triangles );
return qfalse; return qfalse;
} }