mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
Merge branch 'main' into dev
This commit is contained in:
commit
e7a2a79de5
1 changed files with 7 additions and 12 deletions
|
@ -25,10 +25,10 @@ auto SetEditableMaterialsCB = AddressByVersion<RpAtomic*(*)(RpAtomic*,void*)>(0x
|
||||||
|
|
||||||
void* (CEntity::*CEntity::orgGetColModel)();
|
void* (CEntity::*CEntity::orgGetColModel)();
|
||||||
|
|
||||||
static void ResetEditableMaterials(std::pair<void*,int>* pData)
|
static void ResetEditableMaterials(std::pair<void**,void*> pData[], size_t num)
|
||||||
{
|
{
|
||||||
for ( auto* i = pData; i->first != nullptr; i++ )
|
for (size_t i = 0; i < num; ++i)
|
||||||
*static_cast<int*>(i->first) = i->second;
|
*pData[i].first = pData[i].second;
|
||||||
}
|
}
|
||||||
|
|
||||||
RpAtomic* ShadowCameraRenderCB(RpAtomic* pAtomic)
|
RpAtomic* ShadowCameraRenderCB(RpAtomic* pAtomic)
|
||||||
|
@ -66,8 +66,8 @@ void CObject::Render()
|
||||||
if ( m_bDoNotRender || !m_pRwObject )
|
if ( m_bDoNotRender || !m_pRwObject )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool bCallRestore = false;
|
std::pair<void**,void*> materialRestoreData[256];
|
||||||
std::pair<void*,int> materialRestoreData[16];
|
size_t numMaterialsToRestore = 0;
|
||||||
|
|
||||||
RwScopedRenderState cullState(rwRENDERSTATECULLMODE);
|
RwScopedRenderState cullState(rwRENDERSTATECULLMODE);
|
||||||
|
|
||||||
|
@ -83,20 +83,15 @@ void CObject::Render()
|
||||||
|
|
||||||
SetEditableMaterialsCB(reinterpret_cast<RpAtomic*>(m_pRwObject), &pData);
|
SetEditableMaterialsCB(reinterpret_cast<RpAtomic*>(m_pRwObject), &pData);
|
||||||
assert( pData >= std::begin(materialRestoreData) && pData < std::end(materialRestoreData) );
|
assert( pData >= std::begin(materialRestoreData) && pData < std::end(materialRestoreData) );
|
||||||
pData->first = nullptr;
|
numMaterialsToRestore = std::distance(materialRestoreData, pData);
|
||||||
|
|
||||||
// Disable backface culling for the part
|
// Disable backface culling for the part
|
||||||
RwRenderStateSet(rwRENDERSTATECULLMODE, reinterpret_cast<void*>(rwCULLMODECULLNONE));
|
RwRenderStateSet(rwRENDERSTATECULLMODE, reinterpret_cast<void*>(rwCULLMODECULLNONE));
|
||||||
|
|
||||||
bCallRestore = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity::Render();
|
CEntity::Render();
|
||||||
|
|
||||||
if ( bCallRestore )
|
ResetEditableMaterials(materialRestoreData, numMaterialsToRestore);
|
||||||
{
|
|
||||||
ResetEditableMaterials(materialRestoreData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void (*WorldRemove)(CEntity*);
|
extern void (*WorldRemove)(CEntity*);
|
||||||
|
|
Loading…
Reference in a new issue