bbox fixes
This commit is contained in:
+1
-2
@@ -1,10 +1,9 @@
|
|||||||
------------ Tyra's v2.0 roadmap to publish on GitHub ------------
|
------------ Tyra's v2.0 roadmap to publish on GitHub ------------
|
||||||
|
|
||||||
- [Tutorials] 7
|
- [Renderer] Add decimate to de_dust2
|
||||||
- [Tutorials] 8
|
- [Tutorials] 8
|
||||||
- [Tutorials] 9.
|
- [Tutorials] 9.
|
||||||
|
|
||||||
- [Renderer] Check ee clipping on de_dust2, add decimate to de_dust2?
|
|
||||||
- [General] Check all left TODOs -> Github issues
|
- [General] Check all left TODOs -> Github issues
|
||||||
- [General] Readme Credits: clipping, obj loader
|
- [General] Readme Credits: clipping, obj loader
|
||||||
- [Video] How to setup environment
|
- [Video] How to setup environment
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ class BBox : public CoreBBox {
|
|||||||
public:
|
public:
|
||||||
BBox(const BBox& t_bbox);
|
BBox(const BBox& t_bbox);
|
||||||
explicit BBox(CoreBBox** t_bboxes, const u32& count);
|
explicit BBox(CoreBBox** t_bboxes, const u32& count);
|
||||||
explicit BBox(Vec4* t_vertices, u32* faces, u32 t_count);
|
explicit BBox(const Vec4* t_vertices, const u32* faces, const u32& t_count);
|
||||||
explicit BBox(Vec4* t_vertices, 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(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);
|
static BBox create(const Vec4& center, const float& size);
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ class StaPipBagPackage {
|
|||||||
CoreBBoxFrustum isInFrustum;
|
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
|
* 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
|
* 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.
|
* StaPipBagPackagesBBox's bboxes.
|
||||||
*/
|
*/
|
||||||
u32 indexOf1By3BBox;
|
u32 indexOf1By3BBox;
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ class CoreBBox {
|
|||||||
public:
|
public:
|
||||||
CoreBBox();
|
CoreBBox();
|
||||||
CoreBBox(const CoreBBox& t_bbox);
|
CoreBBox(const CoreBBox& t_bbox);
|
||||||
explicit CoreBBox(Vec4* t_vertices, u32* faces, u32 t_count);
|
explicit CoreBBox(const Vec4* t_vertices, const u32* faces,
|
||||||
explicit CoreBBox(Vec4* t_vertices, u32 t_count);
|
const u32& t_count);
|
||||||
explicit CoreBBox(Vec4* t_vertices);
|
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(CoreBBox** t_bboxes, const u32& count);
|
||||||
explicit CoreBBox(const std::vector<CoreBBox>& t_bboxes,
|
explicit CoreBBox(const std::vector<CoreBBox>& t_bboxes,
|
||||||
const u32& startIndex, const u32& stopIndex);
|
const u32& startIndex, const u32& stopIndex);
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ namespace Tyra {
|
|||||||
/** Bounding box */
|
/** Bounding box */
|
||||||
class RenderBBox : public CoreBBox {
|
class RenderBBox : public CoreBBox {
|
||||||
public:
|
public:
|
||||||
explicit RenderBBox(Vec4* t_vertices, u32* faces, u32 t_count);
|
explicit RenderBBox(const Vec4* t_vertices, const u32* faces,
|
||||||
explicit RenderBBox(Vec4* t_vertices, u32 t_count);
|
const u32& t_count);
|
||||||
explicit RenderBBox(Vec4* t_vertices);
|
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(CoreBBox** t_bboxes, const u32& count);
|
||||||
explicit RenderBBox(const std::vector<CoreBBox>& t_bboxes,
|
explicit RenderBBox(const std::vector<CoreBBox>& t_bboxes,
|
||||||
const u32& startIndex, const u32& stopIndex);
|
const u32& startIndex, const u32& stopIndex);
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ BBox::BBox(CoreBBox** t_bboxes, const u32& count) : CoreBBox(t_bboxes, count) {
|
|||||||
setData();
|
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();
|
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) {
|
: CoreBBox(t_vertices, faces, count) {
|
||||||
setData();
|
setData();
|
||||||
}
|
}
|
||||||
@@ -32,7 +33,7 @@ BBox::BBox(const BBox& t_bbox, const M4x4& t_matrix)
|
|||||||
setData();
|
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 {
|
BBox BBox::getTransformed(const M4x4& t_matrix) const {
|
||||||
return BBox(*this, t_matrix);
|
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);
|
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;
|
float lowX, lowY, lowZ, hiX, hiY, hiZ;
|
||||||
lowX = hiX = t_vertices[faces[0]].x;
|
lowX = hiX = t_vertices[faces[0]].x;
|
||||||
lowY = hiY = t_vertices[faces[0]].y;
|
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);
|
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;
|
float lowX, lowY, lowZ, hiX, hiY, hiZ;
|
||||||
lowX = hiX = t_vertices[0].x;
|
lowX = hiX = t_vertices[0].x;
|
||||||
lowY = hiY = t_vertices[0].y;
|
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);
|
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);
|
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)
|
const u32& startIndex, const u32& stopIndex)
|
||||||
: CoreBBox(t_bboxes, startIndex, 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) {}
|
: 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) {}
|
: 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)
|
RenderBBox::RenderBBox(const RenderBBox& t_bbox, const M4x4& t_matrix)
|
||||||
: CoreBBox(t_bbox, t_matrix) {}
|
: CoreBBox(t_bbox, t_matrix) {}
|
||||||
@@ -64,6 +65,6 @@ CoreBBoxFrustum RenderBBox::clipFrustumCheck(const Plane* frustumPlanes,
|
|||||||
guardBand[5] = -10.0F; // FAR
|
guardBand[5] = -10.0F; // FAR
|
||||||
|
|
||||||
return frustumCheck(frustumPlanes, model, guardBand); // Let's check it again
|
return frustumCheck(frustumPlanes, model, guardBand); // Let's check it again
|
||||||
} // namespace Tyra
|
}
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
|
|||||||
Reference in New Issue
Block a user