mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-04-20 16:32:30 +03:00
Fix a detail sprite material bug.
Fix a material bug that is caused by Valve's Aspect Ratio code that is being ran before the world has even spawned.
This commit is contained in:
parent
d603770f99
commit
762f6531b6
@ -1471,25 +1471,6 @@ void CDetailObjectSystem::LevelInitPreEntity()
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_DetailObjects.Count() || m_DetailSpriteDict.Count() )
|
||||
{
|
||||
// There are detail objects in the level, so precache the material
|
||||
PrecacheMaterial( DETAIL_SPRITE_MATERIAL );
|
||||
IMaterial *pMat = m_DetailSpriteMaterial;
|
||||
// adjust for non-square textures (cropped)
|
||||
float flRatio = (float)( pMat->GetMappingWidth() ) / pMat->GetMappingHeight();
|
||||
if ( flRatio > 1.0 )
|
||||
{
|
||||
for( int i = 0; i<m_DetailSpriteDict.Count(); i++ )
|
||||
{
|
||||
m_DetailSpriteDict[i].m_TexUL.y *= flRatio;
|
||||
m_DetailSpriteDict[i].m_TexLR.y *= flRatio;
|
||||
m_DetailSpriteDictFlipped[i].m_TexUL.y *= flRatio;
|
||||
m_DetailSpriteDictFlipped[i].m_TexLR.y *= flRatio;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int detailPropLightingLump;
|
||||
if( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE )
|
||||
{
|
||||
@ -1512,13 +1493,30 @@ void CDetailObjectSystem::LevelInitPreEntity()
|
||||
|
||||
void CDetailObjectSystem::LevelInitPostEntity()
|
||||
{
|
||||
const char *pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL;
|
||||
C_World *pWorld = GetClientWorldEntity();
|
||||
if ( pWorld && pWorld->GetDetailSpriteMaterial() && *(pWorld->GetDetailSpriteMaterial()) )
|
||||
if ( m_DetailObjects.Count() || m_DetailSpriteDict.Count() )
|
||||
{
|
||||
pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial();
|
||||
const char *pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL;
|
||||
C_World *pWorld = GetClientWorldEntity();
|
||||
if ( pWorld && pWorld->GetDetailSpriteMaterial() && *(pWorld->GetDetailSpriteMaterial()) )
|
||||
pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial();
|
||||
|
||||
m_DetailSpriteMaterial.Init( pDetailSpriteMaterial, TEXTURE_GROUP_OTHER );
|
||||
PrecacheMaterial( pDetailSpriteMaterial );
|
||||
IMaterial *pMat = m_DetailSpriteMaterial;
|
||||
|
||||
// adjust for non-square textures (cropped)
|
||||
float flRatio = pMat->GetMappingWidth() / pMat->GetMappingHeight();
|
||||
if ( flRatio > 1.0 )
|
||||
{
|
||||
for( int i = 0; i<m_DetailSpriteDict.Count(); i++ )
|
||||
{
|
||||
m_DetailSpriteDict[i].m_TexUL.y *= flRatio;
|
||||
m_DetailSpriteDict[i].m_TexLR.y *= flRatio;
|
||||
m_DetailSpriteDictFlipped[i].m_TexUL.y *= flRatio;
|
||||
m_DetailSpriteDictFlipped[i].m_TexLR.y *= flRatio;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_DetailSpriteMaterial.Init( pDetailSpriteMaterial, TEXTURE_GROUP_OTHER );
|
||||
|
||||
if ( GetDetailController() )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user