From 7028cbe09c688437910a25623098762bf0fa592d Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 28 Mar 2016 22:28:34 +1000 Subject: Move Irrlicht to src/others. --- .../examples/03.CustomSceneNode/tutorial.html | 222 +++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 src/others/irrlicht-1.8.1/examples/03.CustomSceneNode/tutorial.html (limited to 'src/others/irrlicht-1.8.1/examples/03.CustomSceneNode/tutorial.html') diff --git a/src/others/irrlicht-1.8.1/examples/03.CustomSceneNode/tutorial.html b/src/others/irrlicht-1.8.1/examples/03.CustomSceneNode/tutorial.html new file mode 100644 index 0000000..becc3d7 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/03.CustomSceneNode/tutorial.html @@ -0,0 +1,222 @@ + +
+
+ Lets start! |
+ ||||||||||||
+
+ To start, I include the header files, use the irr namespace, and tell + the linker to link with the .lib file. +
Here comes the most sophisticated part of this tutorial: The class
+ of our very own custom scene node. To keep it simple, To let our scene node be able to be inserted into the Irrlicht Engine + scene, the class we create needs only be derived from the ISceneNode + class and has to override some methods. +
First, we declare some member variables, to hold data for our tetraeder:
+ The bounding box, 4 vertices, and
The parameters of the constructor specify the parent of the scene node, + a pointer to the scene manager, and an id of the scene node. In the + constructor itself, we call the parent classes constructor, set some + properties of the material we use to draw the scene node and create + the 4 vertices of the tetraeder we will draw later. +
+ The Irrlicht Engine needs to know the bounding box of your scene node. + It will use it for doing automatic culling and other things. Hence we + need to create a bounding box from the 4 vertices we use. If you do not + want the engine to use the box for automatic culling, and/or don't want + to create the box, you could also write + AutomaticCullingEnabled = false;. + +
+ Before it is drawn, the OnPreRender() method of every scene node in
+ the scene is called by the scene manager. If the scene node wishes to
+ draw itself, it may register itself in the scene manager to be drawn.
+ This is necessary to tell the scene manager when it should call the
+ ::render method. For example normal scene nodes render their content
+ one after another, while stencil buffer shadows would like to be drawn
+ after all other scene nodes. And camera or light scene nodes need to
+ be rendered before all other scene nodes (if at all).
In the render() method most of the interresting stuff happenes: The Scene + node renders itself. We override this method and draw the tetraeder. +
At least, we create three small additional methods. GetBoundingBox()
+ returns the bounding box of this scene node,
That's it. The Scene node is done. Now we simply have to start the engine, + create the scene node and a camera, and look at the result. +
Create our scene node. Note that it is dropped (->drop()) instantly + after we create it. This is possible because the scene manager now takes + care of it. This is not nessecary, it would also be possible to drop it + at the end of the program. +
To animate something in this boring scene consisting only of one tetraeder, + and to show, that you now can use your scene node like any other scene + node in the engine, we add an animator to the scene node, which rotates + the node a little bit. +
Now draw everything and finish. +
That's it. Compile and play around with the program. |
+
+ + -- cgit v1.1