Decompile fn_17920 (CView::Refresh)
Batch #12475 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_17920 CView::Refresh: logic confirmed by peer review Peer-reviewed-by: Yommy, gordaoprogramas, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
e2df9c0157
commit
b303d14641
3 changed files with 19 additions and 26 deletions
|
|
@ -31,6 +31,7 @@ public:
|
|||
virtual void Update();
|
||||
|
||||
matrix AlternateView(float yaw) const;
|
||||
void Refresh();
|
||||
|
||||
/* 0004 */ CameraShake shake;
|
||||
/* 0020 */ CameraState camera;
|
||||
|
|
|
|||
|
|
@ -7,33 +7,28 @@
|
|||
#include "Render/Renderer.h"
|
||||
#include "Resource/World/TerrainResource.h"
|
||||
|
||||
// INLINED
|
||||
__forceinline void CameraFrame::Build(const CameraState& camera) {
|
||||
constexpr float pi = 3.141592f;
|
||||
matrix orbit;
|
||||
orbit.MakeXRotation((camera.pitch / 180.0f) * pi);
|
||||
orbit.AppendYRotation((camera.yaw / 180.0f) * pi);
|
||||
const float distance = -camera.distance;
|
||||
this->eye[1] = ((orbit.values[4] * 0.0f + orbit.values[1] * 0.0f) + distance * orbit.values[7]) + orbit.values[10];
|
||||
this->eye[2] = ((orbit.values[5] * 0.0f + orbit.values[2] * 0.0f) + distance * orbit.values[8]) + orbit.values[11];
|
||||
this->eye[0] = (((orbit.values[3] * 0.0f + orbit.values[0] * 0.0f) + distance * orbit.values[6]) + orbit.values[9]) + camera.target[0];
|
||||
this->eye[1] = camera.target[1] + this->eye[1];
|
||||
this->eye[2] = camera.target[2] + this->eye[2];
|
||||
const float height = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(this->eye[0], this->eye[2]);
|
||||
|
||||
if (this->eye[1] > height) {
|
||||
this->eye[1] = height;
|
||||
}
|
||||
|
||||
this->view.LookAt(this->eye, camera.target, this->up);
|
||||
this->inverse.MakeInverse(this->view);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00ADB560
|
||||
// FUNCTION: fn_17920
|
||||
void CameraFrame::Refresh(const CameraState& camera, CRenderer& renderer) {
|
||||
this->Build(camera);
|
||||
renderer.SetCamera(this->eye, camera.target, this->up);
|
||||
void CView::Refresh() {
|
||||
constexpr float pi = 3.141592f;
|
||||
matrix orbit;
|
||||
orbit.MakeXRotation((this->camera.pitch / 180.0f) * pi);
|
||||
orbit.AppendYRotation((this->camera.yaw / 180.0f) * pi);
|
||||
const float distance = -this->camera.distance;
|
||||
this->frame.eye[1] = ((orbit.values[4] * 0.0f + orbit.values[1] * 0.0f) + distance * orbit.values[7]) + orbit.values[10];
|
||||
this->frame.eye[2] = ((orbit.values[5] * 0.0f + orbit.values[2] * 0.0f) + distance * orbit.values[8]) + orbit.values[11];
|
||||
this->frame.eye[0] = (((orbit.values[3] * 0.0f + orbit.values[0] * 0.0f) + distance * orbit.values[6]) + orbit.values[9]) + this->camera.target[0];
|
||||
this->frame.eye[1] = this->camera.target[1] + this->frame.eye[1];
|
||||
this->frame.eye[2] = this->camera.target[2] + this->frame.eye[2];
|
||||
const float height = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(this->frame.eye[0], this->frame.eye[2]);
|
||||
|
||||
if (this->frame.eye[1] > height) {
|
||||
this->frame.eye[1] = height;
|
||||
}
|
||||
|
||||
this->frame.view.LookAt(this->frame.eye, this->camera.target, this->frame.up);
|
||||
this->frame.inverse.MakeInverse(this->frame.view);
|
||||
g_renderer->SetCamera(this->frame.eye, this->camera.target, this->frame.up);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00ADBF60
|
||||
|
|
@ -45,6 +40,5 @@ void CView::Update() {
|
|||
this->camera.desiredTarget[2] = position.z;
|
||||
this->camera.Smooth();
|
||||
this->shake.Apply(this->camera, g_worldViewDrawn);
|
||||
this->frame.Build(this->camera);
|
||||
g_renderer->SetCamera(this->frame.eye, this->camera.target, this->frame.up);
|
||||
this->Refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ struct CameraFrame {
|
|||
/* 0098 */ matrix view;
|
||||
/* 00C8 */ matrix inverse;
|
||||
|
||||
void Build(const CameraState& camera);
|
||||
void Refresh(const CameraState& camera, CRenderer& renderer);
|
||||
void Forward(const CameraState& camera, float* output) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue