Merge branch 'master' of https://github.com/assimp/assimp
commit
28de609a56
18
.travis.yml
18
.travis.yml
|
@ -15,12 +15,12 @@ env:
|
|||
matrix:
|
||||
- LINUX=1 TRAVIS_NO_EXPORT=YES
|
||||
- LINUX=1 TRAVIS_NO_EXPORT=NO
|
||||
- LINUX=1 TRAVIS_STATIC_BUILD=ON
|
||||
- LINUX=1 TRAVIS_STATIC_BUILD=OFF
|
||||
- LINUX=1 SHARED_BUILD=ON
|
||||
- LINUX=1 SHARED_BUILD=OFF
|
||||
- WINDOWS=1 TRAVIS_NO_EXPORT=YES
|
||||
- WINDOWS=1 TRAVIS_NO_EXPORT=NO
|
||||
- WINDOWS=1 TRAVIS_STATIC_BUILD=ON
|
||||
- WINDOWS=1 TRAVIS_STATIC_BUILD=OFF
|
||||
- WINDOWS=1 SHARED_BUILD=ON
|
||||
- WINDOWS=1 SHARED_BUILD=OFF
|
||||
- ANDROID=1
|
||||
|
||||
language: cpp
|
||||
|
@ -35,10 +35,18 @@ install:
|
|||
script:
|
||||
- if [ $ANDROID ]; then
|
||||
ant -v -Dmy.dir=${TRAVIS_BUILD_DIR} -f ${TRAVIS_BUILD_DIR}/port/jassimp/build.xml ndk-jni ;
|
||||
elif [ $WINDOWS -a $CC = "gcc" ]; then
|
||||
sudo sh -c "wget http://source.winehq.org/git/wine.git/commitdiff_plain/86781a6a524fa336f893ffd0a87373ffd306913c?hp=076edfe9d4b6cd39b6cf41b9f1d3e18688cc8673 -O - | patch -p 1 -d /usr/x86_64-w64-mingw32" ;
|
||||
sudo sh -c "wget https://www.winehq.org/pipermail/wine-patches/2012-February/111438.html -O - | patch -p 1 -d /usr/x86_64-w64-mingw32" ;
|
||||
cmake -G "Unix Makefiles" -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -DBUILD_SHARED_LIBS=$SHARED_BUILD -DCMAKE_TOOLCHAIN_FILE=cmake-modules/MinGW_x86_64.cmake ;
|
||||
cmake --build . ;
|
||||
make install ;
|
||||
elif [ $WINDOWS ]; then
|
||||
echo "Skip compile with non-gcc setting." ;
|
||||
elif [ $RESERVED ]; then
|
||||
echo "Reserved condition" ;
|
||||
else
|
||||
cmake -G "Unix Makefiles" -DASSIMP_ENABLE_BOOST_WORKAROUND=YES -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -STATIC_BUILD=$TRAVIS_STATIC_BUILD ;
|
||||
cmake -G "Unix Makefiles" -DASSIMP_ENABLE_BOOST_WORKAROUND=YES -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -DBUILD_SHARED_LIBS=$SHARED_BUILD ;
|
||||
make ;
|
||||
sudo make install ;
|
||||
sudo ldconfig ;
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
cmake_minimum_required( VERSION 2.8 )
|
||||
PROJECT( Assimp )
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build package with shared libraries." ON)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
#set(CMAKE_EXE_LINKER_FLAGS "-static")
|
||||
set(LINK_SEARCH_START_STATIC TRUE)
|
||||
endif(NOT BUILD_SHARED_LIBS)
|
||||
|
||||
# Define here the needed parameters
|
||||
set (ASSIMP_VERSION_MAJOR 3)
|
||||
set (ASSIMP_VERSION_MINOR 1)
|
||||
|
@ -88,9 +94,6 @@ SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE PATH
|
|||
|
||||
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfitx for lib, samples and tools")
|
||||
|
||||
# Allow the user to build a shared or static library
|
||||
option ( BUILD_SHARED_LIBS "Build a shared version of the library" ON )
|
||||
|
||||
# Only generate this target if no higher-level project already has
|
||||
IF (NOT TARGET uninstall)
|
||||
# add make uninstall capability
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# this one sets internal to crosscompile (in theory)
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# the minimalistic settings
|
||||
SET(CMAKE_C_COMPILER "/usr/bin/x86_64-w64-mingw32-gcc")
|
||||
SET(CMAKE_CXX_COMPILER "/usr/bin/x86_64-w64-mingw32-g++")
|
||||
SET(CMAKE_RC_COMPILER "/usr/bin/x86_64-w64-mingw32-windres")
|
||||
|
||||
# where is the target (so called staging) environment
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
|
||||
|
||||
# search for programs in the build host directories (default BOTH)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
# for libraries and headers in the target directories
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -175,6 +175,7 @@ namespace OpenGEX {
|
|||
|
||||
USE_ODDLPARSER_NS
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
OpenGEXImporter::VertexContainer::VertexContainer()
|
||||
: m_numVerts( 0 )
|
||||
, m_vertices()
|
||||
|
@ -185,6 +186,7 @@ OpenGEXImporter::VertexContainer::VertexContainer()
|
|||
// empty
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
OpenGEXImporter::VertexContainer::~VertexContainer() {
|
||||
delete[] m_vertices;
|
||||
delete[] m_normals;
|
||||
|
@ -209,6 +211,8 @@ OpenGEXImporter::RefInfo::~RefInfo() {
|
|||
//------------------------------------------------------------------------------------------------
|
||||
OpenGEXImporter::OpenGEXImporter()
|
||||
: m_meshCache()
|
||||
, m_root( NULL )
|
||||
, m_nodeChildMap()
|
||||
, m_mesh2refMap()
|
||||
, m_ctx( NULL )
|
||||
, m_currentNode( NULL )
|
||||
|
@ -259,6 +263,7 @@ void OpenGEXImporter::InternReadFile( const std::string &filename, aiScene *pSce
|
|||
|
||||
copyMeshes( pScene );
|
||||
resolveReferences();
|
||||
createNodeTree( pScene );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
@ -536,7 +541,6 @@ void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene
|
|||
m_currentMesh = new aiMesh;
|
||||
const size_t meshidx( m_meshCache.size() );
|
||||
m_meshCache.push_back( m_currentMesh );
|
||||
m_mesh2refMap[ node->getName() ] = meshidx;
|
||||
|
||||
Property *prop = node->getProperties();
|
||||
if( NULL != prop ) {
|
||||
|
@ -550,6 +554,12 @@ void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene
|
|||
}
|
||||
|
||||
handleNodes( node, pScene );
|
||||
|
||||
DDLNode *parent( node->getParent() );
|
||||
if( NULL != parent ) {
|
||||
const std::string &name = parent->getName();
|
||||
m_mesh2refMap[ name ] = meshidx;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
@ -717,6 +727,16 @@ void OpenGEXImporter::handleMaterialNode( ODDLParser::DDLNode *node, aiScene *pS
|
|||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene *pScene ) {
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene *pScene ) {
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
void OpenGEXImporter::copyMeshes( aiScene *pScene ) {
|
||||
if( m_meshCache.empty() ) {
|
||||
|
@ -745,8 +765,12 @@ void OpenGEXImporter::resolveReferences() {
|
|||
if( RefInfo::MeshRef == currentRefInfo->m_type ) {
|
||||
for( size_t i = 0; i < currentRefInfo->m_Names.size(); i++ ) {
|
||||
const std::string &name(currentRefInfo->m_Names[ i ] );
|
||||
ReferenceMap::const_iterator it( m_mesh2refMap.find( name ) );
|
||||
if( m_mesh2refMap.end() != it ) {
|
||||
unsigned int meshIdx = m_mesh2refMap[ name ];
|
||||
node->mMeshes[ i ] = meshIdx;
|
||||
//node->mNumMeshes++;
|
||||
}
|
||||
}
|
||||
} else if( RefInfo::MaterialRef == currentRefInfo->m_type ) {
|
||||
// ToDo!
|
||||
|
@ -758,13 +782,21 @@ void OpenGEXImporter::resolveReferences() {
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene *pScene ) {
|
||||
|
||||
void OpenGEXImporter::createNodeTree( aiScene *pScene ) {
|
||||
if( NULL == m_root ) {
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene *pScene ) {
|
||||
|
||||
if( m_root->m_children.empty() ) {
|
||||
return;
|
||||
}
|
||||
size_t i( 0 );
|
||||
pScene->mRootNode->mNumChildren = m_root->m_children.size();
|
||||
pScene->mRootNode->mChildren = new C_STRUCT aiNode*[ pScene->mRootNode->mNumChildren ];
|
||||
for( ChildInfo::NodeList::iterator it = m_root->m_children.begin(); it != m_root->m_children.end(); it++ ) {
|
||||
pScene->mRootNode->mChildren[ i ] = *it;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
@ -772,12 +804,30 @@ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
|
|||
ai_assert( NULL != pScene );
|
||||
|
||||
if( NULL != node ) {
|
||||
ChildInfo *info( NULL );
|
||||
if( m_nodeStack.empty() ) {
|
||||
node->mParent = pScene->mRootNode;
|
||||
NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) );
|
||||
if( m_nodeChildMap.end() == it ) {
|
||||
info = new ChildInfo;
|
||||
m_root = info;
|
||||
m_nodeChildMap[ node->mParent ] = info;
|
||||
} else {
|
||||
info = it->second;
|
||||
}
|
||||
info->m_children.push_back( node );
|
||||
} else {
|
||||
aiNode *parent( m_nodeStack.back() );
|
||||
ai_assert( NULL != parent );
|
||||
node->mParent = parent;
|
||||
NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) );
|
||||
if( m_nodeChildMap.end() == it ) {
|
||||
info = new ChildInfo;
|
||||
m_nodeChildMap[ node->mParent ] = info;
|
||||
} else {
|
||||
info = it->second;
|
||||
}
|
||||
info->m_children.push_back( node );
|
||||
}
|
||||
m_nodeStack.push_back( node );
|
||||
}
|
||||
|
|
|
@ -120,6 +120,7 @@ protected:
|
|||
aiNode *popNode();
|
||||
aiNode *top() const;
|
||||
void clearNodeStack();
|
||||
void createNodeTree( aiScene *pScene );
|
||||
|
||||
private:
|
||||
struct VertexContainer {
|
||||
|
@ -156,7 +157,16 @@ private:
|
|||
RefInfo &operator = ( const RefInfo & );
|
||||
};
|
||||
|
||||
struct ChildInfo {
|
||||
typedef std::list<aiNode*> NodeList;
|
||||
std::list<aiNode*> m_children;
|
||||
};
|
||||
ChildInfo *m_root;
|
||||
typedef std::map<aiNode*, ChildInfo*> NodeChildMap;
|
||||
NodeChildMap m_nodeChildMap;
|
||||
|
||||
std::vector<aiMesh*> m_meshCache;
|
||||
typedef std::map<std::string, size_t> ReferenceMap;
|
||||
std::map<std::string, size_t> m_mesh2refMap;
|
||||
|
||||
ODDLParser::Context *m_ctx;
|
||||
|
|
|
@ -1023,8 +1023,10 @@ void SceneCombiner::CopyScene(aiScene** _dest,const aiScene* src,bool allocate)
|
|||
dest->mFlags = src->mFlags;
|
||||
|
||||
// source private data might be NULL if the scene is user-allocated (i.e. for use with the export API)
|
||||
if (dest->mPrivate != NULL) {
|
||||
ScenePriv(dest)->mPPStepsApplied = ScenePriv(src) ? ScenePriv(src)->mPPStepsApplied : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SceneCombiner::Copy (aiMesh** _dest, const aiMesh* src)
|
||||
|
|
Loading…
Reference in New Issue