- refactoring : remove not used mesh index from private method in obj-importer.
- refactoring : remove commented code. Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>pull/171/head
parent
87a0e77032
commit
685612b9f4
|
@ -277,7 +277,7 @@ struct Model
|
||||||
//! Material map
|
//! Material map
|
||||||
std::map<std::string, Material*> m_MaterialMap;
|
std::map<std::string, Material*> m_MaterialMap;
|
||||||
|
|
||||||
//! \brief Default constructor
|
//! \brief The default class constructor
|
||||||
Model() :
|
Model() :
|
||||||
m_ModelName(""),
|
m_ModelName(""),
|
||||||
m_pCurrent(NULL),
|
m_pCurrent(NULL),
|
||||||
|
@ -290,7 +290,7 @@ struct Model
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \brief Destructor
|
//! \brief The class destructor
|
||||||
~Model()
|
~Model()
|
||||||
{
|
{
|
||||||
// Clear all stored object instances
|
// Clear all stored object instances
|
||||||
|
|
|
@ -123,8 +123,9 @@ void ObjFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
|
|
||||||
// Get the file-size and validate it, throwing an exception when fails
|
// Get the file-size and validate it, throwing an exception when fails
|
||||||
size_t fileSize = file->FileSize();
|
size_t fileSize = file->FileSize();
|
||||||
if( fileSize < 16)
|
if( fileSize < 16) {
|
||||||
throw DeadlyImportError( "OBJ-file is too small.");
|
throw DeadlyImportError( "OBJ-file is too small.");
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate buffer and read file into it
|
// Allocate buffer and read file into it
|
||||||
TextFileToBuffer(file.get(),m_Buffer);
|
TextFileToBuffer(file.get(),m_Buffer);
|
||||||
|
@ -167,7 +168,7 @@ void ObjFileImporter::CreateDataFromImport(const ObjFile::Model* pModel, aiScene
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This is an error, so break down the application
|
// This is a fatal error, so break down the application
|
||||||
ai_assert(false);
|
ai_assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +176,7 @@ void ObjFileImporter::CreateDataFromImport(const ObjFile::Model* pModel, aiScene
|
||||||
std::vector<aiMesh*> MeshArray;
|
std::vector<aiMesh*> MeshArray;
|
||||||
for (size_t index = 0; index < pModel->m_Objects.size(); index++)
|
for (size_t index = 0; index < pModel->m_Objects.size(); index++)
|
||||||
{
|
{
|
||||||
createNodes(pModel, pModel->m_Objects[ index ], index, pScene->mRootNode, pScene, MeshArray);
|
createNodes(pModel, pModel->m_Objects[ index ], pScene->mRootNode, pScene, MeshArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create mesh pointer buffer for this scene
|
// Create mesh pointer buffer for this scene
|
||||||
|
@ -195,7 +196,6 @@ void ObjFileImporter::CreateDataFromImport(const ObjFile::Model* pModel, aiScene
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Creates all nodes of the model
|
// Creates all nodes of the model
|
||||||
aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile::Object* pObject,
|
aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile::Object* pObject,
|
||||||
unsigned int /*uiMeshIndex*/,
|
|
||||||
aiNode *pParent, aiScene* pScene,
|
aiNode *pParent, aiScene* pScene,
|
||||||
std::vector<aiMesh*> &MeshArray )
|
std::vector<aiMesh*> &MeshArray )
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,7 @@ private:
|
||||||
void CreateDataFromImport(const ObjFile::Model* pModel, aiScene* pScene);
|
void CreateDataFromImport(const ObjFile::Model* pModel, aiScene* pScene);
|
||||||
|
|
||||||
//! \brief Creates all nodes stored in imported content.
|
//! \brief Creates all nodes stored in imported content.
|
||||||
aiNode *createNodes(const ObjFile::Model* pModel, const ObjFile::Object* pData, unsigned int uiMeshIndex,
|
aiNode *createNodes(const ObjFile::Model* pModel, const ObjFile::Object* pData,
|
||||||
aiNode *pParent, aiScene* pScene, std::vector<aiMesh*> &MeshArray);
|
aiNode *pParent, aiScene* pScene, std::vector<aiMesh*> &MeshArray);
|
||||||
|
|
||||||
//! \brief Creates topology data like faces and meshes for the geometry.
|
//! \brief Creates topology data like faces and meshes for the geometry.
|
||||||
|
|
|
@ -50,10 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "../include/assimp/types.h"
|
#include "../include/assimp/types.h"
|
||||||
#include "DefaultIOSystem.h"
|
#include "DefaultIOSystem.h"
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
const std::string ObjFileParser::DEFAULT_MATERIAL = AI_DEFAULT_MATERIAL_NAME;
|
const std::string ObjFileParser::DEFAULT_MATERIAL = AI_DEFAULT_MATERIAL_NAME;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
@ -71,9 +69,10 @@ ObjFileParser::ObjFileParser(std::vector<char> &Data,const std::string &strModel
|
||||||
m_pModel = new ObjFile::Model();
|
m_pModel = new ObjFile::Model();
|
||||||
m_pModel->m_ModelName = strModelName;
|
m_pModel->m_ModelName = strModelName;
|
||||||
|
|
||||||
|
// create default material and store it
|
||||||
m_pModel->m_pDefaultMaterial = new ObjFile::Material();
|
m_pModel->m_pDefaultMaterial = new ObjFile::Material();
|
||||||
m_pModel->m_pDefaultMaterial->MaterialName.Set( DEFAULT_MATERIAL );
|
m_pModel->m_pDefaultMaterial->MaterialName.Set( DEFAULT_MATERIAL );
|
||||||
m_pModel->m_MaterialLib.push_back( DEFAULT_MATERIAL );
|
m_pModel->m_MaterialLib.push_back( DEFAULT_MATERIAL );
|
||||||
m_pModel->m_MaterialMap[ DEFAULT_MATERIAL ] = m_pModel->m_pDefaultMaterial;
|
m_pModel->m_MaterialMap[ DEFAULT_MATERIAL ] = m_pModel->m_pDefaultMaterial;
|
||||||
|
|
||||||
// Start parsing the file
|
// Start parsing the file
|
||||||
|
@ -84,9 +83,6 @@ ObjFileParser::ObjFileParser(std::vector<char> &Data,const std::string &strModel
|
||||||
// Destructor
|
// Destructor
|
||||||
ObjFileParser::~ObjFileParser()
|
ObjFileParser::~ObjFileParser()
|
||||||
{
|
{
|
||||||
/*delete m_pModel->m_pDefaultMaterial;
|
|
||||||
m_pModel->m_pDefaultMaterial = NULL;*/
|
|
||||||
|
|
||||||
delete m_pModel;
|
delete m_pModel;
|
||||||
m_pModel = NULL;
|
m_pModel = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue