Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/graphics/GameView.cpp
Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | |||||
/////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////// | ||||
// This callback is part of the Scene interface | // This callback is part of the Scene interface | ||||
// Submit all objects visible in the given frustum | // Submit all objects visible in the given frustum | ||||
void CGameView::EnumerateObjects(const CFrustum& frustum, SceneCollector* c) | void CGameView::EnumerateObjects(const CFrustum& frustum, SceneCollector* c) | ||||
{ | { | ||||
{ | { | ||||
PROFILE3("submit terrain"); | PROFILE3("submit terrain"); | ||||
CTerrain* pTerrain = m->Game->GetWorld()->GetTerrain(); | const CTerrain& terrain = m->Game->GetWorld()->GetTerrain(); | ||||
float waterHeight = g_Renderer.GetSceneRenderer().GetWaterManager().m_WaterHeight + 0.001f; | float waterHeight = g_Renderer.GetSceneRenderer().GetWaterManager().m_WaterHeight + 0.001f; | ||||
const ssize_t patchesPerSide = pTerrain->GetPatchesPerSide(); | const ssize_t patchesPerSide = terrain.GetPatchesPerSide(); | ||||
// find out which patches will be drawn | // find out which patches will be drawn | ||||
for (ssize_t j=0; j<patchesPerSide; ++j) | for (ssize_t j=0; j<patchesPerSide; ++j) | ||||
{ | { | ||||
for (ssize_t i=0; i<patchesPerSide; ++i) | for (ssize_t i=0; i<patchesPerSide; ++i) | ||||
{ | { | ||||
CPatch* patch=pTerrain->GetPatch(i,j); // can't fail | CPatch* const patch = terrain.GetPatch(i,j); // can't fail | ||||
// If the patch is underwater, calculate a bounding box that also contains the water plane | // If the patch is underwater, calculate a bounding box that also contains the water plane | ||||
CBoundingBoxAligned bounds = patch->GetWorldBounds(); | CBoundingBoxAligned bounds = patch->GetWorldBounds(); | ||||
if(bounds[1].Y < waterHeight) | if(bounds[1].Y < waterHeight) | ||||
bounds[1].Y = waterHeight; | bounds[1].Y = waterHeight; | ||||
if (!m->Culling || frustum.IsBoxVisible(bounds)) | if (!m->Culling || frustum.IsBoxVisible(bounds)) | ||||
c->Submit(patch); | c->Submit(patch); | ||||
▲ Show 20 Lines • Show All 128 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator