|
18th March 2004, 10:56 PM | #1 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
Adding lots of surfaces quickly - Importer plugin
Hi Folks,
What's the quickest way to add a lot (like 250,000 or so) surfaces to an AC3D object in an importer plugin. Currently I use something like; Code:
List *surfaces = NULL; ... Surface* s = new_surface(); // Set up surface list_add_item_head(&surfaces,s); ... object_add_surfaces(object,surfaces); Is there something like ac_object_add_vertices_from_float_array, but for surfaces that would let me pre-allocate a bunch of surfaces and add them to my object all in one hit? Cheers. |
19th March 2004, 02:59 AM | #2 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
Re: Adding lots of surfaces quickly - Importer plugin
Code:
list_add_item_head(&surfaces,s); Code:
Prototype void object_add_surfaces(ACObject *ob, List *l); It looks like you have optimal code here. Perhaps there is something else causing a slowdown? Andy |
19th March 2004, 06:00 AM | #3 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
Re: Adding lots of surfaces quickly - Importer plugin
Ah, yes. Thanks for the reply.
It was; Code:
ac_object_get_vertex_at_index If I run through and cache them all, it's much quicker. But still, is there a quicker way to get a list of all the Vertex pointers? I've created them with; Code:
ac_object_add_vertices_from_float_array |
19th March 2004, 07:40 AM | #4 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
Re: Adding lots of surfaces quickly - Importer plugin
No worries, fixed it by accessing the vertex List directly.
A 512x512 tga loaded, smoothed and 130,000 surfaces created and added in about a second. Bargain! Thanks for your help. Please ignore my stupidness! Anybody want a (very simple) heightmap importer? |
19th March 2004, 10:32 AM | #5 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
Re: Adding lots of surfaces quickly - Importer plugin
Gorgeous!
>is there a quicker way to get a list of all the Vertex pointers? You can use: Code:
Prototype ListData *list_create_array(List *l, int numitems); // free with myfree() free the block of memory with myfree(). Andy |
19th March 2004, 10:48 AM | #6 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
Re: Adding lots of surfaces quickly - Importer plugin
Hurrah! Even quicker, and even better.
Cheers. |
19th March 2004, 02:05 PM | #7 |
Senior Member
Professional user
Join Date: Nov 2003
Location: Eugene OR, USA
Posts: 212
|
Re: Adding lots of surfaces quickly - Importer plugin
wow, somone else was working on a hightmap maker also, lol
anyways, id love to have that plugin, please post a link where we can download it also, IF your plugin is 'open source' id realy like to see how you made it :wink: good job. Philip |
21st March 2004, 03:27 AM | #8 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
Re: Adding lots of surfaces quickly - Importer plugin
Well, I wouldn't say I was "working on" a heightmap importer. I just hacked one together quickly to allow me to generate a quick landscape for some vertex/fragment shader development that I'm doing.
It's available as a "bonus feature" of the Ogre mesh export plugin. I've got a bit of tidying up to do then I'll update the archive and post the URL. I'll also stick the source-code in the archive. Stay tuned! |
25th March 2004, 02:11 AM | #9 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
Re: Adding lots of surfaces quickly - Importer plugin
You can get the OGRE Plugin with bonus Height Map importer from;
http://www.green-eyed-monster.com/ The source code's available from the same place. |
|
|