camera movement & formatting

This commit is contained in:
Asuro
2025-02-12 01:24:28 +01:00
parent bf2371eca0
commit 03aecb6d44
18 changed files with 1316 additions and 574 deletions

View File

@@ -1,60 +1,84 @@
#pragma once
#include <bx/math.h>
#include <cstdint>
struct SharedData;
struct IVec2
{
int32_t X = 0;
int32_t Y = 0;
int32_t X = 0;
int32_t Y = 0;
};
struct IVec3
{
int32_t X = 0;
int32_t Y = 0;
int32_t X = 0;
int32_t Y = 0;
};
struct Vec2
{
float X = 0.0f;
float Y = 0.0f;
float X = 0.0f;
float Y = 0.0f;
};
struct Vec3
{
float X = 0.0f;
float Y = 0.0f;
float Z = 0.0f;
float X = 0.0f;
float Y = 0.0f;
float Z = 0.0f;
bx::Vec3 ToBX()
{
return {X, Y, Z};
};
};
struct Quat
{
float X = 0.0f;
float Y = 0.0f;
float Z = 0.0f;
float W = 1.0f;
float X = 0.0f;
float Y = 0.0f;
float Z = 0.0f;
float W = 1.0f;
static Quat FromEuler(float x, float y, float z);
static Quat FromEuler(Vec3 rot);
static Quat FromEuler(float x, float y, float z);
static Quat FromEuler(Vec3 rot);
};
struct Mat4
{
float M[16] {
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
};
float M[16]{
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
};
static void CreateTransform(float* out, Vec3 pos, Quat rot = {}, Vec3 scale = {1.0f, 1.0f, 1.0f});
void Translate(Vec3 offset);
Vec3 Right();
Vec3 Up();
Vec3 Forward();
};
namespace Game
{
struct GameInstance;
SharedData& GetShared();
void SetShared(SharedData& instance);
GameInstance& GetInstance();
void SetInstance(GameInstance& instance);
}
struct GameInstance;
SharedData& GetShared();
void SetShared(SharedData& instance);
GameInstance& GetInstance();
void SetInstance(GameInstance& instance);
} // namespace Game