bbox fixes

This commit is contained in:
h4570
2022-08-24 00:05:45 +02:00
parent 989d2702e8
commit b5147bba3a
8 changed files with 27 additions and 24 deletions
+1 -2
View File
@@ -1,10 +1,9 @@
------------ Tyra's v2.0 roadmap to publish on GitHub ------------
- [Tutorials] 7
- [Renderer] Add decimate to de_dust2
- [Tutorials] 8
- [Tutorials] 9.
- [Renderer] Check ee clipping on de_dust2, add decimate to de_dust2?
- [General] Check all left TODOs -> Github issues
- [General] Readme Credits: clipping, obj loader
- [Video] How to setup environment
+3 -3
View File
@@ -21,10 +21,10 @@ class BBox : public CoreBBox {
public:
BBox(const BBox& t_bbox);
explicit BBox(CoreBBox** t_bboxes, const u32& count);
explicit BBox(Vec4* t_vertices, u32* faces, u32 t_count);
explicit BBox(Vec4* t_vertices, u32 t_count);
explicit BBox(const Vec4* t_vertices, const u32* faces, const u32& t_count);
explicit BBox(const Vec4* t_vertices, const u32& t_count);
explicit BBox(const BBox& t_bbox, const M4x4& t_matrix);
explicit BBox(Vec4* t_vertices);
explicit BBox(const Vec4* t_vertices);
static BBox create(const Vec4& center, const float& size);
@@ -32,11 +32,11 @@ class StaPipBagPackage {
CoreBBoxFrustum isInFrustum;
/**
* We are creating StaPipBagPackagesBBox which checks CoreBBoxBBox for every
* We are creating StaPipBagPackagesBBox which checks CoreBBox for every
* maxVertCount / 3. So this variable is index of starting
* StaPipBagPackagesBBox's CoreBBoxBBox. If package have <= maxVertCount / 3
* StaPipBagPackagesBBox's CoreBBox. If package have <= maxVertCount / 3
* verts, we will need only single (starting) bbox. if package have
* maxVertCount verts, we will calculate CoreBBoxBBox from 3
* maxVertCount verts, we will calculate CoreBBox from 3
* StaPipBagPackagesBBox's bboxes.
*/
u32 indexOf1By3BBox;
@@ -24,9 +24,10 @@ class CoreBBox {
public:
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 Vec4* t_vertices, const u32* faces,
const u32& t_count);
explicit CoreBBox(const Vec4* t_vertices, const u32& t_count);
explicit CoreBBox(const Vec4* t_vertices);
explicit CoreBBox(CoreBBox** t_bboxes, const u32& count);
explicit CoreBBox(const std::vector<CoreBBox>& t_bboxes,
const u32& startIndex, const u32& stopIndex);
@@ -18,9 +18,10 @@ namespace Tyra {
/** Bounding box */
class RenderBBox : public CoreBBox {
public:
explicit RenderBBox(Vec4* t_vertices, u32* faces, u32 t_count);
explicit RenderBBox(Vec4* t_vertices, u32 t_count);
explicit RenderBBox(Vec4* t_vertices);
explicit RenderBBox(const Vec4* t_vertices, const u32* faces,
const u32& t_count);
explicit RenderBBox(const Vec4* t_vertices, const u32& t_count);
explicit RenderBBox(const Vec4* t_vertices);
explicit RenderBBox(CoreBBox** t_bboxes, const u32& count);
explicit RenderBBox(const std::vector<CoreBBox>& t_bboxes,
const u32& startIndex, const u32& stopIndex);
+4 -3
View File
@@ -16,11 +16,12 @@ BBox::BBox(CoreBBox** t_bboxes, const u32& count) : CoreBBox(t_bboxes, count) {
setData();
}
BBox::BBox(Vec4* t_vertices, u32 count) : CoreBBox(t_vertices, count) {
BBox::BBox(const Vec4* t_vertices, const u32& count)
: CoreBBox(t_vertices, count) {
setData();
}
BBox::BBox(Vec4* t_vertices, u32* faces, u32 count)
BBox::BBox(const Vec4* t_vertices, const u32* faces, const u32& count)
: CoreBBox(t_vertices, faces, count) {
setData();
}
@@ -32,7 +33,7 @@ BBox::BBox(const BBox& t_bbox, const M4x4& t_matrix)
setData();
}
BBox::BBox(Vec4* t_vertices) : CoreBBox(t_vertices) { setData(); }
BBox::BBox(const Vec4* t_vertices) : CoreBBox(t_vertices) { setData(); }
BBox BBox::getTransformed(const M4x4& t_matrix) const {
return BBox(*this, t_matrix);
@@ -86,7 +86,7 @@ CoreBBox::CoreBBox(const std::vector<CoreBBox>& t_bboxes, const u32& startIndex,
vertices[7].set(hiX, hiY, hiZ);
}
CoreBBox::CoreBBox(Vec4* t_vertices, u32* faces, u32 count) {
CoreBBox::CoreBBox(const Vec4* t_vertices, const u32* faces, const u32& count) {
float lowX, lowY, lowZ, hiX, hiY, hiZ;
lowX = hiX = t_vertices[faces[0]].x;
lowY = hiY = t_vertices[faces[0]].y;
@@ -113,7 +113,7 @@ CoreBBox::CoreBBox(Vec4* t_vertices, u32* faces, u32 count) {
vertices[7].set(hiX, hiY, hiZ);
}
CoreBBox::CoreBBox(Vec4* t_vertices, u32 count) {
CoreBBox::CoreBBox(const Vec4* t_vertices, const u32& count) {
float lowX, lowY, lowZ, hiX, hiY, hiZ;
lowX = hiX = t_vertices[0].x;
lowY = hiY = t_vertices[0].y;
@@ -159,7 +159,7 @@ void CoreBBox::operator=(const CoreBBox& v) {
for (auto i = 0; i < 8; i++) Vec4::copy(&vertices[i], v.vertices[i].xyzw);
}
CoreBBox::CoreBBox(Vec4* t_vertices) {
CoreBBox::CoreBBox(const Vec4* t_vertices) {
for (auto i = 0; i < 8; i++) Vec4::copy(&vertices[i], t_vertices[i].xyzw);
}
@@ -21,13 +21,14 @@ RenderBBox::RenderBBox(const std::vector<CoreBBox>& t_bboxes,
const u32& startIndex, const u32& stopIndex)
: CoreBBox(t_bboxes, startIndex, stopIndex) {}
RenderBBox::RenderBBox(Vec4* t_vertices, u32* faces, u32 count)
RenderBBox::RenderBBox(const Vec4* t_vertices, const u32* faces,
const u32& count)
: CoreBBox(t_vertices, faces, count) {}
RenderBBox::RenderBBox(Vec4* t_vertices, u32 count)
RenderBBox::RenderBBox(const Vec4* t_vertices, const u32& count)
: CoreBBox(t_vertices, count) {}
RenderBBox::RenderBBox(Vec4* t_vertices) : CoreBBox(t_vertices) {}
RenderBBox::RenderBBox(const Vec4* t_vertices) : CoreBBox(t_vertices) {}
RenderBBox::RenderBBox(const RenderBBox& t_bbox, const M4x4& t_matrix)
: CoreBBox(t_bbox, t_matrix) {}
@@ -64,6 +65,6 @@ CoreBBoxFrustum RenderBBox::clipFrustumCheck(const Plane* frustumPlanes,
guardBand[5] = -10.0F; // FAR
return frustumCheck(frustumPlanes, model, guardBand); // Let's check it again
} // namespace Tyra
}
} // namespace Tyra