Magnum::BulletIntegration::DebugDraw class

Bullet physics debug visualization.

This class implements btIDebugDraw, which allows rendering a visualization of a Bullet physics world for debugging purposes.

Usage

Set up an instance and attach it to Bullet world:

btDynamicsWorld* btWorld = ;
BulletIntegration::DebugDraw debugDraw;

debugDraw.setMode(BulletIntegration::DebugDraw::Mode::DrawWireframe|
                  BulletIntegration::DebugDraw::Mode::DrawConstraints);
btWorld->setDebugDrawer(&debugDraw);

Then, at every frame, call this:

debugDraw.setTransformationProjectionMatrix(projection*transformation);
btWorld->debugDrawWorld();

Public types

enum class Mode: Int { NoDebug = DBG_NoDebug, DrawWireframe = DBG_DrawWireframe, DrawAabb = DBG_DrawAabb, DrawFeaturesText = DBG_DrawFeaturesText, DrawContactPoints = DBG_DrawContactPoints, NoDeactivation = DBG_NoDeactivation, NoHelpText = DBG_NoHelpText, DrawText = DBG_DrawText, ProfileTimings = DBG_ProfileTimings, EnableSatComparison = DBG_EnableSatComparison, DisableBulletLCP = DBG_DisableBulletLCP, EnableCCD = DBG_EnableCCD, DrawConstraints = DBG_DrawConstraints, DrawConstraintLimits = DBG_DrawConstraintLimits, FastWireframe = DBG_FastWireframe, DrawNormals = DBG_DrawNormals }
Debug mode.
using Modes = Containers::EnumSet<Mode>
Debug modes.

Constructors, destructors, conversion operators

DebugDraw(std::size_t initialBufferCapacity = 0) explicit
Constructor.
DebugDraw(NoCreateT) explicit noexcept
Construct without creating the underlying OpenGL objects.
DebugDraw(DebugDraw&&) noexcept
Move constructor.
DebugDraw(const DebugDraw&) deleted
Copying is not allowed.

Public functions

auto operator=(DebugDraw&&) -> DebugDraw& noexcept
Move assignment.
auto operator=(const DebugDraw&) -> DebugDraw& deleted
Copying is not allowed.
auto mode() const -> Modes
Debug mode.
auto debugMode() const -> Modes deprecated in 2018.10
Debug mode.
auto setMode(Modes mode) -> DebugDraw&
Set debug mode.
auto setTransformationProjectionMatrix(const Matrix4& matrix) -> DebugDraw&
Set transformation projection matrix used for rendering.

Enum documentation

enum class Magnum::BulletIntegration::DebugDraw::Mode: Int

Debug mode.

Enumerators
NoDebug

Disable debug rendering

DrawWireframe

Draw wireframe of all collision shapes

DrawAabb

Draw axis aligned bounding box of all collision object

DrawFeaturesText

Draw text for features

DrawContactPoints

Draw contact points

NoDeactivation

Disable deactivation of objects

NoHelpText

Diable help text

DrawText

Enable text drawing

ProfileTimings

Profile timings

EnableSatComparison

Enable Sat Comparison

DisableBulletLCP

Disable Bullet LCP

EnableCCD

Enable CCD

DrawConstraints

Draw constaints

DrawConstraintLimits

Draw constraint limits

FastWireframe

Draw fast wireframes

DrawNormals

Draw normals

Typedef documentation

typedef Containers::EnumSet<Mode> Magnum::BulletIntegration::DebugDraw::Modes

Debug modes.

Function documentation

Magnum::BulletIntegration::DebugDraw::DebugDraw(std::size_t initialBufferCapacity = 0) explicit

Constructor.

Parameters
initialBufferCapacity Amount of lines for which to reserve memory in the buffer vector.

Sets up Shaders::VertexColorGL3D, GL::Buffer and GL::Mesh for physics debug rendering.

Magnum::BulletIntegration::DebugDraw::DebugDraw(NoCreateT) explicit noexcept

Construct without creating the underlying OpenGL objects.

The constructed instance is equivalent to moved-from state. Useful for deferring the initialization to a later point, for example if the OpenGL context is not yet created. Move another instance over it to make it useful.

Modes Magnum::BulletIntegration::DebugDraw::debugMode() const

Debug mode.

DebugDraw& Magnum::BulletIntegration::DebugDraw::setMode(Modes mode)

Set debug mode.

Returns Reference to self (for method chaining)

By default, nothing is enabled.