diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/Renderer.cpp | 262 | ||||
-rw-r--r-- | src/render/Renderer.h | 2 |
2 files changed, 0 insertions, 264 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 03bc175a..10a551fb 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -20,8 +20,6 @@ #include "PointLights.h" #include "Renderer.h" -bool gbShowPedRoadGroups; -bool gbShowCarRoadGroups; bool gbShowCollisionPolys; bool gbShowCollisionLines; bool gbShowCullZoneDebugStuff; @@ -193,23 +191,7 @@ CRenderer::RenderRoads(void) for(i = 0; i < ms_nNoOfVisibleEntities; i++){ t = (CTreadable*)ms_aVisibleEntityPtrs[i]; if(t->IsBuilding() && t->GetIsATreadable()){ -#ifndef MASTER -#ifndef MIAMI - if(gbShowCarRoadGroups || gbShowPedRoadGroups){ - int ind = 0; - if(gbShowCarRoadGroups) - ind += ThePaths.m_pathNodes[t->m_nodeIndices[PATH_CAR][0]].group; - if(gbShowPedRoadGroups) - ind += ThePaths.m_pathNodes[t->m_nodeIndices[PATH_PED][0]].group; - SetAmbientColoursToIndicateRoadGroup(ind); - } -#endif -#endif RenderOneRoad(t); -#ifndef MASTER - if(gbShowCarRoadGroups || gbShowPedRoadGroups) - ReSetAmbientAndDirectionalColours(); -#endif } } } @@ -328,153 +310,6 @@ enum Visbility int32 CRenderer::SetupEntityVisibility(CEntity *ent) { -#ifndef MIAMI - CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(ent->m_modelIndex); - CTimeModelInfo *ti; - int32 other; - float dist; - - bool request = true; - if (mi->GetModelType() == MITYPE_TIME) { - ti = (CTimeModelInfo*)mi; - other = ti->GetOtherTimeModel(); - if(CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())){ - // don't fade in, or between time objects - if(CANTIMECULL) - ti->m_alpha = 255; - }else{ - // Hide if possible - if(CANTIMECULL) - return VIS_INVISIBLE; - // can't cull, so we'll try to draw this one, but don't request - // it since what we really want is the other one. - request = false; - } - }else{ - if (mi->GetModelType() != MITYPE_SIMPLE) { - if(FindPlayerVehicle() == ent && - TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){ - // Player's vehicle in first person mode - if(TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_FORWARD || - ent->GetModelIndex() == MI_RHINO || - ent->GetModelIndex() == MI_COACH || - TheCamera.m_bInATunnelAndABigVehicle){ - ent->bNoBrightHeadLights = true; - }else{ - m_pFirstPersonVehicle = (CVehicle*)ent; - ent->bNoBrightHeadLights = false; - } - return VIS_OFFSCREEN; - }else{ - // All sorts of Clumps - if(ent->m_rwObject == nil || !ent->bIsVisible) - return VIS_INVISIBLE; - if(!ent->GetIsOnScreen()) - return VIS_OFFSCREEN; - if(ent->bDrawLast){ - dist = (ent->GetPosition() - ms_vecCameraPosition).Magnitude(); - CVisibilityPlugins::InsertEntityIntoSortedList(ent, dist); - ent->bDistanceFade = false; - return VIS_INVISIBLE; - }else - return VIS_VISIBLE; - } - return VIS_INVISIBLE; - } - if(ent->IsObject() && - ((CObject*)ent)->ObjectCreatedBy == TEMP_OBJECT){ - if(ent->m_rwObject == nil || !ent->bIsVisible) - return VIS_INVISIBLE; - return ent->GetIsOnScreen() ? VIS_VISIBLE : VIS_OFFSCREEN; - } - } - - // Simple ModelInfo - - dist = (ent->GetPosition() - ms_vecCameraPosition).Magnitude(); - - // This can only happen with multi-atomic models (e.g. railtracks) - // but why do we bump up the distance? can only be fading... - if(LOD_DISTANCE + STREAM_DISTANCE < dist && dist < mi->GetLargestLodDistance()) - dist = mi->GetLargestLodDistance(); - - if(ent->IsObject() && ent->bRenderDamaged) - mi->m_isDamaged = true; - - RpAtomic *a = mi->GetAtomicFromDistance(dist); - if(a){ - mi->m_isDamaged = false; - if(ent->m_rwObject == nil) - ent->CreateRwObject(); - assert(ent->m_rwObject); - RpAtomic *rwobj = (RpAtomic*)ent->m_rwObject; - // Make sure our atomic uses the right geometry and not - // that of an atomic for another draw distance. - if(RpAtomicGetGeometry(a) != RpAtomicGetGeometry(rwobj)) - RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?) - mi->IncreaseAlpha(); - if(ent->m_rwObject == nil || !ent->bIsVisible) - return VIS_INVISIBLE; - - if(!ent->GetIsOnScreen()){ - mi->m_alpha = 255; - return VIS_OFFSCREEN; - } - - if(mi->m_alpha != 255){ - CVisibilityPlugins::InsertEntityIntoSortedList(ent, dist); - ent->bDistanceFade = true; - return VIS_INVISIBLE; - } - - if(mi->m_drawLast || ent->bDrawLast){ - CVisibilityPlugins::InsertEntityIntoSortedList(ent, dist); - ent->bDistanceFade = false; - return VIS_INVISIBLE; - } - return VIS_VISIBLE; - } - - // Object is not loaded, figure out what to do - - if(mi->m_noFade){ - mi->m_isDamaged = false; - // request model - if(dist - STREAM_DISTANCE < mi->GetLargestLodDistance() && request) - return VIS_STREAMME; - return VIS_INVISIBLE; - } - - // We might be fading - - a = mi->GetAtomicFromDistance(dist - FADE_DISTANCE); - mi->m_isDamaged = false; - if(a == nil){ - // request model - if(dist - FADE_DISTANCE - STREAM_DISTANCE < mi->GetLargestLodDistance() && request) - return VIS_STREAMME; - return VIS_INVISIBLE; - } - - if(ent->m_rwObject == nil) - ent->CreateRwObject(); - assert(ent->m_rwObject); - RpAtomic *rwobj = (RpAtomic*)ent->m_rwObject; - if(RpAtomicGetGeometry(a) != RpAtomicGetGeometry(rwobj)) - RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?) - mi->IncreaseAlpha(); - if(ent->m_rwObject == nil || !ent->bIsVisible) - return VIS_INVISIBLE; - - if(!ent->GetIsOnScreen()){ - mi->m_alpha = 255; - return VIS_OFFSCREEN; - }else{ - CVisibilityPlugins::InsertEntityIntoSortedList(ent, dist); - ent->bDistanceFade = true; - return VIS_OFFSCREEN; // Why this? - } -#else CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(ent->m_modelIndex); CTimeModelInfo *ti; int32 other; @@ -625,95 +460,11 @@ CRenderer::SetupEntityVisibility(CEntity *ent) ent->bDistanceFade = true; return VIS_OFFSCREEN; // Why this? } -#endif } int32 CRenderer::SetupBigBuildingVisibility(CEntity *ent) { -#ifndef MIAMI - CSimpleModelInfo *mi = (CSimpleModelInfo *)CModelInfo::GetModelInfo(ent->GetModelIndex()); - CTimeModelInfo *ti; - int32 other; - - if (mi->GetModelType() == MITYPE_TIME) { - ti = (CTimeModelInfo*)mi; - other = ti->GetOtherTimeModel(); - // Hide objects not in time range if possible - if(CANTIMECULL) - if(!CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())) - return VIS_INVISIBLE; - // Draw like normal - } else if (mi->GetModelType() == MITYPE_VEHICLE) - return ent->IsVisible() ? VIS_VISIBLE : VIS_INVISIBLE; - - float dist = (ms_vecCameraPosition-ent->GetPosition()).Magnitude(); - CSimpleModelInfo *nonLOD = mi->GetRelatedModel(); - - // Find out whether to draw below near distance. - // This is only the case if there is a non-LOD which is either not - // loaded or not completely faded in yet. - if(dist < mi->GetNearDistance() && dist < LOD_DISTANCE + STREAM_DISTANCE){ - // No non-LOD or non-LOD is completely visible. - if(nonLOD == nil || - nonLOD->GetRwObject() && nonLOD->m_alpha == 255) - return VIS_INVISIBLE; - - // But if it is a time object, we'd rather draw the wrong - // non-LOD than the right LOD. - if (nonLOD->GetModelType() == MITYPE_TIME) { - ti = (CTimeModelInfo*)nonLOD; - other = ti->GetOtherTimeModel(); - if(other != -1 && CModelInfo::GetModelInfo(other)->GetRwObject()) - return VIS_INVISIBLE; - } - } - - RpAtomic *a = mi->GetAtomicFromDistance(dist); - if(a){ - if(ent->m_rwObject == nil) - ent->CreateRwObject(); - assert(ent->m_rwObject); - RpAtomic *rwobj = (RpAtomic*)ent->m_rwObject; - - // Make sure our atomic uses the right geometry and not - // that of an atomic for another draw distance. - if(RpAtomicGetGeometry(a) != RpAtomicGetGeometry(rwobj)) - RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?) - if(!ent->IsVisibleComplex()) - return VIS_INVISIBLE; - if(mi->m_drawLast){ - CVisibilityPlugins::InsertEntityIntoSortedList(ent, dist); - ent->bDistanceFade = false; - return VIS_INVISIBLE; - } - return VIS_VISIBLE; - } - - if(mi->m_noFade){ - ent->DeleteRwObject(); - return VIS_INVISIBLE; - } - - - // get faded atomic - a = mi->GetAtomicFromDistance(dist - FADE_DISTANCE); - if(a == nil){ - ent->DeleteRwObject(); - return VIS_INVISIBLE; - } - - // Fade... - if(ent->m_rwObject == nil) - ent->CreateRwObject(); - assert(ent->m_rwObject); - RpAtomic *rwobj = (RpAtomic*)ent->m_rwObject; - if(RpAtomicGetGeometry(a) != RpAtomicGetGeometry(rwobj)) - RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?) - if(ent->IsVisibleComplex()) - CVisibilityPlugins::InsertEntityIntoSortedList(ent, dist); - return VIS_INVISIBLE; -#else CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(ent->m_modelIndex); CTimeModelInfo *ti; int32 other; @@ -827,7 +578,6 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent) }else mi->m_alpha = 255; return VIS_INVISIBLE; -#endif } void @@ -974,11 +724,7 @@ CRenderer::ScanWorld(void) } ScanSectorPoly(poly, 3, ScanSectorList); -#ifndef MIAMI - ScanBigBuildingList(CWorld::GetBigBuildingList(CCollision::ms_collisionInMemory)); -#else ScanBigBuildingList(CWorld::GetBigBuildingList(CGame::currLevel)); -#endif ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_NONE)); } } @@ -1223,13 +969,6 @@ CRenderer::ScanBigBuildingList(CPtrList &list) CPtrNode *node; CEntity *ent; -#ifndef MIAMI - for(node = list.first; node; node = node->next){ - ent = (CEntity*)node->item; - if(!ent->bZoneCulled && SetupBigBuildingVisibility(ent) == VIS_VISIBLE) - ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent; - } -#else // TODO(MIAMI): some flags and such for(node = list.first; node; node = node->next){ ent = (CEntity*)node->item; @@ -1243,7 +982,6 @@ CRenderer::ScanBigBuildingList(CPtrList &list) break; } } -#endif } void diff --git a/src/render/Renderer.h b/src/render/Renderer.h index e28995c3..5bf211e4 100644 --- a/src/render/Renderer.h +++ b/src/render/Renderer.h @@ -2,8 +2,6 @@ class CEntity; -extern bool gbShowPedRoadGroups; -extern bool gbShowCarRoadGroups; extern bool gbShowCollisionPolys; extern bool gbShowCollisionLines; extern bool gbShowCullZoneDebugStuff; |