From cec0b35cd4c1db4f7577c85a23f8f725ecf565a3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 16 Sep 2003 19:54:57 +0000 Subject: [PATCH] Fixes for .osg output of UByte4 values, and added missing template contructor to DrawElementsUShort. --- include/osg/PrimitiveSet | 5 +++++ include/osg/UByte4 | 8 ++++---- src/osgPlugins/osg/Geometry.cpp | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/osg/PrimitiveSet b/include/osg/PrimitiveSet index 332b2940c..bc7907497 100644 --- a/include/osg/PrimitiveSet +++ b/include/osg/PrimitiveSet @@ -392,6 +392,11 @@ class SG_EXPORT DrawElementsUInt : public PrimitiveSet, public VectorUInt PrimitiveSet(DrawElementsUIntPrimitiveType,mode), VectorUInt(no) {} + template + DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) : + PrimitiveSet(DrawElementsUIntPrimitiveType,mode), + VectorUInt(first,last) {} + virtual Object* cloneType() const { return new DrawElementsUInt(); } virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } diff --git a/include/osg/UByte4 b/include/osg/UByte4 index 2636b43cb..9cb953529 100644 --- a/include/osg/UByte4 +++ b/include/osg/UByte4 @@ -148,10 +148,10 @@ class UByte4 friend inline std::ostream& operator << (std::ostream& output, const UByte4& vec) { - output << vec._v[0] << " " - << vec._v[1] << " " - << vec._v[2] << " " - << vec._v[3]; + output << (int)vec._v[0] << " " + << (int)vec._v[1] << " " + << (int)vec._v[2] << " " + << (int)vec._v[3]; return output; // to enable cascading } diff --git a/src/osgPlugins/osg/Geometry.cpp b/src/osgPlugins/osg/Geometry.cpp index 06b98235b..213c5de5f 100644 --- a/src/osgPlugins/osg/Geometry.cpp +++ b/src/osgPlugins/osg/Geometry.cpp @@ -524,7 +524,7 @@ Array* Array_readLocalData(Input& fr) fr[2].getUInt(b) && fr[3].getUInt(a)) { - ++fr; + fr+=4; array->push_back(osg::UByte4(r,g,b,a)); } else ++fr;