Changed base of material indices in models from one to zero for consistency with everything else.
parent
286d0cc517
commit
e539502cfb
|
@ -376,10 +376,9 @@ void Mesh::render(const std::vector<const Material*>& materials,
|
|||
const Material* mat = NULL;
|
||||
uint32 materialIndex = (*iter)->materialIndex;
|
||||
if (materialIndex != lastMaterial &&
|
||||
materialIndex > 0 &&
|
||||
materialIndex <= materials.size())
|
||||
materialIndex < materials.size())
|
||||
{
|
||||
mat = materials[materialIndex - 1];
|
||||
mat = materials[materialIndex];
|
||||
}
|
||||
rc.setMaterial(mat);
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ static Model*
|
|||
Convert3DSModel(const M3DScene& scene, const string& texPath)
|
||||
{
|
||||
Model* model = new Model();
|
||||
uint32 materialIndex = 1;
|
||||
uint32 materialIndex = 0;
|
||||
|
||||
for (unsigned int i = 0; i < scene.getModelCount(); i++)
|
||||
{
|
||||
|
|
|
@ -110,8 +110,6 @@ Model* LoadModel(istream& in, const string& texPath)
|
|||
|
||||
delete loader;
|
||||
|
||||
cout << "Model loaded\n"; cout.flush();
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
@ -483,7 +481,12 @@ AsciiModelLoader::loadMesh()
|
|||
delete mesh;
|
||||
return NULL;
|
||||
}
|
||||
uint32 materialIndex = (uint32) tok.getNumberValue();
|
||||
|
||||
uint32 materialIndex;
|
||||
if (tok.getNumberValue() == -1.0)
|
||||
materialIndex = ~0;
|
||||
else
|
||||
materialIndex = (uint32) tok.getNumberValue();
|
||||
|
||||
if (tok.nextToken() != Tokenizer::TokenNumber)
|
||||
{
|
||||
|
@ -491,6 +494,7 @@ AsciiModelLoader::loadMesh()
|
|||
delete mesh;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32 indexCount = (uint32) tok.getNumberValue();
|
||||
|
||||
uint32* indices = new uint32[indexCount];
|
||||
|
@ -556,8 +560,6 @@ AsciiModelLoader::load()
|
|||
string name = tok.getNameValue();
|
||||
tok.pushBack();
|
||||
|
||||
cout << "token " << name << '\n';
|
||||
|
||||
if (name == "material")
|
||||
{
|
||||
if (seenMeshes)
|
||||
|
|
|
@ -384,7 +384,7 @@ Mesh* SphereMesh::convertToMesh() const
|
|||
indexData[j * 2 + 1] = (i + 1) * (nSlices + 1) + j;
|
||||
}
|
||||
|
||||
mesh->addGroup(Mesh::TriStrip, 0, (nSlices + 1) * 2, indexData);
|
||||
mesh->addGroup(Mesh::TriStrip, ~0, (nSlices + 1) * 2, indexData);
|
||||
}
|
||||
|
||||
return mesh;
|
||||
|
|
Loading…
Reference in New Issue