diff options
Diffstat (limited to '')
-rw-r--r-- | src/render/Renderer.cpp | 22 | ||||
-rw-r--r-- | src/render/Renderer.h | 8 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 165ef235..b131e6c3 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -82,14 +82,6 @@ CVehicle *CRenderer::m_pFirstPersonVehicle; bool CRenderer::m_loadingPriority; float CRenderer::ms_lodDistScale = 1.2f; -#ifdef EXTRA_MODEL_FLAGS -#define BACKFACE_CULLING_ON SetCullMode(rwCULLMODECULLBACK) -#define BACKFACE_CULLING_OFF SetCullMode(rwCULLMODECULLNONE) -#else -#define BACKFACE_CULLING_ON -#define BACKFACE_CULLING_OFF -#endif - // unused BlockedRange CRenderer::aBlockedRanges[16]; BlockedRange *CRenderer::pFullBlockedRanges; @@ -442,6 +434,14 @@ CRenderer::RenderOneBuilding(CEntity *ent, float camdist) RpAtomic *atomic = (RpAtomic*)ent->m_rwObject; CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(ent->GetModelIndex()); +#ifdef EXTRA_MODEL_FLAGS + bool resetCull = false; + if(!ent->IsBuilding() || mi->RenderDoubleSided()){ + resetCull = true; + BACKFACE_CULLING_OFF; + } +#endif + int pass = PASS_BLEND; if(mi->m_additive) // very questionable pass = PASS_ADD; @@ -471,6 +471,11 @@ CRenderer::RenderOneBuilding(CEntity *ent, float camdist) }else WorldRender::AtomicFirstPass(atomic, pass); +#ifdef EXTRA_MODEL_FLAGS + if(resetCull) + BACKFACE_CULLING_ON; +#endif + ent->bImBeingRendered = false; // TODO: this seems wrong, but do we even need it? } @@ -482,6 +487,7 @@ CRenderer::RenderWorld(int pass) CLink<CVisibilityPlugins::AlphaObjectInfo> *node; RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE); + BACKFACE_CULLING_ON; DeActivateDirectional(); SetAmbientColours(); diff --git a/src/render/Renderer.h b/src/render/Renderer.h index 35b43a0b..0322939c 100644 --- a/src/render/Renderer.h +++ b/src/render/Renderer.h @@ -10,6 +10,14 @@ class CEntity; #define FADE_DISTANCE 20.0f #define STREAM_DISTANCE 30.0f +#ifdef EXTRA_MODEL_FLAGS +#define BACKFACE_CULLING_ON SetCullMode(rwCULLMODECULLBACK) +#define BACKFACE_CULLING_OFF SetCullMode(rwCULLMODECULLNONE) +#else +#define BACKFACE_CULLING_ON +#define BACKFACE_CULLING_OFF +#endif + extern bool gbShowPedRoadGroups; extern bool gbShowCarRoadGroups; extern bool gbShowCollisionPolys; |