|
![]() |
#1 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
![]()
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. |
![]() |
![]() |
![]() |
#2 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,541
|
![]() 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 |
![]() |
![]() |
![]() |
#3 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
![]()
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 |
![]() |
![]() |
![]() |
#4 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
![]()
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? ![]() |
![]() |
![]() |
![]() |
#5 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,541
|
![]()
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 |
![]() |
![]() |
![]() |
#6 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
![]()
Hurrah! Even quicker, and even better.
Cheers. |
![]() |
![]() |
![]() |
#7 |
Senior Member
Professional user
Join Date: Nov 2003
Location: Eugene OR, USA
Posts: 212
|
![]()
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 |
![]() |
![]() |
![]() |
#8 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
![]()
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! |
![]() |
![]() |
![]() |
#9 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
![]()
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. |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|