Thread: [Plib-users] Identifying objects after loading an AC3D- modell
Brought to you by:
sjbaker
From: Michael W. <mic...@ti...> - 2004-03-18 18:36:49
|
Hi all, I am building my modells with AC3D. How can I identify in my c-code = different objects of an AC3D-modell after loading it with ssgLoadAC ? Best regards Michael |
From: Steve B. <sjb...@ai...> - 2004-03-18 20:17:56
|
Michael Wessels wrote: > Hi all, > I am building my modells with AC3D. How can I identify in my c-code different objects of an AC3D-modell after loading it with ssgLoadAC ? I attach a comment to the model in AC3D. You can tell the PLIB loaders to call a callback function in the application when they find a comment field. They then hand you the responsibility of allocating that node in the scene graph - so you can make it be a ssgTransform node instead of a regular ssgBranch. In order to avoid actual comments in the '.ac' file triggering this, I put an unusual/distinctive character or string at the beginning of the comment. Beware though - the AC3D modeller has a tendancy to rearrange your model tree - and in the process it tends to delete the comments. Best advice is to build the model, get it looking completely right - and only add the magic comments at the very end. ---------------------------- 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: Daniel T K. <dan...@dy...> - 2004-03-18 21:13:40
|
Is it possible to get the SelectBox to wrap around its choices? ie when it gets to the End of the list of strings to go to the beginning of the strings? I've looked through the documentation and my guess is no but I was hoping I was wrong. Danny PS Thanks for a great library! |
From: Steve B. <sjb...@ai...> - 2004-03-18 22:07:41
|
Daniel T Konkle wrote: > > Is it possible to get the SelectBox to wrap around its choices? > ie when it gets to the End of the list of strings to go to the beginning > of the strings? I've looked through the documentation and my guess is > no but I was hoping I was wrong. I don't think it does that - but it's a great idea. It's probably not hard to do. ---------------------------- 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: Daniel T K. <dan...@dy...> - 2004-03-18 22:57:11
|
At 04:06 PM 3/18/2004, you wrote: >Daniel T Konkle wrote: >>Is it possible to get the SelectBox to wrap around its choices? >>ie when it gets to the End of the list of strings to go to the beginning >>of the strings? I've looked through the documentation and my guess is no >>but I was hoping I was wrong. > >I don't think it does that - but it's a great idea. It's probably not >hard to do. I looked at the code and I'm not a good enough C++ programmer to make the change. |
From: Steve B. <sjb...@ai...> - 2004-03-19 00:09:21
|
Daniel T Konkle wrote: > At 04:06 PM 3/18/2004, you wrote: > >> Daniel T Konkle wrote: >> >>> Is it possible to get the SelectBox to wrap around its choices? >>> ie when it gets to the End of the list of strings to go to the >>> beginning of the strings? I've looked through the documentation and >>> my guess is no but I was hoping I was wrong. >> >> >> I don't think it does that - but it's a great idea. It's probably not >> hard to do. > > > I looked at the code and I'm not a good enough C++ programmer to make > the change. That's OK - maybe we could get John Fay to look into it. He has the dubious title of "Mr PUI". :-0 ---------------------------- 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: Michael W. <mic...@ti...> - 2004-03-25 20:02:29
|
Hi Steve, in my '.ac' file I have the comment field "Tribune1". How can I tell the PLIB loaders to call a callback function in the application when they find this comment field ? Can you give me a strip of code-lines ? Best regards Michael ----- Original Message ----- From: "Steve Baker" <sjb...@ai...> To: <pli...@li...> Sent: Thursday, March 18, 2004 9:16 PM Subject: Re: [Plib-users] Identifying objects after loading an AC3D- modell > Michael Wessels wrote: > > Hi all, > > I am building my modells with AC3D. How can I identify in my c-code different objects of an AC3D-modell after loading it with ssgLoadAC ? > > I attach a comment to the model in AC3D. > > You can tell the PLIB loaders to call a callback function in the application when they find a comment field. > They then hand you the responsibility of allocating that node in the scene graph - so you can make it be > a ssgTransform node instead of a regular ssgBranch. > > In order to avoid actual comments in the '.ac' file triggering this, I put an unusual/distinctive > character or string at the beginning of the comment. > > Beware though - the AC3D modeller has a tendancy to rearrange your model tree - and in the process > it tends to delete the comments. > > Best advice is to build the model, get it looking completely right - and only add the magic comments > at the very end. > > ---------------------------- 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----- > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users |
From: Steve B. <sjb...@ai...> - 2004-03-26 01:38:42
|
Michael Wessels wrote: > in my '.ac' file I have the comment field "Tribune1". How can I tell the > PLIB loaders to call a callback function in the application when they find > this comment field ? Write a function like this: ssgBranch *process_userdata ( char *data ) { if ( data == NULL || data [ 0 ] == '\0' ) return NULL ; if ( strncmp ( "Tribune1", data, strlen ( "Tribune1" ) ) == 0 ) { ssgBranch *b = new ssgBranch () ; /* ...or whatever you want this node to be */ /* whatever you need to do here */ return b ; } return NULL ; } Sometime after ssgInit() but before you load your model: ssgLoaderOptions *loader_opts = new ssgLoaderOptions () ; loader_opts -> setCreateBranchCallback ( process_userdata ) ; /* You may wish to set other loader options here */ ssgSetCurrentOptions ( loader_opts ) ; ...then just load your model in the usual way and whenever SSG needs to create a branch node, it'll call your 'process_userdata' function with the comment as the parameter. If this is a 'special' node, then you create the node and return it as the result. If it's not special then just return NULL and the loader will do something appropriate. ---------------------------- 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: Michael W. <mic...@ti...> - 2004-04-23 17:47:05
|
Dear Steve, I have implemented what you said. But when I debug the application the code never jumps in the function ssgBranch *process_userdata ( char *data ) . My ac-file looks folowing:. AC3Db MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat3" rgb 1 0 0 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat7" rgb 0.270588 0.52549 0.454902 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat9" rgb 0 0 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat13" rgb 0.533333 0.533333 0.533333 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 OBJECT world kids 2 OBJECT group name "Race-Course" loc 0.560112 0.0001 0.361112 kids 4 OBJECT poly name "poly" loc -0.240913 0 -0.282012 texture "ASSPHALT.bmp" texrep 10 10 numvert 10 -0.1712 0 -0.1475 -0.0751 0 -0.1577 0.0686 0 -0.1675 0.2239 0 -0.1789 0.3284 0 -0.1871 0.3219 0 -0.2051 0.1242 0 -0.1854 -0.0899 0 -0.1724 -0.1744 0 -0.1613 -0.1744 0 -0.1613 numsurf 10 ............... ................ I attach the .ac-file to this mail. My intention is to seperate for example the OBJECT group name "Race-Course" as a single object from the rest. What can I do ? Best regards ----- Original Message ----- From: "Steve Baker" <sjb...@ai...> To: <pli...@li...> Sent: Friday, March 26, 2004 3:35 AM Subject: Re: [Plib-users] Identifying objects after loading an AC3D- modell > Michael Wessels wrote: > > > in my '.ac' file I have the comment field "Tribune1". How can I tell the > > PLIB loaders to call a callback function in the application when they find > > this comment field ? > > Write a function like this: > > ssgBranch *process_userdata ( char *data ) > { > if ( data == NULL || data [ 0 ] == '\0' ) return NULL ; > > if ( strncmp ( "Tribune1", data, strlen ( "Tribune1" ) ) == 0 ) > { > ssgBranch *b = new ssgBranch () ; /* ...or whatever you want this node to be */ > /* whatever you need to do here */ > return b ; > } > > return NULL ; > } > > > Sometime after ssgInit() but before you load your model: > > ssgLoaderOptions *loader_opts = new ssgLoaderOptions () ; > loader_opts -> setCreateBranchCallback ( process_userdata ) ; > /* You may wish to set other loader options here */ > ssgSetCurrentOptions ( loader_opts ) ; > > ...then just load your model in the usual way and whenever SSG > needs to create a branch node, it'll call your 'process_userdata' > function with the comment as the parameter. If this is a 'special' > node, then you create the node and return it as the result. If it's > not special then just return NULL and the loader will do something > appropriate. > > ---------------------------- 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----- > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users |
From: Paolo L. <p.l...@ci...> - 2004-04-26 08:00:08
|
Michael, Is the problem setting custom properties for objects/materials? The approach based on inline comments doesn't meet my favour since a) it works only for ascii-text file (3D) formats such as AC3D, b) needs of manual editing as you update the file (risk to loose such addenda or to be enabled to do it only in its final version). I'm in favour of this alternative solution: A) manually write a simple text properties file - I use kinda .ini format: [property] Object-name Params ... [property] Material-name Params ... B) learn to parse your format, and, after having loaded the 3D data, walk the graph by first identifying nodes by name (either objects or materials, the getName() method works on both, and on non-states you have also the getByName() utility) - all 3D formats allow to identifiy objs/mats by a textual name - then setting node properties depending on the directive in the file. I use properties like envmap, mirror, no-lit (disable lighting), etc, some acting on leafs and others on states. This approach is not so heavy in the implementation, keeps 3D data and custom properties separate, and works for all 3D data formats. Greetings - Paolo > -----Messaggio originale----- > Da: pli...@li...=20 > [mailto:pli...@li...] Per conto di=20 > Michael Wessels > Inviato: venerd=EC 23 aprile 2004 18.47 > A: pli...@li... > Oggetto: Re: [Plib-users] Identifying objects after loading=20 > an AC3D- modell >=20 >=20 > Dear Steve, > I have implemented what you said. > But when I debug the application the code never jumps in the=20 > function ssgBranch *process_userdata ( char *data ) . My=20 > ac-file looks folowing:. >=20 > AC3Db > MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 =20 > spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat3" rgb 1 0=20 > 0 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 =20 > trans 0 MATERIAL "ac3dmat7" rgb 0.270588 0.52549 0.454902 =20 > amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans=20 > 0 MATERIAL "ac3dmat9" rgb 0 0 1 amb 0.2 0.2 0.2 emis 0 0 0 =20 > spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat13" rgb=20 > 0.533333 0.533333 0.533333 amb 0.2 0.2 0.2 emis 0 0 0 spec=20 > 0.5 0.5 0.5 shi 10 trans 0 OBJECT world kids 2 OBJECT group=20 > name "Race-Course" loc 0.560112 0.0001 0.361112 kids 4 OBJECT=20 > poly name "poly" loc -0.240913 0 -0.282012 texture=20 > "ASSPHALT.bmp" texrep 10 10 numvert 10 -0.1712 0 -0.1475=20 > -0.0751 0 -0.1577 0.0686 0 -0.1675 0.2239 0 -0.1789 0.3284 0=20 > -0.1871 0.3219 0 -0.2051 0.1242 0 -0.1854 -0.0899 0 -0.1724=20 > -0.1744 0 -0.1613 -0.1744 0 -0.1613 numsurf 10=20 > ............... ................ >=20 > I attach the .ac-file to this mail. > My intention is to seperate for example the >=20 > OBJECT group > name "Race-Course" >=20 > as a single object from the rest. > What can I do ? >=20 > Best regards >=20 > ----- Original Message -----=20 > From: "Steve Baker" <sjb...@ai...> > To: <pli...@li...> > Sent: Friday, March 26, 2004 3:35 AM > Subject: Re: [Plib-users] Identifying objects after loading=20 > an AC3D- modell >=20 >=20 > > Michael Wessels wrote: > > > > > in my '.ac' file I have the comment field "Tribune1". How=20 > can I tell=20 > > > the PLIB loaders to call a callback function in the=20 > application when=20 > > > they > find > > > this comment field ? > > > > Write a function like this: > > > > ssgBranch *process_userdata ( char *data ) > > { > > if ( data =3D=3D NULL || data [ 0 ] =3D=3D '\0' ) return NULL ; > > > > if ( strncmp ( "Tribune1", data, strlen ( "Tribune1" ) ) =3D=3D = 0 ) > > { > > ssgBranch *b =3D new ssgBranch () ; /* ...or whatever=20 > you want=20 > > this > node to be */ > > /* whatever you need to do here */ > > return b ; > > } > > > > return NULL ; > > } > > > > > > Sometime after ssgInit() but before you load your model: > > > > ssgLoaderOptions *loader_opts =3D new ssgLoaderOptions () ; > > loader_opts -> setCreateBranchCallback ( process_userdata ) ; > > /* You may wish to set other loader options here */ > > ssgSetCurrentOptions ( loader_opts ) ; > > > > ...then just load your model in the usual way and whenever=20 > SSG needs=20 > > to create a branch node, it'll call your 'process_userdata' > > function with the comment as the parameter. If this is a 'special' > > node, then you create the node and return it as the result.=20 > If it's=20 > > not special then just return NULL and the loader will do something=20 > > appropriate. > > > > ---------------------------- 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=20 > -----BEGIN=20 > > GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E---=20 > > W+++ N o+ K? w--- !O M- > > V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++=20 > > y++++ -----END GEEK CODE BLOCK----- > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IBM Linux Tutorials > > Free Linux tutorial presented by Daniel Robbins, President=20 > and CEO of=20 > > GenToo technologies. Learn everything from fundamentals to system=20 > >=20 > = administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > > _______________________________________________ > > plib-users mailing list > > pli...@li...=20 > > https://lists.sourceforge.net/lists/listinfo/plib-users >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at=20 > ThinkGeek For a limited time only, get FREE Ground shipping=20 > on all orders of $35 or more. Hurry up and shop folks, this=20 > offer expires April 30th!=20 > http://www.thinkgeek.com/freeshipping/?cpg=3D> 12297 >=20 > _______________________________________________ >=20 > plib-users mailing list > pli...@li...=20 > https://lists.sourceforge.net/lists/listinfo/p> lib-users >=20 |
From: Michael W. <mic...@ti...> - 2004-04-26 17:38:44
|
Hi Paolo, I understand what you mean and I agree. I have tried to walk through the tree but not successfull. Can you give me some lines of C/C++code how to do it ? Best regards Michael ----- Original Message -----=20 From: "Paolo Leoncini" <p.l...@ci...> To: <pli...@li...> Sent: Monday, April 26, 2004 9:59 AM Subject: R: [Plib-users] Identifying objects after loading an AC3D- model= l Michael, Is the problem setting custom properties for objects/materials? The approach based on inline comments doesn't meet my favour since a) it works only for ascii-text file (3D) formats such as AC3D, b) needs of manual editing as you update the file (risk to loose such addenda or to be enabled to do it only in its final version). I'm in favour of this alternative solution: A) manually write a simple text properties file - I use kinda .ini format: [property] Object-name Params ... [property] Material-name Params ... B) learn to parse your format, and, after having loaded the 3D data, walk the graph by first identifying nodes by name (either objects or materials, the getName() method works on both, and on non-states you have also the getByName() utility) - all 3D formats allow to identifiy objs/mats by a textual name - then setting node properties depending on the directive in the file. I use properties like envmap, mirror, no-lit (disable lighting), etc, some acting on leafs and others on states. This approach is not so heavy in the implementation, keeps 3D data and custom properties separate, and works for all 3D data formats. Greetings - Paolo > -----Messaggio originale----- > Da: pli...@li... > [mailto:pli...@li...] Per conto di > Michael Wessels > Inviato: venerd=EC 23 aprile 2004 18.47 > A: pli...@li... > Oggetto: Re: [Plib-users] Identifying objects after loading > an AC3D- modell > > > Dear Steve, > I have implemented what you said. > But when I debug the application the code never jumps in the > function ssgBranch *process_userdata ( char *data ) . My > ac-file looks folowing:. > > AC3Db > MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 > spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat3" rgb 1 0 > 0 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 > trans 0 MATERIAL "ac3dmat7" rgb 0.270588 0.52549 0.454902 > amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans > 0 MATERIAL "ac3dmat9" rgb 0 0 1 amb 0.2 0.2 0.2 emis 0 0 0 > spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat13" rgb > 0.533333 0.533333 0.533333 amb 0.2 0.2 0.2 emis 0 0 0 spec > 0.5 0.5 0.5 shi 10 trans 0 OBJECT world kids 2 OBJECT group > name "Race-Course" loc 0.560112 0.0001 0.361112 kids 4 OBJECT > poly name "poly" loc -0.240913 0 -0.282012 texture > "ASSPHALT.bmp" texrep 10 10 numvert 10 -0.1712 0 -0.1475 > -0.0751 0 -0.1577 0.0686 0 -0.1675 0.2239 0 -0.1789 0.3284 0 > -0.1871 0.3219 0 -0.2051 0.1242 0 -0.1854 -0.0899 0 -0.1724 > -0.1744 0 -0.1613 -0.1744 0 -0.1613 numsurf 10 > ............... ................ > > I attach the .ac-file to this mail. > My intention is to seperate for example the > > OBJECT group > name "Race-Course" > > as a single object from the rest. > What can I do ? > > Best regards > > ----- Original Message -----=20 > From: "Steve Baker" <sjb...@ai...> > To: <pli...@li...> > Sent: Friday, March 26, 2004 3:35 AM > Subject: Re: [Plib-users] Identifying objects after loading > an AC3D- modell > > > > Michael Wessels wrote: > > > > > in my '.ac' file I have the comment field "Tribune1". How > can I tell > > > the PLIB loaders to call a callback function in the > application when > > > they > find > > > this comment field ? > > > > Write a function like this: > > > > ssgBranch *process_userdata ( char *data ) > > { > > if ( data =3D=3D NULL || data [ 0 ] =3D=3D '\0' ) return NULL ; > > > > if ( strncmp ( "Tribune1", data, strlen ( "Tribune1" ) ) =3D=3D = 0 ) > > { > > ssgBranch *b =3D new ssgBranch () ; /* ...or whatever > you want > > this > node to be */ > > /* whatever you need to do here */ > > return b ; > > } > > > > return NULL ; > > } > > > > > > Sometime after ssgInit() but before you load your model: > > > > ssgLoaderOptions *loader_opts =3D new ssgLoaderOptions () ; > > loader_opts -> setCreateBranchCallback ( process_userdata ) ; > > /* You may wish to set other loader options here */ > > ssgSetCurrentOptions ( loader_opts ) ; > > > > ...then just load your model in the usual way and whenever > SSG needs > > to create a branch node, it'll call your 'process_userdata' > > function with the comment as the parameter. If this is a 'special' > > node, then you create the node and return it as the result. > If it's > > not special then just return NULL and the loader will do something > > appropriate. > > > > ---------------------------- 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---=20 > > 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: IBM Linux Tutorials > > Free Linux tutorial presented by Daniel Robbins, President > and CEO of > > GenToo technologies. Learn everything from fundamentals to system > > > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dc= lick > > _______________________________________________ > > plib-users mailing list > > pli...@li... > > https://lists.sourceforge.net/lists/listinfo/plib-users > > > > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at > ThinkGeek For a limited time only, get FREE Ground shipping > on all orders of $35 or more. Hurry up and shop folks, this > offer expires April 30th! > http://www.thinkgeek.com/freeshipping/?cpg=3D> 12297 > > _______________________________________________ > > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/p> lib-users > ------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users |
From: Paolo L. <p.l...@ci...> - 2004-04-27 07:45:09
|
Michael, You're welcome - ftp://ftp.cira.it/download/lepa069/envmap.cxx Hope everything is clear with this little comment support - this is how I manage the env mapping property into SSG and the corresponding search-then-setup functions. Greetings - Paolo > -----Messaggio originale----- > Da: pli...@li...=20 > [mailto:pli...@li...] Per conto di=20 > Michael Wessels > Inviato: luned=EC 26 aprile 2004 18.38 > A: pli...@li... > Oggetto: Re: [Plib-users] Identifying objects after loading=20 > an AC3D- modell >=20 >=20 > Hi Paolo, > I understand what you mean and I agree. I have tried to walk=20 > through the tree but not successfull. Can you give me some=20 > lines of C/C++code how to do it ? Best regards >=20 > Michael >=20 > ----- Original Message -----=20 > From: "Paolo Leoncini" <p.l...@ci...> > To: <pli...@li...> > Sent: Monday, April 26, 2004 9:59 AM > Subject: R: [Plib-users] Identifying objects after loading an=20 > AC3D- modell >=20 >=20 > Michael, >=20 > Is the problem setting custom properties for objects/materials? >=20 > The approach based on inline comments doesn't meet my favour since > a) it works only for ascii-text file (3D) formats such as AC3D, > b) needs of manual editing as you update the file (risk to=20 > loose such addenda or to be enabled to do it only in its=20 > final version). >=20 > I'm in favour of this alternative solution: >=20 > A) manually write a simple text properties file - I use kinda .ini > format: >=20 > [property] > Object-name Params > ... > [property] > Material-name Params > ... >=20 > B) learn to parse your format, and, after having loaded the=20 > 3D data, walk the graph by first identifying nodes by name=20 > (either objects or materials, the getName() method works on=20 > both, and on non-states you have also the getByName()=20 > utility) - all 3D formats allow to identifiy objs/mats by a=20 > textual name - then setting node properties depending on the=20 > directive in the file. >=20 > I use properties like envmap, mirror, no-lit (disable=20 > lighting), etc, some acting on leafs and others on states. >=20 > This approach is not so heavy in the implementation, keeps 3D=20 > data and custom properties separate, and works for all 3D=20 > data formats. >=20 > Greetings - >=20 > Paolo >=20 >=20 > > -----Messaggio originale----- > > Da: pli...@li... > > [mailto:pli...@li...] Per conto=20 > di Michael=20 > > Wessels > > Inviato: venerd=EC 23 aprile 2004 18.47 > > A: pli...@li... > > Oggetto: Re: [Plib-users] Identifying objects after loading=20 > an AC3D-=20 > > modell > > > > > > Dear Steve, > > I have implemented what you said. > > But when I debug the application the code never jumps in=20 > the function=20 > > ssgBranch *process_userdata ( char *data ) . My ac-file looks=20 > > folowing:. > > > > AC3Db > > MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5=20 > > 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat3" rgb 1 0 0 amb=20 > 0.2 0.2 0.2 =20 > > emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat7" rgb=20 > > 0.270588 0.52549 0.454902 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5=20 > > 0.5 shi 10 trans 0 MATERIAL "ac3dmat9" rgb 0 0 1 amb 0.2=20 > 0.2 0.2 =20 > > emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat13" rgb > > 0.533333 0.533333 0.533333 amb 0.2 0.2 0.2 emis 0 0 0 spec > > 0.5 0.5 0.5 shi 10 trans 0 OBJECT world kids 2 OBJECT group > > name "Race-Course" loc 0.560112 0.0001 0.361112 kids 4 OBJECT > > poly name "poly" loc -0.240913 0 -0.282012 texture > > "ASSPHALT.bmp" texrep 10 10 numvert 10 -0.1712 0 -0.1475 > > -0.0751 0 -0.1577 0.0686 0 -0.1675 0.2239 0 -0.1789 0.3284 0 > > -0.1871 0.3219 0 -0.2051 0.1242 0 -0.1854 -0.0899 0 -0.1724 > > -0.1744 0 -0.1613 -0.1744 0 -0.1613 numsurf 10 > > ............... ................ > > > > I attach the .ac-file to this mail. > > My intention is to seperate for example the > > > > OBJECT group > > name "Race-Course" > > > > as a single object from the rest. > > What can I do ? > > > > Best regards > > > > ----- Original Message ----- > > From: "Steve Baker" <sjb...@ai...> > > To: <pli...@li...> > > Sent: Friday, March 26, 2004 3:35 AM > > Subject: Re: [Plib-users] Identifying objects after loading > > an AC3D- modell > > > > > > > Michael Wessels wrote: > > > > > > > in my '.ac' file I have the comment field "Tribune1". How > > can I tell > > > > the PLIB loaders to call a callback function in the > > application when > > > > they > > find > > > > this comment field ? > > > > > > Write a function like this: > > > > > > ssgBranch *process_userdata ( char *data ) > > > { > > > if ( data =3D=3D NULL || data [ 0 ] =3D=3D '\0' ) return NULL = ; > > > > > > if ( strncmp ( "Tribune1", data, strlen ( "Tribune1"=20 > ) ) =3D=3D 0 ) > > > { > > > ssgBranch *b =3D new ssgBranch () ; /* ...or whatever > > you want > > > this > > node to be */ > > > /* whatever you need to do here */ > > > return b ; > > > } > > > > > > return NULL ; > > > } > > > > > > > > > Sometime after ssgInit() but before you load your model: > > > > > > ssgLoaderOptions *loader_opts =3D new ssgLoaderOptions () ; > > > loader_opts -> setCreateBranchCallback ( process_userdata ) ; > > > /* You may wish to set other loader options here */ > > > ssgSetCurrentOptions ( loader_opts ) ; > > > > > > ...then just load your model in the usual way and whenever > > SSG needs > > > to create a branch node, it'll call your 'process_userdata' > > > function with the comment as the parameter. If this is=20 > a 'special' > > > node, then you create the node and return it as the result. > > If it's > > > not special then just return NULL and the loader will do=20 > something=20 > > > appropriate. > > > > > > ---------------------------- 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++=20 > h--(-) r+++ > > > y++++ -----END GEEK CODE BLOCK----- > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: IBM Linux Tutorials > > > Free Linux tutorial presented by Daniel Robbins, President > > and CEO of > > > GenToo technologies. Learn everything from fundamentals to system > > > > >=20 > = administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > > > _______________________________________________ > > > plib-users mailing list > > > pli...@li...=20 > > > https://lists.sourceforge.net/lists/listinfo/plib-users > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek=20 > > For a limited time only, get FREE Ground shipping on all=20 > orders of $35=20 > > or more. Hurry up and shop folks, this offer expires April 30th! > > http://www.thinkgeek.com/freeshipping/?cpg=3D> 12297 > > > > _______________________________________________ > > > > plib-users mailing list > > pli...@li...=20 > > https://lists.sourceforge.net/lists/listinfo/p> lib-users > > >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at=20 > ThinkGeek For a limited time only, get FREE Ground shipping=20 > on all orders of $35 or more. Hurry up and shop folks, this=20 > offer expires April 30th!=20 > http://www.thinkgeek.com/freeshipping/?cpg=12297 >=20 > _______________________________________________ > plib-users mailing list > pli...@li...=20 > https://lists.sourceforge.net/lists/listinfo/p> lib-users >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at=20 > ThinkGeek For a limited time only, get FREE Ground shipping=20 > on all orders of $35 or more. Hurry up and shop folks, this=20 > offer expires April 30th!=20 > http://www.thinkgeek.com/freeshipping/?cpg=12297 >=20 > _______________________________________________ > plib-users mailing list > pli...@li...=20 > https://lists.sourceforge.net/lists/listinfo/p> lib-users >=20 |
From: Michael W. <mic...@ti...> - 2004-04-27 10:44:17
|
Hi Paolo, I will try it. Thanks Michael ----- Original Message -----=20 From: "Paolo Leoncini" <p.l...@ci...> To: <pli...@li...> Sent: Tuesday, April 27, 2004 9:44 AM Subject: R: [Plib-users] Identifying objects after loading an AC3D- model= l Michael, You're welcome - ftp://ftp.cira.it/download/lepa069/envmap.cxx Hope everything is clear with this little comment support - this is how I manage the env mapping property into SSG and the corresponding search-then-setup functions. Greetings - Paolo > -----Messaggio originale----- > Da: pli...@li... > [mailto:pli...@li...] Per conto di > Michael Wessels > Inviato: luned=EC 26 aprile 2004 18.38 > A: pli...@li... > Oggetto: Re: [Plib-users] Identifying objects after loading > an AC3D- modell > > > Hi Paolo, > I understand what you mean and I agree. I have tried to walk > through the tree but not successfull. Can you give me some > lines of C/C++code how to do it ? Best regards > > Michael > > ----- Original Message -----=20 > From: "Paolo Leoncini" <p.l...@ci...> > To: <pli...@li...> > Sent: Monday, April 26, 2004 9:59 AM > Subject: R: [Plib-users] Identifying objects after loading an > AC3D- modell > > > Michael, > > Is the problem setting custom properties for objects/materials? > > The approach based on inline comments doesn't meet my favour since > a) it works only for ascii-text file (3D) formats such as AC3D, > b) needs of manual editing as you update the file (risk to > loose such addenda or to be enabled to do it only in its > final version). > > I'm in favour of this alternative solution: > > A) manually write a simple text properties file - I use kinda .ini > format: > > [property] > Object-name Params > ... > [property] > Material-name Params > ... > > B) learn to parse your format, and, after having loaded the > 3D data, walk the graph by first identifying nodes by name > (either objects or materials, the getName() method works on > both, and on non-states you have also the getByName() > utility) - all 3D formats allow to identifiy objs/mats by a > textual name - then setting node properties depending on the > directive in the file. > > I use properties like envmap, mirror, no-lit (disable > lighting), etc, some acting on leafs and others on states. > > This approach is not so heavy in the implementation, keeps 3D > data and custom properties separate, and works for all 3D > data formats. > > Greetings - > > Paolo > > > > -----Messaggio originale----- > > Da: pli...@li... > > [mailto:pli...@li...] Per conto > di Michael > > Wessels > > Inviato: venerd=EC 23 aprile 2004 18.47 > > A: pli...@li... > > Oggetto: Re: [Plib-users] Identifying objects after loading > an AC3D- > > modell > > > > > > Dear Steve, > > I have implemented what you said. > > But when I debug the application the code never jumps in > the function > > ssgBranch *process_userdata ( char *data ) . My ac-file looks > > folowing:. > > > > AC3Db > > MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 > > 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat3" rgb 1 0 0 amb > 0.2 0.2 0.2 > > emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat7" rgb > > 0.270588 0.52549 0.454902 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 > > 0.5 shi 10 trans 0 MATERIAL "ac3dmat9" rgb 0 0 1 amb 0.2 > 0.2 0.2 > > emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat13" rgb > > 0.533333 0.533333 0.533333 amb 0.2 0.2 0.2 emis 0 0 0 spec > > 0.5 0.5 0.5 shi 10 trans 0 OBJECT world kids 2 OBJECT group > > name "Race-Course" loc 0.560112 0.0001 0.361112 kids 4 OBJECT > > poly name "poly" loc -0.240913 0 -0.282012 texture > > "ASSPHALT.bmp" texrep 10 10 numvert 10 -0.1712 0 -0.1475 > > -0.0751 0 -0.1577 0.0686 0 -0.1675 0.2239 0 -0.1789 0.3284 0 > > -0.1871 0.3219 0 -0.2051 0.1242 0 -0.1854 -0.0899 0 -0.1724 > > -0.1744 0 -0.1613 -0.1744 0 -0.1613 numsurf 10 > > ............... ................ > > > > I attach the .ac-file to this mail. > > My intention is to seperate for example the > > > > OBJECT group > > name "Race-Course" > > > > as a single object from the rest. > > What can I do ? > > > > Best regards > > > > ----- Original Message ----- > > From: "Steve Baker" <sjb...@ai...> > > To: <pli...@li...> > > Sent: Friday, March 26, 2004 3:35 AM > > Subject: Re: [Plib-users] Identifying objects after loading > > an AC3D- modell > > > > > > > Michael Wessels wrote: > > > > > > > in my '.ac' file I have the comment field "Tribune1". How > > can I tell > > > > the PLIB loaders to call a callback function in the > > application when > > > > they > > find > > > > this comment field ? > > > > > > Write a function like this: > > > > > > ssgBranch *process_userdata ( char *data ) > > > { > > > if ( data =3D=3D NULL || data [ 0 ] =3D=3D '\0' ) return NULL = ; > > > > > > if ( strncmp ( "Tribune1", data, strlen ( "Tribune1" > ) ) =3D=3D 0 ) > > > { > > > ssgBranch *b =3D new ssgBranch () ; /* ...or whatever > > you want > > > this > > node to be */ > > > /* whatever you need to do here */ > > > return b ; > > > } > > > > > > return NULL ; > > > } > > > > > > > > > Sometime after ssgInit() but before you load your model: > > > > > > ssgLoaderOptions *loader_opts =3D new ssgLoaderOptions () ; > > > loader_opts -> setCreateBranchCallback ( process_userdata ) ; > > > /* You may wish to set other loader options here */ > > > ssgSetCurrentOptions ( loader_opts ) ; > > > > > > ...then just load your model in the usual way and whenever > > SSG needs > > > to create a branch node, it'll call your 'process_userdata' > > > function with the comment as the parameter. If this is > a 'special' > > > node, then you create the node and return it as the result. > > If it's > > > not special then just return NULL and the loader will do > something > > > appropriate. > > > > > > ---------------------------- 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----- > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: IBM Linux Tutorials > > > Free Linux tutorial presented by Daniel Robbins, President > > and CEO of > > > GenToo technologies. Learn everything from fundamentals to system > > > > > > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dc= lick > > > _______________________________________________ > > > plib-users mailing list > > > pli...@li... > > > https://lists.sourceforge.net/lists/listinfo/plib-users > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek > > For a limited time only, get FREE Ground shipping on all > orders of $35 > > or more. Hurry up and shop folks, this offer expires April 30th! > > http://www.thinkgeek.com/freeshipping/?cpg=3D> 12297 > > > > _______________________________________________ > > > > plib-users mailing list > > pli...@li... > > https://lists.sourceforge.net/lists/listinfo/p> lib-users > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at > ThinkGeek For a limited time only, get FREE Ground shipping > on all orders of $35 or more. Hurry up and shop folks, this > offer expires April 30th! > http://www.thinkgeek.com/freeshipping/?cpg=12297 > > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/p> lib-users > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at > ThinkGeek For a limited time only, get FREE Ground shipping > on all orders of $35 or more. Hurry up and shop folks, this > offer expires April 30th! > http://www.thinkgeek.com/freeshipping/?cpg=12297 > > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/p> lib-users > ------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 _______________________________________________ plib-users mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-users |
From: Paolo L. <p.l...@ci...> - 2004-04-27 11:37:38
|
Michael, Should the search function not find any node could be due to the 'flatten' graph reorganization, if you apply it. Flatten eliminates unnecessary ssgTransforms (those with identity xform) - so incidentally deleting those nodes which actually hold the object name (loaders normally setName() just to ssgTransform nodes). I never went down to its source code, so it could be that ssgTransform's with a name set are 'saved' in the flatten op. Greetings - Paolo > -----Messaggio originale----- > Da: pli...@li...=20 > [mailto:pli...@li...] Per conto di=20 > Michael Wessels > Inviato: marted=EC 27 aprile 2004 11.44 > A: pli...@li... > Oggetto: Re: [Plib-users] Identifying objects after loading=20 > an AC3D- modell >=20 >=20 > Hi Paolo, > I will try it. >=20 > Thanks >=20 > Michael > ----- Original Message -----=20 > From: "Paolo Leoncini" <p.l...@ci...> > To: <pli...@li...> > Sent: Tuesday, April 27, 2004 9:44 AM > Subject: R: [Plib-users] Identifying objects after loading an=20 > AC3D- modell >=20 >=20 > Michael, >=20 > You're welcome - ftp://ftp.cira.it/download/lepa069/envmap.cxx >=20 > Hope everything is clear with this little comment support -=20 > this is how I manage the env mapping property into SSG and=20 > the corresponding search-then-setup functions. >=20 > Greetings - >=20 > Paolo >=20 >=20 > > -----Messaggio originale----- > > Da: pli...@li... > > [mailto:pli...@li...] Per conto=20 > di Michael=20 > > Wessels > > Inviato: luned=EC 26 aprile 2004 18.38 > > A: pli...@li... > > Oggetto: Re: [Plib-users] Identifying objects after loading=20 > an AC3D-=20 > > modell > > > > > > Hi Paolo, > > I understand what you mean and I agree. I have tried to=20 > walk through=20 > > the tree but not successfull. Can you give me some lines of=20 > C/C++code=20 > > how to do it ? Best regards > > > > Michael > > > > ----- Original Message ----- > > From: "Paolo Leoncini" <p.l...@ci...> > > To: <pli...@li...> > > Sent: Monday, April 26, 2004 9:59 AM > > Subject: R: [Plib-users] Identifying objects after loading an > > AC3D- modell > > > > > > Michael, > > > > Is the problem setting custom properties for objects/materials? > > > > The approach based on inline comments doesn't meet my favour since > > a) it works only for ascii-text file (3D) formats such as AC3D, > > b) needs of manual editing as you update the file (risk to=20 > loose such=20 > > addenda or to be enabled to do it only in its final version). > > > > I'm in favour of this alternative solution: > > > > A) manually write a simple text properties file - I use kinda .ini > > format: > > > > [property] > > Object-name Params > > ... > > [property] > > Material-name Params > > ... > > > > B) learn to parse your format, and, after having loaded the=20 > 3D data,=20 > > walk the graph by first identifying nodes by name (either=20 > objects or=20 > > materials, the getName() method works on both, and on=20 > non-states you=20 > > have also the getByName() > > utility) - all 3D formats allow to identifiy objs/mats by a textual=20 > > name - then setting node properties depending on the=20 > directive in the=20 > > file. > > > > I use properties like envmap, mirror, no-lit (disable=20 > lighting), etc,=20 > > some acting on leafs and others on states. > > > > This approach is not so heavy in the implementation, keeps=20 > 3D data and=20 > > custom properties separate, and works for all 3D data formats. > > > > Greetings - > > > > Paolo > > > > > > > -----Messaggio originale----- > > > Da: pli...@li... > > > [mailto:pli...@li...] Per conto > > di Michael > > > Wessels > > > Inviato: venerd=EC 23 aprile 2004 18.47 > > > A: pli...@li... > > > Oggetto: Re: [Plib-users] Identifying objects after loading > > an AC3D- > > > modell > > > > > > > > > Dear Steve, > > > I have implemented what you said. > > > But when I debug the application the code never jumps in > > the function > > > ssgBranch *process_userdata ( char *data ) . My ac-file looks=20 > > > folowing:. > > > > > > AC3Db > > > MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0=20 > 0 spec 0.5=20 > > > 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat3" rgb 1 0 0 amb > > 0.2 0.2 0.2 > > > emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL=20 > "ac3dmat7" rgb=20 > > > 0.270588 0.52549 0.454902 amb 0.2 0.2 0.2 emis 0 0 0 =20 > spec 0.5 0.5=20 > > > 0.5 shi 10 trans 0 MATERIAL "ac3dmat9" rgb 0 0 1 amb 0.2 > > 0.2 0.2 > > > emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL=20 > "ac3dmat13" rgb=20 > > > 0.533333 0.533333 0.533333 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5=20 > > > 0.5 0.5 shi 10 trans 0 OBJECT world kids 2 OBJECT group name=20 > > > "Race-Course" loc 0.560112 0.0001 0.361112 kids 4 OBJECT=20 > poly name=20 > > > "poly" loc -0.240913 0 -0.282012 texture "ASSPHALT.bmp"=20 > texrep 10 10=20 > > > numvert 10 -0.1712 0 -0.1475 -0.0751 0 -0.1577 0.0686 0 -0.1675=20 > > > 0.2239 0 -0.1789 0.3284 0 -0.1871 0.3219 0 -0.2051 0.1242=20 > 0 -0.1854=20 > > > -0.0899 0 -0.1724 -0.1744 0 -0.1613 -0.1744 0 -0.1613 numsurf 10 > > > ............... ................ > > > > > > I attach the .ac-file to this mail. > > > My intention is to seperate for example the > > > > > > OBJECT group > > > name "Race-Course" > > > > > > as a single object from the rest. > > > What can I do ? > > > > > > Best regards > > > > > > ----- Original Message ----- > > > From: "Steve Baker" <sjb...@ai...> > > > To: <pli...@li...> > > > Sent: Friday, March 26, 2004 3:35 AM > > > Subject: Re: [Plib-users] Identifying objects after=20 > loading an AC3D-=20 > > > modell > > > > > > > > > > Michael Wessels wrote: > > > > > > > > > in my '.ac' file I have the comment field "Tribune1". How > > > can I tell > > > > > the PLIB loaders to call a callback function in the > > > application when > > > > > they > > > find > > > > > this comment field ? > > > > > > > > Write a function like this: > > > > > > > > ssgBranch *process_userdata ( char *data ) > > > > { > > > > if ( data =3D=3D NULL || data [ 0 ] =3D=3D '\0' ) return = NULL ; > > > > > > > > if ( strncmp ( "Tribune1", data, strlen ( "Tribune1" > > ) ) =3D=3D 0 ) > > > > { > > > > ssgBranch *b =3D new ssgBranch () ; /* ...or whatever > > > you want > > > > this > > > node to be */ > > > > /* whatever you need to do here */ > > > > return b ; > > > > } > > > > > > > > return NULL ; > > > > } > > > > > > > > > > > > Sometime after ssgInit() but before you load your model: > > > > > > > > ssgLoaderOptions *loader_opts =3D new ssgLoaderOptions () ; > > > > loader_opts -> setCreateBranchCallback ( process_userdata ) ; > > > > /* You may wish to set other loader options here */ > > > > ssgSetCurrentOptions ( loader_opts ) ; > > > > > > > > ...then just load your model in the usual way and whenever > > > SSG needs > > > > to create a branch node, it'll call your 'process_userdata' > > > > function with the comment as the parameter. If this is > > a 'special' > > > > node, then you create the node and return it as the result. > > > If it's > > > > not special then just return NULL and the loader will do > > something > > > > appropriate. > > > > > > > > ---------------------------- Steve Baker=20 > ------------------------- > > > > HomeEmail: <sjb...@ai...> WorkEmail:=20 > <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---=20 > 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: IBM Linux Tutorials=20 > Free Linux=20 > > > > tutorial presented by Daniel Robbins, President > > > and CEO of > > > > GenToo technologies. Learn everything from fundamentals=20 > to system > > > > > > > > >=20 > = administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > > > > _______________________________________________ > > > > plib-users mailing list > > > > pli...@li...=20 > > > > https://lists.sourceforge.net/lists/listinfo/plib-users > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: The Robotic Monkeys at=20 > ThinkGeek=20 > > > For a limited time only, get FREE Ground shipping on all > > orders of $35 > > > or more. Hurry up and shop folks, this offer expires April 30th!=20 > > > http://www.thinkgeek.com/freeshipping/?cpg=3D> 12297 > > > > > > _______________________________________________ > > > > > > plib-users mailing list > > > pli...@li...=20 > > > https://lists.sourceforge.net/lists/listinfo/p> lib-users > > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek=20 > > For a limited time only, get FREE Ground shipping on all=20 > orders of $35=20 > > or more. Hurry up and shop folks, this offer expires April 30th! > > http://www.thinkgeek.com/freeshipping/?cpg=12297 > > > > _______________________________________________ > > plib-users mailing list > > pli...@li...=20 > > https://lists.sourceforge.net/lists/listinfo/p> lib-users > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek=20 > > For a limited time only, get FREE Ground shipping on all=20 > orders of $35=20 > > or more. Hurry up and shop folks, this offer expires April 30th! > > http://www.thinkgeek.com/freeshipping/?cpg=12297 > > > > _______________________________________________ > > plib-users mailing list > > pli...@li...=20 > > https://lists.sourceforge.net/lists/listinfo/p> lib-users > > >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at=20 > ThinkGeek For a limited time only, get FREE Ground shipping=20 > on all orders of $35 or more. Hurry up and shop folks, this=20 > offer expires April 30th!=20 > http://www.thinkgeek.com/freeshipping/?cpg=12297 >=20 > _______________________________________________ > plib-users mailing list > pli...@li...=20 > https://lists.sourceforge.net/lists/listinfo/p> lib-users >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at=20 > ThinkGeek For a limited time only, get FREE Ground shipping=20 > on all orders of $35 or more. Hurry up and shop folks, this=20 > offer expires April 30th!=20 > http://www.thinkgeek.com/freeshipping/?cpg=12297 >=20 > _______________________________________________ > plib-users mailing list > pli...@li...=20 > https://lists.sourceforge.net/lists/listinfo/p> lib-users >=20 |