Hi All,
I have just finished a rather intensive bout of work on the new
cleaned up osg::Geometry, one of the most challenging parts was
providing a fallback for the deprecated array indices and
BIND_PER_PRIMITIVE usage. The new osg::Geometry doesn't support
rendering of geometries with indices and BIND_PER_PRIMITIVE so one has
to convert geometries containing these over to OpenGL fast path
compliant forms using just straight vertex arrays and standard
glDrawArray/glDrawElements based primitives, and to ease this task I
have written a could of new methods to osg::Geometry:
/** Return true if the deprecated use array indicies or
BIND_PER_PRIMITIVE binding has been assigned to arrays.*/
bool containsDeprecatedData() const { return _containsDeprecatedData; }
/** fallback for deprecated functionality. Return true if the
Geometry contains any array indices or BIND_PER_PRIMITIVE arrays. */
bool checkForDeprecatedData();
/** fallback for deprecated functionality. Removes any array
indices and BIND_PER_PRIMITIVE arrays.*/
void fixDeprecatedData();
I have add a check in osg::Geode::addDrawable() to automatically calls
geometry->fixDeprecatedData() when it finds a
geometry->containsDeprecatedData() returns true. This will catch most
cases where applications are still using the deprecated functionality.
The old methods for setting the indices are still in place but guarded
by a #if defined(OSG_USE_DEPRECATED_GEOMETRY_METHODS) and currently
CMake in conjucntion with include/osg/Config sets this by default, but
you can disable this via cmake. For now the OSG itself won't build if
you do this, but once we are a bit further down the road we can make
sure that the rest of the OSG will compile with the
OSG_USE_DEPRECATED_GEOMETRY_METHODS being defined. For 3.2 my current
inclination is to leave this #define enabled by default just to allow
users to be able to compile there applications without problems.
Not all the old osg::Geometry methods exist now - for instance there
is now Geometry::ArrayData structure, just direct access to
osg::Array, for these there is no way we can fix things so that the
old code will compile and such code will have to be ported across. I
expect this will only effect a small number of users though as normal
OSG usage wouldn't require usage of ArrayData directly.
I have decided against going the GeometryDeprecated route that I was
considering at the start of this thread, I feel the above fallback
should be sufficient and will be easier to maintain and document.
An svn update will get all these changes. Fingers crossed there won't
be any big fallout, most apps should just compile and work as before.
Let me know if you have problems though.
The work isn't quite finished yet. There are still plugins and
examples that use the deprecated functionality that we need to port
across. Some of the plugins look like there just read things like
indices for the purpose of writing out, but now osg::Geometry won't
officially contain these so this code can probably be dropped. I
would apprecaite help from the community with a review of the pugins
for the old deprecated functionality, especially as I've been working
a few too many evenings and weekends of late and have started to
suffer a bit from RSI in both forearms/wrists/hands so I'll need to
cut back on my current high work intensity.
Thanks,
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org