Thread: [Plib-users] STATES
Brought to you by:
sjbaker
From: <m_p...@ya...> - 2004-07-14 19:45:15
|
Hi everybody. I´ve a problem and I dont know how to resolve it. I don´t have a lot of experience with PLIB and I thought that maybe someone had this problem before. So, in order to add a ssgLeaf to the tree of a Scene I make a ssgVtxTable *dtl; Then I load on it an ac file with the function grssgLoadAC3D(const char *filename, const ssgLoaderOptions *options). Till there is everything ok. I can load the ac file in my scene whith out problem, but if I want to acces to the state of the dtl (It doesn´t mind if I use dtl->getState() or dtl->setState(ssgState*)) my program breaks. My code is something like that: char *acname; ssgVtxTable *dtl= new ssgVtxTable; void *hndl = grTrackHandle; dtl= (ssgVtxTable *)grssgLoadAC3D(acname, NULL); /* in acname is the path of the ac file*/ dtl->setState(.....); It compiles and the program runs but it crashes. thank you --------------------------------- [input] [input] [input] |
From: Steve B. <sjb...@ai...> - 2004-07-15 00:14:46
|
Manuel Pecero Rodr=EDguez wrote: > So, in order to add a ssgLeaf to the tree of a Scene I make a=20 > ssgVtxTable *dtl; Then I load on it an ac file with the function=20 > grssgLoadAC3D(const char *filename, const ssgLoaderOptions *options). No, no, no! You need something like: ssgEntity *br =3D ssgLoad ( filename, options ) ) ; if ( br =3D=3D NULL ) /* some kind of error message */ ; scene -> addKid ( br ) ; Where: 'scene' is some kind of ssgBranch node - maybe the ssgRoot at the top of your tree. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++= -----END GEEK CODE BLOCK----- |
From: <m_p...@ya...> - 2004-07-15 14:40:08
|
Ok, but I need to change the state (I need an state selector for this object) and if I make it with an ssgEntity * I cannot do it becouse with the ssgEntity class you cannot acces to the ssgLeaf states without a casting. isn´t it? Thank you. Steve Baker <sjb...@ai...> wrote: Manuel Pecero Rodríguez wrote: > So, in order to add a ssgLeaf to the tree of a Scene I make a > ssgVtxTable *dtl; Then I load on it an ac file with the function > grssgLoadAC3D(const char *filename, const ssgLoaderOptions *options). No, no, no! You need something like: ssgEntity *br = ssgLoad ( filename, options ) ) ; if ( br == NULL ) /* some kind of error message */ ; scene -> addKid ( br ) ; Where: 'scene' is some kind of ssgBranch node - maybe the ssgRoot at the top of your tree. ---------------------------- Steve Baker ------------------------- HomeEmail: WorkEmail: HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_idG21&alloc_id040&op=click _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users --------------------------------- [input] [input] [input] |
From: Steve B. <sjb...@ai...> - 2004-07-16 09:20:16
|
Manuel Pecero Rodr=EDguez wrote: > Ok, but I need to change the state (I need an state selector for this=20 > object) and if I make it with an ssgEntity * I cannot do it becouse wit= h=20 > the ssgEntity class you cannot acces to the ssgLeaf states without a=20 > casting. isn=B4t it? Ah! OK - I see the cause of your confusion. The ssgLoad function(s) don't generate a single leaf node - they generate= an entire sub-tree of branch nodes with numerous leaf nodes under them. In order to change the states of ALL of those leaf nodes you have to do one of two things. EITHER: 1) After you load the model, traverse the tree structure by testing each node to see whether it's a leaf or a branch (use 'isAKindOf()) If it's a leaf, change it's state. If it's a branch use getNumKids()= and getKid(n) to find all of it's child nodes - and call the tree tra= verser recursively for each of them. 2) You can use a callback function (it's provided in the ssgLoaderOptions= ) that calls your code as the model is being loaded in order that you c= an allocate your own ssgSimpleState nodes instead of the loader doing it= for you. Which of these things to do depends on the context and what other things you may need to change in the model that was loaded. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++= -----END GEEK CODE BLOCK----- |