Added a debug HUD for bullet.
Added a debug HUD for bullet.

file:a/App.cpp -> file:b/App.cpp
--- a/App.cpp
+++ b/App.cpp
@@ -222,6 +222,11 @@
 bool App::showDebug()
 { 
   return _showDebug;
+}
+
+void App::addDebugHUD(DebugHUD *hud)
+{
+  _debugHUDs.push_back(hud);
 }
 
 bool App::keyPressed(const OIS::KeyEvent &e)

file:a/App.h -> file:b/App.h
--- a/App.h
+++ b/App.h
@@ -37,6 +37,8 @@
   virtual bool initialize();
   virtual void setupScene();
 
+  void addDebugHUD(DebugHUD *hud);
+
   bool showDebug();
 
   /// OIS Inputs

--- a/BulletApp.cpp
+++ b/BulletApp.cpp
@@ -1,4 +1,6 @@
 #include "BulletApp.h"
+
+#include "DebugBullet.h"
 
 BulletApp::BulletApp()
   : App(),
@@ -50,6 +52,9 @@
   // Initialize debug drawing
   _debugDrawer=new BtOgre::DebugDrawer(sceneMngr()->getRootSceneNode(),_world);
   _world->setDebugDrawer(_debugDrawer);
+
+  addDebugHUD(new DebugBullet(_world));
+
   return true;
 }
 

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,7 @@
   BulletApp.cpp
   DebugHUD.cpp
   DebugMain.cpp
+  DebugBullet.cpp
   DotSceneLoader.cpp
   DotSceneSubloader.cpp
   DotScene.cpp
@@ -30,6 +31,7 @@
   resources.cfg
   media/debug.overlay
   media/debugmain.overlay
+  media/debugbullet.overlay
   media/fonts/DebugFont.fontdef
   media/fonts/times.ttf
   media/base/base.scene

file:b/DebugBullet.cpp (new)
--- /dev/null
+++ b/DebugBullet.cpp
@@ -1,1 +1,46 @@
+#include "DebugBullet.h"
 
+#include <OgreOverlayManager.h>
+#include <OgreOverlayContainer.h>
+#include <OgreStringConverter.h>
+
+DebugBullet::DebugBullet(btDynamicsWorld *world)
+  : DebugHUD("Bullet"),_world(world)
+{ 
+  _objectsDebug=Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Debug/Bullet/Objects");
+  _activeDebug=Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Debug/Bullet/Active");
+  _sleepingDebug=Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Debug/Bullet/Sleeping");
+
+}
+
+void DebugBullet::update()
+{
+  DebugHUD::update();
+
+  int total=_world->getNumCollisionObjects();
+  _objectsDebug->setCaption(Ogre::StringConverter::toString(total));
+
+  int active=0;
+  int sleeping=0;
+  btCollisionObjectArray objects=_world->getCollisionObjectArray();
+  for(int i=0;i<total;i++)
+    {
+      switch(objects[i]->getActivationState())
+	{
+	case ACTIVE_TAG:
+	case DISABLE_DEACTIVATION:
+	  active++;
+	  break;
+	case ISLAND_SLEEPING:
+	case WANTS_DEACTIVATION:
+	case DISABLE_SIMULATION:
+	  sleeping++;
+	  break;
+	}
+    }
+
+  _activeDebug->setCaption(Ogre::StringConverter::toString(active));
+  _sleepingDebug->setCaption(Ogre::StringConverter::toString(sleeping));
+}
+
+

file:b/DebugBullet.h (new)
--- /dev/null
+++ b/DebugBullet.h
@@ -1,1 +1,26 @@
+#ifndef DEBUGBULLET_H_
+#define DEBUGBULLET_H_
 
+#include <OgreOverlayElement.h>
+
+#include <btBulletDynamicsCommon.h>
+
+#include "DebugHUD.h"
+
+class DebugBullet : public DebugHUD
+{
+public:
+  DebugBullet(btDynamicsWorld *world);
+
+  void update();
+
+private:
+  btDynamicsWorld *_world;
+
+  Ogre::OverlayElement *_objectsDebug;
+  Ogre::OverlayElement *_activeDebug;
+  Ogre::OverlayElement *_sleepingDebug;
+};
+
+#endif // DEBUGBULLET_H_
+

--- /dev/null
+++ b/media/debugbullet.overlay
@@ -1,1 +1,64 @@
+template container Panel(Bullet)
+{
+	metrics_mode pixels
+	left 0
+	top 30
+	width 100
+	height 100
 
+	element TextArea(Bullet/ObjectsLabel) : Debug/Template/BasicText
+	{
+		left 10
+		top 10
+		width 100
+		height 10
+		caption # Objects:
+	}
+
+	element TextArea(Bullet/Objects) : Debug/Template/BasicText
+	{
+		left 75
+		top 10
+		width 100
+		height 10
+		caption 100
+	}
+
+	element TextArea(Bullet/ActiveLabel) : Debug/Template/BasicText
+	{
+		left 10
+		top 25
+		width 100
+		height 10
+		caption # Active:
+	}
+
+	element TextArea(Bullet/Active) : Debug/Template/BasicText
+	{
+		left 75
+		top 25
+		width 100
+		height 10
+		caption 100
+	}
+
+	element TextArea(Bullet/SleepingLabel) : Debug/Template/BasicText
+	{
+		left 10
+		top 40
+		width 100
+		height 10
+		caption # Sleeping:
+	}
+
+	element TextArea(Bullet/Sleeping) : Debug/Template/BasicText
+	{
+		left 75
+		top 40
+		width 100
+		height 10
+		caption 100
+	}
+
+}
+