예제 #1
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pSolid - 
//			pList - 
// Output : 
//-----------------------------------------------------------------------------
static BOOL _CheckLightmapSizeOnDisplacement( CMapSolid *pSolid, CListBox *pList )
{
	//
	// check all faces with the displacement parameter for proper 
	// lightmap size
	//
	int faceCount = pSolid->GetFaceCount();
	for( int i = 0; i < faceCount; i++ )
	{
		//
		// check for faces with a displacement map
		//
		CMapFace *pFace = pSolid->GetFace( i );
		if( !pFace->HasDisp() )
			continue;

		//
		// check the lightmap extents
		//
		if( !pFace->ValidLightmapSize() )
		{
			AddError( pList, ErrorInvalidLightmapSizeOnDisplacement, i, pSolid );
			break;
		}		
	}

	return TRUE;
}
예제 #2
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
static void FixInvalidLightmapSizeOnDisplacement( MapError *pError )
{
	CMapSolid *pSolid = ( CMapSolid* )pError->pObjects[0];

	//
	// check and fix all displacement faces of the solid with improper lightmap
	// extents
	//
	int faceCount = pSolid->GetFaceCount();
	for( int i = 0; i < faceCount; i++ )
	{
		CMapFace *pFace = pSolid->GetFace( i );
		if( !pFace->HasDisp() )
			continue;

		// find the bad surfaces
		if( pFace->ValidLightmapSize() )
			continue;

		// adjust the lightmap scale
		pFace->AdjustLightmapScale();
	}
}