From 28643660d3dbfb10c3c8613711606652f31b4263 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 21 Apr 2015 20:56:16 +0200 Subject: [PATCH] Change triangle indices to unsigned --- components/nif/data.cpp | 2 +- components/nif/data.hpp | 4 ++-- components/nif/nifstream.cpp | 4 ++-- components/nif/nifstream.hpp | 2 +- components/nifosg/nifloader.cpp | 2 +- components/sceneutil/riggeometry.cpp | 4 ++-- components/sceneutil/riggeometry.hpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/nif/data.cpp b/components/nif/data.cpp index 3a06e40060..fc0631b841 100644 --- a/components/nif/data.cpp +++ b/components/nif/data.cpp @@ -71,7 +71,7 @@ void NiTriShapeData::read(NIFStream *nif) // We have three times as many vertices as triangles, so this // is always equal to tris*3. int cnt = nif->getInt(); - nif->getShorts(triangles, cnt); + nif->getUShorts(triangles, cnt); // Read the match list, which lists the vertices that are equal to // vertices. We don't actually need need this for anything, so diff --git a/components/nif/data.hpp b/components/nif/data.hpp index 1b4d02f26c..63dc42aded 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -48,7 +48,7 @@ class NiTriShapeData : public ShapeData { public: // Triangles, three vertex indices per triangle - std::vector triangles; + std::vector triangles; void read(NIFStream *nif); }; @@ -144,7 +144,7 @@ class NiSkinData : public Record public: struct VertWeight { - short vertex; + unsigned short vertex; float weight; }; diff --git a/components/nif/nifstream.cpp b/components/nif/nifstream.cpp index 628541933f..d0fc9bab03 100644 --- a/components/nif/nifstream.cpp +++ b/components/nif/nifstream.cpp @@ -103,11 +103,11 @@ std::string NIFStream::getVersionString() return result; } -void NIFStream::getShorts(std::vector &vec, size_t size) +void NIFStream::getUShorts(std::vector &vec, size_t size) { vec.resize(size); for(size_t i = 0;i < vec.size();i++) - vec[i] = getShort(); + vec[i] = getUShort(); } void NIFStream::getFloats(std::vector &vec, size_t size) { diff --git a/components/nif/nifstream.hpp b/components/nif/nifstream.hpp index b732c83af2..45733f48fe 100644 --- a/components/nif/nifstream.hpp +++ b/components/nif/nifstream.hpp @@ -59,7 +59,7 @@ public: ///This is special since the version string doesn't start with a number, and ends with "\n" std::string getVersionString(); - void getShorts(std::vector &vec, size_t size); + void getUShorts(std::vector &vec, size_t size); void getFloats(std::vector &vec, size_t size); void getVector2s(std::vector &vec, size_t size); void getVector3s(std::vector &vec, size_t size); diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index b28412cb68..f7f6af0ae6 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -1146,7 +1146,7 @@ namespace NifOsg //influence.mWeights.reserve(weights.size()); for(size_t j = 0;j < weights.size();j++) { - std::pair indexWeight = std::make_pair(weights[j].vertex, weights[j].weight); + std::pair indexWeight = std::make_pair(weights[j].vertex, weights[j].weight); influence.mWeights.insert(indexWeight); } influence.mInvBindMatrix = toMatrix(data->bones[i].trafo); diff --git a/components/sceneutil/riggeometry.cpp b/components/sceneutil/riggeometry.cpp index 00f80c8297..4d4ea22d25 100644 --- a/components/sceneutil/riggeometry.cpp +++ b/components/sceneutil/riggeometry.cpp @@ -172,9 +172,9 @@ void RigGeometry::update(osg::NodeVisitor* nv) osg::Matrixf finalMatrix = bi.mInvBindMatrix * bone->mMatrixInSkeletonSpace * geomToSkel; - for (std::map::const_iterator weightIt = bi.mWeights.begin(); weightIt != bi.mWeights.end(); ++weightIt) + for (std::map::const_iterator weightIt = bi.mWeights.begin(); weightIt != bi.mWeights.end(); ++weightIt) { - short vertex = weightIt->first; + unsigned short vertex = weightIt->first; float weight = weightIt->second; osg::Vec3f a = (*positionSrc)[vertex]; diff --git a/components/sceneutil/riggeometry.hpp b/components/sceneutil/riggeometry.hpp index 70f2c6e7db..c77ff7c726 100644 --- a/components/sceneutil/riggeometry.hpp +++ b/components/sceneutil/riggeometry.hpp @@ -25,7 +25,7 @@ namespace SceneUtil { osg::Matrixf mInvBindMatrix; // - std::map mWeights; + std::map mWeights; }; struct InfluenceMap : public osg::Referenced