Example #1
0
float GetSurfaceExtraLongestCurve( int num )
{
	surfaceExtra_t	*se = GetSurfaceExtra( num );
	return se->longestCurve;
}
Example #2
0
int GetSurfaceExtraRecvShadows( int num )
{
	surfaceExtra_t	*se = GetSurfaceExtra( num );
	return se->recvShadows;
}
Example #3
0
int GetSurfaceExtraSampleSize( int num )
{
	surfaceExtra_t	*se = GetSurfaceExtra( num );
	return se->sampleSize;
}
Example #4
0
int GetSurfaceExtraEntityNum( int num )
{
	surfaceExtra_t	*se = GetSurfaceExtra( num );
	return se->entityNum;
}
Example #5
0
int GetSurfaceExtraCastShadows( int num )
{
	surfaceExtra_t	*se = GetSurfaceExtra( num );
	return se->castShadows;
}
Example #6
0
int GetSurfaceExtraParentSurfaceNum( int num )
{
	return GetSurfaceExtra( num )->parentSurfaceNum;
}
Example #7
0
int GetSurfaceExtraParentSurfaceNum( int num )
{
	surfaceExtra_t	*se = GetSurfaceExtra( num );
	return se->parentSurfaceNum;
}
Example #8
0
void GetSurfaceExtraLightmapAxis( int num, vec3_t lightmapAxis )
{
	VectorCopy( GetSurfaceExtra( num )->lightmapAxis, lightmapAxis );
}
Example #9
0
/*
=================
WriteSurfaceExtraFile

writes out a surface info file (<map>.srf)
=================
*/
void WriteSurfaceExtraFile( const char *path )
{
	char		srfPath[MAX_SYSPATH];
	file_t		*sf;
	surfaceExtra_t	*se;
	int		i;

	if( path == NULL || path[0] == '\0' )
		return;
	
	MsgDev( D_NOTE, "--- WriteSurfaceExtraFile ---\n" );
	
	com.snprintf( srfPath, sizeof( srfPath ), "maps/%s", path );
	FS_StripExtension( srfPath );
	FS_DefaultExtension( srfPath, ".srf" );
	Msg( "Writing %s\n", srfPath );
	sf = FS_Open( srfPath, "w" );
	if( !sf ) Sys_Error( "Error opening %s for writing", srfPath );
	
	for( i = -1; i < numSurfaceExtras; i++ )
	{
		se = GetSurfaceExtra( i );
		
		if( i < 0 ) FS_Printf( sf, "default" );
		else FS_Printf( sf, "%d", i );
		
		if( se->mds == NULL ) FS_Printf( sf, "\n" );
		else
		{
			FS_Printf( sf, " // %s V: %d I: %d %s\n", surfaceTypes[se->mds->type], se->mds->numVerts, se->mds->numIndexes,
			(se->mds->planar ? "planar" : ""));
		}
		
		FS_Printf( sf, "{\n" );
		
		if( se->si != NULL ) FS_Printf( sf, "\tshader %s\n", se->si->shader );
			
		if( se->parentSurfaceNum != seDefault.parentSurfaceNum )
			FS_Printf( sf, "\tparent %d\n", se->parentSurfaceNum );
			
		if( se->entityNum != seDefault.entityNum )
			FS_Printf( sf, "\tentity %d\n", se->entityNum );
			
		if( se->castShadows != seDefault.castShadows || se == &seDefault )
			FS_Printf( sf, "\tcastShadows %d\n", se->castShadows );
			
		if( se->recvShadows != seDefault.recvShadows || se == &seDefault )
			FS_Printf( sf, "\treceiveShadows %d\n", se->recvShadows );
			
		if( se->sampleSize != seDefault.sampleSize || se == &seDefault )
			FS_Printf( sf, "\tsampleSize %d\n", se->sampleSize );
			
		if( se->longestCurve != seDefault.longestCurve || se == &seDefault )
			FS_Printf( sf, "\tlongestCurve %f\n", se->longestCurve );
			
		if( VectorCompare( se->lightmapAxis, seDefault.lightmapAxis ) == false )
			FS_Printf( sf, "\tlightmapAxis ( %f %f %f )\n", se->lightmapAxis[0], se->lightmapAxis[1], se->lightmapAxis[2] );
		FS_Printf( sf, "}\n\n" );
	}
	FS_Close( sf );
}
Example #10
0
int GetSurfaceExtraSampleSize( int num )
{
	return GetSurfaceExtra( num )->sampleSize;
}
Example #11
0
float GetSurfaceExtraLongestCurve( int num )
{
	return GetSurfaceExtra( num )->longestCurve;
}
Example #12
0
int GetSurfaceExtraRecvShadows( int num )
{
	return GetSurfaceExtra( num )->recvShadows;
}
Example #13
0
int GetSurfaceExtraCastShadows( int num )
{
	return GetSurfaceExtra( num )->castShadows;
}
Example #14
0
int GetSurfaceExtraEntityNum( int num )
{
	return GetSurfaceExtra( num )->entityNum;
}
Example #15
0
void GetSurfaceExtraLightmapAxis( int num, vec3_t lightmapAxis )
{
	surfaceExtra_t	*se = GetSurfaceExtra( num );
	VectorCopy( se->lightmapAxis, lightmapAxis );
}
Example #16
0
shaderInfo_t *GetSurfaceExtraShaderInfo( int num )
{
	surfaceExtra_t	*se = GetSurfaceExtra( num );
	return se->si;
}
Example #17
0
void WriteSurfaceExtraFile( const char *path )
{
	char			srfPath[ 1024 ];
	FILE			*sf;
	surfaceExtra_t	*se;
	int				i;
	
	
	/* dummy check */
	if( path == NULL || path[ 0 ] == '\0' )
		return;
	
	/* note it */
	Sys_Printf( "--- WriteSurfaceExtraFile ---\n" );
	
	/* open the file */
	strcpy( srfPath, path );
	StripExtension( srfPath );
	strcat( srfPath, ".srf" );
	Sys_Printf( "Writing %s\n", srfPath );
	sf = fopen( srfPath, "w" );
	if( sf == NULL )
		Error( "Error opening %s for writing", srfPath );
	
	/* lap through the extras list */
	for( i = -1; i < numSurfaceExtras; i++ )
	{
		/* get extra */
		se = GetSurfaceExtra( i );
		
		/* default or surface num? */
		if( i < 0 )
			fprintf( sf, "default" );
		else
			fprintf( sf, "%d", i );
		
		/* valid map drawsurf? */
		if( se->mds == NULL )
			fprintf( sf, "\n" );
		else
		{
			fprintf( sf, " // %s V: %d I: %d %s\n",
				surfaceTypes[ se->mds->type ],
				se->mds->numVerts,
				se->mds->numIndexes,
				(se->mds->planar ? "planar" : "") );
		}
		
		/* open braces */
		fprintf( sf, "{\n" );
		
			/* shader */
			if( se->si != NULL )
				fprintf( sf, "\tshader %s\n", se->si->shader );
			
			/* parent surface number */
			if( se->parentSurfaceNum != seDefault.parentSurfaceNum )
				fprintf( sf, "\tparent %d\n", se->parentSurfaceNum );
			
			/* entity number */
			if( se->entityNum != seDefault.entityNum )
				fprintf( sf, "\tentity %d\n", se->entityNum );
			
			/* cast shadows */
			if( se->castShadows != seDefault.castShadows || se == &seDefault )
				fprintf( sf, "\tcastShadows %d\n", se->castShadows );
			
			/* recv shadows */
			if( se->recvShadows != seDefault.recvShadows || se == &seDefault )
				fprintf( sf, "\treceiveShadows %d\n", se->recvShadows );
			
			/* lightmap sample size */
			if( se->sampleSize != seDefault.sampleSize || se == &seDefault )
				fprintf( sf, "\tsampleSize %d\n", se->sampleSize );
			
			/* longest curve */
			if( se->longestCurve != seDefault.longestCurve || se == &seDefault )
				fprintf( sf, "\tlongestCurve %f\n", se->longestCurve );
			
			/* lightmap axis vector */
			if( VectorCompare( se->lightmapAxis, seDefault.lightmapAxis ) == qfalse )
				fprintf( sf, "\tlightmapAxis ( %f %f %f )\n", se->lightmapAxis[ 0 ], se->lightmapAxis[ 1 ], se->lightmapAxis[ 2 ] );
		
		/* close braces */
		fprintf( sf, "}\n\n" );
	}
	
	/* close the file */
	fclose( sf );
}
Example #18
0
shaderInfo_t *GetSurfaceExtraShaderInfo( int num )
{
	return GetSurfaceExtra( num )->si;
}