gerwindehaan / osgswig

Python bindings for OpenSceneGraph (auto-export from code.google.com/p/osgswig)
Other
1 stars 1 forks source link

'accept' and 'supports' missing from osg.Geometry class #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
osgswig 0.9.1, OpenSceneGraph 2.6, Windows XP SP3.

Original issue reported on code.google.com by rfritz...@gmail.com on 4 Mar 2009 at 6:52

GoogleCodeExporter commented 9 years ago
From the osg/Geometry and osg/Drawable header files it becomes clear that 
'accept'
and 'supports' want some 'AttributeFunctor' as input. The 'AttributeFunctor' 
class is
defined as a nested class inside osg::Drawable, and unfortunately we currently 
have
no automated way to wrap these without manual intevention. 

For the list of nested classes, see for example:
http://code.google.com/p/osgswig/wiki/NestedClassesOsg

Could you add or indicate a minimal python/c++ example where it's use becomes 
clear?

I can check if I can manually add these in a nice way.

Original comment by gerwinde...@gmail.com on 5 Mar 2009 at 7:29

GoogleCodeExporter commented 9 years ago
I'm actually more interested in accept(PrimitiveFunctor).  It's one way to 
traverse
the node tree.  Since the functionality doesn't exist in Python, I don't have 
Python
example code.  Osfield talks about it some and cites examples at
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2009-Marc
h/024511.html.
 My understanding of the functionality is that I would write something like:

  class DrawableToRad(TriangleFunctor):
    def __init__(self,file):
      self.file = file
    def setVertexArray(self,n,vec):
      ...
    def drawArrays(self,mode,first,count):
      "Draw an array to file"
      ...

I initialize the functor, for instance:
  wtrifunc = DrawableToRad(file)
Then, for each Drawable drw in a scene graph, I write:
  drw.accept(wtrifunct)
(Probably this is done with a NodeVisitor)
At the end of this process, file will contain a Radiance version of the scene 
graph.

Original comment by rfritz...@gmail.com on 8 Mar 2009 at 10:59