reduce diff noise

This commit is contained in:
Thomas Debesse 2018-01-28 04:32:58 +01:00
parent 6649445a46
commit bf2da7441f
12 changed files with 129 additions and 146 deletions

View file

@ -1169,24 +1169,24 @@ void WriteTGA( const char *filename, byte *data, int width, int height ) {
free( buffer );
}
void WriteTGAGray (const char *filename, byte *data, int width, int height) {
byte buffer[18];
int i;
int c;
FILE *f;
void WriteTGAGray( const char *filename, byte *data, int width, int height ) {
byte buffer[18];
int i;
int c;
FILE *f;
memset (buffer, 0, 18);
buffer[2] = 3; // uncompressed type
buffer[12] = width&255;
buffer[13] = width>>8;
buffer[14] = height&255;
buffer[15] = height>>8;
buffer[16] = 8; // pixel size
memset( buffer, 0, 18 );
buffer[2] = 3; // uncompressed type
buffer[12] = width & 255;
buffer[13] = width >> 8;
buffer[14] = height & 255;
buffer[15] = height >> 8;
buffer[16] = 8; // pixel size
f = fopen (filename, "wb");
fwrite (buffer, 1, 18, f);
fwrite (data, 1, width * height, f);
fclose (f);
f = fopen( filename, "wb" );
fwrite( buffer, 1, 18, f );
fwrite( data, 1, width * height, f );
fclose( f );
}
/*

View file

@ -39,7 +39,7 @@ void Save256Image( const char *name, byte *pixels, byte *palette,
void LoadTGA( const char *filename, byte **pixels, int *width, int *height );
void LoadTGABuffer( const byte *buffer, const byte* enddata, byte **pic, int *width, int *height );
void WriteTGA( const char *filename, byte *data, int width, int height );
int LoadJPGBuff( void *src_buffer, int src_size, unsigned char **pic, int *width, int *height );
void WriteTGAGray (const char *filename, byte *data, int width, int height);
int LoadJPGBuff( void *src_buffer, int src_size, unsigned char **pic, int *width, int *height );
void Load32BitImage( const char *name, unsigned **pixels, int *width, int *height );

View file

@ -841,12 +841,12 @@ int BSPMain( int argc, char **argv ){
Sys_Printf( "Debug portal surfaces enabled\n" );
debugPortals = qtrue;
}
else if( !strcmp( argv[ i ], "-altsplit" ) )
else if ( !strcmp( argv[ i ], "-altsplit" ) )
{
Sys_Printf( "Alternate BSP splitting (by 27) enabled\n" );
bspAlternateSplitWeights = qtrue;
}
else if( !strcmp( argv[ i ], "-deep" ) )
else if ( !strcmp( argv[ i ], "-deep" ) )
{
Sys_Printf( "Deep BSP tree generation enabled\n" );
deepBSP = qtrue;

View file

@ -318,22 +318,10 @@ void BuildFaceTree_r( node_t *node, face_t *list ){
}
}
#if 0
if((node->compileFlags & C_DETAIL) && isstruct)
Sys_FPrintf(SYS_ERR, "I am detail, my child is structural, this is a wtf1\n", node->has_structural_children);
#endif
for ( i = 0 ; i < 2 ; i++ ) {
BuildFaceTree_r( node->children[i], childLists[i] );
node->has_structural_children |= node->children[i]->has_structural_children;
}
#if 0
if((node->compileFlags & C_DETAIL) && !(node->children[0]->compileFlags & C_DETAIL) && node->children[0]->planenum != PLANENUM_LEAF)
Sys_FPrintf(SYS_ERR, "I am detail, my child is structural\n", node->has_structural_children);
if((node->compileFlags & C_DETAIL) && isstruct)
Sys_FPrintf(SYS_ERR, "I am detail, my child is structural, this is a wtf2\n", node->has_structural_children);
#endif
}

View file

@ -66,7 +66,7 @@
1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
1.0f/66.0f, /* minimap border */
1.0f / 66.0f, /* minimap border */
qtrue, /* minimap keep aspect */
MINIMAP_MODE_GRAY, /* minimap mode */
"../gfx/%s_mini.tga", /* minimap name format */

View file

@ -41,6 +41,7 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2."
content and surface flags - also uses defines from game_quake3.h
------------------------------------------------------------------------------- */
#define UNV_CONT_NOALIENBUILD 0x1000
#define UNV_CONT_NOHUMANBUILD 0x2000
#define UNV_CONT_NOBUILD 0x4000
@ -90,13 +91,11 @@ game_t struct
/* default */
{ "default", Q_CONT_SOLID, -1, 0, -1, C_SOLID, -1 },
/* ydnar */
{ "lightgrid", 0, 0, 0, 0, C_LIGHTGRID, 0 },
{ "antiportal", 0, 0, 0, 0, C_ANTIPORTAL, 0 },
{ "skip", 0, 0, 0, 0, C_SKIP, 0 },
/* compiler */
{ "origin", Q_CONT_ORIGIN, Q_CONT_SOLID, 0, 0, C_ORIGIN | C_TRANSLUCENT, C_SOLID },
{ "areaportal", Q_CONT_AREAPORTAL, Q_CONT_SOLID, 0, 0, C_AREAPORTAL | C_TRANSLUCENT, C_SOLID },
@ -111,7 +110,6 @@ game_t struct
{ "nolightmap", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
{ "pointlight", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
/* game */
{ "nonsolid", 0, Q_CONT_SOLID, Q_SURF_NONSOLID, 0, 0, C_SOLID },
@ -144,7 +142,6 @@ game_t struct
{ "nodlight", 0, 0, Q_SURF_NODLIGHT, 0, 0, 0 },
{ "dust", 0, 0, Q_SURF_DUST, 0, 0, 0 },
/* unvanquished */
{"noalienbuild", UNV_CONT_NOALIENBUILD, 0, 0, 0, 0, 0 },
{"nohumanbuild", UNV_CONT_NOHUMANBUILD, 0, 0, 0, 0, 0 },
@ -154,13 +151,10 @@ game_t struct
{"nohumanbuildsurface", 0, 0, UNV_SURF_NOHUMANBUILDSURFACE, 0, 0, 0 },
{"nobuildsurface", 0, 0, UNV_SURF_NOBUILDSURFACE, 0, 0, 0 },
/* null */
{ NULL, 0, 0, 0, 0, 0, 0 }
}
}
/* end marker */
#endif

View file

@ -1596,8 +1596,9 @@ void DirtyRawLightmap( int rawLightmapNum ){
static qboolean SubmapRawLuxel( rawLightmap_t *lm, int x, int y, float bx, float by, int *sampleCluster, vec3_t sampleOrigin, vec3_t sampleNormal ){
int i, *cluster, *cluster2;
float *origin, *origin2, *normal;
vec3_t originVecs[ 2 ];
float *origin, *origin2, *normal; //% , *normal2;
vec3_t originVecs[ 2 ]; //% , normalVecs[ 2 ];
/* calulate x vector */
if ( ( x < ( lm->sw - 1 ) && bx >= 0.0f ) || ( x == 0 && bx <= 0.0f ) ) {
@ -1612,7 +1613,7 @@ static qboolean SubmapRawLuxel( rawLightmap_t *lm, int x, int y, float bx, float
cluster2 = SUPER_CLUSTER( x, y );
origin2 = SUPER_ORIGIN( x, y );
}
else{
else {
Sys_FPrintf( SYS_WRN, "WARNING: Spurious lightmap S vector\n" );
VectorClear( originVecs[0] );
origin = originVecs[0];
@ -1634,7 +1635,7 @@ static qboolean SubmapRawLuxel( rawLightmap_t *lm, int x, int y, float bx, float
cluster2 = SUPER_CLUSTER( x, y );
origin2 = SUPER_ORIGIN( x, y );
}
else{
else {
Sys_FPrintf( SYS_WRN, "WARNING: Spurious lightmap T vector\n" );
VectorClear( originVecs[1] );
origin = originVecs[1];
@ -2784,7 +2785,6 @@ void SetupBrushesFlags( unsigned int mask_any, unsigned int test_any, unsigned i
bspShader_t *shader;
shaderInfo_t *si;
/* note it */
Sys_FPrintf( SYS_VRB, "--- SetupBrushes ---\n" );
@ -2807,7 +2807,7 @@ void SetupBrushesFlags( unsigned int mask_any, unsigned int test_any, unsigned i
/* check all sides */
inside = qtrue;
compileFlags = 0;
allCompileFlags = ~(0u);
allCompileFlags = ~( 0u );
for ( j = 0; j < brush->numSides && inside; j++ )
{
/* do bsp shader calculations */
@ -2822,12 +2822,12 @@ void SetupBrushesFlags( unsigned int mask_any, unsigned int test_any, unsigned i
/* or together compile flags */
compileFlags |= si->compileFlags;
allCompileFlags &= si->compileFlags;
}
/* determine if this brush is opaque to light */
if( (compileFlags & mask_any) == test_any && (allCompileFlags & mask_all) == test_all )
{
opaqueBrushes[ b >> 3 ] |= (1 << (b & 7));
if ( ( compileFlags & mask_any ) == test_any && ( allCompileFlags & mask_all ) == test_all ) {
opaqueBrushes[ b >> 3 ] |= ( 1 << ( b & 7 ) );
numOpaqueBrushes++;
maxOpaqueBrush = i;
}
@ -2836,9 +2836,8 @@ void SetupBrushesFlags( unsigned int mask_any, unsigned int test_any, unsigned i
/* emit some statistics */
Sys_FPrintf( SYS_VRB, "%9d opaque brushes\n", numOpaqueBrushes );
}
void SetupBrushes( void )
{
SetupBrushesFlags(C_TRANSLUCENT, 0, 0, 0);
void SetupBrushes( void ){
SetupBrushesFlags( C_TRANSLUCENT, 0, 0, 0 );
}

View file

@ -249,8 +249,9 @@ int main( int argc, char **argv ){
}
/* div0: minimap */
else if( !strcmp( argv[ 1 ], "-minimap" ) )
r = MiniMapBSPMain(argc - 1, argv + 1);
else if ( !strcmp( argv[ 1 ], "-minimap" ) ) {
r = MiniMapBSPMain( argc - 1, argv + 1 );
}
/* ydnar: otherwise create a bsp */
else{

View file

@ -389,8 +389,7 @@ void InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shade
{
dv->lightmap[ j ][ 0 ] = 0.0f;
dv->lightmap[ j ][ 1 ] = 0.0f;
if(spawnFlags & 32) // spawnflag 32: model color -> alpha hack
{
if ( spawnFlags & 32 ) { // spawnflag 32: model color -> alpha hack
dv->color[ j ][ 0 ] = 255.0f;
dv->color[ j ][ 1 ] = 255.0f;
dv->color[ j ][ 2 ] = 255.0f;

View file

@ -64,35 +64,35 @@ void WriteFloat( FILE *f, vec_t v ){
}
}
void CountVisportals_r(node_t *node)
{
int i, s;
portal_t *p;
winding_t *w;
void CountVisportals_r( node_t *node ){
int s;
portal_t *p;
winding_t *w;
vec3_t normal;
vec_t dist;
// decision node
if (node->planenum != PLANENUM_LEAF) {
CountVisportals_r (node->children[0]);
CountVisportals_r (node->children[1]);
if ( node->planenum != PLANENUM_LEAF ) {
CountVisportals_r( node->children[0] );
CountVisportals_r( node->children[1] );
return;
}
if (node->opaque) {
if ( node->opaque ) {
return;
}
for (p = node->portals ; p ; p=p->next[s])
for ( p = node->portals ; p ; p = p->next[s] )
{
w = p->winding;
s = (p->nodes[1] == node);
if (w && p->nodes[0] == node)
{
if (!PortalPassable(p))
s = ( p->nodes[1] == node );
if ( w && p->nodes[0] == node ) {
if ( !PortalPassable( p ) ) {
continue;
if(p->nodes[0]->cluster == p->nodes[1]->cluster)
}
if ( p->nodes[0]->cluster == p->nodes[1]->cluster ) {
continue;
}
++num_visportals;
}
}
@ -129,8 +129,9 @@ void WritePortalFile_r( node_t *node ){
if ( !PortalPassable( p ) ) {
continue;
}
if(p->nodes[0]->cluster == p->nodes[1]->cluster)
if ( p->nodes[0]->cluster == p->nodes[1]->cluster ) {
continue;
}
--num_visportals;
// write out to the file
@ -138,17 +139,17 @@ void WritePortalFile_r( node_t *node ){
// the changeover point between different axis. interpret the
// plane the same way vis will, and flip the side orders if needed
// FIXME: is this still relevent?
WindingPlane (w, normal, &dist);
if ( DotProduct (p->plane.normal, normal) < 0.99 )
{ // backwards...
fprintf (pf,"%i %i %i ",w->numpoints, p->nodes[1]->cluster, p->nodes[0]->cluster);
WindingPlane( w, normal, &dist );
if ( DotProduct( p->plane.normal, normal ) < 0.99 ) { // backwards...
fprintf( pf,"%i %i %i ",w->numpoints, p->nodes[1]->cluster, p->nodes[0]->cluster );
}
else{
fprintf( pf,"%i %i %i ",w->numpoints, p->nodes[0]->cluster, p->nodes[1]->cluster );
}
/* ydnar: added this change to make antiportals work */
if ( p->compileFlags & C_HINT ) {
if( p->compileFlags & C_HINT ) {
fprintf( pf, "1 " );
}
else{
@ -170,33 +171,33 @@ void WritePortalFile_r( node_t *node ){
}
void CountSolidFaces_r (node_t *node)
{
int i, s;
portal_t *p;
winding_t *w;
void CountSolidFaces_r( node_t *node ){
int s;
portal_t *p;
winding_t *w;
// decision node
if (node->planenum != PLANENUM_LEAF) {
CountSolidFaces_r (node->children[0]);
CountSolidFaces_r (node->children[1]);
if ( node->planenum != PLANENUM_LEAF ) {
CountSolidFaces_r( node->children[0] );
CountSolidFaces_r( node->children[1] );
return;
}
if (node->opaque) {
if ( node->opaque ) {
return;
}
for (p = node->portals ; p ; p=p->next[s])
for ( p = node->portals ; p ; p = p->next[s] )
{
w = p->winding;
s = (p->nodes[1] == node);
if (w)
{
if (PortalPassable(p))
s = ( p->nodes[1] == node );
if ( w ) {
if ( PortalPassable( p ) ) {
continue;
if(p->nodes[0]->cluster == p->nodes[1]->cluster)
}
if ( p->nodes[0]->cluster == p->nodes[1]->cluster ) {
continue;
}
// write out to the file
++num_solidfaces;
@ -268,29 +269,29 @@ void WriteFaceFile_r( node_t *node ){
}
/*
================
NumberLeafs_r
================
*/
void NumberLeafs_r (node_t *node, int c)
{
portal_t *p;
================
NumberLeafs_r
================
*/
void NumberLeafs_r( node_t *node, int c ){
#if 0
portal_t *p;
#endif
if ( node->planenum != PLANENUM_LEAF ) {
// decision node
node->cluster = -99;
if(node->has_structural_children)
{
NumberLeafs_r (node->children[0], c);
NumberLeafs_r (node->children[1], c);
if ( node->has_structural_children ) {
NumberLeafs_r( node->children[0], c );
NumberLeafs_r( node->children[1], c );
}
else
{
if(c < 0)
if ( c < 0 ) {
c = num_visclusters++;
NumberLeafs_r (node->children[0], c);
NumberLeafs_r (node->children[1], c);
}
NumberLeafs_r( node->children[0], c );
NumberLeafs_r( node->children[1], c );
}
return;
}
@ -303,8 +304,9 @@ void NumberLeafs_r (node_t *node, int c)
return;
}
if(c < 0)
if ( c < 0 ) {
c = num_visclusters++;
}
node->cluster = c;
@ -346,9 +348,9 @@ void NumberClusters( tree_t *tree ) {
Sys_FPrintf( SYS_VRB,"--- NumberClusters ---\n" );
// set the cluster field in every leaf and count the total number of portals
NumberLeafs_r (tree->headnode, -1);
CountVisportals_r (tree->headnode);
CountSolidFaces_r (tree->headnode);
NumberLeafs_r( tree->headnode, -1 );
CountVisportals_r( tree->headnode );
CountSolidFaces_r( tree->headnode );
Sys_FPrintf( SYS_VRB, "%9d visclusters\n", num_visclusters );
Sys_FPrintf( SYS_VRB, "%9d visportals\n", num_visportals );

View file

@ -573,11 +573,11 @@ typedef struct game_s
int lightmapSize; /* bsp lightmap width/height */
float lightmapGamma; /* default lightmap gamma */
float lightmapCompensate; /* default lightmap compensate value */
int miniMapSize; /* minimap size */
float miniMapSharpen; /* minimap sharpening coefficient */
float miniMapBorder; /* minimap border amount */
qboolean miniMapKeepAspect; /* minimap keep aspect ratio by letterboxing */
miniMapMode_t miniMapMode; /* minimap mode */
int miniMapSize; /* minimap size */
float miniMapSharpen; /* minimap sharpening coefficient */
float miniMapBorder; /* minimap border amount */
qboolean miniMapKeepAspect; /* minimap keep aspect ratio by letterboxing */
miniMapMode_t miniMapMode; /* minimap mode */
char *miniMapNameFormat; /* minimap name format */
char *bspIdent; /* 4-letter bsp file prefix */
int bspVersion; /* bsp version to use */
@ -1131,7 +1131,7 @@ typedef struct node_s
struct portal_s *portals; /* also on nodes during construction */
qboolean has_structural_children;
qboolean has_structural_children;
}
node_t;
@ -1766,7 +1766,7 @@ void DirtyRawLightmap( int num );
void IlluminateRawLightmap( int num );
void IlluminateVertexes( int num );
void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all );
void SetupBrushesFlags( unsigned int mask_any, unsigned int test_any, unsigned int mask_all, unsigned int test_all );
void SetupBrushes( void );
void SetupClusters( void );
qboolean ClusterVisible( int a, int b );
@ -1822,7 +1822,7 @@ void EmitVertexRemapShader( char *from, char *to );
void LoadShaderInfo( void );
shaderInfo_t *ShaderInfoForShader( const char *shader );
shaderInfo_t *ShaderInfoForShaderNull( const char *shader );
shaderInfo_t *ShaderInfoForShaderNull( const char *shader );
/* bspfile_abstract.c */
@ -1897,7 +1897,7 @@ Q_EXTERN game_t games[]
,
#include "game_tremulous.h" /*LinuxManMikeC: must be after game_quake3.h, depends on #define's set in it */
,
#include "game_unvanquished.h" /* must be after game_quake3.h as they share defines! */
#include "game_unvanquished.h" /* must be after game_tremulous.h as they share defines! */
,
#include "game_tenebrae.h"
,
@ -1919,7 +1919,7 @@ Q_EXTERN game_t games[]
,
#include "game_reaction.h" /* must be after game_quake3.h */
,
#include "game__null.h" /* null game (must be last item) */
#include "game__null.h" /* null game (must be last item) */
};
#endif
Q_EXTERN game_t *game Q_ASSIGN( &games[ 0 ] );
@ -1967,8 +1967,8 @@ Q_EXTERN qboolean nofog Q_ASSIGN( qfalse );
Q_EXTERN qboolean noHint Q_ASSIGN( qfalse ); /* ydnar */
Q_EXTERN qboolean renameModelShaders Q_ASSIGN( qfalse ); /* ydnar */
Q_EXTERN qboolean skyFixHack Q_ASSIGN( qfalse ); /* ydnar */
Q_EXTERN qboolean bspAlternateSplitWeights Q_ASSIGN( qfalse ); /* 27 */
Q_EXTERN qboolean deepBSP Q_ASSIGN( qfalse ); /* div0 */
Q_EXTERN qboolean bspAlternateSplitWeights Q_ASSIGN( qfalse ); /* 27 */
Q_EXTERN qboolean deepBSP Q_ASSIGN( qfalse ); /* div0 */
Q_EXTERN int patchSubdivisions Q_ASSIGN( 8 ); /* ydnar: -patchmeta subdivisions */
@ -2098,17 +2098,16 @@ Q_EXTERN m4x4_t skyboxTransform;
------------------------------------------------------------------------------- */
/* commandline arguments */
Q_EXTERN qboolean fastvis;
Q_EXTERN qboolean noPassageVis;
Q_EXTERN qboolean passageVisOnly;
Q_EXTERN qboolean mergevis;
Q_EXTERN qboolean mergevisportals;
Q_EXTERN qboolean nosort;
Q_EXTERN qboolean saveprt;
Q_EXTERN qboolean hint; /* ydnar */
Q_EXTERN char inbase[ MAX_QPATH ];
Q_EXTERN char inbase[ MAX_QPATH ];
Q_EXTERN char globalCelShader[ MAX_QPATH ];
Q_EXTERN qboolean fastvis;
Q_EXTERN qboolean noPassageVis;
Q_EXTERN qboolean passageVisOnly;
Q_EXTERN qboolean mergevis;
Q_EXTERN qboolean mergevisportals;
Q_EXTERN qboolean nosort;
Q_EXTERN qboolean saveprt;
Q_EXTERN qboolean hint; /* ydnar */
Q_EXTERN char inbase[ MAX_QPATH ];
Q_EXTERN char globalCelShader[ MAX_QPATH ];
/* other bits */
Q_EXTERN int totalvis;
@ -2394,7 +2393,7 @@ Q_EXTERN int numBSPBrushSides Q_ASSIGN( 0 );
Q_EXTERN bspBrushSide_t bspBrushSides[ MAX_MAP_BRUSHSIDES ];
Q_EXTERN int numBSPLightBytes Q_ASSIGN( 0 );
Q_EXTERN byte *bspLightBytes Q_ASSIGN( NULL );
Q_EXTERN byte *bspLightBytes Q_ASSIGN( NULL );
//% Q_EXTERN int numBSPGridPoints Q_ASSIGN( 0 );
//% Q_EXTERN byte *bspGridPoints Q_ASSIGN( NULL );
@ -2406,7 +2405,7 @@ Q_EXTERN int numBSPVisBytes Q_ASSIGN( 0 );
Q_EXTERN byte bspVisBytes[ MAX_MAP_VISIBILITY ];
Q_EXTERN int numBSPDrawVerts Q_ASSIGN( 0 );
Q_EXTERN bspDrawVert_t *bspDrawVerts Q_ASSIGN( NULL );
Q_EXTERN bspDrawVert_t *bspDrawVerts Q_ASSIGN( NULL );
Q_EXTERN int numBSPDrawIndexes Q_ASSIGN( 0 );
Q_EXTERN int bspDrawIndexes[ MAX_MAP_DRAW_INDEXES ];

View file

@ -802,9 +802,10 @@ static void LoadShaderImages( shaderInfo_t *si ){
*/
shaderInfo_t *ShaderInfoForShaderNull( const char *shaderName ){
if(!strcmp(shaderName, "noshader"))
if ( !strcmp( shaderName, "noshader" ) ) {
return NULL;
return ShaderInfoForShader(shaderName);
}
return ShaderInfoForShader( shaderName );
}
shaderInfo_t *ShaderInfoForShader( const char *shaderName ){
@ -1464,7 +1465,7 @@ static void ParseShaderFile( const char *filename ){
si->lightmapSampleSize = atoi( token );
}
/* q3map_lightmapSampleSffset <value> */
/* q3map_lightmapSampleOffset <value> */
else if ( !Q_stricmp( token, "q3map_lightmapSampleOffset" ) ) {
GetTokenAppend( shaderText, qfalse );
si->lightmapSampleOffset = atof( token );