-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrix4.hpp
More file actions
52 lines (39 loc) · 995 Bytes
/
Matrix4.hpp
File metadata and controls
52 lines (39 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include "stdafx.h"
#include <string>
#include <cmath>
#include <cstring>
#include <algorithm>
#ifndef MATRIX4_HPP
#define MATRIX4_HPP
class Matrix4
{
public:
float m[4][4]; // row-major
};
class Matrix4Ex : public Matrix4
{
public:
float yaw = 0.0f;
float pitch = 0.0f;
float roll = 0.0f;
Matrix4Ex();
void Identity();
void Reset();
// Load matrix from game memory
void Load(const float* addr);
// Write matrix back to game memory
void Store(float* addr) const;
// Right-multiply: this = this * rhs
void Mul(const Matrix4Ex& rhs);
// Rotation around X axis (pitch)
static Matrix4Ex RotX(float angle);
// Rotation around Y axis (yaw)
static Matrix4Ex RotY(float angle);
// Rotation around Z axis (roll)
static Matrix4Ex RotZ(float angle);
// Apply yaw/pitch to the view matrix
void RotateView(float yawDelta, float pitchDelta, float rollDelta);
void Print(char* buffer);
};
#endif