Re: [Plib-users] ssgTransform absolut position
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2004-02-13 07:28:50
|
neu...@su... wrote: > I have a tree of objects in my scene. I want the absolut position of the > Object x in the three in world coordinates. > > Can I use the > > void getTransform ( sgMat4 xform ) > > function ?? No - it doesn't give you the absolute position - only the position relative to it's parent object. In fact, you cannot ever know the absolute position of an object in SSG because objects are allowed to have multiple parents. If you imagine a game where there is a forest containing a hundred thousand trees, each with several levels of detail - you wouldn't want 100,000 copies of that complicated structure in memory. However, you could build a set of branch nodes that point to a small number of unique tree models. That way, 100,000 pointers to 10 tree models would create your forest in a very reasonable amount of memory. However, each tree model would appear in the scene ten thousand times - each at a different 3D position. To ask one of those tree models "Where are you?" is ridiculous because that model appears in 10,000 different places in the 3D world. This process is called 'instancing' and it's very common in 3D graphics. If you know your object is in a unique location, you can walk the scene graph upwards from the object to the top of the tree using "getParent" and concatenating all of the transforms along the way yourself. ---------------------------- 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----- |