- UPDATE : Add group loading support to Obj-Loader. Many thanks to Robert Ramirez for this Patch.

- UPDATE : Add Robert Ramirez to CREDITS file.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@506 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
kimmi 2009-11-27 14:33:29 +00:00
parent 46809f0dfa
commit 1829481591
9 changed files with 2858 additions and 2866 deletions

View File

@ -69,4 +69,7 @@ Updated PyAssimp to the latest Assimp data structures and provided a script to k
Collada testing with Cinema 4D Collada testing with Cinema 4D
- Brad Grantham - Brad Grantham
Improvements in OpenGL-sample Improvements in OpenGL-Sample.
- Robert Ramirez
Add group loading feature to Obj-Loader.

View File

@ -155,7 +155,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 ], pScene->mRootNode, pScene, MeshArray); createNodes(pModel, pModel->m_Objects[ index ], index, pScene->mRootNode, pScene, MeshArray);
} }
// Create mesh pointer buffer for this scene // Create mesh pointer buffer for this scene
@ -178,6 +178,7 @@ 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* pData, aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile::Object* pData,
unsigned int uiMeshIndex,
aiNode *pParent, aiScene* pScene, aiNode *pParent, aiScene* pScene,
std::vector<aiMesh*> &MeshArray) std::vector<aiMesh*> &MeshArray)
{ {
@ -192,10 +193,10 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile
this->appendChildToParentNode(pParent, pNode); this->appendChildToParentNode(pParent, pNode);
aiMesh *pMesh = NULL; aiMesh *pMesh = NULL;
for (unsigned int meshIndex = 0; meshIndex < pModel->m_Meshes.size(); meshIndex++) //for (unsigned int meshIndex = 0; meshIndex < pModel->m_Meshes.size(); meshIndex++)
{ {
pMesh = new aiMesh(); pMesh = new aiMesh();
createTopology( pModel, pData, meshIndex, pMesh ); createTopology( pModel, pData, uiMeshIndex, pMesh );
if (pMesh->mNumVertices > 0) { if (pMesh->mNumVertices > 0) {
MeshArray.push_back( pMesh ); MeshArray.push_back( pMesh );
} }

View File

@ -90,7 +90,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, aiNode *createNodes(const ObjFile::Model* pModel, const ObjFile::Object* pData, unsigned int uiMeshIndex,
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.

View File

@ -385,9 +385,9 @@ void ObjFileParser::getMaterialDesc()
{ {
// Not found, use default material // Not found, use default material
m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial; m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
m_pModel->m_pCurrentMesh = new ObjFile::Mesh(); //m_pModel->m_pCurrentMesh = new ObjFile::Mesh();
m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh ); //m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh );
m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( DEFAULT_MATERIAL ); //m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( DEFAULT_MATERIAL );
} }
else else
{ {
@ -395,9 +395,9 @@ void ObjFileParser::getMaterialDesc()
m_pModel->m_pCurrentMaterial = (*it).second; m_pModel->m_pCurrentMaterial = (*it).second;
// Create a new mesh for a new material // Create a new mesh for a new material
m_pModel->m_pCurrentMesh = new ObjFile::Mesh(); //m_pModel->m_pCurrentMesh = new ObjFile::Mesh();
m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh ); //m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh );
m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( strName ); //m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( strName );
} }
// Skip rest of line // Skip rest of line
@ -597,6 +597,16 @@ void ObjFileParser::createObject(const std::string &strObjectName)
m_pModel->m_pCurrent = new ObjFile::Object(); m_pModel->m_pCurrent = new ObjFile::Object();
m_pModel->m_pCurrent->m_strObjName = strObjectName; m_pModel->m_pCurrent->m_strObjName = strObjectName;
m_pModel->m_Objects.push_back(m_pModel->m_pCurrent); m_pModel->m_Objects.push_back(m_pModel->m_pCurrent);
m_pModel->m_pCurrentMesh = new ObjFile::Mesh();
m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh );
if(m_pModel->m_pCurrentMaterial)
{
m_pModel->m_pCurrentMesh->m_uiMaterialIndex =
getMaterialIndex( m_pModel->m_pCurrentMaterial->MaterialName.data );
m_pModel->m_pCurrentMesh->m_pMaterial = m_pModel->m_pCurrentMaterial;
}
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,14 @@
 
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2005 # Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpview", "assimp_view.vcproj", "{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpview", "assimp_view.vcproj", "{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}"
ProjectSection(ProjectDependencies) = postProject
{5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524}
EndProjectSection
ProjectSection(WebsiteProperties) = preProject ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True" Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False" Release.AspNetCompiler.Debug = "False"
EndProjectSection EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp", "assimp.vcproj", "{5691E159-2D9B-407F-971F-EA5C592DC524}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp", "assimp.vcproj", "{5691E159-2D9B-407F-971F-EA5C592DC524}"
ProjectSection(WebsiteProperties) = preProject ProjectSection(WebsiteProperties) = preProject
@ -17,22 +17,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp", "assimp.vcproj", "
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit", "UnitTest.vcproj", "{9B9D1C90-8A03-409A-B547-AE7B48B90F1A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit", "UnitTest.vcproj", "{9B9D1C90-8A03-409A-B547-AE7B48B90F1A}"
ProjectSection(ProjectDependencies) = postProject
{5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524}
EndProjectSection
ProjectSection(WebsiteProperties) = preProject ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True" Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False" Release.AspNetCompiler.Debug = "False"
EndProjectSection EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp_cmd", "assimp_cmd.vcproj", "{7C8F7B44-C990-4EA8-A2A5-9028472E0AD3}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpcmd", "assimp_cmd.vcproj", "{7C8F7B44-C990-4EA8-A2A5-9028472E0AD3}"
ProjectSection(ProjectDependencies) = postProject
{5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524}
EndProjectSection
ProjectSection(WebsiteProperties) = preProject ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True" Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False" Release.AspNetCompiler.Debug = "False"
EndProjectSection EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524}
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff