Hi All,

I have now taken the next step and added the following methods to osg::Array:


        /** Specify whether the array data should be normalized by OpenGL.*/
        void setNormalize(bool normalize) { _normalize = normalize; }

        /** Get whether the array data should be normalized by OpenGL.*/
        bool getNormalize() const { return _normalize; }

        /** Set hint to ask that the array data is passed via integer
or double, or normal setVertexAttribPointer function.*/
        void setPreserveDataType(bool preserve) { _preserveDataType =
preserve; }

        /** Get hint to ask that the array data is passed via integer
or double, or normal setVertexAttribPointer function.*/
        bool getPreserveDataType() const { return _preserveDataType; }

        /** Set the rate at which generic vertex attributes advance
during instanced rendering. Uses the glVertexAttribDivisor feature of
OpenGL 4.0*/
        void setAttribDivisor(GLuint divisor) { _attribDivisor = divisor; }

        /** Get the rate at which generic vertex attributes advance
during instanced rendering.*/
        GLuint getAttribDivisor() const { return _attribDivisor; }

        enum Binding
        {
            BIND_OFF=0,
            BIND_OVERALL,
            BIND_PER_PRIMITIVE_SET,
            BIND_PER_VERTEX
        };

        /** Specify how this array should be passed to OpenGL.*/
        void setBinding(Binding binding) { _binding = binding; }

        /** Get how this array should be passed to OpenGL.*/
        Binding getBinding() const { return _binding; }

At present all of them doing nothing at all apart from sitting there
looking pretty.  The PreserveDataType and AttribDivisor are entirely
new and are intended to support new extensions being added to the OSG
- but their implementation will have to wait till the GeometryNew
refactor is further down the road.

The Normalize and Binding map directly to what has been available in
osg::Geometry::ArrayData's normalize and binding parameters.  The
binding we've typically set via Geometry::setNormalBinding() etc.
which we could easily remap internally to array->setBinding(..), but
it will of course require one to call setNormalBinding() after
setNormalArray(..) otherwise the setting would be lost.  Alternatively
we just drop backwards compatibility and force uses to set the binding
directly on the array.

Providing backwards compatibility for normalize will more awkward as
custom normalize settings would require a direct setting to ArrayData,
however, I'm inclined to think dropping this element of backwards
compatibility won't effect too many users as I expect most users not
to be applying anything other than defaults.

The naming of Binding is something I'm note yet sure of, with the
introduction of AttribDivisor the binding becomes a bit less clearly
defined as well.  Not sure what to make of this yet...

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

Reply via email to