Difference between revisions of "Procedurally generated geometry tutorial"
Line 14: | Line 14: | ||
When we have calculated the geometry itself we need to create a char-stream to make Horde believe the geometry has been read from a file and pass it to Horde as a geometry Resource. | When we have calculated the geometry itself we need to create a char-stream to make Horde believe the geometry has been read from a file and pass it to Horde as a geometry Resource. | ||
The final step is to create a Horde3D Scene Node from our procedurally generated mesh and render it into our scene. | The final step is to create a Horde3D Scene Node from our procedurally generated mesh and render it into our scene. | ||
− | [http://musicracer.de/images/musicracer_intro.jpg This is how it could look] | + | [http://musicracer.de/images/musicracer_intro.jpg |
+ | |||
+ | This is how it could look like] | ||
=StreamGenerator= | =StreamGenerator= |
Revision as of 20:22, 27 August 2009
Work in progress
Contents
Important notes
- The code used here has been tested with Horde3D 1.0.0 beta2 and beta3 and will NOT work with the latest release (beta4)
Overview
Basic approach
To create and display a procedurally generated mesh that, instead of being loaded from a Horde3D Scene node and a geoemtry file(*.scene.xml, *.geo), will be created in-memory by some algorithm, you have to create a mesh first and then "fake" the .geo-file and the scene node itself and pass it to the engine.
To do that you have to create your procedural geometry first. This is easy for simple shapes like single triangles, squares or triangle-strips, but will become way more difficult when we try to generate complex meshes, e.g. when we have a cloud of points in 3D space and have to describe which points make triangles, and which don't (calculating the triangle indices, texture coordinates and normals).
When we have calculated the geometry itself we need to create a char-stream to make Horde believe the geometry has been read from a file and pass it to Horde as a geometry Resource. The final step is to create a Horde3D Scene Node from our procedurally generated mesh and render it into our scene. [
This is how it could look like]