pull/1811/head
Marco Di Benedetto 2018-01-18 19:08:54 +01:00
commit 55ca48e838
555 changed files with 496440 additions and 465209 deletions

View File

@ -43,7 +43,7 @@ __Importers__:
- AMJ - AMJ
- ASE - ASE
- ASK - ASK
- B3D; - B3D
- BLEND (Blender) - BLEND (Blender)
- BVH - BVH
- COB - COB

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "TargetAnimation.h" #include "TargetAnimation.h"
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include "StringComparison.h" #include <assimp/StringComparison.h>
#include <memory> #include <memory>
#include <cctype> #include <cctype>

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "3DSHelper.h" #include "3DSHelper.h"
#include <assimp/SceneCombiner.h> #include <assimp/SceneCombiner.h>
#include "SplitLargeMeshes.h" #include "SplitLargeMeshes.h"
#include "StringComparison.h" #include <assimp/StringComparison.h>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/Exporter.hpp> #include <assimp/Exporter.hpp>

View File

@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map> #include <map>
#include <memory> #include <memory>
#include "StreamWriter.h" #include <assimp/StreamWriter.h>
#include <assimp/material.h> #include <assimp/material.h>
struct aiScene; struct aiScene;

View File

@ -44,10 +44,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_3DSFILEHELPER_H_INC #ifndef AI_3DSFILEHELPER_H_INC
#define AI_3DSFILEHELPER_H_INC #define AI_3DSFILEHELPER_H_INC
#include "SpatialSort.h" #include <assimp/SpatialSort.h>
#include "SmoothingGroups.h" #include <assimp/SmoothingGroups.h>
#include "StringUtils.h" #include <assimp/StringUtils.h>
#include "qnan.h" #include <assimp/qnan.h>
#include <assimp/material.h> #include <assimp/material.h>
#include <assimp/camera.h> #include <assimp/camera.h>
#include <assimp/light.h> #include <assimp/light.h>

View File

@ -51,12 +51,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "3DSLoader.h" #include "3DSLoader.h"
#include "Macros.h" #include <assimp/Macros.h>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
#include "StringComparison.h" #include <assimp/StringComparison.h>
using namespace Assimp; using namespace Assimp;

View File

@ -46,13 +46,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_3DSIMPORTER_H_INC #ifndef AI_3DSIMPORTER_H_INC
#define AI_3DSIMPORTER_H_INC #define AI_3DSIMPORTER_H_INC
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include <assimp/types.h> #include <assimp/types.h>
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER #ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
#include "3DSHelper.h" #include "3DSHelper.h"
#include "StreamReader.h" #include <assimp/StreamReader.h>
struct aiNode; struct aiNode;

View File

@ -49,11 +49,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "ACLoader.h" #include "ACLoader.h"
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "Subdivision.h" #include <assimp/Subdivision.h>
#include "Importer.h" #include "Importer.h"
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
#include <assimp/light.h> #include <assimp/light.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include <assimp/types.h> #include <assimp/types.h>
struct aiNode; struct aiNode;

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "AMFImporter.hpp" #include "AMFImporter.hpp"
#include "AMFImporter_Macro.hpp" #include "AMFImporter_Macro.hpp"
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include <assimp/DefaultIOSystem.h> #include <assimp/DefaultIOSystem.h>
// Header files, stdlib. // Header files, stdlib.

View File

@ -56,8 +56,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
#include "assimp/types.h" #include "assimp/types.h"
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "irrXMLWrapper.h" #include <assimp/irrXMLWrapper.h>
// Header files, stdlib. // Header files, stdlib.
#include <set> #include <set>

View File

@ -51,8 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Header files, Assimp. // Header files, Assimp.
#include <assimp/SceneCombiner.h> #include <assimp/SceneCombiner.h>
#include "StandardShapes.h" #include <assimp/StandardShapes.h>
#include "StringUtils.h" #include <assimp/StringUtils.h>
// Header files, stdlib. // Header files, stdlib.
#include <iterator> #include <iterator>

View File

@ -50,8 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "ASELoader.h" #include "ASELoader.h"
#include "StringComparison.h" #include <assimp/StringComparison.h>
#include "SkeletonMeshBuilder.h" #include <assimp/SkeletonMeshBuilder.h>
#include "TargetAnimation.h" #include "TargetAnimation.h"
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
@ -62,7 +62,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory> #include <memory>
// utilities // utilities
#include "fast_atof.h" #include <assimp/fast_atof.h>
using namespace Assimp; using namespace Assimp;
using namespace Assimp::ASE; using namespace Assimp::ASE;

View File

@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_ASELOADER_H_INCLUDED #ifndef AI_ASELOADER_H_INCLUDED
#define AI_ASELOADER_H_INCLUDED #define AI_ASELOADER_H_INCLUDED
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include <assimp/types.h> #include <assimp/types.h>
#include "ASEParser.h" #include "ASEParser.h"

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "TextureTransform.h" #include "TextureTransform.h"
#include "ASELoader.h" #include "ASELoader.h"
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
using namespace Assimp; using namespace Assimp;

View File

@ -52,8 +52,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER #ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
// for some helper routines like IsSpace() // for some helper routines like IsSpace()
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "qnan.h" #include <assimp/qnan.h>
// ASE is quite similar to 3ds. We can reuse some structures // ASE is quite similar to 3ds. We can reuse some structures
#include "3DSLoader.h" #include "3DSLoader.h"

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp> #include <assimp/Exporter.hpp>
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include "Exceptional.h" #include <assimp/Exceptional.h>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB #ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h> # include <zlib.h>

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "AssbinLoader.h" #include "AssbinLoader.h"
#include "assbin_chunks.h" #include "assbin_chunks.h"
#include "MemoryIOWrapper.h" #include <assimp/MemoryIOWrapper.h>
#include <assimp/mesh.h> #include <assimp/mesh.h>
#include <assimp/anim.h> #include <assimp/anim.h>
#include <assimp/scene.h> #include <assimp/scene.h>

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_ASSBINIMPORTER_H_INC #ifndef AI_ASSBINIMPORTER_H_INC
#define AI_ASSBINIMPORTER_H_INC #define AI_ASSBINIMPORTER_H_INC
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
struct aiMesh; struct aiMesh;
struct aiNode; struct aiNode;

View File

@ -50,12 +50,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
#include <assimp/scene.h> #include <assimp/scene.h>
#include "GenericProperty.h" #include <assimp/GenericProperty.h>
#include "CInterfaceIOWrapper.h" #include "CInterfaceIOWrapper.h"
#include "Importer.h" #include "Importer.h"
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include "ScenePrivate.h" #include "ScenePrivate.h"
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include <list> #include <list>
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "B3DImporter.h" #include "B3DImporter.h"
#include "TextureTransform.h" #include "TextureTransform.h"
#include "ConvertToLHProcess.h" #include "ConvertToLHProcess.h"
#include "StringUtils.h" #include <assimp/StringUtils.h>
#include <memory> #include <memory>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/anim.h> #include <assimp/anim.h>

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/types.h> #include <assimp/types.h>
#include <assimp/mesh.h> #include <assimp/mesh.h>
#include <assimp/material.h> #include <assimp/material.h>
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include <memory> #include <memory>
#include <vector> #include <vector>

View File

@ -45,11 +45,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_BVH_IMPORTER #ifndef ASSIMP_BUILD_NO_BVH_IMPORTER
#include "BVHLoader.h" #include "BVHLoader.h"
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "SkeletonMeshBuilder.h" #include <assimp/SkeletonMeshBuilder.h>
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
#include <memory> #include <memory>
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>

View File

@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_BVHLOADER_H_INC #ifndef AI_BVHLOADER_H_INC
#define AI_BVHLOADER_H_INC #define AI_BVHLOADER_H_INC
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
struct aiNode; struct aiNode;

View File

@ -44,10 +44,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Implementation of BaseImporter * @brief Implementation of BaseImporter
*/ */
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "FileSystemFilter.h" #include "FileSystemFilter.h"
#include "Importer.h" #include "Importer.h"
#include "ByteSwapper.h" #include <assimp/ByteSwapper.h>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
#include <assimp/postprocess.h> #include <assimp/postprocess.h>

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file Implementation of BaseProcess */ /** @file Implementation of BaseProcess */
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "BaseProcess.h" #include "BaseProcess.h"
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h> #include <assimp/scene.h>

View File

@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define INCLUDED_AI_BASEPROCESS_H #define INCLUDED_AI_BASEPROCESS_H
#include <map> #include <map>
#include "GenericProperty.h" #include <assimp/GenericProperty.h>
struct aiScene; struct aiScene;

View File

@ -47,10 +47,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "Bitmap.h" #include <assimp/Bitmap.h>
#include <assimp/texture.h> #include <assimp/texture.h>
#include <assimp/IOStream.hpp> #include <assimp/IOStream.hpp>
#include "ByteSwapper.h" #include <assimp/ByteSwapper.h>
namespace Assimp { namespace Assimp {

View File

@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_BLEND_BMESH_H #ifndef INCLUDED_AI_BLEND_BMESH_H
#define INCLUDED_AI_BLEND_BMESH_H #define INCLUDED_AI_BLEND_BMESH_H
#include "LogAux.h" #include <assimp/LogAux.h>
namespace Assimp namespace Assimp
{ {

View File

@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER #ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
#include "BlenderDNA.h" #include "BlenderDNA.h"
#include "StreamReader.h" #include <assimp/StreamReader.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
using namespace Assimp; using namespace Assimp;
using namespace Assimp::Blender; using namespace Assimp::Blender;

View File

@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_BLEND_DNA_H #ifndef INCLUDED_AI_BLEND_DNA_H
#define INCLUDED_AI_BLEND_DNA_H #define INCLUDED_AI_BLEND_DNA_H
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "StreamReader.h" #include <assimp/StreamReader.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <stdint.h> #include <stdint.h>
#include <memory> #include <memory>

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define INCLUDED_AI_BLEND_DNA_INL #define INCLUDED_AI_BLEND_DNA_INL
#include <memory> #include <memory>
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
namespace Assimp { namespace Assimp {
namespace Blender { namespace Blender {

View File

@ -53,13 +53,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderIntermediate.h" #include "BlenderIntermediate.h"
#include "BlenderModifier.h" #include "BlenderModifier.h"
#include "BlenderBMesh.h" #include "BlenderBMesh.h"
#include "StringUtils.h" #include <assimp/StringUtils.h>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
#include "StringComparison.h" #include <assimp/StringComparison.h>
#include "StreamReader.h" #include <assimp/StreamReader.h>
#include "MemoryIOWrapper.h" #include <assimp/MemoryIOWrapper.h>
#include <cctype> #include <cctype>

View File

@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_BLEND_LOADER_H #ifndef INCLUDED_AI_BLEND_LOADER_H
#define INCLUDED_AI_BLEND_LOADER_H #define INCLUDED_AI_BLEND_LOADER_H
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "LogAux.h" #include <assimp/LogAux.h>
#include <memory> #include <memory>
struct aiNode; struct aiNode;

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderModifier.h" #include "BlenderModifier.h"
#include <assimp/SceneCombiner.h> #include <assimp/SceneCombiner.h>
#include "Subdivision.h" #include <assimp/Subdivision.h>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <memory> #include <memory>

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define INCLUDED_AI_BLEND_MODIFIER_H #define INCLUDED_AI_BLEND_MODIFIER_H
#include "BlenderIntermediate.h" #include "BlenderIntermediate.h"
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
namespace Assimp { namespace Assimp {
namespace Blender { namespace Blender {

View File

@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# define ASSIMP_BLEND_WITH_POLY_2_TRI 1 # define ASSIMP_BLEND_WITH_POLY_2_TRI 1
#endif #endif
#include "LogAux.h" #include <assimp/LogAux.h>
#if ASSIMP_BLEND_WITH_GLU_TESSELLATE #if ASSIMP_BLEND_WITH_GLU_TESSELLATE

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif #endif
#include "C4DImporter.h" #include "C4DImporter.h"
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
#include <memory> #include <memory>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/scene.h> #include <assimp/scene.h>

View File

@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_CINEMA_4D_LOADER_H #ifndef INCLUDED_AI_CINEMA_4D_LOADER_H
#define INCLUDED_AI_CINEMA_4D_LOADER_H #define INCLUDED_AI_CINEMA_4D_LOADER_H
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "LogAux.h" #include <assimp/LogAux.h>
#include <map> #include <map>
struct aiNode; struct aiNode;

View File

@ -98,6 +98,40 @@ SET( PUBLIC_HEADERS
${HEADER_PATH}/DefaultIOStream.h ${HEADER_PATH}/DefaultIOStream.h
${HEADER_PATH}/DefaultIOSystem.h ${HEADER_PATH}/DefaultIOSystem.h
${HEADER_PATH}/SceneCombiner.h ${HEADER_PATH}/SceneCombiner.h
${HEADER_PATH}/fast_atof.h
${HEADER_PATH}/qnan.h
${HEADER_PATH}/BaseImporter.h
${HEADER_PATH}/Hash.h
${HEADER_PATH}/MemoryIOWrapper.h
${HEADER_PATH}/ParsingUtils.h
${HEADER_PATH}/StreamReader.h
${HEADER_PATH}/StreamWriter.h
${HEADER_PATH}/StringComparison.h
${HEADER_PATH}/StringUtils.h
${HEADER_PATH}/SGSpatialSort.h
${HEADER_PATH}/GenericProperty.h
${HEADER_PATH}/SpatialSort.h
${HEADER_PATH}/SkeletonMeshBuilder.h
${HEADER_PATH}/SmoothingGroups.h
${HEADER_PATH}/SmoothingGroups.inl
${HEADER_PATH}/StandardShapes.h
${HEADER_PATH}/RemoveComments.h
${HEADER_PATH}/Subdivision.h
${HEADER_PATH}/Vertex.h
${HEADER_PATH}/LineSplitter.h
${HEADER_PATH}/TinyFormatter.h
${HEADER_PATH}/Profiler.h
${HEADER_PATH}/LogAux.h
${HEADER_PATH}/Bitmap.h
${HEADER_PATH}/XMLTools.h
${HEADER_PATH}/IOStreamBuffer.h
${HEADER_PATH}/CreateAnimMesh.h
${HEADER_PATH}/irrXMLWrapper.h
${HEADER_PATH}/BlobIOSystem.h
${HEADER_PATH}/MathFunctions.h
${HEADER_PATH}/Macros.h
${HEADER_PATH}/Exceptional.h
${HEADER_PATH}/ByteSwapper.h
) )
SET( Core_SRCS SET( Core_SRCS
@ -117,68 +151,40 @@ SET( Logging_SRCS
SOURCE_GROUP(Logging FILES ${Logging_SRCS}) SOURCE_GROUP(Logging FILES ${Logging_SRCS})
SET( Common_SRCS SET( Common_SRCS
fast_atof.h
qnan.h
BaseImporter.cpp BaseImporter.cpp
BaseImporter.h
BaseProcess.cpp BaseProcess.cpp
BaseProcess.h BaseProcess.h
Importer.h Importer.h
ScenePrivate.h ScenePrivate.h
PostStepRegistry.cpp PostStepRegistry.cpp
ImporterRegistry.cpp ImporterRegistry.cpp
ByteSwapper.h
DefaultProgressHandler.h DefaultProgressHandler.h
DefaultIOStream.cpp DefaultIOStream.cpp
DefaultIOSystem.cpp DefaultIOSystem.cpp
CInterfaceIOWrapper.cpp CInterfaceIOWrapper.cpp
CInterfaceIOWrapper.h CInterfaceIOWrapper.h
Hash.h
Importer.cpp Importer.cpp
IFF.h IFF.h
MemoryIOWrapper.h
ParsingUtils.h
StreamReader.h
StreamWriter.h
StringComparison.h
StringUtils.h
SGSpatialSort.cpp SGSpatialSort.cpp
SGSpatialSort.h
VertexTriangleAdjacency.cpp VertexTriangleAdjacency.cpp
VertexTriangleAdjacency.h VertexTriangleAdjacency.h
GenericProperty.h
SpatialSort.cpp SpatialSort.cpp
SpatialSort.h
SceneCombiner.cpp SceneCombiner.cpp
ScenePreprocessor.cpp ScenePreprocessor.cpp
ScenePreprocessor.h ScenePreprocessor.h
SkeletonMeshBuilder.cpp SkeletonMeshBuilder.cpp
SkeletonMeshBuilder.h
SplitByBoneCountProcess.cpp SplitByBoneCountProcess.cpp
SplitByBoneCountProcess.h SplitByBoneCountProcess.h
ScaleProcess.cpp ScaleProcess.cpp
ScaleProcess.h ScaleProcess.h
SmoothingGroups.h
StandardShapes.cpp StandardShapes.cpp
StandardShapes.h
TargetAnimation.cpp TargetAnimation.cpp
TargetAnimation.h TargetAnimation.h
RemoveComments.cpp RemoveComments.cpp
RemoveComments.h
Subdivision.cpp Subdivision.cpp
Subdivision.h
scene.cpp scene.cpp
Vertex.h
LineSplitter.h
TinyFormatter.h
Profiler.h
LogAux.h
Bitmap.cpp Bitmap.cpp
Bitmap.h
XMLTools.h
Version.cpp Version.cpp
IOStreamBuffer.h
CreateAnimMesh.h
CreateAnimMesh.cpp CreateAnimMesh.cpp
) )
SOURCE_GROUP(Common FILES ${Common_SRCS}) SOURCE_GROUP(Common FILES ${Common_SRCS})
@ -457,24 +463,23 @@ ADD_ASSIMP_IMPORTER( BLEND
) )
ADD_ASSIMP_IMPORTER( IFC ADD_ASSIMP_IMPORTER( IFC
IFCLoader.cpp Importer/IFC/IFCLoader.cpp
IFCLoader.h Importer/IFC/IFCLoader.h
IFCReaderGen1.cpp Importer/IFC/IFCReaderGen1_2x3.cpp
IFCReaderGen2.cpp Importer/IFC/IFCReaderGen2_2x3.cpp
IFCReaderGen.h Importer/IFC/IFCReaderGen_2x3.h
IFCUtil.h Importer/IFC/IFCUtil.h
IFCUtil.cpp Importer/IFC/IFCUtil.cpp
IFCGeometry.cpp Importer/IFC/IFCGeometry.cpp
IFCMaterial.cpp Importer/IFC/IFCMaterial.cpp
IFCProfile.cpp Importer/IFC/IFCProfile.cpp
IFCCurve.cpp Importer/IFC/IFCCurve.cpp
IFCBoolean.cpp Importer/IFC/IFCBoolean.cpp
IFCOpenings.cpp Importer/IFC/IFCOpenings.cpp
STEPFile.h Importer/IFC/STEPFileReader.h
STEPFileReader.h Importer/IFC/STEPFileReader.cpp
STEPFileReader.cpp Importer/IFC/STEPFileEncoding.cpp
STEPFileEncoding.cpp Importer/IFC/STEPFileEncoding.h
STEPFileEncoding.h
) )
if (ASSIMP_BUILD_IFC_IMPORTER) if (ASSIMP_BUILD_IFC_IMPORTER)
if (MSVC) if (MSVC)
@ -575,7 +580,7 @@ SET( PostProcessing_SRCS
) )
SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS}) SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS})
SET( IrrXML_SRCS irrXMLWrapper.h ) SET( IrrXML_SRCS ${HEADER_PATH}/irrXMLWrapper.h )
SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS}) SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
ADD_ASSIMP_IMPORTER( Q3D ADD_ASSIMP_IMPORTER( Q3D
@ -697,6 +702,7 @@ ADD_ASSIMP_IMPORTER( MMD
) )
SET( Step_SRCS SET( Step_SRCS
STEPFile.h
StepExporter.h StepExporter.h
StepExporter.cpp StepExporter.cpp
) )
@ -705,7 +711,7 @@ SOURCE_GROUP( Step FILES ${Step_SRCS})
SET( Exporter_SRCS SET( Exporter_SRCS
Exporter.cpp Exporter.cpp
AssimpCExport.cpp AssimpCExport.cpp
BlobIOSystem.h ${HEADER_PATH}/BlobIOSystem.h
) )
SOURCE_GROUP( Exporter FILES ${Exporter_SRCS}) SOURCE_GROUP( Exporter FILES ${Exporter_SRCS})

View File

@ -47,12 +47,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "COBLoader.h" #include "COBLoader.h"
#include "COBScene.h" #include "COBScene.h"
#include "StreamReader.h" #include <assimp/StreamReader.h>
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "LineSplitter.h" #include <assimp/LineSplitter.h>
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
#include <memory> #include <memory>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>

View File

@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_COB_LOADER_H #ifndef INCLUDED_AI_COB_LOADER_H
#define INCLUDED_AI_COB_LOADER_H #define INCLUDED_AI_COB_LOADER_H
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "StreamReader.h" #include <assimp/StreamReader.h>
struct aiNode; struct aiNode;

View File

@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <deque> #include <deque>
#include <map> #include <map>
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include <assimp/material.h> #include <assimp/material.h>
namespace Assimp { namespace Assimp {

View File

@ -49,9 +49,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_CSM_IMPORTER #ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
#include "CSMLoader.h" #include "CSMLoader.h"
#include "SkeletonMeshBuilder.h" #include <assimp/SkeletonMeshBuilder.h>
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
#include <memory> #include <memory>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>

View File

@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_CSM_LOADER_H #ifndef INCLUDED_AI_CSM_LOADER_H
#define INCLUDED_AI_CSM_LOADER_H #define INCLUDED_AI_CSM_LOADER_H
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
namespace Assimp { namespace Assimp {

View File

@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "CalcTangentsProcess.h" #include "CalcTangentsProcess.h"
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
#include "qnan.h" #include <assimp/qnan.h>
using namespace Assimp; using namespace Assimp;

View File

@ -43,17 +43,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER #ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
#include "ColladaExporter.h" #include "ColladaExporter.h"
#include "Bitmap.h" #include <assimp/Bitmap.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include <assimp/SceneCombiner.h> #include <assimp/SceneCombiner.h>
#include "StringUtils.h" #include <assimp/StringUtils.h>
#include "XMLTools.h" #include <assimp/XMLTools.h>
#include <assimp/DefaultIOSystem.h> #include <assimp/DefaultIOSystem.h>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp> #include <assimp/Exporter.hpp>
#include <assimp/scene.h> #include <assimp/scene.h>
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include <memory> #include <memory>
#include <ctime> #include <ctime>

View File

@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
#include <map> #include <map>
#include "StringUtils.h" #include <assimp/StringUtils.h>
struct aiScene; struct aiScene;
struct aiNode; struct aiNode;

View File

@ -53,10 +53,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
#include "ColladaParser.h" #include "ColladaParser.h"
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "SkeletonMeshBuilder.h" #include <assimp/SkeletonMeshBuilder.h>
#include "CreateAnimMesh.h" #include <assimp/CreateAnimMesh.h>
#include "time.h" #include "time.h"
#include "math.h" #include "math.h"

View File

@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_COLLADALOADER_H_INC #ifndef AI_COLLADALOADER_H_INC
#define AI_COLLADALOADER_H_INC #define AI_COLLADALOADER_H_INC
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "ColladaParser.h" #include "ColladaParser.h"
struct aiNode; struct aiNode;

View File

@ -49,13 +49,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sstream> #include <sstream>
#include <stdarg.h> #include <stdarg.h>
#include "ColladaParser.h" #include "ColladaParser.h"
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "StringUtils.h" #include <assimp/StringUtils.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/light.h> #include <assimp/light.h>
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
#include <memory> #include <memory>

View File

@ -46,10 +46,10 @@
#ifndef AI_COLLADAPARSER_H_INC #ifndef AI_COLLADAPARSER_H_INC
#define AI_COLLADAPARSER_H_INC #define AI_COLLADAPARSER_H_INC
#include "irrXMLWrapper.h" #include <assimp/irrXMLWrapper.h>
#include "ColladaHelper.h" #include "ColladaHelper.h"
#include <assimp/ai_assert.h> #include <assimp/ai_assert.h>
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
namespace Assimp namespace Assimp
{ {

View File

@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ComputeUVMappingProcess.h" #include "ComputeUVMappingProcess.h"
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include "Exceptional.h" #include <assimp/Exceptional.h>
using namespace Assimp; using namespace Assimp;

View File

@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "CreateAnimMesh.h" #include <assimp/CreateAnimMesh.h>
namespace Assimp { namespace Assimp {

View File

@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/Exporter.hpp> #include <assimp/Exporter.hpp>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include "3MFXmlTags.h" #include "3MFXmlTags.h"
#include "D3MFOpcPackage.h" #include "D3MFOpcPackage.h"

View File

@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
#include "StringComparison.h" #include <assimp/StringComparison.h>
#include "StringUtils.h" #include <assimp/StringUtils.h>
#include <string> #include <string>
#include <vector> #include <vector>
@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "D3MFOpcPackage.h" #include "D3MFOpcPackage.h"
#include <contrib/unzip/unzip.h> #include <contrib/unzip/unzip.h>
#include "irrXMLWrapper.h" #include <assimp/irrXMLWrapper.h>
#include "3MFXmlTags.h" #include "3MFXmlTags.h"
namespace Assimp { namespace Assimp {

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_D3MFLOADER_H_INCLUDED #ifndef AI_D3MFLOADER_H_INCLUDED
#define AI_D3MFLOADER_H_INCLUDED #define AI_D3MFLOADER_H_INCLUDED
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
namespace Assimp { namespace Assimp {

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_3MF_IMPORTER #ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
#include "D3MFOpcPackage.h" #include "D3MFOpcPackage.h"
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include <assimp/IOStream.hpp> #include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>

View File

@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory> #include <memory>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include "irrXMLWrapper.h" #include <assimp/irrXMLWrapper.h>
namespace Assimp { namespace Assimp {
namespace D3MF { namespace D3MF {

View File

@ -46,10 +46,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_DXFHELPER_H #ifndef INCLUDED_DXFHELPER_H
#define INCLUDED_DXFHELPER_H #define INCLUDED_DXFHELPER_H
#include "LineSplitter.h" #include <assimp/LineSplitter.h>
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
#include "StreamReader.h" #include <assimp/StreamReader.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include <vector> #include <vector>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>

View File

@ -48,9 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_DXF_IMPORTER #ifndef ASSIMP_BUILD_NO_DXF_IMPORTER
#include "DXFLoader.h" #include "DXFLoader.h"
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "ConvertToLHProcess.h" #include "ConvertToLHProcess.h"
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "DXFHelper.h" #include "DXFHelper.h"
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>

View File

@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_DXFLOADER_H_INCLUDED #ifndef AI_DXFLOADER_H_INCLUDED
#define AI_DXFLOADER_H_INCLUDED #define AI_DXFLOADER_H_INCLUDED
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include <map> #include <map>
namespace Assimp { namespace Assimp {

View File

@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/** @file Default implementation of IOSystem using the standard C file functions */ /** @file Default implementation of IOSystem using the standard C file functions */
#include "StringComparison.h" #include <assimp/StringComparison.h>
#include <assimp/DefaultIOSystem.h> #include <assimp/DefaultIOSystem.h>
#include <assimp/DefaultIOStream.h> #include <assimp/DefaultIOStream.h>

View File

@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Win32DebugLogStream.h" #include "Win32DebugLogStream.h"
#include "StdOStreamLogStream.h" #include "StdOStreamLogStream.h"
#include "FileLogStream.h" #include "FileLogStream.h"
#include "StringUtils.h" #include <assimp/StringUtils.h>
#include <assimp/DefaultIOSystem.h> #include <assimp/DefaultIOSystem.h>
#include <assimp/NullLogger.hpp> #include <assimp/NullLogger.hpp>

View File

@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "EmbedTexturesProcess.h" #include "EmbedTexturesProcess.h"
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include <fstream> #include <fstream>

View File

@ -53,7 +53,7 @@ Here we implement only the C++ interface (Assimp::Exporter).
#ifndef ASSIMP_BUILD_NO_EXPORT #ifndef ASSIMP_BUILD_NO_EXPORT
#include "BlobIOSystem.h" #include <assimp/BlobIOSystem.h>
#include <assimp/SceneCombiner.h> #include <assimp/SceneCombiner.h>
#include "BaseProcess.h" #include "BaseProcess.h"
#include "Importer.h" // need this for GetPostProcessingStepInstanceList() #include "Importer.h" // need this for GetPostProcessingStepInstanceList()
@ -61,7 +61,7 @@ Here we implement only the C++ interface (Assimp::Exporter).
#include "JoinVerticesProcess.h" #include "JoinVerticesProcess.h"
#include "MakeVerboseFormat.h" #include "MakeVerboseFormat.h"
#include "ConvertToLHProcess.h" #include "ConvertToLHProcess.h"
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include "ScenePrivate.h" #include "ScenePrivate.h"
#include <memory> #include <memory>

View File

@ -50,8 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXUtil.h" #include "FBXUtil.h"
#include <assimp/defs.h> #include <assimp/defs.h>
#include <stdint.h> #include <stdint.h>
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include "ByteSwapper.h" #include <assimp/ByteSwapper.h>
namespace Assimp { namespace Assimp {
namespace FBX { namespace FBX {

View File

@ -52,7 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXUtil.h" #include "FBXUtil.h"
#include "FBXProperties.h" #include "FBXProperties.h"
#include "FBXImporter.h" #include "FBXImporter.h"
#include "StringComparison.h" #include <assimp/StringComparison.h>
#include <assimp/scene.h> #include <assimp/scene.h>
@ -241,6 +241,10 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiColor3D GetColorPropertyFromMaterial( const PropertyTable& props, const std::string& baseName, aiColor3D GetColorPropertyFromMaterial( const PropertyTable& props, const std::string& baseName,
bool& result ); bool& result );
aiColor3D GetColorPropertyFactored( const PropertyTable& props, const std::string& colorName,
const std::string& factorName, bool& result, bool useTemplate=true );
aiColor3D GetColorProperty( const PropertyTable& props, const std::string& colorName,
bool& result, bool useTemplate=true );
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyTable& props ); void SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyTable& props );
@ -1716,7 +1720,7 @@ unsigned int Converter::ConvertMaterial( const Material& material, const MeshGeo
aiString str; aiString str;
// stip Material:: prefix // strip Material:: prefix
std::string name = material.Name(); std::string name = material.Name();
if ( name.substr( 0, 10 ) == "Material::" ) { if ( name.substr( 0, 10 ) == "Material::" ) {
name = name.substr( 10 ); name = name.substr( 10 );
@ -2077,40 +2081,62 @@ void Converter::SetTextureProperties( aiMaterial* out_mat, const LayeredTextureM
TrySetTextureProperties( out_mat, layeredTextures, "ShininessExponent", aiTextureType_SHININESS, mesh ); TrySetTextureProperties( out_mat, layeredTextures, "ShininessExponent", aiTextureType_SHININESS, mesh );
} }
aiColor3D Converter::GetColorPropertyFromMaterial( const PropertyTable& props, const std::string& baseName, aiColor3D Converter::GetColorPropertyFactored( const PropertyTable& props, const std::string& colorName,
bool& result ) const std::string& factorName, bool& result, bool useTemplate )
{ {
result = true; result = true;
bool ok; bool ok;
const aiVector3D& Diffuse = PropertyGet<aiVector3D>( props, baseName, ok ); aiVector3D BaseColor = PropertyGet<aiVector3D>( props, colorName, ok, useTemplate );
if ( ok ) { if ( ! ok ) {
return aiColor3D( Diffuse.x, Diffuse.y, Diffuse.z ); result = false;
return aiColor3D( 0.0f, 0.0f, 0.0f );
} }
else {
aiVector3D DiffuseColor = PropertyGet<aiVector3D>( props, baseName + "Color", ok );
if ( ok ) {
float DiffuseFactor = PropertyGet<float>( props, baseName + "Factor", ok );
if ( ok ) {
DiffuseColor *= DiffuseFactor;
}
return aiColor3D( DiffuseColor.x, DiffuseColor.y, DiffuseColor.z ); // if no factor name, return the colour as is
} if ( factorName.empty() ) {
return aiColor3D( BaseColor.x, BaseColor.y, BaseColor.z );
} }
result = false;
return aiColor3D( 0.0f, 0.0f, 0.0f ); // otherwise it should be multiplied by the factor, if found.
float factor = PropertyGet<float>( props, factorName, ok, useTemplate );
if ( ok ) {
BaseColor *= factor;
}
return aiColor3D( BaseColor.x, BaseColor.y, BaseColor.z );
} }
aiColor3D Converter::GetColorPropertyFromMaterial( const PropertyTable& props, const std::string& baseName,
bool& result )
{
return GetColorPropertyFactored( props, baseName + "Color", baseName + "Factor", result, true );
}
aiColor3D Converter::GetColorProperty( const PropertyTable& props, const std::string& colorName,
bool& result, bool useTemplate )
{
result = true;
bool ok;
const aiVector3D& ColorVec = PropertyGet<aiVector3D>( props, colorName, ok, useTemplate );
if ( ! ok ) {
result = false;
return aiColor3D( 0.0f, 0.0f, 0.0f );
}
return aiColor3D( ColorVec.x, ColorVec.y, ColorVec.z );
}
void Converter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyTable& props ) void Converter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyTable& props )
{ {
// set shading properties. There are various, redundant ways in which FBX materials // Set shading properties.
// specify their shading settings (depending on shading models, prop // Modern FBX Files have two separate systems for defining these,
// template etc.). No idea which one is right in a particular context. // with only the more comprehensive one described in the property template.
// Just try to make sense of it - there's no spec to verify this against, // Likely the other values are a legacy system,
// so why should we. // which is still always exported by the official FBX SDK.
//
// Blender's FBX import and export mostly ignore this legacy system,
// and as we only support recent versions of FBX anyway, we can do the same.
bool ok; bool ok;
const aiColor3D& Diffuse = GetColorPropertyFromMaterial( props, "Diffuse", ok ); const aiColor3D& Diffuse = GetColorPropertyFromMaterial( props, "Diffuse", ok );
if ( ok ) { if ( ok ) {
out_mat->AddProperty( &Diffuse, 1, AI_MATKEY_COLOR_DIFFUSE ); out_mat->AddProperty( &Diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );
@ -2126,29 +2152,64 @@ void Converter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyT
out_mat->AddProperty( &Ambient, 1, AI_MATKEY_COLOR_AMBIENT ); out_mat->AddProperty( &Ambient, 1, AI_MATKEY_COLOR_AMBIENT );
} }
const aiColor3D& Specular = GetColorPropertyFromMaterial( props, "Specular", ok ); // we store specular factor as SHININESS_STRENGTH, so just get the color
const aiColor3D& Specular = GetColorProperty( props, "SpecularColor", ok, true );
if ( ok ) { if ( ok ) {
out_mat->AddProperty( &Specular, 1, AI_MATKEY_COLOR_SPECULAR ); out_mat->AddProperty( &Specular, 1, AI_MATKEY_COLOR_SPECULAR );
} }
// and also try to get SHININESS_STRENGTH
const float SpecularFactor = PropertyGet<float>( props, "SpecularFactor", ok, true );
if ( ok ) {
out_mat->AddProperty( &SpecularFactor, 1, AI_MATKEY_SHININESS_STRENGTH );
}
// and the specular exponent
const float ShininessExponent = PropertyGet<float>( props, "ShininessExponent", ok );
if ( ok ) {
out_mat->AddProperty( &ShininessExponent, 1, AI_MATKEY_SHININESS );
}
// TransparentColor / TransparencyFactor... gee thanks FBX :rolleyes:
const aiColor3D& Transparent = GetColorPropertyFactored( props, "TransparentColor", "TransparencyFactor", ok );
float CalculatedOpacity = 1.0;
if ( ok ) {
out_mat->AddProperty( &Transparent, 1, AI_MATKEY_COLOR_TRANSPARENT );
// as calculated by FBX SDK 2017:
CalculatedOpacity = 1.0 - ((Transparent.r + Transparent.g + Transparent.b) / 3.0);
}
// use of TransparencyFactor is inconsistent.
// Maya always stores it as 1.0,
// so we can't use it to set AI_MATKEY_OPACITY.
// Blender is more sensible and stores it as the alpha value.
// However both the FBX SDK and Blender always write an additional
// legacy "Opacity" field, so we can try to use that.
//
// If we can't find it,
// we can fall back to the value which the FBX SDK calculates
// from transparency colour (RGB) and factor (F) as
// 1.0 - F*((R+G+B)/3).
//
// There's no consistent way to interpret this opacity value,
// so it's up to clients to do the correct thing.
const float Opacity = PropertyGet<float>( props, "Opacity", ok ); const float Opacity = PropertyGet<float>( props, "Opacity", ok );
if ( ok ) { if ( ok ) {
out_mat->AddProperty( &Opacity, 1, AI_MATKEY_OPACITY ); out_mat->AddProperty( &Opacity, 1, AI_MATKEY_OPACITY );
} }
else if ( CalculatedOpacity != 1.0 ) {
const float Reflectivity = PropertyGet<float>( props, "Reflectivity", ok ); out_mat->AddProperty( &CalculatedOpacity, 1, AI_MATKEY_OPACITY );
if ( ok ) {
out_mat->AddProperty( &Reflectivity, 1, AI_MATKEY_REFLECTIVITY );
} }
const float Shininess = PropertyGet<float>( props, "Shininess", ok ); // reflection color and factor are stored separately
const aiColor3D& Reflection = GetColorProperty( props, "ReflectionColor", ok, true );
if ( ok ) { if ( ok ) {
out_mat->AddProperty( &Shininess, 1, AI_MATKEY_SHININESS_STRENGTH ); out_mat->AddProperty( &Reflection, 1, AI_MATKEY_COLOR_REFLECTIVE );
} }
const float ShininessExponent = PropertyGet<float>( props, "ShininessExponent", ok ); float ReflectionFactor = PropertyGet<float>( props, "ReflectionFactor", ok, true );
if ( ok ) { if ( ok ) {
out_mat->AddProperty( &ShininessExponent, 1, AI_MATKEY_SHININESS ); out_mat->AddProperty( &ReflectionFactor, 1, AI_MATKEY_REFLECTIVITY );
} }
const float BumpFactor = PropertyGet<float>(props, "BumpFactor", ok); const float BumpFactor = PropertyGet<float>(props, "BumpFactor", ok);

View File

@ -53,8 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXDocument.h" #include "FBXDocument.h"
#include "FBXConverter.h" #include "FBXConverter.h"
#include "StreamReader.h" #include <assimp/StreamReader.h>
#include "MemoryIOWrapper.h" #include <assimp/MemoryIOWrapper.h>
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>

View File

@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_FBX_IMPORTER_H #ifndef INCLUDED_AI_FBX_IMPORTER_H
#define INCLUDED_AI_FBX_IMPORTER_H #define INCLUDED_AI_FBX_IMPORTER_H
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "LogAux.h" #include <assimp/LogAux.h>
#include "FBXImportSettings.h" #include "FBXImportSettings.h"

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXImportSettings.h" #include "FBXImportSettings.h"
#include "FBXDocumentUtil.h" #include "FBXDocumentUtil.h"
#include "FBXProperties.h" #include "FBXProperties.h"
#include "ByteSwapper.h" #include <assimp/ByteSwapper.h>
namespace Assimp { namespace Assimp {
namespace FBX { namespace FBX {

View File

@ -56,9 +56,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXParser.h" #include "FBXParser.h"
#include "FBXUtil.h" #include "FBXUtil.h"
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "ByteSwapper.h" #include <assimp/ByteSwapper.h>
#include <iostream> #include <iostream>

View File

@ -48,8 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdint.h> #include <stdint.h>
#include <map> #include <map>
#include <memory> #include <memory>
#include "LogAux.h" #include <assimp/LogAux.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "FBXCompileConfig.h" #include "FBXCompileConfig.h"
#include "FBXTokenizer.h" #include "FBXTokenizer.h"

View File

@ -148,11 +148,23 @@ T PropertyGet(const PropertyTable& in, const std::string& name, const T& default
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
inline inline
T PropertyGet(const PropertyTable& in, const std::string& name, bool& result) { T PropertyGet(const PropertyTable& in, const std::string& name, bool& result, bool useTemplate=false ) {
const Property* const prop = in.Get(name); const Property* prop = in.Get(name);
if( nullptr == prop) { if( nullptr == prop) {
result = false; if ( ! useTemplate ) {
return T(); result = false;
return T();
}
const PropertyTable* templ = in.TemplateProps();
if ( nullptr == templ ) {
result = false;
return T();
}
prop = templ->Get(name);
if ( nullptr == prop ) {
result = false;
return T();
}
} }
// strong typing, no need to be lenient // strong typing, no need to be lenient

View File

@ -48,11 +48,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// tab width for logging columns // tab width for logging columns
#define ASSIMP_FBX_TAB_WIDTH 4 #define ASSIMP_FBX_TAB_WIDTH 4
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "FBXTokenizer.h" #include "FBXTokenizer.h"
#include "FBXUtil.h" #include "FBXUtil.h"
#include "Exceptional.h" #include <assimp/Exceptional.h>
namespace Assimp { namespace Assimp {
namespace FBX { namespace FBX {

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXUtil.h" #include "FBXUtil.h"
#include "FBXTokenizer.h" #include "FBXTokenizer.h"
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
#include <string> #include <string>
#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER #ifndef ASSIMP_BUILD_NO_FBX_IMPORTER

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_X3D_IMPORTER #ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
#include "FIReader.hpp" #include "FIReader.hpp"
#include "StringUtils.h" #include <assimp/StringUtils.h>
// Workaround for issue #1361 // Workaround for issue #1361
// https://github.com/assimp/assimp/issues/1361 // https://github.com/assimp/assimp/issues/1361
@ -54,13 +54,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# define _GLIBCXX_USE_C99 1 # define _GLIBCXX_USE_C99 1
#endif #endif
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include <assimp/IOStream.hpp> #include <assimp/IOStream.hpp>
#include <assimp/types.h> #include <assimp/types.h>
#include "MemoryIOWrapper.h" #include <assimp/MemoryIOWrapper.h>
#include "irrXMLWrapper.h" #include <assimp/irrXMLWrapper.h>
#include "../contrib/utf8cpp/source/utf8.h" #include "../contrib/utf8cpp/source/utf8.h"
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include <stack> #include <stack>
#include <map> #include <map>
#include <iostream> #include <iostream>

View File

@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/assimp/IOSystem.hpp" #include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp" #include "../include/assimp/DefaultLogger.hpp"
#include "fast_atof.h" #include "../include/assimp/fast_atof.h"
#include "ParsingUtils.h" #include "../include/assimp/ParsingUtils.h"
namespace Assimp { namespace Assimp {

View File

@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include "FindDegenerates.h" #include "FindDegenerates.h"
#include "Exceptional.h" #include <assimp/Exceptional.h>
using namespace Assimp; using namespace Assimp;

View File

@ -50,9 +50,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "FindInvalidDataProcess.h" #include "FindInvalidDataProcess.h"
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include "Macros.h" #include <assimp/Macros.h>
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include "qnan.h" #include <assimp/qnan.h>
using namespace Assimp; using namespace Assimp;

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "FixNormalsStep.h" #include "FixNormalsStep.h"
#include "StringUtils.h" #include <assimp/StringUtils.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/postprocess.h> #include <assimp/postprocess.h>
#include <assimp/scene.h> #include <assimp/scene.h>

View File

@ -49,8 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/postprocess.h> #include <assimp/postprocess.h>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include "qnan.h" #include <assimp/qnan.h>
using namespace Assimp; using namespace Assimp;

View File

@ -49,8 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "GenVertexNormalsProcess.h" #include "GenVertexNormalsProcess.h"
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include "qnan.h" #include <assimp/qnan.h>
using namespace Assimp; using namespace Assimp;

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_HMPLOADER_H_INCLUDED #define AI_HMPLOADER_H_INCLUDED
// internal headers // internal headers
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "MDLLoader.h" #include "MDLLoader.h"
#include "HMPFileData.h" #include "HMPFileData.h"

View File

@ -5,7 +5,7 @@
#ifndef AI_IFF_H_INCLUDED #ifndef AI_IFF_H_INCLUDED
#define AI_IFF_H_INCLUDED #define AI_IFF_H_INCLUDED
#include "ByteSwapper.h" #include <assimp/ByteSwapper.h>
namespace Assimp { namespace Assimp {
namespace IFF { namespace IFF {

View File

@ -49,16 +49,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_IRR_IMPORTER #ifndef ASSIMP_BUILD_NO_IRR_IMPORTER
#include "IRRLoader.h" #include "IRRLoader.h"
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include "GenericProperty.h" #include <assimp/GenericProperty.h>
#include <assimp/SceneCombiner.h> #include <assimp/SceneCombiner.h>
#include "StandardShapes.h" #include <assimp/StandardShapes.h>
#include "Importer.h" #include "Importer.h"
// We need MathFunctions.h to compute the lcm/gcd of a number // We need MathFunctions.h to compute the lcm/gcd of a number
#include "MathFunctions.h" #include <assimp/MathFunctions.h>
#include <memory> #include <memory>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/mesh.h> #include <assimp/mesh.h>

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "IRRShared.h" #include "IRRShared.h"
#include <assimp/SceneCombiner.h> #include <assimp/SceneCombiner.h>
#include "Importer.h" #include "Importer.h"
#include "StringUtils.h" #include <assimp/StringUtils.h>
#include <assimp/anim.h> #include <assimp/anim.h>
namespace Assimp { namespace Assimp {

View File

@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER #ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER
#include "IRRMeshLoader.h" #include "IRRMeshLoader.h"
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include <memory> #include <memory>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <assimp/mesh.h> #include <assimp/mesh.h>
@ -56,7 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/material.h> #include <assimp/material.h>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
#include "Macros.h" #include <assimp/Macros.h>
using namespace Assimp; using namespace Assimp;
using namespace irr; using namespace irr;

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_IRRMESHLOADER_H_INCLUDED #ifndef AI_IRRMESHLOADER_H_INCLUDED
#define AI_IRRMESHLOADER_H_INCLUDED #define AI_IRRMESHLOADER_H_INCLUDED
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "IRRShared.h" #include "IRRShared.h"
#ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER #ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER

View File

@ -50,8 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if !(defined(ASSIMP_BUILD_NO_IRR_IMPORTER) && defined(ASSIMP_BUILD_NO_IRRMESH_IMPORTER)) #if !(defined(ASSIMP_BUILD_NO_IRR_IMPORTER) && defined(ASSIMP_BUILD_NO_IRRMESH_IMPORTER))
#include "IRRShared.h" #include "IRRShared.h"
#include "ParsingUtils.h" #include <assimp/ParsingUtils.h>
#include "fast_atof.h" #include <assimp/fast_atof.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/material.h> #include <assimp/material.h>

View File

@ -7,8 +7,8 @@
#ifndef INCLUDED_AI_IRRSHARED_H #ifndef INCLUDED_AI_IRRSHARED_H
#define INCLUDED_AI_IRRSHARED_H #define INCLUDED_AI_IRRSHARED_H
#include "irrXMLWrapper.h" #include <assimp/irrXMLWrapper.h>
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include <stdint.h> #include <stdint.h>
struct aiMaterial; struct aiMaterial;

View File

@ -64,19 +64,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Internal headers // Internal headers
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
#include "Importer.h" #include "Importer.h"
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "BaseProcess.h" #include "BaseProcess.h"
#include "DefaultProgressHandler.h" #include "DefaultProgressHandler.h"
#include "GenericProperty.h" #include <assimp/GenericProperty.h>
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include "ScenePreprocessor.h" #include "ScenePreprocessor.h"
#include "ScenePrivate.h" #include "ScenePrivate.h"
#include "MemoryIOWrapper.h" #include <assimp/MemoryIOWrapper.h>
#include "Profiler.h" #include <assimp/Profiler.h>
#include "TinyFormatter.h" #include <assimp/TinyFormatter.h>
#include "Exceptional.h" #include <assimp/Exceptional.h>
#include "Profiler.h" #include <assimp/Profiler.h>
#include <set> #include <set>
#include <memory> #include <memory>
#include <cctype> #include <cctype>

View File

@ -42,17 +42,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Implements a subset of Ifc boolean operations * @brief Implements a subset of Ifc boolean operations
*/ */
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h" #include "code/Importer/IFC/IFCUtil.h"
#include "PolyTools.h" #include "code/PolyTools.h"
#include "ProcessHelper.h" #include "code/ProcessHelper.h"
#include <assimp/Defines.h> #include <assimp/Defines.h>
#include <iterator> #include <iterator>
#include <tuple> #include <tuple>
namespace Assimp { namespace Assimp {
namespace IFC { namespace IFC {
@ -61,7 +59,7 @@ namespace Assimp {
// The function then generates a hit only if the end is beyond a certain margin in that direction, filtering out // The function then generates a hit only if the end is beyond a certain margin in that direction, filtering out
// "very close to plane" ghost hits as long as start and end stay directly on or within the given plane side. // "very close to plane" ghost hits as long as start and end stay directly on or within the given plane side.
bool IntersectSegmentPlane(const IfcVector3& p,const IfcVector3& n, const IfcVector3& e0, bool IntersectSegmentPlane(const IfcVector3& p,const IfcVector3& n, const IfcVector3& e0,
const IfcVector3& e1, bool assumeStartOnWhiteSide, IfcVector3& out) const IfcVector3& e1, bool assumeStartOnWhiteSide, IfcVector3& out)
{ {
const IfcVector3 pdelta = e0 - p, seg = e1 - e0; const IfcVector3 pdelta = e0 - p, seg = e1 - e0;
const IfcFloat dotOne = n*seg, dotTwo = -(n*pdelta); const IfcFloat dotOne = n*seg, dotTwo = -(n*pdelta);
@ -131,20 +129,20 @@ void WritePolygon(std::vector<IfcVector3>& resultpoly, TempMesh& result)
if( resultpoly.size() > 2 ) if( resultpoly.size() > 2 )
{ {
result.verts.insert(result.verts.end(), resultpoly.begin(), resultpoly.end()); result.mVerts.insert(result.mVerts.end(), resultpoly.begin(), resultpoly.end());
result.vertcnt.push_back(static_cast<unsigned int>(resultpoly.size())); result.mVertcnt.push_back(static_cast<unsigned int>(resultpoly.size()));
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessBooleanHalfSpaceDifference(const IfcHalfSpaceSolid* hs, TempMesh& result, void ProcessBooleanHalfSpaceDifference(const Schema_2x3::IfcHalfSpaceSolid* hs, TempMesh& result,
const TempMesh& first_operand, const TempMesh& first_operand,
ConversionData& /*conv*/) ConversionData& /*conv*/)
{ {
ai_assert(hs != NULL); ai_assert(hs != NULL);
const IfcPlane* const plane = hs->BaseSurface->ToPtr<IfcPlane>(); const Schema_2x3::IfcPlane* const plane = hs->BaseSurface->ToPtr<Schema_2x3::IfcPlane>();
if(!plane) { if(!plane) {
IFCImporter::LogError("expected IfcPlane as base surface for the IfcHalfSpaceSolid"); IFCImporter::LogError("expected IfcPlane as base surface for the IfcHalfSpaceSolid");
return; return;
@ -162,14 +160,14 @@ void ProcessBooleanHalfSpaceDifference(const IfcHalfSpaceSolid* hs, TempMesh& re
} }
// clip the current contents of `meshout` against the plane we obtained from the second operand // clip the current contents of `meshout` against the plane we obtained from the second operand
const std::vector<IfcVector3>& in = first_operand.verts; const std::vector<IfcVector3>& in = first_operand.mVerts;
std::vector<IfcVector3>& outvert = result.verts; std::vector<IfcVector3>& outvert = result.mVerts;
std::vector<unsigned int>::const_iterator begin = first_operand.vertcnt.begin(), std::vector<unsigned int>::const_iterator begin = first_operand.mVertcnt.begin(),
end = first_operand.vertcnt.end(), iit; end = first_operand.mVertcnt.end(), iit;
outvert.reserve(in.size()); outvert.reserve(in.size());
result.vertcnt.reserve(first_operand.vertcnt.size()); result.mVertcnt.reserve(first_operand.mVertcnt.size());
unsigned int vidx = 0; unsigned int vidx = 0;
for(iit = begin; iit != end; vidx += *iit++) { for(iit = begin; iit != end; vidx += *iit++) {
@ -229,10 +227,10 @@ void ProcessBooleanHalfSpaceDifference(const IfcHalfSpaceSolid* hs, TempMesh& re
--newcount; --newcount;
} }
if(newcount > 2) { if(newcount > 2) {
result.vertcnt.push_back(newcount); result.mVertcnt.push_back(newcount);
} }
else while(newcount-->0) { else while(newcount-->0) {
result.verts.pop_back(); result.mVerts.pop_back();
} }
} }
@ -386,13 +384,13 @@ bool PointInPoly(const IfcVector3& p, const std::vector<IfcVector3>& boundary)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBoundedHalfSpace* hs, TempMesh& result, void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const Schema_2x3::IfcPolygonalBoundedHalfSpace* hs, TempMesh& result,
const TempMesh& first_operand, const TempMesh& first_operand,
ConversionData& conv) ConversionData& conv)
{ {
ai_assert(hs != NULL); ai_assert(hs != NULL);
const IfcPlane* const plane = hs->BaseSurface->ToPtr<IfcPlane>(); const Schema_2x3::IfcPlane* const plane = hs->BaseSurface->ToPtr<Schema_2x3::IfcPlane>();
if(!plane) { if(!plane) {
IFCImporter::LogError("expected IfcPlane as base surface for the IfcHalfSpaceSolid"); IFCImporter::LogError("expected IfcPlane as base surface for the IfcHalfSpaceSolid");
return; return;
@ -419,7 +417,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
} }
// determine winding order by calculating the normal. // determine winding order by calculating the normal.
IfcVector3 profileNormal = TempMesh::ComputePolygonNormal(profile->verts.data(), profile->verts.size()); IfcVector3 profileNormal = TempMesh::ComputePolygonNormal(profile->mVerts.data(), profile->mVerts.size());
IfcMatrix4 proj_inv; IfcMatrix4 proj_inv;
ConvertAxisPlacement(proj_inv,hs->Position); ConvertAxisPlacement(proj_inv,hs->Position);
@ -430,16 +428,16 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
proj.Inverse(); proj.Inverse();
// clip the current contents of `meshout` against the plane we obtained from the second operand // clip the current contents of `meshout` against the plane we obtained from the second operand
const std::vector<IfcVector3>& in = first_operand.verts; const std::vector<IfcVector3>& in = first_operand.mVerts;
std::vector<IfcVector3>& outvert = result.verts; std::vector<IfcVector3>& outvert = result.mVerts;
std::vector<unsigned int>& outvertcnt = result.vertcnt; std::vector<unsigned int>& outvertcnt = result.mVertcnt;
outvert.reserve(in.size()); outvert.reserve(in.size());
outvertcnt.reserve(first_operand.vertcnt.size()); outvertcnt.reserve(first_operand.mVertcnt.size());
unsigned int vidx = 0; unsigned int vidx = 0;
std::vector<unsigned int>::const_iterator begin = first_operand.vertcnt.begin(); std::vector<unsigned int>::const_iterator begin = first_operand.mVertcnt.begin();
std::vector<unsigned int>::const_iterator end = first_operand.vertcnt.end(); std::vector<unsigned int>::const_iterator end = first_operand.mVertcnt.end();
std::vector<unsigned int>::const_iterator iit; std::vector<unsigned int>::const_iterator iit;
for( iit = begin; iit != end; vidx += *iit++ ) for( iit = begin; iit != end; vidx += *iit++ )
{ {
@ -510,7 +508,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
{ {
// poly edge index, intersection point, edge index in boundary poly // poly edge index, intersection point, edge index in boundary poly
std::vector<std::tuple<size_t, IfcVector3, size_t> > intersections; std::vector<std::tuple<size_t, IfcVector3, size_t> > intersections;
bool startedInside = PointInPoly(proj * blackside.front(), profile->verts); bool startedInside = PointInPoly(proj * blackside.front(), profile->mVerts);
bool isCurrentlyInside = startedInside; bool isCurrentlyInside = startedInside;
std::vector<std::pair<size_t, IfcVector3> > intersected_boundary; std::vector<std::pair<size_t, IfcVector3> > intersected_boundary;
@ -521,7 +519,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
const IfcVector3 e1 = proj * blackside[(a + 1) % blackside.size()]; const IfcVector3 e1 = proj * blackside[(a + 1) % blackside.size()];
intersected_boundary.clear(); intersected_boundary.clear();
IntersectsBoundaryProfile(e0, e1, profile->verts, isCurrentlyInside, intersected_boundary); IntersectsBoundaryProfile(e0, e1, profile->mVerts, isCurrentlyInside, intersected_boundary);
// sort the hits by distance from e0 to get the correct in/out/in sequence. Manually :-( I miss you, C++11. // sort the hits by distance from e0 to get the correct in/out/in sequence. Manually :-( I miss you, C++11.
if( intersected_boundary.size() > 1 ) if( intersected_boundary.size() > 1 )
{ {
@ -634,17 +632,17 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
// generate segments along the boundary polygon that lie in the poly's plane until we hit another intersection // generate segments along the boundary polygon that lie in the poly's plane until we hit another intersection
IfcVector3 startingPoint = proj * std::get<1>(nextintsec); IfcVector3 startingPoint = proj * std::get<1>(nextintsec);
size_t currentBoundaryEdgeIdx = (std::get<2>(nextintsec) + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size(); size_t currentBoundaryEdgeIdx = (std::get<2>(nextintsec) + (marchBackwardsOnBoundary ? 1 : 0)) % profile->mVerts.size();
size_t nextIntsecIdx = SIZE_MAX; size_t nextIntsecIdx = SIZE_MAX;
while( nextIntsecIdx == SIZE_MAX ) while( nextIntsecIdx == SIZE_MAX )
{ {
IfcFloat t = 1e10; IfcFloat t = 1e10;
size_t nextBoundaryEdgeIdx = marchBackwardsOnBoundary ? (currentBoundaryEdgeIdx + profile->verts.size() - 1) : currentBoundaryEdgeIdx + 1; size_t nextBoundaryEdgeIdx = marchBackwardsOnBoundary ? (currentBoundaryEdgeIdx + profile->mVerts.size() - 1) : currentBoundaryEdgeIdx + 1;
nextBoundaryEdgeIdx %= profile->verts.size(); nextBoundaryEdgeIdx %= profile->mVerts.size();
// vertices of the current boundary segments // vertices of the current boundary segments
IfcVector3 currBoundaryPoint = profile->verts[currentBoundaryEdgeIdx]; IfcVector3 currBoundaryPoint = profile->mVerts[currentBoundaryEdgeIdx];
IfcVector3 nextBoundaryPoint = profile->verts[nextBoundaryEdgeIdx]; IfcVector3 nextBoundaryPoint = profile->mVerts[nextBoundaryEdgeIdx];
// project the two onto the polygon // project the two onto the polygon
if( std::abs(polyNormal.z) > 1e-5 ) if( std::abs(polyNormal.z) > 1e-5 )
{ {
@ -693,7 +691,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
} }
// quick endless loop check // quick endless loop check
if( resultpoly.size() > blackside.size() + profile->verts.size() ) if( resultpoly.size() > blackside.size() + profile->mVerts.size() )
{ {
IFCImporter::LogError("Encountered endless loop while clipping polygon against poly-bounded half space."); IFCImporter::LogError("Encountered endless loop while clipping polygon against poly-bounded half space.");
break; break;
@ -718,7 +716,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, TempMesh& result, void ProcessBooleanExtrudedAreaSolidDifference(const Schema_2x3::IfcExtrudedAreaSolid* as, TempMesh& result,
const TempMesh& first_operand, const TempMesh& first_operand,
ConversionData& conv) ConversionData& conv)
{ {
@ -738,12 +736,12 @@ void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, T
TempMesh temp; TempMesh temp;
std::vector<IfcVector3>::const_iterator vit = first_operand.verts.begin(); std::vector<IfcVector3>::const_iterator vit = first_operand.mVerts.begin();
for(unsigned int pcount : first_operand.vertcnt) { for(unsigned int pcount : first_operand.mVertcnt) {
temp.Clear(); temp.Clear();
temp.verts.insert(temp.verts.end(), vit, vit + pcount); temp.mVerts.insert(temp.mVerts.end(), vit, vit + pcount);
temp.vertcnt.push_back(pcount); temp.mVertcnt.push_back(pcount);
// The algorithms used to generate mesh geometry sometimes // The algorithms used to generate mesh geometry sometimes
// spit out lines or other degenerates which must be // spit out lines or other degenerates which must be
@ -767,11 +765,11 @@ void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, T
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessBoolean(const IfcBooleanResult& boolean, TempMesh& result, ConversionData& conv) void ProcessBoolean(const Schema_2x3::IfcBooleanResult& boolean, TempMesh& result, ConversionData& conv)
{ {
// supported CSG operations: // supported CSG operations:
// DIFFERENCE // DIFFERENCE
if(const IfcBooleanResult* const clip = boolean.ToPtr<IfcBooleanResult>()) { if(const Schema_2x3::IfcBooleanResult* const clip = boolean.ToPtr<Schema_2x3::IfcBooleanResult>()) {
if(clip->Operator != "DIFFERENCE") { if(clip->Operator != "DIFFERENCE") {
IFCImporter::LogWarn("encountered unsupported boolean operator: " + (std::string)clip->Operator); IFCImporter::LogWarn("encountered unsupported boolean operator: " + (std::string)clip->Operator);
return; return;
@ -786,18 +784,18 @@ void ProcessBoolean(const IfcBooleanResult& boolean, TempMesh& result, Conversio
// IfcExtrudedAreaSolid -- reduce to an instance of the quadrify() algorithm // IfcExtrudedAreaSolid -- reduce to an instance of the quadrify() algorithm
const IfcHalfSpaceSolid* const hs = clip->SecondOperand->ResolveSelectPtr<IfcHalfSpaceSolid>(conv.db); const Schema_2x3::IfcHalfSpaceSolid* const hs = clip->SecondOperand->ResolveSelectPtr<Schema_2x3::IfcHalfSpaceSolid>(conv.db);
const IfcExtrudedAreaSolid* const as = clip->SecondOperand->ResolveSelectPtr<IfcExtrudedAreaSolid>(conv.db); const Schema_2x3::IfcExtrudedAreaSolid* const as = clip->SecondOperand->ResolveSelectPtr<Schema_2x3::IfcExtrudedAreaSolid>(conv.db);
if(!hs && !as) { if(!hs && !as) {
IFCImporter::LogError("expected IfcHalfSpaceSolid or IfcExtrudedAreaSolid as second clipping operand"); IFCImporter::LogError("expected IfcHalfSpaceSolid or IfcExtrudedAreaSolid as second clipping operand");
return; return;
} }
TempMesh first_operand; TempMesh first_operand;
if(const IfcBooleanResult* const op0 = clip->FirstOperand->ResolveSelectPtr<IfcBooleanResult>(conv.db)) { if(const Schema_2x3::IfcBooleanResult* const op0 = clip->FirstOperand->ResolveSelectPtr<Schema_2x3::IfcBooleanResult>(conv.db)) {
ProcessBoolean(*op0,first_operand,conv); ProcessBoolean(*op0,first_operand,conv);
} }
else if (const IfcSweptAreaSolid* const swept = clip->FirstOperand->ResolveSelectPtr<IfcSweptAreaSolid>(conv.db)) { else if (const Schema_2x3::IfcSweptAreaSolid* const swept = clip->FirstOperand->ResolveSelectPtr<Schema_2x3::IfcSweptAreaSolid>(conv.db)) {
ProcessSweptAreaSolid(*swept,first_operand,conv); ProcessSweptAreaSolid(*swept,first_operand,conv);
} }
else { else {
@ -807,7 +805,7 @@ void ProcessBoolean(const IfcBooleanResult& boolean, TempMesh& result, Conversio
if(hs) { if(hs) {
const IfcPolygonalBoundedHalfSpace* const hs_bounded = clip->SecondOperand->ResolveSelectPtr<IfcPolygonalBoundedHalfSpace>(conv.db); const Schema_2x3::IfcPolygonalBoundedHalfSpace* const hs_bounded = clip->SecondOperand->ResolveSelectPtr<Schema_2x3::IfcPolygonalBoundedHalfSpace>(conv.db);
if (hs_bounded) { if (hs_bounded) {
ProcessPolygonalBoundedBooleanHalfSpaceDifference(hs_bounded, result, first_operand, conv); ProcessPolygonalBoundedBooleanHalfSpaceDifference(hs_bounded, result, first_operand, conv);
} }

View File

@ -57,7 +57,7 @@ namespace {
class Conic : public Curve { class Conic : public Curve {
public: public:
// -------------------------------------------------- // --------------------------------------------------
Conic(const IfcConic& entity, ConversionData& conv) Conic(const Schema_2x3::IfcConic& entity, ConversionData& conv)
: Curve(entity,conv) { : Curve(entity,conv) {
IfcMatrix4 trafo; IfcMatrix4 trafo;
ConvertAxisPlacement(trafo,*entity.Position,conv); ConvertAxisPlacement(trafo,*entity.Position,conv);
@ -103,7 +103,7 @@ protected:
class Circle : public Conic { class Circle : public Conic {
public: public:
// -------------------------------------------------- // --------------------------------------------------
Circle(const IfcCircle& entity, ConversionData& conv) Circle(const Schema_2x3::IfcCircle& entity, ConversionData& conv)
: Conic(entity,conv) : Conic(entity,conv)
, entity(entity) , entity(entity)
{ {
@ -117,17 +117,16 @@ public:
} }
private: private:
const IfcCircle& entity; const Schema_2x3::IfcCircle& entity;
}; };
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
// Ellipse // Ellipse
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
class Ellipse : public Conic { class Ellipse : public Conic {
public: public:
// -------------------------------------------------- // --------------------------------------------------
Ellipse(const IfcEllipse& entity, ConversionData& conv) Ellipse(const Schema_2x3::IfcEllipse& entity, ConversionData& conv)
: Conic(entity,conv) : Conic(entity,conv)
, entity(entity) { , entity(entity) {
// empty // empty
@ -141,7 +140,7 @@ public:
} }
private: private:
const IfcEllipse& entity; const Schema_2x3::IfcEllipse& entity;
}; };
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
@ -150,7 +149,7 @@ private:
class Line : public Curve { class Line : public Curve {
public: public:
// -------------------------------------------------- // --------------------------------------------------
Line(const IfcLine& entity, ConversionData& conv) Line(const Schema_2x3::IfcLine& entity, ConversionData& conv)
: Curve(entity,conv) { : Curve(entity,conv) {
ConvertCartesianPoint(p,entity.Pnt); ConvertCartesianPoint(p,entity.Pnt);
ConvertVector(v,entity.Dir); ConvertVector(v,entity.Dir);
@ -181,12 +180,12 @@ public:
ai_assert( InRange( b ) ); ai_assert( InRange( b ) );
if (a == b) { if (a == b) {
out.verts.push_back(Eval(a)); out.mVerts.push_back(Eval(a));
return; return;
} }
out.verts.reserve(out.verts.size()+2); out.mVerts.reserve(out.mVerts.size()+2);
out.verts.push_back(Eval(a)); out.mVerts.push_back(Eval(a));
out.verts.push_back(Eval(b)); out.mVerts.push_back(Eval(b));
} }
// -------------------------------------------------- // --------------------------------------------------
@ -208,11 +207,11 @@ class CompositeCurve : public BoundedCurve {
public: public:
// -------------------------------------------------- // --------------------------------------------------
CompositeCurve(const IfcCompositeCurve& entity, ConversionData& conv) CompositeCurve(const Schema_2x3::IfcCompositeCurve& entity, ConversionData& conv)
: BoundedCurve(entity,conv) : BoundedCurve(entity,conv)
, total() { , total() {
curves.reserve(entity.Segments.size()); curves.reserve(entity.Segments.size());
for(const IfcCompositeCurveSegment& curveSegment :entity.Segments) { for(const Schema_2x3::IfcCompositeCurveSegment& curveSegment :entity.Segments) {
// according to the specification, this must be a bounded curve // according to the specification, this must be a bounded curve
std::shared_ptr< Curve > cv(Curve::Convert(curveSegment.ParentCurve,conv)); std::shared_ptr< Curve > cv(Curve::Convert(curveSegment.ParentCurve,conv));
std::shared_ptr< BoundedCurve > bc = std::dynamic_pointer_cast<BoundedCurve>(cv); std::shared_ptr< BoundedCurve > bc = std::dynamic_pointer_cast<BoundedCurve>(cv);
@ -282,14 +281,14 @@ public:
ai_assert( InRange( b ) ); ai_assert( InRange( b ) );
const size_t cnt = EstimateSampleCount(a,b); const size_t cnt = EstimateSampleCount(a,b);
out.verts.reserve(out.verts.size() + cnt); out.mVerts.reserve(out.mVerts.size() + cnt);
for(const CurveEntry& entry : curves) { for(const CurveEntry& entry : curves) {
const size_t cnt = out.verts.size(); const size_t cnt = out.mVerts.size();
entry.first->SampleDiscrete(out); entry.first->SampleDiscrete(out);
if (!entry.second && cnt != out.verts.size()) { if (!entry.second && cnt != out.mVerts.size()) {
std::reverse(out.verts.begin()+cnt,out.verts.end()); std::reverse(out.mVerts.begin()+cnt,out.mVerts.end());
} }
} }
} }
@ -310,7 +309,7 @@ private:
class TrimmedCurve : public BoundedCurve { class TrimmedCurve : public BoundedCurve {
public: public:
// -------------------------------------------------- // --------------------------------------------------
TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv) TrimmedCurve(const Schema_2x3::IfcTrimmedCurve& entity, ConversionData& conv)
: BoundedCurve(entity,conv) : BoundedCurve(entity,conv)
{ {
base = std::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv)); base = std::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv));
@ -325,12 +324,12 @@ public:
bool have_param = false, have_point = false; bool have_param = false, have_point = false;
IfcVector3 point; IfcVector3 point;
for(const Entry sel :entity.Trim1) { for(const Entry sel :entity.Trim1) {
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) { if (const ::Assimp::STEP::EXPRESS::REAL* const r = sel->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
range.first = *r; range.first = *r;
have_param = true; have_param = true;
break; break;
} }
else if (const IfcCartesianPoint* const r = sel->ResolveSelectPtr<IfcCartesianPoint>(conv.db)) { else if (const Schema_2x3::IfcCartesianPoint* const r = sel->ResolveSelectPtr<Schema_2x3::IfcCartesianPoint>(conv.db)) {
ConvertCartesianPoint(point,*r); ConvertCartesianPoint(point,*r);
have_point = true; have_point = true;
} }
@ -342,12 +341,12 @@ public:
} }
have_param = false, have_point = false; have_param = false, have_point = false;
for(const Entry sel :entity.Trim2) { for(const Entry sel :entity.Trim2) {
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) { if (const ::Assimp::STEP::EXPRESS::REAL* const r = sel->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
range.second = *r; range.second = *r;
have_param = true; have_param = true;
break; break;
} }
else if (const IfcCartesianPoint* const r = sel->ResolveSelectPtr<IfcCartesianPoint>(conv.db)) { else if (const Schema_2x3::IfcCartesianPoint* const r = sel->ResolveSelectPtr<Schema_2x3::IfcCartesianPoint>(conv.db)) {
ConvertCartesianPoint(point,*r); ConvertCartesianPoint(point,*r);
have_point = true; have_point = true;
} }
@ -420,13 +419,13 @@ private:
class PolyLine : public BoundedCurve { class PolyLine : public BoundedCurve {
public: public:
// -------------------------------------------------- // --------------------------------------------------
PolyLine(const IfcPolyline& entity, ConversionData& conv) PolyLine(const Schema_2x3::IfcPolyline& entity, ConversionData& conv)
: BoundedCurve(entity,conv) : BoundedCurve(entity,conv)
{ {
points.reserve(entity.Points.size()); points.reserve(entity.Points.size());
IfcVector3 t; IfcVector3 t;
for(const IfcCartesianPoint& cp : entity.Points) { for(const Schema_2x3::IfcCartesianPoint& cp : entity.Points) {
ConvertCartesianPoint(t,cp); ConvertCartesianPoint(t,cp);
points.push_back(t); points.push_back(t);
} }
@ -463,29 +462,29 @@ private:
} // anon } // anon
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Curve* Curve::Convert(const IFC::IfcCurve& curve,ConversionData& conv) { Curve* Curve::Convert(const IFC::Schema_2x3::IfcCurve& curve,ConversionData& conv) {
if(curve.ToPtr<IfcBoundedCurve>()) { if(curve.ToPtr<Schema_2x3::IfcBoundedCurve>()) {
if(const IfcPolyline* c = curve.ToPtr<IfcPolyline>()) { if(const Schema_2x3::IfcPolyline* c = curve.ToPtr<Schema_2x3::IfcPolyline>()) {
return new PolyLine(*c,conv); return new PolyLine(*c,conv);
} }
if(const IfcTrimmedCurve* c = curve.ToPtr<IfcTrimmedCurve>()) { if(const Schema_2x3::IfcTrimmedCurve* c = curve.ToPtr<Schema_2x3::IfcTrimmedCurve>()) {
return new TrimmedCurve(*c,conv); return new TrimmedCurve(*c,conv);
} }
if(const IfcCompositeCurve* c = curve.ToPtr<IfcCompositeCurve>()) { if(const Schema_2x3::IfcCompositeCurve* c = curve.ToPtr<Schema_2x3::IfcCompositeCurve>()) {
return new CompositeCurve(*c,conv); return new CompositeCurve(*c,conv);
} }
} }
if(curve.ToPtr<IfcConic>()) { if(curve.ToPtr<Schema_2x3::IfcConic>()) {
if(const IfcCircle* c = curve.ToPtr<IfcCircle>()) { if(const Schema_2x3::IfcCircle* c = curve.ToPtr<Schema_2x3::IfcCircle>()) {
return new Circle(*c,conv); return new Circle(*c,conv);
} }
if(const IfcEllipse* c = curve.ToPtr<IfcEllipse>()) { if(const Schema_2x3::IfcEllipse* c = curve.ToPtr<Schema_2x3::IfcEllipse>()) {
return new Ellipse(*c,conv); return new Ellipse(*c,conv);
} }
} }
if(const IfcLine* c = curve.ToPtr<IfcLine>()) { if(const Schema_2x3::IfcLine* c = curve.ToPtr<Schema_2x3::IfcLine>()) {
return new Line(*c,conv); return new Line(*c,conv);
} }
@ -589,11 +588,11 @@ void Curve::SampleDiscrete(TempMesh& out,IfcFloat a, IfcFloat b) const {
ai_assert( InRange( b ) ); ai_assert( InRange( b ) );
const size_t cnt = std::max(static_cast<size_t>(0),EstimateSampleCount(a,b)); const size_t cnt = std::max(static_cast<size_t>(0),EstimateSampleCount(a,b));
out.verts.reserve( out.verts.size() + cnt + 1); out.mVerts.reserve( out.mVerts.size() + cnt + 1);
IfcFloat p = a, delta = (b-a)/cnt; IfcFloat p = a, delta = (b-a)/cnt;
for(size_t i = 0; i <= cnt; ++i, p += delta) { for(size_t i = 0; i <= cnt; ++i, p += delta) {
out.verts.push_back(Eval(p)); out.mVerts.push_back(Eval(p));
} }
} }

View File

@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h" #include "IFCUtil.h"
#include "PolyTools.h" #include "code/PolyTools.h"
#include "ProcessHelper.h" #include "code/ProcessHelper.h"
#include "../contrib/poly2tri/poly2tri/poly2tri.h" #include "../contrib/poly2tri/poly2tri/poly2tri.h"
#include "../contrib/clipper/clipper.hpp" #include "../contrib/clipper/clipper.hpp"
@ -59,27 +59,27 @@ namespace Assimp {
namespace IFC { namespace IFC {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData& /*conv*/) bool ProcessPolyloop(const Schema_2x3::IfcPolyLoop& loop, TempMesh& meshout, ConversionData& /*conv*/)
{ {
size_t cnt = 0; size_t cnt = 0;
for(const IfcCartesianPoint& c : loop.Polygon) { for(const Schema_2x3::IfcCartesianPoint& c : loop.Polygon) {
IfcVector3 tmp; IfcVector3 tmp;
ConvertCartesianPoint(tmp,c); ConvertCartesianPoint(tmp,c);
meshout.verts.push_back(tmp); meshout.mVerts.push_back(tmp);
++cnt; ++cnt;
} }
meshout.vertcnt.push_back(static_cast<unsigned int>(cnt)); meshout.mVertcnt.push_back(static_cast<unsigned int>(cnt));
// zero- or one- vertex polyloops simply ignored // zero- or one- vertex polyloops simply ignored
if (meshout.vertcnt.back() > 1) { if (meshout.mVertcnt.back() > 1) {
return true; return true;
} }
if (meshout.vertcnt.back()==1) { if (meshout.mVertcnt.back()==1) {
meshout.vertcnt.pop_back(); meshout.mVertcnt.pop_back();
meshout.verts.pop_back(); meshout.mVerts.pop_back();
} }
return false; return false;
} }
@ -88,19 +88,19 @@ bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData&
void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t master_bounds = (size_t)-1) void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t master_bounds = (size_t)-1)
{ {
// handle all trivial cases // handle all trivial cases
if(inmesh.vertcnt.empty()) { if(inmesh.mVertcnt.empty()) {
return; return;
} }
if(inmesh.vertcnt.size() == 1) { if(inmesh.mVertcnt.size() == 1) {
result.Append(inmesh); result.Append(inmesh);
return; return;
} }
ai_assert(std::count(inmesh.vertcnt.begin(), inmesh.vertcnt.end(), 0) == 0); ai_assert(std::count(inmesh.mVertcnt.begin(), inmesh.mVertcnt.end(), 0) == 0);
typedef std::vector<unsigned int>::const_iterator face_iter; typedef std::vector<unsigned int>::const_iterator face_iter;
face_iter begin = inmesh.vertcnt.begin(), end = inmesh.vertcnt.end(), iit; face_iter begin = inmesh.mVertcnt.begin(), end = inmesh.mVertcnt.end(), iit;
std::vector<unsigned int>::const_iterator outer_polygon_it = end; std::vector<unsigned int>::const_iterator outer_polygon_it = end;
// major task here: given a list of nested polygon boundaries (one of which // major task here: given a list of nested polygon boundaries (one of which
@ -119,7 +119,7 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
// shall be of the type IfcFaceOuterBound' // shall be of the type IfcFaceOuterBound'
IfcFloat area_outer_polygon = 1e-10f; IfcFloat area_outer_polygon = 1e-10f;
if (master_bounds != (size_t)-1) { if (master_bounds != (size_t)-1) {
ai_assert(master_bounds < inmesh.vertcnt.size()); ai_assert(master_bounds < inmesh.mVertcnt.size());
outer_polygon_it = begin + master_bounds; outer_polygon_it = begin + master_bounds;
} }
else { else {
@ -146,9 +146,9 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
// this is the plane onto which the quadrulate algorithm will // this is the plane onto which the quadrulate algorithm will
// project the entire mesh. // project the entire mesh.
std::vector<TempOpening> fake_openings; std::vector<TempOpening> fake_openings;
fake_openings.reserve(inmesh.vertcnt.size()-1); fake_openings.reserve(inmesh.mVertcnt.size()-1);
std::vector<IfcVector3>::const_iterator vit = inmesh.verts.begin(), outer_vit; std::vector<IfcVector3>::const_iterator vit = inmesh.mVerts.begin(), outer_vit;
for(iit = begin; iit != end; vit += *iit++) { for(iit = begin; iit != end; vit += *iit++) {
if (iit == outer_polygon_it) { if (iit == outer_polygon_it) {
@ -171,32 +171,32 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
opening.solid = NULL; opening.solid = NULL;
opening.profileMesh = std::make_shared<TempMesh>(); opening.profileMesh = std::make_shared<TempMesh>();
opening.profileMesh->verts.reserve(*iit); opening.profileMesh->mVerts.reserve(*iit);
opening.profileMesh->vertcnt.push_back(*iit); opening.profileMesh->mVertcnt.push_back(*iit);
std::copy(vit, vit + *iit, std::back_inserter(opening.profileMesh->verts)); std::copy(vit, vit + *iit, std::back_inserter(opening.profileMesh->mVerts));
} }
// fill a mesh with ONLY the main polygon // fill a mesh with ONLY the main polygon
TempMesh temp; TempMesh temp;
temp.verts.reserve(outer_polygon_size); temp.mVerts.reserve(outer_polygon_size);
temp.vertcnt.push_back(static_cast<unsigned int>(outer_polygon_size)); temp.mVertcnt.push_back(static_cast<unsigned int>(outer_polygon_size));
std::copy(outer_vit, outer_vit+outer_polygon_size, std::copy(outer_vit, outer_vit+outer_polygon_size,
std::back_inserter(temp.verts)); std::back_inserter(temp.mVerts));
GenerateOpenings(fake_openings, normals, temp, false, false); GenerateOpenings(fake_openings, normals, temp, false, false);
result.Append(temp); result.Append(temp);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result, ConversionData& conv) void ProcessConnectedFaceSet(const Schema_2x3::IfcConnectedFaceSet& fset, TempMesh& result, ConversionData& conv)
{ {
for(const IfcFace& face : fset.CfsFaces) { for(const Schema_2x3::IfcFace& face : fset.CfsFaces) {
// size_t ob = -1, cnt = 0; // size_t ob = -1, cnt = 0;
TempMesh meshout; TempMesh meshout;
for(const IfcFaceBound& bound : face.Bounds) { for(const Schema_2x3::IfcFaceBound& bound : face.Bounds) {
if(const IfcPolyLoop* const polyloop = bound.Bound->ToPtr<IfcPolyLoop>()) { if(const Schema_2x3::IfcPolyLoop* const polyloop = bound.Bound->ToPtr<Schema_2x3::IfcPolyLoop>()) {
if(ProcessPolyloop(*polyloop, meshout,conv)) { if(ProcessPolyloop(*polyloop, meshout,conv)) {
// The outer boundary is better determined by checking which // The outer boundary is better determined by checking which
@ -230,12 +230,12 @@ void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& result, ConversionData& conv) void ProcessRevolvedAreaSolid(const Schema_2x3::IfcRevolvedAreaSolid& solid, TempMesh& result, ConversionData& conv)
{ {
TempMesh meshout; TempMesh meshout;
// first read the profile description // first read the profile description
if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.verts.size()<=1) { if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.mVerts.size()<=1) {
return; return;
} }
@ -246,7 +246,7 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
IfcMatrix4::Translation(pos,tb0); IfcMatrix4::Translation(pos,tb0);
IfcMatrix4::Translation(-pos,tb1); IfcMatrix4::Translation(-pos,tb1);
const std::vector<IfcVector3>& in = meshout.verts; const std::vector<IfcVector3>& in = meshout.mVerts;
const size_t size=in.size(); const size_t size=in.size();
bool has_area = solid.SweptArea->ProfileType == "AREA" && size>2; bool has_area = solid.SweptArea->ProfileType == "AREA" && size>2;
@ -263,14 +263,14 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
has_area = has_area && std::fabs(max_angle) < AI_MATH_TWO_PI_F*0.99; has_area = has_area && std::fabs(max_angle) < AI_MATH_TWO_PI_F*0.99;
result.verts.reserve(size*((cnt_segments+1)*4+(has_area?2:0))); result.mVerts.reserve(size*((cnt_segments+1)*4+(has_area?2:0)));
result.vertcnt.reserve(size*cnt_segments+2); result.mVertcnt.reserve(size*cnt_segments+2);
IfcMatrix4 rot; IfcMatrix4 rot;
rot = tb0 * IfcMatrix4::Rotation(delta,axis,rot) * tb1; rot = tb0 * IfcMatrix4::Rotation(delta,axis,rot) * tb1;
size_t base = 0; size_t base = 0;
std::vector<IfcVector3>& out = result.verts; std::vector<IfcVector3>& out = result.mVerts;
// dummy data to simplify later processing // dummy data to simplify later processing
for(size_t i = 0; i < size; ++i) { for(size_t i = 0; i < size; ++i) {
@ -281,7 +281,7 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
for(size_t i = 0; i < size; ++i) { for(size_t i = 0; i < size; ++i) {
const size_t next = (i+1)%size; const size_t next = (i+1)%size;
result.vertcnt.push_back(4); result.mVertcnt.push_back(4);
const IfcVector3 base_0 = out[base+i*4+3],base_1 = out[base+next*4+3]; const IfcVector3 base_0 = out[base+i*4+3],base_1 = out[base+next*4+3];
out.push_back(base_0); out.push_back(base_0);
@ -305,8 +305,8 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
for(size_t i = 0; i < size; ++i ) { for(size_t i = 0; i < size; ++i ) {
out.push_back(out[i*4]); out.push_back(out[i*4]);
} }
result.vertcnt.push_back(static_cast<unsigned int>(size)); result.mVertcnt.push_back(static_cast<unsigned int>(size));
result.vertcnt.push_back(static_cast<unsigned int>(size)); result.mVertcnt.push_back(static_cast<unsigned int>(size));
} }
IfcMatrix4 trafo; IfcMatrix4 trafo;
@ -316,10 +316,8 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
IFCImporter::LogDebug("generate mesh procedurally by radial extrusion (IfcRevolvedAreaSolid)"); IFCImporter::LogDebug("generate mesh procedurally by radial extrusion (IfcRevolvedAreaSolid)");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, ConversionData& conv) void ProcessSweptDiskSolid(const Schema_2x3::IfcSweptDiskSolid solid, TempMesh& result, ConversionData& conv)
{ {
const Curve* const curve = Curve::Convert(*solid.Directrix, conv); const Curve* const curve = Curve::Convert(*solid.Directrix, conv);
if(!curve) { if(!curve) {
@ -332,12 +330,12 @@ void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, Conv
TempMesh temp; TempMesh temp;
curve->SampleDiscrete(temp, solid.StartParam, solid.EndParam); curve->SampleDiscrete(temp, solid.StartParam, solid.EndParam);
const std::vector<IfcVector3>& curve_points = temp.verts; const std::vector<IfcVector3>& curve_points = temp.mVerts;
const size_t samples = curve_points.size(); const size_t samples = curve_points.size();
result.verts.reserve(cnt_segments * samples * 4); result.mVerts.reserve(cnt_segments * samples * 4);
result.vertcnt.reserve((cnt_segments - 1) * samples); result.mVertcnt.reserve((cnt_segments - 1) * samples);
std::vector<IfcVector3> points; std::vector<IfcVector3> points;
points.reserve(cnt_segments * samples); points.reserve(cnt_segments * samples);
@ -434,22 +432,22 @@ void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, Conv
for (unsigned int seg = 0; seg < cnt_segments; ++seg) { for (unsigned int seg = 0; seg < cnt_segments; ++seg) {
result.verts.push_back(points[ i * cnt_segments + (seg % cnt_segments)]); result.mVerts.push_back(points[ i * cnt_segments + (seg % cnt_segments)]);
result.verts.push_back(points[ i * cnt_segments + (seg + 1) % cnt_segments]); result.mVerts.push_back(points[ i * cnt_segments + (seg + 1) % cnt_segments]);
result.verts.push_back(points[ (i+1) * cnt_segments + ((seg + 1 + best_pair_offset) % cnt_segments)]); result.mVerts.push_back(points[ (i+1) * cnt_segments + ((seg + 1 + best_pair_offset) % cnt_segments)]);
result.verts.push_back(points[ (i+1) * cnt_segments + ((seg + best_pair_offset) % cnt_segments)]); result.mVerts.push_back(points[ (i+1) * cnt_segments + ((seg + best_pair_offset) % cnt_segments)]);
IfcVector3& v1 = *(result.verts.end()-1); IfcVector3& v1 = *(result.mVerts.end()-1);
IfcVector3& v2 = *(result.verts.end()-2); IfcVector3& v2 = *(result.mVerts.end()-2);
IfcVector3& v3 = *(result.verts.end()-3); IfcVector3& v3 = *(result.mVerts.end()-3);
IfcVector3& v4 = *(result.verts.end()-4); IfcVector3& v4 = *(result.mVerts.end()-4);
if (((v4-v3) ^ (v4-v1)) * (v4 - curve_points[i]) < 0.0f) { if (((v4-v3) ^ (v4-v1)) * (v4 - curve_points[i]) < 0.0f) {
std::swap(v4, v1); std::swap(v4, v1);
std::swap(v3, v2); std::swap(v3, v2);
} }
result.vertcnt.push_back(4); result.mVertcnt.push_back(4);
} }
} }
@ -459,14 +457,15 @@ void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, Conv
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVector3& norOut) IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVector3& norOut)
{ {
const std::vector<IfcVector3>& out = curmesh.verts; const std::vector<IfcVector3>& out = curmesh.mVerts;
IfcMatrix3 m; IfcMatrix3 m;
ok = true; ok = true;
// The input "mesh" must be a single polygon // The input "mesh" must be a single polygon
const size_t s = out.size(); const size_t s = out.size();
assert(curmesh.vertcnt.size() == 1 && curmesh.vertcnt.back() == s); ai_assert( curmesh.mVertcnt.size() == 1 );
ai_assert( curmesh.mVertcnt.back() == s);
const IfcVector3 any_point = out[s-1]; const IfcVector3 any_point = out[s-1];
IfcVector3 nor; IfcVector3 nor;
@ -477,9 +476,10 @@ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVect
// axis for the 2D coordinate space on the polygon plane, exploiting the // axis for the 2D coordinate space on the polygon plane, exploiting the
// fact that the input polygon is nearly always a quad. // fact that the input polygon is nearly always a quad.
bool done = false; bool done = false;
size_t i, j; size_t idx( 0 );
for (i = 0; !done && i < s-2; done || ++i) { for (size_t i = 0; !done && i < s-2; done || ++i) {
for (j = i+1; j < s-1; ++j) { idx = i;
for (size_t j = i+1; j < s-1; ++j) {
nor = -((out[i]-any_point)^(out[j]-any_point)); nor = -((out[i]-any_point)^(out[j]-any_point));
if(std::fabs(nor.Length()) > 1e-8f) { if(std::fabs(nor.Length()) > 1e-8f) {
done = true; done = true;
@ -496,7 +496,7 @@ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVect
nor.Normalize(); nor.Normalize();
norOut = nor; norOut = nor;
IfcVector3 r = (out[i]-any_point); IfcVector3 r = (out[idx]-any_point);
r.Normalize(); r.Normalize();
//if(d) { //if(d) {
@ -524,12 +524,12 @@ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVect
} }
// Extrudes the given polygon along the direction, converts it into an opening or applies all openings as necessary. // Extrudes the given polygon along the direction, converts it into an opening or applies all openings as necessary.
void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curve, void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const TempMesh& curve,
const IfcVector3& extrusionDir, TempMesh& result, ConversionData &conv, bool collect_openings) const IfcVector3& extrusionDir, TempMesh& result, ConversionData &conv, bool collect_openings)
{ {
// Outline: 'curve' is now a list of vertex points forming the underlying profile, extrude along the given axis, // Outline: 'curve' is now a list of vertex points forming the underlying profile, extrude along the given axis,
// forming new triangles. // forming new triangles.
const bool has_area = solid.SweptArea->ProfileType == "AREA" && curve.verts.size() > 2; const bool has_area = solid.SweptArea->ProfileType == "AREA" && curve.mVerts.size() > 2;
if( solid.Depth < 1e-6 ) { if( solid.Depth < 1e-6 ) {
if( has_area ) { if( has_area ) {
result.Append(curve); result.Append(curve);
@ -537,9 +537,9 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
return; return;
} }
result.verts.reserve(curve.verts.size()*(has_area ? 4 : 2)); result.mVerts.reserve(curve.mVerts.size()*(has_area ? 4 : 2));
result.vertcnt.reserve(curve.verts.size() + 2); result.mVertcnt.reserve(curve.mVerts.size() + 2);
std::vector<IfcVector3> in = curve.verts; std::vector<IfcVector3> in = curve.mVerts;
// First step: transform all vertices into the target coordinate space // First step: transform all vertices into the target coordinate space
IfcMatrix4 trafo; IfcMatrix4 trafo;
@ -582,24 +582,24 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
for(TempOpening& t : *conv.apply_openings) { for(TempOpening& t : *conv.apply_openings) {
TempMesh& bounds = *t.profileMesh.get(); TempMesh& bounds = *t.profileMesh.get();
if( bounds.verts.size() <= 2 ) { if( bounds.mVerts.size() <= 2 ) {
nors.push_back(IfcVector3()); nors.push_back(IfcVector3());
continue; continue;
} }
nors.push_back(((bounds.verts[2] - bounds.verts[0]) ^ (bounds.verts[1] - bounds.verts[0])).Normalize()); nors.push_back(((bounds.mVerts[2] - bounds.mVerts[0]) ^ (bounds.mVerts[1] - bounds.mVerts[0])).Normalize());
} }
} }
TempMesh temp; TempMesh temp;
TempMesh& curmesh = openings ? temp : result; TempMesh& curmesh = openings ? temp : result;
std::vector<IfcVector3>& out = curmesh.verts; std::vector<IfcVector3>& out = curmesh.mVerts;
size_t sides_with_openings = 0; size_t sides_with_openings = 0;
for( size_t i = 0; i < in.size(); ++i ) { for( size_t i = 0; i < in.size(); ++i ) {
const size_t next = (i + 1) % in.size(); const size_t next = (i + 1) % in.size();
curmesh.vertcnt.push_back(4); curmesh.mVertcnt.push_back(4);
out.push_back(in[i]); out.push_back(in[i]);
out.push_back(in[next]); out.push_back(in[next]);
@ -638,7 +638,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
out.push_back(in[i]); out.push_back(in[i]);
} }
curmesh.vertcnt.push_back(static_cast<unsigned int>(in.size())); curmesh.mVertcnt.push_back(static_cast<unsigned int>(in.size()));
if( openings && in.size() > 2 ) { if( openings && in.size() > 2 ) {
if( GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) { if( GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) {
++sides_with_v_openings; ++sides_with_v_openings;
@ -664,8 +664,8 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
profile->Swap(result); profile->Swap(result);
std::shared_ptr<TempMesh> profile2D = std::shared_ptr<TempMesh>(new TempMesh()); std::shared_ptr<TempMesh> profile2D = std::shared_ptr<TempMesh>(new TempMesh());
profile2D->verts.insert(profile2D->verts.end(), in.begin(), in.end()); profile2D->mVerts.insert(profile2D->mVerts.end(), in.begin(), in.end());
profile2D->vertcnt.push_back(static_cast<unsigned int>(in.size())); profile2D->mVertcnt.push_back(static_cast<unsigned int>(in.size()));
conv.collect_openings->push_back(TempOpening(&solid, dir, profile, profile2D)); conv.collect_openings->push_back(TempOpening(&solid, dir, profile, profile2D));
ai_assert(result.IsEmpty()); ai_assert(result.IsEmpty());
@ -673,13 +673,13 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& result, void ProcessExtrudedAreaSolid(const Schema_2x3::IfcExtrudedAreaSolid& solid, TempMesh& result,
ConversionData& conv, bool collect_openings) ConversionData& conv, bool collect_openings)
{ {
TempMesh meshout; TempMesh meshout;
// First read the profile description. // First read the profile description.
if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.verts.size()<=1) { if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.mVerts.size()<=1) {
return; return;
} }
@ -691,13 +691,13 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
// and there's still so many corner cases uncovered - we really need a generic solution to all of this hole carving. // and there's still so many corner cases uncovered - we really need a generic solution to all of this hole carving.
std::vector<TempOpening> fisherPriceMyFirstOpenings; std::vector<TempOpening> fisherPriceMyFirstOpenings;
std::vector<TempOpening>* oldApplyOpenings = conv.apply_openings; std::vector<TempOpening>* oldApplyOpenings = conv.apply_openings;
if( const IfcArbitraryProfileDefWithVoids* const cprofile = solid.SweptArea->ToPtr<IfcArbitraryProfileDefWithVoids>() ) { if( const Schema_2x3::IfcArbitraryProfileDefWithVoids* const cprofile = solid.SweptArea->ToPtr<Schema_2x3::IfcArbitraryProfileDefWithVoids>() ) {
if( !cprofile->InnerCurves.empty() ) { if( !cprofile->InnerCurves.empty() ) {
// read all inner curves and extrude them to form proper openings. // read all inner curves and extrude them to form proper openings.
std::vector<TempOpening>* oldCollectOpenings = conv.collect_openings; std::vector<TempOpening>* oldCollectOpenings = conv.collect_openings;
conv.collect_openings = &fisherPriceMyFirstOpenings; conv.collect_openings = &fisherPriceMyFirstOpenings;
for(const IfcCurve* curve : cprofile->InnerCurves) { for (const Schema_2x3::IfcCurve* curve : cprofile->InnerCurves) {
TempMesh curveMesh, tempMesh; TempMesh curveMesh, tempMesh;
ProcessCurve(*curve, curveMesh, conv); ProcessCurve(*curve, curveMesh, conv);
ProcessExtrudedArea(solid, curveMesh, dir, tempMesh, conv, true); ProcessExtrudedArea(solid, curveMesh, dir, tempMesh, conv, true);
@ -713,13 +713,13 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessSweptAreaSolid(const IfcSweptAreaSolid& swept, TempMesh& meshout, void ProcessSweptAreaSolid(const Schema_2x3::IfcSweptAreaSolid& swept, TempMesh& meshout,
ConversionData& conv) ConversionData& conv)
{ {
if(const IfcExtrudedAreaSolid* const solid = swept.ToPtr<IfcExtrudedAreaSolid>()) { if(const Schema_2x3::IfcExtrudedAreaSolid* const solid = swept.ToPtr<Schema_2x3::IfcExtrudedAreaSolid>()) {
ProcessExtrudedAreaSolid(*solid,meshout,conv, !!conv.collect_openings); ProcessExtrudedAreaSolid(*solid,meshout,conv, !!conv.collect_openings);
} }
else if(const IfcRevolvedAreaSolid* const rev = swept.ToPtr<IfcRevolvedAreaSolid>()) { else if(const Schema_2x3::IfcRevolvedAreaSolid* const rev = swept.ToPtr<Schema_2x3::IfcRevolvedAreaSolid>()) {
ProcessRevolvedAreaSolid(*rev,meshout,conv); ProcessRevolvedAreaSolid(*rev,meshout,conv);
} }
else { else {
@ -728,16 +728,16 @@ void ProcessSweptAreaSolid(const IfcSweptAreaSolid& swept, TempMesh& meshout,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid, std::vector<unsigned int>& mesh_indices, bool ProcessGeometricItem(const Schema_2x3::IfcRepresentationItem& geo, unsigned int matid, std::vector<unsigned int>& mesh_indices,
ConversionData& conv) ConversionData& conv)
{ {
bool fix_orientation = false; bool fix_orientation = false;
std::shared_ptr< TempMesh > meshtmp = std::make_shared<TempMesh>(); std::shared_ptr< TempMesh > meshtmp = std::make_shared<TempMesh>();
if(const IfcShellBasedSurfaceModel* shellmod = geo.ToPtr<IfcShellBasedSurfaceModel>()) { if(const Schema_2x3::IfcShellBasedSurfaceModel* shellmod = geo.ToPtr<Schema_2x3::IfcShellBasedSurfaceModel>()) {
for(std::shared_ptr<const IfcShell> shell :shellmod->SbsmBoundary) { for(std::shared_ptr<const Schema_2x3::IfcShell> shell :shellmod->SbsmBoundary) {
try { try {
const EXPRESS::ENTITY& e = shell->To<ENTITY>(); const ::Assimp::STEP::EXPRESS::ENTITY& e = shell->To<::Assimp::STEP::EXPRESS::ENTITY>();
const IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To<IfcConnectedFaceSet>(); const Schema_2x3::IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To<Schema_2x3::IfcConnectedFaceSet>();
ProcessConnectedFaceSet(fs,*meshtmp.get(),conv); ProcessConnectedFaceSet(fs,*meshtmp.get(),conv);
} }
@ -747,30 +747,30 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
} }
fix_orientation = true; fix_orientation = true;
} }
else if(const IfcConnectedFaceSet* fset = geo.ToPtr<IfcConnectedFaceSet>()) { else if(const Schema_2x3::IfcConnectedFaceSet* fset = geo.ToPtr<Schema_2x3::IfcConnectedFaceSet>()) {
ProcessConnectedFaceSet(*fset,*meshtmp.get(),conv); ProcessConnectedFaceSet(*fset,*meshtmp.get(),conv);
fix_orientation = true; fix_orientation = true;
} }
else if(const IfcSweptAreaSolid* swept = geo.ToPtr<IfcSweptAreaSolid>()) { else if(const Schema_2x3::IfcSweptAreaSolid* swept = geo.ToPtr<Schema_2x3::IfcSweptAreaSolid>()) {
ProcessSweptAreaSolid(*swept,*meshtmp.get(),conv); ProcessSweptAreaSolid(*swept,*meshtmp.get(),conv);
} }
else if(const IfcSweptDiskSolid* disk = geo.ToPtr<IfcSweptDiskSolid>()) { else if(const Schema_2x3::IfcSweptDiskSolid* disk = geo.ToPtr<Schema_2x3::IfcSweptDiskSolid>()) {
ProcessSweptDiskSolid(*disk,*meshtmp.get(),conv); ProcessSweptDiskSolid(*disk,*meshtmp.get(),conv);
} }
else if(const IfcManifoldSolidBrep* brep = geo.ToPtr<IfcManifoldSolidBrep>()) { else if(const Schema_2x3::IfcManifoldSolidBrep* brep = geo.ToPtr<Schema_2x3::IfcManifoldSolidBrep>()) {
ProcessConnectedFaceSet(brep->Outer,*meshtmp.get(),conv); ProcessConnectedFaceSet(brep->Outer,*meshtmp.get(),conv);
fix_orientation = true; fix_orientation = true;
} }
else if(const IfcFaceBasedSurfaceModel* surf = geo.ToPtr<IfcFaceBasedSurfaceModel>()) { else if(const Schema_2x3::IfcFaceBasedSurfaceModel* surf = geo.ToPtr<Schema_2x3::IfcFaceBasedSurfaceModel>()) {
for(const IfcConnectedFaceSet& fc : surf->FbsmFaces) { for(const Schema_2x3::IfcConnectedFaceSet& fc : surf->FbsmFaces) {
ProcessConnectedFaceSet(fc,*meshtmp.get(),conv); ProcessConnectedFaceSet(fc,*meshtmp.get(),conv);
} }
fix_orientation = true; fix_orientation = true;
} }
else if(const IfcBooleanResult* boolean = geo.ToPtr<IfcBooleanResult>()) { else if(const Schema_2x3::IfcBooleanResult* boolean = geo.ToPtr<Schema_2x3::IfcBooleanResult>()) {
ProcessBoolean(*boolean,*meshtmp.get(),conv); ProcessBoolean(*boolean,*meshtmp.get(),conv);
} }
else if(geo.ToPtr<IfcBoundingBox>()) { else if(geo.ToPtr<Schema_2x3::IfcBoundingBox>()) {
// silently skip over bounding boxes // silently skip over bounding boxes
return false; return false;
} }
@ -788,7 +788,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
// which returns an empty mesh. // which returns an empty mesh.
if(conv.collect_openings) { if(conv.collect_openings) {
if (!meshtmp->IsEmpty()) { if (!meshtmp->IsEmpty()) {
conv.collect_openings->push_back(TempOpening(geo.ToPtr<IfcSolidModel>(), conv.collect_openings->push_back(TempOpening(geo.ToPtr<Schema_2x3::IfcSolidModel>(),
IfcVector3(0,0,0), IfcVector3(0,0,0),
meshtmp, meshtmp,
std::shared_ptr<TempMesh>())); std::shared_ptr<TempMesh>()));
@ -837,7 +837,7 @@ void AssignAddedMeshes(std::vector<unsigned int>& mesh_indices,aiNode* nd,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool TryQueryMeshCache(const IfcRepresentationItem& item, bool TryQueryMeshCache(const Schema_2x3::IfcRepresentationItem& item,
std::vector<unsigned int>& mesh_indices, unsigned int mat_index, std::vector<unsigned int>& mesh_indices, unsigned int mat_index,
ConversionData& conv) ConversionData& conv)
{ {
@ -851,7 +851,7 @@ bool TryQueryMeshCache(const IfcRepresentationItem& item,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void PopulateMeshCache(const IfcRepresentationItem& item, void PopulateMeshCache(const Schema_2x3::IfcRepresentationItem& item,
const std::vector<unsigned int>& mesh_indices, unsigned int mat_index, const std::vector<unsigned int>& mesh_indices, unsigned int mat_index,
ConversionData& conv) ConversionData& conv)
{ {
@ -860,7 +860,7 @@ void PopulateMeshCache(const IfcRepresentationItem& item,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool ProcessRepresentationItem(const IfcRepresentationItem& item, unsigned int matid, bool ProcessRepresentationItem(const Schema_2x3::IfcRepresentationItem& item, unsigned int matid,
std::vector<unsigned int>& mesh_indices, std::vector<unsigned int>& mesh_indices,
ConversionData& conv) ConversionData& conv)
{ {

View File

@ -59,7 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "IFCUtil.h" #include "IFCUtil.h"
#include "MemoryIOWrapper.h" #include <assimp/MemoryIOWrapper.h>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
@ -99,7 +99,7 @@ void SetUnits(ConversionData& conv);
void SetCoordinateSpace(ConversionData& conv); void SetCoordinateSpace(ConversionData& conv);
void ProcessSpatialStructures(ConversionData& conv); void ProcessSpatialStructures(ConversionData& conv);
void MakeTreeRelative(ConversionData& conv); void MakeTreeRelative(ConversionData& conv);
void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv); void ConvertUnit(const ::Assimp::STEP::EXPRESS::DataType& dt,ConversionData& conv);
} // anon } // anon
@ -152,7 +152,6 @@ const aiImporterDesc* IFCImporter::GetInfo () const
return &desc; return &desc;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Setup configuration properties for the loader // Setup configuration properties for the loader
void IFCImporter::SetupProperties(const Importer* pImp) void IFCImporter::SetupProperties(const Importer* pImp)
@ -167,8 +166,7 @@ void IFCImporter::SetupProperties(const Importer* pImp)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void IFCImporter::InternReadFile( const std::string& pFile, void IFCImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
aiScene* pScene, IOSystem* pIOHandler)
{ {
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile)); std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile));
if (!stream) { if (!stream) {
@ -253,8 +251,8 @@ void IFCImporter::InternReadFile( const std::string& pFile,
} }
// obtain a copy of the machine-generated IFC scheme // obtain a copy of the machine-generated IFC scheme
EXPRESS::ConversionSchema schema; ::Assimp::STEP::EXPRESS::ConversionSchema schema;
GetSchema(schema); Schema_2x3::GetSchema(schema);
// tell the reader which entity types to track with special care // tell the reader which entity types to track with special care
static const char* const types_to_track[] = { static const char* const types_to_track[] = {
@ -273,7 +271,7 @@ void IFCImporter::InternReadFile( const std::string& pFile,
ThrowException("missing IfcProject entity"); ThrowException("missing IfcProject entity");
} }
ConversionData conv(*db,proj->To<IfcProject>(),pScene,settings); ConversionData conv(*db,proj->To<Schema_2x3::IfcProject>(),pScene,settings);
SetUnits(conv); SetUnits(conv);
SetCoordinateSpace(conv); SetCoordinateSpace(conv);
ProcessSpatialStructures(conv); ProcessSpatialStructures(conv);
@ -323,10 +321,9 @@ namespace {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertUnit(const IfcNamedUnit& unit,ConversionData& conv) void ConvertUnit(const Schema_2x3::IfcNamedUnit& unit,ConversionData& conv)
{ {
if(const IfcSIUnit* const si = unit.ToPtr<IfcSIUnit>()) { if(const Schema_2x3::IfcSIUnit* const si = unit.ToPtr<Schema_2x3::IfcSIUnit>()) {
if(si->UnitType == "LENGTHUNIT") { if(si->UnitType == "LENGTHUNIT") {
conv.len_scale = si->Prefix ? ConvertSIPrefix(si->Prefix) : 1.f; conv.len_scale = si->Prefix ? ConvertSIPrefix(si->Prefix) : 1.f;
IFCImporter::LogDebug("got units used for lengths"); IFCImporter::LogDebug("got units used for lengths");
@ -337,11 +334,10 @@ void ConvertUnit(const IfcNamedUnit& unit,ConversionData& conv)
} }
} }
} }
else if(const IfcConversionBasedUnit* const convu = unit.ToPtr<IfcConversionBasedUnit>()) { else if(const Schema_2x3::IfcConversionBasedUnit* const convu = unit.ToPtr<Schema_2x3::IfcConversionBasedUnit>()) {
if(convu->UnitType == "PLANEANGLEUNIT") { if(convu->UnitType == "PLANEANGLEUNIT") {
try { try {
conv.angle_scale = convu->ConversionFactor->ValueComponent->To<EXPRESS::REAL>(); conv.angle_scale = convu->ConversionFactor->ValueComponent->To<::Assimp::STEP::EXPRESS::REAL>();
ConvertUnit(*convu->ConversionFactor->UnitComponent,conv); ConvertUnit(*convu->ConversionFactor->UnitComponent,conv);
IFCImporter::LogDebug("got units used for angles"); IFCImporter::LogDebug("got units used for angles");
} }
@ -353,12 +349,12 @@ void ConvertUnit(const IfcNamedUnit& unit,ConversionData& conv)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv) void ConvertUnit(const ::Assimp::STEP::EXPRESS::DataType& dt,ConversionData& conv)
{ {
try { try {
const EXPRESS::ENTITY& e = dt.To<ENTITY>(); const ::Assimp::STEP::EXPRESS::ENTITY& e = dt.To<::Assimp::STEP::EXPRESS::ENTITY>();
const IfcNamedUnit& unit = e.ResolveSelect<IfcNamedUnit>(conv.db); const Schema_2x3::IfcNamedUnit& unit = e.ResolveSelect<Schema_2x3::IfcNamedUnit>(conv.db);
if(unit.UnitType != "LENGTHUNIT" && unit.UnitType != "PLANEANGLEUNIT") { if(unit.UnitType != "LENGTHUNIT" && unit.UnitType != "PLANEANGLEUNIT") {
return; return;
} }
@ -384,8 +380,8 @@ void SetUnits(ConversionData& conv)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SetCoordinateSpace(ConversionData& conv) void SetCoordinateSpace(ConversionData& conv)
{ {
const IfcRepresentationContext* fav = NULL; const Schema_2x3::IfcRepresentationContext* fav = NULL;
for(const IfcRepresentationContext& v : conv.proj.RepresentationContexts) { for(const Schema_2x3::IfcRepresentationContext& v : conv.proj.RepresentationContexts) {
fav = &v; fav = &v;
// Model should be the most suitable type of context, hence ignore the others // Model should be the most suitable type of context, hence ignore the others
if (v.ContextType && v.ContextType.Get() == "Model") { if (v.ContextType && v.ContextType.Get() == "Model") {
@ -393,7 +389,7 @@ void SetCoordinateSpace(ConversionData& conv)
} }
} }
if (fav) { if (fav) {
if(const IfcGeometricRepresentationContext* const geo = fav->ToPtr<IfcGeometricRepresentationContext>()) { if(const Schema_2x3::IfcGeometricRepresentationContext* const geo = fav->ToPtr<Schema_2x3::IfcGeometricRepresentationContext>()) {
ConvertAxisPlacement(conv.wcs, *geo->WorldCoordinateSystem, conv); ConvertAxisPlacement(conv.wcs, *geo->WorldCoordinateSystem, conv);
IFCImporter::LogDebug("got world coordinate system"); IFCImporter::LogDebug("got world coordinate system");
} }
@ -402,9 +398,9 @@ void SetCoordinateSpace(ConversionData& conv)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ResolveObjectPlacement(aiMatrix4x4& m, const IfcObjectPlacement& place, ConversionData& conv) void ResolveObjectPlacement(aiMatrix4x4& m, const Schema_2x3::IfcObjectPlacement& place, ConversionData& conv)
{ {
if (const IfcLocalPlacement* const local = place.ToPtr<IfcLocalPlacement>()){ if (const Schema_2x3::IfcLocalPlacement* const local = place.ToPtr<Schema_2x3::IfcLocalPlacement>()){
IfcMatrix4 tmp; IfcMatrix4 tmp;
ConvertAxisPlacement(tmp, *local->RelativePlacement, conv); ConvertAxisPlacement(tmp, *local->RelativePlacement, conv);
@ -422,9 +418,9 @@ void ResolveObjectPlacement(aiMatrix4x4& m, const IfcObjectPlacement& place, Con
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv) bool ProcessMappedItem(const Schema_2x3::IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv)
{ {
// insert a custom node here, the cartesian transform operator is simply a conventional transformation matrix // insert a custom node here, the carthesian transform operator is simply a conventional transformation matrix
std::unique_ptr<aiNode> nd(new aiNode()); std::unique_ptr<aiNode> nd(new aiNode());
nd->mName.Set("IfcMappedItem"); nd->mName.Set("IfcMappedItem");
@ -448,10 +444,10 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
} }
unsigned int localmatid = ProcessMaterials(mapped.GetID(),matid,conv,false); unsigned int localmatid = ProcessMaterials(mapped.GetID(),matid,conv,false);
const IfcRepresentation& repr = mapped.MappingSource->MappedRepresentation; const Schema_2x3::IfcRepresentation& repr = mapped.MappingSource->MappedRepresentation;
bool got = false; bool got = false;
for(const IfcRepresentationItem& item : repr.Items) { for(const Schema_2x3::IfcRepresentationItem& item : repr.Items) {
if(!ProcessRepresentationItem(item,localmatid,meshes,conv)) { if(!ProcessRepresentationItem(item,localmatid,meshes,conv)) {
IFCImporter::LogWarn("skipping mapped entity of type " + item.GetClassName() + ", no representations could be generated"); IFCImporter::LogWarn("skipping mapped entity of type " + item.GetClassName() + ", no representations could be generated");
} }
@ -483,8 +479,7 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
struct RateRepresentationPredicate { struct RateRepresentationPredicate {
int Rate(const Schema_2x3::IfcRepresentation* r) const {
int Rate(const IfcRepresentation* r) const {
// the smaller, the better // the smaller, the better
if (! r->RepresentationIdentifier) { if (! r->RepresentationIdentifier) {
@ -497,7 +492,7 @@ struct RateRepresentationPredicate {
if (name == "MappedRepresentation") { if (name == "MappedRepresentation") {
if (!r->Items.empty()) { if (!r->Items.empty()) {
// take the first item and base our choice on it // take the first item and base our choice on it
const IfcMappedItem* const m = r->Items.front()->ToPtr<IfcMappedItem>(); const Schema_2x3::IfcMappedItem* const m = r->Items.front()->ToPtr<Schema_2x3::IfcMappedItem>();
if (m) { if (m) {
return Rate(m->MappingSource->MappedRepresentation); return Rate(m->MappingSource->MappedRepresentation);
} }
@ -509,8 +504,6 @@ struct RateRepresentationPredicate {
} }
int Rate(const std::string& r) const { int Rate(const std::string& r) const {
if (r == "SolidModel") { if (r == "SolidModel") {
return -3; return -3;
} }
@ -541,13 +534,13 @@ struct RateRepresentationPredicate {
return 0; return 0;
} }
bool operator() (const IfcRepresentation* a, const IfcRepresentation* b) const { bool operator() (const Schema_2x3::IfcRepresentation* a, const Schema_2x3::IfcRepresentation* b) const {
return Rate(a) < Rate(b); return Rate(a) < Rate(b);
} }
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector< aiNode* >& subnodes, ConversionData& conv) void ProcessProductRepresentation(const Schema_2x3::IfcProduct& el, aiNode* nd, std::vector< aiNode* >& subnodes, ConversionData& conv)
{ {
if(!el.Representation) { if(!el.Representation) {
return; return;
@ -562,14 +555,14 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
// representation is relatively generic and allows the concrete implementations // representation is relatively generic and allows the concrete implementations
// for the different representation types to make some sensible choices what // for the different representation types to make some sensible choices what
// to load and what not to load. // to load and what not to load.
const STEP::ListOf< STEP::Lazy< IfcRepresentation >, 1, 0 >& src = el.Representation.Get()->Representations; const STEP::ListOf< STEP::Lazy< Schema_2x3::IfcRepresentation >, 1, 0 >& src = el.Representation.Get()->Representations;
std::vector<const IfcRepresentation*> repr_ordered(src.size()); std::vector<const Schema_2x3::IfcRepresentation*> repr_ordered(src.size());
std::copy(src.begin(),src.end(),repr_ordered.begin()); std::copy(src.begin(),src.end(),repr_ordered.begin());
std::sort(repr_ordered.begin(),repr_ordered.end(),RateRepresentationPredicate()); std::sort(repr_ordered.begin(),repr_ordered.end(),RateRepresentationPredicate());
for(const IfcRepresentation* repr : repr_ordered) { for(const Schema_2x3::IfcRepresentation* repr : repr_ordered) {
bool res = false; bool res = false;
for(const IfcRepresentationItem& item : repr->Items) { for(const Schema_2x3::IfcRepresentationItem& item : repr->Items) {
if(const IfcMappedItem* const geo = item.ToPtr<IfcMappedItem>()) { if(const Schema_2x3::IfcMappedItem* const geo = item.ToPtr<Schema_2x3::IfcMappedItem>()) {
res = ProcessMappedItem(*geo,nd,subnodes,matid,conv) || res; res = ProcessMappedItem(*geo,nd,subnodes,matid,conv) || res;
} }
else { else {
@ -587,25 +580,25 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
typedef std::map<std::string, std::string> Metadata; typedef std::map<std::string, std::string> Metadata;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionData& conv, Metadata& properties, void ProcessMetadata(const Schema_2x3::ListOf< Schema_2x3::Lazy< Schema_2x3::IfcProperty >, 1, 0 >& set, ConversionData& conv, Metadata& properties,
const std::string& prefix = "", const std::string& prefix = "",
unsigned int nest = 0) unsigned int nest = 0)
{ {
for(const IfcProperty& property : set) { for(const Schema_2x3::IfcProperty& property : set) {
const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name; const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
if (const IfcPropertySingleValue* const singleValue = property.ToPtr<IfcPropertySingleValue>()) { if (const Schema_2x3::IfcPropertySingleValue* const singleValue = property.ToPtr<Schema_2x3::IfcPropertySingleValue>()) {
if (singleValue->NominalValue) { if (singleValue->NominalValue) {
if (const EXPRESS::STRING* str = singleValue->NominalValue.Get()->ToPtr<EXPRESS::STRING>()) { if (const ::Assimp::STEP::EXPRESS::STRING* str = singleValue->NominalValue.Get()->ToPtr<::Assimp::STEP::EXPRESS::STRING>()) {
std::string value = static_cast<std::string>(*str); std::string value = static_cast<std::string>(*str);
properties[key]=value; properties[key]=value;
} }
else if (const EXPRESS::REAL* val = singleValue->NominalValue.Get()->ToPtr<EXPRESS::REAL>()) { else if (const ::Assimp::STEP::EXPRESS::REAL* val = singleValue->NominalValue.Get()->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
float value = static_cast<float>(*val); float value = static_cast<float>(*val);
std::stringstream s; std::stringstream s;
s << value; s << value;
properties[key]=s.str(); properties[key]=s.str();
} }
else if (const EXPRESS::INTEGER* val = singleValue->NominalValue.Get()->ToPtr<EXPRESS::INTEGER>()) { else if (const ::Assimp::STEP::EXPRESS::INTEGER* val = singleValue->NominalValue.Get()->ToPtr<::Assimp::STEP::EXPRESS::INTEGER>()) {
int64_t value = static_cast<int64_t>(*val); int64_t value = static_cast<int64_t>(*val);
std::stringstream s; std::stringstream s;
s << value; s << value;
@ -613,21 +606,21 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
} }
} }
} }
else if (const IfcPropertyListValue* const listValue = property.ToPtr<IfcPropertyListValue>()) { else if (const Schema_2x3::IfcPropertyListValue* const listValue = property.ToPtr<Schema_2x3::IfcPropertyListValue>()) {
std::stringstream ss; std::stringstream ss;
ss << "["; ss << "[";
unsigned index=0; unsigned index=0;
for(const IfcValue::Out& v : listValue->ListValues) { for(const Schema_2x3::IfcValue::Out& v : listValue->ListValues) {
if (!v) continue; if (!v) continue;
if (const EXPRESS::STRING* str = v->ToPtr<EXPRESS::STRING>()) { if (const ::Assimp::STEP::EXPRESS::STRING* str = v->ToPtr<::Assimp::STEP::EXPRESS::STRING>()) {
std::string value = static_cast<std::string>(*str); std::string value = static_cast<std::string>(*str);
ss << "'" << value << "'"; ss << "'" << value << "'";
} }
else if (const EXPRESS::REAL* val = v->ToPtr<EXPRESS::REAL>()) { else if (const ::Assimp::STEP::EXPRESS::REAL* val = v->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
float value = static_cast<float>(*val); float value = static_cast<float>(*val);
ss << value; ss << value;
} }
else if (const EXPRESS::INTEGER* val = v->ToPtr<EXPRESS::INTEGER>()) { else if (const ::Assimp::STEP::EXPRESS::INTEGER* val = v->ToPtr<::Assimp::STEP::EXPRESS::INTEGER>()) {
int64_t value = static_cast<int64_t>(*val); int64_t value = static_cast<int64_t>(*val);
ss << value; ss << value;
} }
@ -639,7 +632,7 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
ss << "]"; ss << "]";
properties[key]=ss.str(); properties[key]=ss.str();
} }
else if (const IfcComplexProperty* const complexProp = property.ToPtr<IfcComplexProperty>()) { else if (const Schema_2x3::IfcComplexProperty* const complexProp = property.ToPtr<Schema_2x3::IfcComplexProperty>()) {
if(nest > 2) { // mostly arbitrary limit to prevent stack overflow vulnerabilities if(nest > 2) { // mostly arbitrary limit to prevent stack overflow vulnerabilities
IFCImporter::LogError("maximum nesting level for IfcComplexProperty reached, skipping this property."); IFCImporter::LogError("maximum nesting level for IfcComplexProperty reached, skipping this property.");
} }
@ -657,29 +650,29 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessMetadata(uint64_t relDefinesByPropertiesID, ConversionData& conv, Metadata& properties) void ProcessMetadata(uint64_t relDefinesByPropertiesID, ConversionData& conv, Metadata& properties)
{ {
if (const IfcRelDefinesByProperties* const pset = conv.db.GetObject(relDefinesByPropertiesID)->ToPtr<IfcRelDefinesByProperties>()) { if (const Schema_2x3::IfcRelDefinesByProperties* const pset = conv.db.GetObject(relDefinesByPropertiesID)->ToPtr<Schema_2x3::IfcRelDefinesByProperties>()) {
if (const IfcPropertySet* const set = conv.db.GetObject(pset->RelatingPropertyDefinition->GetID())->ToPtr<IfcPropertySet>()) { if (const Schema_2x3::IfcPropertySet* const set = conv.db.GetObject(pset->RelatingPropertyDefinition->GetID())->ToPtr<Schema_2x3::IfcPropertySet>()) {
ProcessMetadata(set->HasProperties, conv, properties); ProcessMetadata(set->HasProperties, conv, properties);
} }
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, ConversionData& conv, std::vector<TempOpening>* collect_openings = NULL) aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el, ConversionData& conv, std::vector<TempOpening>* collect_openings = NULL)
{ {
const STEP::DB::RefMap& refs = conv.db.GetRefs(); const STEP::DB::RefMap& refs = conv.db.GetRefs();
// skip over space and annotation nodes - usually, these have no meaning in Assimp's context // skip over space and annotation nodes - usually, these have no meaning in Assimp's context
bool skipGeometry = false; bool skipGeometry = false;
if(conv.settings.skipSpaceRepresentations) { if(conv.settings.skipSpaceRepresentations) {
if(el.ToPtr<IfcSpace>()) { if(el.ToPtr<Schema_2x3::IfcSpace>()) {
IFCImporter::LogDebug("skipping IfcSpace entity due to importer settings"); IFCImporter::LogDebug("skipping IfcSpace entity due to importer settings");
skipGeometry = true; skipGeometry = true;
} }
} }
if(conv.settings.skipAnnotations) { if(conv.settings.skipAnnotations) {
if(el.ToPtr<IfcAnnotation>()) { if(el.ToPtr<Schema_2x3::IfcAnnotation>()) {
IFCImporter::LogDebug("skipping IfcAnnotation entity due to importer settings"); IFCImporter::LogDebug("skipping IfcAnnotation entity due to importer settings");
return NULL; return NULL;
} }
@ -745,12 +738,12 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
const STEP::LazyObject& obj = conv.db.MustGetObject((*range2.first).second); const STEP::LazyObject& obj = conv.db.MustGetObject((*range2.first).second);
// handle regularly-contained elements // handle regularly-contained elements
if(const IfcRelContainedInSpatialStructure* const cont = obj->ToPtr<IfcRelContainedInSpatialStructure>()) { if(const Schema_2x3::IfcRelContainedInSpatialStructure* const cont = obj->ToPtr<Schema_2x3::IfcRelContainedInSpatialStructure>()) {
if(cont->RelatingStructure->GetID() != el.GetID()) { if(cont->RelatingStructure->GetID() != el.GetID()) {
continue; continue;
} }
for(const IfcProduct& pro : cont->RelatedElements) { for(const Schema_2x3::IfcProduct& pro : cont->RelatedElements) {
if(pro.ToPtr<IfcOpeningElement>()) { if(pro.ToPtr<Schema_2x3::IfcOpeningElement>()) {
// IfcOpeningElement is handled below. Sadly we can't use it here as is: // IfcOpeningElement is handled below. Sadly we can't use it here as is:
// The docs say that opening elements are USUALLY attached to building storey, // The docs say that opening elements are USUALLY attached to building storey,
// but we want them for the building elements to which they belong. // but we want them for the building elements to which they belong.
@ -764,9 +757,9 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
} }
} }
// handle openings, which we collect in a list rather than adding them to the node graph // handle openings, which we collect in a list rather than adding them to the node graph
else if(const IfcRelVoidsElement* const fills = obj->ToPtr<IfcRelVoidsElement>()) { else if(const Schema_2x3::IfcRelVoidsElement* const fills = obj->ToPtr<Schema_2x3::IfcRelVoidsElement>()) {
if(fills->RelatingBuildingElement->GetID() == el.GetID()) { if(fills->RelatingBuildingElement->GetID() == el.GetID()) {
const IfcFeatureElementSubtraction& open = fills->RelatedOpeningElement; const Schema_2x3::IfcFeatureElementSubtraction& open = fills->RelatedOpeningElement;
// move opening elements to a separate node since they are semantically different than elements that are just 'contained' // move opening elements to a separate node since they are semantically different than elements that are just 'contained'
std::unique_ptr<aiNode> nd_aggr(new aiNode()); std::unique_ptr<aiNode> nd_aggr(new aiNode());
@ -808,7 +801,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
if (conv.already_processed.find((*range.first).second) != conv.already_processed.end()) { if (conv.already_processed.find((*range.first).second) != conv.already_processed.end()) {
continue; continue;
} }
if(const IfcRelAggregates* const aggr = conv.db.GetObject((*range.first).second)->ToPtr<IfcRelAggregates>()) { if(const Schema_2x3::IfcRelAggregates* const aggr = conv.db.GetObject((*range.first).second)->ToPtr<Schema_2x3::IfcRelAggregates>()) {
if(aggr->RelatingObject->GetID() != el.GetID()) { if(aggr->RelatingObject->GetID() != el.GetID()) {
continue; continue;
} }
@ -821,8 +814,8 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
nd_aggr->mTransformation = nd->mTransformation; nd_aggr->mTransformation = nd->mTransformation;
nd_aggr->mChildren = new aiNode*[aggr->RelatedObjects.size()](); nd_aggr->mChildren = new aiNode*[aggr->RelatedObjects.size()]();
for(const IfcObjectDefinition& def : aggr->RelatedObjects) { for(const Schema_2x3::IfcObjectDefinition& def : aggr->RelatedObjects) {
if(const IfcProduct* const prod = def.ToPtr<IfcProduct>()) { if(const Schema_2x3::IfcProduct* const prod = def.ToPtr<Schema_2x3::IfcProduct>()) {
aiNode* const ndnew = ProcessSpatialStructure(nd_aggr.get(),*prod,conv,NULL); aiNode* const ndnew = ProcessSpatialStructure(nd_aggr.get(),*prod,conv,NULL);
if(ndnew) { if(ndnew) {
@ -889,7 +882,7 @@ void ProcessSpatialStructures(ConversionData& conv)
std::vector<aiNode*> nodes; std::vector<aiNode*> nodes;
for(const STEP::LazyObject* lz : *range) { for(const STEP::LazyObject* lz : *range) {
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>(); const Schema_2x3::IfcSpatialStructureElement* const prod = lz->ToPtr<Schema_2x3::IfcSpatialStructureElement>();
if(!prod) { if(!prod) {
continue; continue;
} }
@ -899,9 +892,9 @@ void ProcessSpatialStructures(ConversionData& conv)
const STEP::DB::RefMap& refs = conv.db.GetRefs(); const STEP::DB::RefMap& refs = conv.db.GetRefs();
STEP::DB::RefMapRange ref_range = refs.equal_range(conv.proj.GetID()); STEP::DB::RefMapRange ref_range = refs.equal_range(conv.proj.GetID());
for(; ref_range.first != ref_range.second; ++ref_range.first) { for(; ref_range.first != ref_range.second; ++ref_range.first) {
if(const IfcRelAggregates* const aggr = conv.db.GetObject((*ref_range.first).second)->ToPtr<IfcRelAggregates>()) { if(const Schema_2x3::IfcRelAggregates* const aggr = conv.db.GetObject((*ref_range.first).second)->ToPtr<Schema_2x3::IfcRelAggregates>()) {
for(const IfcObjectDefinition& def : aggr->RelatedObjects) { for(const Schema_2x3::IfcObjectDefinition& def : aggr->RelatedObjects) {
// comparing pointer values is not sufficient, we would need to cast them to the same type first // comparing pointer values is not sufficient, we would need to cast them to the same type first
// as there is multiple inheritance in the game. // as there is multiple inheritance in the game.
if (def.GetID() == prod->GetID()) { if (def.GetID() == prod->GetID()) {
@ -910,7 +903,6 @@ void ProcessSpatialStructures(ConversionData& conv)
nodes.push_back(ProcessSpatialStructure(NULL, *prod, conv, NULL)); nodes.push_back(ProcessSpatialStructure(NULL, *prod, conv, NULL));
} }
} }
} }
} }
} }
@ -920,7 +912,7 @@ void ProcessSpatialStructures(ConversionData& conv)
if (nb_nodes == 0) { if (nb_nodes == 0) {
IFCImporter::LogWarn("failed to determine primary site element, taking all the IfcSite"); IFCImporter::LogWarn("failed to determine primary site element, taking all the IfcSite");
for (const STEP::LazyObject* lz : *range) { for (const STEP::LazyObject* lz : *range) {
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>(); const Schema_2x3::IfcSpatialStructureElement* const prod = lz->ToPtr<Schema_2x3::IfcSpatialStructureElement>();
if (!prod) { if (!prod) {
continue; continue;
} }
@ -939,7 +931,7 @@ void ProcessSpatialStructures(ConversionData& conv)
conv.out->mRootNode->mParent = NULL; conv.out->mRootNode->mParent = NULL;
conv.out->mRootNode->mNumChildren = static_cast<unsigned int>(nb_nodes); conv.out->mRootNode->mNumChildren = static_cast<unsigned int>(nb_nodes);
conv.out->mRootNode->mChildren = new aiNode*[conv.out->mRootNode->mNumChildren]; conv.out->mRootNode->mChildren = new aiNode*[conv.out->mRootNode->mNumChildren];
for (size_t i = 0; i < nb_nodes; ++i) { for (size_t i = 0; i < nb_nodes; ++i) {
aiNode* node = nodes[i]; aiNode* node = nodes[i];

View File

@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_IFC_LOADER_H #ifndef INCLUDED_AI_IFC_LOADER_H
#define INCLUDED_AI_IFC_LOADER_H #define INCLUDED_AI_IFC_LOADER_H
#include "BaseImporter.h" #include <assimp/BaseImporter.h>
#include "LogAux.h" #include <assimp/LogAux.h>
namespace Assimp { namespace Assimp {

View File

@ -68,20 +68,20 @@ static int ConvertShadingMode(const std::string& name) {
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionData& conv) { static void FillMaterial(aiMaterial* mat,const IFC::Schema_2x3::IfcSurfaceStyle* surf,ConversionData& conv) {
aiString name; aiString name;
name.Set((surf->Name? surf->Name.Get() : "IfcSurfaceStyle_Unnamed")); name.Set((surf->Name? surf->Name.Get() : "IfcSurfaceStyle_Unnamed"));
mat->AddProperty(&name,AI_MATKEY_NAME); mat->AddProperty(&name,AI_MATKEY_NAME);
// now see which kinds of surface information are present // now see which kinds of surface information are present
for(std::shared_ptr< const IFC::IfcSurfaceStyleElementSelect > sel2 : surf->Styles) { for(std::shared_ptr< const IFC::Schema_2x3::IfcSurfaceStyleElementSelect > sel2 : surf->Styles) {
if (const IFC::IfcSurfaceStyleShading* shade = sel2->ResolveSelectPtr<IFC::IfcSurfaceStyleShading>(conv.db)) { if (const IFC::Schema_2x3::IfcSurfaceStyleShading* shade = sel2->ResolveSelectPtr<IFC::Schema_2x3::IfcSurfaceStyleShading>(conv.db)) {
aiColor4D col_base,col; aiColor4D col_base,col;
ConvertColor(col_base, shade->SurfaceColour); ConvertColor(col_base, shade->SurfaceColour);
mat->AddProperty(&col_base,1, AI_MATKEY_COLOR_DIFFUSE); mat->AddProperty(&col_base,1, AI_MATKEY_COLOR_DIFFUSE);
if (const IFC::IfcSurfaceStyleRendering* ren = shade->ToPtr<IFC::IfcSurfaceStyleRendering>()) { if (const IFC::Schema_2x3::IfcSurfaceStyleRendering* ren = shade->ToPtr<IFC::Schema_2x3::IfcSurfaceStyleRendering>()) {
if (ren->Transparency) { if (ren->Transparency) {
const float t = 1.f-static_cast<float>(ren->Transparency.Get()); const float t = 1.f-static_cast<float>(ren->Transparency.Get());
@ -112,7 +112,7 @@ static void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,Conver
mat->AddProperty(&shading,1, AI_MATKEY_SHADING_MODEL); mat->AddProperty(&shading,1, AI_MATKEY_SHADING_MODEL);
if (ren->SpecularHighlight) { if (ren->SpecularHighlight) {
if(const EXPRESS::REAL* rt = ren->SpecularHighlight.Get()->ToPtr<EXPRESS::REAL>()) { if(const ::Assimp::STEP::EXPRESS::REAL* rt = ren->SpecularHighlight.Get()->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
// at this point we don't distinguish between the two distinct ways of // at this point we don't distinguish between the two distinct ways of
// specifying highlight intensities. leave this to the user. // specifying highlight intensities. leave this to the user.
const float e = static_cast<float>(*rt); const float e = static_cast<float>(*rt);
@ -123,23 +123,19 @@ static void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,Conver
} }
} }
} }
} /* }
else if (const IFC::IfcSurfaceStyleWithTextures* tex = sel2->ResolveSelectPtr<IFC::IfcSurfaceStyleWithTextures>(conv.db)) {
// XXX
} */
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat) { unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat) {
STEP::DB::RefMapRange range = conv.db.GetRefs().equal_range(id); STEP::DB::RefMapRange range = conv.db.GetRefs().equal_range(id);
for(;range.first != range.second; ++range.first) { for(;range.first != range.second; ++range.first) {
if(const IFC::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr<IFC::IfcStyledItem>()) { if(const IFC::Schema_2x3::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr<IFC::Schema_2x3::IfcStyledItem>()) {
for(const IFC::IfcPresentationStyleAssignment& as : styled->Styles) { for(const IFC::Schema_2x3::IfcPresentationStyleAssignment& as : styled->Styles) {
for(std::shared_ptr<const IFC::IfcPresentationStyleSelect> sel : as.Styles) { for(std::shared_ptr<const IFC::Schema_2x3::IfcPresentationStyleSelect> sel : as.Styles) {
if( const IFC::IfcSurfaceStyle* const surf = sel->ResolveSelectPtr<IFC::IfcSurfaceStyle>(conv.db) ) { if( const IFC::Schema_2x3::IfcSurfaceStyle* const surf = sel->ResolveSelectPtr<IFC::Schema_2x3::IfcSurfaceStyle>(conv.db) ) {
// try to satisfy from cache // try to satisfy from cache
ConversionData::MaterialCache::iterator mit = conv.cached_materials.find(surf); ConversionData::MaterialCache::iterator mit = conv.cached_materials.find(surf);
if( mit != conv.cached_materials.end() ) if( mit != conv.cached_materials.end() )

View File

@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h" #include "IFCUtil.h"
#include "PolyTools.h" #include "code/PolyTools.h"
#include "ProcessHelper.h" #include "code/ProcessHelper.h"
#include "../contrib/poly2tri/poly2tri/poly2tri.h" #include "../contrib/poly2tri/poly2tri/poly2tri.h"
#include "../contrib/clipper/clipper.hpp" #include "../contrib/clipper/clipper.hpp"
@ -323,7 +323,7 @@ void InsertWindowContours(const ContourVector& contours,
if (hit) { if (hit) {
if (last_hit != (size_t)-1) { if (last_hit != (size_t)-1) {
const size_t old = curmesh.verts.size(); const size_t old = curmesh.mVerts.size();
size_t cnt = last_hit > n ? size-(last_hit-n) : n-last_hit; size_t cnt = last_hit > n ? size-(last_hit-n) : n-last_hit;
for(size_t a = last_hit, e = 0; e <= cnt; a=(a+1)%size, ++e) { for(size_t a = last_hit, e = 0; e <= cnt; a=(a+1)%size, ++e) {
// hack: this is to fix cases where opening contours are self-intersecting. // hack: this is to fix cases where opening contours are self-intersecting.
@ -335,7 +335,7 @@ void InsertWindowContours(const ContourVector& contours,
if ((contour[a] - edge).SquareLength() > diag*diag*0.7) { if ((contour[a] - edge).SquareLength() > diag*diag*0.7) {
continue; continue;
} }
curmesh.verts.push_back(IfcVector3(contour[a].x, contour[a].y, 0.0f)); curmesh.mVerts.push_back(IfcVector3(contour[a].x, contour[a].y, 0.0f));
} }
if (edge != contour[last_hit]) { if (edge != contour[last_hit]) {
@ -356,16 +356,16 @@ void InsertWindowContours(const ContourVector& contours,
corner.y = bb.second.y; corner.y = bb.second.y;
} }
curmesh.verts.push_back(IfcVector3(corner.x, corner.y, 0.0f)); curmesh.mVerts.push_back(IfcVector3(corner.x, corner.y, 0.0f));
} }
else if (cnt == 1) { else if (cnt == 1) {
// avoid degenerate polygons (also known as lines or points) // avoid degenerate polygons (also known as lines or points)
curmesh.verts.erase(curmesh.verts.begin()+old,curmesh.verts.end()); curmesh.mVerts.erase(curmesh.mVerts.begin()+old,curmesh.mVerts.end());
} }
if (const size_t d = curmesh.verts.size()-old) { if (const size_t d = curmesh.mVerts.size()-old) {
curmesh.vertcnt.push_back(static_cast<unsigned int>(d)); curmesh.mVertcnt.push_back(static_cast<unsigned int>(d));
std::reverse(curmesh.verts.rbegin(),curmesh.verts.rbegin()+d); std::reverse(curmesh.mVerts.rbegin(),curmesh.mVerts.rbegin()+d);
} }
if (n == very_first_hit) { if (n == very_first_hit) {
break; break;
@ -504,8 +504,8 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
std::vector<IfcVector3> vold; std::vector<IfcVector3> vold;
std::vector<unsigned int> iold; std::vector<unsigned int> iold;
vold.reserve(curmesh.verts.size()); vold.reserve(curmesh.mVerts.size());
iold.reserve(curmesh.vertcnt.size()); iold.reserve(curmesh.mVertcnt.size());
// Fix the outer contour using polyclipper // Fix the outer contour using polyclipper
try { try {
@ -530,9 +530,9 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
subject.reserve(4); subject.reserve(4);
size_t index = 0; size_t index = 0;
size_t countdown = 0; size_t countdown = 0;
for(const IfcVector3& pip : curmesh.verts) { for(const IfcVector3& pip : curmesh.mVerts) {
if (!countdown) { if (!countdown) {
countdown = curmesh.vertcnt[index++]; countdown = curmesh.mVertcnt[index++];
if (!countdown) { if (!countdown) {
continue; continue;
} }
@ -572,8 +572,8 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
} }
// swap data arrays // swap data arrays
std::swap(vold,curmesh.verts); std::swap(vold,curmesh.mVerts);
std::swap(iold,curmesh.vertcnt); std::swap(iold,curmesh.mVertcnt);
} }
typedef std::vector<TempOpening*> OpeningRefs; typedef std::vector<TempOpening*> OpeningRefs;
@ -898,14 +898,14 @@ size_t CloseWindows(ContourVector& contours,
SkipList::const_iterator skipbegin = (*it).skiplist.begin(); SkipList::const_iterator skipbegin = (*it).skiplist.begin();
curmesh.verts.reserve(curmesh.verts.size() + (*it).contour.size() * 4); curmesh.mVerts.reserve(curmesh.mVerts.size() + (*it).contour.size() * 4);
curmesh.vertcnt.reserve(curmesh.vertcnt.size() + (*it).contour.size()); curmesh.mVertcnt.reserve(curmesh.mVertcnt.size() + (*it).contour.size());
bool reverseCountourFaces = false; bool reverseCountourFaces = false;
// compare base poly normal and contour normal to detect if we need to reverse the face winding // compare base poly normal and contour normal to detect if we need to reverse the face winding
if(curmesh.vertcnt.size() > 0) { if(curmesh.mVertcnt.size() > 0) {
IfcVector3 basePolyNormal = TempMesh::ComputePolygonNormal(curmesh.verts.data(), curmesh.vertcnt.front()); IfcVector3 basePolyNormal = TempMesh::ComputePolygonNormal(curmesh.mVerts.data(), curmesh.mVertcnt.front());
std::vector<IfcVector3> worldSpaceContourVtx(it->contour.size()); std::vector<IfcVector3> worldSpaceContourVtx(it->contour.size());
@ -954,14 +954,14 @@ size_t CloseWindows(ContourVector& contours,
} }
if (drop_this_edge) { if (drop_this_edge) {
curmesh.verts.pop_back(); curmesh.mVerts.pop_back();
curmesh.verts.pop_back(); curmesh.mVerts.pop_back();
} }
else { else {
curmesh.verts.push_back(((cit == cbegin) != reverseCountourFaces) ? world_point : bestv); curmesh.mVerts.push_back(((cit == cbegin) != reverseCountourFaces) ? world_point : bestv);
curmesh.verts.push_back(((cit == cbegin) != reverseCountourFaces) ? bestv : world_point); curmesh.mVerts.push_back(((cit == cbegin) != reverseCountourFaces) ? bestv : world_point);
curmesh.vertcnt.push_back(4); curmesh.mVertcnt.push_back(4);
++closed; ++closed;
} }
@ -971,8 +971,8 @@ size_t CloseWindows(ContourVector& contours,
continue; continue;
} }
curmesh.verts.push_back(reverseCountourFaces ? bestv : world_point); curmesh.mVerts.push_back(reverseCountourFaces ? bestv : world_point);
curmesh.verts.push_back(reverseCountourFaces ? world_point : bestv); curmesh.mVerts.push_back(reverseCountourFaces ? world_point : bestv);
if (cit == cend - 1) { if (cit == cend - 1) {
drop_this_edge = *skipit; drop_this_edge = *skipit;
@ -981,13 +981,13 @@ size_t CloseWindows(ContourVector& contours,
// a border edge that needs to be dropped. // a border edge that needs to be dropped.
if (drop_this_edge) { if (drop_this_edge) {
--closed; --closed;
curmesh.vertcnt.pop_back(); curmesh.mVertcnt.pop_back();
curmesh.verts.pop_back(); curmesh.mVerts.pop_back();
curmesh.verts.pop_back(); curmesh.mVerts.pop_back();
} }
else { else {
curmesh.verts.push_back(reverseCountourFaces ? start0 : start1); curmesh.mVerts.push_back(reverseCountourFaces ? start0 : start1);
curmesh.verts.push_back(reverseCountourFaces ? start1 : start0); curmesh.mVerts.push_back(reverseCountourFaces ? start1 : start0);
} }
} }
} }
@ -1029,10 +1029,10 @@ void Quadrify(const std::vector< BoundingBox >& bbs, TempMesh& curmesh)
QuadrifyPart(IfcVector2(),one_vec,field,bbs,quads); QuadrifyPart(IfcVector2(),one_vec,field,bbs,quads);
ai_assert(!(quads.size() % 4)); ai_assert(!(quads.size() % 4));
curmesh.vertcnt.resize(quads.size()/4,4); curmesh.mVertcnt.resize(quads.size()/4,4);
curmesh.verts.reserve(quads.size()); curmesh.mVerts.reserve(quads.size());
for(const IfcVector2& v2 : quads) { for(const IfcVector2& v2 : quads) {
curmesh.verts.push_back(IfcVector3(v2.x, v2.y, static_cast<IfcFloat>(0.0))); curmesh.mVerts.push_back(IfcVector3(v2.x, v2.y, static_cast<IfcFloat>(0.0)));
} }
} }
@ -1053,7 +1053,7 @@ void Quadrify(const ContourVector& contours, TempMesh& curmesh)
IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh& in_mesh, IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh& in_mesh,
bool &ok, IfcVector3& nor_out) bool &ok, IfcVector3& nor_out)
{ {
const std::vector<IfcVector3>& in_verts = in_mesh.verts; const std::vector<IfcVector3>& in_verts = in_mesh.mVerts;
ok = true; ok = true;
IfcMatrix4 m = IfcMatrix4(DerivePlaneCoordinateSpace(in_mesh, ok, nor_out)); IfcMatrix4 m = IfcMatrix4(DerivePlaneCoordinateSpace(in_mesh, ok, nor_out));
@ -1200,8 +1200,8 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
} }
} }
} }
std::vector<IfcVector3> profile_verts = profile_data->verts; std::vector<IfcVector3> profile_verts = profile_data->mVerts;
std::vector<unsigned int> profile_vertcnts = profile_data->vertcnt; std::vector<unsigned int> profile_vertcnts = profile_data->mVertcnt;
if(profile_verts.size() <= 2) { if(profile_verts.size() <= 2) {
continue; continue;
} }
@ -1421,7 +1421,7 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
CleanupOuterContour(contour_flat, curmesh); CleanupOuterContour(contour_flat, curmesh);
// Undo the projection and get back to world (or local object) space // Undo the projection and get back to world (or local object) space
for(IfcVector3& v3 : curmesh.verts) { for(IfcVector3& v3 : curmesh.mVerts) {
v3 = minv * v3; v3 = minv * v3;
} }
@ -1438,7 +1438,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
TempMesh& curmesh) TempMesh& curmesh)
{ {
IFCImporter::LogWarn("forced to use poly2tri fallback method to generate wall openings"); IFCImporter::LogWarn("forced to use poly2tri fallback method to generate wall openings");
std::vector<IfcVector3>& out = curmesh.verts; std::vector<IfcVector3>& out = curmesh.mVerts;
bool result = false; bool result = false;
@ -1513,14 +1513,14 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
continue; continue;
} }
const std::vector<IfcVector3>& va = t.profileMesh->verts; const std::vector<IfcVector3>& va = t.profileMesh->mVerts;
if(va.size() <= 2) { if(va.size() <= 2) {
continue; continue;
} }
std::vector<IfcVector2> contour; std::vector<IfcVector2> contour;
for(const IfcVector3& xx : t.profileMesh->verts) { for(const IfcVector3& xx : t.profileMesh->mVerts) {
IfcVector3 vv = m * xx, vv_extr = m * (xx + t.extrusionDir); IfcVector3 vv = m * xx, vv_extr = m * (xx + t.extrusionDir);
const bool is_extruded_side = std::fabs(vv.z - coord) > std::fabs(vv_extr.z - coord); const bool is_extruded_side = std::fabs(vv.z - coord) > std::fabs(vv_extr.z - coord);
@ -1603,8 +1603,8 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
std::vector<IfcVector3> old_verts; std::vector<IfcVector3> old_verts;
std::vector<unsigned int> old_vertcnt; std::vector<unsigned int> old_vertcnt;
old_verts.swap(curmesh.verts); old_verts.swap(curmesh.mVerts);
old_vertcnt.swap(curmesh.vertcnt); old_vertcnt.swap(curmesh.mVertcnt);
std::vector< std::vector<p2t::Point*> > contours; std::vector< std::vector<p2t::Point*> > contours;
for(ClipperLib::ExPolygon& clip : clipped) { for(ClipperLib::ExPolygon& clip : clipped) {
@ -1669,9 +1669,9 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
ai_assert(v.x <= 1.0 && v.x >= 0.0 && v.y <= 1.0 && v.y >= 0.0); ai_assert(v.x <= 1.0 && v.x >= 0.0 && v.y <= 1.0 && v.y >= 0.0);
const IfcVector3 v3 = minv * IfcVector3(vmin.x + v.x * vmax.x, vmin.y + v.y * vmax.y,coord) ; const IfcVector3 v3 = minv * IfcVector3(vmin.x + v.x * vmax.x, vmin.y + v.y * vmax.y,coord) ;
curmesh.verts.push_back(v3); curmesh.mVerts.push_back(v3);
} }
curmesh.vertcnt.push_back(3); curmesh.mVertcnt.push_back(3);
} }
result = true; result = true;
@ -1679,8 +1679,8 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
if (!result) { if (!result) {
// revert -- it's a shame, but better than nothing // revert -- it's a shame, but better than nothing
curmesh.verts.insert(curmesh.verts.end(),old_verts.begin(), old_verts.end()); curmesh.mVerts.insert(curmesh.mVerts.end(),old_verts.begin(), old_verts.end());
curmesh.vertcnt.insert(curmesh.vertcnt.end(),old_vertcnt.begin(), old_vertcnt.end()); curmesh.mVertcnt.insert(curmesh.mVertcnt.end(),old_vertcnt.begin(), old_vertcnt.end());
IFCImporter::LogError("Ifc: revert, could not generate openings for this wall"); IFCImporter::LogError("Ifc: revert, could not generate openings for this wall");
} }

View File

@ -43,28 +43,27 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Read profile and curves entities from IFC files * @brief Read profile and curves entities from IFC files
*/ */
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h" #include "IFCUtil.h"
namespace Assimp { namespace Assimp {
namespace IFC { namespace IFC {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessPolyLine(const IfcPolyline& def, TempMesh& meshout, ConversionData& /*conv*/) void ProcessPolyLine(const Schema_2x3::IfcPolyline& def, TempMesh& meshout, ConversionData& /*conv*/)
{ {
// this won't produce a valid mesh, it just spits out a list of vertices // this won't produce a valid mesh, it just spits out a list of vertices
IfcVector3 t; IfcVector3 t;
for(const IfcCartesianPoint& cp : def.Points) { for(const Schema_2x3::IfcCartesianPoint& cp : def.Points) {
ConvertCartesianPoint(t,cp); ConvertCartesianPoint(t,cp);
meshout.verts.push_back(t); meshout.mVerts.push_back(t);
} }
meshout.vertcnt.push_back(static_cast<unsigned int>(meshout.verts.size())); meshout.mVertcnt.push_back(static_cast<unsigned int>(meshout.mVerts.size()));
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& conv) bool ProcessCurve(const Schema_2x3::IfcCurve& curve, TempMesh& meshout, ConversionData& conv)
{ {
std::unique_ptr<const Curve> cv(Curve::Convert(curve,conv)); std::unique_ptr<const Curve> cv(Curve::Convert(curve,conv));
if (!cv) { if (!cv) {
@ -78,10 +77,10 @@ bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& con
bc->SampleDiscrete(meshout); bc->SampleDiscrete(meshout);
} }
catch(const CurveError& cv) { catch(const CurveError& cv) {
IFCImporter::LogError(cv.s+ " (error occurred while processing curve)"); IFCImporter::LogError(cv.mStr + " (error occurred while processing curve)");
return false; return false;
} }
meshout.vertcnt.push_back(static_cast<unsigned int>(meshout.verts.size())); meshout.mVertcnt.push_back(static_cast<unsigned int>(meshout.mVerts.size()));
return true; return true;
} }
@ -90,66 +89,66 @@ bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& con
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessClosedProfile(const IfcArbitraryClosedProfileDef& def, TempMesh& meshout, ConversionData& conv) void ProcessClosedProfile(const Schema_2x3::IfcArbitraryClosedProfileDef& def, TempMesh& meshout, ConversionData& conv)
{ {
ProcessCurve(def.OuterCurve,meshout,conv); ProcessCurve(def.OuterCurve,meshout,conv);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessOpenProfile(const IfcArbitraryOpenProfileDef& def, TempMesh& meshout, ConversionData& conv) void ProcessOpenProfile(const Schema_2x3::IfcArbitraryOpenProfileDef& def, TempMesh& meshout, ConversionData& conv)
{ {
ProcessCurve(def.Curve,meshout,conv); ProcessCurve(def.Curve,meshout,conv);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh& meshout, ConversionData& conv) void ProcessParametrizedProfile(const Schema_2x3::IfcParameterizedProfileDef& def, TempMesh& meshout, ConversionData& conv)
{ {
if(const IfcRectangleProfileDef* const cprofile = def.ToPtr<IfcRectangleProfileDef>()) { if(const Schema_2x3::IfcRectangleProfileDef* const cprofile = def.ToPtr<Schema_2x3::IfcRectangleProfileDef>()) {
const IfcFloat x = cprofile->XDim*0.5f, y = cprofile->YDim*0.5f; const IfcFloat x = cprofile->XDim*0.5f, y = cprofile->YDim*0.5f;
meshout.verts.reserve(meshout.verts.size()+4); meshout.mVerts.reserve(meshout.mVerts.size()+4);
meshout.verts.push_back( IfcVector3( x, y, 0.f )); meshout.mVerts.push_back( IfcVector3( x, y, 0.f ));
meshout.verts.push_back( IfcVector3(-x, y, 0.f )); meshout.mVerts.push_back( IfcVector3(-x, y, 0.f ));
meshout.verts.push_back( IfcVector3(-x,-y, 0.f )); meshout.mVerts.push_back( IfcVector3(-x,-y, 0.f ));
meshout.verts.push_back( IfcVector3( x,-y, 0.f )); meshout.mVerts.push_back( IfcVector3( x,-y, 0.f ));
meshout.vertcnt.push_back(4); meshout.mVertcnt.push_back(4);
} }
else if( const IfcCircleProfileDef* const circle = def.ToPtr<IfcCircleProfileDef>()) { else if( const Schema_2x3::IfcCircleProfileDef* const circle = def.ToPtr<Schema_2x3::IfcCircleProfileDef>()) {
if(def.ToPtr<IfcCircleHollowProfileDef>()) { if(def.ToPtr<Schema_2x3::IfcCircleHollowProfileDef>()) {
// TODO // TODO
} }
const size_t segments = conv.settings.cylindricalTessellation; const size_t segments = conv.settings.cylindricalTessellation;
const IfcFloat delta = AI_MATH_TWO_PI_F/segments, radius = circle->Radius; const IfcFloat delta = AI_MATH_TWO_PI_F/segments, radius = circle->Radius;
meshout.verts.reserve(segments); meshout.mVerts.reserve(segments);
IfcFloat angle = 0.f; IfcFloat angle = 0.f;
for(size_t i = 0; i < segments; ++i, angle += delta) { for(size_t i = 0; i < segments; ++i, angle += delta) {
meshout.verts.push_back( IfcVector3( std::cos(angle)*radius, std::sin(angle)*radius, 0.f )); meshout.mVerts.push_back( IfcVector3( std::cos(angle)*radius, std::sin(angle)*radius, 0.f ));
} }
meshout.vertcnt.push_back(static_cast<unsigned int>(segments)); meshout.mVertcnt.push_back(static_cast<unsigned int>(segments));
} }
else if( const IfcIShapeProfileDef* const ishape = def.ToPtr<IfcIShapeProfileDef>()) { else if( const Schema_2x3::IfcIShapeProfileDef* const ishape = def.ToPtr<Schema_2x3::IfcIShapeProfileDef>()) {
// construct simplified IBeam shape // construct simplified IBeam shape
const IfcFloat offset = (ishape->OverallWidth - ishape->WebThickness) / 2; const IfcFloat offset = (ishape->OverallWidth - ishape->WebThickness) / 2;
const IfcFloat inner_height = ishape->OverallDepth - ishape->FlangeThickness * 2; const IfcFloat inner_height = ishape->OverallDepth - ishape->FlangeThickness * 2;
meshout.verts.reserve(12); meshout.mVerts.reserve(12);
meshout.verts.push_back(IfcVector3(0,0,0)); meshout.mVerts.push_back(IfcVector3(0,0,0));
meshout.verts.push_back(IfcVector3(0,ishape->FlangeThickness,0)); meshout.mVerts.push_back(IfcVector3(0,ishape->FlangeThickness,0));
meshout.verts.push_back(IfcVector3(offset,ishape->FlangeThickness,0)); meshout.mVerts.push_back(IfcVector3(offset,ishape->FlangeThickness,0));
meshout.verts.push_back(IfcVector3(offset,ishape->FlangeThickness + inner_height,0)); meshout.mVerts.push_back(IfcVector3(offset,ishape->FlangeThickness + inner_height,0));
meshout.verts.push_back(IfcVector3(0,ishape->FlangeThickness + inner_height,0)); meshout.mVerts.push_back(IfcVector3(0,ishape->FlangeThickness + inner_height,0));
meshout.verts.push_back(IfcVector3(0,ishape->OverallDepth,0)); meshout.mVerts.push_back(IfcVector3(0,ishape->OverallDepth,0));
meshout.verts.push_back(IfcVector3(ishape->OverallWidth,ishape->OverallDepth,0)); meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,ishape->OverallDepth,0));
meshout.verts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness + inner_height,0)); meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness + inner_height,0));
meshout.verts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness + inner_height,0)); meshout.mVerts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness + inner_height,0));
meshout.verts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness,0)); meshout.mVerts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness,0));
meshout.verts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness,0)); meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness,0));
meshout.verts.push_back(IfcVector3(ishape->OverallWidth,0,0)); meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,0,0));
meshout.vertcnt.push_back(12); meshout.mVertcnt.push_back(12);
} }
else { else {
IFCImporter::LogWarn("skipping unknown IfcParameterizedProfileDef entity, type is " + def.GetClassName()); IFCImporter::LogWarn("skipping unknown IfcParameterizedProfileDef entity, type is " + def.GetClassName());
@ -162,15 +161,15 @@ void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh&
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool ProcessProfile(const IfcProfileDef& prof, TempMesh& meshout, ConversionData& conv) bool ProcessProfile(const Schema_2x3::IfcProfileDef& prof, TempMesh& meshout, ConversionData& conv)
{ {
if(const IfcArbitraryClosedProfileDef* const cprofile = prof.ToPtr<IfcArbitraryClosedProfileDef>()) { if(const Schema_2x3::IfcArbitraryClosedProfileDef* const cprofile = prof.ToPtr<Schema_2x3::IfcArbitraryClosedProfileDef>()) {
ProcessClosedProfile(*cprofile,meshout,conv); ProcessClosedProfile(*cprofile,meshout,conv);
} }
else if(const IfcArbitraryOpenProfileDef* const copen = prof.ToPtr<IfcArbitraryOpenProfileDef>()) { else if(const Schema_2x3::IfcArbitraryOpenProfileDef* const copen = prof.ToPtr<Schema_2x3::IfcArbitraryOpenProfileDef>()) {
ProcessOpenProfile(*copen,meshout,conv); ProcessOpenProfile(*copen,meshout,conv);
} }
else if(const IfcParameterizedProfileDef* const cparam = prof.ToPtr<IfcParameterizedProfileDef>()) { else if(const Schema_2x3::IfcParameterizedProfileDef* const cparam = prof.ToPtr<Schema_2x3::IfcParameterizedProfileDef>()) {
ProcessParametrizedProfile(*cparam,meshout,conv); ProcessParametrizedProfile(*cparam,meshout,conv);
} }
else { else {
@ -178,7 +177,7 @@ bool ProcessProfile(const IfcProfileDef& prof, TempMesh& meshout, ConversionData
return false; return false;
} }
meshout.RemoveAdjacentDuplicates(); meshout.RemoveAdjacentDuplicates();
if (!meshout.vertcnt.size() || meshout.vertcnt.front() <= 1) { if (!meshout.mVertcnt.size() || meshout.mVertcnt.front() <= 1) {
return false; return false;
} }
return true; return true;
@ -187,4 +186,4 @@ bool ProcessProfile(const IfcProfileDef& prof, TempMesh& meshout, ConversionData
} // ! IFC } // ! IFC
} // ! Assimp } // ! Assimp
#endif #endif // ASSIMP_BUILD_NO_IFC_IMPORTER

Some files were not shown because too many files have changed in this diff Show More