mirror of
https://github.com/guezoloic/t3dsr.git
synced 2026-01-25 07:34:23 +00:00
feat(mat4.hpp): add cpp port
This commit is contained in:
10
src/main.cpp
10
src/main.cpp
@@ -1,13 +1,9 @@
|
||||
#include <iostream>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "math/mat4.h"
|
||||
#include "math/vec3.h"
|
||||
#include "math/vec4.h"
|
||||
}
|
||||
#include "math/mat4.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
math::Mat4f test = math::Mat4f::Identity();
|
||||
std::cout << test.data().m[0] << test.data().m[5] << test.data().m[10] << test.data().m[15] << std::endl;
|
||||
return 0;
|
||||
}
|
||||
24
src/math/mat4.hpp
Normal file
24
src/math/mat4.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "mat4.h"
|
||||
}
|
||||
|
||||
namespace math
|
||||
{
|
||||
class Mat4f
|
||||
{
|
||||
private:
|
||||
Mat4f_t mat4;
|
||||
|
||||
public:
|
||||
Mat4f() { mat4f_zero_r(&mat4); }
|
||||
explicit Mat4f(const Mat4f_t& m) : mat4(m) {}
|
||||
explicit Mat4f(const float arr[16]) { mat4f_from_array_r(&mat4, arr); }
|
||||
|
||||
static Mat4f Identity() { Mat4f mat; mat4f_identity_r(&mat.mat4); return mat; }
|
||||
static Mat4f Zero() { Mat4f mat; mat4f_zero_r(&mat.mat4); return mat; }
|
||||
|
||||
const Mat4f_t& data() const { return mat4; }
|
||||
Mat4f_t& data() { return mat4; }
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user