Dateien nach "inc" hochladen

This commit is contained in:
2026-11-07 20:24:56 +00:00
parent 03eeb724ee
commit 959388d2c4
4 changed files with 112 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
#pragma once
namespace math
{
struct render_points_t
{
float x;
float y;
float w;
float h;
};
struct matrix3x4
{
float *operator[](int i)
{
return m_value[i];
}
const float *operator[](int i) const
{
return m_value[i];
}
float *Base()
{
return &m_value[0][0];
}
const float *Base() const
{
return &m_value[0][0];
}
float m_value[3][4];
};
inline float dot_prod(const float *first, const float *second)
{
return ((first[0] * second[0]) + (first[1] * second[1]) + (first[2] * second[2]));
}
inline void vector_transform(Vector3D& in, const matrix3x4& matrix, Vector3D& out)
{
const auto in_array = in.base();
out.x = dot_prod(in_array, matrix[0]) + matrix[0][3];
out.y = dot_prod(in_array, matrix[1]) + matrix[1][3];
out.z = dot_prod(in_array, matrix[2]) + matrix[2][3];
}
extern bool setup_render_points(Context* ctx, const matrix3x4& coord_frame, const Vector3D& mins, const Vector3D& maxs, render_points_t& out);
}