overte-HifiExperiments/libraries/physics/src/PhysicsDebugDraw.h
Anthony J. Thibault 4fa9af5534 Added items to the developer menu for debugging physics
Hooked up Bullet's internal debug draw functionality to our client.
Under the Developer > Physics Menu there are five new items:

  * Show Bullet Collision - will draw all collision shapes in wireframe. WARNING: can be slow on large scenes.
  * Show Bullet Bounding Boxes - will draw axis aligned bounding boxes around all physics shapes.
  * Show Bullet Contact Points - will draw all contact points where two or more objects are colliding.
  * Show Bullet Constraints - will render wire frame axes for each constraint connecting bodies together.
  * Show Bullet Constraint Limits - will render the joint limits for each constraint.
2018-05-02 10:51:00 -07:00

34 lines
1.2 KiB
C++

//
// PhysicsDebugDraw.h
// libraries/physics/src
//
// Created by Anthony Thibault 2018-4-18
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
// http://bulletphysics.org/Bullet/BulletFull/classbtIDebugDraw.html
#ifndef hifi_PhysicsDebugDraw_h
#define hifi_PhysicsDebugDraw_h
#include <stdint.h>
#include <LinearMath/btIDebugDraw.h>
class PhysicsDebugDraw : public btIDebugDraw {
public:
using btIDebugDraw::drawLine;
virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color) override;
virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance,
int lifeTime, const btVector3& color) override;
virtual void reportErrorWarning(const char* warningString) override;
virtual void draw3dText(const btVector3& location, const char* textString) override;
virtual void setDebugMode(int debugMode) override;
virtual int getDebugMode() const override;
protected:
uint32_t _debugDrawMode;
};
#endif // hifi_PhysicsDebugDraw_h