Merge branch 'master' into master
commit
25c5384208
|
@ -60,6 +60,7 @@ test/gtest/src/gtest-stamp/Debug/gtest-build
|
||||||
*.lib
|
*.lib
|
||||||
test/gtest/src/gtest-stamp/Debug/
|
test/gtest/src/gtest-stamp/Debug/
|
||||||
tools/assimp_view/assimp_viewer.vcxproj.user
|
tools/assimp_view/assimp_viewer.vcxproj.user
|
||||||
|
*.pyc
|
||||||
|
|
||||||
# Unix editor backups
|
# Unix editor backups
|
||||||
*~
|
*~
|
||||||
|
|
|
@ -103,6 +103,7 @@ OPTION ( BUILD_DOCS
|
||||||
OFF
|
OFF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Use subset of Windows.h
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
||||||
endif()
|
endif()
|
||||||
|
@ -203,7 +204,6 @@ IF( UNIX )
|
||||||
INCLUDE(GNUInstallDirs)
|
INCLUDE(GNUInstallDirs)
|
||||||
ENDIF( UNIX )
|
ENDIF( UNIX )
|
||||||
|
|
||||||
|
|
||||||
# Grouped compiler settings
|
# Grouped compiler settings
|
||||||
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
|
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
|
||||||
# hide all not-exported symbols
|
# hide all not-exported symbols
|
||||||
|
|
|
@ -43,7 +43,7 @@ __Importers__:
|
||||||
- AMJ
|
- AMJ
|
||||||
- ASE
|
- ASE
|
||||||
- ASK
|
- ASK
|
||||||
- B3D;
|
- B3D
|
||||||
- BLEND (Blender)
|
- BLEND (Blender)
|
||||||
- BVH
|
- BVH
|
||||||
- COB
|
- COB
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "TargetAnimation.h"
|
#include "TargetAnimation.h"
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include "StringComparison.h"
|
#include <assimp/StringComparison.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
@ -127,9 +127,8 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
|
||||||
if (cnt && idx == mScene->mMaterials.size())
|
if (cnt && idx == mScene->mMaterials.size())
|
||||||
{
|
{
|
||||||
// We need to create our own default material
|
// We need to create our own default material
|
||||||
D3DS::Material sMat;
|
D3DS::Material sMat("%%%DEFAULT");
|
||||||
sMat.mDiffuse = aiColor3D(0.3f,0.3f,0.3f);
|
sMat.mDiffuse = aiColor3D(0.3f,0.3f,0.3f);
|
||||||
sMat.mName = "%%%DEFAULT";
|
|
||||||
mScene->mMaterials.push_back(sMat);
|
mScene->mMaterials.push_back(sMat);
|
||||||
|
|
||||||
DefaultLogger::get()->info("3DS: Generating default material");
|
DefaultLogger::get()->info("3DS: Generating default material");
|
||||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "3DSHelper.h"
|
#include "3DSHelper.h"
|
||||||
#include <assimp/SceneCombiner.h>
|
#include <assimp/SceneCombiner.h>
|
||||||
#include "SplitLargeMeshes.h"
|
#include "SplitLargeMeshes.h"
|
||||||
#include "StringComparison.h"
|
#include <assimp/StringComparison.h>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
|
|
|
@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "StreamWriter.h"
|
#include <assimp/StreamWriter.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
|
||||||
struct aiScene;
|
struct aiScene;
|
||||||
|
|
|
@ -44,10 +44,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_3DSFILEHELPER_H_INC
|
#ifndef AI_3DSFILEHELPER_H_INC
|
||||||
#define AI_3DSFILEHELPER_H_INC
|
#define AI_3DSFILEHELPER_H_INC
|
||||||
|
|
||||||
#include "SpatialSort.h"
|
#include <assimp/SpatialSort.h>
|
||||||
#include "SmoothingGroups.h"
|
#include <assimp/SmoothingGroups.h>
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
#include "qnan.h"
|
#include <assimp/qnan.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
#include <assimp/camera.h>
|
#include <assimp/camera.h>
|
||||||
#include <assimp/light.h>
|
#include <assimp/light.h>
|
||||||
|
@ -370,9 +370,14 @@ struct Texture
|
||||||
/** Helper structure representing a 3ds material */
|
/** Helper structure representing a 3ds material */
|
||||||
struct Material
|
struct Material
|
||||||
{
|
{
|
||||||
//! Default constructor. Builds a default name for the material
|
//! Default constructor has been deleted
|
||||||
Material()
|
Material() = delete;
|
||||||
: mDiffuse ( ai_real( 0.6 ), ai_real( 0.6 ), ai_real( 0.6 ) ) // FIX ... we won't want object to be black
|
|
||||||
|
|
||||||
|
//! Constructor with explicit name
|
||||||
|
explicit Material(const std::string &name)
|
||||||
|
: mName(name)
|
||||||
|
, mDiffuse ( ai_real( 0.6 ), ai_real( 0.6 ), ai_real( 0.6 ) ) // FIX ... we won't want object to be black
|
||||||
, mSpecularExponent ( ai_real( 0.0 ) )
|
, mSpecularExponent ( ai_real( 0.0 ) )
|
||||||
, mShininessStrength ( ai_real( 1.0 ) )
|
, mShininessStrength ( ai_real( 1.0 ) )
|
||||||
, mShading(Discreet3DS::Gouraud)
|
, mShading(Discreet3DS::Gouraud)
|
||||||
|
@ -380,13 +385,70 @@ struct Material
|
||||||
, mBumpHeight ( ai_real( 1.0 ) )
|
, mBumpHeight ( ai_real( 1.0 ) )
|
||||||
, mTwoSided (false)
|
, mTwoSided (false)
|
||||||
{
|
{
|
||||||
static int iCnt = 0;
|
|
||||||
|
|
||||||
char szTemp[128];
|
|
||||||
ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
|
|
||||||
mName = szTemp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Material(const Material &other) = default;
|
||||||
|
Material &operator=(const Material &other) = default;
|
||||||
|
|
||||||
|
|
||||||
|
//! Move constructor. This is explicitly written because MSVC doesn't support defaulting it
|
||||||
|
Material(Material &&other)
|
||||||
|
: mName(std::move(other.mName))
|
||||||
|
, mDiffuse(std::move(other.mDiffuse))
|
||||||
|
, mSpecularExponent(std::move(other.mSpecularExponent))
|
||||||
|
, mShininessStrength(std::move(other.mShininessStrength))
|
||||||
|
, mSpecular(std::move(other.mSpecular))
|
||||||
|
, mAmbient(std::move(other.mAmbient))
|
||||||
|
, mShading(std::move(other.mShading))
|
||||||
|
, mTransparency(std::move(other.mTransparency))
|
||||||
|
, sTexDiffuse(std::move(other.sTexDiffuse))
|
||||||
|
, sTexOpacity(std::move(other.sTexOpacity))
|
||||||
|
, sTexSpecular(std::move(other.sTexSpecular))
|
||||||
|
, sTexReflective(std::move(other.sTexReflective))
|
||||||
|
, sTexBump(std::move(other.sTexBump))
|
||||||
|
, sTexEmissive(std::move(other.sTexEmissive))
|
||||||
|
, sTexShininess(std::move(other.sTexShininess))
|
||||||
|
, mBumpHeight(std::move(other.mBumpHeight))
|
||||||
|
, mEmissive(std::move(other.mEmissive))
|
||||||
|
, sTexAmbient(std::move(other.sTexAmbient))
|
||||||
|
, mTwoSided(std::move(other.mTwoSided))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Material &operator=(Material &&other) {
|
||||||
|
if (this == &other) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
mName = std::move(other.mName);
|
||||||
|
mDiffuse = std::move(other.mDiffuse);
|
||||||
|
mSpecularExponent = std::move(other.mSpecularExponent);
|
||||||
|
mShininessStrength = std::move(other.mShininessStrength),
|
||||||
|
mSpecular = std::move(other.mSpecular);
|
||||||
|
mAmbient = std::move(other.mAmbient);
|
||||||
|
mShading = std::move(other.mShading);
|
||||||
|
mTransparency = std::move(other.mTransparency);
|
||||||
|
sTexDiffuse = std::move(other.sTexDiffuse);
|
||||||
|
sTexOpacity = std::move(other.sTexOpacity);
|
||||||
|
sTexSpecular = std::move(other.sTexSpecular);
|
||||||
|
sTexReflective = std::move(other.sTexReflective);
|
||||||
|
sTexBump = std::move(other.sTexBump);
|
||||||
|
sTexEmissive = std::move(other.sTexEmissive);
|
||||||
|
sTexShininess = std::move(other.sTexShininess);
|
||||||
|
mBumpHeight = std::move(other.mBumpHeight);
|
||||||
|
mEmissive = std::move(other.mEmissive);
|
||||||
|
sTexAmbient = std::move(other.sTexAmbient);
|
||||||
|
mTwoSided = std::move(other.mTwoSided);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
~Material() {}
|
||||||
|
|
||||||
|
|
||||||
//! Name of the material
|
//! Name of the material
|
||||||
std::string mName;
|
std::string mName;
|
||||||
//! Diffuse color of the material
|
//! Diffuse color of the material
|
||||||
|
|
|
@ -51,12 +51,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "3DSLoader.h"
|
#include "3DSLoader.h"
|
||||||
#include "Macros.h"
|
#include <assimp/Macros.h>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include "StringComparison.h"
|
#include <assimp/StringComparison.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -105,14 +105,14 @@ static const aiImporterDesc desc = {
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
Discreet3DSImporter::Discreet3DSImporter()
|
Discreet3DSImporter::Discreet3DSImporter()
|
||||||
: stream(),
|
: stream()
|
||||||
mLastNodeIndex(),
|
, mLastNodeIndex()
|
||||||
mCurrentNode(),
|
, mCurrentNode()
|
||||||
mRootNode(),
|
, mRootNode()
|
||||||
mScene(),
|
, mScene()
|
||||||
mMasterScale(),
|
, mMasterScale()
|
||||||
bHasBG(),
|
, bHasBG()
|
||||||
bIsPrj()
|
, bIsPrj()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -346,7 +346,7 @@ void Discreet3DSImporter::ParseObjectChunk()
|
||||||
case Discreet3DS::CHUNK_MAT_MATERIAL:
|
case Discreet3DS::CHUNK_MAT_MATERIAL:
|
||||||
|
|
||||||
// Add a new material to the list
|
// Add a new material to the list
|
||||||
mScene->mMaterials.push_back(D3DS::Material());
|
mScene->mMaterials.push_back(D3DS::Material(std::string("UNNAMED_" + std::to_string(mScene->mMaterials.size()))));
|
||||||
ParseMaterialChunk();
|
ParseMaterialChunk();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_3DSIMPORTER_H_INC
|
#ifndef AI_3DSIMPORTER_H_INC
|
||||||
#define AI_3DSIMPORTER_H_INC
|
#define AI_3DSIMPORTER_H_INC
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||||
|
|
||||||
#include "3DSHelper.h"
|
#include "3DSHelper.h"
|
||||||
#include "StreamReader.h"
|
#include <assimp/StreamReader.h>
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "ACLoader.h"
|
#include "ACLoader.h"
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include "Subdivision.h"
|
#include <assimp/Subdivision.h>
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/light.h>
|
#include <assimp/light.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AMFImporter.hpp"
|
#include "AMFImporter.hpp"
|
||||||
#include "AMFImporter_Macro.hpp"
|
#include "AMFImporter_Macro.hpp"
|
||||||
|
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include <assimp/DefaultIOSystem.h>
|
#include <assimp/DefaultIOSystem.h>
|
||||||
|
|
||||||
// Header files, stdlib.
|
// Header files, stdlib.
|
||||||
|
|
|
@ -56,8 +56,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include "assimp/types.h"
|
#include "assimp/types.h"
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "irrXMLWrapper.h"
|
#include <assimp/irrXMLWrapper.h>
|
||||||
|
|
||||||
// Header files, stdlib.
|
// Header files, stdlib.
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
|
@ -51,8 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Header files, Assimp.
|
// Header files, Assimp.
|
||||||
#include <assimp/SceneCombiner.h>
|
#include <assimp/SceneCombiner.h>
|
||||||
#include "StandardShapes.h"
|
#include <assimp/StandardShapes.h>
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
|
|
||||||
// Header files, stdlib.
|
// Header files, stdlib.
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
|
@ -50,8 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "ASELoader.h"
|
#include "ASELoader.h"
|
||||||
#include "StringComparison.h"
|
#include <assimp/StringComparison.h>
|
||||||
#include "SkeletonMeshBuilder.h"
|
#include <assimp/SkeletonMeshBuilder.h>
|
||||||
#include "TargetAnimation.h"
|
#include "TargetAnimation.h"
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
|
@ -62,7 +62,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
// utilities
|
// utilities
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
using namespace Assimp::ASE;
|
using namespace Assimp::ASE;
|
||||||
|
@ -83,11 +83,11 @@ static const aiImporterDesc desc = {
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
ASEImporter::ASEImporter()
|
ASEImporter::ASEImporter()
|
||||||
: mParser(),
|
: mParser()
|
||||||
mBuffer(),
|
, mBuffer()
|
||||||
pcScene(),
|
, pcScene()
|
||||||
configRecomputeNormals(),
|
, configRecomputeNormals()
|
||||||
noSkeletonMesh()
|
, noSkeletonMesh()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -276,14 +276,13 @@ void ASEImporter::GenerateDefaultMaterial()
|
||||||
}
|
}
|
||||||
if (bHas || mParser->m_vMaterials.empty()) {
|
if (bHas || mParser->m_vMaterials.empty()) {
|
||||||
// add a simple material without submaterials to the parser's list
|
// add a simple material without submaterials to the parser's list
|
||||||
mParser->m_vMaterials.push_back ( ASE::Material() );
|
mParser->m_vMaterials.push_back ( ASE::Material(AI_DEFAULT_MATERIAL_NAME) );
|
||||||
ASE::Material& mat = mParser->m_vMaterials.back();
|
ASE::Material& mat = mParser->m_vMaterials.back();
|
||||||
|
|
||||||
mat.mDiffuse = aiColor3D(0.6f,0.6f,0.6f);
|
mat.mDiffuse = aiColor3D(0.6f,0.6f,0.6f);
|
||||||
mat.mSpecular = aiColor3D(1.0f,1.0f,1.0f);
|
mat.mSpecular = aiColor3D(1.0f,1.0f,1.0f);
|
||||||
mat.mAmbient = aiColor3D(0.05f,0.05f,0.05f);
|
mat.mAmbient = aiColor3D(0.05f,0.05f,0.05f);
|
||||||
mat.mShading = Discreet3DS::Gouraud;
|
mat.mShading = Discreet3DS::Gouraud;
|
||||||
mat.mName = AI_DEFAULT_MATERIAL_NAME;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_ASELOADER_H_INCLUDED
|
#ifndef AI_ASELOADER_H_INCLUDED
|
||||||
#define AI_ASELOADER_H_INCLUDED
|
#define AI_ASELOADER_H_INCLUDED
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
#include "ASEParser.h"
|
#include "ASEParser.h"
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "TextureTransform.h"
|
#include "TextureTransform.h"
|
||||||
#include "ASELoader.h"
|
#include "ASELoader.h"
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -528,7 +528,7 @@ void Parser::ParseLV1MaterialListBlock()
|
||||||
ParseLV4MeshLong(iMaterialCount);
|
ParseLV4MeshLong(iMaterialCount);
|
||||||
|
|
||||||
// now allocate enough storage to hold all materials
|
// now allocate enough storage to hold all materials
|
||||||
m_vMaterials.resize(iOldMaterialCount+iMaterialCount);
|
m_vMaterials.resize(iOldMaterialCount+iMaterialCount, Material("INVALID"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (TokenMatch(filePtr,"MATERIAL",8))
|
if (TokenMatch(filePtr,"MATERIAL",8))
|
||||||
|
@ -706,7 +706,7 @@ void Parser::ParseLV2MaterialBlock(ASE::Material& mat)
|
||||||
ParseLV4MeshLong(iNumSubMaterials);
|
ParseLV4MeshLong(iNumSubMaterials);
|
||||||
|
|
||||||
// allocate enough storage
|
// allocate enough storage
|
||||||
mat.avSubMaterials.resize(iNumSubMaterials);
|
mat.avSubMaterials.resize(iNumSubMaterials, Material("INVALID SUBMATERIAL"));
|
||||||
}
|
}
|
||||||
// submaterial chunks
|
// submaterial chunks
|
||||||
if (TokenMatch(filePtr,"SUBMATERIAL",11))
|
if (TokenMatch(filePtr,"SUBMATERIAL",11))
|
||||||
|
|
|
@ -52,8 +52,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||||
|
|
||||||
// for some helper routines like IsSpace()
|
// for some helper routines like IsSpace()
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "qnan.h"
|
#include <assimp/qnan.h>
|
||||||
|
|
||||||
// ASE is quite similar to 3ds. We can reuse some structures
|
// ASE is quite similar to 3ds. We can reuse some structures
|
||||||
#include "3DSLoader.h"
|
#include "3DSLoader.h"
|
||||||
|
@ -67,10 +67,53 @@ using namespace D3DS;
|
||||||
/** Helper structure representing an ASE material */
|
/** Helper structure representing an ASE material */
|
||||||
struct Material : public D3DS::Material
|
struct Material : public D3DS::Material
|
||||||
{
|
{
|
||||||
//! Default constructor
|
//! Default constructor has been deleted
|
||||||
Material() : pcInstance(NULL), bNeed (false)
|
Material() = delete;
|
||||||
|
|
||||||
|
|
||||||
|
//! Constructor with explicit name
|
||||||
|
explicit Material(const std::string &name)
|
||||||
|
: D3DS::Material(name)
|
||||||
|
, pcInstance(NULL)
|
||||||
|
, bNeed (false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Material(const Material &other) = default;
|
||||||
|
Material &operator=(const Material &other) = default;
|
||||||
|
|
||||||
|
|
||||||
|
//! Move constructor. This is explicitly written because MSVC doesn't support defaulting it
|
||||||
|
Material(Material &&other)
|
||||||
|
: D3DS::Material(std::move(other))
|
||||||
|
, avSubMaterials(std::move(other.avSubMaterials))
|
||||||
|
, pcInstance(std::move(other.pcInstance))
|
||||||
|
, bNeed(std::move(other.bNeed))
|
||||||
|
{
|
||||||
|
other.pcInstance = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Material &operator=(Material &&other) {
|
||||||
|
if (this == &other) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
D3DS::Material::operator=(std::move(other));
|
||||||
|
|
||||||
|
avSubMaterials = std::move(other.avSubMaterials);
|
||||||
|
pcInstance = std::move(other.pcInstance);
|
||||||
|
bNeed = std::move(other.bNeed);
|
||||||
|
|
||||||
|
other.pcInstance = nullptr;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
~Material() {}
|
||||||
|
|
||||||
|
|
||||||
//! Contains all sub materials of this material
|
//! Contains all sub materials of this material
|
||||||
std::vector<Material> avSubMaterials;
|
std::vector<Material> avSubMaterials;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
|
|
||||||
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
|
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
|
||||||
# include <zlib.h>
|
# include <zlib.h>
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "AssbinLoader.h"
|
#include "AssbinLoader.h"
|
||||||
#include "assbin_chunks.h"
|
#include "assbin_chunks.h"
|
||||||
#include "MemoryIOWrapper.h"
|
#include <assimp/MemoryIOWrapper.h>
|
||||||
#include <assimp/mesh.h>
|
#include <assimp/mesh.h>
|
||||||
#include <assimp/anim.h>
|
#include <assimp/anim.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_ASSBINIMPORTER_H_INC
|
#ifndef AI_ASSBINIMPORTER_H_INC
|
||||||
#define AI_ASSBINIMPORTER_H_INC
|
#define AI_ASSBINIMPORTER_H_INC
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
struct aiMesh;
|
struct aiMesh;
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
|
@ -50,12 +50,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
#include "GenericProperty.h"
|
#include <assimp/GenericProperty.h>
|
||||||
#include "CInterfaceIOWrapper.h"
|
#include "CInterfaceIOWrapper.h"
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
#include "ScenePrivate.h"
|
#include "ScenePrivate.h"
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "B3DImporter.h"
|
#include "B3DImporter.h"
|
||||||
#include "TextureTransform.h"
|
#include "TextureTransform.h"
|
||||||
#include "ConvertToLHProcess.h"
|
#include "ConvertToLHProcess.h"
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/anim.h>
|
#include <assimp/anim.h>
|
||||||
|
@ -93,7 +93,6 @@ void DeleteAllBarePointers(std::vector<T>& x)
|
||||||
|
|
||||||
B3DImporter::~B3DImporter()
|
B3DImporter::~B3DImporter()
|
||||||
{
|
{
|
||||||
DeleteAllBarePointers(_animations);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -267,6 +266,21 @@ T *B3DImporter::to_array( const vector<T> &v ){
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
template<class T>
|
||||||
|
T **unique_to_array( vector<std::unique_ptr<T> > &v ){
|
||||||
|
if( v.empty() ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
T **p = new T*[ v.size() ];
|
||||||
|
for( size_t i = 0; i < v.size(); ++i ){
|
||||||
|
p[i] = v[i].release();
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void B3DImporter::ReadTEXS(){
|
void B3DImporter::ReadTEXS(){
|
||||||
while( ChunkSize() ){
|
while( ChunkSize() ){
|
||||||
|
@ -295,8 +309,7 @@ void B3DImporter::ReadBRUS(){
|
||||||
/*int blend=**/ReadInt();
|
/*int blend=**/ReadInt();
|
||||||
int fx=ReadInt();
|
int fx=ReadInt();
|
||||||
|
|
||||||
aiMaterial *mat=new aiMaterial;
|
std::unique_ptr<aiMaterial> mat(new aiMaterial);
|
||||||
_materials.push_back( mat );
|
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
aiString ainame( name );
|
aiString ainame( name );
|
||||||
|
@ -333,6 +346,7 @@ void B3DImporter::ReadBRUS(){
|
||||||
mat->AddProperty( &texname,AI_MATKEY_TEXTURE_DIFFUSE(0) );
|
mat->AddProperty( &texname,AI_MATKEY_TEXTURE_DIFFUSE(0) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_materials.emplace_back( std::move(mat) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,8 +400,7 @@ void B3DImporter::ReadTRIS( int v0 ){
|
||||||
Fail( "Bad material id" );
|
Fail( "Bad material id" );
|
||||||
}
|
}
|
||||||
|
|
||||||
aiMesh *mesh=new aiMesh;
|
std::unique_ptr<aiMesh> mesh(new aiMesh);
|
||||||
_meshes.push_back( mesh );
|
|
||||||
|
|
||||||
mesh->mMaterialIndex=matid;
|
mesh->mMaterialIndex=matid;
|
||||||
mesh->mNumFaces=0;
|
mesh->mNumFaces=0;
|
||||||
|
@ -415,6 +428,8 @@ void B3DImporter::ReadTRIS( int v0 ){
|
||||||
++mesh->mNumFaces;
|
++mesh->mNumFaces;
|
||||||
++face;
|
++face;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_meshes.emplace_back( std::move(mesh) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -500,11 +515,11 @@ void B3DImporter::ReadANIM(){
|
||||||
int frames=ReadInt();
|
int frames=ReadInt();
|
||||||
float fps=ReadFloat();
|
float fps=ReadFloat();
|
||||||
|
|
||||||
aiAnimation *anim=new aiAnimation;
|
std::unique_ptr<aiAnimation> anim(new aiAnimation);
|
||||||
_animations.push_back( anim );
|
|
||||||
|
|
||||||
anim->mDuration=frames;
|
anim->mDuration=frames;
|
||||||
anim->mTicksPerSecond=fps;
|
anim->mTicksPerSecond=fps;
|
||||||
|
_animations.emplace_back( std::move(anim) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -531,7 +546,7 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){
|
||||||
node->mParent=parent;
|
node->mParent=parent;
|
||||||
node->mTransformation=tform;
|
node->mTransformation=tform;
|
||||||
|
|
||||||
aiNodeAnim *nodeAnim=0;
|
std::unique_ptr<aiNodeAnim> nodeAnim;
|
||||||
vector<unsigned> meshes;
|
vector<unsigned> meshes;
|
||||||
vector<aiNode*> children;
|
vector<aiNode*> children;
|
||||||
|
|
||||||
|
@ -549,11 +564,10 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){
|
||||||
ReadANIM();
|
ReadANIM();
|
||||||
}else if( t=="KEYS" ){
|
}else if( t=="KEYS" ){
|
||||||
if( !nodeAnim ){
|
if( !nodeAnim ){
|
||||||
nodeAnim=new aiNodeAnim;
|
nodeAnim.reset(new aiNodeAnim);
|
||||||
_nodeAnims.push_back( nodeAnim );
|
|
||||||
nodeAnim->mNodeName=node->mName;
|
nodeAnim->mNodeName=node->mName;
|
||||||
}
|
}
|
||||||
ReadKEYS( nodeAnim );
|
ReadKEYS( nodeAnim.get() );
|
||||||
}else if( t=="NODE" ){
|
}else if( t=="NODE" ){
|
||||||
aiNode *child=ReadNODE( node );
|
aiNode *child=ReadNODE( node );
|
||||||
children.push_back( child );
|
children.push_back( child );
|
||||||
|
@ -561,6 +575,10 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){
|
||||||
ExitChunk();
|
ExitChunk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodeAnim) {
|
||||||
|
_nodeAnims.emplace_back( std::move(nodeAnim) );
|
||||||
|
}
|
||||||
|
|
||||||
node->mNumMeshes= static_cast<unsigned int>(meshes.size());
|
node->mNumMeshes= static_cast<unsigned int>(meshes.size());
|
||||||
node->mMeshes=to_array( meshes );
|
node->mMeshes=to_array( meshes );
|
||||||
|
|
||||||
|
@ -586,7 +604,6 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
|
||||||
|
|
||||||
_nodeAnims.clear();
|
_nodeAnims.clear();
|
||||||
|
|
||||||
DeleteAllBarePointers(_animations);
|
|
||||||
_animations.clear();
|
_animations.clear();
|
||||||
|
|
||||||
string t=ReadChunk();
|
string t=ReadChunk();
|
||||||
|
@ -622,7 +639,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
|
||||||
aiNode *node=_nodes[i];
|
aiNode *node=_nodes[i];
|
||||||
|
|
||||||
for( size_t j=0;j<node->mNumMeshes;++j ){
|
for( size_t j=0;j<node->mNumMeshes;++j ){
|
||||||
aiMesh *mesh=_meshes[node->mMeshes[j]];
|
aiMesh *mesh = _meshes[node->mMeshes[j]].get();
|
||||||
|
|
||||||
int n_tris=mesh->mNumFaces;
|
int n_tris=mesh->mNumFaces;
|
||||||
int n_verts=mesh->mNumVertices=n_tris * 3;
|
int n_verts=mesh->mNumVertices=n_tris * 3;
|
||||||
|
@ -685,27 +702,28 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
|
||||||
|
|
||||||
//nodes
|
//nodes
|
||||||
scene->mRootNode=_nodes[0];
|
scene->mRootNode=_nodes[0];
|
||||||
|
_nodes.clear(); // node ownership now belongs to scene
|
||||||
|
|
||||||
//material
|
//material
|
||||||
if( !_materials.size() ){
|
if( !_materials.size() ){
|
||||||
_materials.push_back( new aiMaterial );
|
_materials.emplace_back( std::unique_ptr<aiMaterial>(new aiMaterial) );
|
||||||
}
|
}
|
||||||
scene->mNumMaterials= static_cast<unsigned int>(_materials.size());
|
scene->mNumMaterials= static_cast<unsigned int>(_materials.size());
|
||||||
scene->mMaterials=to_array( _materials );
|
scene->mMaterials = unique_to_array( _materials );
|
||||||
|
|
||||||
//meshes
|
//meshes
|
||||||
scene->mNumMeshes= static_cast<unsigned int>(_meshes.size());
|
scene->mNumMeshes= static_cast<unsigned int>(_meshes.size());
|
||||||
scene->mMeshes=to_array( _meshes );
|
scene->mMeshes = unique_to_array( _meshes );
|
||||||
|
|
||||||
//animations
|
//animations
|
||||||
if( _animations.size()==1 && _nodeAnims.size() ){
|
if( _animations.size()==1 && _nodeAnims.size() ){
|
||||||
|
|
||||||
aiAnimation *anim=_animations.back();
|
aiAnimation *anim = _animations.back().get();
|
||||||
anim->mNumChannels=static_cast<unsigned int>(_nodeAnims.size());
|
anim->mNumChannels=static_cast<unsigned int>(_nodeAnims.size());
|
||||||
anim->mChannels=to_array( _nodeAnims );
|
anim->mChannels = unique_to_array( _nodeAnims );
|
||||||
|
|
||||||
scene->mNumAnimations=static_cast<unsigned int>(_animations.size());
|
scene->mNumAnimations=static_cast<unsigned int>(_animations.size());
|
||||||
scene->mAnimations=to_array( _animations );
|
scene->mAnimations=unique_to_array( _animations );
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert to RH
|
// convert to RH
|
||||||
|
|
|
@ -47,8 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
#include <assimp/mesh.h>
|
#include <assimp/mesh.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct aiNodeAnim;
|
struct aiNodeAnim;
|
||||||
|
@ -116,15 +117,15 @@ private:
|
||||||
std::vector<unsigned> _stack;
|
std::vector<unsigned> _stack;
|
||||||
|
|
||||||
std::vector<std::string> _textures;
|
std::vector<std::string> _textures;
|
||||||
std::vector<aiMaterial*> _materials;
|
std::vector<std::unique_ptr<aiMaterial> > _materials;
|
||||||
|
|
||||||
int _vflags,_tcsets,_tcsize;
|
int _vflags,_tcsets,_tcsize;
|
||||||
std::vector<Vertex> _vertices;
|
std::vector<Vertex> _vertices;
|
||||||
|
|
||||||
std::vector<aiNode*> _nodes;
|
std::vector<aiNode*> _nodes;
|
||||||
std::vector<aiMesh*> _meshes;
|
std::vector<std::unique_ptr<aiMesh> > _meshes;
|
||||||
std::vector<aiNodeAnim*> _nodeAnims;
|
std::vector<std::unique_ptr<aiNodeAnim> > _nodeAnims;
|
||||||
std::vector<aiAnimation*> _animations;
|
std::vector<std::unique_ptr<aiAnimation> > _animations;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_BVH_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_BVH_IMPORTER
|
||||||
|
|
||||||
#include "BVHLoader.h"
|
#include "BVHLoader.h"
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include "SkeletonMeshBuilder.h"
|
#include <assimp/SkeletonMeshBuilder.h>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
|
|
|
@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_BVHLOADER_H_INC
|
#ifndef AI_BVHLOADER_H_INC
|
||||||
#define AI_BVHLOADER_H_INC
|
#define AI_BVHLOADER_H_INC
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @brief Implementation of BaseImporter
|
* @brief Implementation of BaseImporter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "FileSystemFilter.h"
|
#include "FileSystemFilter.h"
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
#include "ByteSwapper.h"
|
#include <assimp/ByteSwapper.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
|
|
|
@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
/** @file Implementation of BaseProcess */
|
/** @file Implementation of BaseProcess */
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "BaseProcess.h"
|
#include "BaseProcess.h"
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define INCLUDED_AI_BASEPROCESS_H
|
#define INCLUDED_AI_BASEPROCESS_H
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "GenericProperty.h"
|
#include <assimp/GenericProperty.h>
|
||||||
|
|
||||||
struct aiScene;
|
struct aiScene;
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Bitmap.h"
|
#include <assimp/Bitmap.h>
|
||||||
#include <assimp/texture.h>
|
#include <assimp/texture.h>
|
||||||
#include <assimp/IOStream.hpp>
|
#include <assimp/IOStream.hpp>
|
||||||
#include "ByteSwapper.h"
|
#include <assimp/ByteSwapper.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
@ -84,7 +84,8 @@ namespace Assimp {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline std::size_t Copy(uint8_t* data, T& field) {
|
inline
|
||||||
|
std::size_t Copy(uint8_t* data, const T &field) {
|
||||||
#ifdef AI_BUILD_BIG_ENDIAN
|
#ifdef AI_BUILD_BIG_ENDIAN
|
||||||
T field_swapped=AI_BE(field);
|
T field_swapped=AI_BE(field);
|
||||||
std::memcpy(data, &field_swapped, sizeof(field)); return sizeof(field);
|
std::memcpy(data, &field_swapped, sizeof(field)); return sizeof(field);
|
||||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_BLEND_BMESH_H
|
#ifndef INCLUDED_AI_BLEND_BMESH_H
|
||||||
#define INCLUDED_AI_BLEND_BMESH_H
|
#define INCLUDED_AI_BLEND_BMESH_H
|
||||||
|
|
||||||
#include "LogAux.h"
|
#include <assimp/LogAux.h>
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
|
||||||
#include "BlenderDNA.h"
|
#include "BlenderDNA.h"
|
||||||
#include "StreamReader.h"
|
#include <assimp/StreamReader.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
using namespace Assimp::Blender;
|
using namespace Assimp::Blender;
|
||||||
|
|
|
@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_BLEND_DNA_H
|
#ifndef INCLUDED_AI_BLEND_DNA_H
|
||||||
#define INCLUDED_AI_BLEND_DNA_H
|
#define INCLUDED_AI_BLEND_DNA_H
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "StreamReader.h"
|
#include <assimp/StreamReader.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define INCLUDED_AI_BLEND_DNA_INL
|
#define INCLUDED_AI_BLEND_DNA_INL
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace Blender {
|
namespace Blender {
|
||||||
|
|
|
@ -53,13 +53,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "BlenderIntermediate.h"
|
#include "BlenderIntermediate.h"
|
||||||
#include "BlenderModifier.h"
|
#include "BlenderModifier.h"
|
||||||
#include "BlenderBMesh.h"
|
#include "BlenderBMesh.h"
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
|
|
||||||
#include "StringComparison.h"
|
#include <assimp/StringComparison.h>
|
||||||
#include "StreamReader.h"
|
#include <assimp/StreamReader.h>
|
||||||
#include "MemoryIOWrapper.h"
|
#include <assimp/MemoryIOWrapper.h>
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_BLEND_LOADER_H
|
#ifndef INCLUDED_AI_BLEND_LOADER_H
|
||||||
#define INCLUDED_AI_BLEND_LOADER_H
|
#define INCLUDED_AI_BLEND_LOADER_H
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "LogAux.h"
|
#include <assimp/LogAux.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "BlenderModifier.h"
|
#include "BlenderModifier.h"
|
||||||
#include <assimp/SceneCombiner.h>
|
#include <assimp/SceneCombiner.h>
|
||||||
#include "Subdivision.h"
|
#include <assimp/Subdivision.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define INCLUDED_AI_BLEND_MODIFIER_H
|
#define INCLUDED_AI_BLEND_MODIFIER_H
|
||||||
|
|
||||||
#include "BlenderIntermediate.h"
|
#include "BlenderIntermediate.h"
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace Blender {
|
namespace Blender {
|
||||||
|
|
|
@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
# define ASSIMP_BLEND_WITH_POLY_2_TRI 1
|
# define ASSIMP_BLEND_WITH_POLY_2_TRI 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "LogAux.h"
|
#include <assimp/LogAux.h>
|
||||||
|
|
||||||
#if ASSIMP_BLEND_WITH_GLU_TESSELLATE
|
#if ASSIMP_BLEND_WITH_GLU_TESSELLATE
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "C4DImporter.h"
|
#include "C4DImporter.h"
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
|
@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_CINEMA_4D_LOADER_H
|
#ifndef INCLUDED_AI_CINEMA_4D_LOADER_H
|
||||||
#define INCLUDED_AI_CINEMA_4D_LOADER_H
|
#define INCLUDED_AI_CINEMA_4D_LOADER_H
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "LogAux.h"
|
#include <assimp/LogAux.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
|
@ -98,6 +98,40 @@ SET( PUBLIC_HEADERS
|
||||||
${HEADER_PATH}/DefaultIOStream.h
|
${HEADER_PATH}/DefaultIOStream.h
|
||||||
${HEADER_PATH}/DefaultIOSystem.h
|
${HEADER_PATH}/DefaultIOSystem.h
|
||||||
${HEADER_PATH}/SceneCombiner.h
|
${HEADER_PATH}/SceneCombiner.h
|
||||||
|
${HEADER_PATH}/fast_atof.h
|
||||||
|
${HEADER_PATH}/qnan.h
|
||||||
|
${HEADER_PATH}/BaseImporter.h
|
||||||
|
${HEADER_PATH}/Hash.h
|
||||||
|
${HEADER_PATH}/MemoryIOWrapper.h
|
||||||
|
${HEADER_PATH}/ParsingUtils.h
|
||||||
|
${HEADER_PATH}/StreamReader.h
|
||||||
|
${HEADER_PATH}/StreamWriter.h
|
||||||
|
${HEADER_PATH}/StringComparison.h
|
||||||
|
${HEADER_PATH}/StringUtils.h
|
||||||
|
${HEADER_PATH}/SGSpatialSort.h
|
||||||
|
${HEADER_PATH}/GenericProperty.h
|
||||||
|
${HEADER_PATH}/SpatialSort.h
|
||||||
|
${HEADER_PATH}/SkeletonMeshBuilder.h
|
||||||
|
${HEADER_PATH}/SmoothingGroups.h
|
||||||
|
${HEADER_PATH}/SmoothingGroups.inl
|
||||||
|
${HEADER_PATH}/StandardShapes.h
|
||||||
|
${HEADER_PATH}/RemoveComments.h
|
||||||
|
${HEADER_PATH}/Subdivision.h
|
||||||
|
${HEADER_PATH}/Vertex.h
|
||||||
|
${HEADER_PATH}/LineSplitter.h
|
||||||
|
${HEADER_PATH}/TinyFormatter.h
|
||||||
|
${HEADER_PATH}/Profiler.h
|
||||||
|
${HEADER_PATH}/LogAux.h
|
||||||
|
${HEADER_PATH}/Bitmap.h
|
||||||
|
${HEADER_PATH}/XMLTools.h
|
||||||
|
${HEADER_PATH}/IOStreamBuffer.h
|
||||||
|
${HEADER_PATH}/CreateAnimMesh.h
|
||||||
|
${HEADER_PATH}/irrXMLWrapper.h
|
||||||
|
${HEADER_PATH}/BlobIOSystem.h
|
||||||
|
${HEADER_PATH}/MathFunctions.h
|
||||||
|
${HEADER_PATH}/Macros.h
|
||||||
|
${HEADER_PATH}/Exceptional.h
|
||||||
|
${HEADER_PATH}/ByteSwapper.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET( Core_SRCS
|
SET( Core_SRCS
|
||||||
|
@ -117,68 +151,40 @@ SET( Logging_SRCS
|
||||||
SOURCE_GROUP(Logging FILES ${Logging_SRCS})
|
SOURCE_GROUP(Logging FILES ${Logging_SRCS})
|
||||||
|
|
||||||
SET( Common_SRCS
|
SET( Common_SRCS
|
||||||
fast_atof.h
|
|
||||||
qnan.h
|
|
||||||
BaseImporter.cpp
|
BaseImporter.cpp
|
||||||
BaseImporter.h
|
|
||||||
BaseProcess.cpp
|
BaseProcess.cpp
|
||||||
BaseProcess.h
|
BaseProcess.h
|
||||||
Importer.h
|
Importer.h
|
||||||
ScenePrivate.h
|
ScenePrivate.h
|
||||||
PostStepRegistry.cpp
|
PostStepRegistry.cpp
|
||||||
ImporterRegistry.cpp
|
ImporterRegistry.cpp
|
||||||
ByteSwapper.h
|
|
||||||
DefaultProgressHandler.h
|
DefaultProgressHandler.h
|
||||||
DefaultIOStream.cpp
|
DefaultIOStream.cpp
|
||||||
DefaultIOSystem.cpp
|
DefaultIOSystem.cpp
|
||||||
CInterfaceIOWrapper.cpp
|
CInterfaceIOWrapper.cpp
|
||||||
CInterfaceIOWrapper.h
|
CInterfaceIOWrapper.h
|
||||||
Hash.h
|
|
||||||
Importer.cpp
|
Importer.cpp
|
||||||
IFF.h
|
IFF.h
|
||||||
MemoryIOWrapper.h
|
|
||||||
ParsingUtils.h
|
|
||||||
StreamReader.h
|
|
||||||
StreamWriter.h
|
|
||||||
StringComparison.h
|
|
||||||
StringUtils.h
|
|
||||||
SGSpatialSort.cpp
|
SGSpatialSort.cpp
|
||||||
SGSpatialSort.h
|
|
||||||
VertexTriangleAdjacency.cpp
|
VertexTriangleAdjacency.cpp
|
||||||
VertexTriangleAdjacency.h
|
VertexTriangleAdjacency.h
|
||||||
GenericProperty.h
|
|
||||||
SpatialSort.cpp
|
SpatialSort.cpp
|
||||||
SpatialSort.h
|
|
||||||
SceneCombiner.cpp
|
SceneCombiner.cpp
|
||||||
ScenePreprocessor.cpp
|
ScenePreprocessor.cpp
|
||||||
ScenePreprocessor.h
|
ScenePreprocessor.h
|
||||||
SkeletonMeshBuilder.cpp
|
SkeletonMeshBuilder.cpp
|
||||||
SkeletonMeshBuilder.h
|
|
||||||
SplitByBoneCountProcess.cpp
|
SplitByBoneCountProcess.cpp
|
||||||
SplitByBoneCountProcess.h
|
SplitByBoneCountProcess.h
|
||||||
ScaleProcess.cpp
|
ScaleProcess.cpp
|
||||||
ScaleProcess.h
|
ScaleProcess.h
|
||||||
SmoothingGroups.h
|
|
||||||
StandardShapes.cpp
|
StandardShapes.cpp
|
||||||
StandardShapes.h
|
|
||||||
TargetAnimation.cpp
|
TargetAnimation.cpp
|
||||||
TargetAnimation.h
|
TargetAnimation.h
|
||||||
RemoveComments.cpp
|
RemoveComments.cpp
|
||||||
RemoveComments.h
|
|
||||||
Subdivision.cpp
|
Subdivision.cpp
|
||||||
Subdivision.h
|
|
||||||
scene.cpp
|
scene.cpp
|
||||||
Vertex.h
|
|
||||||
LineSplitter.h
|
|
||||||
TinyFormatter.h
|
|
||||||
Profiler.h
|
|
||||||
LogAux.h
|
|
||||||
Bitmap.cpp
|
Bitmap.cpp
|
||||||
Bitmap.h
|
|
||||||
XMLTools.h
|
|
||||||
Version.cpp
|
Version.cpp
|
||||||
IOStreamBuffer.h
|
|
||||||
CreateAnimMesh.h
|
|
||||||
CreateAnimMesh.cpp
|
CreateAnimMesh.cpp
|
||||||
)
|
)
|
||||||
SOURCE_GROUP(Common FILES ${Common_SRCS})
|
SOURCE_GROUP(Common FILES ${Common_SRCS})
|
||||||
|
@ -457,24 +463,23 @@ ADD_ASSIMP_IMPORTER( BLEND
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_ASSIMP_IMPORTER( IFC
|
ADD_ASSIMP_IMPORTER( IFC
|
||||||
IFCLoader.cpp
|
Importer/IFC/IFCLoader.cpp
|
||||||
IFCLoader.h
|
Importer/IFC/IFCLoader.h
|
||||||
IFCReaderGen1.cpp
|
Importer/IFC/IFCReaderGen1_2x3.cpp
|
||||||
IFCReaderGen2.cpp
|
Importer/IFC/IFCReaderGen2_2x3.cpp
|
||||||
IFCReaderGen.h
|
Importer/IFC/IFCReaderGen_2x3.h
|
||||||
IFCUtil.h
|
Importer/IFC/IFCUtil.h
|
||||||
IFCUtil.cpp
|
Importer/IFC/IFCUtil.cpp
|
||||||
IFCGeometry.cpp
|
Importer/IFC/IFCGeometry.cpp
|
||||||
IFCMaterial.cpp
|
Importer/IFC/IFCMaterial.cpp
|
||||||
IFCProfile.cpp
|
Importer/IFC/IFCProfile.cpp
|
||||||
IFCCurve.cpp
|
Importer/IFC/IFCCurve.cpp
|
||||||
IFCBoolean.cpp
|
Importer/IFC/IFCBoolean.cpp
|
||||||
IFCOpenings.cpp
|
Importer/IFC/IFCOpenings.cpp
|
||||||
STEPFile.h
|
Importer/IFC/STEPFileReader.h
|
||||||
STEPFileReader.h
|
Importer/IFC/STEPFileReader.cpp
|
||||||
STEPFileReader.cpp
|
Importer/IFC/STEPFileEncoding.cpp
|
||||||
STEPFileEncoding.cpp
|
Importer/IFC/STEPFileEncoding.h
|
||||||
STEPFileEncoding.h
|
|
||||||
)
|
)
|
||||||
if (ASSIMP_BUILD_IFC_IMPORTER)
|
if (ASSIMP_BUILD_IFC_IMPORTER)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
@ -525,6 +530,8 @@ SET( PostProcessing_SRCS
|
||||||
ComputeUVMappingProcess.h
|
ComputeUVMappingProcess.h
|
||||||
ConvertToLHProcess.cpp
|
ConvertToLHProcess.cpp
|
||||||
ConvertToLHProcess.h
|
ConvertToLHProcess.h
|
||||||
|
EmbedTexturesProcess.cpp
|
||||||
|
EmbedTexturesProcess.h
|
||||||
FindDegenerates.cpp
|
FindDegenerates.cpp
|
||||||
FindDegenerates.h
|
FindDegenerates.h
|
||||||
FindInstancesProcess.cpp
|
FindInstancesProcess.cpp
|
||||||
|
@ -573,7 +580,7 @@ SET( PostProcessing_SRCS
|
||||||
)
|
)
|
||||||
SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS})
|
SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS})
|
||||||
|
|
||||||
SET( IrrXML_SRCS irrXMLWrapper.h )
|
SET( IrrXML_SRCS ${HEADER_PATH}/irrXMLWrapper.h )
|
||||||
SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
|
SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
|
||||||
|
|
||||||
ADD_ASSIMP_IMPORTER( Q3D
|
ADD_ASSIMP_IMPORTER( Q3D
|
||||||
|
@ -695,6 +702,7 @@ ADD_ASSIMP_IMPORTER( MMD
|
||||||
)
|
)
|
||||||
|
|
||||||
SET( Step_SRCS
|
SET( Step_SRCS
|
||||||
|
STEPFile.h
|
||||||
StepExporter.h
|
StepExporter.h
|
||||||
StepExporter.cpp
|
StepExporter.cpp
|
||||||
)
|
)
|
||||||
|
@ -703,7 +711,7 @@ SOURCE_GROUP( Step FILES ${Step_SRCS})
|
||||||
SET( Exporter_SRCS
|
SET( Exporter_SRCS
|
||||||
Exporter.cpp
|
Exporter.cpp
|
||||||
AssimpCExport.cpp
|
AssimpCExport.cpp
|
||||||
BlobIOSystem.h
|
${HEADER_PATH}/BlobIOSystem.h
|
||||||
)
|
)
|
||||||
SOURCE_GROUP( Exporter FILES ${Exporter_SRCS})
|
SOURCE_GROUP( Exporter FILES ${Exporter_SRCS})
|
||||||
|
|
||||||
|
@ -940,13 +948,13 @@ if (APPLE)
|
||||||
|
|
||||||
# PUBLIC_HEADER option does not support directory structure creation
|
# PUBLIC_HEADER option does not support directory structure creation
|
||||||
# add ./Compiler/*.h to assimp.framework via copy command
|
# add ./Compiler/*.h to assimp.framework via copy command
|
||||||
ADD_CUSTOM_COMMAND(TARGET assimp POST_BUILD
|
ADD_CUSTOM_COMMAND(TARGET assimp POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||||
"../${HEADER_PATH}/Compiler"
|
"../${HEADER_PATH}/Compiler"
|
||||||
assimp.framework/Headers/Compiler
|
assimp.framework/Headers/Compiler
|
||||||
COMMENT "Copying public ./Compiler/ header files to framework bundle's Headers/Compiler/")
|
COMMENT "Copying public ./Compiler/ header files to framework bundle's Headers/Compiler/")
|
||||||
endif(BUILD_FRAMEWORK)
|
ENDIF(BUILD_FRAMEWORK)
|
||||||
endif(APPLE)
|
ENDIF(APPLE)
|
||||||
|
|
||||||
# Build against external unzip, or add ../contrib/unzip so
|
# Build against external unzip, or add ../contrib/unzip so
|
||||||
# assimp can #include "unzip.h"
|
# assimp can #include "unzip.h"
|
||||||
|
@ -975,7 +983,7 @@ if (ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||||
INSTALL(FILES ${HEADER_PATH}/${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/AndroidJNIIOSystem.h
|
INSTALL(FILES ${HEADER_PATH}/${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/AndroidJNIIOSystem.h
|
||||||
DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}
|
DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}
|
||||||
COMPONENT assimp-dev)
|
COMPONENT assimp-dev)
|
||||||
endif(ASSIMP_ANDROID_JNIIOSYSTEM)
|
ENDIF(ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||||
|
|
||||||
if(MSVC AND ASSIMP_INSTALL_PDB)
|
if(MSVC AND ASSIMP_INSTALL_PDB)
|
||||||
IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
|
IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
|
||||||
|
@ -997,7 +1005,7 @@ if(MSVC AND ASSIMP_INSTALL_PDB)
|
||||||
CONFIGURATIONS RelWithDebInfo
|
CONFIGURATIONS RelWithDebInfo
|
||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
endif ()
|
ENDIF ()
|
||||||
|
|
||||||
if (ASSIMP_COVERALLS)
|
if (ASSIMP_COVERALLS)
|
||||||
include(Coveralls)
|
include(Coveralls)
|
||||||
|
@ -1009,4 +1017,4 @@ if (ASSIMP_COVERALLS)
|
||||||
"${COVERAGE_SRCS}" # The source files.
|
"${COVERAGE_SRCS}" # The source files.
|
||||||
ON # If we should upload.
|
ON # If we should upload.
|
||||||
"${PROJECT_SOURCE_DIR}/cmake-modules/") # (Optional) Alternate project cmake module path.
|
"${PROJECT_SOURCE_DIR}/cmake-modules/") # (Optional) Alternate project cmake module path.
|
||||||
endif()
|
ENDIF()
|
||||||
|
|
|
@ -47,12 +47,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "COBLoader.h"
|
#include "COBLoader.h"
|
||||||
#include "COBScene.h"
|
#include "COBScene.h"
|
||||||
|
|
||||||
#include "StreamReader.h"
|
#include <assimp/StreamReader.h>
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
|
|
||||||
#include "LineSplitter.h"
|
#include <assimp/LineSplitter.h>
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
|
@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_COB_LOADER_H
|
#ifndef INCLUDED_AI_COB_LOADER_H
|
||||||
#define INCLUDED_AI_COB_LOADER_H
|
#define INCLUDED_AI_COB_LOADER_H
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "StreamReader.h"
|
#include <assimp/StreamReader.h>
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
|
@ -49,9 +49,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
|
||||||
|
|
||||||
#include "CSMLoader.h"
|
#include "CSMLoader.h"
|
||||||
#include "SkeletonMeshBuilder.h"
|
#include <assimp/SkeletonMeshBuilder.h>
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_CSM_LOADER_H
|
#ifndef INCLUDED_AI_CSM_LOADER_H
|
||||||
#define INCLUDED_AI_CSM_LOADER_H
|
#define INCLUDED_AI_CSM_LOADER_H
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "CalcTangentsProcess.h"
|
#include "CalcTangentsProcess.h"
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
#include "qnan.h"
|
#include <assimp/qnan.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
|
@ -43,17 +43,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
|
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
|
||||||
|
|
||||||
#include "ColladaExporter.h"
|
#include "ColladaExporter.h"
|
||||||
#include "Bitmap.h"
|
#include <assimp/Bitmap.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include <assimp/SceneCombiner.h>
|
#include <assimp/SceneCombiner.h>
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
#include "XMLTools.h"
|
#include <assimp/XMLTools.h>
|
||||||
#include <assimp/DefaultIOSystem.h>
|
#include <assimp/DefaultIOSystem.h>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
|
@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
|
|
||||||
struct aiScene;
|
struct aiScene;
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
|
@ -53,10 +53,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
|
|
||||||
#include "ColladaParser.h"
|
#include "ColladaParser.h"
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "SkeletonMeshBuilder.h"
|
#include <assimp/SkeletonMeshBuilder.h>
|
||||||
#include "CreateAnimMesh.h"
|
#include <assimp/CreateAnimMesh.h>
|
||||||
|
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
@ -1778,6 +1778,11 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars
|
||||||
tex->pcData = (aiTexel*)new char[tex->mWidth];
|
tex->pcData = (aiTexel*)new char[tex->mWidth];
|
||||||
memcpy(tex->pcData,&imIt->second.mImageData[0],tex->mWidth);
|
memcpy(tex->pcData,&imIt->second.mImageData[0],tex->mWidth);
|
||||||
|
|
||||||
|
// TODO: check the possibility of using the flag "AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING"
|
||||||
|
// In FBX files textures are now stored internally by Assimp with their filename included
|
||||||
|
// Now Assimp can lookup thru the loaded textures after all data is processed
|
||||||
|
// We need to load all textures before referencing them, as FBX file format order may reference a texture before loading it
|
||||||
|
// This may occur on this case too, it has to be studied
|
||||||
// setup texture reference string
|
// setup texture reference string
|
||||||
result.data[0] = '*';
|
result.data[0] = '*';
|
||||||
result.length = 1 + ASSIMP_itoa10(result.data+1,static_cast<unsigned int>(MAXLEN-1),static_cast<int32_t>(mTextures.size()));
|
result.length = 1 + ASSIMP_itoa10(result.data+1,static_cast<unsigned int>(MAXLEN-1),static_cast<int32_t>(mTextures.size()));
|
||||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_COLLADALOADER_H_INC
|
#ifndef AI_COLLADALOADER_H_INC
|
||||||
#define AI_COLLADALOADER_H_INC
|
#define AI_COLLADALOADER_H_INC
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "ColladaParser.h"
|
#include "ColladaParser.h"
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
|
@ -49,13 +49,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "ColladaParser.h"
|
#include "ColladaParser.h"
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/light.h>
|
#include <assimp/light.h>
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,10 @@
|
||||||
#ifndef AI_COLLADAPARSER_H_INC
|
#ifndef AI_COLLADAPARSER_H_INC
|
||||||
#define AI_COLLADAPARSER_H_INC
|
#define AI_COLLADAPARSER_H_INC
|
||||||
|
|
||||||
#include "irrXMLWrapper.h"
|
#include <assimp/irrXMLWrapper.h>
|
||||||
#include "ColladaHelper.h"
|
#include "ColladaHelper.h"
|
||||||
#include <assimp/ai_assert.h>
|
#include <assimp/ai_assert.h>
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "ComputeUVMappingProcess.h"
|
#include "ComputeUVMappingProcess.h"
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CreateAnimMesh.h"
|
#include <assimp/CreateAnimMesh.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
#include "3MFXmlTags.h"
|
#include "3MFXmlTags.h"
|
||||||
#include "D3MFOpcPackage.h"
|
#include "D3MFOpcPackage.h"
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include "StringComparison.h"
|
#include <assimp/StringComparison.h>
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "D3MFOpcPackage.h"
|
#include "D3MFOpcPackage.h"
|
||||||
#include <contrib/unzip/unzip.h>
|
#include <contrib/unzip/unzip.h>
|
||||||
#include "irrXMLWrapper.h"
|
#include <assimp/irrXMLWrapper.h>
|
||||||
#include "3MFXmlTags.h"
|
#include "3MFXmlTags.h"
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
|
@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_D3MFLOADER_H_INCLUDED
|
#ifndef AI_D3MFLOADER_H_INCLUDED
|
||||||
#define AI_D3MFLOADER_H_INCLUDED
|
#define AI_D3MFLOADER_H_INCLUDED
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
|
||||||
|
|
||||||
#include "D3MFOpcPackage.h"
|
#include "D3MFOpcPackage.h"
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
|
|
||||||
#include <assimp/IOStream.hpp>
|
#include <assimp/IOStream.hpp>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include "irrXMLWrapper.h"
|
#include <assimp/irrXMLWrapper.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace D3MF {
|
namespace D3MF {
|
||||||
|
|
|
@ -46,10 +46,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_DXFHELPER_H
|
#ifndef INCLUDED_DXFHELPER_H
|
||||||
#define INCLUDED_DXFHELPER_H
|
#define INCLUDED_DXFHELPER_H
|
||||||
|
|
||||||
#include "LineSplitter.h"
|
#include <assimp/LineSplitter.h>
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
#include "StreamReader.h"
|
#include <assimp/StreamReader.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_DXF_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_DXF_IMPORTER
|
||||||
|
|
||||||
#include "DXFLoader.h"
|
#include "DXFLoader.h"
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "ConvertToLHProcess.h"
|
#include "ConvertToLHProcess.h"
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
|
|
||||||
#include "DXFHelper.h"
|
#include "DXFHelper.h"
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_DXFLOADER_H_INCLUDED
|
#ifndef AI_DXFLOADER_H_INCLUDED
|
||||||
#define AI_DXFLOADER_H_INCLUDED
|
#define AI_DXFLOADER_H_INCLUDED
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
|
@ -123,7 +123,8 @@ size_t DefaultIOStream::FileSize() const
|
||||||
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
|
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
|
||||||
#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
||||||
struct __stat64 fileStat;
|
struct __stat64 fileStat;
|
||||||
int err = _stat64( mFilename.c_str(), &fileStat );
|
//using fileno + fstat avoids having to handle the filename
|
||||||
|
int err = _fstat64( _fileno(mFile), &fileStat );
|
||||||
if (0 != err)
|
if (0 != err)
|
||||||
return 0;
|
return 0;
|
||||||
mCachedSize = (size_t) (fileStat.st_size);
|
mCachedSize = (size_t) (fileStat.st_size);
|
||||||
|
|
|
@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/** @file Default implementation of IOSystem using the standard C file functions */
|
/** @file Default implementation of IOSystem using the standard C file functions */
|
||||||
|
|
||||||
#include "StringComparison.h"
|
#include <assimp/StringComparison.h>
|
||||||
|
|
||||||
#include <assimp/DefaultIOSystem.h>
|
#include <assimp/DefaultIOSystem.h>
|
||||||
#include <assimp/DefaultIOStream.h>
|
#include <assimp/DefaultIOStream.h>
|
||||||
|
@ -54,31 +54,49 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// maximum path length
|
||||||
// Constructor.
|
// XXX http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
|
||||||
DefaultIOSystem::DefaultIOSystem()
|
#ifdef PATH_MAX
|
||||||
{
|
# define PATHLIMIT PATH_MAX
|
||||||
// nothing to do here
|
#else
|
||||||
}
|
# define PATHLIMIT 4096
|
||||||
|
#endif
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor.
|
|
||||||
DefaultIOSystem::~DefaultIOSystem()
|
|
||||||
{
|
|
||||||
// nothing to do here
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Tests for the existence of a file at the given path.
|
// Tests for the existence of a file at the given path.
|
||||||
bool DefaultIOSystem::Exists( const char* pFile) const
|
bool DefaultIOSystem::Exists( const char* pFile) const
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
wchar_t fileName16[PATHLIMIT];
|
||||||
|
|
||||||
|
bool isUnicode = IsTextUnicode(pFile, strlen(pFile), NULL);
|
||||||
|
if (isUnicode) {
|
||||||
|
|
||||||
|
MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, pFile, -1, fileName16, PATHLIMIT);
|
||||||
|
struct _stat64 filestat;
|
||||||
|
if (0 != _wstat64(fileName16, &filestat)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FILE* file = ::fopen(pFile, "rb");
|
||||||
|
if (!file)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
::fclose(file);
|
||||||
|
}
|
||||||
|
#else
|
||||||
FILE* file = ::fopen( pFile, "rb");
|
FILE* file = ::fopen( pFile, "rb");
|
||||||
if( !file)
|
if( !file)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
::fclose( file);
|
::fclose( file);
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,10 +106,22 @@ IOStream* DefaultIOSystem::Open( const char* strFile, const char* strMode)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != strFile);
|
ai_assert(NULL != strFile);
|
||||||
ai_assert(NULL != strMode);
|
ai_assert(NULL != strMode);
|
||||||
|
FILE* file;
|
||||||
FILE* file = ::fopen( strFile, strMode);
|
#ifdef _WIN32
|
||||||
if( NULL == file)
|
wchar_t fileName16[PATHLIMIT];
|
||||||
return NULL;
|
bool isUnicode = IsTextUnicode(strFile, strlen(strFile), NULL );
|
||||||
|
if (isUnicode) {
|
||||||
|
MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, strFile, -1, fileName16, PATHLIMIT);
|
||||||
|
std::string mode8(strMode);
|
||||||
|
file = ::_wfopen(fileName16, std::wstring(mode8.begin(), mode8.end()).c_str());
|
||||||
|
} else {
|
||||||
|
file = ::fopen(strFile, strMode);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
file = ::fopen(strFile, strMode);
|
||||||
|
#endif
|
||||||
|
if (nullptr == file)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
return new DefaultIOStream(file, (std::string) strFile);
|
return new DefaultIOStream(file, (std::string) strFile);
|
||||||
}
|
}
|
||||||
|
@ -121,32 +151,47 @@ bool IOSystem::ComparePaths (const char* one, const char* second) const
|
||||||
return !ASSIMP_stricmp(one,second);
|
return !ASSIMP_stricmp(one,second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// maximum path length
|
|
||||||
// XXX http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
|
|
||||||
#ifdef PATH_MAX
|
|
||||||
# define PATHLIMIT PATH_MAX
|
|
||||||
#else
|
|
||||||
# define PATHLIMIT 4096
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Convert a relative path into an absolute path
|
// Convert a relative path into an absolute path
|
||||||
inline void MakeAbsolutePath (const char* in, char* _out)
|
inline static void MakeAbsolutePath (const char* in, char* _out)
|
||||||
{
|
{
|
||||||
ai_assert(in && _out);
|
ai_assert(in && _out);
|
||||||
char* ret;
|
|
||||||
#if defined( _MSC_VER ) || defined( __MINGW32__ )
|
#if defined( _MSC_VER ) || defined( __MINGW32__ )
|
||||||
ret = ::_fullpath( _out, in, PATHLIMIT );
|
bool isUnicode = IsTextUnicode(in, strlen(in), NULL);
|
||||||
|
if (isUnicode) {
|
||||||
|
wchar_t out16[PATHLIMIT];
|
||||||
|
wchar_t in16[PATHLIMIT];
|
||||||
|
MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, in, -1, out16, PATHLIMIT);
|
||||||
|
wchar_t* ret = ::_wfullpath(out16, in16, PATHLIMIT);
|
||||||
|
if (ret) {
|
||||||
|
WideCharToMultiByte(CP_UTF8, MB_PRECOMPOSED, out16, -1, _out, PATHLIMIT, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
if (!ret) {
|
||||||
|
// preserve the input path, maybe someone else is able to fix
|
||||||
|
// the path before it is accessed (e.g. our file system filter)
|
||||||
|
DefaultLogger::get()->warn("Invalid path: " + std::string(in));
|
||||||
|
strcpy(_out, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
char* ret = :: _fullpath(_out, in, PATHLIMIT);
|
||||||
|
if (!ret) {
|
||||||
|
// preserve the input path, maybe someone else is able to fix
|
||||||
|
// the path before it is accessed (e.g. our file system filter)
|
||||||
|
DefaultLogger::get()->warn("Invalid path: " + std::string(in));
|
||||||
|
strcpy(_out, in);
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
// use realpath
|
// use realpath
|
||||||
ret = realpath(in, _out);
|
char* ret = realpath(in, _out);
|
||||||
#endif
|
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
// preserve the input path, maybe someone else is able to fix
|
// preserve the input path, maybe someone else is able to fix
|
||||||
// the path before it is accessed (e.g. our file system filter)
|
// the path before it is accessed (e.g. our file system filter)
|
||||||
DefaultLogger::get()->warn("Invalid path: "+std::string(in));
|
DefaultLogger::get()->warn("Invalid path: "+std::string(in));
|
||||||
strcpy(_out,in);
|
strcpy(_out,in);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "Win32DebugLogStream.h"
|
#include "Win32DebugLogStream.h"
|
||||||
#include "StdOStreamLogStream.h"
|
#include "StdOStreamLogStream.h"
|
||||||
#include "FileLogStream.h"
|
#include "FileLogStream.h"
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
|
|
||||||
#include <assimp/DefaultIOSystem.h>
|
#include <assimp/DefaultIOSystem.h>
|
||||||
#include <assimp/NullLogger.hpp>
|
#include <assimp/NullLogger.hpp>
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
/*
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2017, assimp team
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
with or without modification, are permitted provided that the
|
||||||
|
following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer in the documentation and/or other
|
||||||
|
materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the assimp team, nor the names of its
|
||||||
|
contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior
|
||||||
|
written permission of the assimp team.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "EmbedTexturesProcess.h"
|
||||||
|
#include <assimp/ParsingUtils.h>
|
||||||
|
#include "ProcessHelper.h"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
using namespace Assimp;
|
||||||
|
|
||||||
|
EmbedTexturesProcess::EmbedTexturesProcess()
|
||||||
|
: BaseProcess() {
|
||||||
|
}
|
||||||
|
|
||||||
|
EmbedTexturesProcess::~EmbedTexturesProcess() {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EmbedTexturesProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
return (pFlags & aiProcess_EmbedTextures) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EmbedTexturesProcess::SetupProperties(const Importer* pImp) {
|
||||||
|
mRootPath = pImp->GetPropertyString("sourceFilePath");
|
||||||
|
mRootPath = mRootPath.substr(0, mRootPath.find_last_of("\\/") + 1u);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EmbedTexturesProcess::Execute(aiScene* pScene) {
|
||||||
|
if (pScene == nullptr || pScene->mRootNode == nullptr) return;
|
||||||
|
|
||||||
|
aiString path;
|
||||||
|
|
||||||
|
uint32_t embeddedTexturesCount = 0u;
|
||||||
|
|
||||||
|
for (auto matId = 0u; matId < pScene->mNumMaterials; ++matId) {
|
||||||
|
auto material = pScene->mMaterials[matId];
|
||||||
|
|
||||||
|
for (auto ttId = 1u; ttId < AI_TEXTURE_TYPE_MAX; ++ttId) {
|
||||||
|
auto tt = static_cast<aiTextureType>(ttId);
|
||||||
|
auto texturesCount = material->GetTextureCount(tt);
|
||||||
|
|
||||||
|
for (auto texId = 0u; texId < texturesCount; ++texId) {
|
||||||
|
material->GetTexture(tt, texId, &path);
|
||||||
|
if (path.data[0] == '*') continue; // Already embedded
|
||||||
|
|
||||||
|
// Indeed embed
|
||||||
|
if (addTexture(pScene, path.data)) {
|
||||||
|
auto embeddedTextureId = pScene->mNumTextures - 1u;
|
||||||
|
::ai_snprintf(path.data, 1024, "*%u", embeddedTextureId);
|
||||||
|
material->AddProperty(&path, AI_MATKEY_TEXTURE(tt, texId));
|
||||||
|
embeddedTexturesCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char stringBuffer[128];
|
||||||
|
::ai_snprintf(stringBuffer, 128, "EmbedTexturesProcess finished. Embedded %u textures.", embeddedTexturesCount);
|
||||||
|
DefaultLogger::get()->info(stringBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EmbedTexturesProcess::addTexture(aiScene* pScene, std::string path) const {
|
||||||
|
uint32_t imageSize = 0;
|
||||||
|
std::string imagePath = path;
|
||||||
|
|
||||||
|
// Test path directly
|
||||||
|
std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
|
||||||
|
if ((imageSize = file.tellg()) == -1u) {
|
||||||
|
DefaultLogger::get()->warn("EmbedTexturesProcess: Cannot find image: " + imagePath + ". Will try to find it in root folder.");
|
||||||
|
|
||||||
|
// Test path in root path
|
||||||
|
imagePath = mRootPath + path;
|
||||||
|
file.open(imagePath, std::ios::binary | std::ios::ate);
|
||||||
|
if ((imageSize = file.tellg()) == -1u) {
|
||||||
|
// Test path basename in root path
|
||||||
|
imagePath = mRootPath + path.substr(path.find_last_of("\\/") + 1u);
|
||||||
|
file.open(imagePath, std::ios::binary | std::ios::ate);
|
||||||
|
if ((imageSize = file.tellg()) == -1u) {
|
||||||
|
DefaultLogger::get()->error("EmbedTexturesProcess: Unable to embed texture: " + path + ".");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aiTexel* imageContent = new aiTexel[1u + imageSize / sizeof(aiTexel)];
|
||||||
|
file.seekg(0, std::ios::beg);
|
||||||
|
file.read(reinterpret_cast<char*>(imageContent), imageSize);
|
||||||
|
|
||||||
|
// Enlarging the textures table
|
||||||
|
auto textureId = pScene->mNumTextures++;
|
||||||
|
auto oldTextures = pScene->mTextures;
|
||||||
|
pScene->mTextures = new aiTexture*[pScene->mNumTextures];
|
||||||
|
memmove(pScene->mTextures, oldTextures, sizeof(aiTexture*) * (pScene->mNumTextures - 1u));
|
||||||
|
|
||||||
|
// Add the new texture
|
||||||
|
auto pTexture = new aiTexture();
|
||||||
|
pTexture->mHeight = 0; // Means that this is still compressed
|
||||||
|
pTexture->mWidth = imageSize;
|
||||||
|
pTexture->pcData = imageContent;
|
||||||
|
|
||||||
|
auto extension = path.substr(path.find_last_of('.') + 1u);
|
||||||
|
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
|
||||||
|
if (extension == "jpeg") extension = "jpg";
|
||||||
|
strcpy(pTexture->achFormatHint, extension.c_str());
|
||||||
|
|
||||||
|
pScene->mTextures[textureId] = pTexture;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2017, 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.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "BaseProcess.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
struct aiNode;
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force embedding of textures (using the path = "*1" convention).
|
||||||
|
* If a texture's file does not exist at the specified path
|
||||||
|
* (due, for instance, to an absolute path generated on another system),
|
||||||
|
* it will check if a file with the same name exists at the root folder
|
||||||
|
* of the imported model. And if so, it uses that.
|
||||||
|
*/
|
||||||
|
class ASSIMP_API EmbedTexturesProcess : public BaseProcess {
|
||||||
|
public:
|
||||||
|
/// The default class constructor.
|
||||||
|
EmbedTexturesProcess();
|
||||||
|
|
||||||
|
/// The class destructor.
|
||||||
|
virtual ~EmbedTexturesProcess();
|
||||||
|
|
||||||
|
/// Overwritten, @see BaseProcess
|
||||||
|
virtual bool IsActive(unsigned int pFlags) const;
|
||||||
|
|
||||||
|
/// Overwritten, @see BaseProcess
|
||||||
|
virtual void SetupProperties(const Importer* pImp);
|
||||||
|
|
||||||
|
/// Overwritten, @see BaseProcess
|
||||||
|
virtual void Execute(aiScene* pScene);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Resolve the path and add the file content to the scene as a texture.
|
||||||
|
bool addTexture(aiScene* pScene, std::string path) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string mRootPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Assimp
|
|
@ -53,7 +53,7 @@ Here we implement only the C++ interface (Assimp::Exporter).
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
||||||
#include "BlobIOSystem.h"
|
#include <assimp/BlobIOSystem.h>
|
||||||
#include <assimp/SceneCombiner.h>
|
#include <assimp/SceneCombiner.h>
|
||||||
#include "BaseProcess.h"
|
#include "BaseProcess.h"
|
||||||
#include "Importer.h" // need this for GetPostProcessingStepInstanceList()
|
#include "Importer.h" // need this for GetPostProcessingStepInstanceList()
|
||||||
|
@ -61,7 +61,7 @@ Here we implement only the C++ interface (Assimp::Exporter).
|
||||||
#include "JoinVerticesProcess.h"
|
#include "JoinVerticesProcess.h"
|
||||||
#include "MakeVerboseFormat.h"
|
#include "MakeVerboseFormat.h"
|
||||||
#include "ConvertToLHProcess.h"
|
#include "ConvertToLHProcess.h"
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
#include "ScenePrivate.h"
|
#include "ScenePrivate.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ void ExportScene3DS(const char*, IOSystem*, const aiScene*, const ExportProperti
|
||||||
void ExportSceneGLTF(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
void ExportSceneGLTF(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||||
void ExportSceneGLB(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
void ExportSceneGLB(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||||
void ExportSceneGLTF2(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
void ExportSceneGLTF2(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||||
|
void ExportSceneGLB2(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||||
void ExportSceneAssbin(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
void ExportSceneAssbin(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||||
void ExportSceneAssxml(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
void ExportSceneAssxml(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||||
void ExportSceneX3D(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
void ExportSceneX3D(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||||
|
@ -151,6 +152,8 @@ Exporter::ExportFormatEntry gExporters[] =
|
||||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ),
|
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ),
|
||||||
Exporter::ExportFormatEntry( "gltf2", "GL Transmission Format v. 2", "gltf2", &ExportSceneGLTF2,
|
Exporter::ExportFormatEntry( "gltf2", "GL Transmission Format v. 2", "gltf2", &ExportSceneGLTF2,
|
||||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ),
|
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ),
|
||||||
|
Exporter::ExportFormatEntry( "glb2", "GL Transmission Format v. 2 (binary)", "glb2", &ExportSceneGLB2,
|
||||||
|
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER
|
#ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER
|
||||||
|
@ -420,7 +423,7 @@ aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const c
|
||||||
|
|
||||||
pimpl->mError = std::string("Found no exporter to handle this file format: ") + pFormatId;
|
pimpl->mError = std::string("Found no exporter to handle this file format: ") + pFormatId;
|
||||||
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
||||||
|
|
||||||
return AI_FAILURE;
|
return AI_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXUtil.h"
|
#include "FBXUtil.h"
|
||||||
#include <assimp/defs.h>
|
#include <assimp/defs.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
#include "ByteSwapper.h"
|
#include <assimp/ByteSwapper.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -129,30 +129,26 @@ AI_WONT_RETURN void TokenizeError(const std::string& message, unsigned int offse
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
uint32_t Offset(const char* begin, const char* cursor)
|
uint32_t Offset(const char* begin, const char* cursor) {
|
||||||
{
|
|
||||||
ai_assert(begin <= cursor);
|
ai_assert(begin <= cursor);
|
||||||
|
|
||||||
return static_cast<unsigned int>(cursor - begin);
|
return static_cast<unsigned int>(cursor - begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void TokenizeError(const std::string& message, const char* begin, const char* cursor)
|
void TokenizeError(const std::string& message, const char* begin, const char* cursor) {
|
||||||
{
|
|
||||||
TokenizeError(message, Offset(begin, cursor));
|
TokenizeError(message, Offset(begin, cursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
uint32_t ReadWord(const char* input, const char*& cursor, const char* end)
|
uint32_t ReadWord(const char* input, const char*& cursor, const char* end) {
|
||||||
{
|
|
||||||
const size_t k_to_read = sizeof( uint32_t );
|
const size_t k_to_read = sizeof( uint32_t );
|
||||||
if(Offset(cursor, end) < k_to_read ) {
|
if(Offset(cursor, end) < k_to_read ) {
|
||||||
TokenizeError("cannot ReadWord, out of bounds",input, cursor);
|
TokenizeError("cannot ReadWord, out of bounds",input, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t word;
|
uint32_t word;
|
||||||
memcpy(&word, cursor, 4);
|
::memcpy(&word, cursor, 4);
|
||||||
AI_SWAP4(word);
|
AI_SWAP4(word);
|
||||||
|
|
||||||
cursor += k_to_read;
|
cursor += k_to_read;
|
||||||
|
@ -167,7 +163,8 @@ uint64_t ReadDoubleWord(const char* input, const char*& cursor, const char* end)
|
||||||
TokenizeError("cannot ReadDoubleWord, out of bounds",input, cursor);
|
TokenizeError("cannot ReadDoubleWord, out of bounds",input, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t dword = *reinterpret_cast<const uint64_t*>(cursor);
|
uint64_t dword /*= *reinterpret_cast<const uint64_t*>(cursor)*/;
|
||||||
|
::memcpy( &dword, cursor, sizeof( uint64_t ) );
|
||||||
AI_SWAP8(dword);
|
AI_SWAP8(dword);
|
||||||
|
|
||||||
cursor += k_to_read;
|
cursor += k_to_read;
|
||||||
|
@ -176,24 +173,21 @@ uint64_t ReadDoubleWord(const char* input, const char*& cursor, const char* end)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
uint8_t ReadByte(const char* input, const char*& cursor, const char* end)
|
uint8_t ReadByte(const char* input, const char*& cursor, const char* end) {
|
||||||
{
|
|
||||||
if(Offset(cursor, end) < sizeof( uint8_t ) ) {
|
if(Offset(cursor, end) < sizeof( uint8_t ) ) {
|
||||||
TokenizeError("cannot ReadByte, out of bounds",input, cursor);
|
TokenizeError("cannot ReadByte, out of bounds",input, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t word = *reinterpret_cast<const uint8_t*>(cursor);
|
uint8_t word;/* = *reinterpret_cast< const uint8_t* >( cursor )*/
|
||||||
|
::memcpy( &word, cursor, sizeof( uint8_t ) );
|
||||||
++cursor;
|
++cursor;
|
||||||
|
|
||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
unsigned int ReadString(const char*& sbegin_out, const char*& send_out, const char* input, const char*& cursor, const char* end,
|
unsigned int ReadString(const char*& sbegin_out, const char*& send_out, const char* input,
|
||||||
bool long_length = false,
|
const char*& cursor, const char* end, bool long_length = false, bool allow_null = false) {
|
||||||
bool allow_null = false)
|
|
||||||
{
|
|
||||||
const uint32_t len_len = long_length ? 4 : 1;
|
const uint32_t len_len = long_length ? 4 : 1;
|
||||||
if(Offset(cursor, end) < len_len) {
|
if(Offset(cursor, end) < len_len) {
|
||||||
TokenizeError("cannot ReadString, out of bounds reading length",input, cursor);
|
TokenizeError("cannot ReadString, out of bounds reading length",input, cursor);
|
||||||
|
@ -222,8 +216,7 @@ unsigned int ReadString(const char*& sbegin_out, const char*& send_out, const ch
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ReadData(const char*& sbegin_out, const char*& send_out, const char* input, const char*& cursor, const char* end)
|
void ReadData(const char*& sbegin_out, const char*& send_out, const char* input, const char*& cursor, const char* end) {
|
||||||
{
|
|
||||||
if(Offset(cursor, end) < 1) {
|
if(Offset(cursor, end) < 1) {
|
||||||
TokenizeError("cannot ReadData, out of bounds reading length",input, cursor);
|
TokenizeError("cannot ReadData, out of bounds reading length",input, cursor);
|
||||||
}
|
}
|
||||||
|
@ -422,7 +415,7 @@ bool ReadScope(TokenList& output_tokens, const char* input, const char*& cursor,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // anonymous namespace
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// TODO: Test FBX Binary files newer than the 7500 version to check if the 64 bits address behaviour is consistent
|
// TODO: Test FBX Binary files newer than the 7500 version to check if the 64 bits address behaviour is consistent
|
||||||
|
|
|
@ -52,7 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXUtil.h"
|
#include "FBXUtil.h"
|
||||||
#include "FBXProperties.h"
|
#include "FBXProperties.h"
|
||||||
#include "FBXImporter.h"
|
#include "FBXImporter.h"
|
||||||
#include "StringComparison.h"
|
#include <assimp/StringComparison.h>
|
||||||
|
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ namespace FBX {
|
||||||
|
|
||||||
using namespace Util;
|
using namespace Util;
|
||||||
|
|
||||||
|
|
||||||
#define MAGIC_NODE_TAG "_$AssimpFbx$"
|
#define MAGIC_NODE_TAG "_$AssimpFbx$"
|
||||||
|
|
||||||
#define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000L
|
#define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000L
|
||||||
|
@ -74,387 +73,11 @@ using namespace Util;
|
||||||
// XXX vc9's debugger won't step into anonymous namespaces
|
// XXX vc9's debugger won't step into anonymous namespaces
|
||||||
//namespace {
|
//namespace {
|
||||||
|
|
||||||
/** Dummy class to encapsulate the conversion process */
|
|
||||||
class Converter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* The different parts that make up the final local transformation of a fbx-node
|
|
||||||
*/
|
|
||||||
enum TransformationComp
|
|
||||||
{
|
|
||||||
TransformationComp_Translation = 0,
|
|
||||||
TransformationComp_RotationOffset,
|
|
||||||
TransformationComp_RotationPivot,
|
|
||||||
TransformationComp_PreRotation,
|
|
||||||
TransformationComp_Rotation,
|
|
||||||
TransformationComp_PostRotation,
|
|
||||||
TransformationComp_RotationPivotInverse,
|
|
||||||
TransformationComp_ScalingOffset,
|
|
||||||
TransformationComp_ScalingPivot,
|
|
||||||
TransformationComp_Scaling,
|
|
||||||
TransformationComp_ScalingPivotInverse,
|
|
||||||
TransformationComp_GeometricTranslation,
|
|
||||||
TransformationComp_GeometricRotation,
|
|
||||||
TransformationComp_GeometricScaling,
|
|
||||||
|
|
||||||
TransformationComp_MAXIMUM
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
Converter( aiScene* out, const Document& doc );
|
|
||||||
~Converter();
|
|
||||||
|
|
||||||
private:
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// find scene root and trigger recursive scene conversion
|
|
||||||
void ConvertRootNode();
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// collect and assign child nodes
|
|
||||||
void ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& parent_transform = aiMatrix4x4() );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertLights( const Model& model );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertCameras( const Model& model );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertLight( const Model& model, const Light& light );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertCamera( const Model& model, const Camera& cam );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// this returns unified names usable within assimp identifiers (i.e. no space characters -
|
|
||||||
// while these would be allowed, they are a potential trouble spot so better not use them).
|
|
||||||
const char* NameTransformationComp( TransformationComp comp );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// note: this returns the REAL fbx property names
|
|
||||||
const char* NameTransformationCompProperty( TransformationComp comp );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
aiVector3D TransformationCompDefaultValue( TransformationComp comp );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void GetRotationMatrix( Model::RotOrder mode, const aiVector3D& rotation, aiMatrix4x4& out );
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* checks if a node has more than just scaling, rotation and translation components
|
|
||||||
*/
|
|
||||||
bool NeedsComplexTransformationChain( const Model& model );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// note: name must be a FixNodeName() result
|
|
||||||
std::string NameTransformationChainNode( const std::string& name, TransformationComp comp );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* note: memory for output_nodes will be managed by the caller
|
|
||||||
*/
|
|
||||||
void GenerateTransformationNodeChain( const Model& model, std::vector<aiNode*>& output_nodes );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void SetupNodeMetadata( const Model& model, aiNode& nd );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertModel( const Model& model, aiNode& nd, const aiMatrix4x4& node_global_transform );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// MeshGeometry -> aiMesh, return mesh index + 1 or 0 if the conversion failed
|
|
||||||
std::vector<unsigned int> ConvertMesh( const MeshGeometry& mesh, const Model& model,
|
|
||||||
const aiMatrix4x4& node_global_transform );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
aiMesh* SetupEmptyMesh( const MeshGeometry& mesh );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
unsigned int ConvertMeshSingleMaterial( const MeshGeometry& mesh, const Model& model,
|
|
||||||
const aiMatrix4x4& node_global_transform );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<unsigned int> ConvertMeshMultiMaterial( const MeshGeometry& mesh, const Model& model,
|
|
||||||
const aiMatrix4x4& node_global_transform );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
unsigned int ConvertMeshMultiMaterial( const MeshGeometry& mesh, const Model& model,
|
|
||||||
MatIndexArray::value_type index,
|
|
||||||
const aiMatrix4x4& node_global_transform );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
static const unsigned int NO_MATERIAL_SEPARATION = /* std::numeric_limits<unsigned int>::max() */
|
|
||||||
static_cast<unsigned int>(-1);
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* - if materialIndex == NO_MATERIAL_SEPARATION, materials are not taken into
|
|
||||||
* account when determining which weights to include.
|
|
||||||
* - outputVertStartIndices is only used when a material index is specified, it gives for
|
|
||||||
* each output vertex the DOM index it maps to.
|
|
||||||
*/
|
|
||||||
void ConvertWeights( aiMesh* out, const Model& model, const MeshGeometry& geo,
|
|
||||||
const aiMatrix4x4& node_global_transform = aiMatrix4x4(),
|
|
||||||
unsigned int materialIndex = NO_MATERIAL_SEPARATION,
|
|
||||||
std::vector<unsigned int>* outputVertStartIndices = NULL );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertCluster( std::vector<aiBone*>& bones, const Model& /*model*/, const Cluster& cl,
|
|
||||||
std::vector<size_t>& out_indices,
|
|
||||||
std::vector<size_t>& index_out_indices,
|
|
||||||
std::vector<size_t>& count_out_indices,
|
|
||||||
const aiMatrix4x4& node_global_transform );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertMaterialForMesh( aiMesh* out, const Model& model, const MeshGeometry& geo,
|
|
||||||
MatIndexArray::value_type materialIndex );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
unsigned int GetDefaultMaterial();
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Material -> aiMaterial
|
|
||||||
unsigned int ConvertMaterial( const Material& material, const MeshGeometry* const mesh );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Video -> aiTexture
|
|
||||||
unsigned int ConvertVideo( const Video& video );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void TrySetTextureProperties( aiMaterial* out_mat, const TextureMap& textures,
|
|
||||||
const std::string& propName,
|
|
||||||
aiTextureType target, const MeshGeometry* const mesh );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextureMap& layeredTextures,
|
|
||||||
const std::string& propName,
|
|
||||||
aiTextureType target, const MeshGeometry* const mesh );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void SetTextureProperties( aiMaterial* out_mat, const TextureMap& textures, const MeshGeometry* const mesh );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void SetTextureProperties( aiMaterial* out_mat, const LayeredTextureMap& layeredTextures, const MeshGeometry* const mesh );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
aiColor3D GetColorPropertyFromMaterial( const PropertyTable& props, const std::string& baseName,
|
|
||||||
bool& result );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyTable& props );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// get the number of fps for a FrameRate enumerated value
|
|
||||||
static double FrameRateToDouble( FileGlobalSettings::FrameRate fp, double customFPSVal = -1.0 );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// convert animation data to aiAnimation et al
|
|
||||||
void ConvertAnimations();
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// rename a node already partially converted. fixed_name is a string previously returned by
|
|
||||||
// FixNodeName, new_name specifies the string FixNodeName should return on all further invocations
|
|
||||||
// which would previously have returned the old value.
|
|
||||||
//
|
|
||||||
// this also updates names in node animations, cameras and light sources and is thus slow.
|
|
||||||
//
|
|
||||||
// NOTE: the caller is responsible for ensuring that the new name is unique and does
|
|
||||||
// not collide with any other identifiers. The best way to ensure this is to only
|
|
||||||
// append to the old name, which is guaranteed to match these requirements.
|
|
||||||
void RenameNode( const std::string& fixed_name, const std::string& new_name );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// takes a fbx node name and returns the identifier to be used in the assimp output scene.
|
|
||||||
// the function is guaranteed to provide consistent results over multiple invocations
|
|
||||||
// UNLESS RenameNode() is called for a particular node name.
|
|
||||||
std::string FixNodeName( const std::string& name );
|
|
||||||
|
|
||||||
typedef std::map<const AnimationCurveNode*, const AnimationLayer*> LayerMap;
|
|
||||||
|
|
||||||
// XXX: better use multi_map ..
|
|
||||||
typedef std::map<std::string, std::vector<const AnimationCurveNode*> > NodeMap;
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertAnimationStack( const AnimationStack& st );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void GenerateNodeAnimations( std::vector<aiNodeAnim*>& node_anims,
|
|
||||||
const std::string& fixed_name,
|
|
||||||
const std::vector<const AnimationCurveNode*>& curves,
|
|
||||||
const LayerMap& layer_map,
|
|
||||||
int64_t start, int64_t stop,
|
|
||||||
double& max_time,
|
|
||||||
double& min_time );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
bool IsRedundantAnimationData( const Model& target,
|
|
||||||
TransformationComp comp,
|
|
||||||
const std::vector<const AnimationCurveNode*>& curves );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
aiNodeAnim* GenerateRotationNodeAnim( const std::string& name,
|
|
||||||
const Model& target,
|
|
||||||
const std::vector<const AnimationCurveNode*>& curves,
|
|
||||||
const LayerMap& layer_map,
|
|
||||||
int64_t start, int64_t stop,
|
|
||||||
double& max_time,
|
|
||||||
double& min_time );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
aiNodeAnim* GenerateScalingNodeAnim( const std::string& name,
|
|
||||||
const Model& /*target*/,
|
|
||||||
const std::vector<const AnimationCurveNode*>& curves,
|
|
||||||
const LayerMap& layer_map,
|
|
||||||
int64_t start, int64_t stop,
|
|
||||||
double& max_time,
|
|
||||||
double& min_time );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
aiNodeAnim* GenerateTranslationNodeAnim( const std::string& name,
|
|
||||||
const Model& /*target*/,
|
|
||||||
const std::vector<const AnimationCurveNode*>& curves,
|
|
||||||
const LayerMap& layer_map,
|
|
||||||
int64_t start, int64_t stop,
|
|
||||||
double& max_time,
|
|
||||||
double& min_time,
|
|
||||||
bool inverse = false );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// generate node anim, extracting only Rotation, Scaling and Translation from the given chain
|
|
||||||
aiNodeAnim* GenerateSimpleNodeAnim( const std::string& name,
|
|
||||||
const Model& target,
|
|
||||||
NodeMap::const_iterator chain[ TransformationComp_MAXIMUM ],
|
|
||||||
NodeMap::const_iterator iter_end,
|
|
||||||
const LayerMap& layer_map,
|
|
||||||
int64_t start, int64_t stop,
|
|
||||||
double& max_time,
|
|
||||||
double& min_time,
|
|
||||||
bool reverse_order = false );
|
|
||||||
|
|
||||||
// key (time), value, mapto (component index)
|
|
||||||
typedef std::tuple<std::shared_ptr<KeyTimeList>, std::shared_ptr<KeyValueList>, unsigned int > KeyFrameList;
|
|
||||||
typedef std::vector<KeyFrameList> KeyFrameListList;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
KeyFrameListList GetKeyframeList( const std::vector<const AnimationCurveNode*>& nodes, int64_t start, int64_t stop );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
KeyTimeList GetKeyTimeList( const KeyFrameListList& inputs );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
|
|
||||||
const aiVector3D& def_value,
|
|
||||||
double& max_time,
|
|
||||||
double& min_time );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void InterpolateKeys( aiQuatKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
|
|
||||||
const aiVector3D& def_value,
|
|
||||||
double& maxTime,
|
|
||||||
double& minTime,
|
|
||||||
Model::RotOrder order );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertTransformOrder_TRStoSRT( aiQuatKey* out_quat, aiVectorKey* out_scale,
|
|
||||||
aiVectorKey* out_translation,
|
|
||||||
const KeyFrameListList& scaling,
|
|
||||||
const KeyFrameListList& translation,
|
|
||||||
const KeyFrameListList& rotation,
|
|
||||||
const KeyTimeList& times,
|
|
||||||
double& maxTime,
|
|
||||||
double& minTime,
|
|
||||||
Model::RotOrder order,
|
|
||||||
const aiVector3D& def_scale,
|
|
||||||
const aiVector3D& def_translate,
|
|
||||||
const aiVector3D& def_rotation );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// euler xyz -> quat
|
|
||||||
aiQuaternion EulerToQuaternion( const aiVector3D& rot, Model::RotOrder order );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertScaleKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, const LayerMap& /*layers*/,
|
|
||||||
int64_t start, int64_t stop,
|
|
||||||
double& maxTime,
|
|
||||||
double& minTime );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertTranslationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
|
|
||||||
const LayerMap& /*layers*/,
|
|
||||||
int64_t start, int64_t stop,
|
|
||||||
double& maxTime,
|
|
||||||
double& minTime );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void ConvertRotationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
|
|
||||||
const LayerMap& /*layers*/,
|
|
||||||
int64_t start, int64_t stop,
|
|
||||||
double& maxTime,
|
|
||||||
double& minTime,
|
|
||||||
Model::RotOrder order );
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// copy generated meshes, animations, lights, cameras and textures to the output scene
|
|
||||||
void TransferDataToScene();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// 0: not assigned yet, others: index is value - 1
|
|
||||||
unsigned int defaultMaterialIndex;
|
|
||||||
|
|
||||||
std::vector<aiMesh*> meshes;
|
|
||||||
std::vector<aiMaterial*> materials;
|
|
||||||
std::vector<aiAnimation*> animations;
|
|
||||||
std::vector<aiLight*> lights;
|
|
||||||
std::vector<aiCamera*> cameras;
|
|
||||||
std::vector<aiTexture*> textures;
|
|
||||||
|
|
||||||
typedef std::map<const Material*, unsigned int> MaterialMap;
|
|
||||||
MaterialMap materials_converted;
|
|
||||||
|
|
||||||
typedef std::map<const Video*, unsigned int> VideoMap;
|
|
||||||
VideoMap textures_converted;
|
|
||||||
|
|
||||||
typedef std::map<const Geometry*, std::vector<unsigned int> > MeshMap;
|
|
||||||
MeshMap meshes_converted;
|
|
||||||
|
|
||||||
// fixed node name -> which trafo chain components have animations?
|
|
||||||
typedef std::map<std::string, unsigned int> NodeAnimBitMap;
|
|
||||||
NodeAnimBitMap node_anim_chain_bits;
|
|
||||||
|
|
||||||
// name -> has had its prefix_stripped?
|
|
||||||
typedef std::map<std::string, bool> NodeNameMap;
|
|
||||||
NodeNameMap node_names;
|
|
||||||
|
|
||||||
typedef std::map<std::string, std::string> NameNameMap;
|
|
||||||
NameNameMap renamed_nodes;
|
|
||||||
|
|
||||||
double anim_fps;
|
|
||||||
|
|
||||||
aiScene* const out;
|
|
||||||
const FBX::Document& doc;
|
|
||||||
|
|
||||||
bool FindTextureIndexByFilename(const Video& video, unsigned int& index) {
|
|
||||||
index = 0;
|
|
||||||
const char* videoFileName = video.FileName().c_str();
|
|
||||||
for (auto texture = textures_converted.begin(); texture != textures_converted.end(); ++texture) {
|
|
||||||
if (!strcmp(texture->first->FileName().c_str(), videoFileName)) {
|
|
||||||
index = texture->second;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Converter::Converter( aiScene* out, const Document& doc )
|
Converter::Converter( aiScene* out, const Document& doc )
|
||||||
: defaultMaterialIndex()
|
: defaultMaterialIndex()
|
||||||
, out( out )
|
, out( out )
|
||||||
, doc( doc )
|
, doc( doc ) {
|
||||||
{
|
|
||||||
// animations need to be converted first since this will
|
// animations need to be converted first since this will
|
||||||
// populate the node_anim_chain_bits map, which is needed
|
// populate the node_anim_chain_bits map, which is needed
|
||||||
// to determine which nodes need to be generated.
|
// to determine which nodes need to be generated.
|
||||||
|
@ -480,6 +103,7 @@ Converter::Converter( aiScene* out, const Document& doc )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConvertGlobalSettings();
|
||||||
TransferDataToScene();
|
TransferDataToScene();
|
||||||
|
|
||||||
// if we didn't read any meshes set the AI_SCENE_FLAGS_INCOMPLETE
|
// if we didn't read any meshes set the AI_SCENE_FLAGS_INCOMPLETE
|
||||||
|
@ -491,8 +115,7 @@ Converter::Converter( aiScene* out, const Document& doc )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Converter::~Converter()
|
Converter::~Converter() {
|
||||||
{
|
|
||||||
std::for_each( meshes.begin(), meshes.end(), Util::delete_fun<aiMesh>() );
|
std::for_each( meshes.begin(), meshes.end(), Util::delete_fun<aiMesh>() );
|
||||||
std::for_each( materials.begin(), materials.end(), Util::delete_fun<aiMaterial>() );
|
std::for_each( materials.begin(), materials.end(), Util::delete_fun<aiMaterial>() );
|
||||||
std::for_each( animations.begin(), animations.end(), Util::delete_fun<aiAnimation>() );
|
std::for_each( animations.begin(), animations.end(), Util::delete_fun<aiAnimation>() );
|
||||||
|
@ -501,8 +124,7 @@ Converter::~Converter()
|
||||||
std::for_each( textures.begin(), textures.end(), Util::delete_fun<aiTexture>() );
|
std::for_each( textures.begin(), textures.end(), Util::delete_fun<aiTexture>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Converter::ConvertRootNode()
|
void Converter::ConvertRootNode() {
|
||||||
{
|
|
||||||
out->mRootNode = new aiNode();
|
out->mRootNode = new aiNode();
|
||||||
out->mRootNode->mName.Set( "RootNode" );
|
out->mRootNode->mName.Set( "RootNode" );
|
||||||
|
|
||||||
|
@ -729,10 +351,12 @@ void Converter::ConvertCamera( const Model& model, const Camera& cam )
|
||||||
out_camera->mName.Set( FixNodeName( model.Name() ) );
|
out_camera->mName.Set( FixNodeName( model.Name() ) );
|
||||||
|
|
||||||
out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight();
|
out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight();
|
||||||
|
|
||||||
//cameras are defined along positive x direction
|
//cameras are defined along positive x direction
|
||||||
out_camera->mPosition = aiVector3D(0.0f);
|
out_camera->mPosition = cam.Position();
|
||||||
out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f);
|
out_camera->mLookAt = ( cam.InterestPosition() - out_camera->mPosition ).Normalize();
|
||||||
out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f);
|
out_camera->mUp = cam.UpVector();
|
||||||
|
|
||||||
out_camera->mHorizontalFOV = AI_DEG_TO_RAD( cam.FieldOfView() );
|
out_camera->mHorizontalFOV = AI_DEG_TO_RAD( cam.FieldOfView() );
|
||||||
out_camera->mClipPlaneNear = cam.NearPlane();
|
out_camera->mClipPlaneNear = cam.NearPlane();
|
||||||
out_camera->mClipPlaneFar = cam.FarPlane();
|
out_camera->mClipPlaneFar = cam.FarPlane();
|
||||||
|
@ -1728,7 +1352,7 @@ unsigned int Converter::ConvertMaterial( const Material& material, const MeshGeo
|
||||||
|
|
||||||
aiString str;
|
aiString str;
|
||||||
|
|
||||||
// stip Material:: prefix
|
// strip Material:: prefix
|
||||||
std::string name = material.Name();
|
std::string name = material.Name();
|
||||||
if ( name.substr( 0, 10 ) == "Material::" ) {
|
if ( name.substr( 0, 10 ) == "Material::" ) {
|
||||||
name = name.substr( 10 );
|
name = name.substr( 10 );
|
||||||
|
@ -1776,6 +1400,8 @@ unsigned int Converter::ConvertVideo( const Video& video )
|
||||||
memcpy( out_tex->achFormatHint, ext.c_str(), ext.size() );
|
memcpy( out_tex->achFormatHint, ext.c_str(), ext.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out_tex->mFilename.Set(video.FileName().c_str());
|
||||||
|
|
||||||
return static_cast<unsigned int>( textures.size() - 1 );
|
return static_cast<unsigned int>( textures.size() - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1810,15 +1436,19 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap&
|
||||||
textures_converted[media] = index;
|
textures_converted[media] = index;
|
||||||
textureReady = true;
|
textureReady = true;
|
||||||
}
|
}
|
||||||
else if (doc.Settings().searchEmbeddedTextures) { //try to find the texture on the already-loaded textures by the filename, if the flag is on
|
|
||||||
textureReady = FindTextureIndexByFilename(*media, index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup texture reference string (copied from ColladaLoader::FindFilenameForEffectTexture), if the texture is ready
|
// setup texture reference string (copied from ColladaLoader::FindFilenameForEffectTexture), if the texture is ready
|
||||||
if (textureReady) {
|
if (doc.Settings().useLegacyEmbeddedTextureNaming) {
|
||||||
path.data[0] = '*';
|
if (textureReady) {
|
||||||
path.length = 1 + ASSIMP_itoa10(path.data + 1, MAXLEN - 1, index);
|
// TODO: check the possibility of using the flag "AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING"
|
||||||
|
// In FBX files textures are now stored internally by Assimp with their filename included
|
||||||
|
// Now Assimp can lookup thru the loaded textures after all data is processed
|
||||||
|
// We need to load all textures before referencing them, as FBX file format order may reference a texture before loading it
|
||||||
|
// This may occur on this case too, it has to be studied
|
||||||
|
path.data[0] = '*';
|
||||||
|
path.length = 1 + ASSIMP_itoa10(path.data + 1, MAXLEN - 1, index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2083,40 +1713,62 @@ void Converter::SetTextureProperties( aiMaterial* out_mat, const LayeredTextureM
|
||||||
TrySetTextureProperties( out_mat, layeredTextures, "ShininessExponent", aiTextureType_SHININESS, mesh );
|
TrySetTextureProperties( out_mat, layeredTextures, "ShininessExponent", aiTextureType_SHININESS, mesh );
|
||||||
}
|
}
|
||||||
|
|
||||||
aiColor3D Converter::GetColorPropertyFromMaterial( const PropertyTable& props, const std::string& baseName,
|
aiColor3D Converter::GetColorPropertyFactored( const PropertyTable& props, const std::string& colorName,
|
||||||
bool& result )
|
const std::string& factorName, bool& result, bool useTemplate )
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
const aiVector3D& Diffuse = PropertyGet<aiVector3D>( props, baseName, ok );
|
aiVector3D BaseColor = PropertyGet<aiVector3D>( props, colorName, ok, useTemplate );
|
||||||
if ( ok ) {
|
if ( ! ok ) {
|
||||||
return aiColor3D( Diffuse.x, Diffuse.y, Diffuse.z );
|
result = false;
|
||||||
|
return aiColor3D( 0.0f, 0.0f, 0.0f );
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
aiVector3D DiffuseColor = PropertyGet<aiVector3D>( props, baseName + "Color", ok );
|
|
||||||
if ( ok ) {
|
|
||||||
float DiffuseFactor = PropertyGet<float>( props, baseName + "Factor", ok );
|
|
||||||
if ( ok ) {
|
|
||||||
DiffuseColor *= DiffuseFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
return aiColor3D( DiffuseColor.x, DiffuseColor.y, DiffuseColor.z );
|
// if no factor name, return the colour as is
|
||||||
}
|
if ( factorName.empty() ) {
|
||||||
|
return aiColor3D( BaseColor.x, BaseColor.y, BaseColor.z );
|
||||||
}
|
}
|
||||||
result = false;
|
|
||||||
return aiColor3D( 0.0f, 0.0f, 0.0f );
|
// otherwise it should be multiplied by the factor, if found.
|
||||||
|
float factor = PropertyGet<float>( props, factorName, ok, useTemplate );
|
||||||
|
if ( ok ) {
|
||||||
|
BaseColor *= factor;
|
||||||
|
}
|
||||||
|
return aiColor3D( BaseColor.x, BaseColor.y, BaseColor.z );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aiColor3D Converter::GetColorPropertyFromMaterial( const PropertyTable& props, const std::string& baseName,
|
||||||
|
bool& result )
|
||||||
|
{
|
||||||
|
return GetColorPropertyFactored( props, baseName + "Color", baseName + "Factor", result, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
aiColor3D Converter::GetColorProperty( const PropertyTable& props, const std::string& colorName,
|
||||||
|
bool& result, bool useTemplate )
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
bool ok;
|
||||||
|
const aiVector3D& ColorVec = PropertyGet<aiVector3D>( props, colorName, ok, useTemplate );
|
||||||
|
if ( ! ok ) {
|
||||||
|
result = false;
|
||||||
|
return aiColor3D( 0.0f, 0.0f, 0.0f );
|
||||||
|
}
|
||||||
|
return aiColor3D( ColorVec.x, ColorVec.y, ColorVec.z );
|
||||||
|
}
|
||||||
|
|
||||||
void Converter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyTable& props )
|
void Converter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyTable& props )
|
||||||
{
|
{
|
||||||
// set shading properties. There are various, redundant ways in which FBX materials
|
// Set shading properties.
|
||||||
// specify their shading settings (depending on shading models, prop
|
// Modern FBX Files have two separate systems for defining these,
|
||||||
// template etc.). No idea which one is right in a particular context.
|
// with only the more comprehensive one described in the property template.
|
||||||
// Just try to make sense of it - there's no spec to verify this against,
|
// Likely the other values are a legacy system,
|
||||||
// so why should we.
|
// which is still always exported by the official FBX SDK.
|
||||||
|
//
|
||||||
|
// Blender's FBX import and export mostly ignore this legacy system,
|
||||||
|
// and as we only support recent versions of FBX anyway, we can do the same.
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
const aiColor3D& Diffuse = GetColorPropertyFromMaterial( props, "Diffuse", ok );
|
const aiColor3D& Diffuse = GetColorPropertyFromMaterial( props, "Diffuse", ok );
|
||||||
if ( ok ) {
|
if ( ok ) {
|
||||||
out_mat->AddProperty( &Diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );
|
out_mat->AddProperty( &Diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );
|
||||||
|
@ -2132,29 +1784,64 @@ void Converter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyT
|
||||||
out_mat->AddProperty( &Ambient, 1, AI_MATKEY_COLOR_AMBIENT );
|
out_mat->AddProperty( &Ambient, 1, AI_MATKEY_COLOR_AMBIENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
const aiColor3D& Specular = GetColorPropertyFromMaterial( props, "Specular", ok );
|
// we store specular factor as SHININESS_STRENGTH, so just get the color
|
||||||
|
const aiColor3D& Specular = GetColorProperty( props, "SpecularColor", ok, true );
|
||||||
if ( ok ) {
|
if ( ok ) {
|
||||||
out_mat->AddProperty( &Specular, 1, AI_MATKEY_COLOR_SPECULAR );
|
out_mat->AddProperty( &Specular, 1, AI_MATKEY_COLOR_SPECULAR );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// and also try to get SHININESS_STRENGTH
|
||||||
|
const float SpecularFactor = PropertyGet<float>( props, "SpecularFactor", ok, true );
|
||||||
|
if ( ok ) {
|
||||||
|
out_mat->AddProperty( &SpecularFactor, 1, AI_MATKEY_SHININESS_STRENGTH );
|
||||||
|
}
|
||||||
|
|
||||||
|
// and the specular exponent
|
||||||
|
const float ShininessExponent = PropertyGet<float>( props, "ShininessExponent", ok );
|
||||||
|
if ( ok ) {
|
||||||
|
out_mat->AddProperty( &ShininessExponent, 1, AI_MATKEY_SHININESS );
|
||||||
|
}
|
||||||
|
|
||||||
|
// TransparentColor / TransparencyFactor... gee thanks FBX :rolleyes:
|
||||||
|
const aiColor3D& Transparent = GetColorPropertyFactored( props, "TransparentColor", "TransparencyFactor", ok );
|
||||||
|
float CalculatedOpacity = 1.0;
|
||||||
|
if ( ok ) {
|
||||||
|
out_mat->AddProperty( &Transparent, 1, AI_MATKEY_COLOR_TRANSPARENT );
|
||||||
|
// as calculated by FBX SDK 2017:
|
||||||
|
CalculatedOpacity = 1.0 - ((Transparent.r + Transparent.g + Transparent.b) / 3.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// use of TransparencyFactor is inconsistent.
|
||||||
|
// Maya always stores it as 1.0,
|
||||||
|
// so we can't use it to set AI_MATKEY_OPACITY.
|
||||||
|
// Blender is more sensible and stores it as the alpha value.
|
||||||
|
// However both the FBX SDK and Blender always write an additional
|
||||||
|
// legacy "Opacity" field, so we can try to use that.
|
||||||
|
//
|
||||||
|
// If we can't find it,
|
||||||
|
// we can fall back to the value which the FBX SDK calculates
|
||||||
|
// from transparency colour (RGB) and factor (F) as
|
||||||
|
// 1.0 - F*((R+G+B)/3).
|
||||||
|
//
|
||||||
|
// There's no consistent way to interpret this opacity value,
|
||||||
|
// so it's up to clients to do the correct thing.
|
||||||
const float Opacity = PropertyGet<float>( props, "Opacity", ok );
|
const float Opacity = PropertyGet<float>( props, "Opacity", ok );
|
||||||
if ( ok ) {
|
if ( ok ) {
|
||||||
out_mat->AddProperty( &Opacity, 1, AI_MATKEY_OPACITY );
|
out_mat->AddProperty( &Opacity, 1, AI_MATKEY_OPACITY );
|
||||||
}
|
}
|
||||||
|
else if ( CalculatedOpacity != 1.0 ) {
|
||||||
const float Reflectivity = PropertyGet<float>( props, "Reflectivity", ok );
|
out_mat->AddProperty( &CalculatedOpacity, 1, AI_MATKEY_OPACITY );
|
||||||
if ( ok ) {
|
|
||||||
out_mat->AddProperty( &Reflectivity, 1, AI_MATKEY_REFLECTIVITY );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const float Shininess = PropertyGet<float>( props, "Shininess", ok );
|
// reflection color and factor are stored separately
|
||||||
|
const aiColor3D& Reflection = GetColorProperty( props, "ReflectionColor", ok, true );
|
||||||
if ( ok ) {
|
if ( ok ) {
|
||||||
out_mat->AddProperty( &Shininess, 1, AI_MATKEY_SHININESS_STRENGTH );
|
out_mat->AddProperty( &Reflection, 1, AI_MATKEY_COLOR_REFLECTIVE );
|
||||||
}
|
}
|
||||||
|
|
||||||
const float ShininessExponent = PropertyGet<float>( props, "ShininessExponent", ok );
|
float ReflectionFactor = PropertyGet<float>( props, "ReflectionFactor", ok, true );
|
||||||
if ( ok ) {
|
if ( ok ) {
|
||||||
out_mat->AddProperty( &ShininessExponent, 1, AI_MATKEY_SHININESS );
|
out_mat->AddProperty( &ReflectionFactor, 1, AI_MATKEY_REFLECTIVITY );
|
||||||
}
|
}
|
||||||
|
|
||||||
const float BumpFactor = PropertyGet<float>(props, "BumpFactor", ok);
|
const float BumpFactor = PropertyGet<float>(props, "BumpFactor", ok);
|
||||||
|
@ -3286,8 +2973,20 @@ void Converter::ConvertRotationKeys( aiNodeAnim* na, const std::vector<const Ani
|
||||||
|
|
||||||
na->mNumRotationKeys = static_cast<unsigned int>( keys.size() );
|
na->mNumRotationKeys = static_cast<unsigned int>( keys.size() );
|
||||||
na->mRotationKeys = new aiQuatKey[ keys.size() ];
|
na->mRotationKeys = new aiQuatKey[ keys.size() ];
|
||||||
if ( keys.size() > 0 )
|
if (!keys.empty()) {
|
||||||
InterpolateKeys( na->mRotationKeys, keys, inputs, aiVector3D( 0.0f, 0.0f, 0.0f ), maxTime, minTime, order );
|
InterpolateKeys(na->mRotationKeys, keys, inputs, aiVector3D(0.0f, 0.0f, 0.0f), maxTime, minTime, order);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Converter::ConvertGlobalSettings() {
|
||||||
|
if (nullptr == out) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
out->mMetaData = aiMetadata::Alloc(1);
|
||||||
|
unsigned int index(0);
|
||||||
|
const double unitScalFactor(doc.GlobalSettings().UnitScaleFactor());
|
||||||
|
out->mMetaData->Set(index, "UnitScaleFactor", unitScalFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Converter::TransferDataToScene()
|
void Converter::TransferDataToScene()
|
||||||
|
|
|
@ -45,7 +45,22 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_FBX_CONVERTER_H
|
#ifndef INCLUDED_AI_FBX_CONVERTER_H
|
||||||
#define INCLUDED_AI_FBX_CONVERTER_H
|
#define INCLUDED_AI_FBX_CONVERTER_H
|
||||||
|
|
||||||
|
#include "FBXParser.h"
|
||||||
|
#include "FBXMeshGeometry.h"
|
||||||
|
#include "FBXDocument.h"
|
||||||
|
#include "FBXUtil.h"
|
||||||
|
#include "FBXProperties.h"
|
||||||
|
#include "FBXImporter.h"
|
||||||
|
#include <assimp/anim.h>
|
||||||
|
#include <assimp/material.h>
|
||||||
|
#include <assimp/light.h>
|
||||||
|
#include <assimp/texture.h>
|
||||||
|
#include <assimp/camera.h>
|
||||||
|
#include <assimp/StringComparison.h>
|
||||||
|
|
||||||
struct aiScene;
|
struct aiScene;
|
||||||
|
struct aiNode;
|
||||||
|
struct aiMaterial;
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -59,6 +74,373 @@ class Document;
|
||||||
*/
|
*/
|
||||||
void ConvertToAssimpScene(aiScene* out, const Document& doc);
|
void ConvertToAssimpScene(aiScene* out, const Document& doc);
|
||||||
|
|
||||||
|
/** Dummy class to encapsulate the conversion process */
|
||||||
|
class Converter {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* The different parts that make up the final local transformation of a fbx-node
|
||||||
|
*/
|
||||||
|
enum TransformationComp {
|
||||||
|
TransformationComp_Translation = 0,
|
||||||
|
TransformationComp_RotationOffset,
|
||||||
|
TransformationComp_RotationPivot,
|
||||||
|
TransformationComp_PreRotation,
|
||||||
|
TransformationComp_Rotation,
|
||||||
|
TransformationComp_PostRotation,
|
||||||
|
TransformationComp_RotationPivotInverse,
|
||||||
|
TransformationComp_ScalingOffset,
|
||||||
|
TransformationComp_ScalingPivot,
|
||||||
|
TransformationComp_Scaling,
|
||||||
|
TransformationComp_ScalingPivotInverse,
|
||||||
|
TransformationComp_GeometricTranslation,
|
||||||
|
TransformationComp_GeometricRotation,
|
||||||
|
TransformationComp_GeometricScaling,
|
||||||
|
|
||||||
|
TransformationComp_MAXIMUM
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
Converter(aiScene* out, const Document& doc);
|
||||||
|
~Converter();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// find scene root and trigger recursive scene conversion
|
||||||
|
void ConvertRootNode();
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// collect and assign child nodes
|
||||||
|
void ConvertNodes(uint64_t id, aiNode& parent, const aiMatrix4x4& parent_transform = aiMatrix4x4());
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertLights(const Model& model);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertCameras(const Model& model);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertLight(const Model& model, const Light& light);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertCamera(const Model& model, const Camera& cam);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// this returns unified names usable within assimp identifiers (i.e. no space characters -
|
||||||
|
// while these would be allowed, they are a potential trouble spot so better not use them).
|
||||||
|
const char* NameTransformationComp(TransformationComp comp);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// note: this returns the REAL fbx property names
|
||||||
|
const char* NameTransformationCompProperty(TransformationComp comp);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
aiVector3D TransformationCompDefaultValue(TransformationComp comp);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void GetRotationMatrix(Model::RotOrder mode, const aiVector3D& rotation, aiMatrix4x4& out);
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* checks if a node has more than just scaling, rotation and translation components
|
||||||
|
*/
|
||||||
|
bool NeedsComplexTransformationChain(const Model& model);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// note: name must be a FixNodeName() result
|
||||||
|
std::string NameTransformationChainNode(const std::string& name, TransformationComp comp);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* note: memory for output_nodes will be managed by the caller
|
||||||
|
*/
|
||||||
|
void GenerateTransformationNodeChain(const Model& model, std::vector<aiNode*>& output_nodes);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void SetupNodeMetadata(const Model& model, aiNode& nd);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertModel(const Model& model, aiNode& nd, const aiMatrix4x4& node_global_transform);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// MeshGeometry -> aiMesh, return mesh index + 1 or 0 if the conversion failed
|
||||||
|
std::vector<unsigned int> ConvertMesh(const MeshGeometry& mesh, const Model& model,
|
||||||
|
const aiMatrix4x4& node_global_transform);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
aiMesh* SetupEmptyMesh(const MeshGeometry& mesh);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
unsigned int ConvertMeshSingleMaterial(const MeshGeometry& mesh, const Model& model,
|
||||||
|
const aiMatrix4x4& node_global_transform);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<unsigned int> ConvertMeshMultiMaterial(const MeshGeometry& mesh, const Model& model,
|
||||||
|
const aiMatrix4x4& node_global_transform);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
unsigned int ConvertMeshMultiMaterial(const MeshGeometry& mesh, const Model& model,
|
||||||
|
MatIndexArray::value_type index,
|
||||||
|
const aiMatrix4x4& node_global_transform);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
static const unsigned int NO_MATERIAL_SEPARATION = /* std::numeric_limits<unsigned int>::max() */
|
||||||
|
static_cast<unsigned int>(-1);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* - if materialIndex == NO_MATERIAL_SEPARATION, materials are not taken into
|
||||||
|
* account when determining which weights to include.
|
||||||
|
* - outputVertStartIndices is only used when a material index is specified, it gives for
|
||||||
|
* each output vertex the DOM index it maps to.
|
||||||
|
*/
|
||||||
|
void ConvertWeights(aiMesh* out, const Model& model, const MeshGeometry& geo,
|
||||||
|
const aiMatrix4x4& node_global_transform = aiMatrix4x4(),
|
||||||
|
unsigned int materialIndex = NO_MATERIAL_SEPARATION,
|
||||||
|
std::vector<unsigned int>* outputVertStartIndices = NULL);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertCluster(std::vector<aiBone*>& bones, const Model& /*model*/, const Cluster& cl,
|
||||||
|
std::vector<size_t>& out_indices,
|
||||||
|
std::vector<size_t>& index_out_indices,
|
||||||
|
std::vector<size_t>& count_out_indices,
|
||||||
|
const aiMatrix4x4& node_global_transform);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertMaterialForMesh(aiMesh* out, const Model& model, const MeshGeometry& geo,
|
||||||
|
MatIndexArray::value_type materialIndex);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
unsigned int GetDefaultMaterial();
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// Material -> aiMaterial
|
||||||
|
unsigned int ConvertMaterial(const Material& material, const MeshGeometry* const mesh);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// Video -> aiTexture
|
||||||
|
unsigned int ConvertVideo(const Video& video);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void TrySetTextureProperties(aiMaterial* out_mat, const TextureMap& textures,
|
||||||
|
const std::string& propName,
|
||||||
|
aiTextureType target, const MeshGeometry* const mesh);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void TrySetTextureProperties(aiMaterial* out_mat, const LayeredTextureMap& layeredTextures,
|
||||||
|
const std::string& propName,
|
||||||
|
aiTextureType target, const MeshGeometry* const mesh);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void SetTextureProperties(aiMaterial* out_mat, const TextureMap& textures, const MeshGeometry* const mesh);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void SetTextureProperties(aiMaterial* out_mat, const LayeredTextureMap& layeredTextures, const MeshGeometry* const mesh);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
aiColor3D GetColorPropertyFromMaterial(const PropertyTable& props, const std::string& baseName,
|
||||||
|
bool& result);
|
||||||
|
aiColor3D GetColorPropertyFactored(const PropertyTable& props, const std::string& colorName,
|
||||||
|
const std::string& factorName, bool& result, bool useTemplate = true);
|
||||||
|
aiColor3D GetColorProperty(const PropertyTable& props, const std::string& colorName,
|
||||||
|
bool& result, bool useTemplate = true);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void SetShadingPropertiesCommon(aiMaterial* out_mat, const PropertyTable& props);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// get the number of fps for a FrameRate enumerated value
|
||||||
|
static double FrameRateToDouble(FileGlobalSettings::FrameRate fp, double customFPSVal = -1.0);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// convert animation data to aiAnimation et al
|
||||||
|
void ConvertAnimations();
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// rename a node already partially converted. fixed_name is a string previously returned by
|
||||||
|
// FixNodeName, new_name specifies the string FixNodeName should return on all further invocations
|
||||||
|
// which would previously have returned the old value.
|
||||||
|
//
|
||||||
|
// this also updates names in node animations, cameras and light sources and is thus slow.
|
||||||
|
//
|
||||||
|
// NOTE: the caller is responsible for ensuring that the new name is unique and does
|
||||||
|
// not collide with any other identifiers. The best way to ensure this is to only
|
||||||
|
// append to the old name, which is guaranteed to match these requirements.
|
||||||
|
void RenameNode(const std::string& fixed_name, const std::string& new_name);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// takes a fbx node name and returns the identifier to be used in the assimp output scene.
|
||||||
|
// the function is guaranteed to provide consistent results over multiple invocations
|
||||||
|
// UNLESS RenameNode() is called for a particular node name.
|
||||||
|
std::string FixNodeName(const std::string& name);
|
||||||
|
|
||||||
|
typedef std::map<const AnimationCurveNode*, const AnimationLayer*> LayerMap;
|
||||||
|
|
||||||
|
// XXX: better use multi_map ..
|
||||||
|
typedef std::map<std::string, std::vector<const AnimationCurveNode*> > NodeMap;
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertAnimationStack(const AnimationStack& st);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void GenerateNodeAnimations(std::vector<aiNodeAnim*>& node_anims,
|
||||||
|
const std::string& fixed_name,
|
||||||
|
const std::vector<const AnimationCurveNode*>& curves,
|
||||||
|
const LayerMap& layer_map,
|
||||||
|
int64_t start, int64_t stop,
|
||||||
|
double& max_time,
|
||||||
|
double& min_time);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
bool IsRedundantAnimationData(const Model& target,
|
||||||
|
TransformationComp comp,
|
||||||
|
const std::vector<const AnimationCurveNode*>& curves);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
aiNodeAnim* GenerateRotationNodeAnim(const std::string& name,
|
||||||
|
const Model& target,
|
||||||
|
const std::vector<const AnimationCurveNode*>& curves,
|
||||||
|
const LayerMap& layer_map,
|
||||||
|
int64_t start, int64_t stop,
|
||||||
|
double& max_time,
|
||||||
|
double& min_time);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
aiNodeAnim* GenerateScalingNodeAnim(const std::string& name,
|
||||||
|
const Model& /*target*/,
|
||||||
|
const std::vector<const AnimationCurveNode*>& curves,
|
||||||
|
const LayerMap& layer_map,
|
||||||
|
int64_t start, int64_t stop,
|
||||||
|
double& max_time,
|
||||||
|
double& min_time);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
aiNodeAnim* GenerateTranslationNodeAnim(const std::string& name,
|
||||||
|
const Model& /*target*/,
|
||||||
|
const std::vector<const AnimationCurveNode*>& curves,
|
||||||
|
const LayerMap& layer_map,
|
||||||
|
int64_t start, int64_t stop,
|
||||||
|
double& max_time,
|
||||||
|
double& min_time,
|
||||||
|
bool inverse = false);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// generate node anim, extracting only Rotation, Scaling and Translation from the given chain
|
||||||
|
aiNodeAnim* GenerateSimpleNodeAnim(const std::string& name,
|
||||||
|
const Model& target,
|
||||||
|
NodeMap::const_iterator chain[TransformationComp_MAXIMUM],
|
||||||
|
NodeMap::const_iterator iter_end,
|
||||||
|
const LayerMap& layer_map,
|
||||||
|
int64_t start, int64_t stop,
|
||||||
|
double& max_time,
|
||||||
|
double& min_time,
|
||||||
|
bool reverse_order = false);
|
||||||
|
|
||||||
|
// key (time), value, mapto (component index)
|
||||||
|
typedef std::tuple<std::shared_ptr<KeyTimeList>, std::shared_ptr<KeyValueList>, unsigned int > KeyFrameList;
|
||||||
|
typedef std::vector<KeyFrameList> KeyFrameListList;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
KeyFrameListList GetKeyframeList(const std::vector<const AnimationCurveNode*>& nodes, int64_t start, int64_t stop);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
KeyTimeList GetKeyTimeList(const KeyFrameListList& inputs);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void InterpolateKeys(aiVectorKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
|
||||||
|
const aiVector3D& def_value,
|
||||||
|
double& max_time,
|
||||||
|
double& min_time);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void InterpolateKeys(aiQuatKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
|
||||||
|
const aiVector3D& def_value,
|
||||||
|
double& maxTime,
|
||||||
|
double& minTime,
|
||||||
|
Model::RotOrder order);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertTransformOrder_TRStoSRT(aiQuatKey* out_quat, aiVectorKey* out_scale,
|
||||||
|
aiVectorKey* out_translation,
|
||||||
|
const KeyFrameListList& scaling,
|
||||||
|
const KeyFrameListList& translation,
|
||||||
|
const KeyFrameListList& rotation,
|
||||||
|
const KeyTimeList& times,
|
||||||
|
double& maxTime,
|
||||||
|
double& minTime,
|
||||||
|
Model::RotOrder order,
|
||||||
|
const aiVector3D& def_scale,
|
||||||
|
const aiVector3D& def_translate,
|
||||||
|
const aiVector3D& def_rotation);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// euler xyz -> quat
|
||||||
|
aiQuaternion EulerToQuaternion(const aiVector3D& rot, Model::RotOrder order);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertScaleKeys(aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, const LayerMap& /*layers*/,
|
||||||
|
int64_t start, int64_t stop,
|
||||||
|
double& maxTime,
|
||||||
|
double& minTime);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertTranslationKeys(aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
|
||||||
|
const LayerMap& /*layers*/,
|
||||||
|
int64_t start, int64_t stop,
|
||||||
|
double& maxTime,
|
||||||
|
double& minTime);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ConvertRotationKeys(aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
|
||||||
|
const LayerMap& /*layers*/,
|
||||||
|
int64_t start, int64_t stop,
|
||||||
|
double& maxTime,
|
||||||
|
double& minTime,
|
||||||
|
Model::RotOrder order);
|
||||||
|
|
||||||
|
void ConvertGlobalSettings();
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// copy generated meshes, animations, lights, cameras and textures to the output scene
|
||||||
|
void TransferDataToScene();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// 0: not assigned yet, others: index is value - 1
|
||||||
|
unsigned int defaultMaterialIndex;
|
||||||
|
|
||||||
|
std::vector<aiMesh*> meshes;
|
||||||
|
std::vector<aiMaterial*> materials;
|
||||||
|
std::vector<aiAnimation*> animations;
|
||||||
|
std::vector<aiLight*> lights;
|
||||||
|
std::vector<aiCamera*> cameras;
|
||||||
|
std::vector<aiTexture*> textures;
|
||||||
|
|
||||||
|
typedef std::map<const Material*, unsigned int> MaterialMap;
|
||||||
|
MaterialMap materials_converted;
|
||||||
|
|
||||||
|
typedef std::map<const Video*, unsigned int> VideoMap;
|
||||||
|
VideoMap textures_converted;
|
||||||
|
|
||||||
|
typedef std::map<const Geometry*, std::vector<unsigned int> > MeshMap;
|
||||||
|
MeshMap meshes_converted;
|
||||||
|
|
||||||
|
// fixed node name -> which trafo chain components have animations?
|
||||||
|
typedef std::map<std::string, unsigned int> NodeAnimBitMap;
|
||||||
|
NodeAnimBitMap node_anim_chain_bits;
|
||||||
|
|
||||||
|
// name -> has had its prefix_stripped?
|
||||||
|
typedef std::map<std::string, bool> NodeNameMap;
|
||||||
|
NodeNameMap node_names;
|
||||||
|
|
||||||
|
typedef std::map<std::string, std::string> NameNameMap;
|
||||||
|
NameNameMap renamed_nodes;
|
||||||
|
|
||||||
|
double anim_fps;
|
||||||
|
|
||||||
|
aiScene* const out;
|
||||||
|
const FBX::Document& doc;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,9 +344,8 @@ void Document::ReadGlobalSettings()
|
||||||
{
|
{
|
||||||
const Scope& sc = parser.GetRootScope();
|
const Scope& sc = parser.GetRootScope();
|
||||||
const Element* const ehead = sc["GlobalSettings"];
|
const Element* const ehead = sc["GlobalSettings"];
|
||||||
if(!ehead || !ehead->Compound()) {
|
if ( nullptr == ehead || !ehead->Compound() ) {
|
||||||
DOMWarning("no GlobalSettings dictionary found");
|
DOMWarning( "no GlobalSettings dictionary found" );
|
||||||
|
|
||||||
globals.reset(new FileGlobalSettings(*this, std::make_shared<const PropertyTable>()));
|
globals.reset(new FileGlobalSettings(*this, std::make_shared<const PropertyTable>()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -619,10 +618,10 @@ std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t dest, const char* classname) const
|
std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t src, const char* classname) const
|
||||||
{
|
{
|
||||||
const char* arr[] = {classname};
|
const char* arr[] = {classname};
|
||||||
return GetConnectionsBySourceSequenced(dest, arr,1);
|
return GetConnectionsBySourceSequenced(src, arr,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -999,8 +999,7 @@ typedef std::multimap<uint64_t, const Connection*> ConnectionMap;
|
||||||
|
|
||||||
/** DOM class for global document settings, a single instance per document can
|
/** DOM class for global document settings, a single instance per document can
|
||||||
* be accessed via Document.Globals(). */
|
* be accessed via Document.Globals(). */
|
||||||
class FileGlobalSettings
|
class FileGlobalSettings {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props);
|
FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props);
|
||||||
~FileGlobalSettings();
|
~FileGlobalSettings();
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct ImportSettings
|
||||||
, readWeights(true)
|
, readWeights(true)
|
||||||
, preservePivots(true)
|
, preservePivots(true)
|
||||||
, optimizeEmptyAnimationCurves(true)
|
, optimizeEmptyAnimationCurves(true)
|
||||||
, searchEmbeddedTextures(false)
|
, useLegacyEmbeddedTextureNaming(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,9 +139,9 @@ struct ImportSettings
|
||||||
* The default value is true. */
|
* The default value is true. */
|
||||||
bool optimizeEmptyAnimationCurves;
|
bool optimizeEmptyAnimationCurves;
|
||||||
|
|
||||||
/** search for embedded loaded textures, where no embedded texture data is provided.
|
/** use legacy naming for embedded textures eg: (*0, *1, *2)
|
||||||
* The default value is false. */
|
**/
|
||||||
bool searchEmbeddedTextures;
|
bool useLegacyEmbeddedTextureNaming;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXDocument.h"
|
#include "FBXDocument.h"
|
||||||
#include "FBXConverter.h"
|
#include "FBXConverter.h"
|
||||||
|
|
||||||
#include "StreamReader.h"
|
#include <assimp/StreamReader.h>
|
||||||
#include "MemoryIOWrapper.h"
|
#include <assimp/MemoryIOWrapper.h>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
|
|
||||||
|
@ -135,13 +135,12 @@ void FBXImporter::SetupProperties(const Importer* pImp)
|
||||||
settings.strictMode = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_STRICT_MODE, false);
|
settings.strictMode = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_STRICT_MODE, false);
|
||||||
settings.preservePivots = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS, true);
|
settings.preservePivots = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS, true);
|
||||||
settings.optimizeEmptyAnimationCurves = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES, true);
|
settings.optimizeEmptyAnimationCurves = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES, true);
|
||||||
settings.searchEmbeddedTextures = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_SEARCH_EMBEDDED_TEXTURES, false);
|
settings.useLegacyEmbeddedTextureNaming = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Imports the given file into the given scene structure.
|
// Imports the given file into the given scene structure.
|
||||||
void FBXImporter::InternReadFile( const std::string& pFile,
|
void FBXImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
|
||||||
aiScene* pScene, IOSystem* pIOHandler)
|
|
||||||
{
|
{
|
||||||
std::unique_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
|
std::unique_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
|
|
|
@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_FBX_IMPORTER_H
|
#ifndef INCLUDED_AI_FBX_IMPORTER_H
|
||||||
#define INCLUDED_AI_FBX_IMPORTER_H
|
#define INCLUDED_AI_FBX_IMPORTER_H
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "LogAux.h"
|
#include <assimp/LogAux.h>
|
||||||
|
|
||||||
#include "FBXImportSettings.h"
|
#include "FBXImportSettings.h"
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXImportSettings.h"
|
#include "FBXImportSettings.h"
|
||||||
#include "FBXDocumentUtil.h"
|
#include "FBXDocumentUtil.h"
|
||||||
#include "FBXProperties.h"
|
#include "FBXProperties.h"
|
||||||
#include "ByteSwapper.h"
|
#include <assimp/ByteSwapper.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -291,40 +291,40 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
|
||||||
|
|
||||||
if(FileName) {
|
if(FileName) {
|
||||||
fileName = ParseTokenAsString(GetRequiredToken(*FileName,0));
|
fileName = ParseTokenAsString(GetRequiredToken(*FileName,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RelativeFilename) {
|
if(RelativeFilename) {
|
||||||
relativeFileName = ParseTokenAsString(GetRequiredToken(*RelativeFilename,0));
|
relativeFileName = ParseTokenAsString(GetRequiredToken(*RelativeFilename,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Content) {
|
if(Content) {
|
||||||
//this field is ommited when the embedded texture is already loaded, let's ignore if it´s not found
|
//this field is ommited when the embedded texture is already loaded, let's ignore if it's not found
|
||||||
try {
|
try {
|
||||||
const Token& token = GetRequiredToken(*Content, 0);
|
const Token& token = GetRequiredToken(*Content, 0);
|
||||||
const char* data = token.begin();
|
const char* data = token.begin();
|
||||||
if (!token.IsBinary()) {
|
if (!token.IsBinary()) {
|
||||||
DOMWarning("video content is not binary data, ignoring", &element);
|
DOMWarning("video content is not binary data, ignoring", &element);
|
||||||
}
|
}
|
||||||
else if (static_cast<size_t>(token.end() - data) < 5) {
|
else if (static_cast<size_t>(token.end() - data) < 5) {
|
||||||
DOMError("binary data array is too short, need five (5) bytes for type signature and element count", &element);
|
DOMError("binary data array is too short, need five (5) bytes for type signature and element count", &element);
|
||||||
}
|
}
|
||||||
else if (*data != 'R') {
|
else if (*data != 'R') {
|
||||||
DOMWarning("video content is not raw binary data, ignoring", &element);
|
DOMWarning("video content is not raw binary data, ignoring", &element);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// read number of elements
|
// read number of elements
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
::memcpy(&len, data + 1, sizeof(len));
|
::memcpy(&len, data + 1, sizeof(len));
|
||||||
AI_SWAP4(len);
|
AI_SWAP4(len);
|
||||||
|
|
||||||
contentLength = len;
|
contentLength = len;
|
||||||
|
|
||||||
content = new uint8_t[len];
|
content = new uint8_t[len];
|
||||||
::memcpy(content, data + 5, len);
|
::memcpy(content, data + 5, len);
|
||||||
}
|
}
|
||||||
} catch (runtime_error runtimeError) {
|
} catch (runtime_error runtimeError) {
|
||||||
//we don´t need the content data for contents that has already been loaded
|
//we don't need the content data for contents that has already been loaded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
props = GetPropertyTable(doc,"Video.FbxVideo",element,sc);
|
props = GetPropertyTable(doc,"Video.FbxVideo",element,sc);
|
||||||
|
|
|
@ -433,7 +433,11 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
|
||||||
// deal with this more elegantly and with less redundancy, but right
|
// deal with this more elegantly and with less redundancy, but right
|
||||||
// now it seems unavoidable.
|
// now it seems unavoidable.
|
||||||
if (MappingInformationType == "ByVertice" && ReferenceInformationType == "Direct") {
|
if (MappingInformationType == "ByVertice" && ReferenceInformationType == "Direct") {
|
||||||
std::vector<T> tempData;
|
if ( !HasElement( source, indexDataElementName ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<T> tempData;
|
||||||
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
||||||
|
|
||||||
data_out.resize(vertex_count);
|
data_out.resize(vertex_count);
|
||||||
|
@ -450,10 +454,12 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
|
||||||
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
||||||
|
|
||||||
data_out.resize(vertex_count);
|
data_out.resize(vertex_count);
|
||||||
|
if ( !HasElement( source, indexDataElementName ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> uvIndices;
|
std::vector<int> uvIndices;
|
||||||
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
|
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
|
||||||
|
|
||||||
for (size_t i = 0, e = uvIndices.size(); i < e; ++i) {
|
for (size_t i = 0, e = uvIndices.size(); i < e; ++i) {
|
||||||
|
|
||||||
const unsigned int istart = mapping_offsets[i], iend = istart + mapping_counts[i];
|
const unsigned int istart = mapping_offsets[i], iend = istart + mapping_counts[i];
|
||||||
|
|
|
@ -45,7 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
|
||||||
|
|
||||||
|
|
||||||
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
|
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
|
||||||
# include <zlib.h>
|
# include <zlib.h>
|
||||||
#else
|
#else
|
||||||
|
@ -56,9 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXParser.h"
|
#include "FBXParser.h"
|
||||||
#include "FBXUtil.h"
|
#include "FBXUtil.h"
|
||||||
|
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include "ByteSwapper.h"
|
#include <assimp/ByteSwapper.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -67,7 +66,6 @@ using namespace Assimp::FBX;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// signal parse error, this is always unrecoverable. Throws DeadlyImportError.
|
// signal parse error, this is always unrecoverable. Throws DeadlyImportError.
|
||||||
AI_WONT_RETURN void ParseError(const std::string& message, const Token& token) AI_WONT_RETURN_SUFFIX;
|
AI_WONT_RETURN void ParseError(const std::string& message, const Token& token) AI_WONT_RETURN_SUFFIX;
|
||||||
|
@ -213,7 +211,6 @@ Scope::~Scope()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Parser::Parser (const TokenList& tokens, bool is_binary)
|
Parser::Parser (const TokenList& tokens, bool is_binary)
|
||||||
: tokens(tokens)
|
: tokens(tokens)
|
||||||
|
@ -537,18 +534,18 @@ void ReadBinaryDataArray(char type, uint32_t count, const char*& data, const cha
|
||||||
uint32_t stride = 0;
|
uint32_t stride = 0;
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case 'f':
|
case 'f':
|
||||||
case 'i':
|
case 'i':
|
||||||
stride = 4;
|
stride = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'l':
|
case 'l':
|
||||||
stride = 8;
|
stride = 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ai_assert(false);
|
ai_assert(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint32_t full_length = stride * count;
|
const uint32_t full_length = stride * count;
|
||||||
|
@ -1197,6 +1194,14 @@ std::string ParseTokenAsString(const Token& t)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasElement( const Scope& sc, const std::string& index ) {
|
||||||
|
const Element* el = sc[ index ];
|
||||||
|
if ( nullptr == el ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// extract a required element from a scope, abort if the element cannot be found
|
// extract a required element from a scope, abort if the element cannot be found
|
||||||
|
|
|
@ -48,8 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "LogAux.h"
|
#include <assimp/LogAux.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
|
|
||||||
#include "FBXCompileConfig.h"
|
#include "FBXCompileConfig.h"
|
||||||
#include "FBXTokenizer.h"
|
#include "FBXTokenizer.h"
|
||||||
|
@ -174,11 +174,9 @@ private:
|
||||||
friend class Element;
|
friend class Element;
|
||||||
|
|
||||||
TokenPtr AdvanceToNextToken();
|
TokenPtr AdvanceToNextToken();
|
||||||
|
|
||||||
TokenPtr LastToken() const;
|
TokenPtr LastToken() const;
|
||||||
TokenPtr CurrentToken() const;
|
TokenPtr CurrentToken() const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const TokenList& tokens;
|
const TokenList& tokens;
|
||||||
|
|
||||||
|
@ -199,7 +197,6 @@ int ParseTokenAsInt(const Token& t, const char*& err_out);
|
||||||
int64_t ParseTokenAsInt64(const Token& t, const char*& err_out);
|
int64_t ParseTokenAsInt64(const Token& t, const char*& err_out);
|
||||||
std::string ParseTokenAsString(const Token& t, const char*& err_out);
|
std::string ParseTokenAsString(const Token& t, const char*& err_out);
|
||||||
|
|
||||||
|
|
||||||
/* wrapper around ParseTokenAsXXX() with DOMError handling */
|
/* wrapper around ParseTokenAsXXX() with DOMError handling */
|
||||||
uint64_t ParseTokenAsID(const Token& t);
|
uint64_t ParseTokenAsID(const Token& t);
|
||||||
size_t ParseTokenAsDim(const Token& t);
|
size_t ParseTokenAsDim(const Token& t);
|
||||||
|
@ -218,6 +215,8 @@ void ParseVectorDataArray(std::vector<unsigned int>& out, const Element& el);
|
||||||
void ParseVectorDataArray(std::vector<uint64_t>& out, const Element& e);
|
void ParseVectorDataArray(std::vector<uint64_t>& out, const Element& e);
|
||||||
void ParseVectorDataArray(std::vector<int64_t>& out, const Element& el);
|
void ParseVectorDataArray(std::vector<int64_t>& out, const Element& el);
|
||||||
|
|
||||||
|
bool HasElement( const Scope& sc, const std::string& index );
|
||||||
|
|
||||||
// extract a required element from a scope, abort if the element cannot be found
|
// extract a required element from a scope, abort if the element cannot be found
|
||||||
const Element& GetRequiredElement(const Scope& sc, const std::string& index, const Element* element = NULL);
|
const Element& GetRequiredElement(const Scope& sc, const std::string& index, const Element* element = NULL);
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ Property* ReadTypedProperty(const Element& element)
|
||||||
ParseTokenAsFloat(*tok[6]))
|
ParseTokenAsFloat(*tok[6]))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (!strcmp(cs,"double") || !strcmp(cs,"Number") || !strcmp(cs,"Float") || !strcmp(cs,"FieldOfView")) {
|
else if (!strcmp(cs,"double") || !strcmp(cs,"Number") || !strcmp(cs,"Float") || !strcmp(cs,"FieldOfView") || !strcmp( cs, "UnitScaleFactor" ) ) {
|
||||||
return new TypedProperty<float>(ParseTokenAsFloat(*tok[4]));
|
return new TypedProperty<float>(ParseTokenAsFloat(*tok[4]));
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -138,7 +138,6 @@ PropertyTable::PropertyTable()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
PropertyTable::PropertyTable(const Element& element, std::shared_ptr<const PropertyTable> templateProps)
|
PropertyTable::PropertyTable(const Element& element, std::shared_ptr<const PropertyTable> templateProps)
|
||||||
: templateProps(templateProps)
|
: templateProps(templateProps)
|
||||||
|
@ -229,8 +228,6 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //! FBX
|
} //! FBX
|
||||||
} //! Assimp
|
} //! Assimp
|
||||||
|
|
||||||
|
|
|
@ -148,11 +148,23 @@ T PropertyGet(const PropertyTable& in, const std::string& name, const T& default
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline
|
||||||
T PropertyGet(const PropertyTable& in, const std::string& name, bool& result) {
|
T PropertyGet(const PropertyTable& in, const std::string& name, bool& result, bool useTemplate=false ) {
|
||||||
const Property* const prop = in.Get(name);
|
const Property* prop = in.Get(name);
|
||||||
if( nullptr == prop) {
|
if( nullptr == prop) {
|
||||||
result = false;
|
if ( ! useTemplate ) {
|
||||||
return T();
|
result = false;
|
||||||
|
return T();
|
||||||
|
}
|
||||||
|
const PropertyTable* templ = in.TemplateProps();
|
||||||
|
if ( nullptr == templ ) {
|
||||||
|
result = false;
|
||||||
|
return T();
|
||||||
|
}
|
||||||
|
prop = templ->Get(name);
|
||||||
|
if ( nullptr == prop ) {
|
||||||
|
result = false;
|
||||||
|
return T();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// strong typing, no need to be lenient
|
// strong typing, no need to be lenient
|
||||||
|
|
|
@ -48,11 +48,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// tab width for logging columns
|
// tab width for logging columns
|
||||||
#define ASSIMP_FBX_TAB_WIDTH 4
|
#define ASSIMP_FBX_TAB_WIDTH 4
|
||||||
|
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
|
|
||||||
#include "FBXTokenizer.h"
|
#include "FBXTokenizer.h"
|
||||||
#include "FBXUtil.h"
|
#include "FBXUtil.h"
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
@ -76,13 +76,11 @@ Token::Token(const char* sbegin, const char* send, TokenType type, unsigned int
|
||||||
ai_assert(static_cast<size_t>(send-sbegin) > 0);
|
ai_assert(static_cast<size_t>(send-sbegin) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Token::~Token()
|
Token::~Token()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "FBXUtil.h"
|
#include "FBXUtil.h"
|
||||||
#include "FBXTokenizer.h"
|
#include "FBXTokenizer.h"
|
||||||
|
|
||||||
#include "TinyFormatter.h"
|
#include <assimp/TinyFormatter.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
|
||||||
|
|
||||||
#include "FIReader.hpp"
|
#include "FIReader.hpp"
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
|
|
||||||
// Workaround for issue #1361
|
// Workaround for issue #1361
|
||||||
// https://github.com/assimp/assimp/issues/1361
|
// https://github.com/assimp/assimp/issues/1361
|
||||||
|
@ -54,13 +54,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
# define _GLIBCXX_USE_C99 1
|
# define _GLIBCXX_USE_C99 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
#include <assimp/IOStream.hpp>
|
#include <assimp/IOStream.hpp>
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
#include "MemoryIOWrapper.h"
|
#include <assimp/MemoryIOWrapper.h>
|
||||||
#include "irrXMLWrapper.h"
|
#include <assimp/irrXMLWrapper.h>
|
||||||
#include "../contrib/utf8cpp/source/utf8.h"
|
#include "../contrib/utf8cpp/source/utf8.h"
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace Assimp {
|
||||||
|
|
||||||
struct FIValue {
|
struct FIValue {
|
||||||
virtual const std::string &toString() const = 0;
|
virtual const std::string &toString() const = 0;
|
||||||
|
virtual ~FIValue() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FIStringValue: public FIValue {
|
struct FIStringValue: public FIValue {
|
||||||
|
@ -121,6 +122,7 @@ struct FICDATAValue: public FIStringValue {
|
||||||
|
|
||||||
struct FIDecoder {
|
struct FIDecoder {
|
||||||
virtual std::shared_ptr<const FIValue> decode(const uint8_t *data, size_t len) = 0;
|
virtual std::shared_ptr<const FIValue> decode(const uint8_t *data, size_t len) = 0;
|
||||||
|
virtual ~FIDecoder() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FIQName {
|
struct FIQName {
|
||||||
|
|
|
@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "../include/assimp/IOSystem.hpp"
|
#include "../include/assimp/IOSystem.hpp"
|
||||||
#include "../include/assimp/DefaultLogger.hpp"
|
#include "../include/assimp/DefaultLogger.hpp"
|
||||||
#include "fast_atof.h"
|
#include "../include/assimp/fast_atof.h"
|
||||||
#include "ParsingUtils.h"
|
#include "../include/assimp/ParsingUtils.h"
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "FindDegenerates.h"
|
#include "FindDegenerates.h"
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "FindInvalidDataProcess.h"
|
#include "FindInvalidDataProcess.h"
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "Macros.h"
|
#include <assimp/Macros.h>
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
#include "qnan.h"
|
#include <assimp/qnan.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "FixNormalsStep.h"
|
#include "FixNormalsStep.h"
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
|
@ -49,8 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
#include "qnan.h"
|
#include <assimp/qnan.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
|
@ -49,8 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "GenVertexNormalsProcess.h"
|
#include "GenVertexNormalsProcess.h"
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "Exceptional.h"
|
#include <assimp/Exceptional.h>
|
||||||
#include "qnan.h"
|
#include <assimp/qnan.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define AI_HMPLOADER_H_INCLUDED
|
#define AI_HMPLOADER_H_INCLUDED
|
||||||
|
|
||||||
// internal headers
|
// internal headers
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "MDLLoader.h"
|
#include "MDLLoader.h"
|
||||||
#include "HMPFileData.h"
|
#include "HMPFileData.h"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#ifndef AI_IFF_H_INCLUDED
|
#ifndef AI_IFF_H_INCLUDED
|
||||||
#define AI_IFF_H_INCLUDED
|
#define AI_IFF_H_INCLUDED
|
||||||
|
|
||||||
#include "ByteSwapper.h"
|
#include <assimp/ByteSwapper.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace IFF {
|
namespace IFF {
|
||||||
|
|
|
@ -49,16 +49,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_IRR_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_IRR_IMPORTER
|
||||||
|
|
||||||
#include "IRRLoader.h"
|
#include "IRRLoader.h"
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include "GenericProperty.h"
|
#include <assimp/GenericProperty.h>
|
||||||
|
|
||||||
#include <assimp/SceneCombiner.h>
|
#include <assimp/SceneCombiner.h>
|
||||||
#include "StandardShapes.h"
|
#include <assimp/StandardShapes.h>
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
|
|
||||||
// We need MathFunctions.h to compute the lcm/gcd of a number
|
// We need MathFunctions.h to compute the lcm/gcd of a number
|
||||||
#include "MathFunctions.h"
|
#include <assimp/MathFunctions.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/mesh.h>
|
#include <assimp/mesh.h>
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "IRRShared.h"
|
#include "IRRShared.h"
|
||||||
#include <assimp/SceneCombiner.h>
|
#include <assimp/SceneCombiner.h>
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
#include "StringUtils.h"
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/anim.h>
|
#include <assimp/anim.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
|
@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER
|
||||||
|
|
||||||
#include "IRRMeshLoader.h"
|
#include "IRRMeshLoader.h"
|
||||||
#include "ParsingUtils.h"
|
#include <assimp/ParsingUtils.h>
|
||||||
#include "fast_atof.h"
|
#include <assimp/fast_atof.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/mesh.h>
|
#include <assimp/mesh.h>
|
||||||
|
@ -56,7 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include "Macros.h"
|
#include <assimp/Macros.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
using namespace irr;
|
using namespace irr;
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_IRRMESHLOADER_H_INCLUDED
|
#ifndef AI_IRRMESHLOADER_H_INCLUDED
|
||||||
#define AI_IRRMESHLOADER_H_INCLUDED
|
#define AI_IRRMESHLOADER_H_INCLUDED
|
||||||
|
|
||||||
#include "BaseImporter.h"
|
#include <assimp/BaseImporter.h>
|
||||||
#include "IRRShared.h"
|
#include "IRRShared.h"
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue