Hi Sebastian,
On 1/07/10 1:18 , Sebastian Messerschmidt wrote:
>> I would suggest reading up on previous discussions about UserData
>> class that supports various generic attribute representation. It does
>> seem like there would be a big overlap with what you are after. What
>> a callback is the right way to interface this type of functionality or
>> not is something I can't really say too much on with spending more
>> time on the topic. Right now I'm focused on other complex work so
>> don't have spare brain cycles to dedicate to other ancillary issues,
>> so I'll leave it to yourself and others to hash out a viable way
>> forward.
>
> Thank you anyways for giving me an appropriate pointer the UserData class.
> I'll will dig
> deeper into it.
> Comments from other people are welcome.
I was doing some work on something similar a while ago to associating
loader-specific data
with the loaded object (in my case meta-data with an osg::Image). Alas, the
requirement
is currently on the back-burner so I haven't pursued this further.
My approach was to add a ref_ptr<PropertyMap> to osg::Object.
PropertyMap is a map of strings to ref_ptr objects.
A templated helper class 'Property' allows type-safe storage of data in this
map.
Both osg::Object userdata and osg::Node descriptions are stored using this
scheme.
The memory footprint for osg::Object stays the same ('ref_ptr<Referenced>
_userData' is
replaced with 'ref_ptr<PropertyMap> _properties') and the footprint for
osg::Node is
reduced by losing std::vector<string>.
API backwards compatibility is maintained through appropriate getters/setters.
The code is still compiling but isn't terribly well exercised or tested. I can
post a
copy if you're interested.
Cheers,
/ulrich
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org