diff --git a/gameObject.cpp b/gameObject.cpp index 2ee2c76..f895437 100644 --- a/gameObject.cpp +++ b/gameObject.cpp @@ -1,8 +1,9 @@ #include "gameObject.h" #include "gameManager.h" #include "defConfigs.h" -#include "unit.h" #include "player.h" +#include "game.h" +#include "unit.h" #include @@ -29,6 +30,7 @@ namespace battleship{ Box *hbMesh = (Box*)hitbox->getMesh(0); hbMesh->setSize(Vector3(width, height, length)); hbMesh->updateVerts(hbMesh->getMeshBase()); + hitbox->setVisible(Game::getSingleton()->isDebug()); } } @@ -68,7 +70,7 @@ namespace battleship{ hitbox = new Node(Vector3(offsetPosTable["x"], offsetPosTable["y"], offsetPosTable["z"])); hitbox->attachMesh(box); - hitbox->setVisible(true); + hitbox->setVisible(Game::getSingleton()->isDebug()); model->attachChild(hitbox); } diff --git a/vehicle.cpp b/vehicle.cpp index 1c5eb69..0cdec74 100644 --- a/vehicle.cpp +++ b/vehicle.cpp @@ -22,16 +22,10 @@ using namespace std; namespace battleship{ Vehicle::Vehicle(Player *player, int id, Vector3 pos, Quaternion rot, Unit::State state) : Unit(player, id, pos, rot, state){ initProperties(); - - debugMat = new Material(Root::getSingleton()->getLibPath() + "texture"); - debugMat->addBoolUniform("lightingEnabled", false); - debugMat->addBoolUniform("texturingEnabled", false); - debugMat->addVec4Uniform("diffuseColor", Vector4::VEC_IJKL); } Vehicle::~Vehicle(){ removeAllPathpoints(); - delete debugMat; } void Vehicle::update(){ @@ -237,13 +231,12 @@ namespace battleship{ pathPoints.push_back(pointPos); Box *b = new Box(Vector3::VEC_IJK); - b->setMaterial(debugMat); + b->setMaterial(player->getColorMaterial()); Node *n = new Node(pointPos); n->attachMesh(b); - + n->setVisible(Game::getSingleton()->isDebug()); Root::getSingleton()->getRootNode()->attachChild(n); - debugPathPoints.push_back(n); } diff --git a/vehicle.h b/vehicle.h index 9bbb184..446830e 100644 --- a/vehicle.h +++ b/vehicle.h @@ -21,7 +21,6 @@ namespace battleship{ Unit *garrisonable = nullptr; int patrolPointId = 0, garrisonCategory; float speed, maxTurnAngle, anglePrecision; - vb01::Material *debugMat = nullptr; std::vector debugPathPoints; vb01::s64 lastBuildTime = 0;