For a simple first integration, you could do the following:
- Create an extension which provides a "RocketNode", e.g.
Code:
Modules::sceneMan().registerType( SNT_RocketNode, "RocketNode",
RocketNode::parsingFunc, RocketNode::factoryFunc, RocketNode::renderFunc );
Use the terrain extension as a template.
- Now decide, if you want to have several RocketNodes in your scene graph which all belong to some UI element or if you want to have only one RocketNode which renders all UI in this single call (maybe to textures/render-targets or on-screen)
- Renderer::drawRenderables will call your RocketNode::renderFunc. You then loop over the queue and fetch all RocketNode nodes and render them
- If you want to have one specific point where RocketNodes should be drawn, add a stage into your pipeline like this
Code:
<Stage id="Rocket">
<DrawGeometry context="ROCKETDRAW" class="RocketNode" />
</Stage>
and make sure that you check for the correct class "RocketNode" inside RocketNode::renderFunc. This way your nodes will be ignored during the normal opaque-stage drawing or the translucent drawing.
If you decide to have only a single "RocketNode" inside your graph then RocketNode::renderFunc could render the complete Rocket UI with SFML (make sure you push/pop render states) and would then be orthogonal to Horde's normal rendering.
We used this approach for our own debug drawing nodes (e.g. for bullet physics).
We created a DebugDraw extension, added only one real DebugDraw node to Horde's scene graph.
Then we have functions like h3dextAddDebugDrawSphere(..) or h3dextAddDebugDrawCoordSys(..) which then register themselves at the DebugDraw node as new debug element.
We also added a rather hacky h3dextAddDebugDrawCallback function where you register a custom callback inside your application.
This way we could re-use Bullet's GLShape/DebugDrawing code using normal GL calls instead of trying to fit all this into Horde's (rather static) geometry setup or mess with VBOs.