Renamed all OctTree to Octree (More OCD)
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
#ifndef OctTree_h__
|
#ifndef Octree_h__
|
||||||
#define OctTree_h__
|
#define Octree_h__
|
||||||
|
|
||||||
#include "Core/AABB.h"
|
#include "Core/AABB.h"
|
||||||
|
|
||||||
class Ray;
|
class Ray;
|
||||||
|
|
||||||
class OctTree
|
class Octree
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct Output
|
struct Output
|
||||||
@@ -13,16 +13,16 @@ public:
|
|||||||
float CollideDistance;
|
float CollideDistance;
|
||||||
};
|
};
|
||||||
|
|
||||||
OctTree();
|
Octree();
|
||||||
~OctTree();
|
~Octree();
|
||||||
//For the root OctTree, [octTreeBounds] should be a box containing the entire level.
|
//For the root Octree, [octreeBounds] should be a box containing the entire level.
|
||||||
OctTree(const AABB& octTreeBounds, int subDivisions);
|
Octree(const AABB& octreeBounds, int subDivisions);
|
||||||
|
|
||||||
//We cannot copy the OctTree as of now, because of the recursive dynamic allocation.
|
//We cannot copy the Octree as of now, because of the recursive dynamic allocation.
|
||||||
//Define these if the OctTree suddenly needs to be copied, think of the children OctChild* ptrs.
|
//Define these if the Octree suddenly needs to be copied, think of the children Child* ptrs.
|
||||||
OctTree(const OctTree& other) = delete;
|
Octree(const Octree& other) = delete;
|
||||||
OctTree(const OctTree&& other) = delete;
|
Octree(const Octree&& other) = delete;
|
||||||
OctTree& operator= (const OctTree& other) = delete;
|
Octree& operator= (const Octree& other) = delete;
|
||||||
//Add a dynamic object (one that moves around) into the tree.
|
//Add a dynamic object (one that moves around) into the tree.
|
||||||
void AddDynamicObject(const AABB& box);
|
void AddDynamicObject(const AABB& box);
|
||||||
//Add a static object (that does not move) into the tree.
|
//Add a static object (that does not move) into the tree.
|
||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
bool BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected);
|
bool BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct OctChild; //Fwd declaration;
|
struct Child; //Fwd declaration;
|
||||||
struct ContainedObject
|
struct ContainedObject
|
||||||
{
|
{
|
||||||
ContainedObject()
|
ContainedObject()
|
||||||
@@ -56,7 +56,7 @@ private:
|
|||||||
AABB Box;
|
AABB Box;
|
||||||
bool Checked;
|
bool Checked;
|
||||||
};
|
};
|
||||||
OctChild* m_Root;
|
Child* m_Root;
|
||||||
std::vector<ContainedObject> m_StaticObjects;
|
std::vector<ContainedObject> m_StaticObjects;
|
||||||
std::vector<ContainedObject> m_DynamicObjects;
|
std::vector<ContainedObject> m_DynamicObjects;
|
||||||
|
|
||||||
@@ -67,16 +67,16 @@ private:
|
|||||||
|
|
||||||
void falsifyObjectChecks();
|
void falsifyObjectChecks();
|
||||||
|
|
||||||
struct OctChild
|
struct Child
|
||||||
{
|
{
|
||||||
~OctChild();
|
~Child();
|
||||||
OctChild(const AABB& octTreeBounds,
|
Child(const AABB& octTreeBounds,
|
||||||
int subDivisions,
|
int subDivisions,
|
||||||
std::vector<OctTree::ContainedObject>& staticObjects,
|
std::vector<Octree::ContainedObject>& staticObjects,
|
||||||
std::vector<OctTree::ContainedObject>& dynamicObjects);
|
std::vector<Octree::ContainedObject>& dynamicObjects);
|
||||||
OctChild(const OctChild& other) = delete;
|
Child(const Child& other) = delete;
|
||||||
OctChild(const OctChild&& other) = delete;
|
Child(const Child&& other) = delete;
|
||||||
OctChild& operator= (const OctChild& other) = delete;
|
Child& operator= (const Child& other) = delete;
|
||||||
void AddDynamicObject(const AABB& box);
|
void AddDynamicObject(const AABB& box);
|
||||||
void AddStaticObject(const AABB& box);
|
void AddStaticObject(const AABB& box);
|
||||||
void BoxesInSameRegion(const AABB& box, std::vector<AABB>& outBoxes) const;
|
void BoxesInSameRegion(const AABB& box, std::vector<AABB>& outBoxes) const;
|
||||||
@@ -85,14 +85,14 @@ private:
|
|||||||
bool RayCollides(const Ray& ray, Output& data) const;
|
bool RayCollides(const Ray& ray, Output& data) const;
|
||||||
bool BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected) const;
|
bool BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected) const;
|
||||||
|
|
||||||
OctChild* m_Children[8];
|
Child* m_Children[8];
|
||||||
//Indices into the lists in OctTree.
|
//Indices into the lists in Octree.
|
||||||
std::vector<int> m_StaticObjIndices;
|
std::vector<int> m_StaticObjIndices;
|
||||||
std::vector<int> m_DynamicObjIndices;
|
std::vector<int> m_DynamicObjIndices;
|
||||||
AABB m_Box;
|
AABB m_Box;
|
||||||
//Reference to the lists in OctTree.
|
//Reference to the lists in Octree.
|
||||||
std::vector<OctTree::ContainedObject>& m_StaticObjectsRef;
|
std::vector<Octree::ContainedObject>& m_StaticObjectsRef;
|
||||||
std::vector<OctTree::ContainedObject>& m_DynamicObjectsRef;
|
std::vector<Octree::ContainedObject>& m_DynamicObjectsRef;
|
||||||
|
|
||||||
inline bool hasChildren() const;
|
inline bool hasChildren() const;
|
||||||
int childIndexContainingPoint(const glm::vec3& point) const;
|
int childIndexContainingPoint(const glm::vec3& point) const;
|
||||||
|
|||||||
+30
-30
@@ -21,65 +21,65 @@ bool isFirstLower(const ChildInfo& first, const ChildInfo& second)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OctTree::OctTree()
|
Octree::Octree()
|
||||||
: OctTree(AABB(), 0)
|
: Octree(AABB(), 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
OctTree::OctTree(const AABB& octTreeBounds, int subDivisions)
|
Octree::Octree(const AABB& octTreeBounds, int subDivisions)
|
||||||
: m_Root(new OctChild(octTreeBounds, subDivisions, m_StaticObjects, m_DynamicObjects))
|
: m_Root(new Child(octTreeBounds, subDivisions, m_StaticObjects, m_DynamicObjects))
|
||||||
, m_UpdatedOnce(false)
|
, m_UpdatedOnce(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
OctTree::~OctTree()
|
Octree::~Octree()
|
||||||
{
|
{
|
||||||
delete m_Root;
|
delete m_Root;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::AddDynamicObject(const AABB& box)
|
void Octree::AddDynamicObject(const AABB& box)
|
||||||
{
|
{
|
||||||
m_Root->AddDynamicObject(box);
|
m_Root->AddDynamicObject(box);
|
||||||
m_DynamicObjects.push_back(box);
|
m_DynamicObjects.push_back(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::AddStaticObject(const AABB& box)
|
void Octree::AddStaticObject(const AABB& box)
|
||||||
{
|
{
|
||||||
m_Root->AddStaticObject(box);
|
m_Root->AddStaticObject(box);
|
||||||
m_StaticObjects.push_back(box);
|
m_StaticObjects.push_back(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::BoxesInSameRegion(const AABB& box, std::vector<AABB>& outBoxes)
|
void Octree::BoxesInSameRegion(const AABB& box, std::vector<AABB>& outBoxes)
|
||||||
{
|
{
|
||||||
falsifyObjectChecks();
|
falsifyObjectChecks();
|
||||||
m_Root->BoxesInSameRegion(box, outBoxes);
|
m_Root->BoxesInSameRegion(box, outBoxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::ClearObjects()
|
void Octree::ClearObjects()
|
||||||
{
|
{
|
||||||
m_StaticObjects.clear();
|
m_StaticObjects.clear();
|
||||||
m_DynamicObjects.clear();
|
m_DynamicObjects.clear();
|
||||||
m_Root->ClearObjects();
|
m_Root->ClearObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::ClearDynamicObjects()
|
void Octree::ClearDynamicObjects()
|
||||||
{
|
{
|
||||||
m_DynamicObjects.clear();
|
m_DynamicObjects.clear();
|
||||||
m_Root->ClearDynamicObjects();
|
m_Root->ClearDynamicObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OctTree::RayCollides(const Ray& ray, Output& data)
|
bool Octree::RayCollides(const Ray& ray, Output& data)
|
||||||
{
|
{
|
||||||
falsifyObjectChecks();
|
falsifyObjectChecks();
|
||||||
data.CollideDistance = -1;
|
data.CollideDistance = -1;
|
||||||
return m_Root->RayCollides(ray, data);
|
return m_Root->RayCollides(ray, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OctTree::BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected)
|
bool Octree::BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected)
|
||||||
{
|
{
|
||||||
falsifyObjectChecks();
|
falsifyObjectChecks();
|
||||||
return m_Root->BoxCollides(boxToTest, outBoxIntersected);
|
return m_Root->BoxCollides(boxToTest, outBoxIntersected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::falsifyObjectChecks()
|
void Octree::falsifyObjectChecks()
|
||||||
{
|
{
|
||||||
for (auto& obj : m_StaticObjects) {
|
for (auto& obj : m_StaticObjects) {
|
||||||
obj.Checked = false;
|
obj.Checked = false;
|
||||||
@@ -89,7 +89,7 @@ void OctTree::falsifyObjectChecks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OctTree::OctChild::OctChild(const AABB& octTreeBounds,
|
Octree::Child::Child(const AABB& octTreeBounds,
|
||||||
int subDivisions,
|
int subDivisions,
|
||||||
std::vector<ContainedObject>& staticObjects,
|
std::vector<ContainedObject>& staticObjects,
|
||||||
std::vector<ContainedObject>& dynamicObjects)
|
std::vector<ContainedObject>& dynamicObjects)
|
||||||
@@ -98,7 +98,7 @@ OctTree::OctChild::OctChild(const AABB& octTreeBounds,
|
|||||||
, m_DynamicObjectsRef(dynamicObjects)
|
, m_DynamicObjectsRef(dynamicObjects)
|
||||||
{
|
{
|
||||||
if (subDivisions == 0) {
|
if (subDivisions == 0) {
|
||||||
for (OctChild*& c : m_Children) {
|
for (Child*& c : m_Children) {
|
||||||
c = nullptr;
|
c = nullptr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -134,14 +134,14 @@ OctTree::OctChild::OctChild(const AABB& octTreeBounds,
|
|||||||
minPos.z = parentMin.z;
|
minPos.z = parentMin.z;
|
||||||
maxPos.z = parentCenter.z;
|
maxPos.z = parentCenter.z;
|
||||||
}
|
}
|
||||||
m_Children[i] = new OctChild(AABB(minPos, maxPos), subDivisions, m_StaticObjectsRef, m_DynamicObjectsRef);
|
m_Children[i] = new Child(AABB(minPos, maxPos), subDivisions, m_StaticObjectsRef, m_DynamicObjectsRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OctTree::OctChild::~OctChild()
|
Octree::Child::~Child()
|
||||||
{
|
{
|
||||||
for (OctChild*& c : m_Children) {
|
for (Child*& c : m_Children) {
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
delete c;
|
delete c;
|
||||||
c = nullptr;
|
c = nullptr;
|
||||||
@@ -149,7 +149,7 @@ OctTree::OctChild::~OctChild()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OctTree::OctChild::BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected) const
|
bool Octree::Child::BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected) const
|
||||||
{
|
{
|
||||||
if (hasChildren()) {
|
if (hasChildren()) {
|
||||||
for (int i : childIndicesContainingBox(boxToTest)) {
|
for (int i : childIndicesContainingBox(boxToTest)) {
|
||||||
@@ -182,7 +182,7 @@ bool OctTree::OctChild::BoxCollides(const AABB& boxToTest, AABB& outBoxIntersect
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OctTree::OctChild::RayCollides(const Ray& ray, Output& data) const
|
bool Octree::Child::RayCollides(const Ray& ray, Output& data) const
|
||||||
{
|
{
|
||||||
//If the node AABB is missed, everything it contains is missed.
|
//If the node AABB is missed, everything it contains is missed.
|
||||||
if (Collision::RayAABBIntr(ray, m_Box)) {
|
if (Collision::RayAABBIntr(ray, m_Box)) {
|
||||||
@@ -234,7 +234,7 @@ bool OctTree::OctChild::RayCollides(const Ray& ray, Output& data) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OctTree::OctChild::AddDynamicObject(const AABB& box)
|
void Octree::Child::AddDynamicObject(const AABB& box)
|
||||||
{
|
{
|
||||||
if (hasChildren()) {
|
if (hasChildren()) {
|
||||||
for (auto i : childIndicesContainingBox(box)) {
|
for (auto i : childIndicesContainingBox(box)) {
|
||||||
@@ -246,7 +246,7 @@ void OctTree::OctChild::AddDynamicObject(const AABB& box)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::OctChild::AddStaticObject(const AABB& box)
|
void Octree::Child::AddStaticObject(const AABB& box)
|
||||||
{
|
{
|
||||||
if (hasChildren()) {
|
if (hasChildren()) {
|
||||||
for (auto i : childIndicesContainingBox(box)) {
|
for (auto i : childIndicesContainingBox(box)) {
|
||||||
@@ -258,7 +258,7 @@ void OctTree::OctChild::AddStaticObject(const AABB& box)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::OctChild::BoxesInSameRegion(const AABB& box, std::vector<AABB>& outBoxes) const
|
void Octree::Child::BoxesInSameRegion(const AABB& box, std::vector<AABB>& outBoxes) const
|
||||||
{
|
{
|
||||||
if (hasChildren()) {
|
if (hasChildren()) {
|
||||||
for (auto i : childIndicesContainingBox(box)) {
|
for (auto i : childIndicesContainingBox(box)) {
|
||||||
@@ -292,10 +292,10 @@ void OctTree::OctChild::BoxesInSameRegion(const AABB& box, std::vector<AABB>& ou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::OctChild::ClearObjects()
|
void Octree::Child::ClearObjects()
|
||||||
{
|
{
|
||||||
if (hasChildren()) {
|
if (hasChildren()) {
|
||||||
for (OctChild*& c : m_Children) {
|
for (Child*& c : m_Children) {
|
||||||
c->ClearObjects();
|
c->ClearObjects();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -304,10 +304,10 @@ void OctTree::OctChild::ClearObjects()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctTree::OctChild::ClearDynamicObjects()
|
void Octree::Child::ClearDynamicObjects()
|
||||||
{
|
{
|
||||||
if (hasChildren()) {
|
if (hasChildren()) {
|
||||||
for (OctChild*& c : m_Children) {
|
for (Child*& c : m_Children) {
|
||||||
c->ClearObjects();
|
c->ClearObjects();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -327,13 +327,13 @@ void OctTree::OctChild::ClearDynamicObjects()
|
|||||||
// x : - - - - + + + +
|
// x : - - - - + + + +
|
||||||
// y : - - + + - - + +
|
// y : - - + + - - + +
|
||||||
// z : - + - + - + - +
|
// z : - + - + - + - +
|
||||||
int OctTree::OctChild::childIndexContainingPoint(const glm::vec3& point) const
|
int Octree::Child::childIndexContainingPoint(const glm::vec3& point) const
|
||||||
{
|
{
|
||||||
const glm::vec3& c = m_Box.Center();
|
const glm::vec3& c = m_Box.Center();
|
||||||
return (1 << 2) * (point.x >= c.x) | (1 << 1) * (point.y >= c.y) | (point.z >= c.z);
|
return (1 << 2) * (point.x >= c.x) | (1 << 1) * (point.y >= c.y) | (point.z >= c.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> OctTree::OctChild::childIndicesContainingBox(const AABB& box) const
|
std::vector<int> Octree::Child::childIndicesContainingBox(const AABB& box) const
|
||||||
{
|
{
|
||||||
int minInd = childIndexContainingPoint(box.MinCorner());
|
int minInd = childIndexContainingPoint(box.MinCorner());
|
||||||
int maxInd = childIndexContainingPoint(box.MaxCorner());
|
int maxInd = childIndexContainingPoint(box.MaxCorner());
|
||||||
@@ -371,7 +371,7 @@ std::vector<int> OctTree::OctChild::childIndicesContainingBox(const AABB& box) c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool OctTree::OctChild::hasChildren() const
|
inline bool Octree::Child::hasChildren() const
|
||||||
{
|
{
|
||||||
return m_Children[0] != nullptr;
|
return m_Children[0] != nullptr;
|
||||||
}
|
}
|
||||||
@@ -205,9 +205,9 @@ BOOST_AUTO_TEST_CASE(octTest)
|
|||||||
{
|
{
|
||||||
glm::vec3 mini = glm::vec3(-1, -1, -1);
|
glm::vec3 mini = glm::vec3(-1, -1, -1);
|
||||||
glm::vec3 maxi = glm::vec3(1, 1, 1);
|
glm::vec3 maxi = glm::vec3(1, 1, 1);
|
||||||
OctTree tree(AABB(mini, maxi), 2);
|
Octree tree(AABB(mini, maxi), 2);
|
||||||
tree.AddDynamicObject(AABB(mini, -0.9f*maxi));
|
tree.AddDynamicObject(AABB(mini, -0.9f*maxi));
|
||||||
OctTree::Output data;
|
Octree::Output data;
|
||||||
glm::vec3 origin = 3.0f * mini;
|
glm::vec3 origin = 3.0f * mini;
|
||||||
bool rayIntersected = tree.RayCollides(Ray(origin , mini - origin), data);
|
bool rayIntersected = tree.RayCollides(Ray(origin , mini - origin), data);
|
||||||
BOOST_CHECK(rayIntersected);
|
BOOST_CHECK(rayIntersected);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ BOOST_AUTO_TEST_CASE(octSameRegionTest)
|
|||||||
{
|
{
|
||||||
glm::vec3 mini = glm::vec3(-1, -1, -1);
|
glm::vec3 mini = glm::vec3(-1, -1, -1);
|
||||||
glm::vec3 maxi = glm::vec3(1, 1, 1);
|
glm::vec3 maxi = glm::vec3(1, 1, 1);
|
||||||
OctTree tree(AABB(mini, maxi), 2);
|
Octree tree(AABB(mini, maxi), 2);
|
||||||
AABB firstQuadrant(mini, 0.8f*mini);
|
AABB firstQuadrant(mini, 0.8f*mini);
|
||||||
tree.AddStaticObject(firstQuadrant);
|
tree.AddStaticObject(firstQuadrant);
|
||||||
AABB testBox(0.9f*mini, 0.8f*mini);
|
AABB testBox(0.9f*mini, 0.8f*mini);
|
||||||
@@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE(octRegionPerfTestWithDuplicates)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(octRegionPerfTestNoDuplicates)
|
BOOST_AUTO_TEST_CASE(octRegionPerfTestNoDuplicates)
|
||||||
{
|
{
|
||||||
TestLoop<OctTree>(RegionTest<OctTree>);
|
TestLoop<Octree>(RegionTest<Octree>);
|
||||||
BOOST_CHECK(true);
|
BOOST_CHECK(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(octBoxPerfTestWithDuplicates)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(octBoxPerfTestNoDuplicates)
|
BOOST_AUTO_TEST_CASE(octBoxPerfTestNoDuplicates)
|
||||||
{
|
{
|
||||||
TestLoop<OctTree>(BoxTest<OctTree>);
|
TestLoop<Octree>(BoxTest<Octree>);
|
||||||
BOOST_CHECK(true);
|
BOOST_CHECK(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE(octRayPerfTestWithDuplicates)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(octRayPerfTestNoDuplicates)
|
BOOST_AUTO_TEST_CASE(octRayPerfTestNoDuplicates)
|
||||||
{
|
{
|
||||||
TestLoop<OctTree>(RayTest<OctTree>);
|
TestLoop<Octree>(RayTest<Octree>);
|
||||||
BOOST_CHECK(true);
|
BOOST_CHECK(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(octNopPerfTestWithDuplicates)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(octNopPerfTestNoDuplicates)
|
BOOST_AUTO_TEST_CASE(octNopPerfTestNoDuplicates)
|
||||||
{
|
{
|
||||||
TestLoop<OctTree>(NopTest<OctTree>);
|
TestLoop<Octree>(NopTest<Octree>);
|
||||||
BOOST_CHECK(true);
|
BOOST_CHECK(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ private:
|
|||||||
glm::quat m_PrevOri;
|
glm::quat m_PrevOri;
|
||||||
|
|
||||||
glm::vec3 worldSize = glm::vec3(50, 50, 50);
|
glm::vec3 worldSize = glm::vec3(50, 50, 50);
|
||||||
OctTree someOctTree;
|
Octree someOctTree;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ class HardcodedTestWorld : public World
|
|||||||
public:
|
public:
|
||||||
struct LinkOctTreeAndModel {
|
struct LinkOctTreeAndModel {
|
||||||
EntityID entId;
|
EntityID entId;
|
||||||
OctTree::OctChild* child;
|
Octree::Child* child;
|
||||||
glm::vec3 posxyz;
|
glm::vec3 posxyz;
|
||||||
LinkOctTreeAndModel(EntityID eId, OctTree::OctChild* ch, glm::vec3 pos)
|
LinkOctTreeAndModel(EntityID eId, Octree::Child* ch, glm::vec3 pos)
|
||||||
{
|
{
|
||||||
entId = eId;
|
entId = eId;
|
||||||
child = ch;
|
child = ch;
|
||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
};
|
};
|
||||||
EntityID anotherBoxTransformId;
|
EntityID anotherBoxTransformId;
|
||||||
std::vector<LinkOctTreeAndModel> linkOM;
|
std::vector<LinkOctTreeAndModel> linkOM;
|
||||||
OctTree someOctTree;
|
Octree someOctTree;
|
||||||
|
|
||||||
//constructor
|
//constructor
|
||||||
HardcodedTestWorld()
|
HardcodedTestWorld()
|
||||||
@@ -115,7 +115,7 @@ private:
|
|||||||
model["Resource"] = "Models/Core/UnitBox.obj";
|
model["Resource"] = "Models/Core/UnitBox.obj";
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBoxModel(const glm::vec3 ¢er, const float &halfSize, OctTree::OctChild* child, EntityID &outEntityId) {
|
void AddBoxModel(const glm::vec3 ¢er, const float &halfSize, Octree::Child* child, EntityID &outEntityId) {
|
||||||
World& world = *this;
|
World& world = *this;
|
||||||
|
|
||||||
EntityID entityDummyScene = world.CreateEntity();
|
EntityID entityDummyScene = world.CreateEntity();
|
||||||
|
|||||||
Reference in New Issue
Block a user