diff --git a/.travis.yml b/.travis.yml index b595600e7..3310b881b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,15 @@ before_install: - sudo apt-get install cmake python3 + - echo -e "#ifndef A_R_H_INC\n#define A_R_H_INC\n#define GitVersion ${TRAVIS_JOB_ID}\n#define GitBranch \"${TRAVIS_BRANCH}\"\n#endif // A_R_H_INC" > revision.h branches: only: - master env: - matrix: + global: + - PV=r8e PLATF=linux-x86_64 NDK_HOME=${TRAVIS_BUILD_DIR}/android-ndk-${PV} PATH=${PATH}:${NDK_HOME} + matrix: - LINUX=1 TRAVIS_NO_EXPORT=YES - LINUX=1 TRAVIS_NO_EXPORT=NO - LINUX=1 TRAVIS_STATIC_BUILD=ON @@ -15,6 +18,7 @@ env: - WINDOWS=1 TRAVIS_NO_EXPORT=NO - WINDOWS=1 TRAVIS_STATIC_BUILD=ON - WINDOWS=1 TRAVIS_STATIC_BUILD=OFF + - ANDROID=1 language: cpp @@ -24,8 +28,10 @@ compiler: install: - if [ $WINDOWS ]; then travis_retry sudo apt-get install -q -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64; fi + - if [ $ANDROID ]; then wget -c http://dl.google.com/android/ndk/android-ndk-${PV}-${PLATF}.tar.bz2 && tar xf android-ndk-${PV}-${PLATF}.tar.bz2 ; fi script: + - if [ $ANDROID ]; then ant -v -Dmy.dir=${TRAVIS_BUILD_DIR} -f ${TRAVIS_BUILD_DIR}/port/jassimp/build.xml ndk-jni ; fi - cmake -G "Unix Makefiles" -DASSIMP_ENABLE_BOOST_WORKAROUND=YES -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -STATIC_BUILD=$TRAVIS_STATIC_BUILD - make - sudo make install @@ -38,4 +44,3 @@ script: - echo "==========================================================" - echo "REGRESSION TEST FAILS (results/run_regression_suite_failures.csv)" - cat ../results/run_regression_suite_failures.csv - diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index 81b6b8446..dc571efad 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -122,33 +122,45 @@ namespace Grammar { } static TokenType matchTokenType( const char *tokenType ) { - if( 0 == strncmp( MetricType, tokenType, strlen( tokenType ) ) ) { + if( 0 == strncmp( MetricType, tokenType, strlen( MetricType ) ) ) { return MetricToken; - } else if( 0 == strncmp( NameType, tokenType, strlen( tokenType ) ) ) { + } else if( 0 == strncmp( NameType, tokenType, strlen( NameType ) ) ) { return NameToken; - } else if( 0 == strncmp( ObjectRefType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( ObjectRefType, tokenType, strlen( ObjectRefType ) ) ) { return ObjectRefToken; - } else if( 0 == strncmp( MaterialRefType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( MaterialRefType, tokenType, strlen( MaterialRefType ) ) ) { return MaterialRefToken; - } else if( 0 == strncmp( MetricKeyType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( MetricKeyType, tokenType, strlen( MetricKeyType ) ) ) { return MetricKeyToken; - } else if( 0 == strncmp( GeometryNodeType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( GeometryNodeType, tokenType, strlen( GeometryNodeType ) ) ) { return GeometryNodeToken; - } else if( 0 == strncmp( GeometryObjectType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( GeometryObjectType, tokenType, strlen( GeometryObjectType ) ) ) { return GeometryObjectToken; - } else if( 0 == strncmp( TransformType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( TransformType, tokenType, strlen( TransformType ) ) ) { return TransformToken; - } else if( 0 == strncmp( MeshType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( MeshType, tokenType, strlen( MeshType ) ) ) { return MeshToken; - } else if( 0 == strncmp( VertexArrayType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( VertexArrayType, tokenType, strlen( VertexArrayType ) ) ) { return VertexArrayToken; - } else if( 0 == strncmp( IndexArrayType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( IndexArrayType, tokenType, strlen( IndexArrayType ) ) ) { return IndexArrayToken; - } else if( 0 == strncmp( MaterialType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( MaterialType, tokenType, strlen( MaterialType ) ) ) { return MaterialToken; - } else if( 0 == strncmp( ColorType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( ColorType, tokenType, strlen( ColorType ) ) ) { return ColorToken; - } else if( 0 == strncmp( TextureType, tokenType, strlen( tokenType ) ) ) { + } + else if( 0 == strncmp( TextureType, tokenType, strlen( TextureType ) ) ) { return TextureToken; } @@ -181,6 +193,7 @@ OpenGEXImporter::OpenGEXImporter() , m_mesh2refMap() , m_ctx( NULL ) , m_currentNode( NULL ) +, m_currentMesh( NULL ) , m_nodeStack() , m_unresolvedRefStack() { // empty @@ -358,9 +371,10 @@ void OpenGEXImporter::handleNameNode( DDLNode *node, aiScene *pScene ) { if( NULL != val ) { if( Value::ddl_string != val->m_type ) { throw DeadlyImportError( "OpenGEX: invalid data type for value in node name." ); + return; } - std::string name( val->getString() ); + const std::string name( val->getString() ); m_currentNode->mName.Set( name.c_str() ); } } @@ -438,18 +452,147 @@ void OpenGEXImporter::handleGeometryObject( DDLNode *node, aiScene *pScene ) { } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::handleTransformNode( ODDLParser::DDLNode *node, aiScene *pScene ) { +static void setMatrix( aiNode *node, DataArrayList *transformData ) { + ai_assert( NULL != node ); + ai_assert( NULL != transformData ); + float m[ 16 ]; + size_t i( 1 ); + Value *next( transformData->m_dataList->m_next ); + m[ 0 ] = transformData->m_dataList->getFloat(); + while( next != NULL ) { + m[ i ] = next->getFloat(); + next = next->m_next; + i++; + } + + node->mTransformation.a1 = m[ 0 ]; + node->mTransformation.a2 = m[ 1 ]; + node->mTransformation.a3 = m[ 2 ]; + node->mTransformation.a4 = m[ 3 ]; + + node->mTransformation.b1 = m[ 4 ]; + node->mTransformation.b2 = m[ 5 ]; + node->mTransformation.b3 = m[ 6 ]; + node->mTransformation.b4 = m[ 7 ]; + + node->mTransformation.c1 = m[ 8 ]; + node->mTransformation.c2 = m[ 9 ]; + node->mTransformation.c3 = m[ 10 ]; + node->mTransformation.c4 = m[ 11 ]; + + node->mTransformation.d1 = m[ 12 ]; + node->mTransformation.d2 = m[ 13 ]; + node->mTransformation.d3 = m[ 14 ]; + node->mTransformation.d4 = m[ 15 ]; +} + +//------------------------------------------------------------------------------------------------ +void OpenGEXImporter::handleTransformNode( ODDLParser::DDLNode *node, aiScene *pScene ) { + if( NULL == m_currentNode ) { + throw DeadlyImportError( "No parent node for name." ); + return; + } + + + DataArrayList *transformData( node->getDataArrayList() ); + if( NULL != transformData ) { + if( transformData->m_numItems != 16 ) { + throw DeadlyImportError( "Invalid number of data for transform matrix." ); + return; + } + setMatrix( m_currentNode, transformData ); + } +} + +//------------------------------------------------------------------------------------------------ +static void propId2StdString( Property *prop, std::string &name, std::string &key ) { + name = key = ""; + if( NULL == prop ) { + return; + } + + if( NULL != prop->m_id ) { + name = prop->m_id->m_buffer; + if( Value::ddl_string == prop->m_primData->m_type ) { + key = prop->m_primData->getString(); + } + } } //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene ) { + Property *prop = node->getProperties(); + m_currentMesh = new aiMesh; + m_meshCache.push_back( m_currentMesh ); + + if( NULL != prop ) { + std::string propName, propKey; + propId2StdString( prop, propName, propKey ); + if( "triangles" == propName ) { + m_currentMesh->mPrimitiveTypes |= aiPrimitiveType_TRIANGLE; + } + } + handleNodes( node, pScene ); +} + +//------------------------------------------------------------------------------------------------ +enum MeshAttribute { + None, + Position, + Normal, + TexCoord +}; + +//------------------------------------------------------------------------------------------------ +static MeshAttribute getAttributeByName( const char *attribName ) { + ai_assert( NULL != attribName ); + + if( 0 == strncmp( "position", attribName, strlen( "position" ) ) ) { + return Position; + } else if( 0 == strncmp( "normal", attribName, strlen( "normal" ) ) ) { + return Normal; + } else if( 0 == strncmp( "texcoord", attribName, strlen( "texcoord" ) ) ) { + return TexCoord; + } + + return None; } //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene *pScene ) { + if( NULL == node ) { + throw DeadlyImportError( "No parent node for name." ); + return; + } + Property *prop( node->getProperties() ); + if( NULL != prop ) { + std::string propName, propKey; + propId2StdString( prop, propName, propKey ); + MeshAttribute attribType( getAttributeByName( propName.c_str() ) ); + if( None == attribType ) { + return; + } + + DataArrayList *vaList = node->getDataArrayList(); + if( NULL == vaList ) { + return; + } + + if( Position == attribType ) { + aiVector3D *pos = new aiVector3D[ vaList->m_numItems ]; + Value *next( vaList->m_dataList ); + for( size_t i = 0; i < vaList->m_numItems; i++ ) { + + } + } else if( Normal == attribType ) { + aiVector3D *normal = new aiVector3D[ vaList->m_numItems ]; + } else if( TexCoord == attribType ) { + aiVector3D *tex = new aiVector3D[ vaList->m_numItems ]; + } + } } //------------------------------------------------------------------------------------------------ @@ -481,6 +624,8 @@ void OpenGEXImporter::resolveReferences() { } } else if( RefInfo::MaterialRef == currentRefInfo->m_type ) { // ToDo + } else { + throw DeadlyImportError( "Unknown reference info to resolve." ); } } } diff --git a/code/OpenGEXImporter.h b/code/OpenGEXImporter.h index fe8ae1ef6..d890bde76 100644 --- a/code/OpenGEXImporter.h +++ b/code/OpenGEXImporter.h @@ -145,6 +145,7 @@ private: ODDLParser::Context *m_ctx; MetricInfo m_metrics[ MetricInfo::Max ]; aiNode *m_currentNode; + aiMesh *m_currentMesh; std::vector m_nodeStack; std::vector m_unresolvedRefStack; }; diff --git a/code/PlyLoader.cpp b/code/PlyLoader.cpp index deb7da094..f1864b0f6 100644 --- a/code/PlyLoader.cpp +++ b/code/PlyLoader.cpp @@ -74,8 +74,9 @@ namespace template const T &GetProperty(const std::vector &props, int idx) { - if (idx >= props.size()) - throw DeadlyImportError("Invalid .ply file: Property index is out of range."); + if( static_cast< size_t >( idx ) >= props.size() ) { + throw DeadlyImportError( "Invalid .ply file: Property index is out of range." ); + } return props[idx]; } diff --git a/contrib/openddlparser/code/OpenDDLParser.cpp b/contrib/openddlparser/code/OpenDDLParser.cpp index 5ff314aa5..1c9006f38 100644 --- a/contrib/openddlparser/code/OpenDDLParser.cpp +++ b/contrib/openddlparser/code/OpenDDLParser.cpp @@ -190,6 +190,8 @@ bool OpenDDLParser::parse() { normalizeBuffer( m_buffer ); + std::cout << &m_buffer[0] << std::endl; + m_context = new Context; m_context->m_root = DDLNode::create( "root", "", ddl_nullptr ); pushNode( m_context->m_root ); @@ -230,7 +232,7 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) { dumpId( id ); #endif // DEBUG_HEADER_NAME - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); Property *first( ddl_nullptr ); if( ddl_nullptr != id ) { if( *in == '(' ) { @@ -238,7 +240,7 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) { Property *prop( ddl_nullptr ), *prev( ddl_nullptr ); while( *in != ')' && in != end ) { in = OpenDDLParser::parseProperty( in, end, &prop ); - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); if( *in != ',' && *in != ')' ) { logInvalidTokenError( in, ")", m_logCallback ); @@ -288,21 +290,20 @@ char *OpenDDLParser::parseStructure( char *in, char *end ) { } bool error( false ); - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); if( *in == '{' ) { // loop over all children ( data and nodes ) do { in = parseStructureBody( in, end, error ); } while ( *in != '}' ); in++; - } - else { + } else { in++; logInvalidTokenError( in, std::string( Grammar::OpenBracketToken ), m_logCallback ); error = true; return in; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); // pop node from stack after successful parsing if( !error ) { @@ -341,18 +342,20 @@ char *OpenDDLParser::parseStructureBody( char *in, char *end, bool &error ) { in++; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); Value::ValueType type( Value::ddl_none ); size_t arrayLen( 0 ); in = OpenDDLParser::parsePrimitiveDataType( in, end, type, arrayLen ); if( Value::ddl_none != type ) { - in = getNextToken( in, end ); + // parse a primitive data type + in = lookForNextToken( in, end ); if( *in == '{' ) { Reference *refs( ddl_nullptr ); DataArrayList *dtArrayList( ddl_nullptr ); Value *values( ddl_nullptr ); if( 1 == arrayLen ) { - in = parseDataList( in, end, &values, &refs ); + size_t numRefs( 0 ), numValues( 0 ); + in = parseDataList( in, end, &values, numValues, &refs, numRefs ); setNodeValues( top(), values ); setNodeReferences( top(), refs ); } else if( arrayLen > 1 ) { @@ -364,13 +367,14 @@ char *OpenDDLParser::parseStructureBody( char *in, char *end, bool &error ) { } } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); if( *in != '}' ) { logInvalidTokenError( in, std::string( Grammar::CloseBracketToken ), m_logCallback ); } else { //in++; } } else { + // parse a complex data type in = parseNextNode( in, end ); } @@ -428,15 +432,16 @@ void OpenDDLParser::normalizeBuffer( std::vector &buffer) { for( size_t readIdx = 0; readIdx( c, end ) ) { + if( !isComment( c, end ) && !isNewLine( *c ) ) { newBuffer.push_back( buffer[ readIdx ] ); } else { - readIdx++; - // skip the comment and the rest of the line - while( !isEndofLine( buffer[ readIdx ] ) ) { + if( isComment( c, end ) ) { readIdx++; + // skip the comment and the rest of the line + while( !isEndofLine( buffer[ readIdx ] ) ) { + readIdx++; + } } - newBuffer.push_back( '\n' ); } } buffer = newBuffer; @@ -449,7 +454,7 @@ char *OpenDDLParser::parseName( char *in, char *end, Name **name ) { } // ignore blanks - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); if( *in != '$' && *in != '%' ) { return in; } @@ -479,7 +484,7 @@ char *OpenDDLParser::parseIdentifier( char *in, char *end, Identifier **id ) { } // ignore blanks - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); // staring with a number is forbidden if( isNumeric( *in ) ) { @@ -520,7 +525,7 @@ char *OpenDDLParser::parsePrimitiveDataType( char *in, char *end, Value::ValueTy } if( Value::ddl_none == type ) { - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); return in; } else { in += prim_len; @@ -581,7 +586,7 @@ char *OpenDDLParser::parseBooleanLiteral( char *in, char *end, Value **boolean ) return in; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); char *start( in ); size_t len( 0 ); while( !isSeparator( *in ) && in != end ) { @@ -616,7 +621,7 @@ char *OpenDDLParser::parseIntegerLiteral( char *in, char *end, Value **integer, return in; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); char *start( in ); while( !isSeparator( *in ) && in != end ) { in++; @@ -652,7 +657,7 @@ char *OpenDDLParser::parseFloatingLiteral( char *in, char *end, Value **floating return in; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); char *start( in ); while( !isSeparator( *in ) && in != end ) { in++; @@ -685,7 +690,7 @@ char *OpenDDLParser::parseStringLiteral( char *in, char *end, Value **stringData return in; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); size_t len( 0 ); char *start( in ); if( *start == '\"' ) { @@ -718,7 +723,7 @@ char *OpenDDLParser::parseHexaLiteral( char *in, char *end, Value **data ) { return in; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); if( *in != '0' ) { return in; } @@ -764,11 +769,11 @@ char *OpenDDLParser::parseProperty( char *in, char *end, Property **prop ) { return in; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); Identifier *id( ddl_nullptr ); in = parseIdentifier( in, end, &id ); if( ddl_nullptr != id ) { - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); if( *in == '=' ) { in++; in = getNextToken( in, end ); @@ -797,19 +802,20 @@ char *OpenDDLParser::parseProperty( char *in, char *end, Property **prop ) { return in; } -char *OpenDDLParser::parseDataList( char *in, char *end, Value **data, Reference **refs ) { +char *OpenDDLParser::parseDataList( char *in, char *end, Value **data, size_t &numValues, Reference **refs, size_t &numRefs ) { *data = ddl_nullptr; + numValues = numRefs = 0; if( ddl_nullptr == in || in == end ) { return in; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); if( *in == '{' ) { in++; Value *current( ddl_nullptr ), *prev( ddl_nullptr ); while( '}' != *in ) { current = ddl_nullptr; - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); if( isInteger( in, end ) ) { in = parseIntegerLiteral( in, end, ¤t ); } else if( isFloat( in, end ) ) { @@ -824,6 +830,7 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value **data, Reference if( !names.empty() ) { Reference *ref = new Reference( names.size(), &names[ 0 ] ); *refs = ref; + numRefs = names.size(); } } @@ -835,6 +842,7 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value **data, Reference prev->setNext( current ); prev = current; } + numValues++; } in = getNextSeparator( in, end ); @@ -854,18 +862,20 @@ char *OpenDDLParser::parseDataArrayList( char *in, char *end, DataArrayList **da return in; } - in = getNextToken( in, end ); + in = lookForNextToken( in, end ); if( *in == Grammar::OpenBracketToken[ 0 ] ) { in++; Value *current( ddl_nullptr ); Reference *refs( ddl_nullptr ); DataArrayList *prev( ddl_nullptr ), *currentDataList( ddl_nullptr ); do { - in = parseDataList( in, end, ¤t, &refs ); + size_t numRefs( 0 ), numValues( 0 ); + in = parseDataList( in, end, ¤t, numValues, &refs, numRefs ); if( ddl_nullptr != current ) { if( ddl_nullptr == prev ) { *dataList = new DataArrayList; - (*dataList)->m_dataList = current; + ( *dataList )->m_dataList = current; + ( *dataList )->m_numItems = numValues; prev = *dataList; } else { currentDataList = new DataArrayList; @@ -876,6 +886,8 @@ char *OpenDDLParser::parseDataArrayList( char *in, char *end, DataArrayList **da } } } while( ',' == *in && in != end ); + in = lookForNextToken( in, end ); + in++; } return in; diff --git a/contrib/openddlparser/include/openddlparser/OpenDDLParser.h b/contrib/openddlparser/include/openddlparser/OpenDDLParser.h index 00f2c2e58..068c028b7 100644 --- a/contrib/openddlparser/include/openddlparser/OpenDDLParser.h +++ b/contrib/openddlparser/include/openddlparser/OpenDDLParser.h @@ -43,13 +43,26 @@ struct Property; template inline -T *getNextToken( T *in, T *end ) { +T *lookForNextToken( T *in, T *end ) { while( ( isSpace( *in ) || isNewLine( *in ) || ',' == *in ) && ( in != end ) ) { in++; } return in; } +template +inline +T *getNextToken( T *in, T *end ) { + T *tmp( in ); + while( ( isSpace( *in ) || isNewLine( *in ) || ',' == *in ) && ( in != end ) ) { + in++; + } + if( tmp == in ) { + in++; + } + return in; +} + /// @brief Defines the log severity. enum LogSeverity { ddl_debug_msg = 0, ///< Debug message, for debugging @@ -96,7 +109,7 @@ public: // static parser helpers static char *parseStringLiteral( char *in, char *end, Value **stringData ); static char *parseHexaLiteral( char *in, char *end, Value **data ); static char *parseProperty( char *in, char *end, Property **prop ); - static char *parseDataList( char *in, char *end, Value **data, Reference **refs ); + static char *parseDataList( char *in, char *end, Value **data, size_t &numValues, Reference **refs, size_t &numRefs ); static char *parseDataArrayList( char *in, char *end, DataArrayList **dataList ); static const char *getVersion(); diff --git a/include/assimp/Compiler/pushpack1.h b/include/assimp/Compiler/pushpack1.h index 8bdb71293..e55202665 100644 --- a/include/assimp/Compiler/pushpack1.h +++ b/include/assimp/Compiler/pushpack1.h @@ -1,46 +1,46 @@ - - -// =============================================================================== -// May be included multiple times - sets structure packing to 1 -// for all supported compilers. #include reverts the changes. -// -// Currently this works on the following compilers: -// MSVC 7,8,9 -// GCC -// BORLAND (complains about 'pack state changed but not reverted', but works) -// Clang -// -// -// USAGE: -// -// struct StructToBePacked { -// } PACK_STRUCT; -// -// =============================================================================== - -#ifdef AI_PUSHPACK_IS_DEFINED -# error poppack1.h must be included after pushpack1.h -#endif - -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) -# pragma pack(push,1) -# define PACK_STRUCT -#elif defined( __GNUC__ ) -# if defined(__clang__) -# define PACK_STRUCT __attribute__((__packed__)) -# else -# define PACK_STRUCT __attribute__((gcc_struct, __packed__)) -# endif -#else -# error Compiler not supported -#endif - -#if defined(_MSC_VER) - -// C4103: Packing was changed after the inclusion of the header, propably missing #pragma pop -# pragma warning (disable : 4103) -#endif - -#define AI_PUSHPACK_IS_DEFINED - - + + +// =============================================================================== +// May be included multiple times - sets structure packing to 1 +// for all supported compilers. #include reverts the changes. +// +// Currently this works on the following compilers: +// MSVC 7,8,9 +// GCC +// BORLAND (complains about 'pack state changed but not reverted', but works) +// Clang +// +// +// USAGE: +// +// struct StructToBePacked { +// } PACK_STRUCT; +// +// =============================================================================== + +#ifdef AI_PUSHPACK_IS_DEFINED +# error poppack1.h must be included after pushpack1.h +#endif + +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) +# pragma pack(push,1) +# define PACK_STRUCT +#elif defined( __GNUC__ ) +# if !defined(HOST_MINGW) +# define PACK_STRUCT __attribute__((__packed__)) +# else +# define PACK_STRUCT __attribute__((gcc_struct, __packed__)) +# endif +#else +# error Compiler not supported +#endif + +#if defined(_MSC_VER) + +// C4103: Packing was changed after the inclusion of the header, propably missing #pragma pop +# pragma warning (disable : 4103) +#endif + +#define AI_PUSHPACK_IS_DEFINED + + diff --git a/port/jassimp/build.xml b/port/jassimp/build.xml index d81d1958a..1352e3ffa 100644 --- a/port/jassimp/build.xml +++ b/port/jassimp/build.xml @@ -1,45 +1,54 @@ - - - - - - - - - + + + + + + + + + - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workspaces/Android-NDK/jni/Android.mk b/workspaces/Android-NDK/jni/Android.mk new file mode 100755 index 000000000..0d9f4981d --- /dev/null +++ b/workspaces/Android-NDK/jni/Android.mk @@ -0,0 +1,124 @@ +LOCAL_PATH := $(call my-dir)/../../../ + +include $(CLEAR_VARS) +LOCAL_MODULE := assimp_static +ASSIMP_SRC_DIR = code + +FILE_LIST := $(wildcard $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/*.cpp) +FILE_LIST += $(wildcard $(LOCAL_PATH)/contrib/openddlparser/code/*.cpp) +FILE_LIST += $(wildcard $(LOCAL_PATH)/contrib/unzip/*.c) +FILE_LIST += $(wildcard $(LOCAL_PATH)/contrib/poly2tri/poly2tri/*/*.cc) + +LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) + +LOCAL_SRC_FILES += contrib/clipper/clipper.cpp \ + contrib/ConvertUTF/ConvertUTF.c \ + contrib/irrXML/irrXML.cpp + +# enables -frtti and -fexceptions +LOCAL_CPP_FEATURES := exceptions +# identifier 'nullptr' will become a keyword in C++0x [-Wc++0x-compat] +# but next breaks blender and other importer +# LOCAL_CFLAGS += -std=c++11 + +# cant be disabled? rudamentary function? +# -DASSIMP_BUILD_NO_FLIPWINDING_PROCESS \ +# +DontBuildProcess = \ + -DASSIMP_BUILD_NO_FLIPUVS_PROCESS \ + -DASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS \ + -DASSIMP_BUILD_NO_CALCTANGENTS_PROCESS \ + -DASSIMP_BUILD_NO_DEBONE_PROCESS \ + -DASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS \ + -DASSIMP_BUILD_NO_FINDINSTANCES_PROCESS \ + -DASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS \ + -DASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS \ + -DASSIMP_BUILD_NO_GENFACENORMALS_PROCESS \ + -DASSIMP_BUILD_NO_GENUVCOORDS_PROCESS \ + -DASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS \ + -DASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS \ + -DASSIMP_BUILD_NO_JOINVERTICES_PROCESS \ + -DASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS \ + -DASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS \ + -DASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS \ + -DASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS \ + -DASSIMP_BUILD_NO_REMOVEVC_PROCESS \ + -DASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS \ + -DASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS \ + -DASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS \ + -DASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS \ + -DASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS \ + -DASSIMP_BUILD_NO_TRIANGULATE_PROCESS \ + -DASSIMP_BUILD_NO_VALIDATEDS_PROCESS + +DontBuildImporters = \ + -DASSIMP_BUILD_NO_X_IMPORTER \ + -DASSIMP_BUILD_NO_3DS_IMPORTER \ + -DASSIMP_BUILD_NO_MD3_IMPORTER \ + -DASSIMP_BUILD_NO_MDL_IMPORTER \ + -DASSIMP_BUILD_NO_MD2_IMPORTER \ + -DASSIMP_BUILD_NO_PLY_IMPORTER \ + -DASSIMP_BUILD_NO_ASE_IMPORTER \ + -DASSIMP_BUILD_NO_HMP_IMPORTER \ + -DASSIMP_BUILD_NO_SMD_IMPORTER \ + -DASSIMP_BUILD_NO_MDC_IMPORTER \ + -DASSIMP_BUILD_NO_MD5_IMPORTER \ + -DASSIMP_BUILD_NO_STL_IMPORTER \ + -DASSIMP_BUILD_NO_LWO_IMPORTER \ + -DASSIMP_BUILD_NO_DXF_IMPORTER \ + -DASSIMP_BUILD_NO_NFF_IMPORTER \ + -DASSIMP_BUILD_NO_RAW_IMPORTER \ + -DASSIMP_BUILD_NO_OFF_IMPORTER \ + -DASSIMP_BUILD_NO_AC_IMPORTER \ + -DASSIMP_BUILD_NO_BVH_IMPORTER \ + -DASSIMP_BUILD_NO_IRRMESH_IMPORTER \ + -DASSIMP_BUILD_NO_IRR_IMPORTER \ + -DASSIMP_BUILD_NO_Q3D_IMPORTER \ + -DASSIMP_BUILD_NO_B3D_IMPORTER \ + -DASSIMP_BUILD_NO_COLLADA_IMPORTER \ + -DASSIMP_BUILD_NO_TERRAGEN_IMPORTER \ + -DASSIMP_BUILD_NO_CSM_IMPORTER \ + -DASSIMP_BUILD_NO_3D_IMPORTER \ + -DASSIMP_BUILD_NO_LWS_IMPORTER \ + -DASSIMP_BUILD_NO_OGRE_IMPORTER \ + -DASSIMP_BUILD_NO_MS3D_IMPORTER \ + -DASSIMP_BUILD_NO_COB_IMPORTER \ + -DASSIMP_BUILD_NO_Q3BSP_IMPORTER \ + -DASSIMP_BUILD_NO_NDO_IMPORTER \ + -DASSIMP_BUILD_NO_IFC_IMPORTER \ + -DASSIMP_BUILD_NO_XGL_IMPORTER \ + -DASSIMP_BUILD_NO_FBX_IMPORTER \ + -DASSIMP_BUILD_NO_C4D_IMPORTER \ + -DASSIMP_BUILD_NO_OPENGEX_IMPORTER \ + -DASSIMP_BUILD_NO_ASSBIN_IMPORTER +# -DASSIMP_BUILD_NO_BLEND_IMPORTER \ +# -DASSIMP_BUILD_NO_GEO_IMPORTER +# -DASSIMP_BUILD_NO_OBJ_IMPORTER \ +# +DontBuildImporters := -DASSIMP_BUILD_NO_IFC_IMPORTER -DASSIMP_BUILD_NO_IRRMESH_IMPORTER -DASSIMP_BUILD_NO_IRR_IMPORTER -DASSIMP_BUILD_NO_C4D_IMPORTER + +ASSIMP_FLAGS_3_0 = -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_BUILD_BOOST_WORKAROUND -Dassimp_EXPORTS -fPIC -fvisibility=hidden -Wall +ASSIMP_FLAGS_3_1 = $(ASSIMP_FLAGS_3_0) # -DASSIMP_BUILD_BLENDER_DEBUG + +LOCAL_CFLAGS += $(ASSIMP_FLAGS_3_1) -DASSIMP_BUILD_NO_EXPORT -DOPENDDL_NO_USE_CPP11 $(DontBuildImporters) # $(DontBuildProcess) + +LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/BoostWorkaround $(LOCAL_PATH)/contrib/openddlparser/include ./ +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/BoostWorkaround + +include $(BUILD_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := assimp + +LOCAL_CFLAGS += -UASSIMP_BUILD_DLL_EXPORT +LOCAL_WHOLE_STATIC_LIBRARIES = assimp_static + +LOCAL_LDLIBS := -lz + +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/BoostWorkaround +include $(BUILD_SHARED_LIBRARY) + +-include $(LOCAL_PATH)/assimp_cmd.mk + +# let it on original place +include $(LOCAL_PATH)/port/jassimp/jassimp-native/Android.mk diff --git a/workspaces/Android-NDK/jni/Application.mk b/workspaces/Android-NDK/jni/Application.mk new file mode 100755 index 000000000..3d264db1b --- /dev/null +++ b/workspaces/Android-NDK/jni/Application.mk @@ -0,0 +1,8 @@ +ifeq ($(CC),clang) + NDK_TOOLCHAIN_VERSION := $(CC) + $(info "Use llvm Compiler") +endif + +APP_ABI := armeabi-v7a + +APP_STL := stlport_static