mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-04-07 18:01:16 +00:00
added pattern matching filtering to /modellist /skinlist /imagelist /shaderlist
This commit is contained in:
parent
db4fb31658
commit
1115cb39b0
4 changed files with 54 additions and 18 deletions
|
@ -77,6 +77,8 @@ add: r_mapBrightness now works on q3map2's external lightmap atlas images
|
|||
add: the renderer can now batch surfaces with different (but sufficiently similar) shaders
|
||||
this new optimization works with the output of "Frozen Sand Particle Studio"
|
||||
|
||||
add: /modellist /skinlist /imagelist /shaderlist can now filter results with pattern matching
|
||||
|
||||
chg: SSE2 instruction set support is now required
|
||||
|
||||
chg: removed FreeType 2 and the unused R_REGISTERFONT syscalls that were using it
|
||||
|
|
|
@ -80,16 +80,24 @@ static byte s_intensitytable[256];
|
|||
|
||||
void R_ImageList_f( void )
|
||||
{
|
||||
const char* const match = Cmd_Argc() > 1 ? Cmd_Argv( 1 ) : NULL;
|
||||
|
||||
ri.Printf( PRINT_ALL, "\nwide high MPI W format name\n" );
|
||||
|
||||
int totalPixelCount = 0;
|
||||
int totalByteCount = 0;
|
||||
int imageCount = 0;
|
||||
for ( int i = 0; i < tr.numImages; ++i ) {
|
||||
const image_t* const image = tr.images[i];
|
||||
const int pixelCount = image->width * image->height;
|
||||
const image_t* image = tr.images[i];
|
||||
|
||||
if ( match && !Com_Filter( match, image->name ) )
|
||||
continue;
|
||||
|
||||
const int byteCount = image->width * image->height * (image->format == TF_RGBA8 ? 4 : 1);
|
||||
if ( !(image->flags & IMG_NOMIPMAP) && (image->width > 1) && (image->height > 1) )
|
||||
totalPixelCount += pixelCount * 1.33f; // will overestimate, but that's what we want anyway
|
||||
totalByteCount += (byteCount * 4) / 3; // not exact, but good enough
|
||||
else
|
||||
totalPixelCount += pixelCount;
|
||||
totalByteCount += byteCount;
|
||||
imageCount++;
|
||||
|
||||
ri.Printf( PRINT_ALL, "%4i %4i %c%c%c ",
|
||||
image->width, image->height,
|
||||
|
@ -112,10 +120,17 @@ void R_ImageList_f( void )
|
|||
ri.Printf( PRINT_ALL, " %s\n", image->name );
|
||||
}
|
||||
|
||||
const char* units[] = { "KB", "MB", "GB", "TB" };
|
||||
int amount = totalByteCount >> 10;
|
||||
int unit = 0;
|
||||
while ( amount >= 1024 ) {
|
||||
amount >>= 10;
|
||||
++unit;
|
||||
}
|
||||
|
||||
ri.Printf( PRINT_ALL, "---------\n" );
|
||||
ri.Printf( PRINT_ALL, "%i images\n", tr.numImages );
|
||||
// just assume/pretend that everything is 4-component
|
||||
ri.Printf( PRINT_ALL, "Estimated VRAM use: %iMB\n\n", totalPixelCount / (1024 * 1024 / 4) );
|
||||
ri.Printf( PRINT_ALL, "%i images found\n", imageCount );
|
||||
ri.Printf( PRINT_ALL, "Estimated VRAM use: %i %s\n\n", amount, units[unit] );
|
||||
}
|
||||
|
||||
|
||||
|
@ -995,9 +1010,16 @@ void R_SkinList_f( void )
|
|||
{
|
||||
ri.Printf( PRINT_ALL, "------------------\n" );
|
||||
|
||||
const char* const match = Cmd_Argc() > 1 ? Cmd_Argv( 1 ) : NULL;
|
||||
|
||||
int skinCount = 0;
|
||||
for (int i = 0; i < tr.numSkins; ++i) {
|
||||
const skin_t* skin = tr.skins[i];
|
||||
|
||||
if ( match && !Com_Filter( match, skin->name ) )
|
||||
continue;
|
||||
|
||||
skinCount++;
|
||||
ri.Printf( PRINT_ALL, "%3i:%s\n", i, skin->name );
|
||||
for (int j = 0; j < skin->numSurfaces; ++j) {
|
||||
ri.Printf( PRINT_ALL, " %s = %s\n",
|
||||
|
@ -1005,6 +1027,7 @@ void R_SkinList_f( void )
|
|||
}
|
||||
}
|
||||
|
||||
ri.Printf( PRINT_ALL, "%i skins found\n", skinCount );
|
||||
ri.Printf( PRINT_ALL, "------------------\n" );
|
||||
}
|
||||
|
||||
|
|
|
@ -325,21 +325,27 @@ void R_ModelInit()
|
|||
|
||||
void R_Modellist_f( void )
|
||||
{
|
||||
int i, j;
|
||||
int total = 0;
|
||||
const char* const match = Cmd_Argc() > 1 ? Cmd_Argv( 1 ) : NULL;
|
||||
|
||||
for ( i = 1 ; i < tr.numModels; i++ ) {
|
||||
int total = 0;
|
||||
int models = 0;
|
||||
for ( int i = 1 ; i < tr.numModels; i++ ) {
|
||||
const model_t* mod = tr.models[i];
|
||||
|
||||
if ( match && !Com_Filter( match, mod->name ) )
|
||||
continue;
|
||||
|
||||
int lods = 1;
|
||||
for ( j = 1 ; j < MD3_MAX_LODS ; j++ ) {
|
||||
for ( int j = 1 ; j < MD3_MAX_LODS ; j++ ) {
|
||||
if ( mod->md3[j] && mod->md3[j] != mod->md3[j-1] ) {
|
||||
lods++;
|
||||
}
|
||||
}
|
||||
ri.Printf( PRINT_ALL, "%8i : (%i) %s\n", mod->dataSize, lods, mod->name );
|
||||
total += mod->dataSize;
|
||||
models++;
|
||||
}
|
||||
ri.Printf( PRINT_ALL, "%8i : %i models\n", total, tr.numModels - 1 );
|
||||
ri.Printf( PRINT_ALL, "%8i : %i models found\n", total, models );
|
||||
|
||||
#if 0 // not working right with new hunk
|
||||
if ( tr.world ) {
|
||||
|
|
|
@ -2480,13 +2480,16 @@ const shader_t* R_GetShaderByHandle( qhandle_t hShader )
|
|||
|
||||
void R_ShaderList_f( void )
|
||||
{
|
||||
int i;
|
||||
const char* const match = Cmd_Argc() > 1 ? Cmd_Argv( 1 ) : NULL;
|
||||
|
||||
ri.Printf( PRINT_ALL, "S P L E func name \n" );
|
||||
ri.Printf( PRINT_ALL, "S P L E func order name \n" );
|
||||
|
||||
int count = 0;
|
||||
for ( i = 0 ; i < tr.numShaders ; i++ ) {
|
||||
const shader_t* sh = (ri.Cmd_Argc() > 1) ? tr.sortedShaders[i] : tr.shaders[i];
|
||||
for ( int i = 0 ; i < tr.numShaders ; i++ ) {
|
||||
const shader_t* sh = tr.sortedShaders[i];
|
||||
|
||||
if ( match && !Com_Filter( match, sh->name ) )
|
||||
continue;
|
||||
|
||||
int passes = sh->numStages;
|
||||
for ( int s = 0; s < sh->numStages; ++s )
|
||||
|
@ -2511,6 +2514,8 @@ void R_ShaderList_f( void )
|
|||
ri.Printf( PRINT_ALL, " " );
|
||||
}
|
||||
|
||||
ri.Printf( PRINT_ALL, "%5.2f ", sh->sort );
|
||||
|
||||
if ( sh->defaultShader ) {
|
||||
ri.Printf( PRINT_ALL, ": %s (DEFAULTED)\n", sh->name );
|
||||
} else {
|
||||
|
@ -2519,7 +2524,7 @@ void R_ShaderList_f( void )
|
|||
count++;
|
||||
}
|
||||
|
||||
ri.Printf( PRINT_ALL, "%i total shaders\n", count );
|
||||
ri.Printf( PRINT_ALL, "%i shaders found\n", count );
|
||||
ri.Printf( PRINT_ALL, "--------------------\n" );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue