mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
Compare commits
9 Commits
aa575b11fd
...
b4a1129cb9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4a1129cb9 | ||
|
|
fa98bbc1f0 | ||
|
|
af4b798942 | ||
|
|
9b18f2f3bd | ||
|
|
6cb5310430 | ||
|
|
cb8291af1a | ||
|
|
58c8975769 | ||
|
|
817cec99fe | ||
|
|
6675586a29 |
@ -95,6 +95,10 @@ void CGObject_C::Disable() {
|
|||||||
this->m_disableTimeMs = CWorld::GetCurTimeMs();
|
this->m_disableTimeMs = CWorld::GetCurTimeMs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CGObject_C::GetFacing() const {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CGObject_C::GetModelFileName(const char*& name) const {
|
int32_t CGObject_C::GetModelFileName(const char*& name) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -103,6 +107,10 @@ CM2Model* CGObject_C::GetObjectModel() {
|
|||||||
return this->m_model;
|
return this->m_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
C3Vector CGObject_C::GetPosition() const {
|
||||||
|
return { 0.0f, 0.0f, 0.0f };
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CGObject_C::IsInReenable() {
|
int32_t CGObject_C::IsInReenable() {
|
||||||
return this->m_inReenable;
|
return this->m_inReenable;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,10 @@ class CGObject_C : public CGObject, public TSHashObject<CGObject_C, CHashKeyGUID
|
|||||||
virtual void HandleOutOfRange(OUT_OF_RANGE_TYPE type) {};
|
virtual void HandleOutOfRange(OUT_OF_RANGE_TYPE type) {};
|
||||||
virtual void UpdateWorldObject(int32_t a2);
|
virtual void UpdateWorldObject(int32_t a2);
|
||||||
// TODO
|
// TODO
|
||||||
|
virtual C3Vector GetPosition() const;
|
||||||
|
// TODO
|
||||||
|
virtual float GetFacing() const;
|
||||||
|
// TODO
|
||||||
virtual int32_t GetModelFileName(const char*& name) const;
|
virtual int32_t GetModelFileName(const char*& name) const;
|
||||||
// TODO
|
// TODO
|
||||||
virtual int32_t CanHighlight();
|
virtual int32_t CanHighlight();
|
||||||
|
|||||||
@ -38,6 +38,9 @@ bool ValidateCameraView(CVar* var, const char* oldValue, const char* value, void
|
|||||||
}
|
}
|
||||||
|
|
||||||
CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip(), 90.0f * CMath::DEG2RAD) {
|
CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip(), 90.0f * CMath::DEG2RAD) {
|
||||||
|
this->m_model = nullptr;
|
||||||
|
|
||||||
|
this->m_target = 0;
|
||||||
this->m_relativeTo = 0;
|
this->m_relativeTo = 0;
|
||||||
|
|
||||||
this->m_view = s_cameraView->GetInt();
|
this->m_view = s_cameraView->GetInt();
|
||||||
@ -63,6 +66,14 @@ C3Vector CGCamera::Forward() const {
|
|||||||
return this->CSimpleCamera::Forward();
|
return this->CSimpleCamera::Forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const WOWGUID& CGCamera::GetTarget() const {
|
||||||
|
return this->m_target;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t CGCamera::HasModel() const {
|
||||||
|
return this->m_model != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
C33Matrix CGCamera::ParentToWorld() const {
|
C33Matrix CGCamera::ParentToWorld() const {
|
||||||
// TODO
|
// TODO
|
||||||
return {};
|
return {};
|
||||||
@ -80,6 +91,10 @@ void CGCamera::SetupWorldProjection(const CRect& projRect) {
|
|||||||
this->SetGxProjectionAndView(projRect);
|
this->SetGxProjectionAndView(projRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
C3Vector CGCamera::Target() const {
|
||||||
|
return this->m_position + this->Forward();
|
||||||
|
}
|
||||||
|
|
||||||
C3Vector CGCamera::Up() const {
|
C3Vector CGCamera::Up() const {
|
||||||
if (this->m_relativeTo) {
|
if (this->m_relativeTo) {
|
||||||
return this->CSimpleCamera::Up() * this->ParentToWorld();
|
return this->CSimpleCamera::Up() * this->ParentToWorld();
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
#include "ui/simple/CSimpleCamera.hpp"
|
#include "ui/simple/CSimpleCamera.hpp"
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
|
|
||||||
|
class CM2Model;
|
||||||
|
|
||||||
class CGCamera : public CSimpleCamera {
|
class CGCamera : public CSimpleCamera {
|
||||||
public:
|
public:
|
||||||
// Public structs
|
// Public structs
|
||||||
@ -25,11 +27,17 @@ class CGCamera : public CSimpleCamera {
|
|||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
CGCamera();
|
CGCamera();
|
||||||
|
const WOWGUID& GetTarget() const;
|
||||||
|
int32_t HasModel() const;
|
||||||
C33Matrix ParentToWorld() const;
|
C33Matrix ParentToWorld() const;
|
||||||
void SetupWorldProjection(const CRect& projRect);
|
void SetupWorldProjection(const CRect& projRect);
|
||||||
|
C3Vector Target() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private member variables
|
// Private member variables
|
||||||
|
CM2Model* m_model;
|
||||||
|
// TODO
|
||||||
|
WOWGUID m_target;
|
||||||
// TODO
|
// TODO
|
||||||
WOWGUID m_relativeTo;
|
WOWGUID m_relativeTo;
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@ -2,8 +2,10 @@
|
|||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
#include "gx/Shader.hpp"
|
#include "gx/Shader.hpp"
|
||||||
#include "gx/Transform.hpp"
|
#include "gx/Transform.hpp"
|
||||||
|
#include "object/Client.hpp"
|
||||||
#include "ui/game/CGCamera.hpp"
|
#include "ui/game/CGCamera.hpp"
|
||||||
#include "ui/game/PlayerName.hpp"
|
#include "ui/game/PlayerName.hpp"
|
||||||
|
#include "world/World.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
#include <tempest/Matrix.hpp>
|
#include <tempest/Matrix.hpp>
|
||||||
|
|
||||||
@ -92,7 +94,19 @@ void CGWorldFrame::OnWorldRender() {
|
|||||||
void CGWorldFrame::OnWorldUpdate() {
|
void CGWorldFrame::OnWorldUpdate() {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
auto target = ClntObjMgrObjectPtr(this->m_camera->GetTarget(), TYPE_OBJECT, __FILE__, __LINE__);
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
this->m_camera->SetupWorldProjection(this->m_screenRect);
|
this->m_camera->SetupWorldProjection(this->m_screenRect);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
auto targetPos = target && !this->m_camera->HasModel()
|
||||||
|
? target->GetPosition()
|
||||||
|
: this->m_camera->Position();
|
||||||
|
|
||||||
|
CWorld::Update(this->m_camera->Position(), this->m_camera->Target(), targetPos);
|
||||||
|
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,6 +84,10 @@ C3Vector CSimpleCamera::Right() const {
|
|||||||
return { this->m_facing.b0, this->m_facing.b1, this->m_facing.b2 };
|
return { this->m_facing.b0, this->m_facing.b1, this->m_facing.b2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const C3Vector& CSimpleCamera::Position() const {
|
||||||
|
return this->m_position;
|
||||||
|
}
|
||||||
|
|
||||||
void CSimpleCamera::SetFacing(const C3Vector& forward) {
|
void CSimpleCamera::SetFacing(const C3Vector& forward) {
|
||||||
BuildBillboardMatrix(forward, this->m_facing);
|
BuildBillboardMatrix(forward, this->m_facing);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class CSimpleCamera {
|
|||||||
// Public member functions
|
// Public member functions
|
||||||
CSimpleCamera(float nearZ, float farZ, float fov);
|
CSimpleCamera(float nearZ, float farZ, float fov);
|
||||||
CM2Scene* GetScene();
|
CM2Scene* GetScene();
|
||||||
|
const C3Vector& Position() const;
|
||||||
void SetFacing(const C3Vector& forward);
|
void SetFacing(const C3Vector& forward);
|
||||||
void SetFacing(const C3Vector& forward, const C3Vector& up);
|
void SetFacing(const C3Vector& forward, const C3Vector& up);
|
||||||
void SetFacing(float yaw, float pitch, float roll);
|
void SetFacing(float yaw, float pitch, float roll);
|
||||||
|
|||||||
@ -213,3 +213,7 @@ void CWorld::SetUpdateTime(float tickTimeSec, uint32_t curTimeMs) {
|
|||||||
CWorld::s_tickTimeMs = static_cast<uint32_t>(tickTimeSec * 1000.0f);
|
CWorld::s_tickTimeMs = static_cast<uint32_t>(tickTimeSec * 1000.0f);
|
||||||
CWorld::s_tickTimeSec = tickTimeSec;
|
CWorld::s_tickTimeSec = tickTimeSec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWorld::Update(const C3Vector& cameraPos, const C3Vector& cameraTarget, const C3Vector& targetPos) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|||||||
@ -70,6 +70,7 @@ class CWorld {
|
|||||||
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 SetFarClip(float farClip);
|
||||||
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
||||||
|
static void Update(const C3Vector& cameraPos, const C3Vector& cameraTarget, const C3Vector& targetPos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private static variables
|
// Private static variables
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user