In my Game, a Scene is composed by several layers. Each layer has different camera transformations.
This way I can have a layer at z=3 (GUI), z=2 (Monsters), z=1 (scrolling background), and this 3 layers compose my whole Scene.
My render loop looks something like:
renderLayer() applyTransformations() renderVisibleEntities() renderChildLayers() end
If I call
DrawDebugData() in the render loop, the whole b2world debug data will be rendered once for each layer in my scene, this generates a mess, because the "debug boxes" get duplicated, some of them get the camera transformations applied and some of them don't, etc.
What I would like to do, would be to make DrawDebugData to draw only certain debug boxes. In that way, I could call something like
and call that on each layer like :
renderLayer() applyTransformations() renderVisibleEntities() //Only render my corresponding layer debug data b2world->DrawDebugDataForLayer(layer_id) renderChildLayers() end
Is there a way to subclass
b2World so I could add this functionality ( specific to my game ) ?
If not, what would be the best way to achieve this (Cocos2d uses a similar scene graph approach and box2d, but I'm not sure if debugDraw works in Cocos2d... )