mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 21:51:06 +03:00
Compare commits
1 Commits
90ed7cf816
...
73d69d1d70
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73d69d1d70 |
@ -1 +1 @@
|
|||||||
Subproject commit 1e5366bbc6935e3363abf5921f0be12f902e790a
|
Subproject commit 4ba7e0a6c3836254daf97bab159807fae6cab039
|
||||||
@ -924,10 +924,6 @@ CGxPool* CGxDevice::PoolCreate(EGxPoolTarget target, EGxPoolUsage usage, uint32_
|
|||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGxDevice::RenderTargetGet(EGxBuffer buffer, CGxTex*& gxTex) {
|
|
||||||
gxTex = this->m_textureTarget[buffer].m_texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGxDevice::RsGet(EGxRenderState which, int32_t& value) {
|
void CGxDevice::RsGet(EGxRenderState which, int32_t& value) {
|
||||||
value = static_cast<int32_t>(this->m_appRenderStates[which].m_value);
|
value = static_cast<int32_t>(this->m_appRenderStates[which].m_value);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,13 +38,6 @@ struct ShaderConstants {
|
|||||||
|
|
||||||
class CGxDevice {
|
class CGxDevice {
|
||||||
public:
|
public:
|
||||||
// Structs
|
|
||||||
struct TextureTarget {
|
|
||||||
CGxTex* m_texture;
|
|
||||||
uint32_t m_plane;
|
|
||||||
void* m_apiSpecific;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Static variables
|
// Static variables
|
||||||
static uint32_t s_alphaRef[];
|
static uint32_t s_alphaRef[];
|
||||||
static C3Vector s_pointScaleIdentity;
|
static C3Vector s_pointScaleIdentity;
|
||||||
@ -108,12 +101,12 @@ class CGxDevice {
|
|||||||
uint32_t m_appMasterEnables = 0;
|
uint32_t m_appMasterEnables = 0;
|
||||||
uint32_t m_hwMasterEnables = 0;
|
uint32_t m_hwMasterEnables = 0;
|
||||||
TSList<CGxPool, TSGetLink<CGxPool>> m_poolList;
|
TSList<CGxPool, TSGetLink<CGxPool>> m_poolList;
|
||||||
CGxBuf* m_bufLocked[GxPoolTargets_Last] = {};
|
CGxBuf* m_bufLocked[GxPoolTargets_Last];
|
||||||
CGxPool* m_vertexPool = nullptr;
|
CGxPool* m_vertexPool = nullptr;
|
||||||
CGxPool* m_indexPool = nullptr;
|
CGxPool* m_indexPool = nullptr;
|
||||||
CGxBuf* m_streamBufs[GxPoolTargets_Last] = {};
|
CGxBuf* m_streamBufs[GxPoolTargets_Last];
|
||||||
CGxVertexAttrib m_primVertexFormatAttrib[GxVertexBufferFormats_Last];
|
CGxVertexAttrib m_primVertexFormatAttrib[GxVertexBufferFormats_Last];
|
||||||
CGxBuf* m_primVertexFormatBuf[GxVertexBufferFormats_Last] = {};
|
CGxBuf* m_primVertexFormatBuf[GxVertexBufferFormats_Last];
|
||||||
uint32_t m_primVertexMask = 0;
|
uint32_t m_primVertexMask = 0;
|
||||||
uint32_t m_primVertexDirty = 0;
|
uint32_t m_primVertexDirty = 0;
|
||||||
EGxVertexBufferFormat m_primVertexFormat = GxVertexBufferFormats_Last;
|
EGxVertexBufferFormat m_primVertexFormat = GxVertexBufferFormats_Last;
|
||||||
@ -123,9 +116,6 @@ class CGxDevice {
|
|||||||
int32_t m_primIndexDirty = 0;
|
int32_t m_primIndexDirty = 0;
|
||||||
TSFixedArray<CGxAppRenderState> m_appRenderStates;
|
TSFixedArray<CGxAppRenderState> m_appRenderStates;
|
||||||
TSFixedArray<CGxStateBom> m_hwRenderStates;
|
TSFixedArray<CGxStateBom> m_hwRenderStates;
|
||||||
// TODO
|
|
||||||
TextureTarget m_textureTarget[GxBuffers_Last] = {};
|
|
||||||
// TODO
|
|
||||||
uint32_t m_baseMipLevel = 0; // TODO placeholder
|
uint32_t m_baseMipLevel = 0; // TODO placeholder
|
||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
@ -183,7 +173,6 @@ class CGxDevice {
|
|||||||
void PrimVertexFormat(CGxBuf*, CGxVertexAttrib*, uint32_t);
|
void PrimVertexFormat(CGxBuf*, CGxVertexAttrib*, uint32_t);
|
||||||
void PrimVertexMask(uint32_t);
|
void PrimVertexMask(uint32_t);
|
||||||
void PrimVertexPtr(CGxBuf*, EGxVertexBufferFormat);
|
void PrimVertexPtr(CGxBuf*, EGxVertexBufferFormat);
|
||||||
void RenderTargetGet(EGxBuffer buffer, CGxTex*& gxTex);
|
|
||||||
void RsGet(EGxRenderState, int32_t&);
|
void RsGet(EGxRenderState, int32_t&);
|
||||||
void RsSet(EGxRenderState, int32_t);
|
void RsSet(EGxRenderState, int32_t);
|
||||||
void RsSet(EGxRenderState, void*);
|
void RsSet(EGxRenderState, void*);
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
#include "gx/RenderTarget.hpp"
|
|
||||||
#include "gx/Device.hpp"
|
|
||||||
|
|
||||||
void GxRenderTargetGet(EGxBuffer buffer, CGxTex*& gxTex) {
|
|
||||||
g_theGxDevicePtr->RenderTargetGet(buffer, gxTex);
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#ifndef GX_RENDER_TARGET_HPP
|
|
||||||
#define GX_RENDER_TARGET_HPP
|
|
||||||
|
|
||||||
#include "gx/Types.hpp"
|
|
||||||
|
|
||||||
class CGxTex;
|
|
||||||
|
|
||||||
void GxRenderTargetGet(EGxBuffer buffer, CGxTex*& gxTex);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -54,12 +54,6 @@ enum EGxBlend {
|
|||||||
GxBlends_Last = 12
|
GxBlends_Last = 12
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EGxBuffer {
|
|
||||||
GxBuffers_Color = 0,
|
|
||||||
GxBuffers_Depth = 1,
|
|
||||||
GxBuffers_Last,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum EGxColorFormat {
|
enum EGxColorFormat {
|
||||||
GxCF_argb = 0,
|
GxCF_argb = 0,
|
||||||
GxCF_rgba = 1,
|
GxCF_rgba = 1,
|
||||||
|
|||||||
@ -1,97 +0,0 @@
|
|||||||
#include "ui/game/CGCamera.hpp"
|
|
||||||
#include "ui/game/Types.hpp"
|
|
||||||
#include "console/CVar.hpp"
|
|
||||||
#include "world/World.hpp"
|
|
||||||
#include <storm/String.hpp>
|
|
||||||
#include <tempest/Math.hpp>
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
static CVar* s_cameraView;
|
|
||||||
|
|
||||||
CGCamera::CameraViewData CGCamera::s_cameraViewDataDefault[MAX_CAMERA_VIEWS] = {
|
|
||||||
{ "0.0", "0.0", "0.0" }, // VIEW_FIRST_PERSON
|
|
||||||
{ "0.0", "0.0", "0.0" }, // VIEW_THIRD_PERSON_A
|
|
||||||
{ "5.55", "10.0", "0.0" }, // VIEW_THIRD_PERSON_B
|
|
||||||
{ "5.55", "20.0", "0.0" }, // VIEW_THIRD_PERSON_C
|
|
||||||
{ "13.88", "30.0", "0.0" }, // VIEW_THIRD_PERSON_D
|
|
||||||
{ "13.88", "10.0", "0.0" }, // VIEW_THIRD_PERSON_E
|
|
||||||
{ "0.0", "0.0", "0.0" }, // VIEW_COMMENTATOR
|
|
||||||
{ "5.0", "10.0", "0.0" }, // VIEW_BARBER_SHOP
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
bool ValidateCameraView(CVar* var, const char* oldValue, const char* value, void* arg) {
|
|
||||||
auto view = SStrToFloat(value);
|
|
||||||
auto min = static_cast<float>(VIEW_FIRST_PERSON);
|
|
||||||
auto max = static_cast<float>(VIEW_BARBER_SHOP);
|
|
||||||
|
|
||||||
if (view >= min && view <= max) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO ConsoleWriteA("Value out of range (%f - %f)\n", DEFAULT_COLOR, min, max);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip(), 90.0f * CMath::DEG2RAD) {
|
|
||||||
this->m_relativeTo = 0;
|
|
||||||
|
|
||||||
this->m_view = s_cameraView->GetInt();
|
|
||||||
|
|
||||||
this->m_distance = SStrToFloat(CGCamera::s_cameraViewDataDefault[this->m_view].m_distance);
|
|
||||||
this->m_yaw = 0.0f;
|
|
||||||
this->m_pitch = SStrToFloat(CGCamera::s_cameraViewDataDefault[this->m_view].m_pitch);
|
|
||||||
this->m_roll = 0.0f;
|
|
||||||
|
|
||||||
this->m_fovOffset = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
float CGCamera::FOV() const {
|
|
||||||
// Clamp offset-adjusted FOV between 0pi and 1pi
|
|
||||||
return std::min(std::max(this->m_fov + this->m_fovOffset, 0.0f), CMath::PI);
|
|
||||||
}
|
|
||||||
|
|
||||||
C3Vector CGCamera::Forward() const {
|
|
||||||
if (this->m_relativeTo) {
|
|
||||||
return this->CSimpleCamera::Forward() * this->ParentToWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this->CSimpleCamera::Forward();
|
|
||||||
}
|
|
||||||
|
|
||||||
C33Matrix CGCamera::ParentToWorld() const {
|
|
||||||
// TODO
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
C3Vector CGCamera::Right() const {
|
|
||||||
if (this->m_relativeTo) {
|
|
||||||
return this->CSimpleCamera::Right() * this->ParentToWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this->CSimpleCamera::Right();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGCamera::SetupWorldProjection(const CRect& projRect) {
|
|
||||||
this->SetGxProjectionAndView(projRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
C3Vector CGCamera::Up() const {
|
|
||||||
if (this->m_relativeTo) {
|
|
||||||
return this->CSimpleCamera::Up() * this->ParentToWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this->CSimpleCamera::Up();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CameraRegisterCVars() {
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
s_cameraView = CVar::Register("cameraView", nullptr, 0x10, "2", &ValidateCameraView, DEFAULT);
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_CAMERA_HPP
|
|
||||||
#define UI_GAME_C_G_CAMERA_HPP
|
|
||||||
|
|
||||||
#include "ui/simple/CSimpleCamera.hpp"
|
|
||||||
#include "util/GUID.hpp"
|
|
||||||
|
|
||||||
class CGCamera : public CSimpleCamera {
|
|
||||||
public:
|
|
||||||
// Public structs
|
|
||||||
struct CameraViewData {
|
|
||||||
const char* m_distance;
|
|
||||||
const char* m_pitch;
|
|
||||||
const char* m_yaw;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Public static variables
|
|
||||||
static CameraViewData s_cameraViewDataDefault[];
|
|
||||||
|
|
||||||
// Virtual public member functions
|
|
||||||
virtual ~CGCamera() = default;
|
|
||||||
virtual float FOV() const;
|
|
||||||
virtual C3Vector Forward() const;
|
|
||||||
virtual C3Vector Right() const;
|
|
||||||
virtual C3Vector Up() const;
|
|
||||||
|
|
||||||
// Public member functions
|
|
||||||
CGCamera();
|
|
||||||
C33Matrix ParentToWorld() const;
|
|
||||||
void SetupWorldProjection(const CRect& projRect);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// Private member variables
|
|
||||||
// TODO
|
|
||||||
WOWGUID m_relativeTo;
|
|
||||||
// TODO
|
|
||||||
int32_t m_view;
|
|
||||||
// TODO
|
|
||||||
float m_distance;
|
|
||||||
float m_yaw;
|
|
||||||
float m_pitch;
|
|
||||||
float m_roll;
|
|
||||||
// TODO
|
|
||||||
float m_fovOffset;
|
|
||||||
};
|
|
||||||
|
|
||||||
void CameraRegisterCVars();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -8,7 +8,6 @@
|
|||||||
#include "ui/game/ActionBarScript.hpp"
|
#include "ui/game/ActionBarScript.hpp"
|
||||||
#include "ui/game/BattlefieldInfoScript.hpp"
|
#include "ui/game/BattlefieldInfoScript.hpp"
|
||||||
#include "ui/game/BattlenetUI.hpp"
|
#include "ui/game/BattlenetUI.hpp"
|
||||||
#include "ui/game/CGCamera.hpp"
|
|
||||||
#include "ui/game/CGCharacterModelBase.hpp"
|
#include "ui/game/CGCharacterModelBase.hpp"
|
||||||
#include "ui/game/CGCooldown.hpp"
|
#include "ui/game/CGCooldown.hpp"
|
||||||
#include "ui/game/CGDressUpModelFrame.hpp"
|
#include "ui/game/CGDressUpModelFrame.hpp"
|
||||||
@ -285,8 +284,4 @@ void CGGameUI::RegisterGameCVars() {
|
|||||||
CVar::Register("fullSizeFocusFrame", "Increases the size of the focus frame to that of the target frame", 0x20, "0", nullptr, GAME);
|
CVar::Register("fullSizeFocusFrame", "Increases the size of the focus frame to that of the target frame", 0x20, "0", nullptr, GAME);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
CameraRegisterCVars();
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#include "ui/game/CGWorldFrame.hpp"
|
#include "ui/game/CGWorldFrame.hpp"
|
||||||
#include "gx/Coordinate.hpp"
|
|
||||||
#include "gx/Shader.hpp"
|
#include "gx/Shader.hpp"
|
||||||
#include "gx/Transform.hpp"
|
#include "gx/Transform.hpp"
|
||||||
#include "ui/game/CGCamera.hpp"
|
|
||||||
#include "ui/game/PlayerName.hpp"
|
#include "ui/game/PlayerName.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
#include <tempest/Matrix.hpp>
|
#include <tempest/Matrix.hpp>
|
||||||
@ -48,10 +46,6 @@ CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
|||||||
this->EnableEvent(SIMPLE_EVENT_MOUSEWHEEL, -1);
|
this->EnableEvent(SIMPLE_EVENT_MOUSEWHEEL, -1);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
this->m_camera = STORM_NEW(CGCamera);
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGWorldFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
|
void CGWorldFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
|
||||||
@ -62,29 +56,6 @@ void CGWorldFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGWorldFrame::OnFrameSizeChanged(const CRect& rect) {
|
|
||||||
this->CSimpleFrame::OnFrameSizeChanged(rect);
|
|
||||||
|
|
||||||
// Screen rect (DDC)
|
|
||||||
this->m_screenRect.minX = std::max(this->m_rect.minX, 0.0f);
|
|
||||||
this->m_screenRect.minY = std::max(this->m_rect.minY, 0.0f);
|
|
||||||
this->m_screenRect.maxX = std::min(this->m_rect.maxX, NDCToDDCWidth(1.0f));
|
|
||||||
this->m_screenRect.maxY = std::min(this->m_rect.maxY, NDCToDDCHeight(1.0f));
|
|
||||||
|
|
||||||
// Camera aspect ratio
|
|
||||||
if (this->m_camera) {
|
|
||||||
this->m_camera->SetScreenAspect(this->m_screenRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Viewport (NDC)
|
|
||||||
DDCToNDC(this->m_rect.minX, this->m_rect.minY, &this->m_viewport.minX, &this->m_viewport.minY);
|
|
||||||
DDCToNDC(this->m_rect.maxX, this->m_rect.maxY, &this->m_viewport.maxX, &this->m_viewport.maxY);
|
|
||||||
this->m_viewport.minX = std::max(this->m_viewport.minX, 0.0f);
|
|
||||||
this->m_viewport.minY = std::max(this->m_viewport.minY, 0.0f);
|
|
||||||
this->m_viewport.maxX = std::min(this->m_viewport.maxX, 1.0f);
|
|
||||||
this->m_viewport.maxY = std::min(this->m_viewport.maxY, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGWorldFrame::OnWorldRender() {
|
void CGWorldFrame::OnWorldRender() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
#include "ui/simple/CSimpleFrame.hpp"
|
#include "ui/simple/CSimpleFrame.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
class CGCamera;
|
|
||||||
|
|
||||||
class CGWorldFrame : public CSimpleFrame {
|
class CGWorldFrame : public CSimpleFrame {
|
||||||
public:
|
public:
|
||||||
// Static variables
|
// Static variables
|
||||||
@ -17,22 +15,11 @@ class CGWorldFrame : public CSimpleFrame {
|
|||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
||||||
// TODO
|
|
||||||
virtual void OnFrameSizeChanged(const CRect& rect);
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
CGWorldFrame(CSimpleFrame* parent);
|
CGWorldFrame(CSimpleFrame* parent);
|
||||||
void OnWorldRender();
|
void OnWorldRender();
|
||||||
void OnWorldUpdate();
|
void OnWorldUpdate();
|
||||||
|
|
||||||
private:
|
|
||||||
// Private member variables
|
|
||||||
// TODO
|
|
||||||
CRect m_screenRect;
|
|
||||||
CRect m_viewport;
|
|
||||||
// TODO
|
|
||||||
CGCamera* m_camera;
|
|
||||||
// TODO
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -13,16 +13,4 @@ enum SCRIPTEVENT {
|
|||||||
// TODO
|
// TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CAMERA_VIEW {
|
|
||||||
VIEW_FIRST_PERSON = 0,
|
|
||||||
VIEW_THIRD_PERSON_A = 1,
|
|
||||||
VIEW_THIRD_PERSON_B = 2,
|
|
||||||
VIEW_THIRD_PERSON_C = 3,
|
|
||||||
VIEW_THIRD_PERSON_D = 4,
|
|
||||||
VIEW_THIRD_PERSON_E = 5,
|
|
||||||
VIEW_COMMENTATOR = 6,
|
|
||||||
VIEW_BARBER_SHOP = 7,
|
|
||||||
MAX_CAMERA_VIEWS,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -104,6 +104,10 @@ void CSimpleCamera::SetFieldOfView(float fov) {
|
|||||||
this->m_fov = fov;
|
this->m_fov = fov;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimpleCamera::SetNearZ(float nearZ) {
|
||||||
|
this->m_nearZ = nearZ;
|
||||||
|
}
|
||||||
|
|
||||||
void CSimpleCamera::SetGxProjectionAndView(const CRect& projRect) {
|
void CSimpleCamera::SetGxProjectionAndView(const CRect& projRect) {
|
||||||
// Projection
|
// Projection
|
||||||
|
|
||||||
@ -123,14 +127,6 @@ void CSimpleCamera::SetGxProjectionAndView(const CRect& projRect) {
|
|||||||
GxXformSetView(viewMat);
|
GxXformSetView(viewMat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimpleCamera::SetNearZ(float nearZ) {
|
|
||||||
this->m_nearZ = nearZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimpleCamera::SetScreenAspect(const CRect& screenRect) {
|
|
||||||
this->m_aspect = (screenRect.maxX - screenRect.minX) / (screenRect.maxY - screenRect.minY);
|
|
||||||
}
|
|
||||||
|
|
||||||
C3Vector CSimpleCamera::Up() const {
|
C3Vector CSimpleCamera::Up() const {
|
||||||
return { this->m_facing.c0, this->m_facing.c1, this->m_facing.c2 };
|
return { this->m_facing.c0, this->m_facing.c1, this->m_facing.c2 };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,6 @@ class CSimpleCamera {
|
|||||||
void SetFieldOfView(float fov);
|
void SetFieldOfView(float fov);
|
||||||
void SetGxProjectionAndView(const CRect& projRect);
|
void SetGxProjectionAndView(const CRect& projRect);
|
||||||
void SetNearZ(float nearZ);
|
void SetNearZ(float nearZ);
|
||||||
void SetScreenAspect(const CRect& screenRect);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Protected member variables
|
// Protected member variables
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
#include "gx/Gx.hpp"
|
#include "gx/Gx.hpp"
|
||||||
#include "gx/Shader.hpp"
|
#include "gx/Shader.hpp"
|
||||||
#include "model/Model2.hpp"
|
#include "model/Model2.hpp"
|
||||||
#include "world/CWorldParam.hpp"
|
|
||||||
#include "world/Map.hpp"
|
#include "world/Map.hpp"
|
||||||
#include "world/Weather.hpp"
|
#include "world/Weather.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
@ -16,31 +15,11 @@ uint32_t CWorld::s_gameTimeFixed;
|
|||||||
float CWorld::s_gameTimeSec;
|
float CWorld::s_gameTimeSec;
|
||||||
CM2Scene* CWorld::s_m2Scene;
|
CM2Scene* CWorld::s_m2Scene;
|
||||||
float CWorld::s_nearClip = 0.1f;
|
float CWorld::s_nearClip = 0.1f;
|
||||||
float CWorld::s_prevFarClip;
|
|
||||||
uint32_t CWorld::s_tickTimeFixed;
|
uint32_t CWorld::s_tickTimeFixed;
|
||||||
uint32_t CWorld::s_tickTimeMs;
|
uint32_t CWorld::s_tickTimeMs;
|
||||||
float CWorld::s_tickTimeSec;
|
float CWorld::s_tickTimeSec;
|
||||||
Weather* CWorld::s_weather;
|
Weather* CWorld::s_weather;
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
float AdjustFarClip(float farClip, int32_t mapID) {
|
|
||||||
float minFarClip = 183.33333f;
|
|
||||||
float maxFarClip = 1583.3334f;
|
|
||||||
|
|
||||||
if (mapID < 530 || mapID == 575 || mapID == 543) {
|
|
||||||
if (!CWorldParam::cvar_farClipOverride || CWorldParam::cvar_farClipOverride->GetInt() < 1) {
|
|
||||||
maxFarClip = 791.66669f;
|
|
||||||
}
|
|
||||||
} else if (false /* TODO OsGetPhysicalMemory() <= 1073741824 */) {
|
|
||||||
maxFarClip = 791.66669f;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::min(std::max(farClip, minFarClip), maxFarClip);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
HWORLDOBJECT CWorld::AddObject(CM2Model* model, void* handler, void* handlerParam, uint64_t param64, uint32_t param32, uint32_t objFlags) {
|
HWORLDOBJECT CWorld::AddObject(CM2Model* model, void* handler, void* handlerParam, uint64_t param64, uint32_t param32, uint32_t objFlags) {
|
||||||
auto entity = CMap::AllocEntity(objFlags & 0x8 ? true : false);
|
auto entity = CMap::AllocEntity(objFlags & 0x8 ? true : false);
|
||||||
|
|
||||||
@ -164,14 +143,10 @@ void CWorld::Initialize() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorld::LoadMap(const char* mapName, const C3Vector& position, int32_t mapID) {
|
void CWorld::LoadMap(const char* mapName, const C3Vector& position, int32_t zoneID) {
|
||||||
CWorld::s_farClip = AdjustFarClip(CWorldParam::cvar_farClip->GetFloat(), mapID);
|
|
||||||
CWorld::s_nearClip = 0.2f;
|
|
||||||
CWorld::s_prevFarClip = CWorld::s_farClip;
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
CMap::Load(mapName, mapID);
|
CMap::Load(mapName, zoneID);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
@ -182,24 +157,6 @@ int32_t CWorld::OnTick(const EVENT_DATA_TICK* data, void* param) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorld::SetFarClip(float farClip) {
|
|
||||||
farClip = AdjustFarClip(farClip, CMap::s_mapID);
|
|
||||||
|
|
||||||
if (CWorld::s_farClip == farClip) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CWorld::s_prevFarClip = CWorld::s_farClip;
|
|
||||||
CWorld::s_farClip = farClip;
|
|
||||||
|
|
||||||
// TODO CMapRenderChunk::DirtyPools();
|
|
||||||
|
|
||||||
CWorld::s_nearClip = 0.2f;
|
|
||||||
|
|
||||||
// TODO dword_D1C410 = 1;
|
|
||||||
// TODO dword_ADEEE0 = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWorld::SetUpdateTime(float tickTimeSec, uint32_t curTimeMs) {
|
void CWorld::SetUpdateTime(float tickTimeSec, uint32_t curTimeMs) {
|
||||||
auto tickTimeFixed = CWorld::GetFixedPrecisionTime(tickTimeSec);
|
auto tickTimeFixed = CWorld::GetFixedPrecisionTime(tickTimeSec);
|
||||||
|
|
||||||
|
|||||||
@ -66,9 +66,8 @@ class CWorld {
|
|||||||
static uint32_t GetTickTimeMs();
|
static uint32_t GetTickTimeMs();
|
||||||
static float GetTickTimeSec();
|
static float GetTickTimeSec();
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void LoadMap(const char* mapName, const C3Vector& position, int32_t mapID);
|
static void LoadMap(const char* mapName, const C3Vector& position, int32_t zoneID);
|
||||||
static int32_t OnTick(const EVENT_DATA_TICK* data, void* param);
|
static int32_t OnTick(const EVENT_DATA_TICK* data, void* param);
|
||||||
static void SetFarClip(float farClip);
|
|
||||||
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -80,7 +79,6 @@ class CWorld {
|
|||||||
static float s_gameTimeSec;
|
static float s_gameTimeSec;
|
||||||
static CM2Scene* s_m2Scene;
|
static CM2Scene* s_m2Scene;
|
||||||
static float s_nearClip;
|
static float s_nearClip;
|
||||||
static float s_prevFarClip;
|
|
||||||
static uint32_t s_tickTimeFixed;
|
static uint32_t s_tickTimeFixed;
|
||||||
static uint32_t s_tickTimeMs;
|
static uint32_t s_tickTimeMs;
|
||||||
static float s_tickTimeSec;
|
static float s_tickTimeSec;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "world/CWorldParam.hpp"
|
#include "world/CWorldParam.hpp"
|
||||||
#include "world/CWorld.hpp"
|
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
|
|
||||||
CVar* CWorldParam::cvar_baseMip;
|
CVar* CWorldParam::cvar_baseMip;
|
||||||
@ -54,8 +53,7 @@ bool CWorldParam::ExtShadowQualityCallback(CVar* var, const char* oldValue, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CWorldParam::FarClipCallback(CVar* var, const char* oldValue, const char* value, void* arg) {
|
bool CWorldParam::FarClipCallback(CVar* var, const char* oldValue, const char* value, void* arg) {
|
||||||
CWorld::SetFarClip(SStrToFloat(value));
|
// TODO
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef WORLD_C_WORLD_PARAM_HPP
|
#ifndef WORLD_C_WORLD_PARAM_HPP
|
||||||
#define WORLD_C_WORLD_PARAM_HPP
|
#define WORLD_C_WORLD_PARAM_HPP
|
||||||
|
|
||||||
#include "console/CVar.hpp"
|
class CVar;
|
||||||
|
|
||||||
class CWorldParam {
|
class CWorldParam {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -28,7 +28,6 @@ uint32_t* CMap::s_mapObjDefGroupHeap;
|
|||||||
uint32_t* CMap::s_mapObjDefHeap;
|
uint32_t* CMap::s_mapObjDefHeap;
|
||||||
uint32_t* CMap::s_mapObjGroupHeap;
|
uint32_t* CMap::s_mapObjGroupHeap;
|
||||||
uint32_t* CMap::s_mapObjHeap;
|
uint32_t* CMap::s_mapObjHeap;
|
||||||
int32_t CMap::s_mapID = -1;
|
|
||||||
char CMap::s_mapName[256];
|
char CMap::s_mapName[256];
|
||||||
char CMap::s_mapPath[256];
|
char CMap::s_mapPath[256];
|
||||||
char CMap::s_wdtFilename[256];
|
char CMap::s_wdtFilename[256];
|
||||||
@ -62,7 +61,7 @@ void CMap::Initialize() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMap::Load(const char* mapName, int32_t mapID) {
|
void CMap::Load(const char* mapName, int32_t zoneID) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
auto nameOfs = SStrCopy(CMap::s_mapPath, "World\\Maps\\");
|
auto nameOfs = SStrCopy(CMap::s_mapPath, "World\\Maps\\");
|
||||||
@ -73,10 +72,6 @@ void CMap::Load(const char* mapName, int32_t mapID) {
|
|||||||
SStrPrintf(CMap::s_wdtFilename, sizeof(CMap::s_wdtFilename), "%s\\%s.wdt", CMap::s_mapPath, CMap::s_mapName);
|
SStrPrintf(CMap::s_wdtFilename, sizeof(CMap::s_wdtFilename), "%s\\%s.wdt", CMap::s_mapPath, CMap::s_mapName);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
CMap::s_mapID = mapID;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMap::MapMemInitialize() {
|
void CMap::MapMemInitialize() {
|
||||||
|
|||||||
@ -23,7 +23,6 @@ class CMap {
|
|||||||
static uint32_t* s_mapObjDefHeap;
|
static uint32_t* s_mapObjDefHeap;
|
||||||
static uint32_t* s_mapObjGroupHeap;
|
static uint32_t* s_mapObjGroupHeap;
|
||||||
static uint32_t* s_mapObjHeap;
|
static uint32_t* s_mapObjHeap;
|
||||||
static int32_t s_mapID;
|
|
||||||
static char s_mapName[];
|
static char s_mapName[];
|
||||||
static char s_mapPath[];
|
static char s_mapPath[];
|
||||||
static char s_wdtFilename[];
|
static char s_wdtFilename[];
|
||||||
@ -31,7 +30,7 @@ class CMap {
|
|||||||
// Static functions
|
// Static functions
|
||||||
static CMapEntity* AllocEntity(int32_t a1);
|
static CMapEntity* AllocEntity(int32_t a1);
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Load(const char* mapName, int32_t mapID);
|
static void Load(const char* mapName, int32_t zoneID);
|
||||||
static void MapMemInitialize();
|
static void MapMemInitialize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user