Merge branch 'master' into import_amf

This commit is contained in:
Alexandr Arutjunov
2016-09-28 17:51:59 +03:00
16 changed files with 5571 additions and 81 deletions

View File

@@ -443,7 +443,8 @@ ADD_ASSIMP_IMPORTER( BLEND
ADD_ASSIMP_IMPORTER( IFC
IFCLoader.cpp
IFCLoader.h
IFCReaderGen.cpp
IFCReaderGen1.cpp
IFCReaderGen2.cpp
IFCReaderGen.h
IFCUtil.h
IFCUtil.cpp

3168
code/IFCReaderGen1.cpp Normal file

File diff suppressed because it is too large Load Diff

1917
code/IFCReaderGen2.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -50,6 +50,10 @@ OpenGEXExporter::OpenGEXExporter() {
OpenGEXExporter::~OpenGEXExporter() {
}
bool OpenGEXExporter::exportScene( const char *filename, const aiScene* pScene ) {
return true;
}
#endif // ASSIMP_BUILD_NO_OPENGEX_EXPORTER
} // Namespace OpenGEX

View File

@@ -223,17 +223,19 @@ static void propId2StdString( Property *prop, std::string &name, std::string &ke
OpenGEXImporter::VertexContainer::VertexContainer()
: m_numVerts( 0 )
, m_vertices( nullptr )
, m_numColors( 0 )
, m_colors( nullptr )
, m_numNormals( 0 )
, m_normals( nullptr )
, m_numUVComps()
, m_textureCoords()
{
, m_textureCoords() {
// empty
}
//------------------------------------------------------------------------------------------------
OpenGEXImporter::VertexContainer::~VertexContainer() {
delete[] m_vertices;
delete[] m_colors;
delete[] m_normals;
for(auto &texcoords : m_textureCoords) {
@@ -279,7 +281,7 @@ OpenGEXImporter::OpenGEXImporter()
//------------------------------------------------------------------------------------------------
OpenGEXImporter::~OpenGEXImporter() {
m_ctx = NULL;
m_ctx = nullptr;
}
//------------------------------------------------------------------------------------------------
@@ -464,13 +466,13 @@ void OpenGEXImporter::handleMetricNode( DDLNode *node, aiScene *pScene ) {
//------------------------------------------------------------------------------------------------
void OpenGEXImporter::handleNameNode( DDLNode *node, aiScene *pScene ) {
if( NULL == m_currentNode ) {
if( nullptr == m_currentNode ) {
throw DeadlyImportError( "No current node for name." );
return;
}
Value *val( node->getValue() );
if( NULL != val ) {
if( nullptr != val ) {
if( Value::ddl_string != val->m_type ) {
throw DeadlyImportError( "OpenGEX: invalid data type for value in node name." );
return;
@@ -488,7 +490,7 @@ void OpenGEXImporter::handleNameNode( DDLNode *node, aiScene *pScene ) {
//------------------------------------------------------------------------------------------------
static void getRefNames( DDLNode *node, std::vector<std::string> &names ) {
ai_assert( NULL != node );
ai_assert( nullptr != node );
Reference *ref = node->getReferences();
if( nullptr != ref ) {
@@ -710,6 +712,7 @@ void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene
enum MeshAttribute {
None,
Position,
Color,
Normal,
TexCoord
};
@@ -718,8 +721,10 @@ enum MeshAttribute {
static MeshAttribute getAttributeByName( const char *attribName ) {
ai_assert( nullptr != attribName );
if( 0 == strncmp( "position", attribName, strlen( "position" ) ) ) {
if ( 0 == strncmp( "position", attribName, strlen( "position" ) ) ) {
return Position;
} else if ( 0 == strncmp( "color", attribName, strlen( "color" ) ) ) {
return Color;
} else if( 0 == strncmp( "normal", attribName, strlen( "normal" ) ) ) {
return Normal;
} else if( 0 == strncmp( "texcoord", attribName, strlen( "texcoord" ) ) ) {
@@ -747,6 +752,22 @@ static void fillVector3( aiVector3D *vec3, Value *vals ) {
vec3->Set( x, y, z );
}
//------------------------------------------------------------------------------------------------
static void fillColor4( aiColor4D *col4, Value *vals ) {
ai_assert( nullptr != col4 );
ai_assert( nullptr != vals );
float r( 0.0f ), g( 0.0f ), b( 0.0f ), a ( 1.0f );
Value *next( vals );
col4->r = next->getFloat();
next = next->m_next;
col4->g = next->getFloat();
next = next->m_next;
col4->b = next->getFloat();
next = next->m_next;
col4->a = next->getFloat();
}
//------------------------------------------------------------------------------------------------
static size_t countDataArrayListItems( DataArrayList *vaList ) {
size_t numItems( 0 );
@@ -774,6 +795,14 @@ static void copyVectorArray( size_t numItems, DataArrayList *vaList, aiVector3D
}
}
//------------------------------------------------------------------------------------------------
static void copyColor4DArray( size_t numItems, DataArrayList *vaList, aiColor4D *colArray ) {
for ( size_t i = 0; i < numItems; i++ ) {
Value *next( vaList->m_dataList );
fillColor4( &colArray[ i ], next );
}
}
//------------------------------------------------------------------------------------------------
void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene *pScene ) {
if( nullptr == node ) {
@@ -801,6 +830,10 @@ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene
m_currentVertices.m_numVerts = numItems;
m_currentVertices.m_vertices = new aiVector3D[ numItems ];
copyVectorArray( numItems, vaList, m_currentVertices.m_vertices );
} else if ( Color == attribType ) {
m_currentVertices.m_numColors = numItems;
m_currentVertices.m_colors = new aiColor4D[ numItems ];
copyColor4DArray( numItems, vaList, m_currentVertices.m_colors );
} else if( Normal == attribType ) {
m_currentVertices.m_numNormals = numItems;
m_currentVertices.m_normals = new aiVector3D[ numItems ];
@@ -835,6 +868,11 @@ void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene *
m_currentMesh->mFaces = new aiFace[ numItems ];
m_currentMesh->mNumVertices = numItems * 3;
m_currentMesh->mVertices = new aiVector3D[ m_currentMesh->mNumVertices ];
bool hasColors( false );
if ( m_currentVertices.m_numColors > 0 ) {
m_currentMesh->mColors[0] = new aiColor4D[ m_currentVertices.m_numColors ];
hasColors = true;
}
bool hasNormalCoords( false );
if ( m_currentVertices.m_numNormals > 0 ) {
m_currentMesh->mNormals = new aiVector3D[ m_currentMesh->mNumVertices ];
@@ -858,6 +896,10 @@ void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene *
ai_assert( index < m_currentMesh->mNumVertices );
aiVector3D &pos = ( m_currentVertices.m_vertices[ idx ] );
m_currentMesh->mVertices[ index ].Set( pos.x, pos.y, pos.z );
if ( hasColors ) {
aiColor4D &col = m_currentVertices.m_colors[ idx ];
m_currentMesh->mColors[ 0 ][ index ] = col;
}
if ( hasNormalCoords ) {
aiVector3D &normal = ( m_currentVertices.m_normals[ idx ] );
m_currentMesh->mNormals[ index ].Set( normal.x, normal.y, normal.z );
@@ -1082,10 +1124,10 @@ void OpenGEXImporter::resolveReferences() {
return;
}
RefInfo *currentRefInfo( NULL );
RefInfo *currentRefInfo( nullptr );
for( std::vector<RefInfo*>::iterator it = m_unresolvedRefStack.begin(); it != m_unresolvedRefStack.end(); ++it ) {
currentRefInfo = *it;
if( NULL != currentRefInfo ) {
if( nullptr != currentRefInfo ) {
aiNode *node( currentRefInfo->m_node );
if( RefInfo::MeshRef == currentRefInfo->m_type ) {
for( size_t i = 0; i < currentRefInfo->m_Names.size(); i++ ) {
@@ -1124,7 +1166,7 @@ void OpenGEXImporter::createNodeTree( aiScene *pScene ) {
void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
ai_assert( nullptr != pScene );
if ( NULL == node ) {
if ( nullptr == node ) {
return;
}

View File

@@ -142,6 +142,8 @@ private:
struct VertexContainer {
size_t m_numVerts;
aiVector3D *m_vertices;
size_t m_numColors;
aiColor4D *m_colors;
size_t m_numNormals;
aiVector3D *m_normals;
size_t m_numUVComps[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
@@ -150,9 +152,8 @@ private:
VertexContainer();
~VertexContainer();
private:
VertexContainer( const VertexContainer & );
VertexContainer &operator = ( const VertexContainer & );
VertexContainer( const VertexContainer & ) = delete;
VertexContainer &operator = ( const VertexContainer & ) = delete;
};
struct RefInfo {
@@ -168,9 +169,8 @@ private:
RefInfo( aiNode *node, Type type, std::vector<std::string> &names );
~RefInfo();
private:
RefInfo( const RefInfo & );
RefInfo &operator = ( const RefInfo & );
RefInfo( const RefInfo & ) = delete;
RefInfo &operator = ( const RefInfo & ) = delete;
};
struct ChildInfo {

View File

@@ -113,7 +113,6 @@ struct LightObject {
bool shadowFlag;
};
struct CameraObject {
float focalLength;
float nearDepth;
@@ -146,7 +145,6 @@ struct Name {
std::string name;
};
struct ObjectRef {
Object *targetStructure;
};
@@ -173,7 +171,6 @@ struct BoneIndex {
unsigned short *arrayStorage;
};
struct BoneWeight {
int boneWeightCount;
const float *boneWeightArray;

View File

@@ -198,7 +198,7 @@ struct SceneHelper
* The class is currently being used by various postprocessing steps
* and loaders (ie. LWS).
*/
class SceneCombiner
class ASSIMP_API SceneCombiner
{
// class cannot be instanced
SceneCombiner() {}

View File

@@ -38,6 +38,11 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
/** @file StdOStreamLogStream.h
* @brief Implementation of StdOStreamLogStream
*/
#ifndef AI_STROSTREAMLOGSTREAM_H_INC
#define AI_STROSTREAMLOGSTREAM_H_INC
@@ -50,8 +55,7 @@ namespace Assimp {
/** @class StdOStreamLogStream
* @brief Logs into a std::ostream
*/
class StdOStreamLogStream : public LogStream
{
class StdOStreamLogStream : public LogStream {
public:
/** @brief Construction from an existing std::ostream
* @param _ostream Output stream to be used
@@ -63,30 +67,33 @@ public:
/** @brief Writer */
void write(const char* message);
private:
std::ostream& ostream;
std::ostream& mOstream;
};
// ---------------------------------------------------------------------------
// Default constructor
inline StdOStreamLogStream::StdOStreamLogStream(std::ostream& _ostream)
: ostream (_ostream)
{}
// ---------------------------------------------------------------------------
// Default constructor
inline StdOStreamLogStream::~StdOStreamLogStream()
{}
// ---------------------------------------------------------------------------
// Write method
inline void StdOStreamLogStream::write(const char* message)
{
ostream << message;
ostream.flush();
: mOstream (_ostream){
// empty
}
// ---------------------------------------------------------------------------
// Default constructor
inline StdOStreamLogStream::~StdOStreamLogStream() {
// empty
}
// ---------------------------------------------------------------------------
// Write method
inline void StdOStreamLogStream::write(const char* message) {
mOstream << message;
mOstream.flush();
}
// ---------------------------------------------------------------------------
} // Namespace Assimp
#endif // guard

View File

@@ -1,7 +1,51 @@
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2016, 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.
---------------------------------------------------------------------------
*/
/** @file Win32DebugLogStream.h
* @brief Implementation of Win32DebugLogStream
*/
#ifndef AI_WIN32DEBUGLOGSTREAM_H_INC
#define AI_WIN32DEBUGLOGSTREAM_H_INC
#ifdef WIN32
#ifdef _WIN32
#include <assimp/LogStream.hpp>
#include "windows.h"
@@ -12,9 +56,7 @@ namespace Assimp {
/** @class Win32DebugLogStream
* @brief Logs into the debug stream from win32.
*/
class Win32DebugLogStream :
public LogStream
{
class Win32DebugLogStream : public LogStream {
public:
/** @brief Default constructor */
Win32DebugLogStream();
@@ -27,24 +69,25 @@ public:
};
// ---------------------------------------------------------------------------
// Default constructor
inline Win32DebugLogStream::Win32DebugLogStream()
{}
inline
Win32DebugLogStream::Win32DebugLogStream(){
// empty
}
// ---------------------------------------------------------------------------
// Default constructor
inline Win32DebugLogStream::~Win32DebugLogStream()
{}
inline
Win32DebugLogStream::~Win32DebugLogStream(){
// empty
}
// ---------------------------------------------------------------------------
// Write method
inline void Win32DebugLogStream::write(const char* message)
{
OutputDebugStringA( message);
inline
void Win32DebugLogStream::write(const char* message) {
::OutputDebugStringA( message);
}
// ---------------------------------------------------------------------------
} // Namespace Assimp
#endif // ! WIN32
#endif // ! _WIN32
#endif // guard