On 5 June 2013 06:45, Robert Osfield <robert.osfi...@gmail.com> wrote:
> Right now I feel that sticking with the same naming convention that
> users have been used will make for a smoother transition to the new
> osg::Geometry.  Ideally I want most users just to recompile their code
> and not have any problems..  Extending the enum Binding with
> BIND_INSTANCE_DIVISOR_0 etc, would be one way, it's a bit cludgy but
> would avoid the overlap in functionality issue.

I have quickly mocked up the change to Array::Binding thus:

        enum Binding
        {
            BIND_UNDEFINED=-1,
            BIND_OFF=0,
            BIND_OVERALL=1,
            BIND_PER_PRIMITIVE_SET=2,
            BIND_PER_VERTEX=4,
            BIND_INSTANCE_DIVISOR_0=6,
            BIND_INSTANCE_DIVISOR_1=BIND_INSTANCE_DIVISOR_0+1,
            BIND_INSTANCE_DIVISOR_2=BIND_INSTANCE_DIVISOR_0+2,
            BIND_INSTANCE_DIVISOR_3=BIND_INSTANCE_DIVISOR_0+3,
            BIND_INSTANCE_DIVISOR_4=BIND_INSTANCE_DIVISOR_0+4,
            BIND_INSTANCE_DIVISOR_5=BIND_INSTANCE_DIVISOR_0+5,
            BIND_INSTANCE_DIVISOR_6=BIND_INSTANCE_DIVISOR_0+6,
            BIND_INSTANCE_DIVISOR_7=BIND_INSTANCE_DIVISOR_0+7
        };

Also I change the s/getBinding() to use an int rather than Binding so
you can simply write:

    array->setBinding(BIND_INSTANCE_DIVISOR_0+divisor);

On a separate clean up of GeometryNew I have now removed the non
essential verifyBindings()/sharedArray() methods that really belong in
osgUtil as part of set of helper classses/methods.  With this clean up
comparing the GeometryNew to old the Geometry shows how effective the
clean up has been:

$ wc include/osg/GeometryNew src/osg/GeometryNew.cpp
  258  1127 11245 include/osg/GeometryNew
 1146  2487 38666 src/osg/GeometryNew.cpp
 1404  3614 49911 total

$ wc include/osg/Geometry src/osg/Geometry.cpp
   463   1877  20075 include/osg/Geometry
  2763   5793 100862 src/osg/Geometry.cpp
  3226   7670 120937 total

Total size is now less than half the previous size.  The code is also
clearer.  So far so good.

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

Reply via email to