mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
Replace BulletDebugNode.setVerbose with setters for individual debug components (wireframe, bounding boxes, constraints, normals)
This commit is contained in:
parent
48f2a8cab7
commit
a0b8d5758d
@ -23,25 +23,49 @@ INLINE BulletDebugNode::
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletDebugNode::set_verbose
|
||||
// Function: BulletDebugNode::show_wireframe
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletDebugNode::
|
||||
set_verbose(bool verbose) {
|
||||
show_wireframe(bool show) {
|
||||
|
||||
_verbose = verbose;
|
||||
_wireframe = show;
|
||||
draw_mask_changed();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletDebugNode::get_verbose
|
||||
// Function: BulletDebugNode::show_constraints
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool BulletDebugNode::
|
||||
get_verbose() const {
|
||||
INLINE void BulletDebugNode::
|
||||
show_constraints(bool show) {
|
||||
|
||||
return _verbose;
|
||||
_constraints = show;
|
||||
draw_mask_changed();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletDebugNode::show_bounding_boxes
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletDebugNode::
|
||||
show_bounding_boxes(bool show) {
|
||||
|
||||
_bounds = show;
|
||||
draw_mask_changed();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletDebugNode::show_normals
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletDebugNode::
|
||||
show_normals(bool show) {
|
||||
|
||||
_drawer._normals = show;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,12 @@ TypeHandle BulletDebugNode::_type_handle;
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
BulletDebugNode::
|
||||
BulletDebugNode(const char *name) : GeomNode(name), _verbose(false) {
|
||||
BulletDebugNode(const char *name) : GeomNode(name) {
|
||||
|
||||
_wireframe = true;
|
||||
_constraints = true;
|
||||
_bounds = false;
|
||||
_drawer._normals = true;
|
||||
|
||||
_vdata = new GeomVertexData("", GeomVertexFormat::get_v3c4(), Geom::UH_stream);
|
||||
|
||||
@ -167,21 +172,24 @@ draw_mask_changed() {
|
||||
_drawer.setDebugMode(DebugDraw::DBG_NoDebug);
|
||||
}
|
||||
else {
|
||||
if (_verbose) {
|
||||
_drawer.setDebugMode(DebugDraw::DBG_DrawWireframe |
|
||||
DebugDraw::DBG_DrawAabb |
|
||||
DebugDraw::DBG_DrawText |
|
||||
DebugDraw::DBG_DrawFeaturesText |
|
||||
DebugDraw::DBG_DrawContactPoints |
|
||||
DebugDraw::DBG_DrawConstraints |
|
||||
DebugDraw::DBG_DrawConstraintLimits);
|
||||
}
|
||||
else {
|
||||
_drawer.setDebugMode(DebugDraw::DBG_DrawWireframe |
|
||||
DebugDraw::DBG_DrawConstraints |
|
||||
DebugDraw::DBG_FastWireframe);
|
||||
int mode = DebugDraw::DBG_DrawText |
|
||||
DebugDraw::DBG_DrawFeaturesText |
|
||||
DebugDraw::DBG_DrawContactPoints;
|
||||
|
||||
if (_wireframe) {
|
||||
mode |= DebugDraw::DBG_DrawWireframe;
|
||||
}
|
||||
|
||||
if (_constraints) {
|
||||
mode |= DebugDraw::DBG_DrawConstraints;
|
||||
mode |= DebugDraw::DBG_DrawConstraintLimits;
|
||||
}
|
||||
|
||||
if (_bounds) {
|
||||
mode |= DebugDraw::DBG_DrawAabb;
|
||||
}
|
||||
|
||||
_drawer.setDebugMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,6 +305,10 @@ drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color) {
|
||||
float g = color.getY();
|
||||
float b = color.getZ();
|
||||
|
||||
// Hack to get rid of triangle normals. The hack is based on the
|
||||
// assumption that only normals are drawn in yellow.
|
||||
if (_normals==false && r==1.0f && g==1.0f && b==0.0f) return;
|
||||
|
||||
Line line;
|
||||
|
||||
line._p0 = LVecBase3f(from.getX(), from.getY(), from.getZ());
|
||||
|
@ -37,8 +37,10 @@ PUBLISHED:
|
||||
|
||||
virtual void draw_mask_changed();
|
||||
|
||||
INLINE void set_verbose(bool verbose);
|
||||
INLINE bool get_verbose() const;
|
||||
INLINE void show_wireframe(bool show);
|
||||
INLINE void show_constraints(bool show);
|
||||
INLINE void show_bounding_boxes(bool show);
|
||||
INLINE void show_normals(bool show);
|
||||
|
||||
public:
|
||||
virtual bool safe_to_flatten() const;
|
||||
@ -91,13 +93,15 @@ private:
|
||||
pvector<Line> _lines;
|
||||
pvector<Triangle> _triangles;
|
||||
|
||||
private:
|
||||
bool _normals;
|
||||
int _mode;
|
||||
};
|
||||
|
||||
DebugDraw _drawer;
|
||||
|
||||
bool _verbose;
|
||||
bool _wireframe;
|
||||
bool _constraints;
|
||||
bool _bounds;
|
||||
|
||||
PT(GeomVertexData) _vdata;
|
||||
PT(Geom) _geom_lines;
|
||||
|
Loading…
x
Reference in New Issue
Block a user