rendering path points and hitboxes only with debug mode enabled

This commit is contained in:
devZoGok
2025-06-22 15:24:59 +03:00
parent eebab2b78b
commit 4a96642c39
3 changed files with 6 additions and 12 deletions
+4 -2
View File
@@ -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 <solUtil.h>
@@ -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);
}
+2 -9
View File
@@ -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);
}
-1
View File
@@ -21,7 +21,6 @@ namespace battleship{
Unit *garrisonable = nullptr;
int patrolPointId = 0, garrisonCategory;
float speed, maxTurnAngle, anglePrecision;
vb01::Material *debugMat = nullptr;
std::vector<vb01::Node*> debugPathPoints;
vb01::s64 lastBuildTime = 0;