Horde3D
http://horde3d.org/forums/

Procedurally generated geometry
http://horde3d.org/forums/viewtopic.php?f=1&t=11
Page 1 of 1

Author:  DarkAngel [ 13.11.2006, 09:27 ]
Post subject:  Procedurally generated geometry

Some of my geometry is generated by code (a terrain mesh from a heightmap), not loaded from models. At the moment I dont think there is a way for me to put this geometry into a node.
I was thinking there could be another function simmilar to setNodeParam that could take a pointer, this way I could pass in a list of vertecies.

E.g. I want to do something like this:
Code:
bool setNodeParamArray( unsigned int id, SceneNodeParam param, void* value, int size );
....

//This class loads an image and generates geometry from the height values:
CHeightmap terrain( 'heightmap.jpg' );
float* pVerts = terrain.getVertecies();
int numVerts = terrain.getNumVertecies();
unsigned int* pIndicies= terrain.getIndicies();
int numIndicies  = terrain.getNumIndicies();

//Send the geometry to the engine:
setNodeStruct( node_id, SceneNodeParams::Vertecies, (void*)pVerts, numVerts  );
setNodeStruct( node_id, SceneNodeParams::Indicies, (void*)pIndicies, numIndicies  );


What do you think of something like this? I think its a good idea to allow the program that uses the engine to upload its own vertex data.

Author:  marciano [ 13.11.2006, 13:17 ]
Post subject: 

I was thinking about procedural geometry some time ago. Your proposal would be a possibility but maybe I have another solution.

I had the idea of creating a new utility function (Horde3DUtils!) to do that job. The file format for the geometry is actually pretty simple, all in all nothing more than the arrays of vertices and indices (and some joints that you can ignore if you don't need them). So why don't we make a new utility function that creates an in-memory geometry file? We can treat this memory block then as any other usual geometry file and send it to the engine using addResource. It would automatically go through the complete loading pipeline (some preprocessing and upload to GPU) without any modifications to the engine.
How do you like that idea?

Author:  DarkAngel [ 14.11.2006, 00:12 ]
Post subject: 

That is a very good idea. This way the API does not become cluttered :D


I will have a try at doing this at let you know how I go.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/