Replaces direct Camera member usage by appropriate method call (m_Orientation
> GetOrientation()
).
This was SVN commit r23234.
This commit is contained in:
parent
a7b7486dea
commit
2fa18b1503
@ -298,7 +298,7 @@ void CCameraController::Update(const float deltaRealTime)
|
||||
float zoomDelta = -m_Zoom.Update(deltaRealTime);
|
||||
if (zoomDelta)
|
||||
{
|
||||
CVector3D forwards = m_Camera.m_Orientation.GetIn();
|
||||
CVector3D forwards = m_Camera.GetOrientation().GetIn();
|
||||
m_PosX.AddSmoothly(forwards.X * zoomDelta);
|
||||
m_PosY.AddSmoothly(forwards.Y * zoomDelta);
|
||||
m_PosZ.AddSmoothly(forwards.Z * zoomDelta);
|
||||
@ -319,7 +319,7 @@ void CCameraController::Update(const float deltaRealTime)
|
||||
CTerrain* pTerrain = g_Game->GetWorld()->GetTerrain();
|
||||
|
||||
CVector3D pivot = GetSmoothPivot(targetCam);
|
||||
CVector3D delta = targetCam.m_Orientation.GetTranslation() - pivot;
|
||||
CVector3D delta = targetCam.GetOrientation().GetTranslation() - pivot;
|
||||
|
||||
CVector3D desiredPivot = pivot;
|
||||
|
||||
@ -364,7 +364,7 @@ void CCameraController::Update(const float deltaRealTime)
|
||||
CVector3D upwards(0.0f, 1.0f, 0.0f);
|
||||
|
||||
CVector3D pivot = GetSmoothPivot(targetCam);
|
||||
CVector3D delta = targetCam.m_Orientation.GetTranslation() - pivot;
|
||||
CVector3D delta = targetCam.GetOrientation().GetTranslation() - pivot;
|
||||
|
||||
CQuaternion q;
|
||||
q.FromAxisAngle(upwards, rotateYDelta);
|
||||
@ -384,10 +384,10 @@ void CCameraController::Update(const float deltaRealTime)
|
||||
float rotateXDelta = m_RotateX.Update(deltaRealTime);
|
||||
if (rotateXDelta)
|
||||
{
|
||||
CVector3D rightwards = targetCam.m_Orientation.GetLeft() * -1.0f;
|
||||
CVector3D rightwards = targetCam.GetOrientation().GetLeft() * -1.0f;
|
||||
|
||||
CVector3D pivot = GetSmoothPivot(targetCam);
|
||||
CVector3D delta = targetCam.m_Orientation.GetTranslation() - pivot;
|
||||
CVector3D delta = targetCam.GetOrientation().GetTranslation() - pivot;
|
||||
|
||||
CQuaternion q;
|
||||
q.FromAxisAngle(rightwards, rotateXDelta);
|
||||
@ -428,7 +428,7 @@ void CCameraController::Update(const float deltaRealTime)
|
||||
|
||||
CVector3D CCameraController::GetSmoothPivot(CCamera& camera) const
|
||||
{
|
||||
return camera.m_Orientation.GetTranslation() + camera.m_Orientation.GetIn() * m_Zoom.GetSmoothedValue();
|
||||
return camera.GetOrientation().GetTranslation() + camera.GetOrientation().GetIn() * m_Zoom.GetSmoothedValue();
|
||||
}
|
||||
|
||||
CVector3D CCameraController::GetCameraPivot() const
|
||||
@ -538,10 +538,10 @@ void CCameraController::ResetCameraAngleZoom()
|
||||
SetupCameraMatrixNonSmooth(&targetCam.m_Orientation);
|
||||
|
||||
// Compute the zoom adjustment to get us back to the default
|
||||
CVector3D forwards = targetCam.m_Orientation.GetIn();
|
||||
CVector3D forwards = targetCam.GetOrientation().GetIn();
|
||||
|
||||
CVector3D pivot = GetSmoothPivot(targetCam);
|
||||
CVector3D delta = pivot - targetCam.m_Orientation.GetTranslation();
|
||||
CVector3D delta = pivot - targetCam.GetOrientation().GetTranslation();
|
||||
float dist = delta.Dot(forwards);
|
||||
m_Zoom.AddSmoothly(m_ViewZoomDefault - dist);
|
||||
|
||||
@ -591,8 +591,8 @@ void CCameraController::FocusHeight(bool smooth)
|
||||
CCamera targetCam = m_Camera;
|
||||
SetupCameraMatrixSmoothRot(&targetCam.m_Orientation);
|
||||
|
||||
const CVector3D position = targetCam.m_Orientation.GetTranslation();
|
||||
const CVector3D forwards = targetCam.m_Orientation.GetIn();
|
||||
const CVector3D position = targetCam.GetOrientation().GetTranslation();
|
||||
const CVector3D forwards = targetCam.GetOrientation().GetIn();
|
||||
|
||||
// horizontal view radius
|
||||
const float radius = sqrtf(forwards.X * forwards.X + forwards.Z * forwards.Z) * m_Zoom.GetSmoothedValue();
|
||||
|
@ -286,13 +286,13 @@ void CMapWriter::WriteXML(const VfsPath& filename,
|
||||
XMLWriter_Element cameraTag(xmlMapFile, "Camera");
|
||||
{
|
||||
XMLWriter_Element positionTag(xmlMapFile, "Position");
|
||||
CVector3D pos = pCamera->m_Orientation.GetTranslation();
|
||||
CVector3D pos = pCamera->GetOrientation().GetTranslation();
|
||||
positionTag.Attribute("x", pos.X);
|
||||
positionTag.Attribute("y", pos.Y);
|
||||
positionTag.Attribute("z", pos.Z);
|
||||
}
|
||||
|
||||
CVector3D in = pCamera->m_Orientation.GetIn();
|
||||
CVector3D in = pCamera->GetOrientation().GetIn();
|
||||
// Convert to spherical coordinates
|
||||
float rotation = atan2(in.X, in.Z);
|
||||
float declination = atan2(sqrt(in.X*in.X + in.Z*in.Z), in.Y) - static_cast<float>(M_PI / 2);
|
||||
|
@ -231,7 +231,7 @@ void CMiniMap::SetCameraPos()
|
||||
|
||||
float CMiniMap::GetAngle() const
|
||||
{
|
||||
CVector3D cameraIn = m_Camera->m_Orientation.GetIn();
|
||||
CVector3D cameraIn = m_Camera->GetOrientation().GetIn();
|
||||
return -atan2(cameraIn.X, cameraIn.Z);
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ void ShaderModelRenderer::Render(const RenderModifierPtr& modifier, const CShade
|
||||
return;
|
||||
|
||||
CMatrix3D worldToCam;
|
||||
g_Renderer.GetViewCamera().m_Orientation.GetInverse(worldToCam);
|
||||
g_Renderer.GetViewCamera().GetOrientation().GetInverse(worldToCam);
|
||||
|
||||
/*
|
||||
* Rendering approach:
|
||||
|
@ -594,8 +594,8 @@ void OverlayRenderer::RenderForegroundOverlays(const CCamera& viewCamera)
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
CVector3D right = -viewCamera.m_Orientation.GetLeft();
|
||||
CVector3D up = viewCamera.m_Orientation.GetUp();
|
||||
CVector3D right = -viewCamera.GetOrientation().GetLeft();
|
||||
CVector3D up = viewCamera.GetOrientation().GetUp();
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
|
@ -113,7 +113,7 @@ void ParticleRenderer::PrepareForRendering(const CShaderDefines& context)
|
||||
// Sort back-to-front by distance from camera
|
||||
PROFILE("sort emitters");
|
||||
CMatrix3D worldToCam;
|
||||
g_Renderer.GetViewCamera().m_Orientation.GetInverse(worldToCam);
|
||||
g_Renderer.GetViewCamera().GetOrientation().GetInverse(worldToCam);
|
||||
std::stable_sort(m->emitters[cullGroup].begin(), m->emitters[cullGroup].end(), SortEmitterDistance(worldToCam));
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ public:
|
||||
void SetOpenGLCamera(const CCamera& camera)
|
||||
{
|
||||
CMatrix3D view;
|
||||
camera.m_Orientation.GetInverse(view);
|
||||
camera.GetOrientation().GetInverse(view);
|
||||
const CMatrix3D& proj = camera.GetProjection();
|
||||
|
||||
#if CONFIG2_GLES
|
||||
@ -910,7 +910,7 @@ void CRenderer::SetObliqueFrustumClipping(CCamera& camera, const CVector4D& worl
|
||||
{
|
||||
// First, we'll convert the given clip plane to camera space, then we'll
|
||||
// Get the view matrix and normal matrix (top 3x3 part of view matrix)
|
||||
CMatrix3D normalMatrix = camera.m_Orientation.GetTranspose();
|
||||
CMatrix3D normalMatrix = camera.GetOrientation().GetTranspose();
|
||||
CVector4D camPlane = normalMatrix.Transform(worldPlane);
|
||||
|
||||
CMatrix3D matrix = camera.GetProjection();
|
||||
|
@ -789,7 +789,7 @@ bool TerrainRenderer::RenderFancyWater(const CShaderDefines& context, int cullGr
|
||||
m->fancyWaterShader->Uniform(str_repeatScale, 1.0f / repeatPeriod);
|
||||
m->fancyWaterShader->Uniform(str_losMatrix, losTexture.GetTextureMatrix());
|
||||
|
||||
m->fancyWaterShader->Uniform(str_cameraPos, camera.m_Orientation.GetTranslation());
|
||||
m->fancyWaterShader->Uniform(str_cameraPos, camera.GetOrientation().GetTranslation());
|
||||
if (WaterMgr->m_WaterRealDepth)
|
||||
{
|
||||
m->fancyWaterShader->Uniform(str_zNear, camera.GetNearPlane());
|
||||
|
@ -232,7 +232,7 @@ QUERYHANDLER(GetView)
|
||||
info.pY = focus.Y;
|
||||
info.pZ = focus.Z;
|
||||
|
||||
CQuaternion quatRot = g_Game->GetView()->GetCamera()->m_Orientation.GetRotation();
|
||||
CQuaternion quatRot = g_Game->GetView()->GetCamera()->GetOrientation().GetRotation();
|
||||
quatRot.Normalize();
|
||||
CVector3D rotation = quatRot.ToEulerAngles();
|
||||
|
||||
|
@ -144,15 +144,15 @@ void SetCurrentPaths(const std::vector<sCinemaPath>& atlasPaths)
|
||||
QUERYHANDLER(GetCameraInfo)
|
||||
{
|
||||
sCameraInfo info;
|
||||
CMatrix3D* cam = &g_Game->GetView()->GetCamera()->m_Orientation;
|
||||
const CMatrix3D& cameraOrientation = g_Game->GetView()->GetCamera()->GetOrientation();
|
||||
|
||||
CQuaternion quatRot = cam->GetRotation();
|
||||
CQuaternion quatRot = cameraOrientation.GetRotation();
|
||||
quatRot.Normalize();
|
||||
CVector3D rotation = quatRot.ToEulerAngles();
|
||||
rotation.X = RADTODEG(rotation.X);
|
||||
rotation.Y = RADTODEG(rotation.Y);
|
||||
rotation.Z = RADTODEG(rotation.Z);
|
||||
CVector3D translation = cam->GetTranslation();
|
||||
CVector3D translation = cameraOrientation.GetTranslation();
|
||||
|
||||
info.pX = translation.X;
|
||||
info.pY = translation.Y;
|
||||
|
Loading…
Reference in New Issue
Block a user