Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/GameView.cpp
Show First 20 Lines • Show All 575 Lines • ▼ Show 20 Lines | static void FocusHeight(CGameViewImpl* m, bool smooth) | ||||
// horizontal view radius | // horizontal view radius | ||||
const float radius = sqrtf(forwards.X * forwards.X + forwards.Z * forwards.Z) * m->Zoom.GetSmoothedValue(); | const float radius = sqrtf(forwards.X * forwards.X + forwards.Z * forwards.Z) * m->Zoom.GetSmoothedValue(); | ||||
const float near_radius = radius * m->HeightSmoothness; | const float near_radius = radius * m->HeightSmoothness; | ||||
const float pivot_radius = radius * m->HeightSmoothness; | const float pivot_radius = radius * m->HeightSmoothness; | ||||
const CVector3D nearPoint = position + forwards * m->ViewNear; | const CVector3D nearPoint = position + forwards * m->ViewNear; | ||||
const CVector3D pivotPoint = position + forwards * m->Zoom.GetSmoothedValue(); | const CVector3D pivotPoint = position + forwards * m->Zoom.GetSmoothedValue(); | ||||
const float ground = m->Game->GetWorld()->GetTerrain()->GetExactGroundLevel(nearPoint.X, nearPoint.Z); | const float ground = std::max( | ||||
m->Game->GetWorld()->GetTerrain()->GetExactGroundLevel(nearPoint.X, nearPoint.Z), | |||||
g_Renderer.GetWaterManager()->m_WaterHeight); | |||||
// filter ground levels for smooth camera movement | // filter ground levels for smooth camera movement | ||||
const float filtered_near_ground = m->Game->GetWorld()->GetTerrain()->GetFilteredGroundLevel(nearPoint.X, nearPoint.Z, near_radius); | const float filtered_near_ground = m->Game->GetWorld()->GetTerrain()->GetFilteredGroundLevel(nearPoint.X, nearPoint.Z, near_radius); | ||||
const float filtered_pivot_ground = m->Game->GetWorld()->GetTerrain()->GetFilteredGroundLevel(pivotPoint.X, pivotPoint.Z, pivot_radius); | const float filtered_pivot_ground = m->Game->GetWorld()->GetTerrain()->GetFilteredGroundLevel(pivotPoint.X, pivotPoint.Z, pivot_radius); | ||||
// filtered maximum visible ground level in view | // filtered maximum visible ground level in view | ||||
const float filtered_ground = std::max(filtered_near_ground, filtered_pivot_ground); | const float filtered_ground = std::max(filtered_near_ground, filtered_pivot_ground); | ||||
▲ Show 20 Lines • Show All 562 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator