Hi Émeric, How to manage doubles in source data will depend on what type of data you have and how to want to use it in your application. It's potentially a very open ended topic so one can't really give simple answers, as their will be a different answer to each type of domain you are working within.
For instance for GIS whole world databases the usual way to manage things is to load the data in doubles then transform to a local origin and reduce any vertex data from doubles to floats in the process and store this data in straight osg::Vec3Array in an osg::Geometry. You then place the object in the correct world space by decorating the subgraph with a Transform (typically a MatrixTransform) that places the local origin in it's correct world position and orientation. If you look at osgEarth and VirtualPlanetBuilder this is how they manage whole earth databases, maintaining floats where OpenGL hardware requires it, but using double MatrixTransforms and the use of double ModelView Matrices in the OSG cull traversal that ensures maintenance of precision as long as possible before one finally has to copy the data to OpenGL. Robert. Robert. On 30 October 2014 15:52, Émeric MASCHINO <[email protected]> wrote: > Hi, > > I have to deal with double precision data files. > > By contrast to what's stated in [1], it seems to me that osg::Geometry > can be passed double precision vertex data. At least in OSG 3.2.1 that > may have fixed things since then. Allright. Great. But e.g. > osgUtil::SmoothingVisitor fails to compute the normals of such vertex > data, as osgUtil/SmoothingVisitor.cpp explicitely dynamic_casts vertex > data as osg::Vec3Array*, probably because a TriangleFunctor (that > doesn't seem to support anything else than osg::Vec3Array) is > required. > > Now, reading in [2], [3] and the DAE/FBX readers source code, it > appears that handling double precision data is a reality. At least for > serialization. But what I'm missing is how to render them actually? I > don't understand how the conversion from double to simple precision > data is done for rendering. I don't seem to find any > duplicated-with-different-precision-vertex-data in the DAE/FBX > readers. BTW, [3] also mentions the newly (at the time) introduced > osgDB::Options::PrecisionHint thing that is only used by the DAE/FBX > to decide whether serialize the vertex data in osg::Vec3Array or > osg::Vec3dArray. But nothing about rendering. > > I was thus wondering of maintaining my double precision vertex data as > node's meta-data. So I read the brilliant discussion and PDF file [4] > that seems to have led to the introduction of the UserDataContainer in > core OSG. But here again, I'm coming short of determining if that's > the right way to do so, as this API is only used to serialize > presentation settings by the Present3D plugin. And while I'm thinking > at "externalizing" my double precision data as meta-data (hence > duplicating them with simple precision data for rendering), why not > pass them as a separate object as plugin data? But here too, the > examples using the {set|get}PluginData API are scarce: namely the DAE > (once again) and FFmpeg plugins. > > In short: > - how do you deal with double precision data? > - how do you deal with any non-standard data (well, not related to > geometry data)? How do you decide whether to use UserDataContainer to > store them as meta-data in nodes or as plugin data? > > Thanks gurus, > > Émeric > > > [1] > http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2007-August/133876.html > [2] > http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2011-October/187722.html > [3] > http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2010-April/173920.html > [4] > http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2011-April/183451.html > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

