Horde3D

Next-Generation Graphics Engine
It is currently 28.04.2024, 16:38

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 13.11.2006, 09:27 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 13.11.2006, 13:17 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 14.11.2006, 00:12 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group