Show
Ignore:
Timestamp:
03/25/09 12:17:21 (4 years ago)
Author:
robert
Message:

Added new virtual reseveElements, setElement, getElment and addElement methods to DrawElements?
to make is easier to write code that can work on DrawElementUByte, UShort or UInt.

Changed the osgTerrain::GeometryTechnique? so that it automatically chooses
the use of DrawElementUShort or DrawElementsUInt accordining to the size of the tile.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osg/PrimitiveSet

    r9599 r9969  
    450450            if (_ebo.valid()) _ebo->releaseGLObjects(state); 
    451451        } 
     452         
     453         
     454        virtual void reserveElements(unsigned int numIndices) = 0; 
     455        virtual void setElement(unsigned int, unsigned int) = 0; 
     456        virtual unsigned int getElement(unsigned int) = 0; 
     457        virtual void addElement(unsigned int) = 0; 
    452458 
    453459    protected: 
     
    527533        } 
    528534         
     535        virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); } 
     536        virtual void setElement(unsigned int i, unsigned int v)  { (*this)[i] = v; } 
     537        virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }  
     538        virtual void addElement(unsigned int v) { push_back(GLubyte(v)); }  
     539 
    529540    protected: 
    530541 
     
    602613        } 
    603614 
     615        virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); } 
     616        virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; } 
     617        virtual unsigned int getElement(unsigned int i) { return (*this)[i]; } 
     618        virtual void addElement(unsigned int v) { push_back(GLushort(v)); } 
     619 
    604620    protected: 
    605621 
     
    677693        } 
    678694 
     695        virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); } 
     696        virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; } 
     697        virtual unsigned int getElement(unsigned int i) { return (*this)[i]; } 
     698        virtual void addElement(unsigned int v) { push_back(GLuint(v)); } 
     699 
    679700    protected: 
    680701