www.quadsoftware.com
FAQ  FAQ   Search  Search   Memberlist  Memberlist   Usergroups  Usergroups
Register  ::  Log in Log in to check your private messages


Post new topic  Reply to topic
 SurfaceInstance doesn't have a SurfaceTemplate « View previous topic :: View next topic » 
Author Message
DeanoC
PostPosted: Thu Nov 08, 2007 4:21 pm    Post subject: SurfaceInstance doesn't have a SurfaceTemplate Reply with quote



Joined: 04 Nov 2007
Posts: 5

I've got a SurfaceInstance from a terrain zone thats returning null for its SurfaceTemplate, is that a legal situation or a bug?

Its not very intuitive that an instance can not have a template. The documentation say "An instance is a space localization (via a matrix) to a surface template", which to me implies that an instance can't exist without a template.

As I was hoping to grab the vertex and index data from the template, but if it doesn't have one i'll have to compute from the heightfield data directly, which seems more error prone...

Thanks,
Deano
Back to top
View user's profile Send private message
DeanoC
PostPosted: Thu Nov 08, 2007 5:06 pm    Post subject: Reply with quote



Joined: 04 Nov 2007
Posts: 5

Some additional info

Code:
csdk::iGeomEntityInstance* geom = terrain_zone->GetGeomEntityInstance();
csdk::t_readonly_array<csdk::iSurfaceInstance*>* surfaces = geom->GetSurfaces();
for( uint surfNo = 0;surfNo < surfaces->No();++surfNo )
{
    csdk::iSurfaceInstance* surface = surfaces->Elem(surfNo);
    csdk::iSurfaceTemplate* templat = surface->GetTemplate();


templat == 0

However using code from ExpOSG
Code:

iGeomEntityTemplate *geom_templ = terrain_zone->GetGeomEntityTemplate();
if(geom_templ)
{
   t_readonly_array<iSurfaceTemplate*>* surfaces = geom_templ->GetSurfaces();
   for( uint surfNo = 0;surfNo < surfaces->No();++surfNo )
   {
      csdk::iSurfaceTemplate* templat = surfaces->Elem(surfNo);

templat = valid interface;
Works, which to my eye looks like a bug, they should be both equivilent i think?

Anyway I have a working solution, so i'm happy Smile

Thanks,
Deano
Back to top
View user's profile Send private message
ALicu
PostPosted: Fri Nov 09, 2007 9:01 am    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1326

Yes, it is a confirmed bug. Thank you for the report. The issue is fixed and it will be present in the next patch.

Also to be noted that two method may return two different interface pointers as csdk::iSurfaceTemplate* (even though internally they refer to the same data). So you must not check the pointers for equality (even though I don't know why you would do that) to see if they refer to the same data. Usually the SDK is reusing the interfaces so they have the same pointers, but in this case temporary interfaces are allocated.

Best Regards,
Adrian L.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

Jump to:  



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 vote in polls in this forum


Based on a template by Dustin Baccetti
Powered by phpBB © 2001, 2005 phpBB Group