Using the system from code can be as simple as this:
//Create the renderer. Can be
GDI or Direct3D (later possibly OpenGL).
//(Only Direct3D supports GPU
shaders)
Endogine.StageBase renderer = Endogine.StageBase.CreateRenderer("Direct3D",
this.panel3D, System.IO.Directory.GetCurrentDirectory() + "\\");
//Create a OBB Graph, and provide
it with the renderer:
graph =
new Graph(renderer);
//Create boxes. First a Box that
just creates a 200*200 bitmap:
graph.Add(new EmptyBitmap(200, 200, 3, false));
//Then add a Noise Box. AddAndAutoConnect()
tries to connect the new box to the existing graph.
graph.AddAndAutoConnect(new
Noise());
//Add NormalMap and Light Boxes:
graph.AddAndAutoConnect(new
NormalMap());
graph.AddAndAutoConnect(new
Light());
//Tell the graph to analyze its
contents, to find Start and End Boxes, possible recursions etc:
graph.Analyze();
//Optional: Create a graphical
interface for looking at the graph, and debugging.
OpenBlackBox.GUI.WinForms.GuiGraph gui =
new OpenBlackBox.GUI.WinForms.GuiGraph();
//Tell the GUI where to render
its contents:
gui.ParentControl =
this.panel1;
//And connect the Graph to it:
gui.OBBGraph = graph;
//Execute the whole Graph immediately:
graph.Run();
This code corresponds to the screenshots of Noise/NormalMap/Light in the gallery.