From 92952941f339c0ce58cd89dd5bd5216483b65dc1 Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 31 Oct 2014 14:29:39 +0100 Subject: [PATCH] disable backface culling for detached car components --- SAFix/GeneralSA.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SAFix/GeneralSA.cpp b/SAFix/GeneralSA.cpp index cb4bcd0..5b90e31 100644 --- a/SAFix/GeneralSA.cpp +++ b/SAFix/GeneralSA.cpp @@ -67,6 +67,14 @@ void CObject::Render() SetEditableMaterialsCB(reinterpret_cast(m_pRwObject), &pData); pData->first = nullptr; + // Disable backface culling for the part +#ifdef _DEBUG + RwCullMode oldCullMode; + RwRenderStateGet(rwRENDERSTATECULLMODE, &oldCullMode); + assert(oldCullMode == rwCULLMODECULLBACK); +#endif + RwRenderStateSet(rwRENDERSTATECULLMODE, reinterpret_cast(rwCULLMODECULLNONE)); + bCallRestore = true; } else @@ -75,7 +83,10 @@ void CObject::Render() CEntity::Render(); if ( bCallRestore ) + { ResetEditableMaterials(materialRestoreData); + RwRenderStateSet(rwRENDERSTATECULLMODE, reinterpret_cast(rwCULLMODECULLBACK)); + } } RwCamera* CShadowCamera::Update(CEntity* pEntity)