mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
Compare commits
6 Commits
722a83dadd
...
29f1cbb827
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29f1cbb827 | ||
|
|
7d491570e4 | ||
|
|
2711c752ba | ||
|
|
0e6f65f32e | ||
|
|
86084516cd | ||
|
|
c500403cd9 |
@ -1 +1 @@
|
|||||||
Subproject commit 1c9e7831c874068e7c939a7dea8790eef6513d78
|
Subproject commit dc8f10e407daa8bdf7e90d9438b55d5883780825
|
||||||
@ -393,6 +393,11 @@ int32_t CGlueMgr::Idle(const void* a1, void* a2) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IDLE_CREATE_CHARACTER: {
|
||||||
|
CGlueMgr::PollCreateCharacter(msg, complete, result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IDLE_DELETE_CHARACTER: {
|
case IDLE_DELETE_CHARACTER: {
|
||||||
CGlueMgr::PollDeleteCharacter(msg, complete, result);
|
CGlueMgr::PollDeleteCharacter(msg, complete, result);
|
||||||
break;
|
break;
|
||||||
@ -763,6 +768,37 @@ void CGlueMgr::PollCharacterList(const char* msg, int32_t complete, int32_t resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::PollCreateCharacter(const char* msg, int32_t complete, int32_t result) {
|
||||||
|
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);
|
||||||
|
|
||||||
|
if (CGlueMgr::HandleBattlenetDisconnect()) {
|
||||||
|
SetIdleState(IDLE_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!complete) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
FrameScript_SignalEvent(OPEN_STATUS_DIALOG, "%s%s", "OKAY", msg);
|
||||||
|
|
||||||
|
CGlueMgr::SetIdleState(IDLE_NONE);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Success
|
||||||
|
|
||||||
|
CGlueMgr::SetIdleState(IDLE_NONE);
|
||||||
|
|
||||||
|
FrameScript_SignalEvent(CLOSE_STATUS_DIALOG, nullptr);
|
||||||
|
FrameScript_SignalEvent(SELECT_LAST_CHARACTER, nullptr);
|
||||||
|
|
||||||
|
CGlueMgr::SetScreen("charselect");
|
||||||
|
}
|
||||||
|
|
||||||
void CGlueMgr::PollDeleteCharacter(const char* msg, int32_t complete, int32_t result) {
|
void CGlueMgr::PollDeleteCharacter(const char* msg, int32_t complete, int32_t result) {
|
||||||
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);
|
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);
|
||||||
|
|
||||||
|
|||||||
@ -80,6 +80,7 @@ class CGlueMgr {
|
|||||||
static int32_t OnKickReasonMsg(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
static int32_t OnKickReasonMsg(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||||
static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
|
static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
|
||||||
static void PollCharacterList(const char* msg, int32_t complete, int32_t result, int32_t errorCode);
|
static void PollCharacterList(const char* msg, int32_t complete, int32_t result, int32_t errorCode);
|
||||||
|
static void PollCreateCharacter(const char* msg, int32_t complete, int32_t result);
|
||||||
static void PollDeleteCharacter(const char* msg, int32_t complete, int32_t result);
|
static void PollDeleteCharacter(const char* msg, int32_t complete, int32_t result);
|
||||||
static void PollEnterWorld();
|
static void PollEnterWorld();
|
||||||
static void PollLoginServerLogin();
|
static void PollLoginServerLogin();
|
||||||
|
|||||||
112
src/ui/simple/CSimpleCamera.cpp
Normal file
112
src/ui/simple/CSimpleCamera.cpp
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
#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) {
|
||||||
|
this->m_scene = nullptr;
|
||||||
|
|
||||||
|
this->m_nearZ = nearZ;
|
||||||
|
this->m_farZ = farZ;
|
||||||
|
this->m_fov = fov;
|
||||||
|
this->m_aspect = 1.0f;
|
||||||
|
|
||||||
|
this->SetFacing(0.0f, 0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
float CSimpleCamera::FOV() {
|
||||||
|
return this->m_fov;
|
||||||
|
}
|
||||||
|
|
||||||
|
C3Vector CSimpleCamera::Forward() const {
|
||||||
|
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 {
|
||||||
|
return { this->m_facing.b0, this->m_facing.b1, this->m_facing.b2 };
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimpleCamera::SetFacing(const C3Vector& forward) {
|
||||||
|
BuildBillboardMatrix(forward, this->m_facing);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimpleCamera::SetFacing(const C3Vector& forward, const C3Vector& up) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimpleCamera::SetFacing(float yaw, float pitch, float roll) {
|
||||||
|
this->m_facing.FromEulerAnglesZYX(yaw, pitch, roll);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimpleCamera::SetFarZ(float farZ) {
|
||||||
|
this->m_farZ = farZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimpleCamera::SetFieldOfView(float fov) {
|
||||||
|
this->m_fov = fov;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimpleCamera::SetNearZ(float nearZ) {
|
||||||
|
this->m_nearZ = nearZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
C3Vector CSimpleCamera::Up() const {
|
||||||
|
return { this->m_facing.c0, this->m_facing.c1, this->m_facing.c2 };
|
||||||
|
}
|
||||||
38
src/ui/simple/CSimpleCamera.hpp
Normal file
38
src/ui/simple/CSimpleCamera.hpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef UI_SIMPLE_C_SIMPLE_CAMERA_HPP
|
||||||
|
#define UI_SIMPLE_C_SIMPLE_CAMERA_HPP
|
||||||
|
|
||||||
|
#include <tempest/Matrix.hpp>
|
||||||
|
#include <tempest/Vector.hpp>
|
||||||
|
|
||||||
|
class CM2Scene;
|
||||||
|
|
||||||
|
class CSimpleCamera {
|
||||||
|
public:
|
||||||
|
// Virtual public member functions
|
||||||
|
virtual float FOV();
|
||||||
|
virtual C3Vector Forward() const;
|
||||||
|
virtual C3Vector Right() const;
|
||||||
|
virtual C3Vector Up() const;
|
||||||
|
|
||||||
|
// Public member functions
|
||||||
|
CSimpleCamera(float nearZ, float farZ, float fov);
|
||||||
|
CM2Scene* GetScene();
|
||||||
|
void SetFacing(const C3Vector& forward);
|
||||||
|
void SetFacing(const C3Vector& forward, const C3Vector& up);
|
||||||
|
void SetFacing(float yaw, float pitch, float roll);
|
||||||
|
void SetFarZ(float farZ);
|
||||||
|
void SetFieldOfView(float fov);
|
||||||
|
void SetNearZ(float nearZ);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Protected member variables
|
||||||
|
CM2Scene* m_scene;
|
||||||
|
C3Vector m_position;
|
||||||
|
C33Matrix m_facing;
|
||||||
|
float m_nearZ;
|
||||||
|
float m_farZ;
|
||||||
|
float m_fov;
|
||||||
|
float m_aspect;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user