Переглянути джерело

Merge branch 'master' into Manage_PCloud_in_Filters

arkeon7 7 роки тому
батько
коміт
6cea62142c

+ 7 - 0
Build.md

@@ -0,0 +1,7 @@
+# Build instructions
+
+> cmake CMakeLists.txt
+make -j4
+
+##UWP
+See https://stackoverflow.com/questions/40803170/cmake-uwp-using-cmake-to-build-universal-windows-app

+ 6 - 6
CMakeLists.txt

@@ -210,8 +210,8 @@ ENDIF( UNIX )
 # Grouped compiler settings
 # Grouped compiler settings
 IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
 IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
   # hide all not-exported symbols
   # hide all not-exported symbols
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -std=c++0x")
-  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+  SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c++0x ${CMAKE_CXX_FLAGS}")
+  SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}")
   SET(LIBSTDC++_LIBRARIES -lstdc++)
   SET(LIBSTDC++_LIBRARIES -lstdc++)
 ELSEIF(MSVC)
 ELSEIF(MSVC)
   # enable multi-core compilation with MSVC
   # enable multi-core compilation with MSVC
@@ -224,11 +224,11 @@ ELSEIF(MSVC)
     ADD_COMPILE_OPTIONS(/wd4351)
     ADD_COMPILE_OPTIONS(/wd4351)
   ENDIF()
   ENDIF()
 ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
 ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -Wno-long-long -std=c++11" )
-  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+  SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -Wno-long-long -std=c++11 ${CMAKE_CXX_FLAGS}" )
+  SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}")
 ELSEIF( CMAKE_COMPILER_IS_MINGW )
 ELSEIF( CMAKE_COMPILER_IS_MINGW )
-  SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -std=c++11 -Wa,-mbig-obj" )
-  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC ")
+  SET( CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -std=c++11 -Wa,-mbig-obj ${CMAKE_CXX_FLAGS}" )
+  SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS} ")
   ADD_DEFINITIONS( -U__STRICT_ANSI__ )
   ADD_DEFINITIONS( -U__STRICT_ANSI__ )
 ENDIF()
 ENDIF()
 
 

+ 1 - 2
code/AssbinExporter.cpp

@@ -824,8 +824,7 @@ public:
     }
     }
 };
 };
 
 
-void ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/)
-{
+void ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/) {
     AssbinExport exporter;
     AssbinExport exporter;
     exporter.WriteBinaryDump( pFile, pIOSystem, pScene );
     exporter.WriteBinaryDump( pFile, pIOSystem, pScene );
 }
 }

+ 0 - 1
code/AssbinLoader.cpp

@@ -547,7 +547,6 @@ void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex) {
             stream->Read(tex->pcData,1,tex->mWidth*tex->mHeight*4);
             stream->Read(tex->pcData,1,tex->mWidth*tex->mHeight*4);
         }
         }
     }
     }
-
 }
 }
 
 
 // -----------------------------------------------------------------------------------
 // -----------------------------------------------------------------------------------

+ 2 - 6
code/FBXConverter.cpp

@@ -185,12 +185,8 @@ void FBXConverter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4&
                 }
                 }
 
 
                 if ( !name_carrier ) {
                 if ( !name_carrier ) {
-                    NodeNameCache::const_iterator it = mNodeNames.find(original_name);
-                    if ( it != mNodeNames.end() ) {
-                        original_name = original_name + std::string( "001" );
-                    }
-
-                    mNodeNames.insert( original_name );
+                    std::string old_original_name = original_name;
+                    GetUniqueName(old_original_name, original_name);
                     nodes_chain.push_back( new aiNode( original_name ) );
                     nodes_chain.push_back( new aiNode( original_name ) );
                 } else {
                 } else {
                     original_name = nodes_chain.back()->mName.C_Str();
                     original_name = nodes_chain.back()->mName.C_Str();

+ 1 - 1
code/FBXMeshGeometry.cpp

@@ -437,7 +437,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
     // deal with this more elegantly and with less redundancy, but right
     // deal with this more elegantly and with less redundancy, but right
     // now it seems unavoidable.
     // now it seems unavoidable.
     if (MappingInformationType == "ByVertice" && isDirect) {
     if (MappingInformationType == "ByVertice" && isDirect) {
-        if (!HasElement(source, indexDataElementName)) {
+        if (!HasElement(source, dataElementName)) {
             return;
             return;
         }
         }
         std::vector<T> tempData;
         std::vector<T> tempData;

+ 1 - 2
include/assimp/DefaultIOSystem.h

@@ -50,8 +50,7 @@ namespace Assimp    {
 
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 /** Default implementation of IOSystem using the standard C file functions */
 /** Default implementation of IOSystem using the standard C file functions */
-class ASSIMP_API DefaultIOSystem : public IOSystem
-{
+class ASSIMP_API DefaultIOSystem : public IOSystem {
 public:
 public:
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
     /** Tests for the existence of a file at the given path. */
     /** Tests for the existence of a file at the given path. */

+ 163 - 122
include/assimp/LineSplitter.h

@@ -44,11 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  @brief LineSplitter, a helper class to iterate through all lines
  *  @brief LineSplitter, a helper class to iterate through all lines
  *    of a file easily. Works with StreamReader.
  *    of a file easily. Works with StreamReader.
  */
  */
+#pragma once
 #ifndef INCLUDED_LINE_SPLITTER_H
 #ifndef INCLUDED_LINE_SPLITTER_H
 #define INCLUDED_LINE_SPLITTER_H
 #define INCLUDED_LINE_SPLITTER_H
 
 
 #include <stdexcept>
 #include <stdexcept>
-
 #include "StreamReader.h"
 #include "StreamReader.h"
 #include "ParsingUtils.h"
 #include "ParsingUtils.h"
 
 
@@ -81,164 +81,205 @@ public:
     /** construct from existing stream reader
     /** construct from existing stream reader
     note: trim is *always* assumed true if skyp_empty_lines==true
     note: trim is *always* assumed true if skyp_empty_lines==true
     */
     */
-    LineSplitter(StreamReaderLE& stream, bool skip_empty_lines = true, bool trim = true)
-    : idx( 0 )
-    , stream(stream)
-    , swallow()
-    , skip_empty_lines(skip_empty_lines)
-    , trim(trim) {
-        cur.reserve(1024);
-        operator++();
-
-        idx = 0;
-    }
-
-    ~LineSplitter() {
-        // empty
-    }
+    LineSplitter(StreamReaderLE& stream, bool skip_empty_lines = true, bool trim = true);
 
 
-public:
+    ~LineSplitter();
 
 
     // -----------------------------------------
     // -----------------------------------------
     /** pseudo-iterator increment */
     /** pseudo-iterator increment */
-    LineSplitter& operator++() {
-        if(swallow) {
-            swallow = false;
-            return *this;
-        }
-        if (!*this) {
-            throw std::logic_error("End of file, no more lines to be retrieved.");
-        }
-        char s;
-        cur.clear();
-        while(stream.GetRemainingSize() && (s = stream.GetI1(),1)) {
-            if (s == '\n' || s == '\r') {
-                if (skip_empty_lines) {
-                    while (stream.GetRemainingSize() && ((s = stream.GetI1()) == ' ' || s == '\r' || s == '\n'));
-                    if (stream.GetRemainingSize()) {
-                        stream.IncPtr(-1);
-                    }
-                }
-                else {
-                    // skip both potential line terminators but don't read past this line.
-                    if (stream.GetRemainingSize() && (s == '\r' && stream.GetI1() != '\n')) {
-                        stream.IncPtr(-1);
-                    }
-                    if (trim) {
-                        while (stream.GetRemainingSize() && ((s = stream.GetI1()) == ' ' || s == '\t'));
-                        if (stream.GetRemainingSize()) {
-                            stream.IncPtr(-1);
-                        }
-                    }
-                }
-                break;
-            }
-            cur += s;
-        }
-        ++idx;
-        return *this;
-    }
+    LineSplitter& operator++();
 
 
     // -----------------------------------------
     // -----------------------------------------
-    LineSplitter& operator++(int) {
-        return ++(*this);
-    }
+    LineSplitter& operator++(int);
 
 
     // -----------------------------------------
     // -----------------------------------------
     /** get a pointer to the beginning of a particular token */
     /** get a pointer to the beginning of a particular token */
-    const char* operator[] (size_t idx) const {
-        const char* s = operator->()->c_str();
-
-        SkipSpaces(&s);
-        for(size_t i = 0; i < idx; ++i) {
-
-            for(;!IsSpace(*s); ++s) {
-                if(IsLineEnd(*s)) {
-                    throw std::range_error("Token index out of range, EOL reached");
-                }
-            }
-            SkipSpaces(&s);
-        }
-        return s;
-    }
+    const char* operator[] (size_t idx) const;
 
 
     // -----------------------------------------
     // -----------------------------------------
     /** extract the start positions of N tokens from the current line*/
     /** extract the start positions of N tokens from the current line*/
     template <size_t N>
     template <size_t N>
-    void get_tokens(const char* (&tokens)[N]) const {
-        const char* s = operator->()->c_str();
-
-        SkipSpaces(&s);
-        for(size_t i = 0; i < N; ++i) {
-            if(IsLineEnd(*s)) {
-
-                throw std::range_error("Token count out of range, EOL reached");
-
-            }
-            tokens[i] = s;
-
-            for(;*s && !IsSpace(*s); ++s);
-            SkipSpaces(&s);
-        }
-    }
+    void get_tokens(const char* (&tokens)[N]) const;
 
 
     // -----------------------------------------
     // -----------------------------------------
     /** member access */
     /** member access */
-    const std::string* operator -> () const {
-        return &cur;
-    }
+    const std::string* operator -> () const;
 
 
-    std::string operator* () const {
-        return cur;
-    }
+    std::string operator* () const;
 
 
     // -----------------------------------------
     // -----------------------------------------
     /** boolean context */
     /** boolean context */
-    operator bool() const {
-        return stream.GetRemainingSize()>0;
-    }
+    operator bool() const;
 
 
     // -----------------------------------------
     // -----------------------------------------
     /** line indices are zero-based, empty lines are included */
     /** line indices are zero-based, empty lines are included */
-    operator line_idx() const {
-        return idx;
-    }
+    operator line_idx() const;
 
 
-    line_idx get_index() const {
-        return idx;
-    }
+    line_idx get_index() const;
 
 
     // -----------------------------------------
     // -----------------------------------------
     /** access the underlying stream object */
     /** access the underlying stream object */
-    StreamReaderLE& get_stream() {
-        return stream;
-    }
+    StreamReaderLE& get_stream();
 
 
     // -----------------------------------------
     // -----------------------------------------
     /** !strcmp((*this)->substr(0,strlen(check)),check) */
     /** !strcmp((*this)->substr(0,strlen(check)),check) */
-    bool match_start(const char* check) {
-        const size_t len = strlen(check);
-
-        return len <= cur.length() && std::equal(check,check+len,cur.begin());
-    }
-
+    bool match_start(const char* check);
 
 
     // -----------------------------------------
     // -----------------------------------------
     /** swallow the next call to ++, return the previous value. */
     /** swallow the next call to ++, return the previous value. */
-    void swallow_next_increment() {
-        swallow = true;
-    }
+    void swallow_next_increment();
 
 
-private:
-    LineSplitter( const LineSplitter & );
-    LineSplitter &operator = ( const LineSplitter & );
+    LineSplitter( const LineSplitter & ) = delete;
+    LineSplitter(LineSplitter &&) = delete;
+    LineSplitter &operator = ( const LineSplitter & ) = delete;
 
 
 private:
 private:
-    line_idx idx;
-    std::string cur;
-    StreamReaderLE& stream;
-    bool swallow, skip_empty_lines, trim;
+    line_idx mIdx;
+    std::string mCur;
+    StreamReaderLE& mStream;
+    bool mSwallow, mSkip_empty_lines, mTrim;
 };
 };
 
 
+inline
+LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_empty_lines, bool trim )
+: mIdx(0)
+, mCur()
+, mStream(stream)
+, mSwallow()
+, mSkip_empty_lines(skip_empty_lines)
+, mTrim(trim) {
+    mCur.reserve(1024);
+    operator++();
+    mIdx = 0;
+}
+
+inline
+LineSplitter::~LineSplitter() {
+    // empty
+}
+
+inline
+LineSplitter& LineSplitter::operator++() {
+    if (mSwallow) {
+        mSwallow = false;
+        return *this;
+    }
+
+    if (!*this) {
+        throw std::logic_error("End of file, no more lines to be retrieved.");
+    }
+
+    char s;
+    mCur.clear();
+    while (mStream.GetRemainingSize() && (s = mStream.GetI1(), 1)) {
+        if (s == '\n' || s == '\r') {
+            if (mSkip_empty_lines) {
+                while (mStream.GetRemainingSize() && ((s = mStream.GetI1()) == ' ' || s == '\r' || s == '\n'));
+                if (mStream.GetRemainingSize()) {
+                    mStream.IncPtr(-1);
+                }
+            } else {
+                // skip both potential line terminators but don't read past this line.
+                if (mStream.GetRemainingSize() && (s == '\r' && mStream.GetI1() != '\n')) {
+                    mStream.IncPtr(-1);
+                }
+                if (mTrim) {
+                    while (mStream.GetRemainingSize() && ((s = mStream.GetI1()) == ' ' || s == '\t'));
+                    if (mStream.GetRemainingSize()) {
+                        mStream.IncPtr(-1);
+                    }
+                }
+            }
+            break;
+        }
+        mCur += s;
+    }
+    ++mIdx;
+
+    return *this;
+}
+
+inline
+LineSplitter &LineSplitter::operator++(int) {
+    return ++(*this);
+}
+
+inline
+const char *LineSplitter::operator[] (size_t idx) const {
+    const char* s = operator->()->c_str();
+
+    SkipSpaces(&s);
+    for (size_t i = 0; i < idx; ++i) {
+
+        for (; !IsSpace(*s); ++s) {
+            if (IsLineEnd(*s)) {
+                throw std::range_error("Token index out of range, EOL reached");
+            }
+        }
+        SkipSpaces(&s);
+    }
+    return s;
+}
+
+template <size_t N>
+inline
+void LineSplitter::get_tokens(const char* (&tokens)[N]) const {
+    const char* s = operator->()->c_str();
+
+    SkipSpaces(&s);
+    for (size_t i = 0; i < N; ++i) {
+        if (IsLineEnd(*s)) {
+            throw std::range_error("Token count out of range, EOL reached");
+        }
+        tokens[i] = s;
+
+        for (; *s && !IsSpace(*s); ++s);
+        SkipSpaces(&s);
+    }
+}
+
+inline
+const std::string* LineSplitter::operator -> () const {
+    return &mCur;
+}
+
+inline
+std::string LineSplitter::operator* () const {
+    return mCur;
+}
+
+inline
+LineSplitter::operator bool() const {
+    return mStream.GetRemainingSize() > 0;
+}
+
+inline
+LineSplitter::operator line_idx() const {
+    return mIdx;
+}
+
+inline
+LineSplitter::line_idx LineSplitter::get_index() const {
+    return mIdx;
+}
+
+inline
+StreamReaderLE &LineSplitter::get_stream() {
+    return mStream;
+}
+
+inline
+bool LineSplitter::match_start(const char* check) {
+    const size_t len = ::strlen(check);
+
+    return len <= mCur.length() && std::equal(check, check + len, mCur.begin());
+}
+
+inline
+void LineSplitter::swallow_next_increment() {
+    mSwallow = true;
 }
 }
+
+} // Namespace Assimp
+
 #endif // INCLUDED_LINE_SPLITTER_H
 #endif // INCLUDED_LINE_SPLITTER_H

+ 3 - 9
include/assimp/StreamReader.h

@@ -67,16 +67,13 @@ namespace Assimp {
  *  XXX switch from unsigned int for size types to size_t? or ptrdiff_t?*/
  *  XXX switch from unsigned int for size types to size_t? or ptrdiff_t?*/
 // --------------------------------------------------------------------------------------------
 // --------------------------------------------------------------------------------------------
 template <bool SwapEndianess = false, bool RuntimeSwitch = false>
 template <bool SwapEndianess = false, bool RuntimeSwitch = false>
-class StreamReader
-{
+class StreamReader {
 public:
 public:
     // FIXME: use these data types throughout the whole library,
     // FIXME: use these data types throughout the whole library,
     // then change them to 64 bit values :-)
     // then change them to 64 bit values :-)
+    using diff = int;
+    using pos  = unsigned int;
 
 
-    typedef int diff;
-    typedef unsigned int pos;
-
-public:
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
     /** Construction from a given stream with a well-defined endianness.
     /** Construction from a given stream with a well-defined endianness.
      *
      *
@@ -111,8 +108,6 @@ public:
         delete[] buffer;
         delete[] buffer;
     }
     }
 
 
-public:
-
     // deprecated, use overloaded operator>> instead
     // deprecated, use overloaded operator>> instead
 
 
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
@@ -176,7 +171,6 @@ public:
         return Get<uint64_t>();
         return Get<uint64_t>();
     }
     }
 
 
-public:
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
     /** Get the remaining stream size (to the end of the stream) */
     /** Get the remaining stream size (to the end of the stream) */
     unsigned int GetRemainingSize() const {
     unsigned int GetRemainingSize() const {

+ 196 - 50
port/PyAssimp/pyassimp/structs.py

@@ -5,7 +5,7 @@ from ctypes import POINTER, c_void_p, c_int, c_uint, c_char, c_float, Structure,
 
 
 class Vector2D(Structure):
 class Vector2D(Structure):
     """
     """
-    See 'aiVector2D.h' for details.
+    See 'vector2.h' for details.
     """ 
     """ 
 
 
 
 
@@ -15,7 +15,7 @@ class Vector2D(Structure):
 
 
 class Matrix3x3(Structure):
 class Matrix3x3(Structure):
     """
     """
-    See 'aiMatrix3x3.h' for details.
+    See 'matrix3x3.h' for details.
     """ 
     """ 
 
 
 
 
@@ -27,7 +27,7 @@ class Matrix3x3(Structure):
 
 
 class Texel(Structure):
 class Texel(Structure):
     """
     """
-    See 'aiTexture.h' for details.
+    See 'texture.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -36,7 +36,7 @@ class Texel(Structure):
 
 
 class Color4D(Structure):
 class Color4D(Structure):
     """
     """
-    See 'aiColor4D.h' for details.
+    See 'color4.h' for details.
     """ 
     """ 
 
 
 
 
@@ -47,7 +47,7 @@ class Color4D(Structure):
 
 
 class Plane(Structure):
 class Plane(Structure):
     """
     """
-    See 'aiTypes.h' for details.
+    See 'types.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -57,7 +57,7 @@ class Plane(Structure):
 
 
 class Color3D(Structure):
 class Color3D(Structure):
     """
     """
-    See 'aiTypes.h' for details.
+    See 'types.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -67,7 +67,7 @@ class Color3D(Structure):
 
 
 class String(Structure):
 class String(Structure):
     """
     """
-    See 'aiTypes.h' for details.
+    See 'types.h' for details.
     """ 
     """ 
 
 
     MAXLEN = 1024
     MAXLEN = 1024
@@ -84,7 +84,7 @@ class String(Structure):
 
 
 class MaterialPropertyString(Structure):
 class MaterialPropertyString(Structure):
     """
     """
-    See 'aiTypes.h' for details.
+    See 'MaterialSystem.cpp' for details.
     
     
     The size of length is truncated to 4 bytes on 64-bit platforms when used as a
     The size of length is truncated to 4 bytes on 64-bit platforms when used as a
     material property (see MaterialSystem.cpp aiMaterial::AddProperty() for details).
     material property (see MaterialSystem.cpp aiMaterial::AddProperty() for details).
@@ -104,7 +104,7 @@ class MaterialPropertyString(Structure):
 
 
 class MemoryInfo(Structure):
 class MemoryInfo(Structure):
     """
     """
-    See 'aiTypes.h' for details.
+    See 'types.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -135,7 +135,7 @@ class MemoryInfo(Structure):
 
 
 class Quaternion(Structure):
 class Quaternion(Structure):
     """
     """
-    See 'aiQuaternion.h' for details.
+    See 'quaternion.h' for details.
     """ 
     """ 
 
 
 
 
@@ -146,7 +146,7 @@ class Quaternion(Structure):
 
 
 class Face(Structure):
 class Face(Structure):
     """
     """
-    See 'aiMesh.h' for details.
+    See 'mesh.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -161,7 +161,7 @@ class Face(Structure):
 
 
 class VertexWeight(Structure):
 class VertexWeight(Structure):
     """
     """
-    See 'aiMesh.h' for details.
+    See 'mesh.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -175,7 +175,7 @@ class VertexWeight(Structure):
 
 
 class Matrix4x4(Structure):
 class Matrix4x4(Structure):
     """
     """
-    See 'aiMatrix4x4.h' for details.
+    See 'matrix4x4.h' for details.
     """ 
     """ 
 
 
 
 
@@ -188,7 +188,7 @@ class Matrix4x4(Structure):
 
 
 class Vector3D(Structure):
 class Vector3D(Structure):
     """
     """
-    See 'aiVector3D.h' for details.
+    See 'vector3.h' for details.
     """ 
     """ 
 
 
 
 
@@ -198,7 +198,7 @@ class Vector3D(Structure):
 
 
 class MeshKey(Structure):
 class MeshKey(Structure):
     """
     """
-    See 'aiAnim.h' for details.
+    See 'anim.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -251,7 +251,7 @@ class Metadata(Structure):
 
 
 class Node(Structure):
 class Node(Structure):
     """
     """
-    See 'aiScene.h' for details.
+    See 'scene.h' for details.
     """ 
     """ 
 
 
 
 
@@ -296,7 +296,7 @@ Node._fields_ = [
 
 
 class Light(Structure):
 class Light(Structure):
     """
     """
-    See 'aiLight.h' for details.
+    See 'light.h' for details.
     """ 
     """ 
 
 
 
 
@@ -322,6 +322,13 @@ class Light(Structure):
             #  may be normalized, but it needn't.
             #  may be normalized, but it needn't.
             ("mDirection", Vector3D),
             ("mDirection", Vector3D),
             
             
+            # Up direction of the light source in space. Relative to the
+            #  transformation of the node corresponding to the light.
+            #
+            # The direction is undefined for point lights. The vector
+            #  may be normalized, but it needn't.
+            ("mUp", Vector3D),
+
             # Constant light attenuation factor.
             # Constant light attenuation factor.
             #  The intensity of the light source at a given distance 'd' from
             #  The intensity of the light source at a given distance 'd' from
             #  the light's position is
             #  the light's position is
@@ -393,11 +400,14 @@ class Light(Structure):
             #  interpolation between the inner and the outer cone of the
             #  interpolation between the inner and the outer cone of the
             #  spot light.
             #  spot light.
             ("mAngleOuterCone", c_float),
             ("mAngleOuterCone", c_float),
+
+            # Size of area light source.
+            ("mSize", Vector2D),
         ]
         ]
 
 
 class Texture(Structure):
 class Texture(Structure):
     """
     """
-    See 'aiTexture.h' for details.
+    See 'texture.h' for details.
     """ 
     """ 
 
 
 
 
@@ -414,16 +424,25 @@ class Texture(Structure):
             ("mHeight", c_uint),
             ("mHeight", c_uint),
             
             
             # A hint from the loader to make it easier for applications
             # A hint from the loader to make it easier for applications
-            #  to determine the type of embedded compressed textures.
-            # If mHeight != 0 this member is undefined. Otherwise it
-            # is set set to '\\0\\0\\0\\0' if the loader has no additional
+            # to determine the type of embedded textures.
+            # 
+            # If mHeight != 0 this member is show how data is packed. Hint will consist of
+            # two parts: channel order and channel bitness (count of the bits for every
+            # color channel). For simple parsing by the viewer it's better to not omit
+            # absent color channel and just use 0 for bitness. For example:
+            # 1. Image contain RGBA and 8 bit per channel, achFormatHint == "rgba8888";
+            # 2. Image contain ARGB and 8 bit per channel, achFormatHint == "argb8888";
+            # 3. Image contain RGB and 5 bit for R and B channels and 6 bit for G channel,
+            #    achFormatHint == "rgba5650";
+            # 4. One color image with B channel and 1 bit for it, achFormatHint == "rgba0010";
+            # If mHeight == 0 then achFormatHint is set set to '\\0\\0\\0\\0' if the loader has no additional
             # information about the texture file format used OR the
             # information about the texture file format used OR the
             # file extension of the format without a trailing dot. If there
             # file extension of the format without a trailing dot. If there
             # are multiple file extensions for a format, the shortest
             # are multiple file extensions for a format, the shortest
             # extension is chosen (JPEG maps to 'jpg', not to 'jpeg').
             # extension is chosen (JPEG maps to 'jpg', not to 'jpeg').
             # E.g. 'dds\\0', 'pcx\\0', 'jpg\\0'.  All characters are lower-case.
             # E.g. 'dds\\0', 'pcx\\0', 'jpg\\0'.  All characters are lower-case.
             # The fourth character will always be '\\0'.
             # The fourth character will always be '\\0'.
-            ("achFormatHint", c_char*4),
+            ("achFormatHint", c_char*9),
             
             
             # Data of the texture.
             # Data of the texture.
             # Points to an array of mWidth
             # Points to an array of mWidth
@@ -434,11 +453,15 @@ class Texture(Structure):
             # buffer of size mWidth containing the compressed texture
             # buffer of size mWidth containing the compressed texture
             # data. Good luck, have fun!
             # data. Good luck, have fun!
             ("pcData", POINTER(Texel)),
             ("pcData", POINTER(Texel)),
+
+            # Texture original filename
+            # Used to get the texture reference
+            ("mFilename", String),
         ]
         ]
 
 
 class Ray(Structure):
 class Ray(Structure):
     """
     """
-    See 'aiTypes.h' for details.
+    See 'types.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -448,7 +471,7 @@ class Ray(Structure):
 
 
 class UVTransform(Structure):
 class UVTransform(Structure):
     """
     """
-    See 'aiMaterial.h' for details.
+    See 'material.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -469,7 +492,7 @@ class UVTransform(Structure):
 
 
 class MaterialProperty(Structure):
 class MaterialProperty(Structure):
     """
     """
-    See 'aiMaterial.h' for details.
+    See 'material.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -505,7 +528,7 @@ class MaterialProperty(Structure):
 
 
 class Material(Structure):
 class Material(Structure):
     """
     """
-    See 'aiMaterial.h' for details.
+    See 'material.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -521,7 +544,7 @@ class Material(Structure):
 
 
 class Bone(Structure):
 class Bone(Structure):
     """
     """
-    See 'aiMesh.h' for details.
+    See 'mesh.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -540,20 +563,66 @@ class Bone(Structure):
             ("mOffsetMatrix", Matrix4x4),
             ("mOffsetMatrix", Matrix4x4),
         ]
         ]
 
 
-class Mesh(Structure):
+
+class AnimMesh(Structure):
     """
     """
-    See 'aiMesh.h' for details.
+    See 'mesh.h' for details.
     """ 
     """ 
 
 
-    AI_MAX_FACE_INDICES = 0x7fff
-    AI_MAX_BONE_WEIGHTS = 0x7fffffff
-    AI_MAX_VERTICES = 0x7fffffff
-    AI_MAX_FACES = 0x7fffffff
-    AI_MAX_NUMBER_OF_COLOR_SETS = 0x8
-    AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x8
+    AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x8
+    AI_MAX_NUMBER_OF_COLOR_SETS = 0x8
 
 
     _fields_ = [
     _fields_ = [
-            # Bitwise combination of the members of the
+            # Replacement for aiMesh::mVertices. If this array is non-NULL,
+            # it *must* contain mNumVertices entries. The corresponding
+            # array in the host mesh must be non-NULL as well - animation
+            # meshes may neither add or nor remove vertex components (if
+            # a replacement array is NULL and the corresponding source
+            # array is not, the source data is taken instead)
+            ("mVertices", POINTER(Vector3D)),
+
+            # Replacement for aiMesh::mNormals.
+            ("mNormals", POINTER(Vector3D)),
+
+            # Replacement for aiMesh::mTangents.
+            ("mTangents", POINTER(Vector3D)),
+
+            # Replacement for aiMesh::mBitangents.
+            ("mBitangents", POINTER(Vector3D)),
+
+            # Replacement for aiMesh::mColors
+            ("mColors", POINTER(Color4D) * AI_MAX_NUMBER_OF_COLOR_SETS),
+
+            # Replacement for aiMesh::mTextureCoords
+            ("mTextureCoords", POINTER(Vector3D) * AI_MAX_NUMBER_OF_TEXTURECOORDS),
+
+            # The number of vertices in the aiAnimMesh, and thus the length of all
+            # the member arrays.
+            #
+            # This has always the same value as the mNumVertices property in the
+            # corresponding aiMesh. It is duplicated here merely to make the length
+            # of the member arrays accessible even if the aiMesh is not known, e.g.
+            # from language bindings.
+            ("mNumVertices", c_uint),
+
+            # Weight of the AnimMesh.
+            ("mWeight", c_float),
+        ]
+
+
+class Mesh(Structure):
+    """
+    See 'mesh.h' for details.
+    """ 
+
+    AI_MAX_FACE_INDICES = 0x7fff
+    AI_MAX_BONE_WEIGHTS = 0x7fffffff
+    AI_MAX_VERTICES = 0x7fffffff
+    AI_MAX_FACES = 0x7fffffff
+    AI_MAX_NUMBER_OF_COLOR_SETS = 0x8
+    AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x8
+
+    _fields_ = [ # Bitwise combination of the members of the
             #aiPrimitiveType enum.
             #aiPrimitiveType enum.
             # This specifies which types of primitives are present in the mesh.
             # This specifies which types of primitives are present in the mesh.
             # The "SortByPrimitiveType"-Step can be used to make sure the
             # The "SortByPrimitiveType"-Step can be used to make sure the
@@ -676,17 +745,23 @@ class Mesh(Structure):
             #   - Vertex animations refer to meshes by their names.
             #   - Vertex animations refer to meshes by their names.
             ("mName", String),
             ("mName", String),
             
             
-            # NOT CURRENTLY IN USE. The number of attachment meshes
+            # The number of attachment meshes. Note! Currently only works with Collada loader.
             ("mNumAnimMeshes", c_uint),
             ("mNumAnimMeshes", c_uint),
             
             
-            # NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation.
-            #  Attachment meshes carry replacement data for some of the
-            #  mesh'es vertex components (usually positions, normals).
+            # Attachment meshes for this mesh, for vertex-based animation.
+            # Attachment meshes carry replacement data for some of the
+            # mesh'es vertex components (usually positions, normals).
+            # Note! Currently only works with Collada loader.
+            ("mAnimMesh", POINTER(POINTER(AnimMesh))),
+
+            # Method of morphing when animeshes are specified.
+            ("mMethod", c_uint),
+
         ]
         ]
 
 
 class Camera(Structure):
 class Camera(Structure):
     """
     """
-    See 'aiCamera.h' for details.
+    See 'camera.h' for details.
     """ 
     """ 
 
 
 
 
@@ -746,7 +821,7 @@ class Camera(Structure):
 
 
 class VectorKey(Structure):
 class VectorKey(Structure):
     """
     """
-    See 'aiAnim.h' for details.
+    See 'anim.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -759,7 +834,7 @@ class VectorKey(Structure):
 
 
 class QuatKey(Structure):
 class QuatKey(Structure):
     """
     """
-    See 'aiAnim.h' for details.
+    See 'anim.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -770,9 +845,27 @@ class QuatKey(Structure):
             ("mValue", Quaternion),
             ("mValue", Quaternion),
         ]
         ]
 
 
+class MeshMorphKey(Structure):
+    """
+    See 'anim.h' for details.
+    """ 
+
+    _fields_ = [
+            # The time of this key
+            ("mTime", c_double),
+
+            # The values and weights at the time of this key
+            ("mValues", POINTER(c_uint)),
+            ("mWeights", POINTER(c_double)),
+
+            # The number of values and weights
+            ("mNumValuesAndWeights", c_uint),
+
+        ]
+
 class NodeAnim(Structure):
 class NodeAnim(Structure):
     """
     """
-    See 'aiAnim.h' for details.
+    See 'anim.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -821,9 +914,48 @@ class NodeAnim(Structure):
             ("mPostState", c_uint),
             ("mPostState", c_uint),
         ]
         ]
 
 
+class MeshAnim(Structure):
+    """
+    See 'anim.h' for details.
+    """ 
+
+    _fields_ = [
+            # Name of the mesh to be animated. An empty string is not allowed,
+            #  animated meshes need to be named (not necessarily uniquely,
+            #  the name can basically serve as wild-card to select a group
+            #  of meshes with similar animation setup)
+            ("mName", String),
+
+            # Size of the #mKeys array. Must be 1, at least.
+            ("mNumKeys", c_uint),
+
+            # Key frames of the animation. May not be NULL.
+            ("mKeys", POINTER(MeshKey)),
+        ]
+
+class MeshMorphAnim(Structure):
+    """
+    See 'anim.h' for details.
+    """     
+
+    _fields_ = [
+            # Name of the mesh to be animated. An empty string is not allowed,
+            # animated meshes need to be named (not necessarily uniquely,
+            # the name can basically serve as wildcard to select a group
+            # of meshes with similar animation setup)
+            ("mName", String),
+
+            # Size of the #mKeys array. Must be 1, at least.
+            ("mNumKeys", c_uint),
+
+            # Key frames of the animation. May not be NULL.
+            ("mKeys", POINTER(MeshMorphKey)),
+        ]
+
+
 class Animation(Structure):
 class Animation(Structure):
     """
     """
-    See 'aiAnim.h' for details.
+    See 'anim.h' for details.
     """ 
     """ 
 
 
     _fields_ = [
     _fields_ = [
@@ -852,6 +984,16 @@ class Animation(Structure):
             
             
             # The mesh animation channels. Each channel affects a single mesh.
             # The mesh animation channels. Each channel affects a single mesh.
             #  The array is mNumMeshChannels in size.
             #  The array is mNumMeshChannels in size.
+            ("mMeshChannels", POINTER(POINTER(MeshAnim))),
+
+            # The number of mesh animation channels. Each channel affects
+            # a single mesh and defines morphing animation.
+            ("mNumMorphMeshChannels", c_uint),
+
+            # The morph mesh animation channels. Each channel affects a single mesh.
+            # The array is mNumMorphMeshChannels in size. 
+            ("mMorphMeshChannels", POINTER(POINTER(MeshMorphAnim))),
+
         ]
         ]
 
 
 class Scene(Structure):
 class Scene(Structure):
@@ -859,11 +1001,12 @@ class Scene(Structure):
     See 'aiScene.h' for details.
     See 'aiScene.h' for details.
     """ 
     """ 
 
 
-    AI_SCENE_FLAGS_INCOMPLETE = 0x1
-    AI_SCENE_FLAGS_VALIDATED = 0x2
-    AI_SCENE_FLAGS_VALIDATION_WARNING =  	0x4
-    AI_SCENE_FLAGS_NON_VERBOSE_FORMAT =  	0x8
-    AI_SCENE_FLAGS_TERRAIN = 0x10
+    AI_SCENE_FLAGS_INCOMPLETE = 0x1
+    AI_SCENE_FLAGS_VALIDATED = 0x2
+    AI_SCENE_FLAGS_VALIDATION_WARNING =  	0x4
+    AI_SCENE_FLAGS_NON_VERBOSE_FORMAT =  	0x8
+    AI_SCENE_FLAGS_TERRAIN = 0x10
+    AI_SCENE_FLAGS_ALLOW_SHARED = 0x20
 
 
     _fields_ = [
     _fields_ = [
             # Any combination of the AI_SCENE_FLAGS_XXX flags. By default
             # Any combination of the AI_SCENE_FLAGS_XXX flags. By default
@@ -940,6 +1083,9 @@ class Scene(Structure):
             # unit-conversions, versions, vendors or other model-specific data. This
             # unit-conversions, versions, vendors or other model-specific data. This
             # can be used to store format-specific metadata as well.
             # can be used to store format-specific metadata as well.
             ("mMetadata", POINTER(Metadata)),
             ("mMetadata", POINTER(Metadata)),
+
+            # Internal data, do not touch
+            ("mPrivate", c_char_p),
         ]
         ]
 
 
 assimp_structs_as_tuple = (Matrix4x4,
 assimp_structs_as_tuple = (Matrix4x4,

+ 4 - 2
test/CMakeLists.txt

@@ -40,8 +40,9 @@
 cmake_minimum_required( VERSION 2.6 )
 cmake_minimum_required( VERSION 2.6 )
 
 
 INCLUDE_DIRECTORIES(
 INCLUDE_DIRECTORIES(
-	../contrib/gtest/include
-	../contrib/gtest/
+	${Assimp_SOURCE_DIR}/contrib/gtest/include
+	${Assimp_SOURCE_DIR}/contrib/gtest/
+    ${Assimp_SOURCE_DIR}/test/unit
     ${Assimp_SOURCE_DIR}/include
     ${Assimp_SOURCE_DIR}/include
     ${Assimp_SOURCE_DIR}/code
     ${Assimp_SOURCE_DIR}/code
 )
 )
@@ -74,6 +75,7 @@ SET( COMMON
   unit/utProfiler.cpp
   unit/utProfiler.cpp
   unit/utSharedPPData.cpp
   unit/utSharedPPData.cpp
   unit/utStringUtils.cpp
   unit/utStringUtils.cpp
+  unit/Common/utLineSplitter.cpp
 )
 )
 
 
 SET( IMPORTERS
 SET( IMPORTERS

+ 3 - 0
test/models/ParsingFiles/linesplitter_emptyline_test.txt

@@ -0,0 +1,3 @@
+TEST
+
+the rest

+ 12 - 0
test/models/ParsingFiles/linesplitter_tokenizetest.txt

@@ -0,0 +1,12 @@
+#1= IFCORGANIZATION('GS','Graphisoft','Graphisoft',$,$);
+#5= IFCAPPLICATION(#1,'14.0','ArchiCAD 14.0','ArchiCAD');
+#6= IFCPERSON('','Haefele','Karl-Heinz',$,$,$,$,$);
+#8= IFCORGANIZATION('','KIT / IAI','',$,$);
+#12= IFCPERSONANDORGANIZATION(#6,#8,$);
+#13= IFCOWNERHISTORY(#12,#5,$,.ADDED.,$,$,$,1286451639);
+#14= IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);
+#15= IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.);
+#16= IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.);
+#17= IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
+#18= IFCMEASUREWITHUNIT(IFCPLANEANGLEMEASURE(0.017453293),#17);
+

+ 71 - 0
test/unit/Common/utLineSplitter.cpp

@@ -0,0 +1,71 @@
+/*
+---------------------------------------------------------------------------
+Open Asset Import Library (assimp)
+---------------------------------------------------------------------------
+
+Copyright (c) 2006-2018, assimp team
+
+
+
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms,
+with or without modification, are permitted provided that the following
+conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the
+following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+* Neither the name of the assimp team, nor the names of its
+contributors may be used to endorse or promote products
+derived from this software without specific prior
+written permission of the assimp team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+---------------------------------------------------------------------------
+*/
+#include "UnitTestPCH.h"
+
+#include <assimp/LineSplitter.h>
+#include <assimp/DefaultIOSystem.h>
+#include <string>
+
+using namespace Assimp;
+
+class utLineSplitter : public ::testing::Test {
+    // empty
+};
+
+TEST_F(utLineSplitter, tokenizetest) {
+    DefaultIOSystem fs;
+    IOStream* file = fs.Open(ASSIMP_TEST_MODELS_DIR"/ParsingFiles/linesplitter_tokenizetest.txt", "rb");
+
+    StreamReaderLE stream(file);
+    LineSplitter myLineSplitter(stream);
+}
+
+TEST_F( utLineSplitter, issue212Test) {
+    DefaultIOSystem fs;
+    IOStream* file = fs.Open(ASSIMP_TEST_MODELS_DIR"/ParsingFiles/linesplitter_emptyline_test.txt", "rb");
+
+    StreamReaderLE stream(file);
+    LineSplitter myLineSplitter(stream);
+    myLineSplitter++;
+    EXPECT_THROW( myLineSplitter++, std::logic_error );
+}