utility functions

This commit is contained in:
h4570
2022-08-17 00:19:16 +02:00
parent 4fb0ab3b6c
commit fea2398699
27 changed files with 419 additions and 247 deletions
+24 -9
View File
@@ -21,17 +21,31 @@ namespace Tyra {
/** Bounding box */
class CoreBBox {
public:
explicit CoreBBox();
CoreBBox();
CoreBBox(const CoreBBox& t_bbox);
explicit CoreBBox(Vec4* t_vertices, u32* faces, u32 t_count);
explicit CoreBBox(Vec4* t_vertices, u32 t_count);
explicit CoreBBox(Vec4* t_vertices);
explicit CoreBBox(const CoreBBox& t_bbox);
explicit CoreBBox(CoreBBox** t_bboxes, const u32& count);
explicit CoreBBox(const std::vector<CoreBBox>& t_bboxes,
const u32& startIndex, const u32& stopIndex);
static CoreBBox create(const Vec4& center, const float& size);
/**
* 0 - lowX, lowY, lowZ
* 1 - lowX, lowY, hiZ
* 2 - lowX, hiY, lowZ
* 3 - lowX, hiY, hiZ
* 4 - hiX, lowY, lowZ
* 5 - hiX, lowY, hiZ
* 6 - hiX, hiY, lowZ
* 7 - hiX, hiY, hiZ
*/
Vec4 vertices[8];
void operator=(const CoreBBox& v);
const Vec4& operator[](const u8& i) const { return vertices[i]; }
const u8 getVertexCount() const { return 8; }
@@ -41,13 +55,14 @@ class CoreBBox {
void print(const std::string& name) const { print(name.c_str()); }
std::string getPrint(const char* name = nullptr) const;
/**
* @brief Check if bbox is in view frustum
*
* @param frustumPlanes Available in engine.renderer.core.renderer3D.frustumPlanes
* @param model Model matrix
* @param margins Optional margins
*/
/**
* @brief Check if bbox is in view frustum
*
* @param frustumPlanes Available in
* engine.renderer.core.renderer3D.frustumPlanes
* @param model Model matrix
* @param margins Optional margins
*/
CoreBBoxFrustum isInFrustum(const Plane* frustumPlanes, const M4x4& model,
const float* margins = nullptr) const;
};