Merge branch 'tyrav2-develop' into tyrav2-static-dynamic-pipelines
This commit is contained in:
@@ -22,6 +22,8 @@ class BBox : public CoreBBox {
|
|||||||
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(Vec4* t_vertices, u32* faces, u32 t_count);
|
||||||
explicit BBox(Vec4* t_vertices, u32 t_count);
|
explicit BBox(Vec4* t_vertices, u32 t_count);
|
||||||
|
explicit BBox(const BBox& t_bbox, const M4x4& t_matrix);
|
||||||
|
explicit BBox(const BBox& t_bbox);
|
||||||
explicit BBox(Vec4* t_vertices);
|
explicit BBox(Vec4* t_vertices);
|
||||||
const float& getHeight() { return _height; }
|
const float& getHeight() { return _height; }
|
||||||
const float& getDepth() { return _depth; }
|
const float& getDepth() { return _depth; }
|
||||||
@@ -52,6 +54,9 @@ class BBox : public CoreBBox {
|
|||||||
* */
|
* */
|
||||||
void getMinMax(Vec4* res_min, Vec4* res_max);
|
void getMinMax(Vec4* res_min, Vec4* res_max);
|
||||||
|
|
||||||
|
/** Get new transformed BBox by model matrix */
|
||||||
|
BBox getTransformed(const M4x4& t_matrix);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float _height, _depth, _width;
|
float _height, _depth, _width;
|
||||||
Vec4 _centerVector;
|
Vec4 _centerVector;
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ class MinecraftPipeline : public Renderer3DPipeline {
|
|||||||
return manager.getTextureOffset();
|
return manager.getTextureOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const McpipBlockData& getBlockData() const { return manager.getBlockData(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlockizerProgramsManager manager;
|
BlockizerProgramsManager manager;
|
||||||
RendererCore* rendererCore;
|
RendererCore* rendererCore;
|
||||||
|
|||||||
@@ -21,9 +21,11 @@ namespace Tyra {
|
|||||||
/** Bounding box */
|
/** Bounding box */
|
||||||
class CoreBBox {
|
class CoreBBox {
|
||||||
public:
|
public:
|
||||||
|
explicit CoreBBox();
|
||||||
explicit CoreBBox(Vec4* t_vertices, u32* faces, u32 t_count);
|
explicit CoreBBox(Vec4* t_vertices, u32* faces, u32 t_count);
|
||||||
explicit CoreBBox(Vec4* t_vertices, u32 t_count);
|
explicit CoreBBox(Vec4* t_vertices, u32 t_count);
|
||||||
explicit CoreBBox(Vec4* t_vertices);
|
explicit CoreBBox(Vec4* t_vertices);
|
||||||
|
explicit CoreBBox(const CoreBBox& t_bbox);
|
||||||
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);
|
||||||
|
|||||||
@@ -25,8 +25,22 @@ BBox::BBox(Vec4* t_vertices, u32* faces, u32 count)
|
|||||||
setData();
|
setData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BBox::BBox(const BBox& t_bbox) : CoreBBox(t_bbox) { setData(); }
|
||||||
|
|
||||||
|
BBox::BBox(const BBox& t_bbox, const M4x4& t_matrix) {
|
||||||
|
for (u32 i = 0; i < 8; i++) {
|
||||||
|
_vertices[i] = t_matrix * _vertices[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
setData();
|
||||||
|
}
|
||||||
|
|
||||||
BBox::BBox(Vec4* t_vertices) : CoreBBox(t_vertices) { setData(); }
|
BBox::BBox(Vec4* t_vertices) : CoreBBox(t_vertices) { setData(); }
|
||||||
|
|
||||||
|
BBox BBox::getTransformed(const M4x4& t_matrix) {
|
||||||
|
return BBox(*this, t_matrix);
|
||||||
|
}
|
||||||
|
|
||||||
void BBox::setData() {
|
void BBox::setData() {
|
||||||
// This might be shortened with Vec4 operator overloading, but current
|
// This might be shortened with Vec4 operator overloading, but current
|
||||||
// implementation is more human readable.
|
// implementation is more human readable.
|
||||||
|
|||||||
@@ -15,6 +15,12 @@
|
|||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
|
CoreBBox::CoreBBox() {
|
||||||
|
for (u32 i = 0; i < 8; i++) {
|
||||||
|
_vertices[i] = Vec4(0.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CoreBBox::CoreBBox(CoreBBox** t_bboxes, const u32& count) {
|
CoreBBox::CoreBBox(CoreBBox** t_bboxes, const u32& count) {
|
||||||
float lowX = t_bboxes[0]->_vertices[0].x;
|
float lowX = t_bboxes[0]->_vertices[0].x;
|
||||||
float lowY = t_bboxes[0]->_vertices[0].y;
|
float lowY = t_bboxes[0]->_vertices[0].y;
|
||||||
@@ -132,6 +138,11 @@ CoreBBox::CoreBBox(Vec4* t_vertices, u32 count) {
|
|||||||
_vertices[7].set(hiX, hiY, hiZ);
|
_vertices[7].set(hiX, hiY, hiZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoreBBox::CoreBBox(const CoreBBox& t_bbox) {
|
||||||
|
for (auto i = 0; i < 8; i++)
|
||||||
|
Vec4::copy(&_vertices[i], t_bbox._vertices[i].xyzw);
|
||||||
|
}
|
||||||
|
|
||||||
CoreBBox::CoreBBox(Vec4* t_vertices) {
|
CoreBBox::CoreBBox(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);
|
||||||
}
|
}
|
||||||
@@ -168,8 +179,8 @@ std::string CoreBBox::getPrint(const char* name) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoreBBoxFrustum CoreBBox::isInFrustum(const Plane* frustumPlanes,
|
CoreBBoxFrustum CoreBBox::isInFrustum(const Plane* frustumPlanes,
|
||||||
const M4x4& model,
|
const M4x4& model,
|
||||||
const float* margins) const {
|
const float* margins) const {
|
||||||
CoreBBoxFrustum result = IN_FRUSTUM;
|
CoreBBoxFrustum result = IN_FRUSTUM;
|
||||||
Vec4 boxCalcTemp;
|
Vec4 boxCalcTemp;
|
||||||
u8 boxIn = 0, boxOut = 0;
|
u8 boxIn = 0, boxOut = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user