Re: [osg-users] Extending Node or a Nodekit ?
Hello, I have a similar problem, only a bit more generic. I would like to extend a node with additional information stored in a hash map. I assume that I would have to write a nodekit to do this. Is that right or is there an easier way to extend nodes? From the quick reference guide I found out that I need to extend the node and write an exporter for the osg format. Is there a small example/tutorial that I could use as a basis? I couldn't find anything. -- Nico Kruithof On Tue, Apr 7, 2009 at 10:16 PM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: Hi Martin, So I can add any arbitrary arrays to _vertexAttribList without affecting the drawables? Yep, and it's even saved in the .osg file :-) See OpenSceneGraph-Data/glsl_confetti.osg for example, search for Attrib. J-S -- __ Jean-Sebastien Guay jean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Extending Node or a Nodekit ?
Martin Beckett wrote: I need the geometry node to contain some extra meta data and an extra value for each vertex (a quality filed) there is no change to how the Node is drawn. I'm looking for the best way to do this: 1, Patch the source - probably a bad idea! 2, Store the data separately with a pointer to the Geometry node. 3, Derive from Geometry, since OSG only uses pointers to store nodes, everything else should work (except I can't save the extra data in an osg file) 4, Write a NodeKit. Is this overkill to just store a few extra fields? I don't want to change how the Node is rendered. Are there any samples of how to write a nodekit.? Is the per-vertex data something you can fit in a float or Vec2/Vec3/Vec4? If so, how about just a generic vertex attribute? The extra meta-data can be attached using the setUserData() method (look at osg/Object). You just have to derive a class from osg::Referenced; then you can attach it to any osg::Object. --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Extending Node or a Nodekit ?
Jason Daly wrote: Is the per-vertex data something you can fit in a float or Vec2/Vec3/Vec4? If so, how about just a generic vertex attribute? So I can add any arbitrary arrays to _vertexAttribList without affecting the drawables? The extra meta-data can be attached using the setUserData() method (look at osg/Object). Thanks - I though I had seen a userdata field in the debugger but I couldn't find it in any of the Nodes - I forgot about 'Object' -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9866#9866 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Extending Node or a Nodekit ?
Hi Martin, So I can add any arbitrary arrays to _vertexAttribList without affecting the drawables? Yep, and it's even saved in the .osg file :-) See OpenSceneGraph-Data/glsl_confetti.osg for example, search for Attrib. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Extending Node or a Nodekit ?
I need the geometry node to contain some extra meta data and an extra value for each vertex (a quality filed) there is no change to how the Node is drawn. I'm looking for the best way to do this: 1, Patch the source - probably a bad idea! 2, Store the data separately with a pointer to the Geometry node. 3, Derive from Geometry, since OSG only uses pointers to store nodes, everything else should work (except I can't save the extra data in an osg file) 4, Write a NodeKit. Is this overkill to just store a few extra fields? I don't want to change how the Node is rendered. Are there any samples of how to write a nodekit.? Martin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9864#9864 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org