Change triangle indices to unsigned

pull/638/head
scrawl 10 years ago
parent 102eadf91c
commit 28643660d3

@ -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

@ -48,7 +48,7 @@ class NiTriShapeData : public ShapeData
{
public:
// Triangles, three vertex indices per triangle
std::vector<short> triangles;
std::vector<unsigned short> triangles;
void read(NIFStream *nif);
};
@ -144,7 +144,7 @@ class NiSkinData : public Record
public:
struct VertWeight
{
short vertex;
unsigned short vertex;
float weight;
};

@ -103,11 +103,11 @@ std::string NIFStream::getVersionString()
return result;
}
void NIFStream::getShorts(std::vector<short> &vec, size_t size)
void NIFStream::getUShorts(std::vector<unsigned short> &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<float> &vec, size_t size)
{

@ -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<short> &vec, size_t size);
void getUShorts(std::vector<unsigned short> &vec, size_t size);
void getFloats(std::vector<float> &vec, size_t size);
void getVector2s(std::vector<osg::Vec2f> &vec, size_t size);
void getVector3s(std::vector<osg::Vec3f> &vec, size_t size);

@ -1146,7 +1146,7 @@ namespace NifOsg
//influence.mWeights.reserve(weights.size());
for(size_t j = 0;j < weights.size();j++)
{
std::pair<short, float> indexWeight = std::make_pair(weights[j].vertex, weights[j].weight);
std::pair<unsigned short, float> indexWeight = std::make_pair(weights[j].vertex, weights[j].weight);
influence.mWeights.insert(indexWeight);
}
influence.mInvBindMatrix = toMatrix(data->bones[i].trafo);

@ -172,9 +172,9 @@ void RigGeometry::update(osg::NodeVisitor* nv)
osg::Matrixf finalMatrix = bi.mInvBindMatrix * bone->mMatrixInSkeletonSpace * geomToSkel;
for (std::map<short, float>::const_iterator weightIt = bi.mWeights.begin(); weightIt != bi.mWeights.end(); ++weightIt)
for (std::map<unsigned short, float>::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];

@ -25,7 +25,7 @@ namespace SceneUtil
{
osg::Matrixf mInvBindMatrix;
// <vertex index, weight>
std::map<short, float> mWeights;
std::map<unsigned short, float> mWeights;
};
struct InfluenceMap : public osg::Referenced

Loading…
Cancel
Save