mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
Compare commits
5 Commits
8d77b8d8d2
...
ce6ef8d996
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce6ef8d996 | ||
|
|
7d491570e4 | ||
|
|
2711c752ba | ||
|
|
0e6f65f32e | ||
|
|
44bee4cbd7 |
@ -1 +1 @@
|
|||||||
Subproject commit a7733b6a8c2d52f081fbd74ca40d7ca8f94e1209
|
Subproject commit dc8f10e407daa8bdf7e90d9438b55d5883780825
|
||||||
@ -1214,4 +1214,17 @@ struct CHARACTER_INFO {
|
|||||||
uint8_t firstLogin;
|
uint8_t firstLogin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CHARACTER_CREATE_INFO {
|
||||||
|
char name[48];
|
||||||
|
uint8_t raceID;
|
||||||
|
uint8_t classID;
|
||||||
|
uint8_t sexID;
|
||||||
|
uint8_t skinID;
|
||||||
|
uint8_t faceID;
|
||||||
|
uint8_t hairStyleID;
|
||||||
|
uint8_t hairColorID;
|
||||||
|
uint8_t facialHairStyleID;
|
||||||
|
uint8_t outfitID;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,7 +1,59 @@
|
|||||||
#include "ui/simple/CSimpleCamera.hpp"
|
#include "ui/simple/CSimpleCamera.hpp"
|
||||||
|
#include "model/Model2.hpp"
|
||||||
|
#include <tempest/Math.hpp>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void FaceDirection(const C3Vector& direction, C3Vector& xPrime, C3Vector& yPrime, C3Vector& zPrime) {
|
||||||
|
STORM_ASSERT(CMath::fnotequal(direction.SquaredMag(), 0.0f));
|
||||||
|
|
||||||
|
// Forward
|
||||||
|
xPrime = direction;
|
||||||
|
|
||||||
|
// Right
|
||||||
|
if (CMath::fequal(xPrime.SquaredMag(), 0.0f)) {
|
||||||
|
yPrime.x = 1.0f;
|
||||||
|
yPrime.y = 0.0f;
|
||||||
|
yPrime.z = 0.0f;
|
||||||
|
} else {
|
||||||
|
yPrime.x = -xPrime.y;
|
||||||
|
yPrime.y = xPrime.x;
|
||||||
|
yPrime.z = 0.0f;
|
||||||
|
|
||||||
|
CMath::normalize(yPrime.x, yPrime.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Up (Forward cross Right)
|
||||||
|
zPrime = C3Vector::Cross(xPrime, yPrime);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildBillboardMatrix(const C3Vector& direction, C33Matrix& rotation) {
|
||||||
|
C3Vector xPrime = {};
|
||||||
|
C3Vector yPrime = {};
|
||||||
|
C3Vector zPrime = {};
|
||||||
|
|
||||||
|
FaceDirection(direction, xPrime, yPrime, zPrime);
|
||||||
|
|
||||||
|
// Forward
|
||||||
|
rotation.a0 = xPrime.x;
|
||||||
|
rotation.a1 = xPrime.y;
|
||||||
|
rotation.a2 = xPrime.z;
|
||||||
|
|
||||||
|
// Right
|
||||||
|
rotation.b0 = yPrime.x;
|
||||||
|
rotation.b1 = yPrime.y;
|
||||||
|
rotation.b2 = yPrime.z;
|
||||||
|
|
||||||
|
// Up
|
||||||
|
rotation.c0 = zPrime.x;
|
||||||
|
rotation.c1 = zPrime.y;
|
||||||
|
rotation.c2 = zPrime.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
CSimpleCamera::CSimpleCamera(float nearZ, float farZ, float fov) {
|
CSimpleCamera::CSimpleCamera(float nearZ, float farZ, float fov) {
|
||||||
this->float10 = 0.0f;
|
this->m_scene = nullptr;
|
||||||
|
|
||||||
this->m_nearZ = nearZ;
|
this->m_nearZ = nearZ;
|
||||||
this->m_farZ = farZ;
|
this->m_farZ = farZ;
|
||||||
@ -19,12 +71,20 @@ C3Vector CSimpleCamera::Forward() const {
|
|||||||
return { this->m_facing.a0, this->m_facing.a1, this->m_facing.a2 };
|
return { this->m_facing.a0, this->m_facing.a1, this->m_facing.a2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CM2Scene* CSimpleCamera::GetScene() {
|
||||||
|
if (!this->m_scene) {
|
||||||
|
this->m_scene = M2CreateScene();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->m_scene;
|
||||||
|
}
|
||||||
|
|
||||||
C3Vector CSimpleCamera::Right() const {
|
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 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimpleCamera::SetFacing(const C3Vector& forward) {
|
void CSimpleCamera::SetFacing(const C3Vector& forward) {
|
||||||
// TODO
|
BuildBillboardMatrix(forward, this->m_facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimpleCamera::SetFacing(const C3Vector& forward, const C3Vector& up) {
|
void CSimpleCamera::SetFacing(const C3Vector& forward, const C3Vector& up) {
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
#include <tempest/Matrix.hpp>
|
#include <tempest/Matrix.hpp>
|
||||||
#include <tempest/Vector.hpp>
|
#include <tempest/Vector.hpp>
|
||||||
|
|
||||||
|
class CM2Scene;
|
||||||
|
|
||||||
class CSimpleCamera {
|
class CSimpleCamera {
|
||||||
public:
|
public:
|
||||||
// Virtual public member functions
|
// Virtual public member functions
|
||||||
@ -14,6 +16,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();
|
||||||
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);
|
||||||
@ -23,8 +26,8 @@ class CSimpleCamera {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Protected member variables
|
// Protected member variables
|
||||||
|
CM2Scene* m_scene;
|
||||||
C3Vector m_position;
|
C3Vector m_position;
|
||||||
float float10;
|
|
||||||
C33Matrix m_facing;
|
C33Matrix m_facing;
|
||||||
float m_nearZ;
|
float m_nearZ;
|
||||||
float m_farZ;
|
float m_farZ;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user