Ejemplo n.º 1
0
/*
=================
ParseBrush
=================
*/
static void ParseBrush( const idMapBrush *mapBrush, int primitiveNum ) {
	uBrush_t	*b;
	side_t		*s;
	const idMapBrushSide	*ms;
	int			i;
	bool		fixedDegeneracies = false;
	buildBrush->entitynum = dmapGlobals.num_entities - 1;
	buildBrush->brushnum = entityPrimitive;
	buildBrush->numsides = mapBrush->GetNumSides();
	for( i = 0 ; i < mapBrush->GetNumSides() ; i++ ) {
		s = &buildBrush->sides[i];
		ms = mapBrush->GetSide( i );
		memset( s, 0, sizeof( *s ) );
		s->planenum = FindFloatPlane( ms->GetPlane(), &fixedDegeneracies );
		s->material = declManager->FindMaterial( ms->GetMaterial() );
		ms->GetTextureVectors( s->texVec.v );
		// remove any integral shift, which will help with grouping
		s->texVec.v[0][3] -= floor( s->texVec.v[0][3] );
		s->texVec.v[1][3] -= floor( s->texVec.v[1][3] );
	}
	// if there are mirrored planes, the entire brush is invalid
	if( !RemoveDuplicateBrushPlanes( buildBrush ) ) {
		return;
	}
	// get the content for the entire brush
	SetBrushContents( buildBrush );
	b = FinishBrush();
	if( !b ) {
		return;
	}
	if( fixedDegeneracies && dmapGlobals.verboseentities ) {
		common->Warning( "brush %d has degenerate plane equations", primitiveNum );
	}
}
Ejemplo n.º 2
0
/*
=================
ParseBrush

parses a brush out of a map file and sets it up
=================
*/
static bool ParseBrush( bool onlyLights )
{
	brush_t	*b;
	
	ParseRawBrush( onlyLights );
	
	// only go this far?
	if( onlyLights ) return true;
	
	buildBrush->portalareas[0] = -1;
	buildBrush->portalareas[1] = -1;
	buildBrush->entityNum = numMapEntities - 1;
	buildBrush->brushNum = entitySourceBrushes;
	
	// if there are mirrored planes, the entire brush is invalid
	if( !RemoveDuplicateBrushPlanes( buildBrush ))
		return true;
	
	SetBrushContents( buildBrush );
	
	// allow detail brushes to be removed
	if( nodetail && (buildBrush->compileFlags & C_DETAIL ))
		return true;
	
	// allow liquid brushes to be removed
	if( nowater && (buildBrush->compileFlags & C_LIQUID ))
		return true;
	
	// allow hint brushes to be removed
	if( noHint && (buildBrush->compileFlags & C_HINT ))
		return true;
	
	b = FinishBrush();
	if( !b ) return false;
	return true;
}