Pues, por ejemplo, en XNA podria ser:
La clase principal, Game:
public class MyGame : Microsoft.Xna.Framework.Game
{
// ...
protected override void Draw(GameTime gameTime)
{
foreach (RenderContext renderContext in renderContexts)
renderContext.Draw(gameTime);
base.Draw(gameTime);
}
// ...
}
El RenderContext:
public class RenderContext : DrawableGameComponent
{
// ...
public override void Draw(GameTime gameTime)
{
ClearBackBuffer();
// 3D Render
foreach (Camera camera in cameras)
{
ApplyCamera(camera);
BaseNode.root.Draw(gameTime); // Este es el nodo principal del scenegraph
}
// 2D Render
{
}
// Render de texto
base.Draw(gameTime);
}
// ...
}
Y por fin el render de nodo basico del scene graph
public class BaseNode : IDisposable
{
// ...
public virtual void Draw(GameTime gameTime)
{
if (visible)
{
//if culling
OnDraw(gameTime);
}
if (listChild != null)
{
for (int i = 0; i < listChild.Count; ++i)
listChild[i].Draw(gameTime);
}
}
public virtual void OnDraw(GameTime gameTime) { } // Aqui dibujan los distintos tipos de nodos
public static BaseNode root = new BaseNode(); // Este es el nodo raiz del scenegraph
// ...
}