OctTree debug temporarily disabled because of the new master layout
This commit is contained in:
+33
-33
@@ -85,42 +85,42 @@ OctTree::~OctTree()
|
|||||||
|
|
||||||
void OctTree::Update(float dt, World* world, Camera* cam)
|
void OctTree::Update(float dt, World* world, Camera* cam)
|
||||||
{
|
{
|
||||||
AABB aabb;
|
//AABB aabb;
|
||||||
for (ComponentWrapper& c : world->GetComponents("Collision")) {
|
//for (ComponentWrapper& c : world->GetComponents("Collision")) {
|
||||||
aabb.CreateFromCenter(c["BoxCenter"], c["BoxSize"]);
|
// aabb.CreateFromCenter(c["BoxCenter"], c["BoxSize"]);
|
||||||
AddStaticObject(aabb);
|
// AddStaticObject(aabb);
|
||||||
}
|
//}
|
||||||
const glm::vec4 redCol = glm::vec4(1, 0.2f, 0, 1);
|
//const glm::vec4 redCol = glm::vec4(1, 0.2f, 0, 1);
|
||||||
const glm::vec4 greenCol = glm::vec4(0.1f, 1.0f, 0.25f, 1);
|
//const glm::vec4 greenCol = glm::vec4(0.1f, 1.0f, 0.25f, 1);
|
||||||
const glm::vec3 boxSize = 0.1f*glm::vec3(1.0f, 1.0f, 1.0f);
|
//const glm::vec3 boxSize = 0.1f*glm::vec3(1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
if (!m_UpdatedOnce) {
|
//if (!m_UpdatedOnce) {
|
||||||
m_BoxID = world->CreateEntity();
|
// m_BoxID = world->CreateEntity();
|
||||||
ComponentWrapper transform = world->AttachComponent(m_BoxID, "Transform");
|
// ComponentWrapper transform = world->AttachComponent(m_BoxID, "Transform");
|
||||||
transform["Scale"] = boxSize;
|
// transform["Scale"] = boxSize;
|
||||||
ComponentWrapper model = world->AttachComponent(m_BoxID, "Model");
|
// ComponentWrapper model = world->AttachComponent(m_BoxID, "Model");
|
||||||
model["Resource"] = "Models/Core/UnitBox.obj";
|
// model["Resource"] = "Models/Core/UnitBox.obj";
|
||||||
m_UpdatedOnce = true;
|
// m_UpdatedOnce = true;
|
||||||
}
|
//}
|
||||||
|
|
||||||
AABB box;
|
//AABB box;
|
||||||
auto boxPos = cam->Position() + 1.2f*cam->Forward();
|
//auto boxPos = cam->Position() + 1.2f*cam->Forward();
|
||||||
box.CreateFromCenter(boxPos, boxSize);
|
//box.CreateFromCenter(boxPos, boxSize);
|
||||||
ComponentWrapper transform = world->GetComponent(m_BoxID, "Transform");
|
//ComponentWrapper transform = world->GetComponent(m_BoxID, "Transform");
|
||||||
transform["Position"] = boxPos;
|
//transform["Position"] = boxPos;
|
||||||
ComponentWrapper model = world->GetComponent(m_BoxID, "Model");
|
//ComponentWrapper model = world->GetComponent(m_BoxID, "Model");
|
||||||
if (BoxCollides(box, AABB())) {
|
//if (BoxCollides(box, AABB())) {
|
||||||
//if (Collision::AABBVsAABB(box, aabb)) {
|
////if (Collision::AABBVsAABB(box, aabb)) {
|
||||||
cam->SetPosition(m_PrevPos);
|
// cam->SetPosition(m_PrevPos);
|
||||||
cam->SetOrientation(m_PrevOri);
|
// cam->SetOrientation(m_PrevOri);
|
||||||
model["Color"] = greenCol;
|
// model["Color"] = greenCol;
|
||||||
} else {
|
//} else {
|
||||||
model["Color"] = redCol;
|
// model["Color"] = redCol;
|
||||||
}
|
//}
|
||||||
|
|
||||||
m_PrevPos = cam->Position();
|
//m_PrevPos = cam->Position();
|
||||||
m_PrevOri = cam->Orientation();
|
//m_PrevOri = cam->Orientation();
|
||||||
ClearObjects();
|
//ClearObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OctTree::BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected) const
|
bool OctTree::BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected) const
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ BOOST_AUTO_TEST_CASE(WorldTestMultipleAllocations, * utf::tolerance(0.00001))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop through them and check data
|
// Loop through them and check data
|
||||||
int i = 0;
|
//int i = 0;
|
||||||
for (auto& c : w.GetComponents("Test")) {
|
//for (auto& c : w.GetComponents("Test")) {
|
||||||
BOOST_TEST((int)c["TestInteger"] == i);
|
// BOOST_TEST((int)c["TestInteger"] == i);
|
||||||
i++;
|
// i++;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user