Re: [osg-users] where can i find the vertex positions?

2009-03-18 Thread Christian Sam
hi,

thanks for the hints, after searching for some of the terms i stumbled over 
"http://www.openscenegraph.org/projects/osg/wiki/Support/ProgrammingGuide/AnalysingAScenegraph";
 which proved very helpful. (maybe someone references it in the tutorial 
section)

best regards,
christian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8736#8736





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] where can i find the vertex positions?

2009-03-18 Thread Peter Amstutz
If you're just interested in the vertices and not the mesh, you can look 
at osg::Geode, get the list of osg::Drawables, cast to osg::Geometry, 
then call osg::Geometry::getVertexArray().


Or you can use osg::TriangleFunctor to iterate over the triangles that 
make up the mesh, this provides you with osg::Vec3 triples representing 
each triangle.


There are likely other ways to get at this data as well, it depends on 
what you want to do with it.


Christian Sam wrote:

Hi,

i' m looking for a way to get the vertex positions of my geometry. i know there 
are methods, provided by osg, to access these vertex positions, but i wanted to 
get some insight how they are handled by osg, so i debugged a simple scene.

i found the "geometry" object along with the "_primitives" data member, referencing my 5 "DrawArrays" with the correct indexes. the debugger also showed me a "_vertexData" member, but i couldn't find any reference to the actual vertex positions. 


(i set my breakpoint in "viewerbase.cpp" in the ViewerBase::frame() at the 
eventTraversal() function.)
here is my .osg scene file:

Code:

LOD {
  nodeMask 0x
  cullingActive TRUE
  Radius -1
  RangeMode DISTANCE_FROM_EYE_POINT
  RangeList 1 {
0 1e+010
  }
  num_children 1
  Group {
nodeMask 0x
cullingActive TRUE
num_children 1
MatrixTransform {
  nodeMask 0x
  cullingActive TRUE
  StateSet {
DataVariance STATIC
rendering_hint DEFAULT_BIN
renderBinMode INHERIT
GL_CULL_FACE ON
GL_LIGHTING OFF
CullFace {
  mode BACK
}
  }
  referenceFrame RELATIVE
  Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
682985 5.21326e+006 0 1
  }
  num_children 1
  Geode {
nodeMask 0x
cullingActive TRUE
num_drawables 1
Geometry {
  PrimitiveSets 5
  {
DrawArrays LINE_STRIP 0 5
DrawArrays LINE_STRIP 5 5
DrawArrays LINE_STRIP 10 5
DrawArrays LINE_STRIP 15 5
DrawArrays LINE_STRIP 20 5
  }
  VertexArray Vec3Array 25
  {
218.39 263.092 0
   ...
-19.3272 -195.515 0
  }
  ColorBinding PER_VERTEX
  ColorArray Vec4Array 25
  {
0.001251 0.563585 0.193304 1
...
0.808741 0.585009 0.479873 1
  }
}
  }
}
  }
}




* where can i find them?

* and whats the prefered way to access them finally in my application? 
i think it can be done both with a visitor (osg::Drawable::AttributeFunctor::apply() like in the osgprerender example), and with a getChild().getVertexArray()


Thanks in advance,
christian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8702#8702





___
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


[osg-users] where can i find the vertex positions?

2009-03-18 Thread Christian Sam
Hi,

i' m looking for a way to get the vertex positions of my geometry. i know there 
are methods, provided by osg, to access these vertex positions, but i wanted to 
get some insight how they are handled by osg, so i debugged a simple scene.

i found the "geometry" object along with the "_primitives" data member, 
referencing my 5 "DrawArrays" with the correct indexes. the debugger also 
showed me a "_vertexData" member, but i couldn't find any reference to the 
actual vertex positions. 

(i set my breakpoint in "viewerbase.cpp" in the ViewerBase::frame() at the 
eventTraversal() function.)
here is my .osg scene file:

Code:

LOD {
  nodeMask 0x
  cullingActive TRUE
  Radius -1
  RangeMode DISTANCE_FROM_EYE_POINT
  RangeList 1 {
0 1e+010
  }
  num_children 1
  Group {
nodeMask 0x
cullingActive TRUE
num_children 1
MatrixTransform {
  nodeMask 0x
  cullingActive TRUE
  StateSet {
DataVariance STATIC
rendering_hint DEFAULT_BIN
renderBinMode INHERIT
GL_CULL_FACE ON
GL_LIGHTING OFF
CullFace {
  mode BACK
}
  }
  referenceFrame RELATIVE
  Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
682985 5.21326e+006 0 1
  }
  num_children 1
  Geode {
nodeMask 0x
cullingActive TRUE
num_drawables 1
Geometry {
  PrimitiveSets 5
  {
DrawArrays LINE_STRIP 0 5
DrawArrays LINE_STRIP 5 5
DrawArrays LINE_STRIP 10 5
DrawArrays LINE_STRIP 15 5
DrawArrays LINE_STRIP 20 5
  }
  VertexArray Vec3Array 25
  {
218.39 263.092 0
   ...
-19.3272 -195.515 0
  }
  ColorBinding PER_VERTEX
  ColorArray Vec4Array 25
  {
0.001251 0.563585 0.193304 1
...
0.808741 0.585009 0.479873 1
  }
}
  }
}
  }
}




* where can i find them?

* and whats the prefered way to access them finally in my application? 
i think it can be done both with a visitor 
(osg::Drawable::AttributeFunctor::apply() like in the osgprerender example), 
and with a getChild().getVertexArray()

Thanks in advance,
christian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8702#8702





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org