diff --git a/NEWS.txt b/NEWS.txt index e57e5953b..5f345bd5d 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -22,9 +22,10 @@ The !OpenSceneGraph 2.8 release is the culmination of 9 years of work by the lea * New PDF widget support (based on libPoppler) * New VNC client widget support (based on libVNCServer) * New Browser client widget support (based on Gecko/UBrowser) + * New plugins for loading Half-Life 2 maps and models. * Improvements to DatabasePager tailored for low latency paging. * Improved stats collection and on screen reporting. - * Support for the OpenGL geometry instancing extension. + * Support for the OpenGL draw instanced extension. * Improvements to COLLADA support. * Build reporting using CDash * New Packing support using CPack diff --git a/include/osg/Array b/include/osg/Array index bf6c400cc..623cb96e6 100644 --- a/include/osg/Array +++ b/include/osg/Array @@ -226,8 +226,8 @@ class TemplateArray : public Array, public MixinVector } virtual const GLvoid* getDataPointer() const { if (!this->empty()) return &this->front(); else return 0; } - virtual unsigned int getTotalDataSize() const { return this->size()*sizeof(T); } - virtual unsigned int getNumElements() const { return this->size(); } + virtual unsigned int getTotalDataSize() const { return static_cast(this->size()*sizeof(T)); } + virtual unsigned int getNumElements() const { return static_cast(this->size()); } typedef T ElementDataType; // expose T @@ -312,8 +312,8 @@ class TemplateIndexArray : public IndexArray, public MixinVector } virtual const GLvoid* getDataPointer() const { if (!this->empty()) return &this->front(); else return 0; } - virtual unsigned int getTotalDataSize() const { return this->size()*sizeof(T); } - virtual unsigned int getNumElements() const { return this->size(); } + virtual unsigned int getTotalDataSize() const { return static_cast(this->size()*sizeof(T)); } + virtual unsigned int getNumElements() const { return static_cast(this->size()); } virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; } diff --git a/include/osg/Drawable b/include/osg/Drawable index e3462be35..217fe47d4 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -154,7 +154,7 @@ class OSG_EXPORT Drawable : public Object * Get the number of parents of node. * @return the number of parents of this node. */ - inline unsigned int getNumParents() const { return _parents.size(); } + inline unsigned int getNumParents() const { return static_cast(_parents.size()); } /** Get the list of matrices that transform this node from local coordinates to world coordinates. * The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */ diff --git a/include/osg/Geometry b/include/osg/Geometry index 195b416e6..670f55de9 100644 --- a/include/osg/Geometry +++ b/include/osg/Geometry @@ -199,7 +199,7 @@ class OSG_EXPORT Geometry : public Drawable ArrayData& getTexCoordData(unsigned int index); const ArrayData& getTexCoordData(unsigned int index) const; - unsigned int getNumTexCoordArrays() const { return _texCoordList.size(); } + unsigned int getNumTexCoordArrays() const { return static_cast(_texCoordList.size()); } ArrayDataList& getTexCoordArrayList() { return _texCoordList; } const ArrayDataList& getTexCoordArrayList() const { return _texCoordList; } @@ -219,7 +219,7 @@ class OSG_EXPORT Geometry : public Drawable ArrayData& getVertexAttribData(unsigned int index); const ArrayData& getVertexAttribData(unsigned int index) const; - unsigned int getNumVertexAttribArrays() const { return _vertexAttribList.size(); } + unsigned int getNumVertexAttribArrays() const { return static_cast(_vertexAttribList.size()); } ArrayDataList& getVertexAttribArrayList() { return _vertexAttribList; } const ArrayDataList& getVertexAttribArrayList() const { return _vertexAttribList; } @@ -231,7 +231,7 @@ class OSG_EXPORT Geometry : public Drawable PrimitiveSetList& getPrimitiveSetList() { return _primitives; } const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; } - unsigned int getNumPrimitiveSets() const { return _primitives.size(); } + unsigned int getNumPrimitiveSets() const { return static_cast(_primitives.size()); } PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); } const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); } diff --git a/include/osg/Group b/include/osg/Group index 19bd96c0e..8bedbc44c 100644 --- a/include/osg/Group +++ b/include/osg/Group @@ -97,7 +97,7 @@ class OSG_EXPORT Group : public Node virtual bool replaceChild( Node *origChild, Node* newChild ); /** Return the number of children nodes. */ - inline unsigned int getNumChildren() const { return _children.size(); } + inline unsigned int getNumChildren() const { return static_cast(_children.size()); } /** Set child node at position i. * Return true if set correctly, false on failure (if node==NULL || i is out of range). @@ -139,7 +139,7 @@ class OSG_EXPORT Group : public Node { if (_children[childNum]==node) return childNum; } - return _children.size(); // node not found. + return static_cast(_children.size()); // node not found. } /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/ diff --git a/include/osg/Image b/include/osg/Image index 32104069b..55593a9d7 100644 --- a/include/osg/Image +++ b/include/osg/Image @@ -273,7 +273,7 @@ class OSG_EXPORT Image : public Object unsigned int getNumMipmapLevels() const { - return _mipmapData.size()+1; + return static_cast(_mipmapData.size())+1; }; /** Send offsets into data. It is assumed that first mipmap offset (index 0) is 0.*/ diff --git a/include/osg/KdTree b/include/osg/KdTree index 580736cd3..735248f5e 100644 --- a/include/osg/KdTree +++ b/include/osg/KdTree @@ -131,7 +131,7 @@ class OSG_EXPORT KdTree : public osg::Shape int addNode(const KdNode& node) { - int num = _kdNodes.size(); + int num = static_cast(_kdNodes.size()); _kdNodes.push_back(node); return num; } @@ -147,7 +147,7 @@ class OSG_EXPORT KdTree : public osg::Shape unsigned int addTriangle(const Triangle& tri) { - unsigned int num = _triangles.size(); + unsigned int num = static_cast(_triangles.size()); _triangles.push_back(tri); return num; } diff --git a/include/osg/Node b/include/osg/Node index 2174c4e9b..b2247c643 100644 --- a/include/osg/Node +++ b/include/osg/Node @@ -144,7 +144,7 @@ class OSG_EXPORT Node : public Object * Get the number of parents of node. * @return the number of parents of this node. */ - inline unsigned int getNumParents() const { return _parents.size(); } + inline unsigned int getNumParents() const { return static_cast(_parents.size()); } /** Get the list of node paths parent paths. * The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */ @@ -279,7 +279,7 @@ class OSG_EXPORT Node : public Object inline std::string& getDescription(unsigned int i) { return _descriptions[i]; } /** Get the number of descriptions of the node.*/ - inline unsigned int getNumDescriptions() const { return _descriptions.size(); } + inline unsigned int getNumDescriptions() const { return static_cast(_descriptions.size()); } /** Add a description string to the node.*/ void addDescription(const std::string& desc) { _descriptions.push_back(desc); } diff --git a/include/osg/OperationThread b/include/osg/OperationThread index 8ec9b8cbc..e3fda41f7 100644 --- a/include/osg/OperationThread +++ b/include/osg/OperationThread @@ -108,7 +108,7 @@ class OSG_EXPORT OperationQueue : public Referenced bool empty() const { return _operations.empty(); } /** Return the num of pending operations that are sitting in the OperationQueue.*/ - unsigned int getNumOperationsInQueue() const { return _operations.size(); } + unsigned int getNumOperationsInQueue() const { return static_cast(_operations.size()); } /** Add operation to end of OperationQueue, this will be * executed by the operation thread once this operation gets to the head of the queue.*/ diff --git a/include/osg/PrimitiveSet b/include/osg/PrimitiveSet index e43257c73..992f57212 100644 --- a/include/osg/PrimitiveSet +++ b/include/osg/PrimitiveSet @@ -316,8 +316,8 @@ class OSG_EXPORT DrawArrays : public PrimitiveSet virtual void accept(PrimitiveFunctor& functor) const; virtual void accept(PrimitiveIndexFunctor& functor) const; - virtual unsigned int getNumIndices() const { return _count; } - virtual unsigned int index(unsigned int pos) const { return _first+pos; } + virtual unsigned int getNumIndices() const { return static_cast(_count); } + virtual unsigned int index(unsigned int pos) const { return static_cast(_first)+pos; } virtual void offsetIndices(int offset) { _first += offset; } protected: @@ -493,7 +493,7 @@ class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte virtual const char* className() const { return "DrawElementsUByte"; } virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); } - virtual unsigned int getTotalDataSize() const { return size(); } + virtual unsigned int getTotalDataSize() const { return static_cast(size()); } virtual bool supportsBufferObject() const { return false; } virtual void draw(State& state, bool useVertexBufferObjects) const ; @@ -501,7 +501,7 @@ class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte virtual void accept(PrimitiveFunctor& functor) const; virtual void accept(PrimitiveIndexFunctor& functor) const; - virtual unsigned int getNumIndices() const { return size(); } + virtual unsigned int getNumIndices() const { return static_cast(size()); } virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; } virtual void offsetIndices(int offset); @@ -568,7 +568,7 @@ class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort virtual const char* className() const { return "DrawElementsUShort"; } virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); } - virtual unsigned int getTotalDataSize() const { return 2*size(); } + virtual unsigned int getTotalDataSize() const { return 2u*static_cast(size()); } virtual bool supportsBufferObject() const { return false; } virtual void draw(State& state, bool useVertexBufferObjects) const; @@ -576,7 +576,7 @@ class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort virtual void accept(PrimitiveFunctor& functor) const; virtual void accept(PrimitiveIndexFunctor& functor) const; - virtual unsigned int getNumIndices() const { return size(); } + virtual unsigned int getNumIndices() const { return static_cast(size()); } virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; } virtual void offsetIndices(int offset); @@ -642,7 +642,7 @@ class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint virtual const char* className() const { return "DrawElementsUInt"; } virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); } - virtual unsigned int getTotalDataSize() const { return 4*size(); } + virtual unsigned int getTotalDataSize() const { return 4u*static_cast(size()); } virtual bool supportsBufferObject() const { return false; } virtual void draw(State& state, bool useVertexBufferObjects) const; @@ -650,7 +650,7 @@ class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint virtual void accept(PrimitiveFunctor& functor) const; virtual void accept(PrimitiveIndexFunctor& functor) const; - virtual unsigned int getNumIndices() const { return size(); } + virtual unsigned int getNumIndices() const { return static_cast(size()); } virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; } virtual void offsetIndices(int offset); diff --git a/include/osg/Program b/include/osg/Program index 409d29a50..38dfaf751 100644 --- a/include/osg/Program +++ b/include/osg/Program @@ -83,7 +83,7 @@ class OSG_EXPORT Program : public osg::StateAttribute * Mark Program as needing relink. Return true for success */ bool addShader( Shader* shader ); - unsigned int getNumShaders() const { return _shaderList.size(); } + unsigned int getNumShaders() const { return static_cast(_shaderList.size()); } Shader* getShader( unsigned int i ) { return _shaderList[i].get(); } const Shader* getShader( unsigned int i ) const { return _shaderList[i].get(); } diff --git a/include/osg/Shape b/include/osg/Shape index b532edca6..507abd7b6 100644 --- a/include/osg/Shape +++ b/include/osg/Shape @@ -609,7 +609,7 @@ class OSG_EXPORT CompositeShape : public Shape const Shape* getShape() const { return _shape.get(); } /** Get the number of children of this composite shape.*/ - unsigned int getNumChildren() const { return _children.size(); } + unsigned int getNumChildren() const { return static_cast(_children.size()); } /** Get a child.*/ Shape* getChild(unsigned int i) { return _children[i].get(); } @@ -631,7 +631,7 @@ class OSG_EXPORT CompositeShape : public Shape { if (_children[childNo]==shape) return childNo; } - return _children.size(); // node not found. + return static_cast(_children.size()); // node not found. } diff --git a/include/osg/State b/include/osg/State index 6214fb733..1db439b17 100644 --- a/include/osg/State +++ b/include/osg/State @@ -134,7 +134,7 @@ class OSG_EXPORT State : public Referenced, public Observer void removeStateSet(unsigned int pos); /** Get the number of StateSet's on the StateSet stack.*/ - unsigned int getStateSetStackSize() { return _stateStateStack.size(); } + unsigned int getStateSetStackSize() { return static_cast(_stateStateStack.size()); } /** Pop StateSet's for the StateSet stack till its size equals the specified size.*/ void popStateSetStackToSize(unsigned int size) { while (_stateStateStack.size()>size) popStateSet(); } diff --git a/include/osg/StateAttribute b/include/osg/StateAttribute index d7c4f23a0..d4c75b241 100644 --- a/include/osg/StateAttribute +++ b/include/osg/StateAttribute @@ -256,7 +256,7 @@ class OSG_EXPORT StateAttribute : public Object * Get the number of parents of this StateAttribute. * @return the number of parents of this StateAttribute. */ - inline unsigned int getNumParents() const { return _parents.size(); } + inline unsigned int getNumParents() const { return static_cast(_parents.size()); } struct ModeUsage diff --git a/include/osg/StateSet b/include/osg/StateSet index 03ea009c7..e40626bf4 100644 --- a/include/osg/StateSet +++ b/include/osg/StateSet @@ -89,7 +89,7 @@ class OSG_EXPORT StateSet : public Object * Get the number of parents of this StateSet. * @return the number of parents of this StateSet. */ - inline unsigned int getNumParents() const { return _parents.size(); } + inline unsigned int getNumParents() const { return static_cast(_parents.size()); } /** Compute the DataVariance based on an assessment of callback etc.*/ diff --git a/include/osg/Stats b/include/osg/Stats index f5a2bb65b..129a892fc 100644 --- a/include/osg/Stats +++ b/include/osg/Stats @@ -38,7 +38,7 @@ class OSG_EXPORT Stats : public osg::Referenced void allocate(unsigned int numberOfFrames); - int getEarliestFrameNumber() const { return _latestFrameNumber < static_cast(_attributeMapList.size()) ? 0 : _latestFrameNumber - _attributeMapList.size() + 1; } + int getEarliestFrameNumber() const { return _latestFrameNumber < static_cast(_attributeMapList.size()) ? 0 : _latestFrameNumber - static_cast(_attributeMapList.size()) + 1; } int getLatestFrameNumber() const { return _latestFrameNumber; } typedef std::map AttributeMap; @@ -102,7 +102,7 @@ class OSG_EXPORT Stats : public osg::Referenced if (frameNumber < getEarliestFrameNumber()) return -1; if (frameNumber >= _baseFrameNumber) return frameNumber - _baseFrameNumber; - else return _attributeMapList.size() - (_baseFrameNumber-frameNumber); + else return static_cast(_attributeMapList.size()) - (_baseFrameNumber-frameNumber); } std::string _name; diff --git a/include/osg/View b/include/osg/View index 653b14cd0..3311cbaf9 100644 --- a/include/osg/View +++ b/include/osg/View @@ -131,7 +131,7 @@ class OSG_EXPORT View : public virtual osg::Object bool removeSlave(unsigned int pos); - unsigned int getNumSlaves() const { return _slaves.size(); } + unsigned int getNumSlaves() const { return static_cast(_slaves.size()); } Slave& getSlave(unsigned int pos) { return _slaves[pos]; } const Slave& getSlave(unsigned int pos) const { return _slaves[pos]; } diff --git a/include/osgVolume/Property b/include/osgVolume/Property index f0ddc89cf..909d60eca 100644 --- a/include/osgVolume/Property +++ b/include/osgVolume/Property @@ -180,8 +180,6 @@ class OSGVOLUME_EXPORT ScalarProperty : public Property { public: - ScalarProperty(); - ScalarProperty(const std::string& scaleName, float value); ScalarProperty(const ScalarProperty& scalarProperty,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); @@ -206,6 +204,8 @@ class OSGVOLUME_EXPORT ScalarProperty : public Property virtual ~ScalarProperty() {} + ScalarProperty(); + osg::ref_ptr _uniform; };