Leviathan  0.8.0.0
Leviathan game engine
Leviathan::PhysicsDebugDrawer Class Reference

#include <PhysicsDebugDrawer.h>

+ Inheritance diagram for Leviathan::PhysicsDebugDrawer:

Public Member Functions

 PhysicsDebugDrawer (Window &drawtarget, GameWorld &cameraworld)
 
void drawLine (const btVector3 &from, const btVector3 &to, const btVector3 &color) override
 
void drawSphere (const btVector3 &p, btScalar radius, const btVector3 &color) override
 
void drawContactPoint (const btVector3 &pointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &color) override
 
void reportErrorWarning (const char *warningString) override
 
void draw3dText (const btVector3 &location, const char *textString) override
 
void setDebugMode (int mode) override
 
int getDebugMode () const override
 
DLLEXPORT void OnBeginDraw ()
 

Protected Attributes

int DebugMode = btIDebugDraw::DBG_DrawWireframe
 

Detailed Description

Definition at line 12 of file PhysicsDebugDrawer.h.

Constructor & Destructor Documentation

◆ PhysicsDebugDrawer()

PhysicsDebugDrawer::PhysicsDebugDrawer ( Window drawtarget,
GameWorld cameraworld 
)
Note
drawtarget Is currently ignored as bsf debug drawing is drawn on all windows

Definition at line 10 of file PhysicsDebugDrawer.cpp.

10  :
11  Target(drawtarget), World(cameraworld)
12 {}

Member Function Documentation

◆ draw3dText()

void Leviathan::PhysicsDebugDrawer::draw3dText ( const btVector3 &  location,
const char *  textString 
)
inlineoverride

Definition at line 26 of file PhysicsDebugDrawer.h.

26 {}

◆ drawContactPoint()

void PhysicsDebugDrawer::drawContactPoint ( const btVector3 &  pointOnB,
const btVector3 &  normalOnB,
btScalar  distance,
int  lifeTime,
const btVector3 &  color 
)
override

Definition at line 28 of file PhysicsDebugDrawer.cpp.

30 {
31  const auto to = pointOnB + normalOnB * distance;
32 
33  drawLine(pointOnB, to, color);
34 
35  // According to one source lifeTime should be drawn as a string near pointOnB
36 }
void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color) override
std::iterator_traits< octet_iterator >::difference_type distance(octet_iterator first, octet_iterator last)
Definition: checked.h:198

◆ drawLine()

void PhysicsDebugDrawer::drawLine ( const btVector3 &  from,
const btVector3 &  to,
const btVector3 &  color 
)
override

Definition at line 14 of file PhysicsDebugDrawer.cpp.

16 {
17  bs::DebugDraw::instance().setColor(Float4(color, 1.f));
18  bs::DebugDraw::instance().drawLine(Float3(from), Float3(to));
19 }

◆ drawSphere()

void PhysicsDebugDrawer::drawSphere ( const btVector3 &  p,
btScalar  radius,
const btVector3 &  color 
)
override

Definition at line 21 of file PhysicsDebugDrawer.cpp.

23 {
24  bs::DebugDraw::instance().setColor(Float4(color, 1.f));
25  bs::DebugDraw::instance().drawWireSphere(Float3(p), radius);
26 }

◆ getDebugMode()

int Leviathan::PhysicsDebugDrawer::getDebugMode ( ) const
inlineoverride

Definition at line 33 of file PhysicsDebugDrawer.h.

34  {
35  return DebugMode;
36  }

◆ OnBeginDraw()

DLLEXPORT void PhysicsDebugDrawer::OnBeginDraw ( )

Definition at line 43 of file PhysicsDebugDrawer.cpp.

44 {
45  bs::DebugDraw::instance().clear();
46 }

◆ reportErrorWarning()

void PhysicsDebugDrawer::reportErrorWarning ( const char *  warningString)
override

Definition at line 38 of file PhysicsDebugDrawer.cpp.

39 {
40  LOG_WARNING("[PHYSICS DEBUG] " + std::string(warningString));
41 }
#define LOG_WARNING(x)
Definition: Define.h:91

◆ setDebugMode()

void Leviathan::PhysicsDebugDrawer::setDebugMode ( int  mode)
inlineoverride

Definition at line 28 of file PhysicsDebugDrawer.h.

29  {
30  DebugMode = mode;
31  }

Member Data Documentation

◆ DebugMode

int Leviathan::PhysicsDebugDrawer::DebugMode = btIDebugDraw::DBG_DrawWireframe
protected

Definition at line 41 of file PhysicsDebugDrawer.h.


The documentation for this class was generated from the following files: