Merge branch 'master' into Manage_PCloud_in_Filters
commit
6cea62142c
|
@ -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
|
|
@ -210,8 +210,8 @@ ENDIF( UNIX )
|
|||
# Grouped compiler settings
|
||||
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
|
||||
# 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++)
|
||||
ELSEIF(MSVC)
|
||||
# enable multi-core compilation with MSVC
|
||||
|
@ -224,11 +224,11 @@ ELSEIF(MSVC)
|
|||
ADD_COMPILE_OPTIONS(/wd4351)
|
||||
ENDIF()
|
||||
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 )
|
||||
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__ )
|
||||
ENDIF()
|
||||
|
||||
|
|
|
@ -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;
|
||||
exporter.WriteBinaryDump( pFile, pIOSystem, pScene );
|
||||
}
|
||||
|
|
|
@ -547,7 +547,6 @@ void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex) {
|
|||
stream->Read(tex->pcData,1,tex->mWidth*tex->mHeight*4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
|
|
@ -185,12 +185,8 @@ void FBXConverter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4&
|
|||
}
|
||||
|
||||
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 ) );
|
||||
} else {
|
||||
original_name = nodes_chain.back()->mName.C_Str();
|
||||
|
|
|
@ -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
|
||||
// now it seems unavoidable.
|
||||
if (MappingInformationType == "ByVertice" && isDirect) {
|
||||
if (!HasElement(source, indexDataElementName)) {
|
||||
if (!HasElement(source, dataElementName)) {
|
||||
return;
|
||||
}
|
||||
std::vector<T> tempData;
|
||||
|
|
|
@ -50,8 +50,7 @@ namespace Assimp {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Default implementation of IOSystem using the standard C file functions */
|
||||
class ASSIMP_API DefaultIOSystem : public IOSystem
|
||||
{
|
||||
class ASSIMP_API DefaultIOSystem : public IOSystem {
|
||||
public:
|
||||
// -------------------------------------------------------------------
|
||||
/** Tests for the existence of a file at the given path. */
|
||||
|
|
|
@ -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
|
||||
* of a file easily. Works with StreamReader.
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef INCLUDED_LINE_SPLITTER_H
|
||||
#define INCLUDED_LINE_SPLITTER_H
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "StreamReader.h"
|
||||
#include "ParsingUtils.h"
|
||||
|
||||
|
@ -81,72 +81,131 @@ public:
|
|||
/** construct from existing stream reader
|
||||
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++();
|
||||
LineSplitter(StreamReaderLE& stream, bool skip_empty_lines = true, bool trim = true);
|
||||
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
~LineSplitter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
public:
|
||||
~LineSplitter();
|
||||
|
||||
// -----------------------------------------
|
||||
/** pseudo-iterator increment */
|
||||
LineSplitter& operator++() {
|
||||
if(swallow) {
|
||||
swallow = false;
|
||||
LineSplitter& operator++();
|
||||
|
||||
// -----------------------------------------
|
||||
LineSplitter& operator++(int);
|
||||
|
||||
// -----------------------------------------
|
||||
/** get a pointer to the beginning of a particular token */
|
||||
const char* operator[] (size_t idx) const;
|
||||
|
||||
// -----------------------------------------
|
||||
/** extract the start positions of N tokens from the current line*/
|
||||
template <size_t N>
|
||||
void get_tokens(const char* (&tokens)[N]) const;
|
||||
|
||||
// -----------------------------------------
|
||||
/** member access */
|
||||
const std::string* operator -> () const;
|
||||
|
||||
std::string operator* () const;
|
||||
|
||||
// -----------------------------------------
|
||||
/** boolean context */
|
||||
operator bool() const;
|
||||
|
||||
// -----------------------------------------
|
||||
/** line indices are zero-based, empty lines are included */
|
||||
operator line_idx() const;
|
||||
|
||||
line_idx get_index() const;
|
||||
|
||||
// -----------------------------------------
|
||||
/** access the underlying stream object */
|
||||
StreamReaderLE& get_stream();
|
||||
|
||||
// -----------------------------------------
|
||||
/** !strcmp((*this)->substr(0,strlen(check)),check) */
|
||||
bool match_start(const char* check);
|
||||
|
||||
// -----------------------------------------
|
||||
/** swallow the next call to ++, return the previous value. */
|
||||
void swallow_next_increment();
|
||||
|
||||
LineSplitter( const LineSplitter & ) = delete;
|
||||
LineSplitter(LineSplitter &&) = delete;
|
||||
LineSplitter &operator = ( const LineSplitter & ) = delete;
|
||||
|
||||
private:
|
||||
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;
|
||||
cur.clear();
|
||||
while(stream.GetRemainingSize() && (s = stream.GetI1(),1)) {
|
||||
mCur.clear();
|
||||
while (mStream.GetRemainingSize() && (s = mStream.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);
|
||||
if (mSkip_empty_lines) {
|
||||
while (mStream.GetRemainingSize() && ((s = mStream.GetI1()) == ' ' || s == '\r' || s == '\n'));
|
||||
if (mStream.GetRemainingSize()) {
|
||||
mStream.IncPtr(-1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} 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 (mStream.GetRemainingSize() && (s == '\r' && mStream.GetI1() != '\n')) {
|
||||
mStream.IncPtr(-1);
|
||||
}
|
||||
if (trim) {
|
||||
while (stream.GetRemainingSize() && ((s = stream.GetI1()) == ' ' || s == '\t'));
|
||||
if (stream.GetRemainingSize()) {
|
||||
stream.IncPtr(-1);
|
||||
if (mTrim) {
|
||||
while (mStream.GetRemainingSize() && ((s = mStream.GetI1()) == ' ' || s == '\t'));
|
||||
if (mStream.GetRemainingSize()) {
|
||||
mStream.IncPtr(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
cur += s;
|
||||
mCur += s;
|
||||
}
|
||||
++idx;
|
||||
++mIdx;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
LineSplitter& operator++(int) {
|
||||
inline
|
||||
LineSplitter &LineSplitter::operator++(int) {
|
||||
return ++(*this);
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
/** get a pointer to the beginning of a particular token */
|
||||
const char* operator[] (size_t idx) const {
|
||||
inline
|
||||
const char *LineSplitter::operator[] (size_t idx) const {
|
||||
const char* s = operator->()->c_str();
|
||||
|
||||
SkipSpaces(&s);
|
||||
|
@ -162,18 +221,15 @@ public:
|
|||
return s;
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
/** extract the start positions of N tokens from the current line*/
|
||||
template <size_t N>
|
||||
void get_tokens(const char* (&tokens)[N]) const {
|
||||
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;
|
||||
|
||||
|
@ -182,63 +238,48 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
/** member access */
|
||||
const std::string* operator -> () const {
|
||||
return &cur;
|
||||
inline
|
||||
const std::string* LineSplitter::operator -> () const {
|
||||
return &mCur;
|
||||
}
|
||||
|
||||
std::string operator* () const {
|
||||
return cur;
|
||||
inline
|
||||
std::string LineSplitter::operator* () const {
|
||||
return mCur;
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
/** boolean context */
|
||||
operator bool() const {
|
||||
return stream.GetRemainingSize()>0;
|
||||
inline
|
||||
LineSplitter::operator bool() const {
|
||||
return mStream.GetRemainingSize() > 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
/** line indices are zero-based, empty lines are included */
|
||||
operator line_idx() const {
|
||||
return idx;
|
||||
inline
|
||||
LineSplitter::operator line_idx() const {
|
||||
return mIdx;
|
||||
}
|
||||
|
||||
line_idx get_index() const {
|
||||
return idx;
|
||||
inline
|
||||
LineSplitter::line_idx LineSplitter::get_index() const {
|
||||
return mIdx;
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
/** access the underlying stream object */
|
||||
StreamReaderLE& get_stream() {
|
||||
return stream;
|
||||
inline
|
||||
StreamReaderLE &LineSplitter::get_stream() {
|
||||
return mStream;
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
/** !strcmp((*this)->substr(0,strlen(check)),check) */
|
||||
bool match_start(const char* check) {
|
||||
const size_t len = strlen(check);
|
||||
inline
|
||||
bool LineSplitter::match_start(const char* check) {
|
||||
const size_t len = ::strlen(check);
|
||||
|
||||
return len <= cur.length() && std::equal(check,check+len,cur.begin());
|
||||
return len <= mCur.length() && std::equal(check, check + len, mCur.begin());
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------
|
||||
/** swallow the next call to ++, return the previous value. */
|
||||
void swallow_next_increment() {
|
||||
swallow = true;
|
||||
inline
|
||||
void LineSplitter::swallow_next_increment() {
|
||||
mSwallow = true;
|
||||
}
|
||||
|
||||
private:
|
||||
LineSplitter( const LineSplitter & );
|
||||
LineSplitter &operator = ( const LineSplitter & );
|
||||
} // Namespace Assimp
|
||||
|
||||
private:
|
||||
line_idx idx;
|
||||
std::string cur;
|
||||
StreamReaderLE& stream;
|
||||
bool swallow, skip_empty_lines, trim;
|
||||
};
|
||||
|
||||
}
|
||||
#endif // INCLUDED_LINE_SPLITTER_H
|
||||
|
|
|
@ -67,16 +67,13 @@ namespace Assimp {
|
|||
* XXX switch from unsigned int for size types to size_t? or ptrdiff_t?*/
|
||||
// --------------------------------------------------------------------------------------------
|
||||
template <bool SwapEndianess = false, bool RuntimeSwitch = false>
|
||||
class StreamReader
|
||||
{
|
||||
class StreamReader {
|
||||
public:
|
||||
// FIXME: use these data types throughout the whole library,
|
||||
// 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.
|
||||
*
|
||||
|
@ -111,8 +108,6 @@ public:
|
|||
delete[] buffer;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// deprecated, use overloaded operator>> instead
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
@ -176,7 +171,6 @@ public:
|
|||
return Get<uint64_t>();
|
||||
}
|
||||
|
||||
public:
|
||||
// ---------------------------------------------------------------------
|
||||
/** Get the remaining stream size (to the end of the stream) */
|
||||
unsigned int GetRemainingSize() const {
|
||||
|
|
|
@ -5,7 +5,7 @@ from ctypes import POINTER, c_void_p, c_int, c_uint, c_char, c_float, Structure,
|
|||
|
||||
class Vector2D(Structure):
|
||||
"""
|
||||
See 'aiVector2D.h' for details.
|
||||
See 'vector2.h' for details.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ class Vector2D(Structure):
|
|||
|
||||
class Matrix3x3(Structure):
|
||||
"""
|
||||
See 'aiMatrix3x3.h' for details.
|
||||
See 'matrix3x3.h' for details.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ class Matrix3x3(Structure):
|
|||
|
||||
class Texel(Structure):
|
||||
"""
|
||||
See 'aiTexture.h' for details.
|
||||
See 'texture.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -36,7 +36,7 @@ class Texel(Structure):
|
|||
|
||||
class Color4D(Structure):
|
||||
"""
|
||||
See 'aiColor4D.h' for details.
|
||||
See 'color4.h' for details.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ class Color4D(Structure):
|
|||
|
||||
class Plane(Structure):
|
||||
"""
|
||||
See 'aiTypes.h' for details.
|
||||
See 'types.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -57,7 +57,7 @@ class Plane(Structure):
|
|||
|
||||
class Color3D(Structure):
|
||||
"""
|
||||
See 'aiTypes.h' for details.
|
||||
See 'types.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -67,7 +67,7 @@ class Color3D(Structure):
|
|||
|
||||
class String(Structure):
|
||||
"""
|
||||
See 'aiTypes.h' for details.
|
||||
See 'types.h' for details.
|
||||
"""
|
||||
|
||||
MAXLEN = 1024
|
||||
|
@ -84,7 +84,7 @@ class String(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
|
||||
material property (see MaterialSystem.cpp aiMaterial::AddProperty() for details).
|
||||
|
@ -104,7 +104,7 @@ class MaterialPropertyString(Structure):
|
|||
|
||||
class MemoryInfo(Structure):
|
||||
"""
|
||||
See 'aiTypes.h' for details.
|
||||
See 'types.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -135,7 +135,7 @@ class MemoryInfo(Structure):
|
|||
|
||||
class Quaternion(Structure):
|
||||
"""
|
||||
See 'aiQuaternion.h' for details.
|
||||
See 'quaternion.h' for details.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -146,7 +146,7 @@ class Quaternion(Structure):
|
|||
|
||||
class Face(Structure):
|
||||
"""
|
||||
See 'aiMesh.h' for details.
|
||||
See 'mesh.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -161,7 +161,7 @@ class Face(Structure):
|
|||
|
||||
class VertexWeight(Structure):
|
||||
"""
|
||||
See 'aiMesh.h' for details.
|
||||
See 'mesh.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -175,7 +175,7 @@ class VertexWeight(Structure):
|
|||
|
||||
class Matrix4x4(Structure):
|
||||
"""
|
||||
See 'aiMatrix4x4.h' for details.
|
||||
See 'matrix4x4.h' for details.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -188,7 +188,7 @@ class Matrix4x4(Structure):
|
|||
|
||||
class Vector3D(Structure):
|
||||
"""
|
||||
See 'aiVector3D.h' for details.
|
||||
See 'vector3.h' for details.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -198,7 +198,7 @@ class Vector3D(Structure):
|
|||
|
||||
class MeshKey(Structure):
|
||||
"""
|
||||
See 'aiAnim.h' for details.
|
||||
See 'anim.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -251,7 +251,7 @@ class Metadata(Structure):
|
|||
|
||||
class Node(Structure):
|
||||
"""
|
||||
See 'aiScene.h' for details.
|
||||
See 'scene.h' for details.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -296,7 +296,7 @@ Node._fields_ = [
|
|||
|
||||
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.
|
||||
("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.
|
||||
# The intensity of the light source at a given distance 'd' from
|
||||
# the light's position is
|
||||
|
@ -393,11 +400,14 @@ class Light(Structure):
|
|||
# interpolation between the inner and the outer cone of the
|
||||
# spot light.
|
||||
("mAngleOuterCone", c_float),
|
||||
|
||||
# Size of area light source.
|
||||
("mSize", Vector2D),
|
||||
]
|
||||
|
||||
class Texture(Structure):
|
||||
"""
|
||||
See 'aiTexture.h' for details.
|
||||
See 'texture.h' for details.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -414,16 +424,25 @@ class Texture(Structure):
|
|||
("mHeight", c_uint),
|
||||
|
||||
# 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
|
||||
# file extension of the format without a trailing dot. If there
|
||||
# are multiple file extensions for a format, the shortest
|
||||
# extension is chosen (JPEG maps to 'jpg', not to 'jpeg').
|
||||
# E.g. 'dds\\0', 'pcx\\0', 'jpg\\0'. All characters are lower-case.
|
||||
# The fourth character will always be '\\0'.
|
||||
("achFormatHint", c_char*4),
|
||||
("achFormatHint", c_char*9),
|
||||
|
||||
# Data of the texture.
|
||||
# Points to an array of mWidth
|
||||
|
@ -434,11 +453,15 @@ class Texture(Structure):
|
|||
# buffer of size mWidth containing the compressed texture
|
||||
# data. Good luck, have fun!
|
||||
("pcData", POINTER(Texel)),
|
||||
|
||||
# Texture original filename
|
||||
# Used to get the texture reference
|
||||
("mFilename", String),
|
||||
]
|
||||
|
||||
class Ray(Structure):
|
||||
"""
|
||||
See 'aiTypes.h' for details.
|
||||
See 'types.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -448,7 +471,7 @@ class Ray(Structure):
|
|||
|
||||
class UVTransform(Structure):
|
||||
"""
|
||||
See 'aiMaterial.h' for details.
|
||||
See 'material.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -469,7 +492,7 @@ class UVTransform(Structure):
|
|||
|
||||
class MaterialProperty(Structure):
|
||||
"""
|
||||
See 'aiMaterial.h' for details.
|
||||
See 'material.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -505,7 +528,7 @@ class MaterialProperty(Structure):
|
|||
|
||||
class Material(Structure):
|
||||
"""
|
||||
See 'aiMaterial.h' for details.
|
||||
See 'material.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -521,7 +544,7 @@ class Material(Structure):
|
|||
|
||||
class Bone(Structure):
|
||||
"""
|
||||
See 'aiMesh.h' for details.
|
||||
See 'mesh.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -540,9 +563,56 @@ class Bone(Structure):
|
|||
("mOffsetMatrix", Matrix4x4),
|
||||
]
|
||||
|
||||
|
||||
class AnimMesh(Structure):
|
||||
"""
|
||||
See 'mesh.h' for details.
|
||||
"""
|
||||
|
||||
AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x8
|
||||
AI_MAX_NUMBER_OF_COLOR_SETS = 0x8
|
||||
|
||||
_fields_ = [
|
||||
# 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 'aiMesh.h' for details.
|
||||
See 'mesh.h' for details.
|
||||
"""
|
||||
|
||||
AI_MAX_FACE_INDICES = 0x7fff
|
||||
|
@ -552,8 +622,7 @@ class Mesh(Structure):
|
|||
AI_MAX_NUMBER_OF_COLOR_SETS = 0x8
|
||||
AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x8
|
||||
|
||||
_fields_ = [
|
||||
# Bitwise combination of the members of the
|
||||
_fields_ = [ # Bitwise combination of the members of the
|
||||
#aiPrimitiveType enum.
|
||||
# This specifies which types of primitives are present in the mesh.
|
||||
# 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.
|
||||
("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),
|
||||
|
||||
# NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation.
|
||||
# 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):
|
||||
"""
|
||||
See 'aiCamera.h' for details.
|
||||
See 'camera.h' for details.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -746,7 +821,7 @@ class Camera(Structure):
|
|||
|
||||
class VectorKey(Structure):
|
||||
"""
|
||||
See 'aiAnim.h' for details.
|
||||
See 'anim.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -759,7 +834,7 @@ class VectorKey(Structure):
|
|||
|
||||
class QuatKey(Structure):
|
||||
"""
|
||||
See 'aiAnim.h' for details.
|
||||
See 'anim.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -770,9 +845,27 @@ class QuatKey(Structure):
|
|||
("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):
|
||||
"""
|
||||
See 'aiAnim.h' for details.
|
||||
See 'anim.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -821,9 +914,48 @@ class NodeAnim(Structure):
|
|||
("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):
|
||||
"""
|
||||
See 'aiAnim.h' for details.
|
||||
See 'anim.h' for details.
|
||||
"""
|
||||
|
||||
_fields_ = [
|
||||
|
@ -852,6 +984,16 @@ class Animation(Structure):
|
|||
|
||||
# The mesh animation channels. Each channel affects a single mesh.
|
||||
# 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):
|
||||
|
@ -864,6 +1006,7 @@ class Scene(Structure):
|
|||
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_ = [
|
||||
# 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
|
||||
# can be used to store format-specific metadata as well.
|
||||
("mMetadata", POINTER(Metadata)),
|
||||
|
||||
# Internal data, do not touch
|
||||
("mPrivate", c_char_p),
|
||||
]
|
||||
|
||||
assimp_structs_as_tuple = (Matrix4x4,
|
||||
|
|
|
@ -40,8 +40,9 @@
|
|||
cmake_minimum_required( VERSION 2.6 )
|
||||
|
||||
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}/code
|
||||
)
|
||||
|
@ -74,6 +75,7 @@ SET( COMMON
|
|||
unit/utProfiler.cpp
|
||||
unit/utSharedPPData.cpp
|
||||
unit/utStringUtils.cpp
|
||||
unit/Common/utLineSplitter.cpp
|
||||
)
|
||||
|
||||
SET( IMPORTERS
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
TEST
|
||||
|
||||
the rest
|
|
@ -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);
|
||||
|
|
@ -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 );
|
||||
}
|
Loading…
Reference in New Issue