mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
rendering path points and hitboxes only with debug mode enabled
This commit is contained in:
+4
-2
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user