summaryrefslogtreecommitdiff
path: root/src/core/Camera.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-05 04:45:18 +0300
committerSergeanur <s.anureev@yandex.ua>2020-05-05 04:45:18 +0300
commit84c9484e55874c57c1c017cb2394e0c6b2f32303 (patch)
treebcd2cbc38055ee38aa1aa2b35dd46d0f5e2e0772 /src/core/Camera.cpp
parent131e8af174a106e2bf98da8ef3ab7ba0bb55e09e (diff)
SetPosition, final part
Diffstat (limited to 'src/core/Camera.cpp')
-rw-r--r--src/core/Camera.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 379b9c36..3f4684e7 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -470,19 +470,19 @@ CCamera::Process(void)
}
}
- GetRight() = CrossProduct(CamUp, CamFront); // actually Left
- GetForward() = CamFront;
- GetUp() = CamUp;
- GetPosition() = CamSource;
+ GetMatrix().GetRight() = CrossProduct(CamUp, CamFront); // actually Left
+ GetMatrix().GetForward() = CamFront;
+ GetMatrix().GetUp() = CamUp;
+ GetMatrix().GetPosition() = CamSource;
// Process Shake
float shakeStrength = m_fCamShakeForce - 0.28f*(CTimer::GetTimeInMilliseconds()-m_uiCamShakeStart)/1000.0f;
shakeStrength = clamp(shakeStrength, 0.0f, 2.0f);
int shakeRand = CGeneral::GetRandomNumber();
float shakeOffset = shakeStrength*0.1f;
- GetPosition().x += shakeOffset*((shakeRand&0xF)-7);
- GetPosition().y += shakeOffset*(((shakeRand&0xF0)>>4)-7);
- GetPosition().z += shakeOffset*(((shakeRand&0xF00)>>8)-7);
+ GetMatrix().GetPosition().x += shakeOffset * ((shakeRand & 0xF) - 7);
+ GetMatrix().GetPosition().y += shakeOffset * (((shakeRand & 0xF0) >> 4) - 7);
+ GetMatrix().GetPosition().z += shakeOffset * (((shakeRand & 0xF00) >> 8) - 7);
if(shakeOffset > 0.0f && m_BlurType != MBLUR_SNIPER)
SetMotionBlurAlpha(Min((int)(shakeStrength*255.0f) + 25, 150));
@@ -499,27 +499,27 @@ CCamera::Process(void)
CVector Front = Cams[2].Front;
CVector Up = Cams[2].Up;
- GetRight() = CrossProduct(Up, Front);
- GetForward() = Front;
- GetUp() = Up;
- GetPosition() = Source;
+ GetMatrix().GetRight() = CrossProduct(Up, Front);
+ GetMatrix().GetForward() = Front;
+ GetMatrix().GetUp() = Up;
+ GetMatrix().GetPosition() = Source;
CDraw::SetFOV(Cams[2].FOV);
m_vecGameCamPos = Cams[ActiveCam].Source;
- *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d();
- *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d();
- *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d();
- *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d();
+ *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition();
+ *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward();
+ *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp();
+ *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight();
RwMatrixUpdate(RwFrameGetMatrix(frame));
RwFrameUpdateObjects(frame);
}else{
RwFrame *frame = RwCameraGetFrame(m_pRwCamera);
m_vecGameCamPos = GetPosition();
- *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d();
- *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d();
- *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d();
- *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d();
+ *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition();
+ *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward();
+ *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp();
+ *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight();
RwMatrixUpdate(RwFrameGetMatrix(frame));
RwFrameUpdateObjects(frame);
}