OgreImporter: Continue cleanup.
parent
09517b342b
commit
6c51fa2072
|
@ -110,12 +110,12 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
||||||
throw DeadlyImportError("Root node is not <mesh> but <" + string(reader->getNodeName()) + ">");
|
throw DeadlyImportError("Root node is not <mesh> but <" + string(reader->getNodeName()) + ">");
|
||||||
|
|
||||||
// Node names
|
// Node names
|
||||||
string nnSharedGeometry = "sharedgeometry";
|
const string nnSharedGeometry = "sharedgeometry";
|
||||||
string nnVertexBuffer = "vertexbuffer";
|
const string nnVertexBuffer = "vertexbuffer";
|
||||||
string nnSubMeshes = "submeshes";
|
const string nnSubMeshes = "submeshes";
|
||||||
string nnSubMesh = "submesh";
|
const string nnSubMesh = "submesh";
|
||||||
string nnSubMeshNames = "submeshnames";
|
const string nnSubMeshNames = "submeshnames";
|
||||||
string nnSkeletonLink = "skeletonlink";
|
const string nnSkeletonLink = "skeletonlink";
|
||||||
|
|
||||||
// -------------------- Shared Geometry --------------------
|
// -------------------- Shared Geometry --------------------
|
||||||
// This can be used to share geometry between submeshes
|
// This can be used to share geometry between submeshes
|
||||||
|
@ -123,7 +123,7 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
||||||
NextNode(reader.get());
|
NextNode(reader.get());
|
||||||
if (CurrentNodeNameEquals(reader, nnSharedGeometry))
|
if (CurrentNodeNameEquals(reader, nnSharedGeometry))
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->debug("Reading shader geometry");
|
DefaultLogger::get()->debug("Reading shared geometry");
|
||||||
unsigned int NumVertices = GetAttribute<unsigned int>(reader.get(), "vertexcount");
|
unsigned int NumVertices = GetAttribute<unsigned int>(reader.get(), "vertexcount");
|
||||||
|
|
||||||
NextNode(reader.get());
|
NextNode(reader.get());
|
||||||
|
@ -147,15 +147,16 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
||||||
|
|
||||||
// Just a index in a array, we add a mesh in each loop cycle, so we get indicies like 0, 1, 2 ... n;
|
// Just a index in a array, we add a mesh in each loop cycle, so we get indicies like 0, 1, 2 ... n;
|
||||||
// so it is important to do this before pushing the mesh in the vector!
|
// so it is important to do this before pushing the mesh in the vector!
|
||||||
|
/// @todo Not sure if this really is needed, refactor out if possible.
|
||||||
submesh->MaterialIndex = subMeshes.size();
|
submesh->MaterialIndex = subMeshes.size();
|
||||||
|
|
||||||
subMeshes.push_back(boost::shared_ptr<SubMesh>(submesh));
|
subMeshes.push_back(boost::shared_ptr<SubMesh>(submesh));
|
||||||
|
|
||||||
// Load the Material:
|
/** @todo What is the correct way of handling empty ref here.
|
||||||
aiMaterial* MeshMat = LoadMaterial(submesh->MaterialName);
|
Does Assimp require there to be a valid material index for each mesh,
|
||||||
|
even if its a dummy material. */
|
||||||
// Set the Material:
|
aiMaterial* material = LoadMaterial(submesh->MaterialName);
|
||||||
materials.push_back(MeshMat);
|
materials.push_back(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subMeshes.empty())
|
if (subMeshes.empty())
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/** @todo Read Vertex Colors
|
|
||||||
@todo Read multiple TexCoords
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp
|
||||||
{
|
{
|
||||||
namespace Ogre
|
namespace Ogre
|
||||||
|
@ -63,10 +59,9 @@ struct SubMesh
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
/** Importer for Ogre mesh, skeleton and material formats.
|
||||||
/// \class OgreImporter
|
@todo Support vertex colors
|
||||||
/// \brief Importer for Ogre mesh, skeleton and material formats.
|
@todo Support multiple TexCoords (this is already done??) */
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
class OgreImporter : public BaseImporter
|
class OgreImporter : public BaseImporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -73,11 +73,11 @@ void OgreImporter::ReadSubMesh(const unsigned int submeshIndex, SubMesh &submesh
|
||||||
NextNode(reader);
|
NextNode(reader);
|
||||||
string currentNodeName = reader->getNodeName();
|
string currentNodeName = reader->getNodeName();
|
||||||
|
|
||||||
string nnFaces = "faces";
|
const string nnFaces = "faces";
|
||||||
string nnFace = "face";
|
const string nnFace = "face";
|
||||||
string nnGeometry = "geometry";
|
const string nnGeometry = "geometry";
|
||||||
string nnBoneAssignments = "boneassignments";
|
const string nnBoneAssignments = "boneassignments";
|
||||||
string nnVertexBuffer = "vertexbuffer";
|
const string nnVertexBuffer = "vertexbuffer";
|
||||||
|
|
||||||
bool quadWarned = false;
|
bool quadWarned = false;
|
||||||
|
|
||||||
|
@ -165,14 +165,14 @@ void OgreImporter::ReadVertexBuffer(SubMesh &submesh, XmlReader *reader, const u
|
||||||
if (!submesh.HasPositions)
|
if (!submesh.HasPositions)
|
||||||
throw DeadlyImportError("Vertex buffer does not contain positions!");
|
throw DeadlyImportError("Vertex buffer does not contain positions!");
|
||||||
|
|
||||||
string nnVertex = "vertex";
|
const string nnVertex = "vertex";
|
||||||
string nnPosition = "position";
|
const string nnPosition = "position";
|
||||||
string nnNormal = "normal";
|
const string nnNormal = "normal";
|
||||||
string nnTangent = "tangent";
|
const string nnTangent = "tangent";
|
||||||
string nnBinormal = "binormal";
|
const string nnBinormal = "binormal";
|
||||||
string nnTexCoord = "texcoord";
|
const string nnTexCoord = "texcoord";
|
||||||
string nnColorDiffuse = "colour_diffuse";
|
const string nnColorDiffuse = "colour_diffuse";
|
||||||
string nnColorSpecular = "colour_specular";
|
const string nnColorSpecular = "colour_specular";
|
||||||
|
|
||||||
bool warnBinormal = true;
|
bool warnBinormal = true;
|
||||||
bool warnColorDiffuse = true;
|
bool warnColorDiffuse = true;
|
||||||
|
@ -299,7 +299,7 @@ void OgreImporter::ReadBoneWeights(SubMesh &submesh, XmlReader *reader)
|
||||||
submesh.Weights.resize(submesh.Positions.size());
|
submesh.Weights.resize(submesh.Positions.size());
|
||||||
|
|
||||||
unsigned int numRead = 0;
|
unsigned int numRead = 0;
|
||||||
string nnVertexBoneAssignment = "vertexboneassignment";
|
const string nnVertexBoneAssignment = "vertexboneassignment";
|
||||||
|
|
||||||
NextNode(reader);
|
NextNode(reader);
|
||||||
while(CurrentNodeNameEquals(reader, nnVertexBoneAssignment))
|
while(CurrentNodeNameEquals(reader, nnVertexBoneAssignment))
|
||||||
|
|
Loading…
Reference in New Issue