commit
632b58f27e
|
@ -114,32 +114,7 @@ IF (NOT TARGET uninstall)
|
||||||
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Globally enable Boost resp. the Boost workaround – it is also needed by the
|
|
||||||
# tools which include the Assimp headers.
|
|
||||||
option ( ASSIMP_ENABLE_BOOST_WORKAROUND
|
|
||||||
"If a simple implementation of the used Boost functions is used. Slightly reduces functionality, but enables builds without Boost available."
|
|
||||||
ON
|
|
||||||
)
|
|
||||||
IF ( ASSIMP_ENABLE_BOOST_WORKAROUND )
|
|
||||||
INCLUDE_DIRECTORIES( code/BoostWorkaround )
|
|
||||||
ADD_DEFINITIONS( -DASSIMP_BUILD_BOOST_WORKAROUND )
|
|
||||||
MESSAGE( STATUS "Building a non-boost version of Assimp." )
|
|
||||||
ELSE ( ASSIMP_ENABLE_BOOST_WORKAROUND )
|
|
||||||
SET( Boost_DETAILED_FAILURE_MSG ON )
|
|
||||||
IF ( NOT Boost_ADDITIONAL_VERSIONS )
|
|
||||||
SET( Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0" "1.48.0" "1.48" "1.49" "1.49.0" "1.50" "1.50.0" "1.51" "1.51.0" "1.52.0" "1.53.0" "1.54.0" "1.55" "1.55.0" "1.56" "1.56.0" "1.57" "1.57.0" "1.58" "1.58.0" "1.59" "1.59.0")
|
|
||||||
ENDIF ( NOT Boost_ADDITIONAL_VERSIONS )
|
|
||||||
FIND_PACKAGE( Boost )
|
|
||||||
IF ( NOT Boost_FOUND )
|
|
||||||
MESSAGE( FATAL_ERROR
|
|
||||||
"Boost libraries (http://www.boost.org/) not found. "
|
|
||||||
"You can build a non-boost version of Assimp with slightly reduced "
|
|
||||||
"functionality by specifying -DASSIMP_ENABLE_BOOST_WORKAROUND=ON."
|
|
||||||
)
|
|
||||||
ENDIF ( NOT Boost_FOUND )
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
|
|
||||||
ENDIF ( ASSIMP_ENABLE_BOOST_WORKAROUND )
|
|
||||||
|
|
||||||
# cmake configuration files
|
# cmake configuration files
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
|
||||||
|
@ -319,7 +294,7 @@ if(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
|
||||||
set(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DEPENDS $ "{LIBASSIMP_COMPONENT}" )
|
set(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DEPENDS $ "{LIBASSIMP_COMPONENT}" )
|
||||||
set(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "${CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT}_DISPLAY_NAME}" )
|
set(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "${CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT}_DISPLAY_NAME}" )
|
||||||
set(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS "${LIBASSIMP-DEV_COMPONENT}" )
|
set(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS "${LIBASSIMP-DEV_COMPONENT}" )
|
||||||
set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake libboost-dev libboost-thread-dev libboost-math-dev zlib1g-dev pkg-config)
|
set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake zlib1g-dev pkg-config)
|
||||||
|
|
||||||
# debian
|
# debian
|
||||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "StringComparison.h"
|
#include "StringComparison.h"
|
||||||
#include <boost/scoped_array.hpp>
|
#include <memory>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -359,7 +359,7 @@ void Discreet3DSImporter::ConvertMeshes(aiScene* pcOut)
|
||||||
|
|
||||||
// we need to split all meshes by their materials
|
// we need to split all meshes by their materials
|
||||||
for (std::vector<D3DS::Mesh>::iterator i = mScene->mMeshes.begin(); i != mScene->mMeshes.end();++i) {
|
for (std::vector<D3DS::Mesh>::iterator i = mScene->mMeshes.begin(); i != mScene->mMeshes.end();++i) {
|
||||||
boost::scoped_array< std::vector<unsigned int> > aiSplit(new std::vector<unsigned int>[mScene->mMaterials.size()]);
|
std::unique_ptr< std::vector<unsigned int>[] > aiSplit(new std::vector<unsigned int>[mScene->mMaterials.size()]);
|
||||||
|
|
||||||
name.length = ASSIMP_itoa10(name.data,num++);
|
name.length = ASSIMP_itoa10(name.data,num++);
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace {
|
||||||
// Worker function for exporting a scene to 3DS. Prototyped and registered in Exporter.cpp
|
// Worker function for exporting a scene to 3DS. Prototyped and registered in Exporter.cpp
|
||||||
void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties)
|
void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<IOStream> outfile (pIOSystem->Open(pFile, "wb"));
|
std::shared_ptr<IOStream> outfile (pIOSystem->Open(pFile, "wb"));
|
||||||
if(!outfile) {
|
if(!outfile) {
|
||||||
throw DeadlyExportError("Could not open output .3ds file: " + std::string(pFile));
|
throw DeadlyExportError("Could not open output .3ds file: " + std::string(pFile));
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScen
|
||||||
// in |Exporter::ExportFormatEntry|.
|
// in |Exporter::ExportFormatEntry|.
|
||||||
aiScene* scenecopy_tmp;
|
aiScene* scenecopy_tmp;
|
||||||
SceneCombiner::CopyScene(&scenecopy_tmp,pScene);
|
SceneCombiner::CopyScene(&scenecopy_tmp,pScene);
|
||||||
std::auto_ptr<aiScene> scenecopy(scenecopy_tmp);
|
std::unique_ptr<aiScene> scenecopy(scenecopy_tmp);
|
||||||
|
|
||||||
SplitLargeMeshesProcess_Triangle tri_splitter;
|
SplitLargeMeshesProcess_Triangle tri_splitter;
|
||||||
tri_splitter.SetLimit(0xffff);
|
tri_splitter.SetLimit(0xffff);
|
||||||
|
@ -181,7 +181,7 @@ void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScen
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Discreet3DSExporter:: Discreet3DSExporter(boost::shared_ptr<IOStream> outfile, const aiScene* scene)
|
Discreet3DSExporter:: Discreet3DSExporter(std::shared_ptr<IOStream> outfile, const aiScene* scene)
|
||||||
: scene(scene)
|
: scene(scene)
|
||||||
, writer(outfile)
|
, writer(outfile)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define AI_3DSEXPORTER_H_INC
|
#define AI_3DSEXPORTER_H_INC
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
#include "StreamWriter.h"
|
#include "StreamWriter.h"
|
||||||
#include "./../include/assimp/material.h"
|
#include "./../include/assimp/material.h"
|
||||||
|
@ -64,7 +64,7 @@ namespace Assimp
|
||||||
class Discreet3DSExporter
|
class Discreet3DSExporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Discreet3DSExporter(boost::shared_ptr<IOStream> outfile, const aiScene* pScene);
|
Discreet3DSExporter(std::shared_ptr<IOStream> outfile, const aiScene* pScene);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include "../include/assimp/config.h"
|
#include "../include/assimp/config.h"
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -708,7 +708,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
|
||||||
// collect all meshes using the same material group.
|
// collect all meshes using the same material group.
|
||||||
if (object.subDiv) {
|
if (object.subDiv) {
|
||||||
if (configEvalSubdivision) {
|
if (configEvalSubdivision) {
|
||||||
boost::scoped_ptr<Subdivider> div(Subdivider::Create(Subdivider::CATMULL_CLARKE));
|
std::unique_ptr<Subdivider> div(Subdivider::Create(Subdivider::CATMULL_CLARKE));
|
||||||
DefaultLogger::get()->info("AC3D: Evaluating subdivision surface: "+object.name);
|
DefaultLogger::get()->info("AC3D: Evaluating subdivision surface: "+object.name);
|
||||||
|
|
||||||
std::vector<aiMesh*> cpy(meshes.size()-oldm,NULL);
|
std::vector<aiMesh*> cpy(meshes.size()-oldm,NULL);
|
||||||
|
@ -787,7 +787,7 @@ void AC3DImporter::SetupProperties(const Importer* pImp)
|
||||||
void AC3DImporter::InternReadFile( const std::string& pFile,
|
void AC3DImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "SkeletonMeshBuilder.h"
|
#include "SkeletonMeshBuilder.h"
|
||||||
#include "TargetAnimation.h"
|
#include "TargetAnimation.h"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
@ -130,7 +130,7 @@ void ASEImporter::SetupProperties(const Importer* pImp)
|
||||||
void ASEImporter::InternReadFile( const std::string& pFile,
|
void ASEImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
|
|
@ -59,8 +59,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
# include <boost/thread/thread.hpp>
|
# include <thread>
|
||||||
# include <boost/thread/mutex.hpp>
|
# include <mutex>
|
||||||
#endif
|
#endif
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -103,7 +103,7 @@ namespace Assimp
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
/** Global mutex to manage the access to the log-stream map */
|
/** Global mutex to manage the access to the log-stream map */
|
||||||
static boost::mutex gLogStreamMutex;
|
static std::mutex gLogStreamMutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public:
|
||||||
|
|
||||||
~LogToCallbackRedirector() {
|
~LogToCallbackRedirector() {
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
boost::mutex::scoped_lock lock(gLogStreamMutex);
|
std::lock_guard<std::mutex> lock(gLogStreamMutex);
|
||||||
#endif
|
#endif
|
||||||
// (HACK) Check whether the 'stream.user' pointer points to a
|
// (HACK) Check whether the 'stream.user' pointer points to a
|
||||||
// custom LogStream allocated by #aiGetPredefinedLogStream.
|
// custom LogStream allocated by #aiGetPredefinedLogStream.
|
||||||
|
@ -383,7 +383,7 @@ ASSIMP_API void aiAttachLogStream( const aiLogStream* stream )
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
boost::mutex::scoped_lock lock(gLogStreamMutex);
|
std::lock_guard<std::mutex> lock(gLogStreamMutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LogStream* lg = new LogToCallbackRedirector(*stream);
|
LogStream* lg = new LogToCallbackRedirector(*stream);
|
||||||
|
@ -402,7 +402,7 @@ ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
boost::mutex::scoped_lock lock(gLogStreamMutex);
|
std::lock_guard<std::mutex> lock(gLogStreamMutex);
|
||||||
#endif
|
#endif
|
||||||
// find the log-stream associated with this data
|
// find the log-stream associated with this data
|
||||||
LogStreamMap::iterator it = gActiveLogStreams.find( *stream);
|
LogStreamMap::iterator it = gActiveLogStreams.find( *stream);
|
||||||
|
@ -427,7 +427,7 @@ ASSIMP_API void aiDetachAllLogStreams(void)
|
||||||
{
|
{
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
boost::mutex::scoped_lock lock(gLogStreamMutex);
|
std::lock_guard<std::mutex> lock(gLogStreamMutex);
|
||||||
#endif
|
#endif
|
||||||
Logger *logger( DefaultLogger::get() );
|
Logger *logger( DefaultLogger::get() );
|
||||||
if ( NULL == logger ) {
|
if ( NULL == logger ) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "TextureTransform.h"
|
#include "TextureTransform.h"
|
||||||
#include "ConvertToLHProcess.h"
|
#include "ConvertToLHProcess.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/anim.h"
|
#include "../include/assimp/anim.h"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
@ -114,7 +114,7 @@ void B3DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
|
||||||
cout<<"Hello world from the B3DImporter!"<<endl;
|
cout<<"Hello world from the B3DImporter!"<<endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
|
|
|
@ -47,12 +47,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include "SkeletonMeshBuilder.h"
|
#include "SkeletonMeshBuilder.h"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <boost/format.hpp>
|
#include "TinyFormatter.h"
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
using namespace Assimp::Formatter;
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static const aiImporterDesc desc = {
|
||||||
"BVH Importer (MoCap)",
|
"BVH Importer (MoCap)",
|
||||||
|
@ -118,7 +119,7 @@ void BVHLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSys
|
||||||
mFileName = pFile;
|
mFileName = pFile;
|
||||||
|
|
||||||
// read file into memory
|
// read file into memory
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
throw DeadlyImportError( "Failed to open file " + pFile + ".");
|
throw DeadlyImportError( "Failed to open file " + pFile + ".");
|
||||||
|
|
||||||
|
@ -179,12 +180,12 @@ aiNode* BVHLoader::ReadNode()
|
||||||
// first token is name
|
// first token is name
|
||||||
std::string nodeName = GetNextToken();
|
std::string nodeName = GetNextToken();
|
||||||
if( nodeName.empty() || nodeName == "{")
|
if( nodeName.empty() || nodeName == "{")
|
||||||
ThrowException( boost::str( boost::format( "Expected node name, but found \"%s\".") % nodeName));
|
ThrowException( format() << "Expected node name, but found \"" << nodeName << "\"." );
|
||||||
|
|
||||||
// then an opening brace should follow
|
// then an opening brace should follow
|
||||||
std::string openBrace = GetNextToken();
|
std::string openBrace = GetNextToken();
|
||||||
if( openBrace != "{")
|
if( openBrace != "{")
|
||||||
ThrowException( boost::str( boost::format( "Expected opening brace \"{\", but found \"%s\".") % openBrace));
|
ThrowException( format() << "Expected opening brace \"{\", but found \"" << openBrace << "\"." );
|
||||||
|
|
||||||
// Create a node
|
// Create a node
|
||||||
aiNode* node = new aiNode( nodeName);
|
aiNode* node = new aiNode( nodeName);
|
||||||
|
@ -216,7 +217,7 @@ aiNode* BVHLoader::ReadNode()
|
||||||
// The real symbol is "End Site". Second part comes in a separate token
|
// The real symbol is "End Site". Second part comes in a separate token
|
||||||
std::string siteToken = GetNextToken();
|
std::string siteToken = GetNextToken();
|
||||||
if( siteToken != "Site")
|
if( siteToken != "Site")
|
||||||
ThrowException( boost::str( boost::format( "Expected \"End Site\" keyword, but found \"%s %s\".") % token % siteToken));
|
ThrowException( format() << "Expected \"End Site\" keyword, but found \"" << token << " " << siteToken << "\"." );
|
||||||
|
|
||||||
aiNode* child = ReadEndSite( nodeName);
|
aiNode* child = ReadEndSite( nodeName);
|
||||||
child->mParent = node;
|
child->mParent = node;
|
||||||
|
@ -229,7 +230,7 @@ aiNode* BVHLoader::ReadNode()
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// everything else is a parse error
|
// everything else is a parse error
|
||||||
ThrowException( boost::str( boost::format( "Unknown keyword \"%s\".") % token));
|
ThrowException( format() << "Unknown keyword \"" << token << "\"." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +253,7 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName)
|
||||||
// check opening brace
|
// check opening brace
|
||||||
std::string openBrace = GetNextToken();
|
std::string openBrace = GetNextToken();
|
||||||
if( openBrace != "{")
|
if( openBrace != "{")
|
||||||
ThrowException( boost::str( boost::format( "Expected opening brace \"{\", but found \"%s\".") % openBrace));
|
ThrowException( format() << "Expected opening brace \"{\", but found \"" << openBrace << "\".");
|
||||||
|
|
||||||
// Create a node
|
// Create a node
|
||||||
aiNode* node = new aiNode( "EndSite_" + pParentName);
|
aiNode* node = new aiNode( "EndSite_" + pParentName);
|
||||||
|
@ -274,7 +275,7 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName)
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// everything else is a parse error
|
// everything else is a parse error
|
||||||
ThrowException( boost::str( boost::format( "Unknown keyword \"%s\".") % token));
|
ThrowException( format() << "Unknown keyword \"" << token << "\"." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +322,7 @@ void BVHLoader::ReadNodeChannels( BVHLoader::Node& pNode)
|
||||||
else if( channelToken == "Zrotation")
|
else if( channelToken == "Zrotation")
|
||||||
pNode.mChannels.push_back( Channel_RotationZ);
|
pNode.mChannels.push_back( Channel_RotationZ);
|
||||||
else
|
else
|
||||||
ThrowException( boost::str( boost::format( "Invalid channel specifier \"%s\".") % channelToken));
|
ThrowException( format() << "Invalid channel specifier \"" << channelToken << "\"." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +333,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/)
|
||||||
// Read number of frames
|
// Read number of frames
|
||||||
std::string tokenFrames = GetNextToken();
|
std::string tokenFrames = GetNextToken();
|
||||||
if( tokenFrames != "Frames:")
|
if( tokenFrames != "Frames:")
|
||||||
ThrowException( boost::str( boost::format( "Expected frame count \"Frames:\", but found \"%s\".") % tokenFrames));
|
ThrowException( format() << "Expected frame count \"Frames:\", but found \"" << tokenFrames << "\".");
|
||||||
|
|
||||||
float numFramesFloat = GetNextTokenAsFloat();
|
float numFramesFloat = GetNextTokenAsFloat();
|
||||||
mAnimNumFrames = (unsigned int) numFramesFloat;
|
mAnimNumFrames = (unsigned int) numFramesFloat;
|
||||||
|
@ -341,7 +342,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/)
|
||||||
std::string tokenDuration1 = GetNextToken();
|
std::string tokenDuration1 = GetNextToken();
|
||||||
std::string tokenDuration2 = GetNextToken();
|
std::string tokenDuration2 = GetNextToken();
|
||||||
if( tokenDuration1 != "Frame" || tokenDuration2 != "Time:")
|
if( tokenDuration1 != "Frame" || tokenDuration2 != "Time:")
|
||||||
ThrowException( boost::str( boost::format( "Expected frame duration \"Frame Time:\", but found \"%s %s\".") % tokenDuration1 % tokenDuration2));
|
ThrowException( format() << "Expected frame duration \"Frame Time:\", but found \"" << tokenDuration1 << " " << tokenDuration2 << "\"." );
|
||||||
|
|
||||||
mAnimTickDuration = GetNextTokenAsFloat();
|
mAnimTickDuration = GetNextTokenAsFloat();
|
||||||
|
|
||||||
|
@ -414,7 +415,7 @@ float BVHLoader::GetNextTokenAsFloat()
|
||||||
ctoken = fast_atoreal_move<float>( ctoken, result);
|
ctoken = fast_atoreal_move<float>( ctoken, result);
|
||||||
|
|
||||||
if( ctoken != token.c_str() + token.length())
|
if( ctoken != token.c_str() + token.length())
|
||||||
ThrowException( boost::str( boost::format( "Expected a floating point number, but found \"%s\".") % token));
|
ThrowException( format() << "Expected a floating point number, but found \"" << token << "\"." );
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -423,7 +424,7 @@ float BVHLoader::GetNextTokenAsFloat()
|
||||||
// Aborts the file reading with an exception
|
// Aborts the file reading with an exception
|
||||||
AI_WONT_RETURN void BVHLoader::ThrowException( const std::string& pError)
|
AI_WONT_RETURN void BVHLoader::ThrowException( const std::string& pError)
|
||||||
{
|
{
|
||||||
throw DeadlyImportError( boost::str( boost::format( "%s:%d - %s") % mFileName % mLine % pError));
|
throw DeadlyImportError( format() << mFileName << ":" << mLine << " - " << pError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -52,8 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "../include/assimp/postprocess.h"
|
#include "../include/assimp/postprocess.h"
|
||||||
#include <ios>
|
#include <ios>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
@ -149,10 +148,10 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
|
||||||
if (!pIOHandler)
|
if (!pIOHandler)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boost::scoped_ptr<IOStream> pStream (pIOHandler->Open(pFile));
|
std::unique_ptr<IOStream> pStream (pIOHandler->Open(pFile));
|
||||||
if (pStream.get() ) {
|
if (pStream.get() ) {
|
||||||
// read 200 characters from the file
|
// read 200 characters from the file
|
||||||
boost::scoped_array<char> _buffer (new char[searchBytes+1 /* for the '\0' */]);
|
std::unique_ptr<char[]> _buffer (new char[searchBytes+1 /* for the '\0' */]);
|
||||||
char* buffer = _buffer.get();
|
char* buffer = _buffer.get();
|
||||||
if( NULL == buffer ) {
|
if( NULL == buffer ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -256,7 +255,7 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
|
||||||
const uint32_t* magic_u32;
|
const uint32_t* magic_u32;
|
||||||
};
|
};
|
||||||
magic = reinterpret_cast<const char*>(_magic);
|
magic = reinterpret_cast<const char*>(_magic);
|
||||||
boost::scoped_ptr<IOStream> pStream (pIOHandler->Open(pFile));
|
std::unique_ptr<IOStream> pStream (pIOHandler->Open(pFile));
|
||||||
if (pStream.get() ) {
|
if (pStream.get() ) {
|
||||||
|
|
||||||
// skip to offset
|
// skip to offset
|
||||||
|
|
|
@ -48,13 +48,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "BlenderDNA.h"
|
#include "BlenderDNA.h"
|
||||||
#include "StreamReader.h"
|
#include "StreamReader.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
using namespace Assimp::Blender;
|
using namespace Assimp::Blender;
|
||||||
using namespace Assimp::Formatter;
|
using namespace Assimp::Formatter;
|
||||||
|
|
||||||
#define for_each BOOST_FOREACH
|
|
||||||
bool match4(StreamReaderAny& stream, const char* string) {
|
bool match4(StreamReaderAny& stream, const char* string) {
|
||||||
char tmp[] = {
|
char tmp[] = {
|
||||||
(stream).GetI1(),
|
(stream).GetI1(),
|
||||||
|
@ -86,7 +84,7 @@ void DNAParser :: Parse ()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> names (stream.GetI4());
|
std::vector<std::string> names (stream.GetI4());
|
||||||
for_each(std::string& s, names) {
|
for(std::string& s : names) {
|
||||||
while (char c = stream.GetI1()) {
|
while (char c = stream.GetI1()) {
|
||||||
s += c;
|
s += c;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +97,7 @@ void DNAParser :: Parse ()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Type> types (stream.GetI4());
|
std::vector<Type> types (stream.GetI4());
|
||||||
for_each(Type& s, types) {
|
for(Type& s : types) {
|
||||||
while (char c = stream.GetI1()) {
|
while (char c = stream.GetI1()) {
|
||||||
s.name += c;
|
s.name += c;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +109,7 @@ void DNAParser :: Parse ()
|
||||||
throw DeadlyImportError("BlenderDNA: Expected TLEN field");
|
throw DeadlyImportError("BlenderDNA: Expected TLEN field");
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each(Type& s, types) {
|
for(Type& s : types) {
|
||||||
s.size = stream.GetI2();
|
s.size = stream.GetI2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,9 +236,9 @@ void DNA :: DumpToFile()
|
||||||
f << "Field format: type name offset size" << "\n";
|
f << "Field format: type name offset size" << "\n";
|
||||||
f << "Structure format: name size" << "\n";
|
f << "Structure format: name size" << "\n";
|
||||||
|
|
||||||
for_each(const Structure& s, structures) {
|
for(const Structure& s : structures) {
|
||||||
f << s.name << " " << s.size << "\n\n";
|
f << s.name << " " << s.size << "\n\n";
|
||||||
for_each(const Field& ff, s.fields) {
|
for(const Field& ff : s.fields) {
|
||||||
f << "\t" << ff.type << " " << ff.name << " " << ff.offset << " " << ff.size << std::endl;
|
f << "\t" << ff.type << " " << ff.name << " " << ff.offset << " " << ff.size << std::endl;
|
||||||
}
|
}
|
||||||
f << std::endl;
|
f << std::endl;
|
||||||
|
@ -270,17 +268,17 @@ void DNA :: DumpToFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
boost::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure(
|
std::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure(
|
||||||
const Structure& structure,
|
const Structure& structure,
|
||||||
const FileDatabase& db
|
const FileDatabase& db
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
std::map<std::string, FactoryPair >::const_iterator it = converters.find(structure.name);
|
std::map<std::string, FactoryPair >::const_iterator it = converters.find(structure.name);
|
||||||
if (it == converters.end()) {
|
if (it == converters.end()) {
|
||||||
return boost::shared_ptr< ElemBase >();
|
return std::shared_ptr< ElemBase >();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr< ElemBase > ret = (structure.*((*it).second.first))();
|
std::shared_ptr< ElemBase > ret = (structure.*((*it).second.first))();
|
||||||
(structure.*((*it).second.second))(ret,db);
|
(structure.*((*it).second.second))(ret,db);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "StreamReader.h"
|
#include "StreamReader.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
// enable verbose log output. really verbose, so be careful.
|
// enable verbose log output. really verbose, so be careful.
|
||||||
|
@ -97,7 +97,7 @@ struct ElemBase
|
||||||
* string points is the `c_str` of the `name` attribute of the
|
* string points is the `c_str` of the `name` attribute of the
|
||||||
* corresponding `Structure`, that is, it is only valid as long
|
* corresponding `Structure`, that is, it is only valid as long
|
||||||
* as the DNA is not modified. The dna_type is only set if the
|
* as the DNA is not modified. The dna_type is only set if the
|
||||||
* data type is not static, i.e. a boost::shared_ptr<ElemBase>
|
* data type is not static, i.e. a std::shared_ptr<ElemBase>
|
||||||
* in the scene description would have its type resolved
|
* in the scene description would have its type resolved
|
||||||
* at runtime, so this member is always set. */
|
* at runtime, so this member is always set. */
|
||||||
const char* dna_type;
|
const char* dna_type;
|
||||||
|
@ -127,7 +127,7 @@ struct FileOffset
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/** Dummy derivate of std::vector to be able to use it in templates simultaenously
|
/** Dummy derivate of std::vector to be able to use it in templates simultaenously
|
||||||
* with boost::shared_ptr, which takes only one template argument
|
* with std::shared_ptr, which takes only one template argument
|
||||||
* while std::vector takes three. Also we need to provide some special member
|
* while std::vector takes three. Also we need to provide some special member
|
||||||
* functions of shared_ptr */
|
* functions of shared_ptr */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -260,11 +260,11 @@ public:
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
// generic converter
|
// generic converter
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Convert(boost::shared_ptr<ElemBase> in,const FileDatabase& db) const;
|
void Convert(std::shared_ptr<ElemBase> in,const FileDatabase& db) const;
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
// generic allocator
|
// generic allocator
|
||||||
template <typename T> boost::shared_ptr<ElemBase> Allocate() const;
|
template <typename T> std::shared_ptr<ElemBase> Allocate() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ public:
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
// field parsing for pointer or dynamic array types
|
// field parsing for pointer or dynamic array types
|
||||||
// (boost::shared_ptr or boost::shared_array)
|
// (std::shared_ptr)
|
||||||
// The return value indicates whether the data was already cached.
|
// The return value indicates whether the data was already cached.
|
||||||
template <int error_policy, template <typename> class TOUT, typename T>
|
template <int error_policy, template <typename> class TOUT, typename T>
|
||||||
bool ReadFieldPtr(TOUT<T>& out, const char* name,
|
bool ReadFieldPtr(TOUT<T>& out, const char* name,
|
||||||
|
@ -291,7 +291,7 @@ public:
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
// field parsing for static arrays of pointer or dynamic
|
// field parsing for static arrays of pointer or dynamic
|
||||||
// array types (boost::shared_ptr[] or boost::shared_array[])
|
// array types (std::shared_ptr[])
|
||||||
// The return value indicates whether the data was already cached.
|
// The return value indicates whether the data was already cached.
|
||||||
template <int error_policy, template <typename> class TOUT, typename T, size_t N>
|
template <int error_policy, template <typename> class TOUT, typename T, size_t N>
|
||||||
bool ReadFieldPtr(TOUT<T> (&out)[N], const char* name,
|
bool ReadFieldPtr(TOUT<T> (&out)[N], const char* name,
|
||||||
|
@ -318,7 +318,7 @@ private:
|
||||||
const FileDatabase& db, const Field& f, bool) const;
|
const FileDatabase& db, const Field& f, bool) const;
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
bool ResolvePointer( boost::shared_ptr< FileOffset >& out, const Pointer & ptrval,
|
bool ResolvePointer( std::shared_ptr< FileOffset >& out, const Pointer & ptrval,
|
||||||
const FileDatabase& db, const Field& f, bool) const;
|
const FileDatabase& db, const Field& f, bool) const;
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
@ -329,8 +329,8 @@ private:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
template <typename T> T* _allocate(boost::shared_ptr<T>& out, size_t& s) const {
|
template <typename T> T* _allocate(std::shared_ptr<T>& out, size_t& s) const {
|
||||||
out = boost::shared_ptr<T>(new T());
|
out = std::shared_ptr<T>(new T());
|
||||||
s = 1;
|
s = 1;
|
||||||
return out.get();
|
return out.get();
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ template <> struct Structure :: _defaultInitializer<ErrorPolicy_Fail> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------
|
||||||
template <> inline bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::shared_ptr<ElemBase>& out,
|
template <> inline bool Structure :: ResolvePointer<std::shared_ptr,ElemBase>(std::shared_ptr<ElemBase>& out,
|
||||||
const Pointer & ptrval,
|
const Pointer & ptrval,
|
||||||
const FileDatabase& db,
|
const FileDatabase& db,
|
||||||
const Field& f,
|
const Field& f,
|
||||||
|
@ -413,11 +413,11 @@ class DNA
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef void (Structure::*ConvertProcPtr) (
|
typedef void (Structure::*ConvertProcPtr) (
|
||||||
boost::shared_ptr<ElemBase> in,
|
std::shared_ptr<ElemBase> in,
|
||||||
const FileDatabase&
|
const FileDatabase&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
typedef boost::shared_ptr<ElemBase> (
|
typedef std::shared_ptr<ElemBase> (
|
||||||
Structure::*AllocProcPtr) () const;
|
Structure::*AllocProcPtr) () const;
|
||||||
|
|
||||||
typedef std::pair< AllocProcPtr, ConvertProcPtr > FactoryPair;
|
typedef std::pair< AllocProcPtr, ConvertProcPtr > FactoryPair;
|
||||||
|
@ -464,7 +464,7 @@ public:
|
||||||
* @param structure Destination structure definition
|
* @param structure Destination structure definition
|
||||||
* @param db File database.
|
* @param db File database.
|
||||||
* @return A null pointer if no appropriate converter is available.*/
|
* @return A null pointer if no appropriate converter is available.*/
|
||||||
boost::shared_ptr< ElemBase > ConvertBlobToStructure(
|
std::shared_ptr< ElemBase > ConvertBlobToStructure(
|
||||||
const Structure& structure,
|
const Structure& structure,
|
||||||
const FileDatabase& db
|
const FileDatabase& db
|
||||||
) const;
|
) const;
|
||||||
|
@ -724,7 +724,7 @@ public:
|
||||||
bool little;
|
bool little;
|
||||||
|
|
||||||
DNA dna;
|
DNA dna;
|
||||||
boost::shared_ptr< StreamReaderAny > reader;
|
std::shared_ptr< StreamReaderAny > reader;
|
||||||
vector< FileBlockHead > entries;
|
vector< FileBlockHead > entries;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -738,7 +738,7 @@ public:
|
||||||
// arrays of objects are never cached because we can't easily
|
// arrays of objects are never cached because we can't easily
|
||||||
// ensure their proper destruction.
|
// ensure their proper destruction.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
ObjectCache<boost::shared_ptr>& cache(boost::shared_ptr<T>& /*in*/) const {
|
ObjectCache<std::shared_ptr>& cache(std::shared_ptr<T>& /*in*/) const {
|
||||||
return _cache;
|
return _cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,7 +755,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mutable ObjectCache<vector> _cacheArrays;
|
mutable ObjectCache<vector> _cacheArrays;
|
||||||
mutable ObjectCache<boost::shared_ptr> _cache;
|
mutable ObjectCache<std::shared_ptr> _cache;
|
||||||
|
|
||||||
mutable size_t next_cache_idx;
|
mutable size_t next_cache_idx;
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_BLEND_DNA_INL
|
#ifndef INCLUDED_AI_BLEND_DNA_INL
|
||||||
#define INCLUDED_AI_BLEND_DNA_INL
|
#define INCLUDED_AI_BLEND_DNA_INL
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace Blender {
|
namespace Blender {
|
||||||
|
@ -83,14 +83,14 @@ const Field& Structure :: operator [] (const size_t i) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
template <typename T> boost::shared_ptr<ElemBase> Structure :: Allocate() const
|
template <typename T> std::shared_ptr<ElemBase> Structure :: Allocate() const
|
||||||
{
|
{
|
||||||
return boost::shared_ptr<T>(new T());
|
return std::shared_ptr<T>(new T());
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
template <typename T> void Structure :: Convert(
|
template <typename T> void Structure :: Convert(
|
||||||
boost::shared_ptr<ElemBase> in,
|
std::shared_ptr<ElemBase> in,
|
||||||
const FileDatabase& db) const
|
const FileDatabase& db) const
|
||||||
{
|
{
|
||||||
Convert<T> (*static_cast<T*> ( in.get() ),db);
|
Convert<T> (*static_cast<T*> ( in.get() ),db);
|
||||||
|
@ -366,7 +366,7 @@ bool Structure :: ResolvePointer(TOUT<T>& out, const Pointer & ptrval, const Fil
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
inline bool Structure :: ResolvePointer( boost::shared_ptr< FileOffset >& out, const Pointer & ptrval,
|
inline bool Structure :: ResolvePointer( std::shared_ptr< FileOffset >& out, const Pointer & ptrval,
|
||||||
const FileDatabase& db,
|
const FileDatabase& db,
|
||||||
const Field&,
|
const Field&,
|
||||||
bool) const
|
bool) const
|
||||||
|
@ -381,7 +381,7 @@ inline bool Structure :: ResolvePointer( boost::shared_ptr< FileOffset >& out, c
|
||||||
// find the file block the pointer is pointing to
|
// find the file block the pointer is pointing to
|
||||||
const FileBlockHead* block = LocateFileBlockForAddress(ptrval,db);
|
const FileBlockHead* block = LocateFileBlockForAddress(ptrval,db);
|
||||||
|
|
||||||
out = boost::shared_ptr< FileOffset > (new FileOffset());
|
out = std::shared_ptr< FileOffset > (new FileOffset());
|
||||||
out->val = block->start+ static_cast<size_t>((ptrval.val - block->address.val) );
|
out->val = block->start+ static_cast<size_t>((ptrval.val - block->address.val) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -426,7 +426,7 @@ bool Structure :: ResolvePointer(vector< TOUT<T> >& out, const Pointer & ptrval,
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
template <> bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::shared_ptr<ElemBase>& out,
|
template <> bool Structure :: ResolvePointer<std::shared_ptr,ElemBase>(std::shared_ptr<ElemBase>& out,
|
||||||
const Pointer & ptrval,
|
const Pointer & ptrval,
|
||||||
const FileDatabase& db,
|
const FileDatabase& db,
|
||||||
const Field&,
|
const Field&,
|
||||||
|
@ -703,7 +703,7 @@ template <template <typename> class TOUT> template <typename T> void ObjectCache
|
||||||
|
|
||||||
typename StructureCache::const_iterator it = caches[s.cache_idx].find(ptr);
|
typename StructureCache::const_iterator it = caches[s.cache_idx].find(ptr);
|
||||||
if (it != caches[s.cache_idx].end()) {
|
if (it != caches[s.cache_idx].end()) {
|
||||||
out = boost::static_pointer_cast<T>( (*it).second );
|
out = std::static_pointer_cast<T>( (*it).second );
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||||
++db.stats().cache_hits;
|
++db.stats().cache_hits;
|
||||||
|
@ -723,7 +723,7 @@ template <template <typename> class TOUT> template <typename T> void ObjectCache
|
||||||
s.cache_idx = db.next_cache_idx++;
|
s.cache_idx = db.next_cache_idx++;
|
||||||
caches.resize(db.next_cache_idx);
|
caches.resize(db.next_cache_idx);
|
||||||
}
|
}
|
||||||
caches[s.cache_idx][ptr] = boost::static_pointer_cast<ElemBase>( out );
|
caches[s.cache_idx][ptr] = std::static_pointer_cast<ElemBase>( out );
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||||
++db.stats().cached_objects;
|
++db.stats().cached_objects;
|
||||||
|
|
|
@ -49,14 +49,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "BlenderDNA.h"
|
#include "BlenderDNA.h"
|
||||||
#include "BlenderScene.h"
|
#include "BlenderScene.h"
|
||||||
#include "BlenderSceneGen.h"
|
#include "BlenderSceneGen.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "./../include/assimp/material.h"
|
#include "./../include/assimp/material.h"
|
||||||
|
|
||||||
struct aiTexture;
|
struct aiTexture;
|
||||||
|
|
||||||
#define for_each(x,y) BOOST_FOREACH(x,y)
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace Blender {
|
namespace Blender {
|
||||||
|
|
||||||
|
@ -71,7 +68,7 @@ namespace Blender {
|
||||||
}
|
}
|
||||||
|
|
||||||
~TempArray () {
|
~TempArray () {
|
||||||
for_each(T* elem, arr) {
|
for(T* elem : arr) {
|
||||||
delete elem;
|
delete elem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +157,7 @@ namespace Blender {
|
||||||
TempArray <std::vector, aiTexture> textures;
|
TempArray <std::vector, aiTexture> textures;
|
||||||
|
|
||||||
// set of all materials referenced by at least one mesh in the scene
|
// set of all materials referenced by at least one mesh in the scene
|
||||||
std::deque< boost::shared_ptr< Material > > materials_raw;
|
std::deque< std::shared_ptr< Material > > materials_raw;
|
||||||
|
|
||||||
// counter to name sentinel textures inserted as substitutes for procedural textures.
|
// counter to name sentinel textures inserted as substitutes for procedural textures.
|
||||||
unsigned int sentinel_cnt;
|
unsigned int sentinel_cnt;
|
||||||
|
|
|
@ -164,7 +164,7 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FileDatabase file;
|
FileDatabase file;
|
||||||
boost::shared_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
|
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
ThrowException("Could not open file for reading");
|
ThrowException("Could not open file for reading");
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
|
||||||
|
|
||||||
// http://www.gzip.org/zlib/rfc-gzip.html#header-trailer
|
// http://www.gzip.org/zlib/rfc-gzip.html#header-trailer
|
||||||
stream->Seek(0L,aiOrigin_SET);
|
stream->Seek(0L,aiOrigin_SET);
|
||||||
boost::shared_ptr<StreamReaderLE> reader = boost::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
|
std::shared_ptr<StreamReaderLE> reader = std::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
|
||||||
|
|
||||||
// build a zlib stream
|
// build a zlib stream
|
||||||
z_stream zstream;
|
z_stream zstream;
|
||||||
|
@ -260,9 +260,9 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void BlenderImporter::ParseBlendFile(FileDatabase& out, boost::shared_ptr<IOStream> stream)
|
void BlenderImporter::ParseBlendFile(FileDatabase& out, std::shared_ptr<IOStream> stream)
|
||||||
{
|
{
|
||||||
out.reader = boost::shared_ptr<StreamReaderAny>(new StreamReaderAny(stream,out.little));
|
out.reader = std::shared_ptr<StreamReaderAny>(new StreamReaderAny(stream,out.little));
|
||||||
|
|
||||||
DNAParser dna_reader(out);
|
DNAParser dna_reader(out);
|
||||||
const DNA* dna = NULL;
|
const DNA* dna = NULL;
|
||||||
|
@ -305,7 +305,7 @@ void BlenderImporter::ExtractScene(Scene& out, const FileDatabase& file)
|
||||||
const Structure& ss = file.dna.structures[(*it).second];
|
const Structure& ss = file.dna.structures[(*it).second];
|
||||||
|
|
||||||
// we need a scene somewhere to start with.
|
// we need a scene somewhere to start with.
|
||||||
for_each(const FileBlockHead& bl,file.entries) {
|
for(const FileBlockHead& bl :file.entries) {
|
||||||
|
|
||||||
// Fix: using the DNA index is more reliable to locate scenes
|
// Fix: using the DNA index is more reliable to locate scenes
|
||||||
//if (bl.id == "SC") {
|
//if (bl.id == "SC") {
|
||||||
|
@ -342,7 +342,7 @@ void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileD
|
||||||
// the file. This is terrible. Here, we're first looking for
|
// the file. This is terrible. Here, we're first looking for
|
||||||
// all objects which don't have parent objects at all -
|
// all objects which don't have parent objects at all -
|
||||||
std::deque<const Object*> no_parents;
|
std::deque<const Object*> no_parents;
|
||||||
for (boost::shared_ptr<Base> cur = boost::static_pointer_cast<Base> ( in.base.first ); cur; cur = cur->next) {
|
for (std::shared_ptr<Base> cur = std::static_pointer_cast<Base> ( in.base.first ); cur; cur = cur->next) {
|
||||||
if (cur->object) {
|
if (cur->object) {
|
||||||
if(!cur->object->parent) {
|
if(!cur->object->parent) {
|
||||||
no_parents.push_back(cur->object.get());
|
no_parents.push_back(cur->object.get());
|
||||||
|
@ -350,7 +350,7 @@ void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileD
|
||||||
else conv.objects.insert(cur->object.get());
|
else conv.objects.insert(cur->object.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (boost::shared_ptr<Base> cur = in.basact; cur; cur = cur->next) {
|
for (std::shared_ptr<Base> cur = in.basact; cur; cur = cur->next) {
|
||||||
if (cur->object) {
|
if (cur->object) {
|
||||||
if(cur->object->parent) {
|
if(cur->object->parent) {
|
||||||
conv.objects.insert(cur->object.get());
|
conv.objects.insert(cur->object.get());
|
||||||
|
@ -560,12 +560,12 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
|
||||||
|
|
||||||
// add a default material if necessary
|
// add a default material if necessary
|
||||||
unsigned int index = static_cast<unsigned int>( -1 );
|
unsigned int index = static_cast<unsigned int>( -1 );
|
||||||
for_each( aiMesh* mesh, conv_data.meshes.get() ) {
|
for( aiMesh* mesh : conv_data.meshes.get() ) {
|
||||||
if (mesh->mMaterialIndex == static_cast<unsigned int>( -1 )) {
|
if (mesh->mMaterialIndex == static_cast<unsigned int>( -1 )) {
|
||||||
|
|
||||||
if (index == static_cast<unsigned int>( -1 )) {
|
if (index == static_cast<unsigned int>( -1 )) {
|
||||||
// Setup a default material.
|
// Setup a default material.
|
||||||
boost::shared_ptr<Material> p(new Material());
|
std::shared_ptr<Material> p(new Material());
|
||||||
ai_assert(::strlen(AI_DEFAULT_MATERIAL_NAME) < sizeof(p->id.name)-2);
|
ai_assert(::strlen(AI_DEFAULT_MATERIAL_NAME) < sizeof(p->id.name)-2);
|
||||||
strcpy( p->id.name+2, AI_DEFAULT_MATERIAL_NAME );
|
strcpy( p->id.name+2, AI_DEFAULT_MATERIAL_NAME );
|
||||||
|
|
||||||
|
@ -589,7 +589,7 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each(boost::shared_ptr<Material> mat, conv_data.materials_raw) {
|
for(std::shared_ptr<Material> mat : conv_data.materials_raw) {
|
||||||
|
|
||||||
// reset per material global counters
|
// reset per material global counters
|
||||||
for (size_t i = 0; i < sizeof(conv_data.next_texture)/sizeof(conv_data.next_texture[0]);++i) {
|
for (size_t i = 0; i < sizeof(conv_data.next_texture)/sizeof(conv_data.next_texture[0]);++i) {
|
||||||
|
@ -722,7 +722,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
|
||||||
temp->reserve(temp->size() + per_mat.size());
|
temp->reserve(temp->size() + per_mat.size());
|
||||||
|
|
||||||
std::map<size_t,size_t> mat_num_to_mesh_idx;
|
std::map<size_t,size_t> mat_num_to_mesh_idx;
|
||||||
for_each(MyPair& it, per_mat) {
|
for(MyPair& it : per_mat) {
|
||||||
|
|
||||||
mat_num_to_mesh_idx[it.first] = temp->size();
|
mat_num_to_mesh_idx[it.first] = temp->size();
|
||||||
temp->push_back(new aiMesh());
|
temp->push_back(new aiMesh());
|
||||||
|
@ -749,8 +749,8 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
|
||||||
ThrowException("Material index is out of range");
|
ThrowException("Material index is out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<Material> mat = mesh->mat[it.first];
|
std::shared_ptr<Material> mat = mesh->mat[it.first];
|
||||||
const std::deque< boost::shared_ptr<Material> >::iterator has = std::find(
|
const std::deque< std::shared_ptr<Material> >::iterator has = std::find(
|
||||||
conv_data.materials_raw.begin(),
|
conv_data.materials_raw.begin(),
|
||||||
conv_data.materials_raw.end(),mat
|
conv_data.materials_raw.end(),mat
|
||||||
);
|
);
|
||||||
|
@ -1157,7 +1157,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers
|
||||||
if (children.size()) {
|
if (children.size()) {
|
||||||
node->mNumChildren = static_cast<unsigned int>(children.size());
|
node->mNumChildren = static_cast<unsigned int>(children.size());
|
||||||
aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren]();
|
aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren]();
|
||||||
for_each (const Object* nobj,children) {
|
for (const Object* nobj :children) {
|
||||||
*nd = ConvertNode(in,nobj,conv_data,node->mTransformation * parentTransform);
|
*nd = ConvertNode(in,nobj,conv_data,node->mTransformation * parentTransform);
|
||||||
(*nd++)->mParent = node;
|
(*nd++)->mParent = node;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include "BaseImporter.h"
|
||||||
#include "LogAux.h"
|
#include "LogAux.h"
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
struct aiMesh;
|
struct aiMesh;
|
||||||
|
@ -133,7 +133,7 @@ protected:
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
void ParseBlendFile(Blender::FileDatabase& out,
|
void ParseBlendFile(Blender::FileDatabase& out,
|
||||||
boost::shared_ptr<IOStream> stream
|
std::shared_ptr<IOStream> stream
|
||||||
);
|
);
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
|
|
|
@ -48,9 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "SceneCombiner.h"
|
#include "SceneCombiner.h"
|
||||||
#include "Subdivision.h"
|
#include "Subdivision.h"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
#include <boost/pointer_cast.hpp>
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
@ -113,8 +111,8 @@ void BlenderModifierShowcase::ApplyModifiers(aiNode& out, ConversionData& conv_d
|
||||||
// we're allowed to dereference the pointers without risking to crash. We might still be
|
// we're allowed to dereference the pointers without risking to crash. We might still be
|
||||||
// invoking UB btw - we're assuming that the ModifierData member of the respective modifier
|
// invoking UB btw - we're assuming that the ModifierData member of the respective modifier
|
||||||
// structures is at offset sizeof(vftable) with no padding.
|
// structures is at offset sizeof(vftable) with no padding.
|
||||||
const SharedModifierData* cur = boost::static_pointer_cast<const SharedModifierData> ( orig_object.modifiers.first.get() );
|
const SharedModifierData* cur = static_cast<const SharedModifierData *> ( orig_object.modifiers.first.get() );
|
||||||
for (; cur; cur = boost::static_pointer_cast<const SharedModifierData> ( cur->modifier.next.get() ), ++ful) {
|
for (; cur; cur = static_cast<const SharedModifierData *> ( cur->modifier.next.get() ), ++ful) {
|
||||||
ai_assert(cur->dna_type);
|
ai_assert(cur->dna_type);
|
||||||
|
|
||||||
const Structure* s = conv_data.db.dna.Get( cur->dna_type );
|
const Structure* s = conv_data.db.dna.Get( cur->dna_type );
|
||||||
|
@ -153,7 +151,7 @@ void BlenderModifierShowcase::ApplyModifiers(aiNode& out, ConversionData& conv_d
|
||||||
|
|
||||||
BlenderModifier* const modifier = *curmod;
|
BlenderModifier* const modifier = *curmod;
|
||||||
if(modifier->IsActive(dat)) {
|
if(modifier->IsActive(dat)) {
|
||||||
modifier->DoIt(out,conv_data,*boost::static_pointer_cast<const ElemBase>(cur),in,orig_object);
|
modifier->DoIt(out,conv_data,*static_cast<const ElemBase *>(cur),in,orig_object);
|
||||||
cnt++;
|
cnt++;
|
||||||
|
|
||||||
curgod = NULL;
|
curgod = NULL;
|
||||||
|
@ -312,11 +310,11 @@ void BlenderModifier_Subdivision :: DoIt(aiNode& out, ConversionData& conv_data
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
boost::scoped_ptr<Subdivider> subd(Subdivider::Create(algo));
|
std::unique_ptr<Subdivider> subd(Subdivider::Create(algo));
|
||||||
ai_assert(subd);
|
ai_assert(subd);
|
||||||
|
|
||||||
aiMesh** const meshes = &conv_data.meshes[conv_data.meshes->size() - out.mNumMeshes];
|
aiMesh** const meshes = &conv_data.meshes[conv_data.meshes->size() - out.mNumMeshes];
|
||||||
boost::scoped_array<aiMesh*> tempmeshes(new aiMesh*[out.mNumMeshes]());
|
std::unique_ptr<aiMesh*[]> tempmeshes(new aiMesh*[out.mNumMeshes]());
|
||||||
|
|
||||||
subd->Subdivide(meshes,out.mNumMeshes,tempmeshes.get(),std::max( mir.renderLevels, mir.levels ),true);
|
subd->Subdivide(meshes,out.mNumMeshes,tempmeshes.get(),std::max( mir.renderLevels, mir.levels ),true);
|
||||||
std::copy(tempmeshes.get(),tempmeshes.get()+out.mNumMeshes,meshes);
|
std::copy(tempmeshes.get(),tempmeshes.get()+out.mNumMeshes,meshes);
|
||||||
|
|
|
@ -64,7 +64,7 @@ template <> void Structure :: Convert<Object> (
|
||||||
ReadFieldArray2<ErrorPolicy_Warn>(dest.parentinv,"parentinv",db);
|
ReadFieldArray2<ErrorPolicy_Warn>(dest.parentinv,"parentinv",db);
|
||||||
ReadFieldArray<ErrorPolicy_Warn>(dest.parsubstr,"parsubstr",db);
|
ReadFieldArray<ErrorPolicy_Warn>(dest.parsubstr,"parsubstr",db);
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Object> parent;
|
std::shared_ptr<Object> parent;
|
||||||
ReadFieldPtr<ErrorPolicy_Warn>(parent,"*parent",db);
|
ReadFieldPtr<ErrorPolicy_Warn>(parent,"*parent",db);
|
||||||
dest.parent = parent.get();
|
dest.parent = parent.get();
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ template <> void Structure :: Convert<MTexPoly> (
|
||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Image> tpage;
|
std::shared_ptr<Image> tpage;
|
||||||
ReadFieldPtr<ErrorPolicy_Igno>(tpage,"*tpage",db);
|
ReadFieldPtr<ErrorPolicy_Igno>(tpage,"*tpage",db);
|
||||||
dest.tpage = tpage.get();
|
dest.tpage = tpage.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace Blender {
|
||||||
//
|
//
|
||||||
// * Pointers to other structures or primitive types are allowed.
|
// * Pointers to other structures or primitive types are allowed.
|
||||||
// No references or double pointers or arrays of pointers.
|
// No references or double pointers or arrays of pointers.
|
||||||
// A pointer to a T is normally written as boost::shared_ptr, while a
|
// A pointer to a T is normally written as std::shared_ptr, while a
|
||||||
// pointer to an array of elements is written as boost::
|
// pointer to an array of elements is written as boost::
|
||||||
// shared_array. To avoid cyclic pointers, use raw pointers in
|
// shared_array. To avoid cyclic pointers, use raw pointers in
|
||||||
// one direction.
|
// one direction.
|
||||||
|
@ -98,6 +98,8 @@ struct Object;
|
||||||
struct MTex;
|
struct MTex;
|
||||||
struct Image;
|
struct Image;
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#define AI_BLEND_MESH_MAX_VERTS 2000000000L
|
#define AI_BLEND_MESH_MAX_VERTS 2000000000L
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -110,8 +112,8 @@ struct ID : ElemBase {
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct ListBase : ElemBase {
|
struct ListBase : ElemBase {
|
||||||
|
|
||||||
boost::shared_ptr<ElemBase> first;
|
std::shared_ptr<ElemBase> first;
|
||||||
boost::shared_ptr<ElemBase> last;
|
std::shared_ptr<ElemBase> last;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,14 +121,14 @@ struct ListBase : ElemBase {
|
||||||
struct PackedFile : ElemBase {
|
struct PackedFile : ElemBase {
|
||||||
int size WARN;
|
int size WARN;
|
||||||
int seek WARN;
|
int seek WARN;
|
||||||
boost::shared_ptr< FileOffset > data WARN;
|
std::shared_ptr< FileOffset > data WARN;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct GroupObject : ElemBase {
|
struct GroupObject : ElemBase {
|
||||||
|
|
||||||
boost::shared_ptr<GroupObject> prev,next FAIL;
|
std::shared_ptr<GroupObject> prev,next FAIL;
|
||||||
boost::shared_ptr<Object> ob;
|
std::shared_ptr<Object> ob;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -134,7 +136,7 @@ struct Group : ElemBase {
|
||||||
ID id FAIL;
|
ID id FAIL;
|
||||||
int layer;
|
int layer;
|
||||||
|
|
||||||
boost::shared_ptr<GroupObject> gobject;
|
std::shared_ptr<GroupObject> gobject;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -222,7 +224,7 @@ struct MTFace : ElemBase {
|
||||||
short tile;
|
short tile;
|
||||||
short unwrap;
|
short unwrap;
|
||||||
|
|
||||||
// boost::shared_ptr<Image> tpage;
|
// std::shared_ptr<Image> tpage;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -259,12 +261,12 @@ struct Material : ElemBase {
|
||||||
float darkness;
|
float darkness;
|
||||||
float refrac;
|
float refrac;
|
||||||
|
|
||||||
boost::shared_ptr<Group> group;
|
std::shared_ptr<Group> group;
|
||||||
|
|
||||||
short diff_shader WARN;
|
short diff_shader WARN;
|
||||||
short spec_shader WARN;
|
short spec_shader WARN;
|
||||||
|
|
||||||
boost::shared_ptr<MTex> mtex[18];
|
std::shared_ptr<MTex> mtex[18];
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -295,7 +297,7 @@ struct Mesh : ElemBase {
|
||||||
vector<MDeformVert> dvert;
|
vector<MDeformVert> dvert;
|
||||||
vector<MCol> mcol;
|
vector<MCol> mcol;
|
||||||
|
|
||||||
vector< boost::shared_ptr<Material> > mat FAIL;
|
vector< std::shared_ptr<Material> > mat FAIL;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -304,7 +306,7 @@ struct Library : ElemBase {
|
||||||
|
|
||||||
char name[240] WARN;
|
char name[240] WARN;
|
||||||
char filename[240] FAIL;
|
char filename[240] FAIL;
|
||||||
boost::shared_ptr<Library> parent WARN;
|
std::shared_ptr<Library> parent WARN;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -444,8 +446,8 @@ struct ModifierData : ElemBase {
|
||||||
eModifierType_ShapeKey
|
eModifierType_ShapeKey
|
||||||
};
|
};
|
||||||
|
|
||||||
boost::shared_ptr<ElemBase> next WARN;
|
std::shared_ptr<ElemBase> next WARN;
|
||||||
boost::shared_ptr<ElemBase> prev WARN;
|
std::shared_ptr<ElemBase> prev WARN;
|
||||||
|
|
||||||
int type, mode;
|
int type, mode;
|
||||||
char name[32];
|
char name[32];
|
||||||
|
@ -489,7 +491,7 @@ struct MirrorModifierData : ElemBase {
|
||||||
|
|
||||||
short axis, flag;
|
short axis, flag;
|
||||||
float tolerance;
|
float tolerance;
|
||||||
boost::shared_ptr<Object> mirror_ob;
|
std::shared_ptr<Object> mirror_ob;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -517,11 +519,11 @@ struct Object : ElemBase {
|
||||||
char parsubstr[32] WARN;
|
char parsubstr[32] WARN;
|
||||||
|
|
||||||
Object* parent WARN;
|
Object* parent WARN;
|
||||||
boost::shared_ptr<Object> track WARN;
|
std::shared_ptr<Object> track WARN;
|
||||||
|
|
||||||
boost::shared_ptr<Object> proxy,proxy_from,proxy_group WARN;
|
std::shared_ptr<Object> proxy,proxy_from,proxy_group WARN;
|
||||||
boost::shared_ptr<Group> dup_group WARN;
|
std::shared_ptr<Group> dup_group WARN;
|
||||||
boost::shared_ptr<ElemBase> data FAIL;
|
std::shared_ptr<ElemBase> data FAIL;
|
||||||
|
|
||||||
ListBase modifiers;
|
ListBase modifiers;
|
||||||
};
|
};
|
||||||
|
@ -530,17 +532,17 @@ struct Object : ElemBase {
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct Base : ElemBase {
|
struct Base : ElemBase {
|
||||||
Base* prev WARN;
|
Base* prev WARN;
|
||||||
boost::shared_ptr<Base> next WARN;
|
std::shared_ptr<Base> next WARN;
|
||||||
boost::shared_ptr<Object> object WARN;
|
std::shared_ptr<Object> object WARN;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct Scene : ElemBase {
|
struct Scene : ElemBase {
|
||||||
ID id FAIL;
|
ID id FAIL;
|
||||||
|
|
||||||
boost::shared_ptr<Object> camera WARN;
|
std::shared_ptr<Object> camera WARN;
|
||||||
boost::shared_ptr<World> world WARN;
|
std::shared_ptr<World> world WARN;
|
||||||
boost::shared_ptr<Base> basact WARN;
|
std::shared_ptr<Base> basact WARN;
|
||||||
|
|
||||||
ListBase base;
|
ListBase base;
|
||||||
};
|
};
|
||||||
|
@ -564,7 +566,7 @@ struct Image : ElemBase {
|
||||||
//unsigned int bindcode;
|
//unsigned int bindcode;
|
||||||
//unsigned int *repbind;
|
//unsigned int *repbind;
|
||||||
|
|
||||||
boost::shared_ptr<PackedFile> packedfile;
|
std::shared_ptr<PackedFile> packedfile;
|
||||||
//struct PreviewImage * preview;
|
//struct PreviewImage * preview;
|
||||||
|
|
||||||
float lastupdate;
|
float lastupdate;
|
||||||
|
@ -650,7 +652,7 @@ struct Tex : ElemBase {
|
||||||
|
|
||||||
//bNodeTree *nodetree;
|
//bNodeTree *nodetree;
|
||||||
//Ipo *ipo;
|
//Ipo *ipo;
|
||||||
boost::shared_ptr<Image> ima WARN;
|
std::shared_ptr<Image> ima WARN;
|
||||||
//PluginTex *plugin;
|
//PluginTex *plugin;
|
||||||
//ColorBand *coba;
|
//ColorBand *coba;
|
||||||
//EnvMap *env;
|
//EnvMap *env;
|
||||||
|
@ -717,8 +719,8 @@ struct MTex : ElemBase {
|
||||||
MapType mapto;
|
MapType mapto;
|
||||||
|
|
||||||
BlendType blendtype;
|
BlendType blendtype;
|
||||||
boost::shared_ptr<Object> object;
|
std::shared_ptr<Object> object;
|
||||||
boost::shared_ptr<Tex> tex;
|
std::shared_ptr<Tex> tex;
|
||||||
char uvname[32];
|
char uvname[32];
|
||||||
|
|
||||||
Projection projx,projy,projz;
|
Projection projx,projy,projz;
|
||||||
|
|
|
@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "./../include/assimp/cexport.h"
|
#include "./../include/assimp/cexport.h"
|
||||||
#include "./../include/assimp/IOSystem.hpp"
|
#include "./../include/assimp/IOSystem.hpp"
|
||||||
#include "./../include/assimp/DefaultLogger.hpp"
|
#include "./../include/assimp/DefaultLogger.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -224,7 +223,7 @@ public:
|
||||||
|
|
||||||
virtual ~BlobIOSystem()
|
virtual ~BlobIOSystem()
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(BlobEntry& blobby, blobs) {
|
for(BlobEntry& blobby : blobs) {
|
||||||
delete blobby.second;
|
delete blobby.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,7 +242,7 @@ public:
|
||||||
{
|
{
|
||||||
// one must be the master
|
// one must be the master
|
||||||
aiExportDataBlob* master = NULL, *cur;
|
aiExportDataBlob* master = NULL, *cur;
|
||||||
BOOST_FOREACH(const BlobEntry& blobby, blobs) {
|
for(const BlobEntry& blobby : blobs) {
|
||||||
if (blobby.first == AI_BLOBIO_MAGIC) {
|
if (blobby.first == AI_BLOBIO_MAGIC) {
|
||||||
master = blobby.second;
|
master = blobby.second;
|
||||||
break;
|
break;
|
||||||
|
@ -257,7 +256,7 @@ public:
|
||||||
master->name.Set("");
|
master->name.Set("");
|
||||||
|
|
||||||
cur = master;
|
cur = master;
|
||||||
BOOST_FOREACH(const BlobEntry& blobby, blobs) {
|
for(const BlobEntry& blobby : blobs) {
|
||||||
if (blobby.second == master) {
|
if (blobby.second == master) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
// small replacement for boost::scoped_ptr
|
// small replacement for std::unique_ptr
|
||||||
template <class T>
|
template <class T>
|
||||||
class scoped_ptr
|
class scoped_ptr
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace boost {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------
|
// ------------------------------
|
||||||
// Small replacement for boost::shared_ptr, not threadsafe because no
|
// Small replacement for std::shared_ptr, not threadsafe because no
|
||||||
// atomic reference counter is in use.
|
// atomic reference counter is in use.
|
||||||
// ------------------------------
|
// ------------------------------
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
|
@ -131,7 +131,7 @@ void C4DImporter::SetupProperties(const Importer* /*pImp*/)
|
||||||
void C4DImporter::InternReadFile( const std::string& pFile,
|
void C4DImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
ThrowException("failed to open file " + pFile);
|
ThrowException("failed to open file " + pFile);
|
||||||
|
@ -161,7 +161,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
|
||||||
RecurseHierarchy(doc->GetFirstObject(), pScene->mRootNode);
|
RecurseHierarchy(doc->GetFirstObject(), pScene->mRootNode);
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
BOOST_FOREACH(aiMesh* mesh, meshes) {
|
for(aiMesh* mesh : meshes) {
|
||||||
delete mesh;
|
delete mesh;
|
||||||
}
|
}
|
||||||
BaseDocument::Free(doc);
|
BaseDocument::Free(doc);
|
||||||
|
@ -176,7 +176,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
|
||||||
|
|
||||||
// copy materials over, adding a default material if necessary
|
// copy materials over, adding a default material if necessary
|
||||||
unsigned int mat_count = static_cast<unsigned int>(materials.size());
|
unsigned int mat_count = static_cast<unsigned int>(materials.size());
|
||||||
BOOST_FOREACH(aiMesh* mesh, meshes) {
|
for(aiMesh* mesh : meshes) {
|
||||||
ai_assert(mesh->mMaterialIndex <= mat_count);
|
ai_assert(mesh->mMaterialIndex <= mat_count);
|
||||||
if(mesh->mMaterialIndex >= mat_count) {
|
if(mesh->mMaterialIndex >= mat_count) {
|
||||||
++mat_count;
|
++mat_count;
|
||||||
|
|
|
@ -53,8 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "LineSplitter.h"
|
#include "LineSplitter.h"
|
||||||
#include "TinyFormatter.h"
|
#include "TinyFormatter.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
@ -64,8 +63,6 @@ using namespace Assimp;
|
||||||
using namespace Assimp::COB;
|
using namespace Assimp::COB;
|
||||||
using namespace Assimp::Formatter;
|
using namespace Assimp::Formatter;
|
||||||
|
|
||||||
#define for_each BOOST_FOREACH
|
|
||||||
|
|
||||||
|
|
||||||
static const float units[] = {
|
static const float units[] = {
|
||||||
1000.f,
|
1000.f,
|
||||||
|
@ -144,7 +141,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
COB::Scene scene;
|
COB::Scene scene;
|
||||||
boost::scoped_ptr<StreamReaderLE> stream(new StreamReaderLE( pIOHandler->Open(pFile,"rb")) );
|
std::unique_ptr<StreamReaderLE> stream(new StreamReaderLE( pIOHandler->Open(pFile,"rb")) );
|
||||||
|
|
||||||
// check header
|
// check header
|
||||||
char head[32];
|
char head[32];
|
||||||
|
@ -170,17 +167,17 @@ void COBImporter::InternReadFile( const std::string& pFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort faces by material indices
|
// sort faces by material indices
|
||||||
for_each(boost::shared_ptr< Node >& n,scene.nodes) {
|
for(std::shared_ptr< Node >& n : scene.nodes) {
|
||||||
if (n->type == Node::TYPE_MESH) {
|
if (n->type == Node::TYPE_MESH) {
|
||||||
Mesh& mesh = (Mesh&)(*n.get());
|
Mesh& mesh = (Mesh&)(*n.get());
|
||||||
for_each(Face& f,mesh.faces) {
|
for(Face& f : mesh.faces) {
|
||||||
mesh.temp_map[f.material].push_back(&f);
|
mesh.temp_map[f.material].push_back(&f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// count meshes
|
// count meshes
|
||||||
for_each(boost::shared_ptr< Node >& n,scene.nodes) {
|
for(std::shared_ptr< Node >& n : scene.nodes) {
|
||||||
if (n->type == Node::TYPE_MESH) {
|
if (n->type == Node::TYPE_MESH) {
|
||||||
Mesh& mesh = (Mesh&)(*n.get());
|
Mesh& mesh = (Mesh&)(*n.get());
|
||||||
if (mesh.vertex_positions.size() && mesh.texture_coords.size()) {
|
if (mesh.vertex_positions.size() && mesh.texture_coords.size()) {
|
||||||
|
@ -193,7 +190,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
|
||||||
pScene->mNumMeshes = 0;
|
pScene->mNumMeshes = 0;
|
||||||
|
|
||||||
// count lights and cameras
|
// count lights and cameras
|
||||||
for_each(boost::shared_ptr< Node >& n,scene.nodes) {
|
for(std::shared_ptr< Node >& n : scene.nodes) {
|
||||||
if (n->type == Node::TYPE_LIGHT) {
|
if (n->type == Node::TYPE_LIGHT) {
|
||||||
++pScene->mNumLights;
|
++pScene->mNumLights;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +208,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
|
||||||
pScene->mNumLights = pScene->mNumCameras = 0;
|
pScene->mNumLights = pScene->mNumCameras = 0;
|
||||||
|
|
||||||
// resolve parents by their IDs and build the output graph
|
// resolve parents by their IDs and build the output graph
|
||||||
boost::scoped_ptr<Node> root(new Group());
|
std::unique_ptr<Node> root(new Group());
|
||||||
for(size_t n = 0; n < scene.nodes.size(); ++n) {
|
for(size_t n = 0; n < scene.nodes.size(); ++n) {
|
||||||
const Node& nn = *scene.nodes[n].get();
|
const Node& nn = *scene.nodes[n].get();
|
||||||
if(nn.parent_id==0) {
|
if(nn.parent_id==0) {
|
||||||
|
@ -230,7 +227,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ConvertTexture(boost::shared_ptr< Texture > tex, aiMaterial* out, aiTextureType type)
|
void ConvertTexture(std::shared_ptr< Texture > tex, aiMaterial* out, aiTextureType type)
|
||||||
{
|
{
|
||||||
const aiString path( tex->path );
|
const aiString path( tex->path );
|
||||||
out->AddProperty(&path,AI_MATKEY_TEXTURE(type,0));
|
out->AddProperty(&path,AI_MATKEY_TEXTURE(type,0));
|
||||||
|
@ -251,10 +248,10 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
|
||||||
if (ndmesh.vertex_positions.size() && ndmesh.texture_coords.size()) {
|
if (ndmesh.vertex_positions.size() && ndmesh.texture_coords.size()) {
|
||||||
|
|
||||||
typedef std::pair<unsigned int,Mesh::FaceRefList> Entry;
|
typedef std::pair<unsigned int,Mesh::FaceRefList> Entry;
|
||||||
for_each(const Entry& reflist,ndmesh.temp_map) {
|
for(const Entry& reflist : ndmesh.temp_map) {
|
||||||
{ // create mesh
|
{ // create mesh
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
for_each(Face* f, reflist.second) {
|
for(Face* f : reflist.second) {
|
||||||
n += f->indices.size();
|
n += f->indices.size();
|
||||||
}
|
}
|
||||||
if (!n) {
|
if (!n) {
|
||||||
|
@ -267,7 +264,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
|
||||||
outmesh->mTextureCoords[0] = new aiVector3D[n];
|
outmesh->mTextureCoords[0] = new aiVector3D[n];
|
||||||
|
|
||||||
outmesh->mFaces = new aiFace[reflist.second.size()]();
|
outmesh->mFaces = new aiFace[reflist.second.size()]();
|
||||||
for_each(Face* f, reflist.second) {
|
for(Face* f : reflist.second) {
|
||||||
if (f->indices.empty()) {
|
if (f->indices.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +272,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
|
||||||
aiFace& fout = outmesh->mFaces[outmesh->mNumFaces++];
|
aiFace& fout = outmesh->mFaces[outmesh->mNumFaces++];
|
||||||
fout.mIndices = new unsigned int[f->indices.size()];
|
fout.mIndices = new unsigned int[f->indices.size()];
|
||||||
|
|
||||||
for_each(VertexIndex& v, f->indices) {
|
for(VertexIndex& v : f->indices) {
|
||||||
if (v.pos_idx >= ndmesh.vertex_positions.size()) {
|
if (v.pos_idx >= ndmesh.vertex_positions.size()) {
|
||||||
ThrowException("Position index out of range");
|
ThrowException("Position index out of range");
|
||||||
}
|
}
|
||||||
|
@ -295,13 +292,13 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
|
||||||
outmesh->mMaterialIndex = fill->mNumMaterials;
|
outmesh->mMaterialIndex = fill->mNumMaterials;
|
||||||
}{ // create material
|
}{ // create material
|
||||||
const Material* min = NULL;
|
const Material* min = NULL;
|
||||||
for_each(const Material& m, scin.materials) {
|
for(const Material& m : scin.materials) {
|
||||||
if (m.parent_id == ndmesh.id && m.matnum == reflist.first) {
|
if (m.parent_id == ndmesh.id && m.matnum == reflist.first) {
|
||||||
min = &m;
|
min = &m;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boost::scoped_ptr<const Material> defmat;
|
std::unique_ptr<const Material> defmat;
|
||||||
if(!min) {
|
if(!min) {
|
||||||
DefaultLogger::get()->debug(format()<<"Could not resolve material index "
|
DefaultLogger::get()->debug(format()<<"Could not resolve material index "
|
||||||
<<reflist.first<<" - creating default material for this slot");
|
<<reflist.first<<" - creating default material for this slot");
|
||||||
|
@ -396,7 +393,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
|
||||||
|
|
||||||
// add children recursively
|
// add children recursively
|
||||||
nd->mChildren = new aiNode*[root.temp_children.size()]();
|
nd->mChildren = new aiNode*[root.temp_children.size()]();
|
||||||
for_each(const Node* n, root.temp_children) {
|
for(const Node* n : root.temp_children) {
|
||||||
(nd->mChildren[nd->mNumChildren++] = BuildNodes(*n,scin,fill))->mParent = nd;
|
(nd->mChildren[nd->mNumChildren++] = BuildNodes(*n,scin,fill))->mParent = nd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,7 +644,7 @@ void COBImporter::ReadUnit_Ascii(Scene& out, LineSplitter& splitter, const Chunk
|
||||||
|
|
||||||
// parent chunks preceede their childs, so we should have the
|
// parent chunks preceede their childs, so we should have the
|
||||||
// corresponding chunk already.
|
// corresponding chunk already.
|
||||||
for_each(boost::shared_ptr< Node >& nd, out.nodes) {
|
for(std::shared_ptr< Node >& nd : out.nodes) {
|
||||||
if (nd->id == nfo.parent_id) {
|
if (nd->id == nfo.parent_id) {
|
||||||
const unsigned int t=strtoul10(splitter[1]);
|
const unsigned int t=strtoul10(splitter[1]);
|
||||||
|
|
||||||
|
@ -676,7 +673,7 @@ void COBImporter::ReadLght_Ascii(Scene& out, LineSplitter& splitter, const Chunk
|
||||||
return UnsupportedChunk_Ascii(splitter,nfo,"Lght");
|
return UnsupportedChunk_Ascii(splitter,nfo,"Lght");
|
||||||
}
|
}
|
||||||
|
|
||||||
out.nodes.push_back(boost::shared_ptr<Light>(new Light()));
|
out.nodes.push_back(std::shared_ptr<Light>(new Light()));
|
||||||
Light& msh = (Light&)(*out.nodes.back().get());
|
Light& msh = (Light&)(*out.nodes.back().get());
|
||||||
msh = nfo;
|
msh = nfo;
|
||||||
|
|
||||||
|
@ -732,7 +729,7 @@ void COBImporter::ReadCame_Ascii(Scene& out, LineSplitter& splitter, const Chunk
|
||||||
return UnsupportedChunk_Ascii(splitter,nfo,"Came");
|
return UnsupportedChunk_Ascii(splitter,nfo,"Came");
|
||||||
}
|
}
|
||||||
|
|
||||||
out.nodes.push_back(boost::shared_ptr<Camera>(new Camera()));
|
out.nodes.push_back(std::shared_ptr<Camera>(new Camera()));
|
||||||
Camera& msh = (Camera&)(*out.nodes.back().get());
|
Camera& msh = (Camera&)(*out.nodes.back().get());
|
||||||
msh = nfo;
|
msh = nfo;
|
||||||
|
|
||||||
|
@ -750,7 +747,7 @@ void COBImporter::ReadBone_Ascii(Scene& out, LineSplitter& splitter, const Chunk
|
||||||
return UnsupportedChunk_Ascii(splitter,nfo,"Bone");
|
return UnsupportedChunk_Ascii(splitter,nfo,"Bone");
|
||||||
}
|
}
|
||||||
|
|
||||||
out.nodes.push_back(boost::shared_ptr<Bone>(new Bone()));
|
out.nodes.push_back(std::shared_ptr<Bone>(new Bone()));
|
||||||
Bone& msh = (Bone&)(*out.nodes.back().get());
|
Bone& msh = (Bone&)(*out.nodes.back().get());
|
||||||
msh = nfo;
|
msh = nfo;
|
||||||
|
|
||||||
|
@ -766,7 +763,7 @@ void COBImporter::ReadGrou_Ascii(Scene& out, LineSplitter& splitter, const Chunk
|
||||||
return UnsupportedChunk_Ascii(splitter,nfo,"Grou");
|
return UnsupportedChunk_Ascii(splitter,nfo,"Grou");
|
||||||
}
|
}
|
||||||
|
|
||||||
out.nodes.push_back(boost::shared_ptr<Group>(new Group()));
|
out.nodes.push_back(std::shared_ptr<Group>(new Group()));
|
||||||
Group& msh = (Group&)(*out.nodes.back().get());
|
Group& msh = (Group&)(*out.nodes.back().get());
|
||||||
msh = nfo;
|
msh = nfo;
|
||||||
|
|
||||||
|
@ -780,7 +777,7 @@ void COBImporter::ReadPolH_Ascii(Scene& out, LineSplitter& splitter, const Chunk
|
||||||
return UnsupportedChunk_Ascii(splitter,nfo,"PolH");
|
return UnsupportedChunk_Ascii(splitter,nfo,"PolH");
|
||||||
}
|
}
|
||||||
|
|
||||||
out.nodes.push_back(boost::shared_ptr<Mesh>(new Mesh()));
|
out.nodes.push_back(std::shared_ptr<Mesh>(new Mesh()));
|
||||||
Mesh& msh = (Mesh&)(*out.nodes.back().get());
|
Mesh& msh = (Mesh&)(*out.nodes.back().get());
|
||||||
msh = nfo;
|
msh = nfo;
|
||||||
|
|
||||||
|
@ -903,7 +900,7 @@ void COBImporter::ReadBitM_Ascii(Scene& /*out*/, LineSplitter& splitter, const C
|
||||||
void COBImporter::ReadString_Binary(std::string& out, StreamReaderLE& reader)
|
void COBImporter::ReadString_Binary(std::string& out, StreamReaderLE& reader)
|
||||||
{
|
{
|
||||||
out.resize( reader.GetI2());
|
out.resize( reader.GetI2());
|
||||||
for_each(char& c,out) {
|
for(char& c : out) {
|
||||||
c = reader.GetI1();
|
c = reader.GetI1();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1036,21 +1033,21 @@ void COBImporter::ReadPolH_Binary(COB::Scene& out, StreamReaderLE& reader, const
|
||||||
}
|
}
|
||||||
const chunk_guard cn(nfo,reader);
|
const chunk_guard cn(nfo,reader);
|
||||||
|
|
||||||
out.nodes.push_back(boost::shared_ptr<Mesh>(new Mesh()));
|
out.nodes.push_back(std::shared_ptr<Mesh>(new Mesh()));
|
||||||
Mesh& msh = (Mesh&)(*out.nodes.back().get());
|
Mesh& msh = (Mesh&)(*out.nodes.back().get());
|
||||||
msh = nfo;
|
msh = nfo;
|
||||||
|
|
||||||
ReadBasicNodeInfo_Binary(msh,reader,nfo);
|
ReadBasicNodeInfo_Binary(msh,reader,nfo);
|
||||||
|
|
||||||
msh.vertex_positions.resize(reader.GetI4());
|
msh.vertex_positions.resize(reader.GetI4());
|
||||||
for_each(aiVector3D& v,msh.vertex_positions) {
|
for(aiVector3D& v : msh.vertex_positions) {
|
||||||
v.x = reader.GetF4();
|
v.x = reader.GetF4();
|
||||||
v.y = reader.GetF4();
|
v.y = reader.GetF4();
|
||||||
v.z = reader.GetF4();
|
v.z = reader.GetF4();
|
||||||
}
|
}
|
||||||
|
|
||||||
msh.texture_coords.resize(reader.GetI4());
|
msh.texture_coords.resize(reader.GetI4());
|
||||||
for_each(aiVector2D& v,msh.texture_coords) {
|
for(aiVector2D& v : msh.texture_coords) {
|
||||||
v.x = reader.GetF4();
|
v.x = reader.GetF4();
|
||||||
v.y = reader.GetF4();
|
v.y = reader.GetF4();
|
||||||
}
|
}
|
||||||
|
@ -1226,7 +1223,7 @@ void COBImporter::ReadCame_Binary(COB::Scene& out, StreamReaderLE& reader, const
|
||||||
|
|
||||||
const chunk_guard cn(nfo,reader);
|
const chunk_guard cn(nfo,reader);
|
||||||
|
|
||||||
out.nodes.push_back(boost::shared_ptr<Camera>(new Camera()));
|
out.nodes.push_back(std::shared_ptr<Camera>(new Camera()));
|
||||||
Camera& msh = (Camera&)(*out.nodes.back().get());
|
Camera& msh = (Camera&)(*out.nodes.back().get());
|
||||||
msh = nfo;
|
msh = nfo;
|
||||||
|
|
||||||
|
@ -1249,7 +1246,7 @@ void COBImporter::ReadLght_Binary(COB::Scene& out, StreamReaderLE& reader, const
|
||||||
|
|
||||||
const chunk_guard cn(nfo,reader);
|
const chunk_guard cn(nfo,reader);
|
||||||
|
|
||||||
out.nodes.push_back(boost::shared_ptr<Light>(new Light()));
|
out.nodes.push_back(std::shared_ptr<Light>(new Light()));
|
||||||
Light& msh = (Light&)(*out.nodes.back().get());
|
Light& msh = (Light&)(*out.nodes.back().get());
|
||||||
msh = nfo;
|
msh = nfo;
|
||||||
|
|
||||||
|
@ -1265,7 +1262,7 @@ void COBImporter::ReadGrou_Binary(COB::Scene& out, StreamReaderLE& reader, const
|
||||||
|
|
||||||
const chunk_guard cn(nfo,reader);
|
const chunk_guard cn(nfo,reader);
|
||||||
|
|
||||||
out.nodes.push_back(boost::shared_ptr<Group>(new Group()));
|
out.nodes.push_back(std::shared_ptr<Group>(new Group()));
|
||||||
Group& msh = (Group&)(*out.nodes.back().get());
|
Group& msh = (Group&)(*out.nodes.back().get());
|
||||||
msh = nfo;
|
msh = nfo;
|
||||||
|
|
||||||
|
@ -1283,7 +1280,7 @@ void COBImporter::ReadUnit_Binary(COB::Scene& out, StreamReaderLE& reader, const
|
||||||
|
|
||||||
// parent chunks preceede their childs, so we should have the
|
// parent chunks preceede their childs, so we should have the
|
||||||
// corresponding chunk already.
|
// corresponding chunk already.
|
||||||
for_each(boost::shared_ptr< Node >& nd, out.nodes) {
|
for(std::shared_ptr< Node >& nd : out.nodes) {
|
||||||
if (nd->id == nfo.parent_id) {
|
if (nd->id == nfo.parent_id) {
|
||||||
const unsigned int t=reader.GetI2();
|
const unsigned int t=reader.GetI2();
|
||||||
nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?(
|
nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?(
|
||||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_COB_SCENE_H
|
#ifndef INCLUDED_AI_COB_SCENE_H
|
||||||
#define INCLUDED_AI_COB_SCENE_H
|
#define INCLUDED_AI_COB_SCENE_H
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include "BaseImporter.h"
|
||||||
|
@ -237,7 +237,7 @@ struct Material : ChunkInfo
|
||||||
AutoFacet autofacet;
|
AutoFacet autofacet;
|
||||||
float autofacet_angle;
|
float autofacet_angle;
|
||||||
|
|
||||||
boost::shared_ptr<Texture> tex_env,tex_bump,tex_color;
|
std::shared_ptr<Texture> tex_env,tex_bump,tex_color;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ------------------
|
// ------------------
|
||||||
|
@ -254,7 +254,7 @@ struct Bitmap : ChunkInfo
|
||||||
std::vector<char> buff_zipped;
|
std::vector<char> buff_zipped;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::deque< boost::shared_ptr<Node> > NodeList;
|
typedef std::deque< std::shared_ptr<Node> > NodeList;
|
||||||
typedef std::vector< Material > MaterialList;
|
typedef std::vector< Material > MaterialList;
|
||||||
|
|
||||||
// ------------------
|
// ------------------
|
||||||
|
|
|
@ -52,7 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "ParsingUtils.h"
|
#include "ParsingUtils.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/anim.h"
|
#include "../include/assimp/anim.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
|
@ -122,7 +122,7 @@ void CSMImporter::SetupProperties(const Importer* pImp)
|
||||||
void CSMImporter::InternReadFile( const std::string& pFile,
|
void CSMImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "Exceptional.h"
|
#include "Exceptional.h"
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ void ExportSceneCollada(const char* pFile, IOSystem* pIOSystem, const aiScene* p
|
||||||
ColladaExporter iDoTheExportThing( pScene, pIOSystem, path, file);
|
ColladaExporter iDoTheExportThing( pScene, pIOSystem, path, file);
|
||||||
|
|
||||||
// we're still here - export successfully completed. Write result to the given IOSYstem
|
// we're still here - export successfully completed. Write result to the given IOSYstem
|
||||||
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
||||||
if(outfile == NULL) {
|
if(outfile == NULL) {
|
||||||
throw DeadlyExportError("could not open output .dae file: " + std::string(pFile));
|
throw DeadlyExportError("could not open output .dae file: " + std::string(pFile));
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ void ColladaExporter::WriteTextures() {
|
||||||
|
|
||||||
std::string name = mFile + "_texture_" + (i < 1000 ? "0" : "") + (i < 100 ? "0" : "") + (i < 10 ? "0" : "") + str + "." + ((const char*) texture->achFormatHint);
|
std::string name = mFile + "_texture_" + (i < 1000 ? "0" : "") + (i < 100 ? "0" : "") + (i < 10 ? "0" : "") + str + "." + ((const char*) texture->achFormatHint);
|
||||||
|
|
||||||
boost::scoped_ptr<IOStream> outfile(mIOSystem->Open(mPath + name, "wb"));
|
std::unique_ptr<IOStream> outfile(mIOSystem->Open(mPath + name, "wb"));
|
||||||
if(outfile == NULL) {
|
if(outfile == NULL) {
|
||||||
throw DeadlyExportError("could not open output texture file: " + mPath + name);
|
throw DeadlyExportError("could not open output texture file: " + mPath + name);
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,7 @@ void ColladaExporter::WriteMaterials()
|
||||||
aiString name;
|
aiString name;
|
||||||
if( mat->Get( AI_MATKEY_NAME, name) != aiReturn_SUCCESS )
|
if( mat->Get( AI_MATKEY_NAME, name) != aiReturn_SUCCESS )
|
||||||
name = "mat";
|
name = "mat";
|
||||||
materials[a].name = std::string( "m") + boost::lexical_cast<std::string> (a) + name.C_Str();
|
materials[a].name = std::string( "m") + std::to_string(a) + name.C_Str();
|
||||||
for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) {
|
for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) {
|
||||||
if( !isalnum_C( *it ) ) {
|
if( !isalnum_C( *it ) ) {
|
||||||
*it = '_';
|
*it = '_';
|
||||||
|
@ -812,7 +812,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
|
||||||
{
|
{
|
||||||
if( mesh->HasTextureCoords( a) )
|
if( mesh->HasTextureCoords( a) )
|
||||||
{
|
{
|
||||||
WriteFloatArray( idstr + "-tex" + boost::lexical_cast<std::string> (a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2,
|
WriteFloatArray( idstr + "-tex" + std::to_string(a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2,
|
||||||
(float*) mesh->mTextureCoords[a], mesh->mNumVertices);
|
(float*) mesh->mTextureCoords[a], mesh->mNumVertices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -821,7 +821,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
|
||||||
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a)
|
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a)
|
||||||
{
|
{
|
||||||
if( mesh->HasVertexColors( a) )
|
if( mesh->HasVertexColors( a) )
|
||||||
WriteFloatArray( idstr + "-color" + boost::lexical_cast<std::string> (a), FloatType_Color, (float*) mesh->mColors[a], mesh->mNumVertices);
|
WriteFloatArray( idstr + "-color" + std::to_string(a), FloatType_Color, (float*) mesh->mColors[a], mesh->mNumVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
// assemble vertex structure
|
// assemble vertex structure
|
||||||
|
|
|
@ -52,7 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
|
|
||||||
struct aiScene;
|
struct aiScene;
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
@ -123,7 +122,7 @@ protected:
|
||||||
void PopTag() { ai_assert( startstr.length() > 1); startstr.erase( startstr.length() - 2); }
|
void PopTag() { ai_assert( startstr.length() > 1); startstr.erase( startstr.length() - 2); }
|
||||||
|
|
||||||
/// Creates a mesh ID for the given mesh
|
/// Creates a mesh ID for the given mesh
|
||||||
std::string GetMeshId( size_t pIndex) const { return std::string( "meshId" ) + boost::lexical_cast<std::string> (pIndex); }
|
std::string GetMeshId( size_t pIndex) const { return std::string( "meshId" ) + std::to_string(pIndex); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Stringstream to write all output into
|
/// Stringstream to write all output into
|
||||||
|
|
|
@ -56,7 +56,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
@ -64,6 +63,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
using namespace Assimp::Formatter;
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static const aiImporterDesc desc = {
|
||||||
"Collada Importer",
|
"Collada Importer",
|
||||||
|
@ -317,7 +317,7 @@ void ColladaLoader::ApplyVertexToEffectSemanticMapping(Collada::Sampler& sampler
|
||||||
// Builds lights for the given node and references them
|
// Builds lights for the given node and references them
|
||||||
void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Collada::Node* pNode, aiNode* pTarget)
|
void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Collada::Node* pNode, aiNode* pTarget)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH( const Collada::LightInstance& lid, pNode->mLights)
|
for( const Collada::LightInstance& lid : pNode->mLights)
|
||||||
{
|
{
|
||||||
// find the referred light
|
// find the referred light
|
||||||
ColladaParser::LightLibrary::const_iterator srcLightIt = pParser.mLightLibrary.find( lid.mLight);
|
ColladaParser::LightLibrary::const_iterator srcLightIt = pParser.mLightLibrary.find( lid.mLight);
|
||||||
|
@ -385,7 +385,7 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
|
||||||
// Builds cameras for the given node and references them
|
// Builds cameras for the given node and references them
|
||||||
void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Collada::Node* pNode, aiNode* pTarget)
|
void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Collada::Node* pNode, aiNode* pTarget)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH( const Collada::CameraInstance& cid, pNode->mCameras)
|
for( const Collada::CameraInstance& cid : pNode->mCameras)
|
||||||
{
|
{
|
||||||
// find the referred light
|
// find the referred light
|
||||||
ColladaParser::CameraLibrary::const_iterator srcCameraIt = pParser.mCameraLibrary.find( cid.mCamera);
|
ColladaParser::CameraLibrary::const_iterator srcCameraIt = pParser.mCameraLibrary.find( cid.mCamera);
|
||||||
|
@ -447,7 +447,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
|
||||||
newMeshRefs.reserve(pNode->mMeshes.size());
|
newMeshRefs.reserve(pNode->mMeshes.size());
|
||||||
|
|
||||||
// add a mesh for each subgroup in each collada mesh
|
// add a mesh for each subgroup in each collada mesh
|
||||||
BOOST_FOREACH( const Collada::MeshInstance& mid, pNode->mMeshes)
|
for( const Collada::MeshInstance& mid : pNode->mMeshes)
|
||||||
{
|
{
|
||||||
const Collada::Mesh* srcMesh = NULL;
|
const Collada::Mesh* srcMesh = NULL;
|
||||||
const Collada::Controller* srcController = NULL;
|
const Collada::Controller* srcController = NULL;
|
||||||
|
@ -468,7 +468,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
|
||||||
|
|
||||||
if( !srcMesh)
|
if( !srcMesh)
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->warn( boost::str( boost::format( "Collada: Unable to find geometry for ID \"%s\". Skipping.") % mid.mMeshOrController));
|
DefaultLogger::get()->warn( format() << "Collada: Unable to find geometry for ID \"" << mid.mMeshOrController << "\". Skipping." );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -497,7 +497,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->warn( boost::str( boost::format( "Collada: No material specified for subgroup <%s> in geometry <%s>.") % submesh.mMaterial % mid.mMeshOrController));
|
DefaultLogger::get()->warn( format() << "Collada: No material specified for subgroup <" << submesh.mMaterial << "> in geometry <" << mid.mMeshOrController << ">." );
|
||||||
if( !mid.mMaterials.empty() )
|
if( !mid.mMaterials.empty() )
|
||||||
meshMaterial = mid.mMaterials.begin()->second.mMatName;
|
meshMaterial = mid.mMaterials.begin()->second.mMatName;
|
||||||
}
|
}
|
||||||
|
@ -785,7 +785,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
|
||||||
if( bnode)
|
if( bnode)
|
||||||
bone->mName.Set( FindNameForNode( bnode));
|
bone->mName.Set( FindNameForNode( bnode));
|
||||||
else
|
else
|
||||||
DefaultLogger::get()->warn( boost::str( boost::format( "ColladaLoader::CreateMesh(): could not find corresponding node for joint \"%s\".") % bone->mName.data));
|
DefaultLogger::get()->warn( format() << "ColladaLoader::CreateMesh(): could not find corresponding node for joint \"" << bone->mName.data << "\"." );
|
||||||
|
|
||||||
// and insert bone
|
// and insert bone
|
||||||
dstMesh->mBones[boneCount++] = bone;
|
dstMesh->mBones[boneCount++] = bone;
|
||||||
|
@ -1005,7 +1005,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
else if( subElement == "Z")
|
else if( subElement == "Z")
|
||||||
entry.mSubElement = 2;
|
entry.mSubElement = 2;
|
||||||
else
|
else
|
||||||
DefaultLogger::get()->warn( boost::str( boost::format( "Unknown anim subelement <%s>. Ignoring") % subElement));
|
DefaultLogger::get()->warn( format() << "Unknown anim subelement <" << subElement << ">. Ignoring" );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// no subelement following, transformId is remaining string
|
// no subelement following, transformId is remaining string
|
||||||
|
@ -1083,7 +1083,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
|
|
||||||
// time count and value count must match
|
// time count and value count must match
|
||||||
if( e.mTimeAccessor->mCount != e.mValueAccessor->mCount)
|
if( e.mTimeAccessor->mCount != e.mValueAccessor->mCount)
|
||||||
throw DeadlyImportError( boost::str( boost::format( "Time count / value count mismatch in animation channel \"%s\".") % e.mChannel->mTarget));
|
throw DeadlyImportError( format() << "Time count / value count mismatch in animation channel \"" << e.mChannel->mTarget << "\"." );
|
||||||
|
|
||||||
if( e.mTimeAccessor->mCount > 0 )
|
if( e.mTimeAccessor->mCount > 0 )
|
||||||
{
|
{
|
||||||
|
@ -1499,8 +1499,8 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars
|
||||||
ColladaParser::ImageLibrary::const_iterator imIt = pParser.mImageLibrary.find( name);
|
ColladaParser::ImageLibrary::const_iterator imIt = pParser.mImageLibrary.find( name);
|
||||||
if( imIt == pParser.mImageLibrary.end())
|
if( imIt == pParser.mImageLibrary.end())
|
||||||
{
|
{
|
||||||
throw DeadlyImportError( boost::str( boost::format(
|
throw DeadlyImportError( format() <<
|
||||||
"Collada: Unable to resolve effect texture entry \"%s\", ended up at ID \"%s\".") % pName % name));
|
"Collada: Unable to resolve effect texture entry \"" << pName << "\", ended up at ID \"" << name << "\"." );
|
||||||
}
|
}
|
||||||
|
|
||||||
aiString result;
|
aiString result;
|
||||||
|
@ -1666,7 +1666,7 @@ std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode)
|
||||||
{
|
{
|
||||||
// No need to worry. Unnamed nodes are no problem at all, except
|
// No need to worry. Unnamed nodes are no problem at all, except
|
||||||
// if cameras or lights need to be assigned to them.
|
// if cameras or lights need to be assigned to them.
|
||||||
return boost::str( boost::format( "$ColladaAutoName$_%d") % mNodeNameCounter++);
|
return format() << "$ColladaAutoName$_" << mNodeNameCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,15 +51,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "ColladaParser.h"
|
#include "ColladaParser.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include "ParsingUtils.h"
|
#include "ParsingUtils.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/light.h"
|
#include "../include/assimp/light.h"
|
||||||
|
#include "TinyFormatter.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
using namespace Assimp::Collada;
|
using namespace Assimp::Collada;
|
||||||
|
using namespace Assimp::Formatter;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
|
@ -88,13 +89,13 @@ ColladaParser::ColladaParser( IOSystem* pIOHandler, const std::string& pFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
// open the file
|
// open the file
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open(pFile ) );
|
std::unique_ptr<IOStream> file( pIOHandler->Open(pFile ) );
|
||||||
if (file.get() == NULL) {
|
if (file.get() == NULL) {
|
||||||
throw DeadlyImportError( "Failed to open file " + pFile + "." );
|
throw DeadlyImportError( "Failed to open file " + pFile + "." );
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate a XML reader for it
|
// generate a XML reader for it
|
||||||
boost::scoped_ptr<CIrrXML_IOStreamReader> mIOWrapper(new CIrrXML_IOStreamReader(file.get()));
|
std::unique_ptr<CIrrXML_IOStreamReader> mIOWrapper(new CIrrXML_IOStreamReader(file.get()));
|
||||||
mReader = irr::io::createIrrXMLReader( mIOWrapper.get());
|
mReader = irr::io::createIrrXMLReader( mIOWrapper.get());
|
||||||
if (!mReader) {
|
if (!mReader) {
|
||||||
ThrowException("Collada: Unable to open file.");
|
ThrowException("Collada: Unable to open file.");
|
||||||
|
@ -164,7 +165,7 @@ void ColladaParser::ReadContents()
|
||||||
ReadStructure();
|
ReadStructure();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->debug( boost::str( boost::format( "Ignoring global element <%s>.") % mReader->getNodeName()));
|
DefaultLogger::get()->debug( format() << "Ignoring global element <" << mReader->getNodeName() << ">." );
|
||||||
SkipElement();
|
SkipElement();
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -725,7 +726,7 @@ void ColladaParser::ReadControllerJoints( Collada::Controller& pController)
|
||||||
|
|
||||||
// local URLS always start with a '#'. We don't support global URLs
|
// local URLS always start with a '#'. We don't support global URLs
|
||||||
if( attrSource[0] != '#')
|
if( attrSource[0] != '#')
|
||||||
ThrowException( boost::str( boost::format( "Unsupported URL format in \"%s\" in source attribute of <joints> data <input> element") % attrSource));
|
ThrowException( format() << "Unsupported URL format in \"" << attrSource << "\" in source attribute of <joints> data <input> element" );
|
||||||
attrSource++;
|
attrSource++;
|
||||||
|
|
||||||
// parse source URL to corresponding source
|
// parse source URL to corresponding source
|
||||||
|
@ -734,7 +735,7 @@ void ColladaParser::ReadControllerJoints( Collada::Controller& pController)
|
||||||
else if( strcmp( attrSemantic, "INV_BIND_MATRIX") == 0)
|
else if( strcmp( attrSemantic, "INV_BIND_MATRIX") == 0)
|
||||||
pController.mJointOffsetMatrixSource = attrSource;
|
pController.mJointOffsetMatrixSource = attrSource;
|
||||||
else
|
else
|
||||||
ThrowException( boost::str( boost::format( "Unknown semantic \"%s\" in <joints> data <input> element") % attrSemantic));
|
ThrowException( format() << "Unknown semantic \"" << attrSemantic << "\" in <joints> data <input> element" );
|
||||||
|
|
||||||
// skip inner data, if present
|
// skip inner data, if present
|
||||||
if( !mReader->isEmptyElement())
|
if( !mReader->isEmptyElement())
|
||||||
|
@ -784,7 +785,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
|
||||||
|
|
||||||
// local URLS always start with a '#'. We don't support global URLs
|
// local URLS always start with a '#'. We don't support global URLs
|
||||||
if( attrSource[0] != '#')
|
if( attrSource[0] != '#')
|
||||||
ThrowException( boost::str( boost::format( "Unsupported URL format in \"%s\" in source attribute of <vertex_weights> data <input> element") % attrSource));
|
ThrowException( format() << "Unsupported URL format in \"" << attrSource << "\" in source attribute of <vertex_weights> data <input> element" );
|
||||||
channel.mAccessor = attrSource + 1;
|
channel.mAccessor = attrSource + 1;
|
||||||
|
|
||||||
// parse source URL to corresponding source
|
// parse source URL to corresponding source
|
||||||
|
@ -793,7 +794,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
|
||||||
else if( strcmp( attrSemantic, "WEIGHT") == 0)
|
else if( strcmp( attrSemantic, "WEIGHT") == 0)
|
||||||
pController.mWeightInputWeights = channel;
|
pController.mWeightInputWeights = channel;
|
||||||
else
|
else
|
||||||
ThrowException( boost::str( boost::format( "Unknown semantic \"%s\" in <vertex_weights> data <input> element") % attrSemantic));
|
ThrowException( format() << "Unknown semantic \"" << attrSemantic << "\" in <vertex_weights> data <input> element" );
|
||||||
|
|
||||||
// skip inner data, if present
|
// skip inner data, if present
|
||||||
if( !mReader->isEmptyElement())
|
if( !mReader->isEmptyElement())
|
||||||
|
@ -1963,7 +1964,7 @@ void ColladaParser::ReadAccessor( const std::string& pID)
|
||||||
int attrSource = GetAttribute( "source");
|
int attrSource = GetAttribute( "source");
|
||||||
const char* source = mReader->getAttributeValue( attrSource);
|
const char* source = mReader->getAttributeValue( attrSource);
|
||||||
if( source[0] != '#')
|
if( source[0] != '#')
|
||||||
ThrowException( boost::str( boost::format( "Unknown reference format in url \"%s\" in source attribute of <accessor> element.") % source));
|
ThrowException( format() << "Unknown reference format in url \"" << source << "\" in source attribute of <accessor> element." );
|
||||||
int attrCount = GetAttribute( "count");
|
int attrCount = GetAttribute( "count");
|
||||||
unsigned int count = (unsigned int) mReader->getAttributeValueAsInt( attrCount);
|
unsigned int count = (unsigned int) mReader->getAttributeValueAsInt( attrCount);
|
||||||
int attrOffset = TestAttribute( "offset");
|
int attrOffset = TestAttribute( "offset");
|
||||||
|
@ -2022,7 +2023,7 @@ void ColladaParser::ReadAccessor( const std::string& pID)
|
||||||
else if( name == "U") acc.mSubOffset[0] = acc.mParams.size();
|
else if( name == "U") acc.mSubOffset[0] = acc.mParams.size();
|
||||||
else if( name == "V") acc.mSubOffset[1] = acc.mParams.size();
|
else if( name == "V") acc.mSubOffset[1] = acc.mParams.size();
|
||||||
//else
|
//else
|
||||||
// DefaultLogger::get()->warn( boost::str( boost::format( "Unknown accessor parameter \"%s\". Ignoring data channel.") % name));
|
// DefaultLogger::get()->warn( format() << "Unknown accessor parameter \"" << name << "\". Ignoring data channel." );
|
||||||
}
|
}
|
||||||
|
|
||||||
// read data type
|
// read data type
|
||||||
|
@ -2045,7 +2046,7 @@ void ColladaParser::ReadAccessor( const std::string& pID)
|
||||||
SkipElement();
|
SkipElement();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <accessor>") % mReader->getNodeName()));
|
ThrowException( format() << "Unexpected sub element <" << mReader->getNodeName() << "> in tag <accessor>" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
|
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
|
||||||
|
@ -2075,7 +2076,7 @@ void ColladaParser::ReadVertexData( Mesh* pMesh)
|
||||||
ReadInputChannel( pMesh->mPerVertexData);
|
ReadInputChannel( pMesh->mPerVertexData);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <vertices>") % mReader->getNodeName()));
|
ThrowException( format() << "Unexpected sub element <" << mReader->getNodeName() << "> in tag <vertices>" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
|
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
|
||||||
|
@ -2173,13 +2174,13 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
|
||||||
SkipElement("extra");
|
SkipElement("extra");
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <%s>") % mReader->getNodeName() % elementName));
|
ThrowException( format() << "Unexpected sub element <" << mReader->getNodeName() << "> in tag <" << elementName << ">" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
|
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
|
||||||
{
|
{
|
||||||
if( mReader->getNodeName() != elementName)
|
if( mReader->getNodeName() != elementName)
|
||||||
ThrowException( boost::str( boost::format( "Expected end of <%s> element.") % elementName));
|
ThrowException( format() << "Expected end of <" << elementName << "> element." );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2212,7 +2213,7 @@ void ColladaParser::ReadInputChannel( std::vector<InputChannel>& poChannels)
|
||||||
int attrSource = GetAttribute( "source");
|
int attrSource = GetAttribute( "source");
|
||||||
const char* source = mReader->getAttributeValue( attrSource);
|
const char* source = mReader->getAttributeValue( attrSource);
|
||||||
if( source[0] != '#')
|
if( source[0] != '#')
|
||||||
ThrowException( boost::str( boost::format( "Unknown reference format in url \"%s\" in source attribute of <input> element.") % source));
|
ThrowException( format() << "Unknown reference format in url \"" << source << "\" in source attribute of <input> element." );
|
||||||
channel.mAccessor = source+1; // skipping the leading #, hopefully the remaining text is the accessor ID only
|
channel.mAccessor = source+1; // skipping the leading #, hopefully the remaining text is the accessor ID only
|
||||||
|
|
||||||
// read index offset, if per-index <input>
|
// read index offset, if per-index <input>
|
||||||
|
@ -2226,7 +2227,7 @@ void ColladaParser::ReadInputChannel( std::vector<InputChannel>& poChannels)
|
||||||
if(attrSet > -1){
|
if(attrSet > -1){
|
||||||
attrSet = mReader->getAttributeValueAsInt( attrSet);
|
attrSet = mReader->getAttributeValueAsInt( attrSet);
|
||||||
if(attrSet < 0)
|
if(attrSet < 0)
|
||||||
ThrowException( boost::str( boost::format( "Invalid index \"%i\" in set attribute of <input> element") % (attrSet)));
|
ThrowException( format() << "Invalid index \"" << (attrSet) << "\" in set attribute of <input> element" );
|
||||||
|
|
||||||
channel.mIndex = attrSet;
|
channel.mIndex = attrSet;
|
||||||
}
|
}
|
||||||
|
@ -2249,7 +2250,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
||||||
// find the offset index for all per-vertex channels
|
// find the offset index for all per-vertex channels
|
||||||
size_t numOffsets = 1;
|
size_t numOffsets = 1;
|
||||||
size_t perVertexOffset = SIZE_MAX; // invalid value
|
size_t perVertexOffset = SIZE_MAX; // invalid value
|
||||||
BOOST_FOREACH( const InputChannel& channel, pPerIndexChannels)
|
for( const InputChannel& channel : pPerIndexChannels)
|
||||||
{
|
{
|
||||||
numOffsets = std::max( numOffsets, channel.mOffset+1);
|
numOffsets = std::max( numOffsets, channel.mOffset+1);
|
||||||
if( channel.mType == IT_Vertex)
|
if( channel.mType == IT_Vertex)
|
||||||
|
@ -2262,7 +2263,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
||||||
{
|
{
|
||||||
case Prim_Polylist:
|
case Prim_Polylist:
|
||||||
{
|
{
|
||||||
BOOST_FOREACH( size_t i, pVCount)
|
for( size_t i : pVCount)
|
||||||
expectedPointCount += i;
|
expectedPointCount += i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2450,7 +2451,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
|
||||||
|
|
||||||
const Accessor& acc = *pInput.mResolved;
|
const Accessor& acc = *pInput.mResolved;
|
||||||
if( pLocalIndex >= acc.mCount)
|
if( pLocalIndex >= acc.mCount)
|
||||||
ThrowException( boost::str( boost::format( "Invalid data index (%d/%d) in primitive specification") % pLocalIndex % acc.mCount));
|
ThrowException( format() << "Invalid data index (" << pLocalIndex << "/" << acc.mCount << ") in primitive specification" );
|
||||||
|
|
||||||
// get a pointer to the start of the data object referred to by the accessor and the local index
|
// get a pointer to the start of the data object referred to by the accessor and the local index
|
||||||
const float* dataObject = &(acc.mData->mValues[0]) + acc.mOffset + pLocalIndex* acc.mStride;
|
const float* dataObject = &(acc.mData->mValues[0]) + acc.mOffset + pLocalIndex* acc.mStride;
|
||||||
|
@ -2905,7 +2906,7 @@ void ColladaParser::ReadScene()
|
||||||
// Aborts the file reading with an exception
|
// Aborts the file reading with an exception
|
||||||
AI_WONT_RETURN void ColladaParser::ThrowException( const std::string& pError) const
|
AI_WONT_RETURN void ColladaParser::ThrowException( const std::string& pError) const
|
||||||
{
|
{
|
||||||
throw DeadlyImportError( boost::str( boost::format( "Collada: %s - %s") % mFileName % pError));
|
throw DeadlyImportError( format() << "Collada: " << mFileName << " - " << pError );
|
||||||
}
|
}
|
||||||
void ColladaParser::ReportWarning(const char* msg,...)
|
void ColladaParser::ReportWarning(const char* msg,...)
|
||||||
{
|
{
|
||||||
|
@ -2956,14 +2957,14 @@ void ColladaParser::TestOpening( const char* pName)
|
||||||
{
|
{
|
||||||
// read element start
|
// read element start
|
||||||
if( !mReader->read())
|
if( !mReader->read())
|
||||||
ThrowException( boost::str( boost::format( "Unexpected end of file while beginning of <%s> element.") % pName));
|
ThrowException( format() << "Unexpected end of file while beginning of <" << pName << "> element." );
|
||||||
// whitespace in front is ok, just read again if found
|
// whitespace in front is ok, just read again if found
|
||||||
if( mReader->getNodeType() == irr::io::EXN_TEXT)
|
if( mReader->getNodeType() == irr::io::EXN_TEXT)
|
||||||
if( !mReader->read())
|
if( !mReader->read())
|
||||||
ThrowException( boost::str( boost::format( "Unexpected end of file while reading beginning of <%s> element.") % pName));
|
ThrowException( format() << "Unexpected end of file while reading beginning of <" << pName << "> element." );
|
||||||
|
|
||||||
if( mReader->getNodeType() != irr::io::EXN_ELEMENT || strcmp( mReader->getNodeName(), pName) != 0)
|
if( mReader->getNodeType() != irr::io::EXN_ELEMENT || strcmp( mReader->getNodeName(), pName) != 0)
|
||||||
ThrowException( boost::str( boost::format( "Expected start of <%s> element.") % pName));
|
ThrowException( format() << "Expected start of <" << pName << "> element." );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -2976,15 +2977,15 @@ void ColladaParser::TestClosing( const char* pName)
|
||||||
|
|
||||||
// if not, read some more
|
// if not, read some more
|
||||||
if( !mReader->read())
|
if( !mReader->read())
|
||||||
ThrowException( boost::str( boost::format( "Unexpected end of file while reading end of <%s> element.") % pName));
|
ThrowException( format() << "Unexpected end of file while reading end of <" << pName << "> element." );
|
||||||
// whitespace in front is ok, just read again if found
|
// whitespace in front is ok, just read again if found
|
||||||
if( mReader->getNodeType() == irr::io::EXN_TEXT)
|
if( mReader->getNodeType() == irr::io::EXN_TEXT)
|
||||||
if( !mReader->read())
|
if( !mReader->read())
|
||||||
ThrowException( boost::str( boost::format( "Unexpected end of file while reading end of <%s> element.") % pName));
|
ThrowException( format() << "Unexpected end of file while reading end of <" << pName << "> element." );
|
||||||
|
|
||||||
// but this has the be the closing tag, or we're lost
|
// but this has the be the closing tag, or we're lost
|
||||||
if( mReader->getNodeType() != irr::io::EXN_ELEMENT_END || strcmp( mReader->getNodeName(), pName) != 0)
|
if( mReader->getNodeType() != irr::io::EXN_ELEMENT_END || strcmp( mReader->getNodeName(), pName) != 0)
|
||||||
ThrowException( boost::str( boost::format( "Expected end of <%s> element.") % pName));
|
ThrowException( format() << "Expected end of <" << pName << "> element." );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -2996,7 +2997,7 @@ int ColladaParser::GetAttribute( const char* pAttr) const
|
||||||
return index;
|
return index;
|
||||||
|
|
||||||
// attribute not found -> throw an exception
|
// attribute not found -> throw an exception
|
||||||
ThrowException( boost::str( boost::format( "Expected attribute \"%s\" for element <%s>.") % pAttr % mReader->getNodeName()));
|
ThrowException( format() << "Expected attribute \"" << pAttr << "\" for element <" << mReader->getNodeName() << ">." );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3131,7 +3132,7 @@ Collada::InputType ColladaParser::GetTypeForSemantic( const std::string& pSemant
|
||||||
else if( pSemantic == "TANGENT" || pSemantic == "TEXTANGENT")
|
else if( pSemantic == "TANGENT" || pSemantic == "TEXTANGENT")
|
||||||
return IT_Tangent;
|
return IT_Tangent;
|
||||||
|
|
||||||
DefaultLogger::get()->warn( boost::str( boost::format( "Unknown vertex input type \"%s\". Ignoring.") % pSemantic));
|
DefaultLogger::get()->warn( format() << "Unknown vertex input type \"" << pSemantic << "\". Ignoring." );
|
||||||
return IT_Invalid;
|
return IT_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@
|
||||||
#include "irrXMLWrapper.h"
|
#include "irrXMLWrapper.h"
|
||||||
#include "ColladaHelper.h"
|
#include "ColladaHelper.h"
|
||||||
#include "../include/assimp/ai_assert.h"
|
#include "../include/assimp/ai_assert.h"
|
||||||
#include <boost/format.hpp>
|
#include "TinyFormatter.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp
|
||||||
{
|
{
|
||||||
|
@ -359,7 +359,7 @@ namespace Assimp
|
||||||
{
|
{
|
||||||
typename std::map<std::string, Type>::const_iterator it = pLibrary.find( pURL);
|
typename std::map<std::string, Type>::const_iterator it = pLibrary.find( pURL);
|
||||||
if( it == pLibrary.end())
|
if( it == pLibrary.end())
|
||||||
ThrowException( boost::str( boost::format( "Unable to resolve library reference \"%s\".") % pURL));
|
ThrowException( Formatter::format() << "Unable to resolve library reference \"" << pURL << "\"." );
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ struct InsertBlock
|
||||||
// keeps track of all geometry in a single BLOCK.
|
// keeps track of all geometry in a single BLOCK.
|
||||||
struct Block
|
struct Block
|
||||||
{
|
{
|
||||||
std::vector< boost::shared_ptr<PolyLine> > lines;
|
std::vector< std::shared_ptr<PolyLine> > lines;
|
||||||
std::vector<InsertBlock> insertions;
|
std::vector<InsertBlock> insertions;
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
|
@ -54,7 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "DXFHelper.h"
|
#include "DXFHelper.h"
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -134,7 +133,7 @@ void DXFImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene,
|
aiScene* pScene,
|
||||||
IOSystem* pIOHandler)
|
IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<IOStream> file = boost::shared_ptr<IOStream>( pIOHandler->Open( pFile) );
|
std::shared_ptr<IOStream> file = std::shared_ptr<IOStream>( pIOHandler->Open( pFile) );
|
||||||
|
|
||||||
// Check whether we can read the file
|
// Check whether we can read the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
@ -222,8 +221,8 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
|
||||||
if (!DefaultLogger::isNullLogger()) {
|
if (!DefaultLogger::isNullLogger()) {
|
||||||
|
|
||||||
unsigned int vcount = 0, icount = 0;
|
unsigned int vcount = 0, icount = 0;
|
||||||
BOOST_FOREACH (const DXF::Block& bl, output.blocks) {
|
for (const DXF::Block& bl : output.blocks) {
|
||||||
BOOST_FOREACH (boost::shared_ptr<const DXF::PolyLine> pl, bl.lines) {
|
for (std::shared_ptr<const DXF::PolyLine> pl : bl.lines) {
|
||||||
vcount += pl->positions.size();
|
vcount += pl->positions.size();
|
||||||
icount += pl->counts.size();
|
icount += pl->counts.size();
|
||||||
}
|
}
|
||||||
|
@ -242,7 +241,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
|
||||||
|
|
||||||
// index blocks by name
|
// index blocks by name
|
||||||
DXF::BlockMap blocks_by_name;
|
DXF::BlockMap blocks_by_name;
|
||||||
BOOST_FOREACH (DXF::Block& bl, output.blocks) {
|
for (DXF::Block& bl : output.blocks) {
|
||||||
blocks_by_name[bl.name] = &bl;
|
blocks_by_name[bl.name] = &bl;
|
||||||
if ( !entities && bl.name == AI_DXF_ENTITIES_MAGIC_BLOCK ) {
|
if ( !entities && bl.name == AI_DXF_ENTITIES_MAGIC_BLOCK ) {
|
||||||
entities = &bl;
|
entities = &bl;
|
||||||
|
@ -263,7 +262,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
|
||||||
ExpandBlockReferences(*entities,blocks_by_name);
|
ExpandBlockReferences(*entities,blocks_by_name);
|
||||||
|
|
||||||
unsigned int cur = 0;
|
unsigned int cur = 0;
|
||||||
BOOST_FOREACH (boost::shared_ptr<const DXF::PolyLine> pl, entities->lines) {
|
for (std::shared_ptr<const DXF::PolyLine> pl : entities->lines) {
|
||||||
if (pl->positions.size()) {
|
if (pl->positions.size()) {
|
||||||
|
|
||||||
std::map<std::string, unsigned int>::iterator it = layers.find(pl->layer);
|
std::map<std::string, unsigned int>::iterator it = layers.find(pl->layer);
|
||||||
|
@ -289,12 +288,12 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
|
||||||
|
|
||||||
pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes ] ();
|
pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes ] ();
|
||||||
|
|
||||||
BOOST_FOREACH(const LayerMap::value_type& elem, layers){
|
for(const LayerMap::value_type& elem : layers){
|
||||||
aiMesh* const mesh = pScene->mMeshes[elem.second] = new aiMesh();
|
aiMesh* const mesh = pScene->mMeshes[elem.second] = new aiMesh();
|
||||||
mesh->mName.Set(elem.first);
|
mesh->mName.Set(elem.first);
|
||||||
|
|
||||||
unsigned int cvert = 0,cface = 0;
|
unsigned int cvert = 0,cface = 0;
|
||||||
BOOST_FOREACH(const DXF::PolyLine* pl, corr[elem.second]){
|
for(const DXF::PolyLine* pl : corr[elem.second]){
|
||||||
// sum over all faces since we need to 'verbosify' them.
|
// sum over all faces since we need to 'verbosify' them.
|
||||||
cvert += std::accumulate(pl->counts.begin(),pl->counts.end(),0);
|
cvert += std::accumulate(pl->counts.begin(),pl->counts.end(),0);
|
||||||
cface += pl->counts.size();
|
cface += pl->counts.size();
|
||||||
|
@ -309,10 +308,10 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
|
||||||
|
|
||||||
unsigned int prims = 0;
|
unsigned int prims = 0;
|
||||||
unsigned int overall_indices = 0;
|
unsigned int overall_indices = 0;
|
||||||
BOOST_FOREACH(const DXF::PolyLine* pl, corr[elem.second]){
|
for(const DXF::PolyLine* pl : corr[elem.second]){
|
||||||
|
|
||||||
std::vector<unsigned int>::const_iterator it = pl->indices.begin();
|
std::vector<unsigned int>::const_iterator it = pl->indices.begin();
|
||||||
BOOST_FOREACH(unsigned int facenumv,pl->counts) {
|
for(unsigned int facenumv : pl->counts) {
|
||||||
aiFace& face = *faces++;
|
aiFace& face = *faces++;
|
||||||
face.mIndices = new unsigned int[face.mNumIndices = facenumv];
|
face.mIndices = new unsigned int[face.mNumIndices = facenumv];
|
||||||
|
|
||||||
|
@ -358,7 +357,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& blocks_by_name)
|
void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& blocks_by_name)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH (const DXF::InsertBlock& insert, bl.insertions) {
|
for (const DXF::InsertBlock& insert : bl.insertions) {
|
||||||
|
|
||||||
// first check if the referenced blocks exists ...
|
// first check if the referenced blocks exists ...
|
||||||
const DXF::BlockMap::const_iterator it = blocks_by_name.find(insert.name);
|
const DXF::BlockMap::const_iterator it = blocks_by_name.find(insert.name);
|
||||||
|
@ -372,8 +371,8 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
|
||||||
// XXX this would be the place to implement recursive expansion if needed.
|
// XXX this would be the place to implement recursive expansion if needed.
|
||||||
const DXF::Block& bl_src = *(*it).second;
|
const DXF::Block& bl_src = *(*it).second;
|
||||||
|
|
||||||
BOOST_FOREACH (boost::shared_ptr<const DXF::PolyLine> pl_in, bl_src.lines) {
|
for (std::shared_ptr<const DXF::PolyLine> pl_in : bl_src.lines) {
|
||||||
boost::shared_ptr<DXF::PolyLine> pl_out = boost::shared_ptr<DXF::PolyLine>(new DXF::PolyLine(*pl_in));
|
std::shared_ptr<DXF::PolyLine> pl_out = std::shared_ptr<DXF::PolyLine>(new DXF::PolyLine(*pl_in));
|
||||||
|
|
||||||
if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) {
|
if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) {
|
||||||
// manual coordinate system transformation
|
// manual coordinate system transformation
|
||||||
|
@ -388,7 +387,7 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
|
||||||
DefaultLogger::get()->warn("DXF: BLOCK rotation not currently implemented");
|
DefaultLogger::get()->warn("DXF: BLOCK rotation not currently implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH (aiVector3D& v, pl_out->positions) {
|
for (aiVector3D& v : pl_out->positions) {
|
||||||
v *= trafo;
|
v *= trafo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,7 +617,7 @@ void DXFImporter::ParseInsertion(DXF::LineReader& reader, DXF::FileData& output)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output)
|
void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output)
|
||||||
{
|
{
|
||||||
output.blocks.back().lines.push_back( boost::shared_ptr<DXF::PolyLine>( new DXF::PolyLine() ) );
|
output.blocks.back().lines.push_back( std::shared_ptr<DXF::PolyLine>( new DXF::PolyLine() ) );
|
||||||
DXF::PolyLine& line = *output.blocks.back().lines.back();
|
DXF::PolyLine& line = *output.blocks.back().lines.back();
|
||||||
|
|
||||||
unsigned int iguess = 0, vguess = 0;
|
unsigned int iguess = 0, vguess = 0;
|
||||||
|
@ -800,7 +799,7 @@ void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output)
|
||||||
// (note) this is also used for for parsing line entities, so we
|
// (note) this is also used for for parsing line entities, so we
|
||||||
// must handle the vertex_count == 2 case as well.
|
// must handle the vertex_count == 2 case as well.
|
||||||
|
|
||||||
output.blocks.back().lines.push_back( boost::shared_ptr<DXF::PolyLine>( new DXF::PolyLine() ) );
|
output.blocks.back().lines.push_back( std::shared_ptr<DXF::PolyLine>( new DXF::PolyLine() ) );
|
||||||
DXF::PolyLine& line = *output.blocks.back().lines.back();
|
DXF::PolyLine& line = *output.blocks.back().lines.back();
|
||||||
|
|
||||||
aiVector3D vip[4];
|
aiVector3D vip[4];
|
||||||
|
|
|
@ -57,10 +57,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
# include <boost/thread/thread.hpp>
|
# include <thread>
|
||||||
# include <boost/thread/mutex.hpp>
|
# include <mutex>
|
||||||
|
|
||||||
boost::mutex loggerMutex;
|
std::mutex loggerMutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -135,7 +135,7 @@ Logger *DefaultLogger::create(const char* name /*= "AssimpLog.txt"*/,
|
||||||
{
|
{
|
||||||
// enter the mutex here to avoid concurrency problems
|
// enter the mutex here to avoid concurrency problems
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
boost::mutex::scoped_lock lock(loggerMutex);
|
std::lock_guard<std::mutex> lock(loggerMutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_pLogger && !isNullLogger() )
|
if (m_pLogger && !isNullLogger() )
|
||||||
|
@ -210,7 +210,7 @@ void DefaultLogger::set( Logger *logger )
|
||||||
{
|
{
|
||||||
// enter the mutex here to avoid concurrency problems
|
// enter the mutex here to avoid concurrency problems
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
boost::mutex::scoped_lock lock(loggerMutex);
|
std::lock_guard<std::mutex> lock(loggerMutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!logger)logger = &s_pNullLogger;
|
if (!logger)logger = &s_pNullLogger;
|
||||||
|
@ -237,7 +237,7 @@ void DefaultLogger::kill()
|
||||||
{
|
{
|
||||||
// enter the mutex here to avoid concurrency problems
|
// enter the mutex here to avoid concurrency problems
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
boost::mutex::scoped_lock lock(loggerMutex);
|
std::lock_guard<std::mutex> lock(loggerMutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( m_pLogger == &s_pNullLogger ) {
|
if ( m_pLogger == &s_pNullLogger ) {
|
||||||
|
@ -413,7 +413,8 @@ void DefaultLogger::WriteToStreams(const char *message, ErrorSeverity ErrorSev )
|
||||||
// Returns thread id, if not supported only a zero will be returned.
|
// Returns thread id, if not supported only a zero will be returned.
|
||||||
unsigned int DefaultLogger::GetThreadID()
|
unsigned int DefaultLogger::GetThreadID()
|
||||||
{
|
{
|
||||||
// fixme: we can get this value via boost::threads
|
// fixme: we can get this value via std::threads
|
||||||
|
// std::this_thread::get_id().hash() returns a (big) size_t, not sure if this is useful in this case.
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
return (unsigned int)::GetCurrentThreadId();
|
return (unsigned int)::GetCurrentThreadId();
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -63,7 +63,7 @@ Here we implement only the C++ interface (Assimp::Exporter).
|
||||||
#include "ConvertToLHProcess.h"
|
#include "ConvertToLHProcess.h"
|
||||||
#include "Exceptional.h"
|
#include "Exceptional.h"
|
||||||
#include "ScenePrivate.h"
|
#include "ScenePrivate.h"
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/Exporter.hpp"
|
#include "../include/assimp/Exporter.hpp"
|
||||||
#include "../include/assimp/mesh.h"
|
#include "../include/assimp/mesh.h"
|
||||||
#include "../include/assimp/postprocess.h"
|
#include "../include/assimp/postprocess.h"
|
||||||
|
@ -184,7 +184,7 @@ public:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
aiExportDataBlob* blob;
|
aiExportDataBlob* blob;
|
||||||
boost::shared_ptr< Assimp::IOSystem > mIOSystem;
|
std::shared_ptr< Assimp::IOSystem > mIOSystem;
|
||||||
bool mIsDefaultIOHandler;
|
bool mIsDefaultIOHandler;
|
||||||
|
|
||||||
/** Post processing steps we can apply at the imported data. */
|
/** Post processing steps we can apply at the imported data. */
|
||||||
|
@ -254,10 +254,10 @@ const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boost::shared_ptr<IOSystem> old = pimpl->mIOSystem;
|
std::shared_ptr<IOSystem> old = pimpl->mIOSystem;
|
||||||
|
|
||||||
BlobIOSystem* blobio = new BlobIOSystem();
|
BlobIOSystem* blobio = new BlobIOSystem();
|
||||||
pimpl->mIOSystem = boost::shared_ptr<IOSystem>( blobio );
|
pimpl->mIOSystem = std::shared_ptr<IOSystem>( blobio );
|
||||||
|
|
||||||
if (AI_SUCCESS != Export(pScene,pFormatId,blobio->GetMagicFileName())) {
|
if (AI_SUCCESS != Export(pScene,pFormatId,blobio->GetMagicFileName())) {
|
||||||
pimpl->mIOSystem = old;
|
pimpl->mIOSystem = old;
|
||||||
|
@ -324,7 +324,7 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
|
||||||
aiScene* scenecopy_tmp;
|
aiScene* scenecopy_tmp;
|
||||||
SceneCombiner::CopyScene(&scenecopy_tmp,pScene);
|
SceneCombiner::CopyScene(&scenecopy_tmp,pScene);
|
||||||
|
|
||||||
std::auto_ptr<aiScene> scenecopy(scenecopy_tmp);
|
std::unique_ptr<aiScene> scenecopy(scenecopy_tmp);
|
||||||
const ScenePrivateData* const priv = ScenePriv(pScene);
|
const ScenePrivateData* const priv = ScenePriv(pScene);
|
||||||
|
|
||||||
// steps that are not idempotent, i.e. we might need to run them again, usually to get back to the
|
// steps that are not idempotent, i.e. we might need to run them again, usually to get back to the
|
||||||
|
@ -491,7 +491,7 @@ const aiExportFormatDesc* Exporter :: GetExportFormatDescription( size_t pIndex
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
aiReturn Exporter :: RegisterExporter(const ExportFormatEntry& desc)
|
aiReturn Exporter :: RegisterExporter(const ExportFormatEntry& desc)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const ExportFormatEntry& e, pimpl->mExporters) {
|
for(const ExportFormatEntry& e : pimpl->mExporters) {
|
||||||
if (!strcmp(e.mDescription.id,desc.mDescription.id)) {
|
if (!strcmp(e.mDescription.id,desc.mDescription.id)) {
|
||||||
return aiReturn_FAILURE;
|
return aiReturn_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ 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 <boost/foreach.hpp>
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -110,7 +109,7 @@ AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, cons
|
||||||
const char* whitelist[] = {"Model","NodeAttribute"};
|
const char* whitelist[] = {"Model","NodeAttribute"};
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsBySourceSequenced(ID(),whitelist,2);
|
const std::vector<const Connection*>& conns = doc.GetConnectionsBySourceSequenced(ID(),whitelist,2);
|
||||||
|
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
|
|
||||||
// link should go for a property
|
// link should go for a property
|
||||||
if (!con->PropertyName().length()) {
|
if (!con->PropertyName().length()) {
|
||||||
|
@ -171,7 +170,7 @@ const AnimationCurveMap& AnimationCurveNode::Curves() const
|
||||||
// resolve attached animation curves
|
// resolve attached animation curves
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurve");
|
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurve");
|
||||||
|
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
|
|
||||||
// link should go for a property
|
// link should go for a property
|
||||||
if (!con->PropertyName().length()) {
|
if (!con->PropertyName().length()) {
|
||||||
|
@ -227,7 +226,7 @@ AnimationCurveNodeList AnimationLayer::Nodes(const char* const * target_prop_whi
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurveNode");
|
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurveNode");
|
||||||
nodes.reserve(conns.size());
|
nodes.reserve(conns.size());
|
||||||
|
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
|
|
||||||
// link should not go to a property
|
// link should not go to a property
|
||||||
if (con->PropertyName().length()) {
|
if (con->PropertyName().length()) {
|
||||||
|
@ -278,7 +277,7 @@ AnimationStack::AnimationStack(uint64_t id, const Element& element, const std::s
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationLayer");
|
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationLayer");
|
||||||
layers.reserve(conns.size());
|
layers.reserve(conns.size());
|
||||||
|
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
|
|
||||||
// link should not go to a property
|
// link should not go to a property
|
||||||
if (con->PropertyName().length()) {
|
if (con->PropertyName().length()) {
|
||||||
|
|
|
@ -54,9 +54,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "StringComparison.h"
|
#include "StringComparison.h"
|
||||||
|
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <tuple>
|
||||||
#include <boost/foreach.hpp>
|
#include <memory>
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -339,7 +338,7 @@ private:
|
||||||
bool reverse_order = false );
|
bool reverse_order = false );
|
||||||
|
|
||||||
// key (time), value, mapto (component index)
|
// key (time), value, mapto (component index)
|
||||||
typedef boost::tuple<boost::shared_ptr<KeyTimeList>, boost::shared_ptr<KeyValueList>, unsigned int > KeyFrameList;
|
typedef std::tuple<std::shared_ptr<KeyTimeList>, std::shared_ptr<KeyValueList>, unsigned int > KeyFrameList;
|
||||||
typedef std::vector<KeyFrameList> KeyFrameListList;
|
typedef std::vector<KeyFrameList> KeyFrameListList;
|
||||||
|
|
||||||
|
|
||||||
|
@ -457,7 +456,7 @@ Converter::Converter( aiScene* out, const Document& doc )
|
||||||
|
|
||||||
if ( doc.Settings().readAllMaterials ) {
|
if ( doc.Settings().readAllMaterials ) {
|
||||||
// unfortunately this means we have to evaluate all objects
|
// unfortunately this means we have to evaluate all objects
|
||||||
BOOST_FOREACH( const ObjectMap::value_type& v, doc.Objects() ) {
|
for( const ObjectMap::value_type& v : doc.Objects() ) {
|
||||||
|
|
||||||
const Object* ob = v.second->Get();
|
const Object* ob = v.second->Get();
|
||||||
if ( !ob ) {
|
if ( !ob ) {
|
||||||
|
@ -515,7 +514,7 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
|
||||||
std::vector<aiNode*> nodes_chain;
|
std::vector<aiNode*> nodes_chain;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BOOST_FOREACH( const Connection* con, conns ) {
|
for( const Connection* con : conns ) {
|
||||||
|
|
||||||
// ignore object-property links
|
// ignore object-property links
|
||||||
if ( con->PropertyName().length() ) {
|
if ( con->PropertyName().length() ) {
|
||||||
|
@ -550,7 +549,7 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
|
||||||
// preserve the name - people might have scripts etc. that rely
|
// preserve the name - people might have scripts etc. that rely
|
||||||
// on specific node names.
|
// on specific node names.
|
||||||
aiNode* name_carrier = NULL;
|
aiNode* name_carrier = NULL;
|
||||||
BOOST_FOREACH( aiNode* prenode, nodes_chain ) {
|
for( aiNode* prenode : nodes_chain ) {
|
||||||
if ( !strcmp( prenode->mName.C_Str(), original_name.c_str() ) ) {
|
if ( !strcmp( prenode->mName.C_Str(), original_name.c_str() ) ) {
|
||||||
name_carrier = prenode;
|
name_carrier = prenode;
|
||||||
break;
|
break;
|
||||||
|
@ -567,7 +566,7 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
|
||||||
|
|
||||||
// link all nodes in a row
|
// link all nodes in a row
|
||||||
aiNode* last_parent = &parent;
|
aiNode* last_parent = &parent;
|
||||||
BOOST_FOREACH( aiNode* prenode, nodes_chain ) {
|
for( aiNode* prenode : nodes_chain ) {
|
||||||
ai_assert( prenode );
|
ai_assert( prenode );
|
||||||
|
|
||||||
if ( last_parent != &parent ) {
|
if ( last_parent != &parent ) {
|
||||||
|
@ -619,7 +618,7 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
|
||||||
void Converter::ConvertLights( const Model& model )
|
void Converter::ConvertLights( const Model& model )
|
||||||
{
|
{
|
||||||
const std::vector<const NodeAttribute*>& node_attrs = model.GetAttributes();
|
const std::vector<const NodeAttribute*>& node_attrs = model.GetAttributes();
|
||||||
BOOST_FOREACH( const NodeAttribute* attr, node_attrs ) {
|
for( const NodeAttribute* attr : node_attrs ) {
|
||||||
const Light* const light = dynamic_cast<const Light*>( attr );
|
const Light* const light = dynamic_cast<const Light*>( attr );
|
||||||
if ( light ) {
|
if ( light ) {
|
||||||
ConvertLight( model, *light );
|
ConvertLight( model, *light );
|
||||||
|
@ -630,7 +629,7 @@ void Converter::ConvertLights( const Model& model )
|
||||||
void Converter::ConvertCameras( const Model& model )
|
void Converter::ConvertCameras( const Model& model )
|
||||||
{
|
{
|
||||||
const std::vector<const NodeAttribute*>& node_attrs = model.GetAttributes();
|
const std::vector<const NodeAttribute*>& node_attrs = model.GetAttributes();
|
||||||
BOOST_FOREACH( const NodeAttribute* attr, node_attrs ) {
|
for( const NodeAttribute* attr : node_attrs ) {
|
||||||
const Camera* const cam = dynamic_cast<const Camera*>( attr );
|
const Camera* const cam = dynamic_cast<const Camera*>( attr );
|
||||||
if ( cam ) {
|
if ( cam ) {
|
||||||
ConvertCamera( model, *cam );
|
ConvertCamera( model, *cam );
|
||||||
|
@ -1089,7 +1088,7 @@ void Converter::SetupNodeMetadata( const Model& model, aiNode& nd )
|
||||||
data->Set( index++, "IsNull", model.IsNull() ? true : false );
|
data->Set( index++, "IsNull", model.IsNull() ? true : false );
|
||||||
|
|
||||||
// add unparsed properties to the node's metadata
|
// add unparsed properties to the node's metadata
|
||||||
BOOST_FOREACH( const DirectPropertyMap::value_type& prop, unparsedProperties ) {
|
for( const DirectPropertyMap::value_type& prop : unparsedProperties ) {
|
||||||
|
|
||||||
// Interpret the property as a concrete type
|
// Interpret the property as a concrete type
|
||||||
if ( const TypedProperty<bool>* interpreted = prop.second->As<TypedProperty<bool> >() )
|
if ( const TypedProperty<bool>* interpreted = prop.second->As<TypedProperty<bool> >() )
|
||||||
|
@ -1116,7 +1115,7 @@ void Converter::ConvertModel( const Model& model, aiNode& nd, const aiMatrix4x4&
|
||||||
std::vector<unsigned int> meshes;
|
std::vector<unsigned int> meshes;
|
||||||
meshes.reserve( geos.size() );
|
meshes.reserve( geos.size() );
|
||||||
|
|
||||||
BOOST_FOREACH( const Geometry* geo, geos ) {
|
for( const Geometry* geo : geos ) {
|
||||||
|
|
||||||
const MeshGeometry* const mesh = dynamic_cast< const MeshGeometry* >( geo );
|
const MeshGeometry* const mesh = dynamic_cast< const MeshGeometry* >( geo );
|
||||||
if ( mesh ) {
|
if ( mesh ) {
|
||||||
|
@ -1160,7 +1159,7 @@ std::vector<unsigned int> Converter::ConvertMesh( const MeshGeometry& mesh, cons
|
||||||
const MatIndexArray& mindices = mesh.GetMaterialIndices();
|
const MatIndexArray& mindices = mesh.GetMaterialIndices();
|
||||||
if ( doc.Settings().readMaterials && !mindices.empty() ) {
|
if ( doc.Settings().readMaterials && !mindices.empty() ) {
|
||||||
const MatIndexArray::value_type base = mindices[ 0 ];
|
const MatIndexArray::value_type base = mindices[ 0 ];
|
||||||
BOOST_FOREACH( MatIndexArray::value_type index, mindices ) {
|
for( MatIndexArray::value_type index : mindices ) {
|
||||||
if ( index != base ) {
|
if ( index != base ) {
|
||||||
return ConvertMeshMultiMaterial( mesh, model, node_global_transform );
|
return ConvertMeshMultiMaterial( mesh, model, node_global_transform );
|
||||||
}
|
}
|
||||||
|
@ -1212,7 +1211,7 @@ unsigned int Converter::ConvertMeshSingleMaterial( const MeshGeometry& mesh, con
|
||||||
aiFace* fac = out_mesh->mFaces = new aiFace[ faces.size() ]();
|
aiFace* fac = out_mesh->mFaces = new aiFace[ faces.size() ]();
|
||||||
|
|
||||||
unsigned int cursor = 0;
|
unsigned int cursor = 0;
|
||||||
BOOST_FOREACH( unsigned int pcount, faces ) {
|
for( unsigned int pcount : faces ) {
|
||||||
aiFace& f = *fac++;
|
aiFace& f = *fac++;
|
||||||
f.mNumIndices = pcount;
|
f.mNumIndices = pcount;
|
||||||
f.mIndices = new unsigned int[ pcount ];
|
f.mIndices = new unsigned int[ pcount ];
|
||||||
|
@ -1287,7 +1286,7 @@ unsigned int Converter::ConvertMeshSingleMaterial( const MeshGeometry& mesh, con
|
||||||
}
|
}
|
||||||
|
|
||||||
aiVector3D* out_uv = out_mesh->mTextureCoords[ i ] = new aiVector3D[ vertices.size() ];
|
aiVector3D* out_uv = out_mesh->mTextureCoords[ i ] = new aiVector3D[ vertices.size() ];
|
||||||
BOOST_FOREACH( const aiVector2D& v, uvs ) {
|
for( const aiVector2D& v : uvs ) {
|
||||||
*out_uv++ = aiVector3D( v.x, v.y, 0.0f );
|
*out_uv++ = aiVector3D( v.x, v.y, 0.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1329,7 +1328,7 @@ std::vector<unsigned int> Converter::ConvertMeshMultiMaterial( const MeshGeometr
|
||||||
std::set<MatIndexArray::value_type> had;
|
std::set<MatIndexArray::value_type> had;
|
||||||
std::vector<unsigned int> indices;
|
std::vector<unsigned int> indices;
|
||||||
|
|
||||||
BOOST_FOREACH( MatIndexArray::value_type index, mindices ) {
|
for( MatIndexArray::value_type index : mindices ) {
|
||||||
if ( had.find( index ) == had.end() ) {
|
if ( had.find( index ) == had.end() ) {
|
||||||
|
|
||||||
indices.push_back( ConvertMeshMultiMaterial( mesh, model, index, node_global_transform ) );
|
indices.push_back( ConvertMeshMultiMaterial( mesh, model, index, node_global_transform ) );
|
||||||
|
@ -1537,7 +1536,7 @@ void Converter::ConvertWeights( aiMesh* out, const Model& model, const MeshGeome
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
BOOST_FOREACH( const Cluster* cluster, sk.Clusters() ) {
|
for( const Cluster* cluster : sk.Clusters() ) {
|
||||||
ai_assert( cluster );
|
ai_assert( cluster );
|
||||||
|
|
||||||
const WeightIndexArray& indices = cluster->GetIndices();
|
const WeightIndexArray& indices = cluster->GetIndices();
|
||||||
|
@ -1558,7 +1557,7 @@ void Converter::ConvertWeights( aiMesh* out, const Model& model, const MeshGeome
|
||||||
|
|
||||||
// now check if *any* of these weights is contained in the output mesh,
|
// now check if *any* of these weights is contained in the output mesh,
|
||||||
// taking notes so we don't need to do it twice.
|
// taking notes so we don't need to do it twice.
|
||||||
BOOST_FOREACH( WeightIndexArray::value_type index, indices ) {
|
for( WeightIndexArray::value_type index : indices ) {
|
||||||
|
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
const unsigned int* const out_idx = geo.ToOutputVertexIndex( index, count );
|
const unsigned int* const out_idx = geo.ToOutputVertexIndex( index, count );
|
||||||
|
@ -1839,7 +1838,7 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap&
|
||||||
uvIndex = -1;
|
uvIndex = -1;
|
||||||
if ( !mesh )
|
if ( !mesh )
|
||||||
{
|
{
|
||||||
BOOST_FOREACH( const MeshMap::value_type& v, meshes_converted ) {
|
for( const MeshMap::value_type& v : meshes_converted ) {
|
||||||
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> ( v.first );
|
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> ( v.first );
|
||||||
if ( !mesh ) {
|
if ( !mesh ) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1957,7 +1956,7 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextu
|
||||||
uvIndex = -1;
|
uvIndex = -1;
|
||||||
if ( !mesh )
|
if ( !mesh )
|
||||||
{
|
{
|
||||||
BOOST_FOREACH( const MeshMap::value_type& v, meshes_converted ) {
|
for( const MeshMap::value_type& v : meshes_converted ) {
|
||||||
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> ( v.first );
|
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> ( v.first );
|
||||||
if ( !mesh ) {
|
if ( !mesh ) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -2190,7 +2189,7 @@ void Converter::ConvertAnimations()
|
||||||
anim_fps = FrameRateToDouble( fps, custom );
|
anim_fps = FrameRateToDouble( fps, custom );
|
||||||
|
|
||||||
const std::vector<const AnimationStack*>& animations = doc.AnimationStacks();
|
const std::vector<const AnimationStack*>& animations = doc.AnimationStacks();
|
||||||
BOOST_FOREACH( const AnimationStack* stack, animations ) {
|
for( const AnimationStack* stack : animations ) {
|
||||||
ConvertAnimationStack( *stack );
|
ConvertAnimationStack( *stack );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2205,21 +2204,21 @@ void Converter::RenameNode( const std::string& fixed_name, const std::string& ne
|
||||||
|
|
||||||
const aiString fn( fixed_name );
|
const aiString fn( fixed_name );
|
||||||
|
|
||||||
BOOST_FOREACH( aiCamera* cam, cameras ) {
|
for( aiCamera* cam : cameras ) {
|
||||||
if ( cam->mName == fn ) {
|
if ( cam->mName == fn ) {
|
||||||
cam->mName.Set( new_name );
|
cam->mName.Set( new_name );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH( aiLight* light, lights ) {
|
for( aiLight* light : lights ) {
|
||||||
if ( light->mName == fn ) {
|
if ( light->mName == fn ) {
|
||||||
light->mName.Set( new_name );
|
light->mName.Set( new_name );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH( aiAnimation* anim, animations ) {
|
for( aiAnimation* anim : animations ) {
|
||||||
for ( unsigned int i = 0; i < anim->mNumChannels; ++i ) {
|
for ( unsigned int i = 0; i < anim->mNumChannels; ++i ) {
|
||||||
aiNodeAnim* const na = anim->mChannels[ i ];
|
aiNodeAnim* const na = anim->mChannels[ i ];
|
||||||
if ( na->mNodeName == fn ) {
|
if ( na->mNodeName == fn ) {
|
||||||
|
@ -2299,11 +2298,11 @@ void Converter::ConvertAnimationStack( const AnimationStack& st )
|
||||||
"Lcl Translation"
|
"Lcl Translation"
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOST_FOREACH( const AnimationLayer* layer, layers ) {
|
for( const AnimationLayer* layer : layers ) {
|
||||||
ai_assert( layer );
|
ai_assert( layer );
|
||||||
|
|
||||||
const AnimationCurveNodeList& nodes = layer->Nodes( prop_whitelist, 3 );
|
const AnimationCurveNodeList& nodes = layer->Nodes( prop_whitelist, 3 );
|
||||||
BOOST_FOREACH( const AnimationCurveNode* node, nodes ) {
|
for( const AnimationCurveNode* node : nodes ) {
|
||||||
ai_assert( node );
|
ai_assert( node );
|
||||||
|
|
||||||
const Model* const model = dynamic_cast<const Model*>( node->Target() );
|
const Model* const model = dynamic_cast<const Model*>( node->Target() );
|
||||||
|
@ -2331,7 +2330,7 @@ void Converter::ConvertAnimationStack( const AnimationStack& st )
|
||||||
double stop_timeF = CONVERT_FBX_TIME( stop_time );
|
double stop_timeF = CONVERT_FBX_TIME( stop_time );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BOOST_FOREACH( const NodeMap::value_type& kv, node_map ) {
|
for( const NodeMap::value_type& kv : node_map ) {
|
||||||
GenerateNodeAnimations( node_anims,
|
GenerateNodeAnimations( node_anims,
|
||||||
kv.first,
|
kv.first,
|
||||||
kv.second,
|
kv.second,
|
||||||
|
@ -2389,7 +2388,7 @@ void Converter::ConvertAnimationStack( const AnimationStack& st )
|
||||||
static void validateAnimCurveNodes( const std::vector<const AnimationCurveNode*>& curves,
|
static void validateAnimCurveNodes( const std::vector<const AnimationCurveNode*>& curves,
|
||||||
bool strictMode ) {
|
bool strictMode ) {
|
||||||
const Object* target( NULL );
|
const Object* target( NULL );
|
||||||
BOOST_FOREACH( const AnimationCurveNode* node, curves ) {
|
for( const AnimationCurveNode* node : curves ) {
|
||||||
if ( !target ) {
|
if ( !target ) {
|
||||||
target = node->Target();
|
target = node->Target();
|
||||||
}
|
}
|
||||||
|
@ -2419,7 +2418,7 @@ void Converter::GenerateNodeAnimations( std::vector<aiNodeAnim*>& node_anims,
|
||||||
validateAnimCurveNodes( curves, doc.Settings().strictMode );
|
validateAnimCurveNodes( curves, doc.Settings().strictMode );
|
||||||
#endif
|
#endif
|
||||||
const AnimationCurveNode* curve_node = NULL;
|
const AnimationCurveNode* curve_node = NULL;
|
||||||
BOOST_FOREACH( const AnimationCurveNode* node, curves ) {
|
for( const AnimationCurveNode* node : curves ) {
|
||||||
ai_assert( node );
|
ai_assert( node );
|
||||||
|
|
||||||
if ( node->TargetProperty().empty() ) {
|
if ( node->TargetProperty().empty() ) {
|
||||||
|
@ -2927,11 +2926,11 @@ Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector<const
|
||||||
int64_t adj_start = start - 10000;
|
int64_t adj_start = start - 10000;
|
||||||
int64_t adj_stop = stop + 10000;
|
int64_t adj_stop = stop + 10000;
|
||||||
|
|
||||||
BOOST_FOREACH( const AnimationCurveNode* node, nodes ) {
|
for( const AnimationCurveNode* node : nodes ) {
|
||||||
ai_assert( node );
|
ai_assert( node );
|
||||||
|
|
||||||
const AnimationCurveMap& curves = node->Curves();
|
const AnimationCurveMap& curves = node->Curves();
|
||||||
BOOST_FOREACH( const AnimationCurveMap::value_type& kv, curves ) {
|
for( const AnimationCurveMap::value_type& kv : curves ) {
|
||||||
|
|
||||||
unsigned int mapto;
|
unsigned int mapto;
|
||||||
if ( kv.first == "d|X" ) {
|
if ( kv.first == "d|X" ) {
|
||||||
|
@ -2952,8 +2951,8 @@ Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector<const
|
||||||
ai_assert( curve->GetKeys().size() == curve->GetValues().size() && curve->GetKeys().size() );
|
ai_assert( curve->GetKeys().size() == curve->GetValues().size() && curve->GetKeys().size() );
|
||||||
|
|
||||||
//get values within the start/stop time window
|
//get values within the start/stop time window
|
||||||
boost::shared_ptr<KeyTimeList> Keys( new KeyTimeList() );
|
std::shared_ptr<KeyTimeList> Keys( new KeyTimeList() );
|
||||||
boost::shared_ptr<KeyValueList> Values( new KeyValueList() );
|
std::shared_ptr<KeyValueList> Values( new KeyValueList() );
|
||||||
const int count = curve->GetKeys().size();
|
const int count = curve->GetKeys().size();
|
||||||
Keys->reserve( count );
|
Keys->reserve( count );
|
||||||
Values->reserve( count );
|
Values->reserve( count );
|
||||||
|
@ -2967,7 +2966,7 @@ Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector<const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.push_back( boost::make_tuple( Keys, Values, mapto ) );
|
inputs.push_back( std::make_tuple( Keys, Values, mapto ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return inputs; // pray for NRVO :-)
|
return inputs; // pray for NRVO :-)
|
||||||
|
@ -2984,8 +2983,8 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
|
||||||
KeyTimeList keys;
|
KeyTimeList keys;
|
||||||
|
|
||||||
size_t estimate = 0;
|
size_t estimate = 0;
|
||||||
BOOST_FOREACH( const KeyFrameList& kfl, inputs ) {
|
for( const KeyFrameList& kfl : inputs ) {
|
||||||
estimate = std::max( estimate, kfl.get<0>()->size() );
|
estimate = std::max( estimate, std::get<0>(kfl)->size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
keys.reserve( estimate );
|
keys.reserve( estimate );
|
||||||
|
@ -3000,8 +2999,8 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
|
||||||
for ( size_t i = 0; i < count; ++i ) {
|
for ( size_t i = 0; i < count; ++i ) {
|
||||||
const KeyFrameList& kfl = inputs[ i ];
|
const KeyFrameList& kfl = inputs[ i ];
|
||||||
|
|
||||||
if ( kfl.get<0>()->size() > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) < min_tick ) {
|
if ( std::get<0>(kfl)->size() > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) < min_tick ) {
|
||||||
min_tick = kfl.get<0>()->at( next_pos[ i ] );
|
min_tick = std::get<0>(kfl)->at( next_pos[ i ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3014,7 +3013,7 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
|
||||||
const KeyFrameList& kfl = inputs[ i ];
|
const KeyFrameList& kfl = inputs[ i ];
|
||||||
|
|
||||||
|
|
||||||
while ( kfl.get<0>()->size() > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) == min_tick ) {
|
while ( std::get<0>(kfl)->size() > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) == min_tick ) {
|
||||||
++next_pos[ i ];
|
++next_pos[ i ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3037,14 +3036,14 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
|
||||||
|
|
||||||
next_pos.resize( inputs.size(), 0 );
|
next_pos.resize( inputs.size(), 0 );
|
||||||
|
|
||||||
BOOST_FOREACH( KeyTimeList::value_type time, keys ) {
|
for( KeyTimeList::value_type time : keys ) {
|
||||||
float result[ 3 ] = { def_value.x, def_value.y, def_value.z };
|
float result[ 3 ] = { def_value.x, def_value.y, def_value.z };
|
||||||
|
|
||||||
for ( size_t i = 0; i < count; ++i ) {
|
for ( size_t i = 0; i < count; ++i ) {
|
||||||
const KeyFrameList& kfl = inputs[ i ];
|
const KeyFrameList& kfl = inputs[ i ];
|
||||||
|
|
||||||
const size_t ksize = kfl.get<0>()->size();
|
const size_t ksize = std::get<0>(kfl)->size();
|
||||||
if ( ksize > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) == time ) {
|
if ( ksize > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) == time ) {
|
||||||
++next_pos[ i ];
|
++next_pos[ i ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3052,18 +3051,18 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
|
||||||
const size_t id1 = next_pos[ i ] == ksize ? ksize - 1 : next_pos[ i ];
|
const size_t id1 = next_pos[ i ] == ksize ? ksize - 1 : next_pos[ i ];
|
||||||
|
|
||||||
// use lerp for interpolation
|
// use lerp for interpolation
|
||||||
const KeyValueList::value_type valueA = kfl.get<1>()->at( id0 );
|
const KeyValueList::value_type valueA = std::get<1>(kfl)->at( id0 );
|
||||||
const KeyValueList::value_type valueB = kfl.get<1>()->at( id1 );
|
const KeyValueList::value_type valueB = std::get<1>(kfl)->at( id1 );
|
||||||
|
|
||||||
const KeyTimeList::value_type timeA = kfl.get<0>()->at( id0 );
|
const KeyTimeList::value_type timeA = std::get<0>(kfl)->at( id0 );
|
||||||
const KeyTimeList::value_type timeB = kfl.get<0>()->at( id1 );
|
const KeyTimeList::value_type timeB = std::get<0>(kfl)->at( id1 );
|
||||||
|
|
||||||
// do the actual interpolation in double-precision arithmetics
|
// do the actual interpolation in double-precision arithmetics
|
||||||
// because it is a bit sensitive to rounding errors.
|
// because it is a bit sensitive to rounding errors.
|
||||||
const double factor = timeB == timeA ? 0. : static_cast<double>( ( time - timeA ) / ( timeB - timeA ) );
|
const double factor = timeB == timeA ? 0. : static_cast<double>( ( time - timeA ) / ( timeB - timeA ) );
|
||||||
const float interpValue = static_cast<float>( valueA + ( valueB - valueA ) * factor );
|
const float interpValue = static_cast<float>( valueA + ( valueB - valueA ) * factor );
|
||||||
|
|
||||||
result[ kfl.get<2>() ] = interpValue;
|
result[ std::get<2>(kfl) ] = interpValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// magic value to convert fbx times to seconds
|
// magic value to convert fbx times to seconds
|
||||||
|
@ -3090,7 +3089,7 @@ void Converter::InterpolateKeys( aiQuatKey* valOut, const KeyTimeList& keys, con
|
||||||
ai_assert( keys.size() );
|
ai_assert( keys.size() );
|
||||||
ai_assert( valOut );
|
ai_assert( valOut );
|
||||||
|
|
||||||
boost::scoped_array<aiVectorKey> temp( new aiVectorKey[ keys.size() ] );
|
std::unique_ptr<aiVectorKey[]> temp( new aiVectorKey[ keys.size() ] );
|
||||||
InterpolateKeys( temp.get(), keys, inputs, def_value, maxTime, minTime );
|
InterpolateKeys( temp.get(), keys, inputs, def_value, maxTime, minTime );
|
||||||
|
|
||||||
aiMatrix4x4 m;
|
aiMatrix4x4 m;
|
||||||
|
|
|
@ -50,7 +50,6 @@ 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 <boost/foreach.hpp>
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -107,7 +106,7 @@ Cluster::Cluster(uint64_t id, const Element& element, const Document& doc, const
|
||||||
|
|
||||||
// read assigned node
|
// read assigned node
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Model");
|
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Model");
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
const Model* const mod = ProcessSimpleConnection<Model>(*con, false, "Model -> Cluster", element);
|
const Model* const mod = ProcessSimpleConnection<Model>(*con, false, "Model -> Cluster", element);
|
||||||
if(mod) {
|
if(mod) {
|
||||||
node = mod;
|
node = mod;
|
||||||
|
@ -143,7 +142,7 @@ Skin::Skin(uint64_t id, const Element& element, const Document& doc, const std::
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer");
|
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer");
|
||||||
|
|
||||||
clusters.reserve(conns.size());
|
clusters.reserve(conns.size());
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
|
|
||||||
const Cluster* const cluster = ProcessSimpleConnection<Cluster>(*con, false, "Cluster -> Skin", element);
|
const Cluster* const cluster = ProcessSimpleConnection<Cluster>(*con, false, "Cluster -> Skin", element);
|
||||||
if(cluster) {
|
if(cluster) {
|
||||||
|
|
|
@ -53,8 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXDocumentUtil.h"
|
#include "FBXDocumentUtil.h"
|
||||||
#include "FBXProperties.h"
|
#include "FBXProperties.h"
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <memory>
|
||||||
#include <boost/make_shared.hpp>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,7 +248,7 @@ Object::~Object()
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
FileGlobalSettings::FileGlobalSettings(const Document& doc, boost::shared_ptr<const PropertyTable> props)
|
FileGlobalSettings::FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props)
|
||||||
: props(props)
|
: props(props)
|
||||||
, doc(doc)
|
, doc(doc)
|
||||||
{
|
{
|
||||||
|
@ -290,11 +289,11 @@ Document::Document(const Parser& parser, const ImportSettings& settings)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Document::~Document()
|
Document::~Document()
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(ObjectMap::value_type& v, objects) {
|
for(ObjectMap::value_type& v : objects) {
|
||||||
delete v.second;
|
delete v.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(ConnectionMap::value_type& v, src_connections) {
|
for(ConnectionMap::value_type& v : src_connections) {
|
||||||
delete v.second;
|
delete v.second;
|
||||||
}
|
}
|
||||||
// |dest_connections| contain the same Connection objects as the |src_connections|
|
// |dest_connections| contain the same Connection objects as the |src_connections|
|
||||||
|
@ -359,11 +358,11 @@ void Document::ReadGlobalSettings()
|
||||||
if(!ehead || !ehead->Compound()) {
|
if(!ehead || !ehead->Compound()) {
|
||||||
DOMWarning("no GlobalSettings dictionary found");
|
DOMWarning("no GlobalSettings dictionary found");
|
||||||
|
|
||||||
globals.reset(new FileGlobalSettings(*this, boost::make_shared<const PropertyTable>()));
|
globals.reset(new FileGlobalSettings(*this, std::make_shared<const PropertyTable>()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<const PropertyTable> props = GetPropertyTable(*this, "", *ehead, *ehead->Compound(), true);
|
std::shared_ptr<const PropertyTable> props = GetPropertyTable(*this, "", *ehead, *ehead->Compound(), true);
|
||||||
|
|
||||||
if(!props) {
|
if(!props) {
|
||||||
DOMError("GlobalSettings dictionary contains no property table");
|
DOMError("GlobalSettings dictionary contains no property table");
|
||||||
|
@ -388,7 +387,7 @@ void Document::ReadObjects()
|
||||||
objects[0] = new LazyObject(0L, *eobjects, *this);
|
objects[0] = new LazyObject(0L, *eobjects, *this);
|
||||||
|
|
||||||
const Scope& sobjects = *eobjects->Compound();
|
const Scope& sobjects = *eobjects->Compound();
|
||||||
BOOST_FOREACH(const ElementMap::value_type& el, sobjects.Elements()) {
|
for(const ElementMap::value_type& el : sobjects.Elements()) {
|
||||||
|
|
||||||
// extract ID
|
// extract ID
|
||||||
const TokenList& tok = el.second->Tokens();
|
const TokenList& tok = el.second->Tokens();
|
||||||
|
@ -470,8 +469,8 @@ void Document::ReadPropertyTemplates()
|
||||||
|
|
||||||
const Element* Properties70 = (*sc)["Properties70"];
|
const Element* Properties70 = (*sc)["Properties70"];
|
||||||
if(Properties70) {
|
if(Properties70) {
|
||||||
boost::shared_ptr<const PropertyTable> props = boost::make_shared<const PropertyTable>(
|
std::shared_ptr<const PropertyTable> props = std::make_shared<const PropertyTable>(
|
||||||
*Properties70,boost::shared_ptr<const PropertyTable>(static_cast<const PropertyTable*>(NULL))
|
*Properties70,std::shared_ptr<const PropertyTable>(static_cast<const PropertyTable*>(NULL))
|
||||||
);
|
);
|
||||||
|
|
||||||
templates[oname+"."+pname] = props;
|
templates[oname+"."+pname] = props;
|
||||||
|
@ -538,7 +537,7 @@ const std::vector<const AnimationStack*>& Document::AnimationStacks() const
|
||||||
}
|
}
|
||||||
|
|
||||||
animationStacksResolved.reserve(animationStacks.size());
|
animationStacksResolved.reserve(animationStacks.size());
|
||||||
BOOST_FOREACH(uint64_t id, animationStacks) {
|
for(uint64_t id : animationStacks) {
|
||||||
LazyObject* const lazy = GetObject(id);
|
LazyObject* const lazy = GetObject(id);
|
||||||
const AnimationStack* stack;
|
const AnimationStack* stack;
|
||||||
if(!lazy || !(stack = lazy->Get<AnimationStack>())) {
|
if(!lazy || !(stack = lazy->Get<AnimationStack>())) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ public:
|
||||||
private:
|
private:
|
||||||
const Document& doc;
|
const Document& doc;
|
||||||
const Element& element;
|
const Element& element;
|
||||||
boost::scoped_ptr<const Object> object;
|
std::unique_ptr<const Object> object;
|
||||||
|
|
||||||
const uint64_t id;
|
const uint64_t id;
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ private:
|
||||||
|
|
||||||
std::string shading;
|
std::string shading;
|
||||||
std::string culling;
|
std::string culling;
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** DOM class for generic FBX textures */
|
/** DOM class for generic FBX textures */
|
||||||
|
@ -541,7 +541,7 @@ private:
|
||||||
std::string relativeFileName;
|
std::string relativeFileName;
|
||||||
std::string fileName;
|
std::string fileName;
|
||||||
std::string alphaSource;
|
std::string alphaSource;
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
|
|
||||||
unsigned int crop[4];
|
unsigned int crop[4];
|
||||||
|
|
||||||
|
@ -663,7 +663,7 @@ private:
|
||||||
std::string type;
|
std::string type;
|
||||||
std::string relativeFileName;
|
std::string relativeFileName;
|
||||||
std::string fileName;
|
std::string fileName;
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
|
|
||||||
uint32_t contentLength;
|
uint32_t contentLength;
|
||||||
uint8_t* content;
|
uint8_t* content;
|
||||||
|
@ -700,7 +700,7 @@ public:
|
||||||
private:
|
private:
|
||||||
std::string shading;
|
std::string shading;
|
||||||
bool multilayer;
|
bool multilayer;
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
|
|
||||||
TextureMap textures;
|
TextureMap textures;
|
||||||
LayeredTextureMap layeredTextures;
|
LayeredTextureMap layeredTextures;
|
||||||
|
@ -791,7 +791,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Object* target;
|
const Object* target;
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
mutable AnimationCurveMap curves;
|
mutable AnimationCurveMap curves;
|
||||||
|
|
||||||
std::string prop;
|
std::string prop;
|
||||||
|
@ -819,7 +819,7 @@ public:
|
||||||
AnimationCurveNodeList Nodes(const char* const * target_prop_whitelist = NULL, size_t whitelist_size = 0) const;
|
AnimationCurveNodeList Nodes(const char* const * target_prop_whitelist = NULL, size_t whitelist_size = 0) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
const Document& doc;
|
const Document& doc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -850,7 +850,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
AnimationLayerList layers;
|
AnimationLayerList layers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -868,7 +868,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<float> WeightArray;
|
typedef std::vector<float> WeightArray;
|
||||||
|
@ -1002,7 +1002,7 @@ public:
|
||||||
// up to many thousands of objects (most of which we never use),
|
// up to many thousands of objects (most of which we never use),
|
||||||
// so the memory overhead for them should be kept at a minimum.
|
// so the memory overhead for them should be kept at a minimum.
|
||||||
typedef std::map<uint64_t, LazyObject*> ObjectMap;
|
typedef std::map<uint64_t, LazyObject*> ObjectMap;
|
||||||
typedef std::fbx_unordered_map<std::string, boost::shared_ptr<const PropertyTable> > PropertyTemplateMap;
|
typedef std::fbx_unordered_map<std::string, std::shared_ptr<const PropertyTable> > PropertyTemplateMap;
|
||||||
|
|
||||||
|
|
||||||
typedef std::multimap<uint64_t, const Connection*> ConnectionMap;
|
typedef std::multimap<uint64_t, const Connection*> ConnectionMap;
|
||||||
|
@ -1013,7 +1013,7 @@ typedef std::multimap<uint64_t, const Connection*> ConnectionMap;
|
||||||
class FileGlobalSettings
|
class FileGlobalSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FileGlobalSettings(const Document& doc, boost::shared_ptr<const PropertyTable> props);
|
FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props);
|
||||||
~FileGlobalSettings();
|
~FileGlobalSettings();
|
||||||
|
|
||||||
const PropertyTable& Props() const {
|
const PropertyTable& Props() const {
|
||||||
|
@ -1065,7 +1065,7 @@ public:
|
||||||
fbx_simple_property(CustomFrameRate, float, -1.0f)
|
fbx_simple_property(CustomFrameRate, float, -1.0f)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<const PropertyTable> props;
|
std::shared_ptr<const PropertyTable> props;
|
||||||
const Document& doc;
|
const Document& doc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1174,7 +1174,7 @@ private:
|
||||||
std::vector<uint64_t> animationStacks;
|
std::vector<uint64_t> animationStacks;
|
||||||
mutable std::vector<const AnimationStack*> animationStacksResolved;
|
mutable std::vector<const AnimationStack*> animationStacksResolved;
|
||||||
|
|
||||||
boost::scoped_ptr<FileGlobalSettings> globals;
|
std::unique_ptr<FileGlobalSettings> globals;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace FBX
|
} // Namespace FBX
|
||||||
|
|
|
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXUtil.h"
|
#include "FBXUtil.h"
|
||||||
#include "FBXDocumentUtil.h"
|
#include "FBXDocumentUtil.h"
|
||||||
#include "FBXProperties.h"
|
#include "FBXProperties.h"
|
||||||
#include <boost/make_shared.hpp>
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -96,14 +96,14 @@ void DOMWarning(const std::string& message, const Element* element /*= NULL*/)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// fetch a property table and the corresponding property template
|
// fetch a property table and the corresponding property template
|
||||||
boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc,
|
std::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc,
|
||||||
const std::string& templateName,
|
const std::string& templateName,
|
||||||
const Element &element,
|
const Element &element,
|
||||||
const Scope& sc,
|
const Scope& sc,
|
||||||
bool no_warn /*= false*/)
|
bool no_warn /*= false*/)
|
||||||
{
|
{
|
||||||
const Element* const Properties70 = sc["Properties70"];
|
const Element* const Properties70 = sc["Properties70"];
|
||||||
boost::shared_ptr<const PropertyTable> templateProps = boost::shared_ptr<const PropertyTable>(
|
std::shared_ptr<const PropertyTable> templateProps = std::shared_ptr<const PropertyTable>(
|
||||||
static_cast<const PropertyTable*>(NULL));
|
static_cast<const PropertyTable*>(NULL));
|
||||||
|
|
||||||
if(templateName.length()) {
|
if(templateName.length()) {
|
||||||
|
@ -121,10 +121,10 @@ boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc,
|
||||||
return templateProps;
|
return templateProps;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return boost::make_shared<const PropertyTable>();
|
return std::make_shared<const PropertyTable>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return boost::make_shared<const PropertyTable>(*Properties70,templateProps);
|
return std::make_shared<const PropertyTable>(*Properties70,templateProps);
|
||||||
}
|
}
|
||||||
} // !Util
|
} // !Util
|
||||||
} // !FBX
|
} // !FBX
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "../include/assimp/defs.h"
|
#include "../include/assimp/defs.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
#include "FBXDocument.h"
|
#include "FBXDocument.h"
|
||||||
|
|
||||||
struct Token;
|
struct Token;
|
||||||
|
@ -67,7 +67,7 @@ void DOMWarning(const std::string& message, const Element* element = NULL);
|
||||||
|
|
||||||
|
|
||||||
// fetch a property table and the corresponding property template
|
// fetch a property table and the corresponding property template
|
||||||
boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc,
|
std::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc,
|
||||||
const std::string& templateName,
|
const std::string& templateName,
|
||||||
const Element &element,
|
const Element &element,
|
||||||
const Scope& sc,
|
const Scope& sc,
|
||||||
|
|
|
@ -46,7 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <boost/tuple/tuple.hpp>
|
|
||||||
|
|
||||||
#include "FBXImporter.h"
|
#include "FBXImporter.h"
|
||||||
|
|
||||||
|
@ -142,7 +141,7 @@ void FBXImporter::SetupProperties(const Importer* pImp)
|
||||||
void FBXImporter::InternReadFile( const std::string& pFile,
|
void FBXImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
|
std::unique_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
ThrowException("Could not open file for reading");
|
ThrowException("Could not open file for reading");
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXDocumentUtil.h"
|
#include "FBXDocumentUtil.h"
|
||||||
#include "FBXProperties.h"
|
#include "FBXProperties.h"
|
||||||
#include "ByteSwapper.h"
|
#include "ByteSwapper.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -96,7 +95,7 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
|
||||||
|
|
||||||
// resolve texture links
|
// resolve texture links
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
|
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
|
|
||||||
// texture link to properties, not objects
|
// texture link to properties, not objects
|
||||||
if (!con->PropertyName().length()) {
|
if (!con->PropertyName().length()) {
|
||||||
|
@ -205,7 +204,7 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
|
||||||
// resolve video links
|
// resolve video links
|
||||||
if(doc.Settings().readTextures) {
|
if(doc.Settings().readTextures) {
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
|
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
const Object* const ob = con->SourceObject();
|
const Object* const ob = con->SourceObject();
|
||||||
if(!ob) {
|
if(!ob) {
|
||||||
DOMWarning("failed to read source object for texture link, ignoring",&element);
|
DOMWarning("failed to read source object for texture link, ignoring",&element);
|
||||||
|
|
|
@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXImporter.h"
|
#include "FBXImporter.h"
|
||||||
#include "FBXImportSettings.h"
|
#include "FBXImportSettings.h"
|
||||||
#include "FBXDocumentUtil.h"
|
#include "FBXDocumentUtil.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -65,7 +64,7 @@ Geometry::Geometry(uint64_t id, const Element& element, const std::string& name,
|
||||||
, skin()
|
, skin()
|
||||||
{
|
{
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer");
|
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer");
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
const Skin* const sk = ProcessSimpleConnection<Skin>(*con, false, "Skin -> Geometry", element);
|
const Skin* const sk = ProcessSimpleConnection<Skin>(*con, false, "Skin -> Geometry", element);
|
||||||
if(sk) {
|
if(sk) {
|
||||||
skin = sk;
|
skin = sk;
|
||||||
|
@ -130,7 +129,7 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
|
||||||
// generate output vertices, computing an adjacency table to
|
// generate output vertices, computing an adjacency table to
|
||||||
// preserve the mapping from fbx indices to *this* indexing.
|
// preserve the mapping from fbx indices to *this* indexing.
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
BOOST_FOREACH(int index, tempFaces) {
|
for(int index : tempFaces) {
|
||||||
const int absi = index < 0 ? (-index - 1) : index;
|
const int absi = index < 0 ? (-index - 1) : index;
|
||||||
if(static_cast<size_t>(absi) >= vertex_count) {
|
if(static_cast<size_t>(absi) >= vertex_count) {
|
||||||
DOMError("polygon vertex index out of range",&PolygonVertexIndex);
|
DOMError("polygon vertex index out of range",&PolygonVertexIndex);
|
||||||
|
@ -156,7 +155,7 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
BOOST_FOREACH(int index, tempFaces) {
|
for(int index : tempFaces) {
|
||||||
const int absi = index < 0 ? (-index - 1) : index;
|
const int absi = index < 0 ? (-index - 1) : index;
|
||||||
mappings[mapping_offsets[absi] + mapping_counts[absi]++] = cursor++;
|
mappings[mapping_offsets[absi] + mapping_counts[absi]++] = cursor++;
|
||||||
}
|
}
|
||||||
|
@ -494,7 +493,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int next = 0;
|
unsigned int next = 0;
|
||||||
BOOST_FOREACH(int i, uvIndices) {
|
for(int i : uvIndices) {
|
||||||
if (static_cast<size_t>(i) >= tempData.size()) {
|
if (static_cast<size_t>(i) >= tempData.size()) {
|
||||||
DOMError("index out of range",&GetRequiredElement(source,indexDataElementName));
|
DOMError("index out of range",&GetRequiredElement(source,indexDataElementName));
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ 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 <boost/foreach.hpp>
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -98,7 +97,7 @@ void Model::ResolveLinks(const Element& element, const Document& doc)
|
||||||
materials.reserve(conns.size());
|
materials.reserve(conns.size());
|
||||||
geometry.reserve(conns.size());
|
geometry.reserve(conns.size());
|
||||||
attributes.reserve(conns.size());
|
attributes.reserve(conns.size());
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
for(const Connection* con : conns) {
|
||||||
|
|
||||||
// material and geometry links should be Object-Object connections
|
// material and geometry links should be Object-Object connections
|
||||||
if (con->PropertyName().length()) {
|
if (con->PropertyName().length()) {
|
||||||
|
@ -139,7 +138,7 @@ void Model::ResolveLinks(const Element& element, const Document& doc)
|
||||||
bool Model::IsNull() const
|
bool Model::IsNull() const
|
||||||
{
|
{
|
||||||
const std::vector<const NodeAttribute*>& attrs = GetAttributes();
|
const std::vector<const NodeAttribute*>& attrs = GetAttributes();
|
||||||
BOOST_FOREACH(const NodeAttribute* att, attrs) {
|
for(const NodeAttribute* att : attrs) {
|
||||||
|
|
||||||
const Null* null_tag = dynamic_cast<const Null*>(att);
|
const Null* null_tag = dynamic_cast<const Null*>(att);
|
||||||
if(null_tag) {
|
if(null_tag) {
|
||||||
|
|
|
@ -58,7 +58,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "ParsingUtils.h"
|
#include "ParsingUtils.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include "ByteSwapper.h"
|
#include "ByteSwapper.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -208,7 +207,7 @@ Scope::Scope(Parser& parser,bool topLevel)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Scope::~Scope()
|
Scope::~Scope()
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(ElementMap::value_type& v, elements) {
|
for(ElementMap::value_type& v : elements) {
|
||||||
delete v.second;
|
delete v.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "LogAux.h"
|
#include "LogAux.h"
|
||||||
|
|
||||||
#include "FBXCompileConfig.h"
|
#include "FBXCompileConfig.h"
|
||||||
|
@ -105,7 +105,7 @@ private:
|
||||||
|
|
||||||
const Token& key_token;
|
const Token& key_token;
|
||||||
TokenList tokens;
|
TokenList tokens;
|
||||||
boost::scoped_ptr<Scope> compound;
|
std::unique_ptr<Scope> compound;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ private:
|
||||||
|
|
||||||
TokenPtr last, current;
|
TokenPtr last, current;
|
||||||
TokenList::const_iterator cursor;
|
TokenList::const_iterator cursor;
|
||||||
boost::scoped_ptr<Scope> root;
|
std::unique_ptr<Scope> root;
|
||||||
|
|
||||||
const bool is_binary;
|
const bool is_binary;
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXDocument.h"
|
#include "FBXDocument.h"
|
||||||
#include "FBXDocumentUtil.h"
|
#include "FBXDocumentUtil.h"
|
||||||
#include "FBXProperties.h"
|
#include "FBXProperties.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -140,12 +139,12 @@ PropertyTable::PropertyTable()
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
PropertyTable::PropertyTable(const Element& element, boost::shared_ptr<const PropertyTable> templateProps)
|
PropertyTable::PropertyTable(const Element& element, std::shared_ptr<const PropertyTable> templateProps)
|
||||||
: templateProps(templateProps)
|
: templateProps(templateProps)
|
||||||
, element(&element)
|
, element(&element)
|
||||||
{
|
{
|
||||||
const Scope& scope = GetRequiredScope(element);
|
const Scope& scope = GetRequiredScope(element);
|
||||||
BOOST_FOREACH(const ElementMap::value_type& v, scope.Elements()) {
|
for(const ElementMap::value_type& v : scope.Elements()) {
|
||||||
if(v.first != "P") {
|
if(v.first != "P") {
|
||||||
DOMWarning("expected only P elements in property table",v.second);
|
DOMWarning("expected only P elements in property table",v.second);
|
||||||
continue;
|
continue;
|
||||||
|
@ -171,7 +170,7 @@ PropertyTable::PropertyTable(const Element& element, boost::shared_ptr<const Pro
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
PropertyTable::~PropertyTable()
|
PropertyTable::~PropertyTable()
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(PropertyMap::value_type& v, props) {
|
for(PropertyMap::value_type& v : props) {
|
||||||
delete v.second;
|
delete v.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +208,7 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const
|
||||||
DirectPropertyMap result;
|
DirectPropertyMap result;
|
||||||
|
|
||||||
// Loop through all the lazy properties (which is all the properties)
|
// Loop through all the lazy properties (which is all the properties)
|
||||||
BOOST_FOREACH(const LazyPropertyMap::value_type& element, lazyProps) {
|
for(const LazyPropertyMap::value_type& element : lazyProps) {
|
||||||
|
|
||||||
// Skip parsed properties
|
// Skip parsed properties
|
||||||
if (props.end() != props.find(element.first)) continue;
|
if (props.end() != props.find(element.first)) continue;
|
||||||
|
@ -217,7 +216,7 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const
|
||||||
// Read the element's value.
|
// Read the element's value.
|
||||||
// Wrap the naked pointer (since the call site is required to acquire ownership)
|
// Wrap the naked pointer (since the call site is required to acquire ownership)
|
||||||
// std::unique_ptr from C++11 would be preferred both as a wrapper and a return value.
|
// std::unique_ptr from C++11 would be preferred both as a wrapper and a return value.
|
||||||
boost::shared_ptr<Property> prop = boost::shared_ptr<Property>(ReadTypedProperty(*element.second));
|
std::shared_ptr<Property> prop = std::shared_ptr<Property>(ReadTypedProperty(*element.second));
|
||||||
|
|
||||||
// Element could not be read. Skip it.
|
// Element could not be read. Skip it.
|
||||||
if (!prop) continue;
|
if (!prop) continue;
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "FBXCompileConfig.h"
|
#include "FBXCompileConfig.h"
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -97,7 +97,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef std::fbx_unordered_map<std::string,boost::shared_ptr<Property> > DirectPropertyMap;
|
typedef std::fbx_unordered_map<std::string,std::shared_ptr<Property> > DirectPropertyMap;
|
||||||
typedef std::fbx_unordered_map<std::string,const Property*> PropertyMap;
|
typedef std::fbx_unordered_map<std::string,const Property*> PropertyMap;
|
||||||
typedef std::fbx_unordered_map<std::string,const Element*> LazyPropertyMap;
|
typedef std::fbx_unordered_map<std::string,const Element*> LazyPropertyMap;
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class PropertyTable
|
||||||
public:
|
public:
|
||||||
// in-memory property table with no source element
|
// in-memory property table with no source element
|
||||||
PropertyTable();
|
PropertyTable();
|
||||||
PropertyTable(const Element& element, boost::shared_ptr<const PropertyTable> templateProps);
|
PropertyTable(const Element& element, std::shared_ptr<const PropertyTable> templateProps);
|
||||||
~PropertyTable();
|
~PropertyTable();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -129,7 +129,7 @@ public:
|
||||||
private:
|
private:
|
||||||
LazyPropertyMap lazyProps;
|
LazyPropertyMap lazyProps;
|
||||||
mutable PropertyMap props;
|
mutable PropertyMap props;
|
||||||
const boost::shared_ptr<const PropertyTable> templateProps;
|
const std::shared_ptr<const PropertyTable> templateProps;
|
||||||
const Element* const element;
|
const Element* const element;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_FBX_TOKENIZER_H
|
#ifndef INCLUDED_AI_FBX_TOKENIZER_H
|
||||||
#define INCLUDED_AI_FBX_TOKENIZER_H
|
#define INCLUDED_AI_FBX_TOKENIZER_H
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
#include "FBXCompileConfig.h"
|
#include "FBXCompileConfig.h"
|
||||||
#include "../include/assimp/ai_assert.h"
|
#include "../include/assimp/ai_assert.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
#include "FindInstancesProcess.h"
|
#include "FindInstancesProcess.h"
|
||||||
#include <boost/scoped_array.hpp>
|
#include <memory>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -126,8 +126,8 @@ void FindInstancesProcess::Execute( aiScene* pScene)
|
||||||
// have several thousand small meshes. That's too much for a brute
|
// have several thousand small meshes. That's too much for a brute
|
||||||
// everyone-against-everyone check involving up to 10 comparisons
|
// everyone-against-everyone check involving up to 10 comparisons
|
||||||
// each.
|
// each.
|
||||||
boost::scoped_array<uint64_t> hashes (new uint64_t[pScene->mNumMeshes]);
|
std::unique_ptr<uint64_t[]> hashes (new uint64_t[pScene->mNumMeshes]);
|
||||||
boost::scoped_array<unsigned int> remapping (new unsigned int[pScene->mNumMeshes]);
|
std::unique_ptr<unsigned int[]> remapping (new unsigned int[pScene->mNumMeshes]);
|
||||||
|
|
||||||
unsigned int numMeshesOut = 0;
|
unsigned int numMeshesOut = 0;
|
||||||
for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
|
for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
|
||||||
|
@ -219,8 +219,8 @@ void FindInstancesProcess::Execute( aiScene* pScene)
|
||||||
|
|
||||||
// For completeness ... compare even the index buffers for equality
|
// For completeness ... compare even the index buffers for equality
|
||||||
// face order & winding order doesn't care. Input data is in verbose format.
|
// face order & winding order doesn't care. Input data is in verbose format.
|
||||||
boost::scoped_array<unsigned int> ftbl_orig(new unsigned int[orig->mNumVertices]);
|
std::unique_ptr<unsigned int[]> ftbl_orig(new unsigned int[orig->mNumVertices]);
|
||||||
boost::scoped_array<unsigned int> ftbl_inst(new unsigned int[orig->mNumVertices]);
|
std::unique_ptr<unsigned int[]> ftbl_inst(new unsigned int[orig->mNumVertices]);
|
||||||
|
|
||||||
for (unsigned int tt = 0; tt < orig->mNumFaces;++tt) {
|
for (unsigned int tt = 0; tt < orig->mNumFaces;++tt) {
|
||||||
aiFace& f = orig->mFaces[tt];
|
aiFace& f = orig->mFaces[tt];
|
||||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "HMPLoader.h"
|
#include "HMPLoader.h"
|
||||||
#include "MD2FileData.h"
|
#include "MD2FileData.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
@ -114,7 +114,7 @@ void HMPImporter::InternReadFile( const std::string& pFile,
|
||||||
{
|
{
|
||||||
pScene = _pScene;
|
pScene = _pScene;
|
||||||
pIOHandler = _pIOHandler;
|
pIOHandler = _pIOHandler;
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <tuple>
|
||||||
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -413,7 +413,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
|
||||||
n.Normalize();
|
n.Normalize();
|
||||||
|
|
||||||
// obtain the polygonal bounding volume
|
// obtain the polygonal bounding volume
|
||||||
boost::shared_ptr<TempMesh> profile = boost::shared_ptr<TempMesh>(new TempMesh());
|
std::shared_ptr<TempMesh> profile = std::shared_ptr<TempMesh>(new TempMesh());
|
||||||
if(!ProcessCurve(hs->PolygonalBoundary, *profile.get(), conv)) {
|
if(!ProcessCurve(hs->PolygonalBoundary, *profile.get(), conv)) {
|
||||||
IFCImporter::LogError("expected valid polyline for boundary of boolean halfspace");
|
IFCImporter::LogError("expected valid polyline for boundary of boolean halfspace");
|
||||||
return;
|
return;
|
||||||
|
@ -510,7 +510,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
|
||||||
if( !blackside.empty() )
|
if( !blackside.empty() )
|
||||||
{
|
{
|
||||||
// poly edge index, intersection point, edge index in boundary poly
|
// poly edge index, intersection point, edge index in boundary poly
|
||||||
std::vector<boost::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->verts);
|
||||||
bool isCurrentlyInside = startedInside;
|
bool isCurrentlyInside = startedInside;
|
||||||
|
|
||||||
|
@ -542,7 +542,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
|
||||||
}
|
}
|
||||||
// now add them to the list of intersections
|
// now add them to the list of intersections
|
||||||
for( size_t b = 0; b < intersected_boundary.size(); ++b )
|
for( size_t b = 0; b < intersected_boundary.size(); ++b )
|
||||||
intersections.push_back(boost::make_tuple(a, proj_inv * intersected_boundary[b].second, intersected_boundary[b].first));
|
intersections.push_back(std::make_tuple(a, proj_inv * intersected_boundary[b].second, intersected_boundary[b].first));
|
||||||
|
|
||||||
// and calculate our new inside/outside state
|
// and calculate our new inside/outside state
|
||||||
if( intersected_boundary.size() & 1 )
|
if( intersected_boundary.size() & 1 )
|
||||||
|
@ -568,12 +568,12 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
|
||||||
// Filter pairs of out->in->out that lie too close to each other.
|
// Filter pairs of out->in->out that lie too close to each other.
|
||||||
for( size_t a = 0; intersections.size() > 0 && a < intersections.size() - 1; /**/ )
|
for( size_t a = 0; intersections.size() > 0 && a < intersections.size() - 1; /**/ )
|
||||||
{
|
{
|
||||||
if( (intersections[a].get<1>() - intersections[(a + 1) % intersections.size()].get<1>()).SquareLength() < 1e-10 )
|
if( (std::get<1>(intersections[a]) - std::get<1>(intersections[(a + 1) % intersections.size()])).SquareLength() < 1e-10 )
|
||||||
intersections.erase(intersections.begin() + a, intersections.begin() + a + 2);
|
intersections.erase(intersections.begin() + a, intersections.begin() + a + 2);
|
||||||
else
|
else
|
||||||
a++;
|
a++;
|
||||||
}
|
}
|
||||||
if( intersections.size() > 1 && (intersections.back().get<1>() - intersections.front().get<1>()).SquareLength() < 1e-10 )
|
if( intersections.size() > 1 && (std::get<1>(intersections.back()) - std::get<1>(intersections.front())).SquareLength() < 1e-10 )
|
||||||
{
|
{
|
||||||
intersections.pop_back(); intersections.erase(intersections.begin());
|
intersections.pop_back(); intersections.erase(intersections.begin());
|
||||||
}
|
}
|
||||||
|
@ -619,23 +619,23 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
|
||||||
while( true )
|
while( true )
|
||||||
{
|
{
|
||||||
ai_assert(intersections.size() > currentIntersecIdx + 1);
|
ai_assert(intersections.size() > currentIntersecIdx + 1);
|
||||||
boost::tuple<size_t, IfcVector3, size_t> currintsec = intersections[currentIntersecIdx + 0];
|
std::tuple<size_t, IfcVector3, size_t> currintsec = intersections[currentIntersecIdx + 0];
|
||||||
boost::tuple<size_t, IfcVector3, size_t> nextintsec = intersections[currentIntersecIdx + 1];
|
std::tuple<size_t, IfcVector3, size_t> nextintsec = intersections[currentIntersecIdx + 1];
|
||||||
intersections.erase(intersections.begin() + currentIntersecIdx, intersections.begin() + currentIntersecIdx + 2);
|
intersections.erase(intersections.begin() + currentIntersecIdx, intersections.begin() + currentIntersecIdx + 2);
|
||||||
|
|
||||||
// we start with an in->out intersection
|
// we start with an in->out intersection
|
||||||
resultpoly.push_back(currintsec.get<1>());
|
resultpoly.push_back(std::get<1>(currintsec));
|
||||||
// climb along the polygon to the next intersection, which should be an out->in
|
// climb along the polygon to the next intersection, which should be an out->in
|
||||||
size_t numPolyPoints = (currintsec.get<0>() > nextintsec.get<0>() ? blackside.size() : 0)
|
size_t numPolyPoints = (std::get<0>(currintsec) > std::get<0>(nextintsec) ? blackside.size() : 0)
|
||||||
+ nextintsec.get<0>() - currintsec.get<0>();
|
+ std::get<0>(nextintsec) - std::get<0>(currintsec);
|
||||||
for( size_t a = 1; a <= numPolyPoints; ++a )
|
for( size_t a = 1; a <= numPolyPoints; ++a )
|
||||||
resultpoly.push_back(blackside[(currintsec.get<0>() + a) % blackside.size()]);
|
resultpoly.push_back(blackside[(std::get<0>(currintsec) + a) % blackside.size()]);
|
||||||
// put the out->in intersection
|
// put the out->in intersection
|
||||||
resultpoly.push_back(nextintsec.get<1>());
|
resultpoly.push_back(std::get<1>(nextintsec));
|
||||||
|
|
||||||
// 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 * nextintsec.get<1>();
|
IfcVector3 startingPoint = proj * std::get<1>(nextintsec);
|
||||||
size_t currentBoundaryEdgeIdx = (nextintsec.get<2>() + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size();
|
size_t currentBoundaryEdgeIdx = (std::get<2>(nextintsec) + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size();
|
||||||
size_t nextIntsecIdx = SIZE_MAX;
|
size_t nextIntsecIdx = SIZE_MAX;
|
||||||
while( nextIntsecIdx == SIZE_MAX )
|
while( nextIntsecIdx == SIZE_MAX )
|
||||||
{
|
{
|
||||||
|
@ -676,7 +676,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
|
||||||
// to marching along the poly border from that intersection point
|
// to marching along the poly border from that intersection point
|
||||||
for( size_t a = 0; a < intersections.size(); a += 2 )
|
for( size_t a = 0; a < intersections.size(); a += 2 )
|
||||||
{
|
{
|
||||||
dirToThatPoint = proj * intersections[a].get<1>() - startingPoint;
|
dirToThatPoint = proj * std::get<1>(intersections[a]) - startingPoint;
|
||||||
tpt = dirToThatPoint * dirAtPolyPlane;
|
tpt = dirToThatPoint * dirAtPolyPlane;
|
||||||
if( tpt > -1e-6 && tpt <= t && (dirToThatPoint - tpt * dirAtPolyPlane).SquareLength() < 1e-10 )
|
if( tpt > -1e-6 && tpt <= t && (dirToThatPoint - tpt * dirAtPolyPlane).SquareLength() < 1e-10 )
|
||||||
{
|
{
|
||||||
|
@ -730,17 +730,17 @@ void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, T
|
||||||
// operand should be near-planar. Luckily, this is usually the case in Ifc
|
// operand should be near-planar. Luckily, this is usually the case in Ifc
|
||||||
// buildings.
|
// buildings.
|
||||||
|
|
||||||
boost::shared_ptr<TempMesh> meshtmp = boost::shared_ptr<TempMesh>(new TempMesh());
|
std::shared_ptr<TempMesh> meshtmp = std::shared_ptr<TempMesh>(new TempMesh());
|
||||||
ProcessExtrudedAreaSolid(*as,*meshtmp,conv,false);
|
ProcessExtrudedAreaSolid(*as,*meshtmp,conv,false);
|
||||||
|
|
||||||
std::vector<TempOpening> openings(1, TempOpening(as,IfcVector3(0,0,0),meshtmp,boost::shared_ptr<TempMesh>()));
|
std::vector<TempOpening> openings(1, TempOpening(as,IfcVector3(0,0,0),meshtmp,std::shared_ptr<TempMesh>()));
|
||||||
|
|
||||||
result = first_operand;
|
result = first_operand;
|
||||||
|
|
||||||
TempMesh temp;
|
TempMesh temp;
|
||||||
|
|
||||||
std::vector<IfcVector3>::const_iterator vit = first_operand.verts.begin();
|
std::vector<IfcVector3>::const_iterator vit = first_operand.verts.begin();
|
||||||
BOOST_FOREACH(unsigned int pcount, first_operand.vertcnt) {
|
for(unsigned int pcount : first_operand.vertcnt) {
|
||||||
temp.Clear();
|
temp.Clear();
|
||||||
|
|
||||||
temp.verts.insert(temp.verts.end(), vit, vit + pcount);
|
temp.verts.insert(temp.verts.end(), vit, vit + pcount);
|
||||||
|
|
|
@ -229,7 +229,7 @@ private:
|
||||||
class CompositeCurve : public BoundedCurve
|
class CompositeCurve : public BoundedCurve
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef std::pair< boost::shared_ptr< BoundedCurve >, bool > CurveEntry;
|
typedef std::pair< std::shared_ptr< BoundedCurve >, bool > CurveEntry;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -239,10 +239,10 @@ public:
|
||||||
, total()
|
, total()
|
||||||
{
|
{
|
||||||
curves.reserve(entity.Segments.size());
|
curves.reserve(entity.Segments.size());
|
||||||
BOOST_FOREACH(const IfcCompositeCurveSegment& curveSegment,entity.Segments) {
|
for(const IfcCompositeCurveSegment& curveSegment :entity.Segments) {
|
||||||
// according to the specification, this must be a bounded curve
|
// according to the specification, this must be a bounded curve
|
||||||
boost::shared_ptr< Curve > cv(Curve::Convert(curveSegment.ParentCurve,conv));
|
std::shared_ptr< Curve > cv(Curve::Convert(curveSegment.ParentCurve,conv));
|
||||||
boost::shared_ptr< BoundedCurve > bc = boost::dynamic_pointer_cast<BoundedCurve>(cv);
|
std::shared_ptr< BoundedCurve > bc = std::dynamic_pointer_cast<BoundedCurve>(cv);
|
||||||
|
|
||||||
if (!bc) {
|
if (!bc) {
|
||||||
IFCImporter::LogError("expected segment of composite curve to be a bounded curve");
|
IFCImporter::LogError("expected segment of composite curve to be a bounded curve");
|
||||||
|
@ -271,7 +271,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcFloat acc = 0;
|
IfcFloat acc = 0;
|
||||||
BOOST_FOREACH(const CurveEntry& entry, curves) {
|
for(const CurveEntry& entry : curves) {
|
||||||
const ParamRange& range = entry.first->GetParametricRange();
|
const ParamRange& range = entry.first->GetParametricRange();
|
||||||
const IfcFloat delta = std::abs(range.second-range.first);
|
const IfcFloat delta = std::abs(range.second-range.first);
|
||||||
if (u < acc+delta) {
|
if (u < acc+delta) {
|
||||||
|
@ -290,7 +290,7 @@ public:
|
||||||
size_t cnt = 0;
|
size_t cnt = 0;
|
||||||
|
|
||||||
IfcFloat acc = 0;
|
IfcFloat acc = 0;
|
||||||
BOOST_FOREACH(const CurveEntry& entry, curves) {
|
for(const CurveEntry& entry : curves) {
|
||||||
const ParamRange& range = entry.first->GetParametricRange();
|
const ParamRange& range = entry.first->GetParametricRange();
|
||||||
const IfcFloat delta = std::abs(range.second-range.first);
|
const IfcFloat delta = std::abs(range.second-range.first);
|
||||||
if (a <= acc+delta && b >= acc) {
|
if (a <= acc+delta && b >= acc) {
|
||||||
|
@ -312,7 +312,7 @@ public:
|
||||||
const size_t cnt = EstimateSampleCount(a,b);
|
const size_t cnt = EstimateSampleCount(a,b);
|
||||||
out.verts.reserve(out.verts.size() + cnt);
|
out.verts.reserve(out.verts.size() + cnt);
|
||||||
|
|
||||||
BOOST_FOREACH(const CurveEntry& entry, curves) {
|
for(const CurveEntry& entry : curves) {
|
||||||
const size_t cnt = out.verts.size();
|
const size_t cnt = out.verts.size();
|
||||||
entry.first->SampleDiscrete(out);
|
entry.first->SampleDiscrete(out);
|
||||||
|
|
||||||
|
@ -346,9 +346,9 @@ public:
|
||||||
TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv)
|
TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv)
|
||||||
: BoundedCurve(entity,conv)
|
: BoundedCurve(entity,conv)
|
||||||
{
|
{
|
||||||
base = boost::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv));
|
base = std::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv));
|
||||||
|
|
||||||
typedef boost::shared_ptr<const STEP::EXPRESS::DataType> Entry;
|
typedef std::shared_ptr<const STEP::EXPRESS::DataType> Entry;
|
||||||
|
|
||||||
// for some reason, trimmed curves can either specify a parametric value
|
// for some reason, trimmed curves can either specify a parametric value
|
||||||
// or a point on the curve, or both. And they can even specify which of the
|
// or a point on the curve, or both. And they can even specify which of the
|
||||||
|
@ -357,7 +357,7 @@ public:
|
||||||
// oh well.
|
// oh well.
|
||||||
bool have_param = false, have_point = false;
|
bool have_param = false, have_point = false;
|
||||||
IfcVector3 point;
|
IfcVector3 point;
|
||||||
BOOST_FOREACH(const Entry sel,entity.Trim1) {
|
for(const Entry sel :entity.Trim1) {
|
||||||
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
|
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
|
||||||
range.first = *r;
|
range.first = *r;
|
||||||
have_param = true;
|
have_param = true;
|
||||||
|
@ -374,7 +374,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
have_param = false, have_point = false;
|
have_param = false, have_point = false;
|
||||||
BOOST_FOREACH(const Entry sel,entity.Trim2) {
|
for(const Entry sel :entity.Trim2) {
|
||||||
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
|
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
|
||||||
range.second = *r;
|
range.second = *r;
|
||||||
have_param = true;
|
have_param = true;
|
||||||
|
@ -446,7 +446,7 @@ private:
|
||||||
IfcFloat maxval;
|
IfcFloat maxval;
|
||||||
bool agree_sense;
|
bool agree_sense;
|
||||||
|
|
||||||
boost::shared_ptr<const Curve> base;
|
std::shared_ptr<const Curve> base;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ public:
|
||||||
points.reserve(entity.Points.size());
|
points.reserve(entity.Points.size());
|
||||||
|
|
||||||
IfcVector3 t;
|
IfcVector3 t;
|
||||||
BOOST_FOREACH(const IfcCartesianPoint& cp, entity.Points) {
|
for(const IfcCartesianPoint& cp : entity.Points) {
|
||||||
ConvertCartesianPoint(t,cp);
|
ConvertCartesianPoint(t,cp);
|
||||||
points.push_back(t);
|
points.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "../contrib/poly2tri/poly2tri/poly2tri.h"
|
#include "../contrib/poly2tri/poly2tri/poly2tri.h"
|
||||||
#include "../contrib/clipper/clipper.hpp"
|
#include "../contrib/clipper/clipper.hpp"
|
||||||
#include <boost/make_shared.hpp>
|
#include <memory>
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ namespace Assimp {
|
||||||
bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData& /*conv*/)
|
bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData& /*conv*/)
|
||||||
{
|
{
|
||||||
size_t cnt = 0;
|
size_t cnt = 0;
|
||||||
BOOST_FOREACH(const IfcCartesianPoint& c, loop.Polygon) {
|
for(const IfcCartesianPoint& c : loop.Polygon) {
|
||||||
IfcVector3 tmp;
|
IfcVector3 tmp;
|
||||||
ConvertCartesianPoint(tmp,c);
|
ConvertCartesianPoint(tmp,c);
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
|
||||||
opening.extrusionDir = master_normal;
|
opening.extrusionDir = master_normal;
|
||||||
opening.solid = NULL;
|
opening.solid = NULL;
|
||||||
|
|
||||||
opening.profileMesh = boost::make_shared<TempMesh>();
|
opening.profileMesh = std::make_shared<TempMesh>();
|
||||||
opening.profileMesh->verts.reserve(*iit);
|
opening.profileMesh->verts.reserve(*iit);
|
||||||
opening.profileMesh->vertcnt.push_back(*iit);
|
opening.profileMesh->vertcnt.push_back(*iit);
|
||||||
|
|
||||||
|
@ -191,10 +191,10 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result, ConversionData& conv)
|
void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result, ConversionData& conv)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const IfcFace& face, fset.CfsFaces) {
|
for(const IfcFace& face : fset.CfsFaces) {
|
||||||
// size_t ob = -1, cnt = 0;
|
// size_t ob = -1, cnt = 0;
|
||||||
TempMesh meshout;
|
TempMesh meshout;
|
||||||
BOOST_FOREACH(const IfcFaceBound& bound, face.Bounds) {
|
for(const IfcFaceBound& bound : face.Bounds) {
|
||||||
|
|
||||||
if(const IfcPolyLoop* const polyloop = bound.Bound->ToPtr<IfcPolyLoop>()) {
|
if(const IfcPolyLoop* const polyloop = bound.Bound->ToPtr<IfcPolyLoop>()) {
|
||||||
if(ProcessPolyloop(*polyloop, meshout,conv)) {
|
if(ProcessPolyloop(*polyloop, meshout,conv)) {
|
||||||
|
@ -219,7 +219,7 @@ void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result,
|
||||||
|
|
||||||
/*if(!IsTrue(bound.Orientation)) {
|
/*if(!IsTrue(bound.Orientation)) {
|
||||||
size_t c = 0;
|
size_t c = 0;
|
||||||
BOOST_FOREACH(unsigned int& c, meshout.vertcnt) {
|
for(unsigned int& c : meshout.vertcnt) {
|
||||||
std::reverse(result.verts.begin() + cnt,result.verts.begin() + cnt + c);
|
std::reverse(result.verts.begin() + cnt,result.verts.begin() + cnt + c);
|
||||||
cnt += c;
|
cnt += c;
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
|
||||||
|
|
||||||
IfcVector3 vmin, vmax;
|
IfcVector3 vmin, vmax;
|
||||||
MinMaxChooser<IfcVector3>()(vmin, vmax);
|
MinMaxChooser<IfcVector3>()(vmin, vmax);
|
||||||
BOOST_FOREACH(IfcVector3& v, in) {
|
for(IfcVector3& v : in) {
|
||||||
v *= trafo;
|
v *= trafo;
|
||||||
|
|
||||||
vmin = std::min(vmin, v);
|
vmin = std::min(vmin, v);
|
||||||
|
@ -579,7 +579,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
|
||||||
}
|
}
|
||||||
|
|
||||||
nors.reserve(conv.apply_openings->size());
|
nors.reserve(conv.apply_openings->size());
|
||||||
BOOST_FOREACH(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.verts.size() <= 2 ) {
|
||||||
|
@ -617,7 +617,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
|
||||||
}
|
}
|
||||||
|
|
||||||
if( openings ) {
|
if( openings ) {
|
||||||
BOOST_FOREACH(TempOpening& opening, *conv.apply_openings) {
|
for(TempOpening& opening : *conv.apply_openings) {
|
||||||
if( !opening.wallPoints.empty() ) {
|
if( !opening.wallPoints.empty() ) {
|
||||||
IFCImporter::LogError("failed to generate all window caps");
|
IFCImporter::LogError("failed to generate all window caps");
|
||||||
}
|
}
|
||||||
|
@ -660,10 +660,10 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
|
||||||
// it was created from. Return an empty mesh to the caller.
|
// it was created from. Return an empty mesh to the caller.
|
||||||
if( collect_openings && !result.IsEmpty() ) {
|
if( collect_openings && !result.IsEmpty() ) {
|
||||||
ai_assert(conv.collect_openings);
|
ai_assert(conv.collect_openings);
|
||||||
boost::shared_ptr<TempMesh> profile = boost::shared_ptr<TempMesh>(new TempMesh());
|
std::shared_ptr<TempMesh> profile = std::shared_ptr<TempMesh>(new TempMesh());
|
||||||
profile->Swap(result);
|
profile->Swap(result);
|
||||||
|
|
||||||
boost::shared_ptr<TempMesh> profile2D = boost::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->verts.insert(profile2D->verts.end(), in.begin(), in.end());
|
||||||
profile2D->vertcnt.push_back(in.size());
|
profile2D->vertcnt.push_back(in.size());
|
||||||
conv.collect_openings->push_back(TempOpening(&solid, dir, profile, profile2D));
|
conv.collect_openings->push_back(TempOpening(&solid, dir, profile, profile2D));
|
||||||
|
@ -697,7 +697,7 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
|
||||||
std::vector<TempOpening>* oldCollectOpenings = conv.collect_openings;
|
std::vector<TempOpening>* oldCollectOpenings = conv.collect_openings;
|
||||||
conv.collect_openings = &fisherPriceMyFirstOpenings;
|
conv.collect_openings = &fisherPriceMyFirstOpenings;
|
||||||
|
|
||||||
BOOST_FOREACH(const IfcCurve* curve, cprofile->InnerCurves) {
|
for(const 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);
|
||||||
|
@ -732,9 +732,9 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
|
||||||
ConversionData& conv)
|
ConversionData& conv)
|
||||||
{
|
{
|
||||||
bool fix_orientation = false;
|
bool fix_orientation = false;
|
||||||
boost::shared_ptr< TempMesh > meshtmp = boost::make_shared<TempMesh>();
|
std::shared_ptr< TempMesh > meshtmp = std::make_shared<TempMesh>();
|
||||||
if(const IfcShellBasedSurfaceModel* shellmod = geo.ToPtr<IfcShellBasedSurfaceModel>()) {
|
if(const IfcShellBasedSurfaceModel* shellmod = geo.ToPtr<IfcShellBasedSurfaceModel>()) {
|
||||||
BOOST_FOREACH(boost::shared_ptr<const IfcShell> shell,shellmod->SbsmBoundary) {
|
for(std::shared_ptr<const IfcShell> shell :shellmod->SbsmBoundary) {
|
||||||
try {
|
try {
|
||||||
const EXPRESS::ENTITY& e = shell->To<ENTITY>();
|
const EXPRESS::ENTITY& e = shell->To<ENTITY>();
|
||||||
const IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To<IfcConnectedFaceSet>();
|
const IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To<IfcConnectedFaceSet>();
|
||||||
|
@ -762,7 +762,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
|
||||||
fix_orientation = true;
|
fix_orientation = true;
|
||||||
}
|
}
|
||||||
else if(const IfcFaceBasedSurfaceModel* surf = geo.ToPtr<IfcFaceBasedSurfaceModel>()) {
|
else if(const IfcFaceBasedSurfaceModel* surf = geo.ToPtr<IfcFaceBasedSurfaceModel>()) {
|
||||||
BOOST_FOREACH(const IfcConnectedFaceSet& fc, surf->FbsmFaces) {
|
for(const IfcConnectedFaceSet& fc : surf->FbsmFaces) {
|
||||||
ProcessConnectedFaceSet(fc,*meshtmp.get(),conv);
|
ProcessConnectedFaceSet(fc,*meshtmp.get(),conv);
|
||||||
}
|
}
|
||||||
fix_orientation = true;
|
fix_orientation = true;
|
||||||
|
@ -791,7 +791,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
|
||||||
conv.collect_openings->push_back(TempOpening(geo.ToPtr<IfcSolidModel>(),
|
conv.collect_openings->push_back(TempOpening(geo.ToPtr<IfcSolidModel>(),
|
||||||
IfcVector3(0,0,0),
|
IfcVector3(0,0,0),
|
||||||
meshtmp,
|
meshtmp,
|
||||||
boost::shared_ptr<TempMesh>()));
|
std::shared_ptr<TempMesh>()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <tuple>
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
|
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
|
||||||
# include "../contrib/unzip/unzip.h"
|
# include "../contrib/unzip/unzip.h"
|
||||||
|
@ -168,7 +168,7 @@ void IFCImporter::SetupProperties(const Importer* pImp)
|
||||||
void IFCImporter::InternReadFile( const std::string& pFile,
|
void IFCImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<IOStream> stream(pIOHandler->Open(pFile));
|
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile));
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
ThrowException("Could not open file for reading");
|
ThrowException("Could not open file for reading");
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ void IFCImporter::InternReadFile( const std::string& pFile,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::scoped_ptr<STEP::DB> db(STEP::ReadFileHeader(stream));
|
std::unique_ptr<STEP::DB> db(STEP::ReadFileHeader(stream));
|
||||||
const STEP::HeaderInfo& head = static_cast<const STEP::DB&>(*db).GetHeader();
|
const STEP::HeaderInfo& head = static_cast<const STEP::DB&>(*db).GetHeader();
|
||||||
|
|
||||||
if(!head.fileSchema.size() || head.fileSchema.substr(0,3) != "IFC") {
|
if(!head.fileSchema.size() || head.fileSchema.substr(0,3) != "IFC") {
|
||||||
|
@ -383,7 +383,7 @@ void SetUnits(ConversionData& conv)
|
||||||
void SetCoordinateSpace(ConversionData& conv)
|
void SetCoordinateSpace(ConversionData& conv)
|
||||||
{
|
{
|
||||||
const IfcRepresentationContext* fav = NULL;
|
const IfcRepresentationContext* fav = NULL;
|
||||||
BOOST_FOREACH(const IfcRepresentationContext& v, conv.proj.RepresentationContexts) {
|
for(const 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") {
|
||||||
|
@ -423,7 +423,7 @@ 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 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 cartesian transform operator is simply a conventional transformation matrix
|
||||||
std::auto_ptr<aiNode> nd(new aiNode());
|
std::unique_ptr<aiNode> nd(new aiNode());
|
||||||
nd->mName.Set("IfcMappedItem");
|
nd->mName.Set("IfcMappedItem");
|
||||||
|
|
||||||
// handle the Cartesian operator
|
// handle the Cartesian operator
|
||||||
|
@ -440,7 +440,7 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
|
||||||
if (conv.apply_openings) {
|
if (conv.apply_openings) {
|
||||||
IfcMatrix4 minv = msrc;
|
IfcMatrix4 minv = msrc;
|
||||||
minv.Inverse();
|
minv.Inverse();
|
||||||
BOOST_FOREACH(TempOpening& open,*conv.apply_openings){
|
for(TempOpening& open :*conv.apply_openings){
|
||||||
open.Transform(minv);
|
open.Transform(minv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
|
||||||
const IfcRepresentation& repr = mapped.MappingSource->MappedRepresentation;
|
const IfcRepresentation& repr = mapped.MappingSource->MappedRepresentation;
|
||||||
|
|
||||||
bool got = false;
|
bool got = false;
|
||||||
BOOST_FOREACH(const IfcRepresentationItem& item, repr.Items) {
|
for(const 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");
|
||||||
}
|
}
|
||||||
|
@ -564,9 +564,9 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
|
||||||
std::vector<const IfcRepresentation*> repr_ordered(src.size());
|
std::vector<const 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());
|
||||||
BOOST_FOREACH(const IfcRepresentation* repr, repr_ordered) {
|
for(const IfcRepresentation* repr : repr_ordered) {
|
||||||
bool res = false;
|
bool res = false;
|
||||||
BOOST_FOREACH(const IfcRepresentationItem& item, repr->Items) {
|
for(const IfcRepresentationItem& item : repr->Items) {
|
||||||
if(const IfcMappedItem* const geo = item.ToPtr<IfcMappedItem>()) {
|
if(const IfcMappedItem* const geo = item.ToPtr<IfcMappedItem>()) {
|
||||||
res = ProcessMappedItem(*geo,nd,subnodes,matid,conv) || res;
|
res = ProcessMappedItem(*geo,nd,subnodes,matid,conv) || res;
|
||||||
}
|
}
|
||||||
|
@ -589,7 +589,7 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
|
||||||
const std::string& prefix = "",
|
const std::string& prefix = "",
|
||||||
unsigned int nest = 0)
|
unsigned int nest = 0)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const IfcProperty& property, set) {
|
for(const 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 IfcPropertySingleValue* const singleValue = property.ToPtr<IfcPropertySingleValue>()) {
|
||||||
if (singleValue->NominalValue) {
|
if (singleValue->NominalValue) {
|
||||||
|
@ -615,7 +615,7 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "[";
|
ss << "[";
|
||||||
unsigned index=0;
|
unsigned index=0;
|
||||||
BOOST_FOREACH(const IfcValue::Out& v, listValue->ListValues) {
|
for(const IfcValue::Out& v : listValue->ListValues) {
|
||||||
if (!v) continue;
|
if (!v) continue;
|
||||||
if (const EXPRESS::STRING* str = v->ToPtr<EXPRESS::STRING>()) {
|
if (const EXPRESS::STRING* str = v->ToPtr<EXPRESS::STRING>()) {
|
||||||
std::string value = static_cast<std::string>(*str);
|
std::string value = static_cast<std::string>(*str);
|
||||||
|
@ -684,7 +684,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
|
||||||
}
|
}
|
||||||
|
|
||||||
// add an output node for this spatial structure
|
// add an output node for this spatial structure
|
||||||
std::auto_ptr<aiNode> nd(new aiNode());
|
std::unique_ptr<aiNode> nd(new aiNode());
|
||||||
nd->mName.Set(el.GetClassName()+"_"+(el.Name?el.Name.Get():"Unnamed")+"_"+el.GlobalId);
|
nd->mName.Set(el.GetClassName()+"_"+(el.Name?el.Name.Get():"Unnamed")+"_"+el.GlobalId);
|
||||||
nd->mParent = parent;
|
nd->mParent = parent;
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
|
||||||
data->mValues = new aiMetadataEntry[data->mNumProperties]();
|
data->mValues = new aiMetadataEntry[data->mNumProperties]();
|
||||||
|
|
||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
BOOST_FOREACH(const Metadata::value_type& kv, properties)
|
for(const Metadata::value_type& kv : properties)
|
||||||
data->Set(index++, kv.first, aiString(kv.second));
|
data->Set(index++, kv.first, aiString(kv.second));
|
||||||
|
|
||||||
nd->mMetaData = data;
|
nd->mMetaData = data;
|
||||||
|
@ -751,7 +751,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
|
||||||
if(cont->RelatingStructure->GetID() != el.GetID()) {
|
if(cont->RelatingStructure->GetID() != el.GetID()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BOOST_FOREACH(const IfcProduct& pro, cont->RelatedElements) {
|
for(const IfcProduct& pro : cont->RelatedElements) {
|
||||||
if(pro.ToPtr<IfcOpeningElement>()) {
|
if(pro.ToPtr<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,
|
||||||
|
@ -771,7 +771,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
|
||||||
const IfcFeatureElementSubtraction& open = fills->RelatedOpeningElement;
|
const 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::auto_ptr<aiNode> nd_aggr(new aiNode());
|
std::unique_ptr<aiNode> nd_aggr(new aiNode());
|
||||||
nd_aggr->mName.Set("$RelVoidsElement");
|
nd_aggr->mName.Set("$RelVoidsElement");
|
||||||
nd_aggr->mParent = nd.get();
|
nd_aggr->mParent = nd.get();
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need all openings to be in the local space of *this* node, so transform them
|
// we need all openings to be in the local space of *this* node, so transform them
|
||||||
BOOST_FOREACH(TempOpening& op,openings_local) {
|
for(TempOpening& op :openings_local) {
|
||||||
op.Transform( myInv*nd_aggr->mChildren[0]->mTransformation);
|
op.Transform( myInv*nd_aggr->mChildren[0]->mTransformation);
|
||||||
openings.push_back(op);
|
openings.push_back(op);
|
||||||
}
|
}
|
||||||
|
@ -816,14 +816,14 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
|
||||||
}
|
}
|
||||||
|
|
||||||
// move aggregate elements to a separate node since they are semantically different than elements that are just 'contained'
|
// move aggregate elements to a separate node since they are semantically different than elements that are just 'contained'
|
||||||
std::auto_ptr<aiNode> nd_aggr(new aiNode());
|
std::unique_ptr<aiNode> nd_aggr(new aiNode());
|
||||||
nd_aggr->mName.Set("$RelAggregates");
|
nd_aggr->mName.Set("$RelAggregates");
|
||||||
nd_aggr->mParent = nd.get();
|
nd_aggr->mParent = nd.get();
|
||||||
|
|
||||||
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()]();
|
||||||
BOOST_FOREACH(const IfcObjectDefinition& def, aggr->RelatedObjects) {
|
for(const IfcObjectDefinition& def : aggr->RelatedObjects) {
|
||||||
if(const IfcProduct* const prod = def.ToPtr<IfcProduct>()) {
|
if(const IfcProduct* const prod = def.ToPtr<IfcProduct>()) {
|
||||||
|
|
||||||
aiNode* const ndnew = ProcessSpatialStructure(nd_aggr.get(),*prod,conv,NULL);
|
aiNode* const ndnew = ProcessSpatialStructure(nd_aggr.get(),*prod,conv,NULL);
|
||||||
|
@ -849,7 +849,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
|
||||||
|
|
||||||
if (subnodes.size()) {
|
if (subnodes.size()) {
|
||||||
nd->mChildren = new aiNode*[subnodes.size()]();
|
nd->mChildren = new aiNode*[subnodes.size()]();
|
||||||
BOOST_FOREACH(aiNode* nd2, subnodes) {
|
for(aiNode* nd2 : subnodes) {
|
||||||
nd->mChildren[nd->mNumChildren++] = nd2;
|
nd->mChildren[nd->mNumChildren++] = nd2;
|
||||||
nd2->mParent = nd.get();
|
nd2->mParent = nd.get();
|
||||||
}
|
}
|
||||||
|
@ -889,7 +889,7 @@ void ProcessSpatialStructures(ConversionData& conv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOST_FOREACH(const STEP::LazyObject* lz, *range) {
|
for(const STEP::LazyObject* lz : *range) {
|
||||||
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
|
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
|
||||||
if(!prod) {
|
if(!prod) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -902,7 +902,7 @@ void ProcessSpatialStructures(ConversionData& conv)
|
||||||
for(;range.first != range.second; ++range.first) {
|
for(;range.first != range.second; ++range.first) {
|
||||||
if(const IfcRelAggregates* const aggr = conv.db.GetObject((*range.first).second)->ToPtr<IfcRelAggregates>()) {
|
if(const IfcRelAggregates* const aggr = conv.db.GetObject((*range.first).second)->ToPtr<IfcRelAggregates>()) {
|
||||||
|
|
||||||
BOOST_FOREACH(const IfcObjectDefinition& def, aggr->RelatedObjects) {
|
for(const 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()) {
|
||||||
|
@ -919,7 +919,7 @@ void ProcessSpatialStructures(ConversionData& conv)
|
||||||
|
|
||||||
|
|
||||||
IFCImporter::LogWarn("failed to determine primary site element, taking the first IfcSite");
|
IFCImporter::LogWarn("failed to determine primary site element, taking the first IfcSite");
|
||||||
BOOST_FOREACH(const STEP::LazyObject* lz, *range) {
|
for(const STEP::LazyObject* lz : *range) {
|
||||||
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
|
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
|
||||||
if(!prod) {
|
if(!prod) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -76,7 +76,7 @@ void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionDat
|
||||||
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
|
||||||
BOOST_FOREACH(boost::shared_ptr< const IFC::IfcSurfaceStyleElementSelect > sel2, surf->Styles) {
|
for(std::shared_ptr< const IFC::IfcSurfaceStyleElementSelect > sel2 : surf->Styles) {
|
||||||
if (const IFC::IfcSurfaceStyleShading* shade = sel2->ResolveSelectPtr<IFC::IfcSurfaceStyleShading>(conv.db)) {
|
if (const IFC::IfcSurfaceStyleShading* shade = sel2->ResolveSelectPtr<IFC::IfcSurfaceStyleShading>(conv.db)) {
|
||||||
aiColor4D col_base,col;
|
aiColor4D col_base,col;
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat
|
||||||
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::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr<IFC::IfcStyledItem>()) {
|
||||||
BOOST_FOREACH(const IFC::IfcPresentationStyleAssignment& as, styled->Styles) {
|
for(const IFC::IfcPresentationStyleAssignment& as : styled->Styles) {
|
||||||
BOOST_FOREACH(boost::shared_ptr<const IFC::IfcPresentationStyleSelect> sel, as.Styles) {
|
for(std::shared_ptr<const IFC::IfcPresentationStyleSelect> sel : as.Styles) {
|
||||||
|
|
||||||
if( const IFC::IfcSurfaceStyle* const surf = sel->ResolveSelectPtr<IFC::IfcSurfaceStyle>(conv.db) ) {
|
if( const IFC::IfcSurfaceStyle* const surf = sel->ResolveSelectPtr<IFC::IfcSurfaceStyle>(conv.db) ) {
|
||||||
// try to satisfy from cache
|
// try to satisfy from cache
|
||||||
|
@ -154,7 +154,7 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat
|
||||||
IFCImporter::LogWarn("ignoring surface side marker on IFC::IfcSurfaceStyle: " + side);
|
IFCImporter::LogWarn("ignoring surface side marker on IFC::IfcSurfaceStyle: " + side);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::auto_ptr<aiMaterial> mat(new aiMaterial());
|
std::unique_ptr<aiMaterial> mat(new aiMaterial());
|
||||||
|
|
||||||
FillMaterial(mat.get(), surf, conv);
|
FillMaterial(mat.get(), surf, conv);
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're here, yet - no default material with suitable color available. Generate one
|
// we're here, yet - no default material with suitable color available. Generate one
|
||||||
std::auto_ptr<aiMaterial> mat(new aiMaterial());
|
std::unique_ptr<aiMaterial> mat(new aiMaterial());
|
||||||
mat->AddProperty(&name,AI_MATKEY_NAME);
|
mat->AddProperty(&name,AI_MATKEY_NAME);
|
||||||
|
|
||||||
const aiColor4D col = aiColor4D( 0.6f, 0.6f, 0.6f, 1.0f); // aiColor4D( color.r, color.g, color.b, 1.0f);
|
const aiColor4D col = aiColor4D( 0.6f, 0.6f, 0.6f, 1.0f); // aiColor4D( color.r, color.g, color.b, 1.0f);
|
||||||
|
|
|
@ -213,7 +213,7 @@ bool BoundingBoxesOverlapping( const BoundingBox &ibb, const BoundingBox &bb )
|
||||||
bool IsDuplicateVertex(const IfcVector2& vv, const std::vector<IfcVector2>& temp_contour)
|
bool IsDuplicateVertex(const IfcVector2& vv, const std::vector<IfcVector2>& temp_contour)
|
||||||
{
|
{
|
||||||
// sanity check for duplicate vertices
|
// sanity check for duplicate vertices
|
||||||
BOOST_FOREACH(const IfcVector2& cp, temp_contour) {
|
for(const IfcVector2& cp : temp_contour) {
|
||||||
if ((cp-vv).SquareLength() < 1e-5f) {
|
if ((cp-vv).SquareLength() < 1e-5f) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ void ExtractVerticesFromClipper(const ClipperLib::Polygon& poly, std::vector<Ifc
|
||||||
bool filter_duplicates = false)
|
bool filter_duplicates = false)
|
||||||
{
|
{
|
||||||
temp_contour.clear();
|
temp_contour.clear();
|
||||||
BOOST_FOREACH(const ClipperLib::IntPoint& point, poly) {
|
for(const ClipperLib::IntPoint& point : poly) {
|
||||||
IfcVector2 vv = IfcVector2( from_int64(point.X), from_int64(point.Y));
|
IfcVector2 vv = IfcVector2( from_int64(point.X), from_int64(point.Y));
|
||||||
vv = std::max(vv,IfcVector2());
|
vv = std::max(vv,IfcVector2());
|
||||||
vv = std::min(vv,one_vec);
|
vv = std::min(vv,one_vec);
|
||||||
|
@ -243,7 +243,7 @@ BoundingBox GetBoundingBox(const ClipperLib::Polygon& poly)
|
||||||
IfcVector2 newbb_min, newbb_max;
|
IfcVector2 newbb_min, newbb_max;
|
||||||
MinMaxChooser<IfcVector2>()(newbb_min, newbb_max);
|
MinMaxChooser<IfcVector2>()(newbb_min, newbb_max);
|
||||||
|
|
||||||
BOOST_FOREACH(const ClipperLib::IntPoint& point, poly) {
|
for(const ClipperLib::IntPoint& point : poly) {
|
||||||
IfcVector2 vv = IfcVector2( from_int64(point.X), from_int64(point.Y));
|
IfcVector2 vv = IfcVector2( from_int64(point.X), from_int64(point.Y));
|
||||||
|
|
||||||
// sanity rounding
|
// sanity rounding
|
||||||
|
@ -391,7 +391,7 @@ void MergeWindowContours (const std::vector<IfcVector2>& a,
|
||||||
ClipperLib::Clipper clipper;
|
ClipperLib::Clipper clipper;
|
||||||
ClipperLib::Polygon clip;
|
ClipperLib::Polygon clip;
|
||||||
|
|
||||||
BOOST_FOREACH(const IfcVector2& pip, a) {
|
for(const IfcVector2& pip : a) {
|
||||||
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ void MergeWindowContours (const std::vector<IfcVector2>& a,
|
||||||
clipper.AddPolygon(clip, ClipperLib::ptSubject);
|
clipper.AddPolygon(clip, ClipperLib::ptSubject);
|
||||||
clip.clear();
|
clip.clear();
|
||||||
|
|
||||||
BOOST_FOREACH(const IfcVector2& pip, b) {
|
for(const IfcVector2& pip : b) {
|
||||||
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ void MakeDisjunctWindowContours (const std::vector<IfcVector2>& a,
|
||||||
ClipperLib::Clipper clipper;
|
ClipperLib::Clipper clipper;
|
||||||
ClipperLib::Polygon clip;
|
ClipperLib::Polygon clip;
|
||||||
|
|
||||||
BOOST_FOREACH(const IfcVector2& pip, a) {
|
for(const IfcVector2& pip : a) {
|
||||||
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ void MakeDisjunctWindowContours (const std::vector<IfcVector2>& a,
|
||||||
clipper.AddPolygon(clip, ClipperLib::ptClip);
|
clipper.AddPolygon(clip, ClipperLib::ptClip);
|
||||||
clip.clear();
|
clip.clear();
|
||||||
|
|
||||||
BOOST_FOREACH(const IfcVector2& pip, b) {
|
for(const IfcVector2& pip : b) {
|
||||||
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ void CleanupWindowContour(ProjectedWindowContour& window)
|
||||||
ClipperLib::Clipper clipper;
|
ClipperLib::Clipper clipper;
|
||||||
ClipperLib::ExPolygons clipped;
|
ClipperLib::ExPolygons clipped;
|
||||||
|
|
||||||
BOOST_FOREACH(const IfcVector2& pip, contour) {
|
for(const IfcVector2& pip : contour) {
|
||||||
subject.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
subject.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ void CleanupWindowContours(ContourVector& contours)
|
||||||
{
|
{
|
||||||
// Use PolyClipper to clean up window contours
|
// Use PolyClipper to clean up window contours
|
||||||
try {
|
try {
|
||||||
BOOST_FOREACH(ProjectedWindowContour& window, contours) {
|
for(ProjectedWindowContour& window : contours) {
|
||||||
CleanupWindowContour(window);
|
CleanupWindowContour(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -516,7 +516,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
|
||||||
|
|
||||||
ClipperLib::Polygon clip;
|
ClipperLib::Polygon clip;
|
||||||
clip.reserve(contour_flat.size());
|
clip.reserve(contour_flat.size());
|
||||||
BOOST_FOREACH(const IfcVector2& pip, contour_flat) {
|
for(const IfcVector2& pip : contour_flat) {
|
||||||
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +530,7 @@ 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;
|
||||||
BOOST_FOREACH(const IfcVector3& pip, curmesh.verts) {
|
for(const IfcVector3& pip : curmesh.verts) {
|
||||||
if (!countdown) {
|
if (!countdown) {
|
||||||
countdown = curmesh.vertcnt[index++];
|
countdown = curmesh.vertcnt[index++];
|
||||||
if (!countdown) {
|
if (!countdown) {
|
||||||
|
@ -548,9 +548,9 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
|
||||||
|
|
||||||
clipper.Execute(ClipperLib::ctIntersection,clipped,ClipperLib::pftNonZero,ClipperLib::pftNonZero);
|
clipper.Execute(ClipperLib::ctIntersection,clipped,ClipperLib::pftNonZero,ClipperLib::pftNonZero);
|
||||||
|
|
||||||
BOOST_FOREACH(const ClipperLib::ExPolygon& ex, clipped) {
|
for(const ClipperLib::ExPolygon& ex : clipped) {
|
||||||
iold.push_back(ex.outer.size());
|
iold.push_back(ex.outer.size());
|
||||||
BOOST_FOREACH(const ClipperLib::IntPoint& point, ex.outer) {
|
for(const ClipperLib::IntPoint& point : ex.outer) {
|
||||||
vold.push_back(IfcVector3(
|
vold.push_back(IfcVector3(
|
||||||
from_int64(point.X),
|
from_int64(point.X),
|
||||||
from_int64(point.Y),
|
from_int64(point.Y),
|
||||||
|
@ -866,7 +866,7 @@ size_t CloseWindows(ContourVector& contours,
|
||||||
OpeningRefs& refs = contours_to_openings[std::distance(contours.begin(), it)];
|
OpeningRefs& refs = contours_to_openings[std::distance(contours.begin(), it)];
|
||||||
|
|
||||||
bool has_other_side = false;
|
bool has_other_side = false;
|
||||||
BOOST_FOREACH(const TempOpening* opening, refs) {
|
for(const TempOpening* opening : refs) {
|
||||||
if(!opening->wallPoints.empty()) {
|
if(!opening->wallPoints.empty()) {
|
||||||
has_other_side = true;
|
has_other_side = true;
|
||||||
break;
|
break;
|
||||||
|
@ -929,8 +929,8 @@ size_t CloseWindows(ContourVector& contours,
|
||||||
|
|
||||||
const IfcVector3 world_point = minv * IfcVector3(proj_point.x,proj_point.y,0.0f);
|
const IfcVector3 world_point = minv * IfcVector3(proj_point.x,proj_point.y,0.0f);
|
||||||
|
|
||||||
BOOST_FOREACH(const TempOpening* opening, refs) {
|
for(const TempOpening* opening : refs) {
|
||||||
BOOST_FOREACH(const IfcVector3& other, opening->wallPoints) {
|
for(const IfcVector3& other : opening->wallPoints) {
|
||||||
const IfcFloat sqdist = (world_point - other).SquareLength();
|
const IfcFloat sqdist = (world_point - other).SquareLength();
|
||||||
|
|
||||||
if (sqdist < best) {
|
if (sqdist < best) {
|
||||||
|
@ -987,7 +987,7 @@ size_t CloseWindows(ContourVector& contours,
|
||||||
else {
|
else {
|
||||||
|
|
||||||
const Contour::const_iterator cbegin = (*it).contour.begin(), cend = (*it).contour.end();
|
const Contour::const_iterator cbegin = (*it).contour.begin(), cend = (*it).contour.end();
|
||||||
BOOST_FOREACH(TempOpening* opening, refs) {
|
for(TempOpening* opening : refs) {
|
||||||
ai_assert(opening->wallPoints.empty());
|
ai_assert(opening->wallPoints.empty());
|
||||||
opening->wallPoints.reserve(opening->wallPoints.capacity() + (*it).contour.size());
|
opening->wallPoints.reserve(opening->wallPoints.capacity() + (*it).contour.size());
|
||||||
for (Contour::const_iterator cit = cbegin; cit != cend; ++cit) {
|
for (Contour::const_iterator cit = cbegin; cit != cend; ++cit) {
|
||||||
|
@ -1023,7 +1023,7 @@ void Quadrify(const std::vector< BoundingBox >& bbs, TempMesh& curmesh)
|
||||||
|
|
||||||
curmesh.vertcnt.resize(quads.size()/4,4);
|
curmesh.vertcnt.resize(quads.size()/4,4);
|
||||||
curmesh.verts.reserve(quads.size());
|
curmesh.verts.reserve(quads.size());
|
||||||
BOOST_FOREACH(const IfcVector2& v2, quads) {
|
for(const IfcVector2& v2 : quads) {
|
||||||
curmesh.verts.push_back(IfcVector3(v2.x, v2.y, static_cast<IfcFloat>(0.0)));
|
curmesh.verts.push_back(IfcVector3(v2.x, v2.y, static_cast<IfcFloat>(0.0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1034,7 +1034,7 @@ void Quadrify(const ContourVector& contours, TempMesh& curmesh)
|
||||||
std::vector<BoundingBox> bbs;
|
std::vector<BoundingBox> bbs;
|
||||||
bbs.reserve(contours.size());
|
bbs.reserve(contours.size());
|
||||||
|
|
||||||
BOOST_FOREACH(const ContourVector::value_type& val, contours) {
|
for(const ContourVector::value_type& val : contours) {
|
||||||
bbs.push_back(val.bb);
|
bbs.push_back(val.bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1065,7 +1065,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
|
||||||
MinMaxChooser<IfcVector3>()(vmin, vmax);
|
MinMaxChooser<IfcVector3>()(vmin, vmax);
|
||||||
|
|
||||||
// Project all points into the new coordinate system, collect min/max verts on the way
|
// Project all points into the new coordinate system, collect min/max verts on the way
|
||||||
BOOST_FOREACH(const IfcVector3& x, in_verts) {
|
for(const IfcVector3& x : in_verts) {
|
||||||
const IfcVector3 vv = m * x;
|
const IfcVector3 vv = m * x;
|
||||||
// keep Z offset in the plane coordinate system. Ignoring precision issues
|
// keep Z offset in the plane coordinate system. Ignoring precision issues
|
||||||
// (which are present, of course), this should be the same value for
|
// (which are present, of course), this should be the same value for
|
||||||
|
@ -1089,7 +1089,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
|
||||||
// [0,1] range. This gives us a consistent data range so all epsilons
|
// [0,1] range. This gives us a consistent data range so all epsilons
|
||||||
// used below can be constants.
|
// used below can be constants.
|
||||||
vmax -= vmin;
|
vmax -= vmin;
|
||||||
BOOST_FOREACH(IfcVector2& vv, out_contour) {
|
for(IfcVector2& vv : out_contour) {
|
||||||
vv.x = (vv.x - vmin.x) / vmax.x;
|
vv.x = (vv.x - vmin.x) / vmax.x;
|
||||||
vv.y = (vv.y - vmin.y) / vmax.y;
|
vv.y = (vv.y - vmin.y) / vmax.y;
|
||||||
|
|
||||||
|
@ -1110,7 +1110,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
|
||||||
// debug code to verify correctness
|
// debug code to verify correctness
|
||||||
#ifdef ASSIMP_BUILD_DEBUG
|
#ifdef ASSIMP_BUILD_DEBUG
|
||||||
std::vector<IfcVector2> out_contour2;
|
std::vector<IfcVector2> out_contour2;
|
||||||
BOOST_FOREACH(const IfcVector3& x, in_verts) {
|
for(const IfcVector3& x : in_verts) {
|
||||||
const IfcVector3& vv = m * x;
|
const IfcVector3& vv = m * x;
|
||||||
|
|
||||||
out_contour2.push_back(IfcVector2(vv.x,vv.y));
|
out_contour2.push_back(IfcVector2(vv.x,vv.y));
|
||||||
|
@ -1161,7 +1161,7 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
|
||||||
IfcVector3 wall_extrusion_axis_norm = wall_extrusion_axis;
|
IfcVector3 wall_extrusion_axis_norm = wall_extrusion_axis;
|
||||||
wall_extrusion_axis_norm.Normalize();
|
wall_extrusion_axis_norm.Normalize();
|
||||||
|
|
||||||
BOOST_FOREACH(TempOpening& opening,openings) {
|
for(TempOpening& opening :openings) {
|
||||||
|
|
||||||
// extrusionDir may be 0,0,0 on case where the opening mesh is not an
|
// extrusionDir may be 0,0,0 on case where the opening mesh is not an
|
||||||
// IfcExtrudedAreaSolid but something else (i.e. a brep)
|
// IfcExtrudedAreaSolid but something else (i.e. a brep)
|
||||||
|
@ -1413,7 +1413,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
|
||||||
BOOST_FOREACH(IfcVector3& v3, curmesh.verts) {
|
for(IfcVector3& v3 : curmesh.verts) {
|
||||||
v3 = minv * v3;
|
v3 = minv * v3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1455,7 +1455,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
||||||
MinMaxChooser<IfcVector2>()(vmin, vmax);
|
MinMaxChooser<IfcVector2>()(vmin, vmax);
|
||||||
|
|
||||||
// Move all points into the new coordinate system, collecting min/max verts on the way
|
// Move all points into the new coordinate system, collecting min/max verts on the way
|
||||||
BOOST_FOREACH(IfcVector3& x, out) {
|
for(IfcVector3& x : out) {
|
||||||
const IfcVector3 vv = m * x;
|
const IfcVector3 vv = m * x;
|
||||||
|
|
||||||
// keep Z offset in the plane coordinate system. Ignoring precision issues
|
// keep Z offset in the plane coordinate system. Ignoring precision issues
|
||||||
|
@ -1498,7 +1498,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
||||||
ClipperLib::Clipper clipper_holes;
|
ClipperLib::Clipper clipper_holes;
|
||||||
size_t c = 0;
|
size_t c = 0;
|
||||||
|
|
||||||
BOOST_FOREACH(const TempOpening& t,openings) {
|
for(const TempOpening& t :openings) {
|
||||||
const IfcVector3& outernor = nors[c++];
|
const IfcVector3& outernor = nors[c++];
|
||||||
const IfcFloat dot = nor * outernor;
|
const IfcFloat dot = nor * outernor;
|
||||||
if (std::fabs(dot)<1.f-1e-6f) {
|
if (std::fabs(dot)<1.f-1e-6f) {
|
||||||
|
@ -1512,7 +1512,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
||||||
|
|
||||||
std::vector<IfcVector2> contour;
|
std::vector<IfcVector2> contour;
|
||||||
|
|
||||||
BOOST_FOREACH(const IfcVector3& xx, t.profileMesh->verts) {
|
for(const IfcVector3& xx : t.profileMesh->verts) {
|
||||||
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);
|
||||||
|
@ -1533,7 +1533,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipperLib::Polygon hole;
|
ClipperLib::Polygon hole;
|
||||||
BOOST_FOREACH(IfcVector2& pip, contour) {
|
for(IfcVector2& pip : contour) {
|
||||||
pip.x = (pip.x - vmin.x) / vmax.x;
|
pip.x = (pip.x - vmin.x) / vmax.x;
|
||||||
pip.y = (pip.y - vmin.y) / vmax.y;
|
pip.y = (pip.y - vmin.y) / vmax.y;
|
||||||
|
|
||||||
|
@ -1566,7 +1566,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
||||||
// to obtain the final polygon to feed into the triangulator.
|
// to obtain the final polygon to feed into the triangulator.
|
||||||
{
|
{
|
||||||
ClipperLib::Polygon poly;
|
ClipperLib::Polygon poly;
|
||||||
BOOST_FOREACH(IfcVector2& pip, contour_flat) {
|
for(IfcVector2& pip : contour_flat) {
|
||||||
pip.x = (pip.x - vmin.x) / vmax.x;
|
pip.x = (pip.x - vmin.x) / vmax.x;
|
||||||
pip.y = (pip.y - vmin.y) / vmax.y;
|
pip.y = (pip.y - vmin.y) / vmax.y;
|
||||||
|
|
||||||
|
@ -1606,13 +1606,13 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
||||||
if (false && do_connections) {
|
if (false && do_connections) {
|
||||||
|
|
||||||
std::vector<IfcVector3> tmpvec;
|
std::vector<IfcVector3> tmpvec;
|
||||||
BOOST_FOREACH(ClipperLib::Polygon& opening, holes_union) {
|
for(ClipperLib::Polygon& opening : holes_union) {
|
||||||
|
|
||||||
assert(ClipperLib::Orientation(opening));
|
assert(ClipperLib::Orientation(opening));
|
||||||
|
|
||||||
tmpvec.clear();
|
tmpvec.clear();
|
||||||
|
|
||||||
BOOST_FOREACH(ClipperLib::IntPoint& point, opening) {
|
for(ClipperLib::IntPoint& point : opening) {
|
||||||
|
|
||||||
tmpvec.push_back( minv * IfcVector3(
|
tmpvec.push_back( minv * IfcVector3(
|
||||||
vmin.x + from_int64(point.X) * vmax.x,
|
vmin.x + from_int64(point.X) * vmax.x,
|
||||||
|
@ -1638,13 +1638,13 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< std::vector<p2t::Point*> > contours;
|
std::vector< std::vector<p2t::Point*> > contours;
|
||||||
BOOST_FOREACH(ClipperLib::ExPolygon& clip, clipped) {
|
for(ClipperLib::ExPolygon& clip : clipped) {
|
||||||
|
|
||||||
contours.clear();
|
contours.clear();
|
||||||
|
|
||||||
// Build the outer polygon contour line for feeding into poly2tri
|
// Build the outer polygon contour line for feeding into poly2tri
|
||||||
std::vector<p2t::Point*> contour_points;
|
std::vector<p2t::Point*> contour_points;
|
||||||
BOOST_FOREACH(ClipperLib::IntPoint& point, clip.outer) {
|
for(ClipperLib::IntPoint& point : clip.outer) {
|
||||||
contour_points.push_back( new p2t::Point(from_int64(point.X), from_int64(point.Y)) );
|
contour_points.push_back( new p2t::Point(from_int64(point.X), from_int64(point.Y)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1664,12 +1664,12 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
||||||
|
|
||||||
|
|
||||||
// Build the poly2tri inner contours for all holes we got from ClipperLib
|
// Build the poly2tri inner contours for all holes we got from ClipperLib
|
||||||
BOOST_FOREACH(ClipperLib::Polygon& opening, clip.holes) {
|
for(ClipperLib::Polygon& opening : clip.holes) {
|
||||||
|
|
||||||
contours.push_back(std::vector<p2t::Point*>());
|
contours.push_back(std::vector<p2t::Point*>());
|
||||||
std::vector<p2t::Point*>& contour = contours.back();
|
std::vector<p2t::Point*>& contour = contours.back();
|
||||||
|
|
||||||
BOOST_FOREACH(ClipperLib::IntPoint& point, opening) {
|
for(ClipperLib::IntPoint& point : opening) {
|
||||||
contour.push_back( new p2t::Point(from_int64(point.X), from_int64(point.Y)) );
|
contour.push_back( new p2t::Point(from_int64(point.X), from_int64(point.Y)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1689,7 +1689,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
||||||
const std::vector<p2t::Triangle*> tris = cdt->GetTriangles();
|
const std::vector<p2t::Triangle*> tris = cdt->GetTriangles();
|
||||||
|
|
||||||
// Collect the triangles we just produced
|
// Collect the triangles we just produced
|
||||||
BOOST_FOREACH(p2t::Triangle* tri, tris) {
|
for(p2t::Triangle* tri : tris) {
|
||||||
for(int i = 0; i < 3; ++i) {
|
for(int i = 0; i < 3; ++i) {
|
||||||
|
|
||||||
const IfcVector2 v = IfcVector2(
|
const IfcVector2 v = IfcVector2(
|
||||||
|
|
|
@ -55,7 +55,7 @@ void ProcessPolyLine(const IfcPolyline& def, TempMesh& meshout, ConversionData&
|
||||||
{
|
{
|
||||||
// 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;
|
||||||
BOOST_FOREACH(const IfcCartesianPoint& cp, def.Points) {
|
for(const IfcCartesianPoint& cp : def.Points) {
|
||||||
ConvertCartesianPoint(t,cp);
|
ConvertCartesianPoint(t,cp);
|
||||||
meshout.verts.push_back(t);
|
meshout.verts.push_back(t);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ void ProcessPolyLine(const IfcPolyline& def, TempMesh& meshout, ConversionData&
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& conv)
|
bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& conv)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<const Curve> cv(Curve::Convert(curve,conv));
|
std::unique_ptr<const Curve> cv(Curve::Convert(curve,conv));
|
||||||
if (!cv) {
|
if (!cv) {
|
||||||
IFCImporter::LogWarn("skipping unknown IfcCurve entity, type is " + curve.GetClassName());
|
IFCImporter::LogWarn("skipping unknown IfcCurve entity, type is " + curve.GetClassName());
|
||||||
return false;
|
return false;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -75,7 +75,7 @@ aiMesh* TempMesh::ToMesh()
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::auto_ptr<aiMesh> mesh(new aiMesh());
|
std::unique_ptr<aiMesh> mesh(new aiMesh());
|
||||||
|
|
||||||
// copy vertices
|
// copy vertices
|
||||||
mesh->mNumVertices = static_cast<unsigned int>(verts.size());
|
mesh->mNumVertices = static_cast<unsigned int>(verts.size());
|
||||||
|
@ -115,7 +115,7 @@ void TempMesh::Clear()
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void TempMesh::Transform(const IfcMatrix4& mat)
|
void TempMesh::Transform(const IfcMatrix4& mat)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(IfcVector3& v, verts) {
|
for(IfcVector3& v : verts) {
|
||||||
v *= mat;
|
v *= mat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ void TempMesh::ComputePolygonNormals(std::vector<IfcVector3>& normals,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(normalize) {
|
if(normalize) {
|
||||||
BOOST_FOREACH(IfcVector3& n, normals) {
|
for(IfcVector3& n : normals) {
|
||||||
n.Normalize();
|
n.Normalize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,7 +383,7 @@ void TempMesh::RemoveAdjacentDuplicates()
|
||||||
|
|
||||||
bool drop = false;
|
bool drop = false;
|
||||||
std::vector<IfcVector3>::iterator base = verts.begin();
|
std::vector<IfcVector3>::iterator base = verts.begin();
|
||||||
BOOST_FOREACH(unsigned int& cnt, vertcnt) {
|
for(unsigned int& cnt : vertcnt) {
|
||||||
if (cnt < 2){
|
if (cnt < 2){
|
||||||
base += cnt;
|
base += cnt;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -120,8 +120,8 @@ struct TempOpening
|
||||||
const IFC::IfcSolidModel* solid;
|
const IFC::IfcSolidModel* solid;
|
||||||
IfcVector3 extrusionDir;
|
IfcVector3 extrusionDir;
|
||||||
|
|
||||||
boost::shared_ptr<TempMesh> profileMesh;
|
std::shared_ptr<TempMesh> profileMesh;
|
||||||
boost::shared_ptr<TempMesh> profileMesh2D;
|
std::shared_ptr<TempMesh> profileMesh2D;
|
||||||
|
|
||||||
// list of points generated for this opening. This is used to
|
// list of points generated for this opening. This is used to
|
||||||
// create connections between two opposing holes created
|
// create connections between two opposing holes created
|
||||||
|
@ -140,8 +140,8 @@ struct TempOpening
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
TempOpening(const IFC::IfcSolidModel* solid,IfcVector3 extrusionDir,
|
TempOpening(const IFC::IfcSolidModel* solid,IfcVector3 extrusionDir,
|
||||||
boost::shared_ptr<TempMesh> profileMesh,
|
std::shared_ptr<TempMesh> profileMesh,
|
||||||
boost::shared_ptr<TempMesh> profileMesh2D)
|
std::shared_ptr<TempMesh> profileMesh2D)
|
||||||
: solid(solid)
|
: solid(solid)
|
||||||
, extrusionDir(extrusionDir)
|
, extrusionDir(extrusionDir)
|
||||||
, profileMesh(profileMesh)
|
, profileMesh(profileMesh)
|
||||||
|
|
|
@ -56,9 +56,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "StandardShapes.h"
|
#include "StandardShapes.h"
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
|
|
||||||
// We need boost::common_factor to compute the lcm/gcd of a number
|
// We need MathFunctions.h to compute the lcm/gcd of a number
|
||||||
#include <boost/math/common_factor_rt.hpp>
|
#include "MathFunctions.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/mesh.h"
|
#include "../include/assimp/mesh.h"
|
||||||
#include "../include/assimp/material.h"
|
#include "../include/assimp/material.h"
|
||||||
|
@ -402,13 +402,13 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
|
||||||
int lcm = 360;
|
int lcm = 360;
|
||||||
|
|
||||||
if (angles[0])
|
if (angles[0])
|
||||||
lcm = boost::math::lcm(lcm,angles[0]);
|
lcm = Math::lcm(lcm,angles[0]);
|
||||||
|
|
||||||
if (angles[1])
|
if (angles[1])
|
||||||
lcm = boost::math::lcm(lcm,angles[1]);
|
lcm = Math::lcm(lcm,angles[1]);
|
||||||
|
|
||||||
if (angles[2])
|
if (angles[2])
|
||||||
lcm = boost::math::lcm(lcm,angles[2]);
|
lcm = Math::lcm(lcm,angles[2]);
|
||||||
|
|
||||||
if (360 == lcm)
|
if (360 == lcm)
|
||||||
break;
|
break;
|
||||||
|
@ -902,7 +902,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
|
||||||
void IRRImporter::InternReadFile( const std::string& pFile,
|
void IRRImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
|
|
|
@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "IRRMeshLoader.h"
|
#include "IRRMeshLoader.h"
|
||||||
#include "ParsingUtils.h"
|
#include "ParsingUtils.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/mesh.h"
|
#include "../include/assimp/mesh.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
|
@ -121,7 +121,7 @@ const aiImporterDesc* IRRMeshImporter::GetInfo () const
|
||||||
void IRRMeshImporter::InternReadFile( const std::string& pFile,
|
void IRRMeshImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
|
|
|
@ -77,7 +77,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "Exceptional.h"
|
#include "Exceptional.h"
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
||||||
|
@ -612,7 +612,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::scoped_ptr<Profiler> profiler(GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME,0)?new Profiler():NULL);
|
std::unique_ptr<Profiler> profiler(GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME,0)?new Profiler():NULL);
|
||||||
if (profiler) {
|
if (profiler) {
|
||||||
profiler->BeginRegion("total");
|
profiler->BeginRegion("total");
|
||||||
}
|
}
|
||||||
|
@ -785,7 +785,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
||||||
}
|
}
|
||||||
#endif // ! DEBUG
|
#endif // ! DEBUG
|
||||||
|
|
||||||
boost::scoped_ptr<Profiler> profiler(GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME,0)?new Profiler():NULL);
|
std::unique_ptr<Profiler> profiler(GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME,0)?new Profiler():NULL);
|
||||||
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
|
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
|
||||||
|
|
||||||
BaseProcess* process = pimpl->mPostProcessingSteps[a];
|
BaseProcess* process = pimpl->mPostProcessingSteps[a];
|
||||||
|
@ -880,7 +880,7 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
|
||||||
}
|
}
|
||||||
#endif // ! DEBUG
|
#endif // ! DEBUG
|
||||||
|
|
||||||
boost::scoped_ptr<Profiler> profiler( GetPropertyInteger( AI_CONFIG_GLOB_MEASURE_TIME, 0 ) ? new Profiler() : NULL );
|
std::unique_ptr<Profiler> profiler( GetPropertyInteger( AI_CONFIG_GLOB_MEASURE_TIME, 0 ) ? new Profiler() : NULL );
|
||||||
|
|
||||||
if ( profiler ) {
|
if ( profiler ) {
|
||||||
profiler->BeginRegion( "postprocess" );
|
profiler->BeginRegion( "postprocess" );
|
||||||
|
|
|
@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "ByteSwapper.h"
|
#include "ByteSwapper.h"
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "ConvertToLHProcess.h"
|
#include "ConvertToLHProcess.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
@ -139,7 +139,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene,
|
aiScene* pScene,
|
||||||
IOSystem* pIOHandler)
|
IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
|
|
|
@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -511,7 +511,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler)
|
IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
io = pIOHandler;
|
io = pIOHandler;
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "MD2NormalTable.h" // shouldn't be included by other units
|
#include "MD2NormalTable.h" // shouldn't be included by other units
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ void MD2Importer::ValidateHeader( )
|
||||||
void MD2Importer::InternReadFile( const std::string& pFile,
|
void MD2Importer::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
|
|
|
@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "ParsingUtils.h"
|
#include "ParsingUtils.h"
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/material.h"
|
#include "../include/assimp/material.h"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
@ -108,7 +108,7 @@ Q3Shader::BlendFunc StringToBlendFunc(const std::string& m)
|
||||||
// Load a Quake 3 shader
|
// Load a Quake 3 shader
|
||||||
bool Q3Shader::LoadShader(ShaderData& fill, const std::string& pFile,IOSystem* io)
|
bool Q3Shader::LoadShader(ShaderData& fill, const std::string& pFile,IOSystem* io)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( io->Open( pFile, "rt"));
|
std::unique_ptr<IOStream> file( io->Open( pFile, "rt"));
|
||||||
if (!file.get())
|
if (!file.get())
|
||||||
return false; // if we can't access the file, don't worry and return
|
return false; // if we can't access the file, don't worry and return
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ bool Q3Shader::LoadShader(ShaderData& fill, const std::string& pFile,IOSystem* i
|
||||||
// Load a Quake 3 skin
|
// Load a Quake 3 skin
|
||||||
bool Q3Shader::LoadSkin(SkinData& fill, const std::string& pFile,IOSystem* io)
|
bool Q3Shader::LoadSkin(SkinData& fill, const std::string& pFile,IOSystem* io)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( io->Open( pFile, "rt"));
|
std::unique_ptr<IOStream> file( io->Open( pFile, "rt"));
|
||||||
if (!file.get())
|
if (!file.get())
|
||||||
return false; // if we can't access the file, don't worry and return
|
return false; // if we can't access the file, don't worry and return
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
|
|
|
@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "SkeletonMeshBuilder.h"
|
#include "SkeletonMeshBuilder.h"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ void MD5Importer::AttachChilds_Anim(int iParentID,aiNode* piParent, AnimBoneList
|
||||||
void MD5Importer::LoadMD5MeshFile ()
|
void MD5Importer::LoadMD5MeshFile ()
|
||||||
{
|
{
|
||||||
std::string pFile = mFile + "md5mesh";
|
std::string pFile = mFile + "md5mesh";
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL || !file->FileSize()) {
|
if( file.get() == NULL || !file->FileSize()) {
|
||||||
|
@ -569,7 +569,7 @@ void MD5Importer::LoadMD5MeshFile ()
|
||||||
void MD5Importer::LoadMD5AnimFile ()
|
void MD5Importer::LoadMD5AnimFile ()
|
||||||
{
|
{
|
||||||
std::string pFile = mFile + "md5anim";
|
std::string pFile = mFile + "md5anim";
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( !file.get() || !file->FileSize()) {
|
if( !file.get() || !file->FileSize()) {
|
||||||
|
@ -681,7 +681,7 @@ void MD5Importer::LoadMD5AnimFile ()
|
||||||
void MD5Importer::LoadMD5CameraFile ()
|
void MD5Importer::LoadMD5CameraFile ()
|
||||||
{
|
{
|
||||||
std::string pFile = mFile + "md5camera";
|
std::string pFile = mFile + "md5camera";
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( !file.get() || !file->FileSize()) {
|
if( !file.get() || !file->FileSize()) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "MDCNormalTable.h" // shouldn't be included by other units
|
#include "MDCNormalTable.h" // shouldn't be included by other units
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ void MDCImporter::SetupProperties(const Importer* pImp)
|
||||||
void MDCImporter::InternReadFile(
|
void MDCImporter::InternReadFile(
|
||||||
const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
|
const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL)
|
if( file.get() == NULL)
|
||||||
|
|
|
@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "MD2FileData.h"
|
#include "MD2FileData.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
|
@ -156,7 +156,7 @@ void MDLImporter::InternReadFile( const std::string& pFile,
|
||||||
{
|
{
|
||||||
pScene = _pScene;
|
pScene = _pScene;
|
||||||
pIOHandler = _pIOHandler;
|
pIOHandler = _pIOHandler;
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2016, assimp team
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer in the documentation and/or other
|
||||||
|
materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the assimp team, nor the names of its
|
||||||
|
contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior
|
||||||
|
written permission of the assimp team.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @file MathFunctions.h
|
||||||
|
* @brief Implementation of the math functions (gcd and lcm)
|
||||||
|
*
|
||||||
|
* Copied from BoostWorkaround/math
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
namespace Math {
|
||||||
|
|
||||||
|
// TODO: use binary GCD for unsigned integers ....
|
||||||
|
template < typename IntegerType >
|
||||||
|
IntegerType gcd( IntegerType a, IntegerType b )
|
||||||
|
{
|
||||||
|
const IntegerType zero = (IntegerType)0;
|
||||||
|
while ( true )
|
||||||
|
{
|
||||||
|
if ( a == zero )
|
||||||
|
return b;
|
||||||
|
b %= a;
|
||||||
|
|
||||||
|
if ( b == zero )
|
||||||
|
return a;
|
||||||
|
a %= b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename IntegerType >
|
||||||
|
IntegerType lcm( IntegerType a, IntegerType b )
|
||||||
|
{
|
||||||
|
const IntegerType t = gcd (a,b);
|
||||||
|
if (!t)return t;
|
||||||
|
return a / t * b;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,10 +50,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/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include "StreamReader.h"
|
#include "StreamReader.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
#define for_each BOOST_FOREACH
|
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static const aiImporterDesc desc = {
|
||||||
"Nendo Mesh Importer",
|
"Nendo Mesh Importer",
|
||||||
|
@ -241,7 +239,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
|
||||||
std::vector<aiVector3D> vertices;
|
std::vector<aiVector3D> vertices;
|
||||||
std::vector<unsigned int> indices;
|
std::vector<unsigned int> indices;
|
||||||
|
|
||||||
for_each(const Object& obj,objects) {
|
for(const Object& obj : objects) {
|
||||||
aiNode* nd = *cc++ = new aiNode(obj.name);
|
aiNode* nd = *cc++ = new aiNode(obj.name);
|
||||||
nd->mParent = root;
|
nd->mParent = root;
|
||||||
|
|
||||||
|
@ -250,7 +248,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
|
||||||
FaceTable face_table;
|
FaceTable face_table;
|
||||||
|
|
||||||
unsigned int n = 0;
|
unsigned int n = 0;
|
||||||
for_each(const Edge& edge, obj.edges) {
|
for(const Edge& edge : obj.edges) {
|
||||||
|
|
||||||
face_table[edge.edge[2]] = n;
|
face_table[edge.edge[2]] = n;
|
||||||
face_table[edge.edge[3]] = n;
|
face_table[edge.edge[3]] = n;
|
||||||
|
@ -263,7 +261,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
|
||||||
|
|
||||||
vertices.clear();
|
vertices.clear();
|
||||||
vertices.reserve(4 * face_table.size()); // arbitrarily chosen
|
vertices.reserve(4 * face_table.size()); // arbitrarily chosen
|
||||||
for_each(FaceTable::value_type& v, face_table) {
|
for(FaceTable::value_type& v : face_table) {
|
||||||
indices.clear();
|
indices.clear();
|
||||||
|
|
||||||
aiFace& f = *faces++;
|
aiFace& f = *faces++;
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "StandardShapes.h"
|
#include "StandardShapes.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include "RemoveComments.h"
|
#include "RemoveComments.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
@ -133,7 +133,7 @@ const aiImporterDesc* NFFImporter::GetInfo () const
|
||||||
void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
|
void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
|
||||||
const std::string& path, IOSystem* pIOHandler)
|
const std::string& path, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( path, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( path, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( !file.get()) {
|
if( !file.get()) {
|
||||||
|
@ -235,7 +235,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
|
||||||
void NFFImporter::InternReadFile( const std::string& pFile,
|
void NFFImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( !file.get())
|
if( !file.get())
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "OFFLoader.h"
|
#include "OFFLoader.h"
|
||||||
#include "ParsingUtils.h"
|
#include "ParsingUtils.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
|
@ -109,7 +109,7 @@ const aiImporterDesc* OFFImporter::GetInfo () const
|
||||||
void OFFImporter::InternReadFile( const std::string& pFile,
|
void OFFImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
|
|
@ -51,8 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <boost/foreach.hpp>
|
#include <memory>
|
||||||
#include <boost/scoped_ptr.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -67,14 +66,14 @@ void ExportSceneObj(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene
|
||||||
|
|
||||||
// we're still here - export successfully completed. Write both the main OBJ file and the material script
|
// we're still here - export successfully completed. Write both the main OBJ file and the material script
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
||||||
if(outfile == NULL) {
|
if(outfile == NULL) {
|
||||||
throw DeadlyExportError("could not open output .obj file: " + std::string(pFile));
|
throw DeadlyExportError("could not open output .obj file: " + std::string(pFile));
|
||||||
}
|
}
|
||||||
outfile->Write( exporter.mOutput.str().c_str(), static_cast<size_t>(exporter.mOutput.tellp()),1);
|
outfile->Write( exporter.mOutput.str().c_str(), static_cast<size_t>(exporter.mOutput.tellp()),1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(exporter.GetMaterialLibFileName(),"wt"));
|
std::unique_ptr<IOStream> outfile (pIOSystem->Open(exporter.GetMaterialLibFileName(),"wt"));
|
||||||
if(outfile == NULL) {
|
if(outfile == NULL) {
|
||||||
throw DeadlyExportError("could not open output .mtl file: " + std::string(exporter.GetMaterialLibFileName()));
|
throw DeadlyExportError("could not open output .mtl file: " + std::string(exporter.GetMaterialLibFileName()));
|
||||||
}
|
}
|
||||||
|
@ -217,7 +216,7 @@ void ObjExporter :: WriteGeometryFile()
|
||||||
// write vertex positions
|
// write vertex positions
|
||||||
vpMap.getVectors(vp);
|
vpMap.getVectors(vp);
|
||||||
mOutput << "# " << vp.size() << " vertex positions" << endl;
|
mOutput << "# " << vp.size() << " vertex positions" << endl;
|
||||||
BOOST_FOREACH(const aiVector3D& v, vp) {
|
for(const aiVector3D& v : vp) {
|
||||||
mOutput << "v " << v.x << " " << v.y << " " << v.z << endl;
|
mOutput << "v " << v.x << " " << v.y << " " << v.z << endl;
|
||||||
}
|
}
|
||||||
mOutput << endl;
|
mOutput << endl;
|
||||||
|
@ -225,7 +224,7 @@ void ObjExporter :: WriteGeometryFile()
|
||||||
// write uv coordinates
|
// write uv coordinates
|
||||||
vtMap.getVectors(vt);
|
vtMap.getVectors(vt);
|
||||||
mOutput << "# " << vt.size() << " UV coordinates" << endl;
|
mOutput << "# " << vt.size() << " UV coordinates" << endl;
|
||||||
BOOST_FOREACH(const aiVector3D& v, vt) {
|
for(const aiVector3D& v : vt) {
|
||||||
mOutput << "vt " << v.x << " " << v.y << " " << v.z << endl;
|
mOutput << "vt " << v.x << " " << v.y << " " << v.z << endl;
|
||||||
}
|
}
|
||||||
mOutput << endl;
|
mOutput << endl;
|
||||||
|
@ -233,22 +232,22 @@ void ObjExporter :: WriteGeometryFile()
|
||||||
// write vertex normals
|
// write vertex normals
|
||||||
vnMap.getVectors(vn);
|
vnMap.getVectors(vn);
|
||||||
mOutput << "# " << vn.size() << " vertex normals" << endl;
|
mOutput << "# " << vn.size() << " vertex normals" << endl;
|
||||||
BOOST_FOREACH(const aiVector3D& v, vn) {
|
for(const aiVector3D& v : vn) {
|
||||||
mOutput << "vn " << v.x << " " << v.y << " " << v.z << endl;
|
mOutput << "vn " << v.x << " " << v.y << " " << v.z << endl;
|
||||||
}
|
}
|
||||||
mOutput << endl;
|
mOutput << endl;
|
||||||
|
|
||||||
// now write all mesh instances
|
// now write all mesh instances
|
||||||
BOOST_FOREACH(const MeshInstance& m, meshes) {
|
for(const MeshInstance& m : meshes) {
|
||||||
mOutput << "# Mesh \'" << m.name << "\' with " << m.faces.size() << " faces" << endl;
|
mOutput << "# Mesh \'" << m.name << "\' with " << m.faces.size() << " faces" << endl;
|
||||||
if (!m.name.empty()) {
|
if (!m.name.empty()) {
|
||||||
mOutput << "g " << m.name << endl;
|
mOutput << "g " << m.name << endl;
|
||||||
}
|
}
|
||||||
mOutput << "usemtl " << m.matname << endl;
|
mOutput << "usemtl " << m.matname << endl;
|
||||||
|
|
||||||
BOOST_FOREACH(const Face& f, m.faces) {
|
for(const Face& f : m.faces) {
|
||||||
mOutput << f.kind << ' ';
|
mOutput << f.kind << ' ';
|
||||||
BOOST_FOREACH(const FaceVertex& fv, f.indices) {
|
for(const FaceVertex& fv : f.indices) {
|
||||||
mOutput << ' ' << fv.vp;
|
mOutput << ' ' << fv.vp;
|
||||||
|
|
||||||
if (f.kind != 'p') {
|
if (f.kind != 'p') {
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "ObjFileImporter.h"
|
#include "ObjFileImporter.h"
|
||||||
#include "ObjFileParser.h"
|
#include "ObjFileParser.h"
|
||||||
#include "ObjFileData.h"
|
#include "ObjFileData.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/ai_assert.h>
|
#include <assimp/ai_assert.h>
|
||||||
|
@ -117,7 +117,7 @@ const aiImporterDesc* ObjFileImporter::GetInfo () const
|
||||||
void ObjFileImporter::InternReadFile( const std::string &file, aiScene* pScene, IOSystem* pIOHandler) {
|
void ObjFileImporter::InternReadFile( const std::string &file, aiScene* pScene, IOSystem* pIOHandler) {
|
||||||
// Read file into memory
|
// Read file into memory
|
||||||
static const std::string mode = "rb";
|
static const std::string mode = "rb";
|
||||||
boost::scoped_ptr<IOStream> fileStream( pIOHandler->Open( file, mode));
|
std::unique_ptr<IOStream> fileStream( pIOHandler->Open( file, mode));
|
||||||
if( !fileStream.get() ) {
|
if( !fileStream.get() ) {
|
||||||
throw DeadlyImportError( "Failed to open file " + file + "." );
|
throw DeadlyImportError( "Failed to open file " + file + "." );
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace Ogre
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef Assimp::StreamReaderLE MemoryStreamReader;
|
typedef Assimp::StreamReaderLE MemoryStreamReader;
|
||||||
typedef boost::shared_ptr<MemoryStreamReader> MemoryStreamReaderPtr;
|
typedef std::shared_ptr<MemoryStreamReader> MemoryStreamReaderPtr;
|
||||||
|
|
||||||
class OgreBinarySerializer
|
class OgreBinarySerializer
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "OgreBinarySerializer.h"
|
#include "OgreBinarySerializer.h"
|
||||||
#include "OgreXmlSerializer.h"
|
#include "OgreXmlSerializer.h"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static const aiImporterDesc desc = {
|
||||||
"Ogre3D Mesh Importer",
|
"Ogre3D Mesh Importer",
|
||||||
|
@ -110,7 +110,7 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
||||||
MemoryStreamReader reader(f);
|
MemoryStreamReader reader(f);
|
||||||
|
|
||||||
// Import mesh
|
// Import mesh
|
||||||
boost::scoped_ptr<Mesh> mesh(OgreBinarySerializer::ImportMesh(&reader));
|
std::unique_ptr<Mesh> mesh(OgreBinarySerializer::ImportMesh(&reader));
|
||||||
|
|
||||||
// Import skeleton
|
// Import skeleton
|
||||||
OgreBinarySerializer::ImportSkeleton(pIOHandler, mesh.get());
|
OgreBinarySerializer::ImportSkeleton(pIOHandler, mesh.get());
|
||||||
|
@ -125,12 +125,12 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/// @note XmlReader does not take ownership of f, hence the scoped ptr.
|
/// @note XmlReader does not take ownership of f, hence the scoped ptr.
|
||||||
boost::scoped_ptr<IOStream> scopedFile(f);
|
std::unique_ptr<IOStream> scopedFile(f);
|
||||||
boost::scoped_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(scopedFile.get()));
|
std::unique_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(scopedFile.get()));
|
||||||
boost::scoped_ptr<XmlReader> reader(irr::io::createIrrXMLReader(xmlStream.get()));
|
std::unique_ptr<XmlReader> reader(irr::io::createIrrXMLReader(xmlStream.get()));
|
||||||
|
|
||||||
// Import mesh
|
// Import mesh
|
||||||
boost::scoped_ptr<MeshXml> mesh(OgreXmlSerializer::ImportMesh(reader.get()));
|
std::unique_ptr<MeshXml> mesh(OgreXmlSerializer::ImportMesh(reader.get()));
|
||||||
|
|
||||||
// Import skeleton
|
// Import skeleton
|
||||||
OgreXmlSerializer::ImportSkeleton(pIOHandler, mesh.get());
|
OgreXmlSerializer::ImportSkeleton(pIOHandler, mesh.get());
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::scoped_ptr<IOStream> stream(materialFile);
|
std::unique_ptr<IOStream> stream(materialFile);
|
||||||
if (stream->FileSize() == 0)
|
if (stream->FileSize() == 0)
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->warn(Formatter::format() << "Source file for material '" << materialName << "' is empty (size is 0 bytes)");
|
DefaultLogger::get()->warn(Formatter::format() << "Source file for material '" << materialName << "' is empty (size is 0 bytes)");
|
||||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
|
||||||
|
|
||||||
#include "MemoryIOWrapper.h"
|
#include "MemoryIOWrapper.h"
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/mesh.h"
|
#include "../include/assimp/mesh.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -76,7 +76,7 @@ class Skeleton;
|
||||||
|
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef Assimp::MemoryIOStream MemoryStream;
|
typedef Assimp::MemoryIOStream MemoryStream;
|
||||||
typedef boost::shared_ptr<MemoryStream> MemoryStreamPtr;
|
typedef std::shared_ptr<MemoryStream> MemoryStreamPtr;
|
||||||
typedef std::map<uint16_t, MemoryStreamPtr> VertexBufferBindings;
|
typedef std::map<uint16_t, MemoryStreamPtr> VertexBufferBindings;
|
||||||
|
|
||||||
// Ogre Vertex Element
|
// Ogre Vertex Element
|
||||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "TinyFormatter.h"
|
#include "TinyFormatter.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
|
||||||
|
|
||||||
|
@ -742,12 +742,12 @@ XmlReaderPtr OgreXmlSerializer::OpenReader(Assimp::IOSystem *pIOHandler, const s
|
||||||
return XmlReaderPtr();
|
return XmlReaderPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::scoped_ptr<IOStream> file(pIOHandler->Open(filename));
|
std::unique_ptr<IOStream> file(pIOHandler->Open(filename));
|
||||||
if (!file.get()) {
|
if (!file.get()) {
|
||||||
throw DeadlyImportError("Failed to open skeleton file " + filename);
|
throw DeadlyImportError("Failed to open skeleton file " + filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::scoped_ptr<CIrrXML_IOStreamReader> stream(new CIrrXML_IOStreamReader(file.get()));
|
std::unique_ptr<CIrrXML_IOStreamReader> stream(new CIrrXML_IOStreamReader(file.get()));
|
||||||
XmlReaderPtr reader = XmlReaderPtr(irr::io::createIrrXMLReader(stream.get()));
|
XmlReaderPtr reader = XmlReaderPtr(irr::io::createIrrXMLReader(stream.get()));
|
||||||
if (!reader.get()) {
|
if (!reader.get()) {
|
||||||
throw DeadlyImportError("Failed to create XML reader for skeleton file " + filename);
|
throw DeadlyImportError("Failed to create XML reader for skeleton file " + filename);
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace Ogre
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef irr::io::IrrXMLReader XmlReader;
|
typedef irr::io::IrrXMLReader XmlReader;
|
||||||
typedef boost::shared_ptr<XmlReader> XmlReaderPtr;
|
typedef std::shared_ptr<XmlReader> XmlReaderPtr;
|
||||||
|
|
||||||
class OgreXmlSerializer
|
class OgreXmlSerializer
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#if !defined(ASSIMP_BUILD_NO_EXPORT) && !defined(ASSIMP_BUILD_NO_PLY_EXPORTER)
|
#if !defined(ASSIMP_BUILD_NO_EXPORT) && !defined(ASSIMP_BUILD_NO_PLY_EXPORTER)
|
||||||
|
|
||||||
#include "PlyExporter.h"
|
#include "PlyExporter.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "Exceptional.h"
|
#include "Exceptional.h"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
@ -64,7 +64,7 @@ void ExportScenePly(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene
|
||||||
PlyExporter exporter(pFile, pScene);
|
PlyExporter exporter(pFile, pScene);
|
||||||
|
|
||||||
// we're still here - export successfully completed. Write the file.
|
// we're still here - export successfully completed. Write the file.
|
||||||
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
||||||
if(outfile == NULL) {
|
if(outfile == NULL) {
|
||||||
throw DeadlyExportError("could not open output .ply file: " + std::string(pFile));
|
throw DeadlyExportError("could not open output .ply file: " + std::string(pFile));
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ void ExportScenePlyBinary(const char* pFile, IOSystem* pIOSystem, const aiScene*
|
||||||
PlyExporter exporter(pFile, pScene, true);
|
PlyExporter exporter(pFile, pScene, true);
|
||||||
|
|
||||||
// we're still here - export successfully completed. Write the file.
|
// we're still here - export successfully completed. Write the file.
|
||||||
boost::scoped_ptr<IOStream> outfile(pIOSystem->Open(pFile, "wb"));
|
std::unique_ptr<IOStream> outfile(pIOSystem->Open(pFile, "wb"));
|
||||||
if (outfile == NULL) {
|
if (outfile == NULL) {
|
||||||
throw DeadlyExportError("could not open output .ply file: " + std::string(pFile));
|
throw DeadlyExportError("could not open output .ply file: " + std::string(pFile));
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "PlyLoader.h"
|
#include "PlyLoader.h"
|
||||||
#include "Macros.h"
|
#include "Macros.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ static bool isBigEndian( const char* szMe ) {
|
||||||
void PLYImporter::InternReadFile( const std::string& pFile,
|
void PLYImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_PROFILER_H
|
#ifndef INCLUDED_PROFILER_H
|
||||||
#define INCLUDED_PROFILER_H
|
#define INCLUDED_PROFILER_H
|
||||||
|
|
||||||
#include "boost/timer.hpp"
|
#include <chrono>
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "TinyFormatter.h"
|
#include "TinyFormatter.h"
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
|
|
||||||
/** Start a named timer */
|
/** Start a named timer */
|
||||||
void BeginRegion(const std::string& region) {
|
void BeginRegion(const std::string& region) {
|
||||||
regions[region] = boost::timer();
|
regions[region] = std::chrono::system_clock::now();
|
||||||
DefaultLogger::get()->debug((format("START `"),region,"`"));
|
DefaultLogger::get()->debug((format("START `"),region,"`"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,12 +83,13 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultLogger::get()->debug((format("END `"),region,"`, dt= ",(*it).second.elapsed()," s"));
|
auto elapsedSeconds = std::chrono::system_clock::now() - regions[region];
|
||||||
|
DefaultLogger::get()->debug((format("END `"),region,"`, dt= ", elapsedSeconds.count()," s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::map<std::string,boost::timer> RegionMap;
|
typedef std::map<std::string,std::chrono::time_point<std::chrono::system_clock>> RegionMap;
|
||||||
RegionMap regions;
|
RegionMap regions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "RawLoader.h"
|
#include "RawLoader.h"
|
||||||
#include "ParsingUtils.h"
|
#include "ParsingUtils.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
@ -99,7 +99,7 @@ const aiImporterDesc* RAWImporter::GetInfo () const
|
||||||
void RAWImporter::InternReadFile( const std::string& pFile,
|
void RAWImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "SkeletonMeshBuilder.h"
|
#include "SkeletonMeshBuilder.h"
|
||||||
#include "../include/assimp/Importer.hpp"
|
#include "../include/assimp/Importer.hpp"
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ void SMDImporter::SetupProperties(const Importer* pImp)
|
||||||
// Imports the given file into the given scene structure.
|
// Imports the given file into the given scene structure.
|
||||||
void SMDImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
|
void SMDImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
|
|
@ -41,8 +41,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_STEPFILE_H
|
#ifndef INCLUDED_AI_STEPFILE_H
|
||||||
#define INCLUDED_AI_STEPFILE_H
|
#define INCLUDED_AI_STEPFILE_H
|
||||||
|
|
||||||
#include <boost/noncopyable.hpp>
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
@ -168,7 +166,7 @@ namespace STEP {
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef boost::shared_ptr<const DataType> Out;
|
typedef std::shared_ptr<const DataType> Out;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -219,7 +217,7 @@ namespace STEP {
|
||||||
*
|
*
|
||||||
* @throw SyntaxError
|
* @throw SyntaxError
|
||||||
*/
|
*/
|
||||||
static boost::shared_ptr<const EXPRESS::DataType> Parse(const char*& inout,
|
static std::shared_ptr<const EXPRESS::DataType> Parse(const char*& inout,
|
||||||
uint64_t line = SyntaxError::LINE_NOT_SPECIFIED,
|
uint64_t line = SyntaxError::LINE_NOT_SPECIFIED,
|
||||||
const EXPRESS::ConversionSchema* schema = NULL);
|
const EXPRESS::ConversionSchema* schema = NULL);
|
||||||
|
|
||||||
|
@ -339,7 +337,7 @@ namespace STEP {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// access a particular list index, throw std::range_error for wrong indices
|
// access a particular list index, throw std::range_error for wrong indices
|
||||||
boost::shared_ptr<const DataType> operator[] (size_t index) const {
|
std::shared_ptr<const DataType> operator[] (size_t index) const {
|
||||||
return members[index];
|
return members[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,13 +348,13 @@ namespace STEP {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** @see DaraType::Parse */
|
/** @see DaraType::Parse */
|
||||||
static boost::shared_ptr<const EXPRESS::LIST> Parse(const char*& inout,
|
static std::shared_ptr<const EXPRESS::LIST> Parse(const char*& inout,
|
||||||
uint64_t line = SyntaxError::LINE_NOT_SPECIFIED,
|
uint64_t line = SyntaxError::LINE_NOT_SPECIFIED,
|
||||||
const EXPRESS::ConversionSchema* schema = NULL);
|
const EXPRESS::ConversionSchema* schema = NULL);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::vector< boost::shared_ptr<const DataType> > MemberList;
|
typedef std::vector< std::shared_ptr<const DataType> > MemberList;
|
||||||
MemberList members;
|
MemberList members;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -510,7 +508,7 @@ namespace STEP {
|
||||||
|
|
||||||
static Object* Construct(const STEP::DB& db, const EXPRESS::LIST& params) {
|
static Object* Construct(const STEP::DB& db, const EXPRESS::LIST& params) {
|
||||||
// make sure we don't leak if Fill() throws an exception
|
// make sure we don't leak if Fill() throws an exception
|
||||||
std::auto_ptr<TDerived> impl(new TDerived());
|
std::unique_ptr<TDerived> impl(new TDerived());
|
||||||
|
|
||||||
// GenericFill<T> is undefined so we need to have a specialization
|
// GenericFill<T> is undefined so we need to have a specialization
|
||||||
const size_t num_args = GenericFill<TDerived>(db,params,&*impl);
|
const size_t num_args = GenericFill<TDerived>(db,params,&*impl);
|
||||||
|
@ -590,7 +588,7 @@ namespace STEP {
|
||||||
/** A LazyObject is created when needed. Before this happens, we just keep
|
/** A LazyObject is created when needed. Before this happens, we just keep
|
||||||
the text line that contains the object definition. */
|
the text line that contains the object definition. */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
class LazyObject : public boost::noncopyable
|
class LazyObject
|
||||||
{
|
{
|
||||||
friend class DB;
|
friend class DB;
|
||||||
public:
|
public:
|
||||||
|
@ -598,6 +596,11 @@ namespace STEP {
|
||||||
LazyObject(DB& db, uint64_t id, uint64_t line, const char* type,const char* args);
|
LazyObject(DB& db, uint64_t id, uint64_t line, const char* type,const char* args);
|
||||||
~LazyObject();
|
~LazyObject();
|
||||||
|
|
||||||
|
LazyObject( LazyObject const& ) = delete;
|
||||||
|
LazyObject operator=( LazyObject const& ) = delete;
|
||||||
|
LazyObject( LazyObject && ) = delete;
|
||||||
|
LazyObject operator=( LazyObject && ) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Object& operator * () {
|
Object& operator * () {
|
||||||
|
@ -671,12 +674,12 @@ namespace STEP {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator==( boost::shared_ptr<LazyObject> lo, T whatever ) {
|
inline bool operator==( std::shared_ptr<LazyObject> lo, T whatever ) {
|
||||||
return *lo == whatever; // XXX use std::forward if we have 0x
|
return *lo == whatever; // XXX use std::forward if we have 0x
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator==( const std::pair<uint64_t, boost::shared_ptr<LazyObject> >& lo, T whatever ) {
|
inline bool operator==( const std::pair<uint64_t, std::shared_ptr<LazyObject> >& lo, T whatever ) {
|
||||||
return *(lo.second) == whatever; // XXX use std::forward if we have 0x
|
return *(lo.second) == whatever; // XXX use std::forward if we have 0x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,12 +741,12 @@ namespace STEP {
|
||||||
typedef EXPRESS::ENTITY Type;
|
typedef EXPRESS::ENTITY Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct PickBaseType< boost::shared_ptr< const EXPRESS::DataType > >;
|
template <> struct PickBaseType< std::shared_ptr< const EXPRESS::DataType > >;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct InternGenericConvert {
|
struct InternGenericConvert {
|
||||||
void operator()(T& out, const boost::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& /*db*/) {
|
void operator()(T& out, const std::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& /*db*/) {
|
||||||
try{
|
try{
|
||||||
out = dynamic_cast< const typename PickBaseType<T>::Type& > ( *in );
|
out = dynamic_cast< const typename PickBaseType<T>::Type& > ( *in );
|
||||||
}
|
}
|
||||||
|
@ -754,15 +757,15 @@ namespace STEP {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct InternGenericConvert< boost::shared_ptr< const EXPRESS::DataType > > {
|
struct InternGenericConvert< std::shared_ptr< const EXPRESS::DataType > > {
|
||||||
void operator()(boost::shared_ptr< const EXPRESS::DataType >& out, const boost::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& /*db*/) {
|
void operator()(std::shared_ptr< const EXPRESS::DataType >& out, const std::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& /*db*/) {
|
||||||
out = in;
|
out = in;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct InternGenericConvert< Maybe<T> > {
|
struct InternGenericConvert< Maybe<T> > {
|
||||||
void operator()(Maybe<T>& out, const boost::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& db) {
|
void operator()(Maybe<T>& out, const std::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& db) {
|
||||||
GenericConvert((T&)out,in,db);
|
GenericConvert((T&)out,in,db);
|
||||||
out.flag_valid();
|
out.flag_valid();
|
||||||
}
|
}
|
||||||
|
@ -770,7 +773,7 @@ namespace STEP {
|
||||||
|
|
||||||
template <typename T,uint64_t min_cnt, uint64_t max_cnt>
|
template <typename T,uint64_t min_cnt, uint64_t max_cnt>
|
||||||
struct InternGenericConvertList {
|
struct InternGenericConvertList {
|
||||||
void operator()(ListOf<T, min_cnt, max_cnt>& out, const boost::shared_ptr< const EXPRESS::DataType >& inp_base, const STEP::DB& db) {
|
void operator()(ListOf<T, min_cnt, max_cnt>& out, const std::shared_ptr< const EXPRESS::DataType >& inp_base, const STEP::DB& db) {
|
||||||
|
|
||||||
const EXPRESS::LIST* inp = dynamic_cast<const EXPRESS::LIST*>(inp_base.get());
|
const EXPRESS::LIST* inp = dynamic_cast<const EXPRESS::LIST*>(inp_base.get());
|
||||||
if (!inp) {
|
if (!inp) {
|
||||||
|
@ -801,7 +804,7 @@ namespace STEP {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct InternGenericConvert< Lazy<T> > {
|
struct InternGenericConvert< Lazy<T> > {
|
||||||
void operator()(Lazy<T>& out, const boost::shared_ptr< const EXPRESS::DataType >& in_base, const STEP::DB& db) {
|
void operator()(Lazy<T>& out, const std::shared_ptr< const EXPRESS::DataType >& in_base, const STEP::DB& db) {
|
||||||
const EXPRESS::ENTITY* in = dynamic_cast<const EXPRESS::ENTITY*>(in_base.get());
|
const EXPRESS::ENTITY* in = dynamic_cast<const EXPRESS::ENTITY*>(in_base.get());
|
||||||
if (!in) {
|
if (!in) {
|
||||||
throw TypeError("type error reading entity");
|
throw TypeError("type error reading entity");
|
||||||
|
@ -811,12 +814,12 @@ namespace STEP {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1>
|
template <typename T1>
|
||||||
inline void GenericConvert(T1& a, const boost::shared_ptr< const EXPRESS::DataType >& b, const STEP::DB& db) {
|
inline void GenericConvert(T1& a, const std::shared_ptr< const EXPRESS::DataType >& b, const STEP::DB& db) {
|
||||||
return InternGenericConvert<T1>()(a,b,db);
|
return InternGenericConvert<T1>()(a,b,db);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T1,uint64_t N1, uint64_t N2>
|
template <typename T1,uint64_t N1, uint64_t N2>
|
||||||
inline void GenericConvert(ListOf<T1,N1,N2>& a, const boost::shared_ptr< const EXPRESS::DataType >& b, const STEP::DB& db) {
|
inline void GenericConvert(ListOf<T1,N1,N2>& a, const std::shared_ptr< const EXPRESS::DataType >& b, const STEP::DB& db) {
|
||||||
return InternGenericConvertList<T1,N1,N2>()(a,b,db);
|
return InternGenericConvertList<T1,N1,N2>()(a,b,db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,7 +831,7 @@ namespace STEP {
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
class DB
|
class DB
|
||||||
{
|
{
|
||||||
friend DB* ReadFileHeader(boost::shared_ptr<IOStream> stream);
|
friend DB* ReadFileHeader(std::shared_ptr<IOStream> stream);
|
||||||
friend void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme,
|
friend void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme,
|
||||||
const char* const* types_to_track, size_t len,
|
const char* const* types_to_track, size_t len,
|
||||||
const char* const* inverse_indices_to_track, size_t len2
|
const char* const* inverse_indices_to_track, size_t len2
|
||||||
|
@ -858,7 +861,7 @@ namespace STEP {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DB(boost::shared_ptr<StreamReaderLE> reader)
|
DB(std::shared_ptr<StreamReaderLE> reader)
|
||||||
: reader(reader)
|
: reader(reader)
|
||||||
, splitter(*reader,true,true)
|
, splitter(*reader,true,true)
|
||||||
, evaluated_count()
|
, evaluated_count()
|
||||||
|
@ -868,7 +871,7 @@ namespace STEP {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
~DB() {
|
~DB() {
|
||||||
BOOST_FOREACH(ObjectMap::value_type& o, objects) {
|
for(ObjectMap::value_type& o : objects) {
|
||||||
delete o.second;
|
delete o.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -950,7 +953,7 @@ namespace STEP {
|
||||||
|
|
||||||
// evaluate *all* entities in the file. this is a power test for the loader
|
// evaluate *all* entities in the file. this is a power test for the loader
|
||||||
void EvaluateAll() {
|
void EvaluateAll() {
|
||||||
BOOST_FOREACH(ObjectMap::value_type& e,objects) {
|
for(ObjectMap::value_type& e :objects) {
|
||||||
**e.second;
|
**e.second;
|
||||||
}
|
}
|
||||||
ai_assert(evaluated_count == objects.size());
|
ai_assert(evaluated_count == objects.size());
|
||||||
|
@ -1013,7 +1016,7 @@ namespace STEP {
|
||||||
RefMap refs;
|
RefMap refs;
|
||||||
InverseWhitelist inv_whitelist;
|
InverseWhitelist inv_whitelist;
|
||||||
|
|
||||||
boost::shared_ptr<StreamReaderLE> reader;
|
std::shared_ptr<StreamReaderLE> reader;
|
||||||
LineSplitter splitter;
|
LineSplitter splitter;
|
||||||
|
|
||||||
uint64_t evaluated_count;
|
uint64_t evaluated_count;
|
||||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
|
|
||||||
#include "../contrib/ConvertUTF/ConvertUTF.h"
|
#include "../contrib/ConvertUTF/ConvertUTF.h"
|
||||||
#include <boost/scoped_array.hpp>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ bool STEP::StringToUTF8(std::string& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t count = (j-basei)/4;
|
const size_t count = (j-basei)/4;
|
||||||
boost::scoped_array<UTF16> src(new UTF16[count]);
|
std::unique_ptr<UTF16[]> src(new UTF16[count]);
|
||||||
|
|
||||||
const char* cur = s.c_str() + basei;
|
const char* cur = s.c_str() + basei;
|
||||||
for (size_t k = 0; k < count; ++k, cur += 4) {
|
for (size_t k = 0; k < count; ++k, cur += 4) {
|
||||||
|
@ -363,7 +363,7 @@ bool STEP::StringToUTF8(std::string& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t dcount = count * 3; // this is enough to hold all possible outputs
|
const size_t dcount = count * 3; // this is enough to hold all possible outputs
|
||||||
boost::scoped_array<UTF8> dest(new UTF8[dcount]);
|
std::unique_ptr<UTF8[]> dest(new UTF8[dcount]);
|
||||||
|
|
||||||
const UTF16* srct = src.get();
|
const UTF16* srct = src.get();
|
||||||
UTF8* destt = dest.get();
|
UTF8* destt = dest.get();
|
||||||
|
@ -387,7 +387,7 @@ bool STEP::StringToUTF8(std::string& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t count = (j-basei)/8;
|
const size_t count = (j-basei)/8;
|
||||||
boost::scoped_array<UTF32> src(new UTF32[count]);
|
std::unique_ptr<UTF32[]> src(new UTF32[count]);
|
||||||
|
|
||||||
const char* cur = s.c_str() + basei;
|
const char* cur = s.c_str() + basei;
|
||||||
for (size_t k = 0; k < count; ++k, cur += 8) {
|
for (size_t k = 0; k < count; ++k, cur += 8) {
|
||||||
|
@ -398,7 +398,7 @@ bool STEP::StringToUTF8(std::string& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t dcount = count * 5; // this is enough to hold all possible outputs
|
const size_t dcount = count * 5; // this is enough to hold all possible outputs
|
||||||
boost::scoped_array<UTF8> dest(new UTF8[dcount]);
|
std::unique_ptr<UTF8[]> dest(new UTF8[dcount]);
|
||||||
|
|
||||||
const UTF32* srct = src.get();
|
const UTF32* srct = src.get();
|
||||||
UTF8* destt = dest.get();
|
UTF8* destt = dest.get();
|
||||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "STEPFileEncoding.h"
|
#include "STEPFileEncoding.h"
|
||||||
#include "TinyFormatter.h"
|
#include "TinyFormatter.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include <boost/make_shared.hpp>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -85,10 +85,10 @@ STEP::TypeError::TypeError (const std::string& s,uint64_t entity /* = ENTITY_NOT
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
STEP::DB* STEP::ReadFileHeader(boost::shared_ptr<IOStream> stream)
|
STEP::DB* STEP::ReadFileHeader(std::shared_ptr<IOStream> stream)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<StreamReaderLE> reader = boost::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
|
std::shared_ptr<StreamReaderLE> reader = std::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
|
||||||
std::auto_ptr<STEP::DB> db = std::auto_ptr<STEP::DB>(new STEP::DB(reader));
|
std::unique_ptr<STEP::DB> db = std::unique_ptr<STEP::DB>(new STEP::DB(reader));
|
||||||
|
|
||||||
LineSplitter& splitter = db->GetSplitter();
|
LineSplitter& splitter = db->GetSplitter();
|
||||||
if (!splitter || *splitter != "ISO-10303-21;") {
|
if (!splitter || *splitter != "ISO-10303-21;") {
|
||||||
|
@ -110,7 +110,7 @@ STEP::DB* STEP::ReadFileHeader(boost::shared_ptr<IOStream> stream)
|
||||||
if (s.substr(0,11) == "FILE_SCHEMA") {
|
if (s.substr(0,11) == "FILE_SCHEMA") {
|
||||||
const char* sz = s.c_str()+11;
|
const char* sz = s.c_str()+11;
|
||||||
SkipSpaces(sz,&sz);
|
SkipSpaces(sz,&sz);
|
||||||
boost::shared_ptr< const EXPRESS::DataType > schema = EXPRESS::DataType::Parse(sz);
|
std::shared_ptr< const EXPRESS::DataType > schema = EXPRESS::DataType::Parse(sz);
|
||||||
|
|
||||||
// the file schema should be a regular list entity, although it usually contains exactly one entry
|
// the file schema should be a regular list entity, although it usually contains exactly one entry
|
||||||
// since the list itself is contained in a regular parameter list, we actually have
|
// since the list itself is contained in a regular parameter list, we actually have
|
||||||
|
@ -300,7 +300,7 @@ void STEP::ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
boost::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*& inout,uint64_t line, const EXPRESS::ConversionSchema* schema /*= NULL*/)
|
std::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*& inout,uint64_t line, const EXPRESS::ConversionSchema* schema /*= NULL*/)
|
||||||
{
|
{
|
||||||
const char* cur = inout;
|
const char* cur = inout;
|
||||||
SkipSpaces(&cur);
|
SkipSpaces(&cur);
|
||||||
|
@ -321,7 +321,7 @@ boost::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*&
|
||||||
std::transform(s.begin(),s.end(),s.begin(),&ToLower<char> );
|
std::transform(s.begin(),s.end(),s.begin(),&ToLower<char> );
|
||||||
if (schema->IsKnownToken(s)) {
|
if (schema->IsKnownToken(s)) {
|
||||||
for(cur = t+1;*cur++ != '(';);
|
for(cur = t+1;*cur++ != '(';);
|
||||||
const boost::shared_ptr<const EXPRESS::DataType> dt = Parse(cur);
|
const std::shared_ptr<const EXPRESS::DataType> dt = Parse(cur);
|
||||||
inout = *cur ? cur+1 : cur;
|
inout = *cur ? cur+1 : cur;
|
||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
@ -335,11 +335,11 @@ boost::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*&
|
||||||
|
|
||||||
if (*cur == '*' ) {
|
if (*cur == '*' ) {
|
||||||
inout = cur+1;
|
inout = cur+1;
|
||||||
return boost::make_shared<EXPRESS::ISDERIVED>();
|
return std::make_shared<EXPRESS::ISDERIVED>();
|
||||||
}
|
}
|
||||||
else if (*cur == '$' ) {
|
else if (*cur == '$' ) {
|
||||||
inout = cur+1;
|
inout = cur+1;
|
||||||
return boost::make_shared<EXPRESS::UNSET>();
|
return std::make_shared<EXPRESS::UNSET>();
|
||||||
}
|
}
|
||||||
else if (*cur == '(' ) {
|
else if (*cur == '(' ) {
|
||||||
// start of an aggregate, further parsing is done by the LIST factory constructor
|
// start of an aggregate, further parsing is done by the LIST factory constructor
|
||||||
|
@ -355,11 +355,11 @@ boost::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inout = cur+1;
|
inout = cur+1;
|
||||||
return boost::make_shared<EXPRESS::ENUMERATION>(std::string(start, static_cast<size_t>(cur-start) ));
|
return std::make_shared<EXPRESS::ENUMERATION>(std::string(start, static_cast<size_t>(cur-start) ));
|
||||||
}
|
}
|
||||||
else if (*cur == '#' ) {
|
else if (*cur == '#' ) {
|
||||||
// object reference
|
// object reference
|
||||||
return boost::make_shared<EXPRESS::ENTITY>(strtoul10_64(++cur,&inout));
|
return std::make_shared<EXPRESS::ENTITY>(strtoul10_64(++cur,&inout));
|
||||||
}
|
}
|
||||||
else if (*cur == '\'' ) {
|
else if (*cur == '\'' ) {
|
||||||
// string literal
|
// string literal
|
||||||
|
@ -393,7 +393,7 @@ boost::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*&
|
||||||
DefaultLogger::get()->error("an error occurred reading escape sequences in ASCII text");
|
DefaultLogger::get()->error("an error occurred reading escape sequences in ASCII text");
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::make_shared<EXPRESS::STRING>(stemp);
|
return std::make_shared<EXPRESS::STRING>(stemp);
|
||||||
}
|
}
|
||||||
else if (*cur == '\"' ) {
|
else if (*cur == '\"' ) {
|
||||||
throw STEP::SyntaxError("binary data not supported yet",line);
|
throw STEP::SyntaxError("binary data not supported yet",line);
|
||||||
|
@ -406,7 +406,7 @@ boost::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*&
|
||||||
if (*cur == '.') {
|
if (*cur == '.') {
|
||||||
double f;
|
double f;
|
||||||
inout = fast_atoreal_move<double>(start,f);
|
inout = fast_atoreal_move<double>(start,f);
|
||||||
return boost::make_shared<EXPRESS::REAL>(f);
|
return std::make_shared<EXPRESS::REAL>(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,14 +419,14 @@ boost::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*&
|
||||||
++start;
|
++start;
|
||||||
}
|
}
|
||||||
int64_t num = static_cast<int64_t>( strtoul10_64(start,&inout) );
|
int64_t num = static_cast<int64_t>( strtoul10_64(start,&inout) );
|
||||||
return boost::make_shared<EXPRESS::INTEGER>(neg?-num:num);
|
return std::make_shared<EXPRESS::INTEGER>(neg?-num:num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
boost::shared_ptr<const EXPRESS::LIST> EXPRESS::LIST::Parse(const char*& inout,uint64_t line, const EXPRESS::ConversionSchema* schema /*= NULL*/)
|
std::shared_ptr<const EXPRESS::LIST> EXPRESS::LIST::Parse(const char*& inout,uint64_t line, const EXPRESS::ConversionSchema* schema /*= NULL*/)
|
||||||
{
|
{
|
||||||
const boost::shared_ptr<EXPRESS::LIST> list = boost::make_shared<EXPRESS::LIST>();
|
const std::shared_ptr<EXPRESS::LIST> list = std::make_shared<EXPRESS::LIST>();
|
||||||
EXPRESS::LIST::MemberList& members = list->members;
|
EXPRESS::LIST::MemberList& members = list->members;
|
||||||
|
|
||||||
const char* cur = inout;
|
const char* cur = inout;
|
||||||
|
@ -522,7 +522,7 @@ void STEP::LazyObject::LazyInit() const
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* acopy = args;
|
const char* acopy = args;
|
||||||
boost::shared_ptr<const EXPRESS::LIST> conv_args = EXPRESS::LIST::Parse(acopy,STEP::SyntaxError::LINE_NOT_SPECIFIED,&db.GetSchema());
|
std::shared_ptr<const EXPRESS::LIST> conv_args = EXPRESS::LIST::Parse(acopy,STEP::SyntaxError::LINE_NOT_SPECIFIED,&db.GetSchema());
|
||||||
delete[] args;
|
delete[] args;
|
||||||
args = NULL;
|
args = NULL;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace STEP {
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// 1) read file header and return to caller, who checks if the
|
// 1) read file header and return to caller, who checks if the
|
||||||
// file is of a supported schema ..
|
// file is of a supported schema ..
|
||||||
DB* ReadFileHeader(boost::shared_ptr<IOStream> stream);
|
DB* ReadFileHeader(std::shared_ptr<IOStream> stream);
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// 2) read the actual file contents using a user-supplied set of
|
// 2) read the actual file contents using a user-supplied set of
|
||||||
// conversion functions to interpret the data.
|
// conversion functions to interpret the data.
|
||||||
|
|
|
@ -47,7 +47,7 @@ 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/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include "../include/assimp/Exporter.hpp"
|
#include "../include/assimp/Exporter.hpp"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "Exceptional.h"
|
#include "Exceptional.h"
|
||||||
#include "ByteSwapper.h"
|
#include "ByteSwapper.h"
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ void ExportSceneSTL(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene
|
||||||
STLExporter exporter(pFile, pScene);
|
STLExporter exporter(pFile, pScene);
|
||||||
|
|
||||||
// we're still here - export successfully completed. Write the file.
|
// we're still here - export successfully completed. Write the file.
|
||||||
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
||||||
if(outfile == NULL) {
|
if(outfile == NULL) {
|
||||||
throw DeadlyExportError("could not open output .stl file: " + std::string(pFile));
|
throw DeadlyExportError("could not open output .stl file: " + std::string(pFile));
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ void ExportSceneSTLBinary(const char* pFile,IOSystem* pIOSystem, const aiScene*
|
||||||
STLExporter exporter(pFile, pScene, true);
|
STLExporter exporter(pFile, pScene, true);
|
||||||
|
|
||||||
// we're still here - export successfully completed. Write the file.
|
// we're still here - export successfully completed. Write the file.
|
||||||
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wb"));
|
std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wb"));
|
||||||
if(outfile == NULL) {
|
if(outfile == NULL) {
|
||||||
throw DeadlyExportError("could not open output .stl file: " + std::string(pFile));
|
throw DeadlyExportError("could not open output .stl file: " + std::string(pFile));
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "STLLoader.h"
|
#include "STLLoader.h"
|
||||||
#include "ParsingUtils.h"
|
#include "ParsingUtils.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
|
@ -172,7 +172,7 @@ void addFacesToMesh(aiMesh* pMesh)
|
||||||
void STLImporter::InternReadFile( const std::string& pFile,
|
void STLImporter::InternReadFile( const std::string& pFile,
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
aiScene* pScene, IOSystem* pIOHandler)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if( file.get() == NULL) {
|
if( file.get() == NULL) {
|
||||||
|
|
|
@ -48,9 +48,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <boost/format.hpp>
|
#include "TinyFormatter.h"
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
using namespace Assimp::Formatter;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
|
@ -95,7 +96,7 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene)
|
||||||
|
|
||||||
if( !isNecessary )
|
if( !isNecessary )
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->debug( boost::str( boost::format( "SplitByBoneCountProcess early-out: no meshes with more than %d bones.") % mMaxBoneCount));
|
DefaultLogger::get()->debug( format() << "SplitByBoneCountProcess early-out: no meshes with more than " << mMaxBoneCount << " bones." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +144,7 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene)
|
||||||
// recurse through all nodes and translate the node's mesh indices to fit the new mesh array
|
// recurse through all nodes and translate the node's mesh indices to fit the new mesh array
|
||||||
UpdateNode( pScene->mRootNode);
|
UpdateNode( pScene->mRootNode);
|
||||||
|
|
||||||
DefaultLogger::get()->debug( boost::str( boost::format( "SplitByBoneCountProcess end: split %d meshes into %d submeshes.") % mSubMeshIndices.size() % meshes.size()));
|
DefaultLogger::get()->debug( format() << "SplitByBoneCountProcess end: split " << mSubMeshIndices.size() << " meshes into " << meshes.size() << " submeshes." );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -234,7 +235,7 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
// create a new mesh to hold this subset of the source mesh
|
// create a new mesh to hold this subset of the source mesh
|
||||||
aiMesh* newMesh = new aiMesh;
|
aiMesh* newMesh = new aiMesh;
|
||||||
if( pMesh->mName.length > 0 )
|
if( pMesh->mName.length > 0 )
|
||||||
newMesh->mName.Set( boost::str( boost::format( "%s_sub%d") % pMesh->mName.data % poNewMeshes.size()));
|
newMesh->mName.Set( format() << pMesh->mName.data << "_sub" << poNewMeshes.size());
|
||||||
newMesh->mMaterialIndex = pMesh->mMaterialIndex;
|
newMesh->mMaterialIndex = pMesh->mMaterialIndex;
|
||||||
newMesh->mPrimitiveTypes = pMesh->mPrimitiveTypes;
|
newMesh->mPrimitiveTypes = pMesh->mPrimitiveTypes;
|
||||||
poNewMeshes.push_back( newMesh);
|
poNewMeshes.push_back( newMesh);
|
||||||
|
|
|
@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include "Exceptional.h"
|
#include "Exceptional.h"
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/scene.h"
|
#include "../include/assimp/scene.h"
|
||||||
|
@ -102,7 +102,7 @@ void ExportSceneStep(const char* pFile,IOSystem* pIOSystem, const aiScene* pScen
|
||||||
StepExporter iDoTheExportThing( pScene, pIOSystem, path, file, &props);
|
StepExporter iDoTheExportThing( pScene, pIOSystem, path, file, &props);
|
||||||
|
|
||||||
// we're still here - export successfully completed. Write result to the given IOSYstem
|
// we're still here - export successfully completed. Write result to the given IOSYstem
|
||||||
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
|
||||||
if(outfile == NULL) {
|
if(outfile == NULL) {
|
||||||
throw DeadlyExportError("could not open output .stp file: " + std::string(pFile));
|
throw DeadlyExportError("could not open output .stp file: " + std::string(pFile));
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "ByteSwapper.h"
|
#include "ByteSwapper.h"
|
||||||
#include "Exceptional.h"
|
#include "Exceptional.h"
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
#include "../include/assimp/IOStream.hpp"
|
#include "../include/assimp/IOStream.hpp"
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
* stream is in little endian byte order. Otherwise the
|
* stream is in little endian byte order. Otherwise the
|
||||||
* endianness information is contained in the @c SwapEndianess
|
* endianness information is contained in the @c SwapEndianess
|
||||||
* template parameter and this parameter is meaningless. */
|
* template parameter and this parameter is meaningless. */
|
||||||
StreamReader(boost::shared_ptr<IOStream> stream, bool le = false)
|
StreamReader(std::shared_ptr<IOStream> stream, bool le = false)
|
||||||
: stream(stream)
|
: stream(stream)
|
||||||
, le(le)
|
, le(le)
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ public:
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
StreamReader(IOStream* stream, bool le = false)
|
StreamReader(IOStream* stream, bool le = false)
|
||||||
: stream(boost::shared_ptr<IOStream>(stream))
|
: stream(std::shared_ptr<IOStream>(stream))
|
||||||
, le(le)
|
, le(le)
|
||||||
{
|
{
|
||||||
ai_assert(stream);
|
ai_assert(stream);
|
||||||
|
@ -339,7 +339,7 @@ private:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
boost::shared_ptr<IOStream> stream;
|
std::shared_ptr<IOStream> stream;
|
||||||
int8_t *buffer, *current, *end, *limit;
|
int8_t *buffer, *current, *end, *limit;
|
||||||
bool le;
|
bool le;
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "ByteSwapper.h"
|
#include "ByteSwapper.h"
|
||||||
#include "../include/assimp/IOStream.hpp"
|
#include "../include/assimp/IOStream.hpp"
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
* stream is in little endian byte order. Otherwise the
|
* stream is in little endian byte order. Otherwise the
|
||||||
* endianness information is defined by the @c SwapEndianess
|
* endianness information is defined by the @c SwapEndianess
|
||||||
* template parameter and this parameter is meaningless. */
|
* template parameter and this parameter is meaningless. */
|
||||||
StreamWriter(boost::shared_ptr<IOStream> stream, bool le = false)
|
StreamWriter(std::shared_ptr<IOStream> stream, bool le = false)
|
||||||
: stream(stream)
|
: stream(stream)
|
||||||
, le(le)
|
, le(le)
|
||||||
, cursor()
|
, cursor()
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
StreamWriter(IOStream* stream, bool le = false)
|
StreamWriter(IOStream* stream, bool le = false)
|
||||||
: stream(boost::shared_ptr<IOStream>(stream))
|
: stream(std::shared_ptr<IOStream>(stream))
|
||||||
, le(le)
|
, le(le)
|
||||||
, cursor()
|
, cursor()
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,7 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
boost::shared_ptr<IOStream> stream;
|
std::shared_ptr<IOStream> stream;
|
||||||
bool le;
|
bool le;
|
||||||
|
|
||||||
std::vector<uint8_t> buffer;
|
std::vector<uint8_t> buffer;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue