Next iteration for c++11 features.
parent
0dabce2754
commit
18531e3677
|
@ -56,8 +56,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
using namespace D3DS;
|
using namespace D3DS;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/light.h>
|
#include <assimp/light.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
#include <assimp/qnan.h>
|
#include <assimp/qnan.h>
|
||||||
#include <stdio.h> //sprintf
|
#include <cstdio> //sprintf
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace D3DS {
|
namespace D3DS {
|
||||||
|
|
|
@ -46,11 +46,11 @@ 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
|
||||||
|
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
|
||||||
|
|
||||||
#include "3DSHelper.h"
|
#include "3DSHelper.h"
|
||||||
#include <assimp/StreamReader.h>
|
#include <assimp/StreamReader.h>
|
||||||
|
@ -75,14 +75,14 @@ public:
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -90,14 +90,14 @@ protected:
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Converts a temporary material to the outer representation
|
/** Converts a temporary material to the outer representation
|
||||||
|
|
|
@ -40,6 +40,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
#ifndef ASSIMP_BUILD_NO_3MF_EXPORTER
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -58,8 +61,6 @@ class IOStream;
|
||||||
|
|
||||||
namespace D3MF {
|
namespace D3MF {
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
|
||||||
#ifndef ASSIMP_BUILD_NO_3MF_EXPORTER
|
|
||||||
|
|
||||||
struct OpcPackageRelationship;
|
struct OpcPackageRelationship;
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ 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
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -84,4 +86,6 @@ protected:
|
||||||
|
|
||||||
} // Namespace Assimp
|
} // Namespace Assimp
|
||||||
|
|
||||||
|
#endif // #ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
|
||||||
|
|
||||||
#endif // AI_D3MFLOADER_H_INCLUDED
|
#endif // AI_D3MFLOADER_H_INCLUDED
|
||||||
|
|
|
@ -51,11 +51,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/texture.h>
|
#include <assimp/texture.h>
|
||||||
#include "3MFXmlTags.h"
|
#include "3MFXmlTags.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
|
@ -42,9 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef D3MFOPCPACKAGE_H
|
#ifndef D3MFOPCPACKAGE_H
|
||||||
#define D3MFOPCPACKAGE_H
|
#define D3MFOPCPACKAGE_H
|
||||||
|
|
||||||
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <assimp/IOSystem.hpp>
|
|
||||||
|
|
||||||
struct aiTexture;
|
struct aiTexture;
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace Assimp {
|
||||||
class AC3DImporter : public BaseImporter {
|
class AC3DImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
AC3DImporter();
|
AC3DImporter();
|
||||||
~AC3DImporter();
|
~AC3DImporter() override;
|
||||||
|
|
||||||
// Represents an AC3D material
|
// Represents an AC3D material
|
||||||
struct Material {
|
struct Material {
|
||||||
|
@ -185,25 +185,25 @@ public:
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details */
|
* See #BaseImporter::GetInfo for the details */
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details*/
|
* See BaseImporter::InternReadFile() for details*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem *pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.*/
|
* basing on the Importer's configuration property list.*/
|
||||||
void SetupProperties(const Importer *pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
|
@ -267,7 +267,7 @@ public:
|
||||||
AMFImporter() AI_NO_EXCEPT;
|
AMFImporter() AI_NO_EXCEPT;
|
||||||
|
|
||||||
/// Default destructor.
|
/// Default destructor.
|
||||||
~AMFImporter();
|
~AMFImporter() override;
|
||||||
|
|
||||||
/// Parse AMF file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph.
|
/// Parse AMF file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph.
|
||||||
/// Also exception can be thrown if trouble will found.
|
/// Also exception can be thrown if trouble will found.
|
||||||
|
@ -276,9 +276,9 @@ public:
|
||||||
void ParseFile(const std::string &pFile, IOSystem *pIOHandler);
|
void ParseFile(const std::string &pFile, IOSystem *pIOHandler);
|
||||||
void ParseHelper_Node_Enter(AMFNodeElementBase *child);
|
void ParseHelper_Node_Enter(AMFNodeElementBase *child);
|
||||||
void ParseHelper_Node_Exit();
|
void ParseHelper_Node_Exit();
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const;
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const override;
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
|
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const;
|
bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const;
|
||||||
bool Find_ConvertedNode(const std::string &pID, NodeArray &nodeArray, aiNode **pNode) const;
|
bool Find_ConvertedNode(const std::string &pID, NodeArray &nodeArray, aiNode **pNode) const;
|
||||||
bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const;
|
bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const;
|
||||||
|
|
|
@ -48,15 +48,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_AMF_IMPORTER_NODE_H
|
#ifndef INCLUDED_AI_AMF_IMPORTER_NODE_H
|
||||||
#define INCLUDED_AI_AMF_IMPORTER_NODE_H
|
#define INCLUDED_AI_AMF_IMPORTER_NODE_H
|
||||||
|
|
||||||
// Header files, stdlib.
|
// Header files, Assimp.
|
||||||
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/types.h>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// Header files, Assimp.
|
|
||||||
#include "assimp/scene.h"
|
|
||||||
#include "assimp/types.h"
|
|
||||||
|
|
||||||
/// \class CAMFImporter_NodeElement
|
/// \class CAMFImporter_NodeElement
|
||||||
/// Base class for elements of nodes.
|
/// Base class for elements of nodes.
|
||||||
class AMFNodeElementBase {
|
class AMFNodeElementBase {
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -62,42 +62,37 @@ namespace Assimp {
|
||||||
class ASEImporter : public BaseImporter {
|
class ASEImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
ASEImporter();
|
ASEImporter();
|
||||||
~ASEImporter();
|
~ASEImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Generate normal vectors basing on smoothing groups
|
/** Generate normal vectors basing on smoothing groups
|
||||||
* (in some cases the normal are already contained in the file)
|
* (in some cases the normal are already contained in the file)
|
||||||
|
@ -106,7 +101,6 @@ private:
|
||||||
*/
|
*/
|
||||||
bool GenerateNormals(ASE::Mesh& mesh);
|
bool GenerateNormals(ASE::Mesh& mesh);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Create valid vertex/normal/UV/color/face lists.
|
/** Create valid vertex/normal/UV/color/face lists.
|
||||||
* All elements are unique, faces have only one set of indices
|
* All elements are unique, faces have only one set of indices
|
||||||
|
@ -115,51 +109,43 @@ private:
|
||||||
*/
|
*/
|
||||||
void BuildUniqueRepresentation(ASE::Mesh& mesh);
|
void BuildUniqueRepresentation(ASE::Mesh& mesh);
|
||||||
|
|
||||||
|
|
||||||
/** Create one-material-per-mesh meshes ;-)
|
/** Create one-material-per-mesh meshes ;-)
|
||||||
* \param mesh Mesh to work with
|
* \param mesh Mesh to work with
|
||||||
* \param Receives the list of all created meshes
|
* \param Receives the list of all created meshes
|
||||||
*/
|
*/
|
||||||
void ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOut);
|
void ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOut);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Convert a material to a aiMaterial object
|
/** Convert a material to a aiMaterial object
|
||||||
* \param mat Input material
|
* \param mat Input material
|
||||||
*/
|
*/
|
||||||
void ConvertMaterial(ASE::Material& mat);
|
void ConvertMaterial(ASE::Material& mat);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Setup the final material indices for each mesh
|
/** Setup the final material indices for each mesh
|
||||||
*/
|
*/
|
||||||
void BuildMaterialIndices();
|
void BuildMaterialIndices();
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Build the node graph
|
/** Build the node graph
|
||||||
*/
|
*/
|
||||||
void BuildNodes(std::vector<ASE::BaseNode*>& nodes);
|
void BuildNodes(std::vector<ASE::BaseNode*>& nodes);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Build output cameras
|
/** Build output cameras
|
||||||
*/
|
*/
|
||||||
void BuildCameras();
|
void BuildCameras();
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Build output lights
|
/** Build output lights
|
||||||
*/
|
*/
|
||||||
void BuildLights();
|
void BuildLights();
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Build output animations
|
/** Build output animations
|
||||||
*/
|
*/
|
||||||
void BuildAnimations(const std::vector<ASE::BaseNode*>& nodes);
|
void BuildAnimations(const std::vector<ASE::BaseNode*>& nodes);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Add sub nodes to a node
|
/** Add sub nodes to a node
|
||||||
* \param pcParent parent node to be filled
|
* \param pcParent parent node to be filled
|
||||||
|
@ -183,7 +169,6 @@ private:
|
||||||
void GenerateDefaultMaterial();
|
void GenerateDefaultMaterial();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Parser instance */
|
/** Parser instance */
|
||||||
ASE::Parser* mParser;
|
ASE::Parser* mParser;
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file AssbinExporter.h
|
/** @file AssbinExporter.h
|
||||||
* ASSBIN Exporter Main Header
|
* ASSBIN Exporter Main Header
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_ASSBINEXPORTER_H_INC
|
#ifndef AI_ASSBINEXPORTER_H_INC
|
||||||
#define AI_ASSBINEXPORTER_H_INC
|
#define AI_ASSBINEXPORTER_H_INC
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -74,17 +73,11 @@ private:
|
||||||
bool compressed;
|
bool compressed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool CanRead(
|
bool CanRead(const std::string& pFile,
|
||||||
const std::string& pFile,
|
IOSystem* pIOHandler, bool checkSig) const override;
|
||||||
IOSystem* pIOHandler,
|
const aiImporterDesc* GetInfo() const override;
|
||||||
bool checkSig
|
void InternReadFile(
|
||||||
) const;
|
const std::string& pFile,aiScene* pScene,IOSystem* pIOHandler) override;
|
||||||
virtual const aiImporterDesc* GetInfo() const;
|
|
||||||
virtual void InternReadFile(
|
|
||||||
const std::string& pFile,
|
|
||||||
aiScene* pScene,
|
|
||||||
IOSystem* pIOHandler
|
|
||||||
);
|
|
||||||
void ReadHeader();
|
void ReadHeader();
|
||||||
void ReadBinaryScene( IOStream * stream, aiScene* pScene );
|
void ReadBinaryScene( IOStream * stream, aiScene* pScene );
|
||||||
void ReadBinaryNode( IOStream * stream, aiNode** mRootNode, aiNode* parent );
|
void ReadBinaryNode( IOStream * stream, aiNode** mRootNode, aiNode* parent );
|
||||||
|
|
|
@ -69,13 +69,12 @@ void MeshSplitter::UpdateNode(aiNode* pcNode, const std::vector<std::pair<aiMesh
|
||||||
for (unsigned int i = 0, end = pcNode->mNumChildren; i < end;++i) {
|
for (unsigned int i = 0, end = pcNode->mNumChildren; i < end;++i) {
|
||||||
UpdateNode ( pcNode->mChildren[i], source_mesh_map );
|
UpdateNode ( pcNode->mChildren[i], source_mesh_map );
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WAS_NOT_COPIED 0xffffffff
|
static const unsigned int WAS_NOT_COPIED = 0xffffffff;
|
||||||
|
|
||||||
typedef std::pair <unsigned int,float> PerVertexWeight;
|
using PerVertexWeight = std::pair <unsigned int,float>;
|
||||||
typedef std::vector <PerVertexWeight> VertexWeightTable;
|
using VertexWeightTable = std::vector <PerVertexWeight>;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh) {
|
VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh) {
|
||||||
|
@ -89,7 +88,7 @@ VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh) {
|
||||||
aiBone* bone = pMesh->mBones[i];
|
aiBone* bone = pMesh->mBones[i];
|
||||||
for (unsigned int a = 0; a < bone->mNumWeights;++a) {
|
for (unsigned int a = 0; a < bone->mNumWeights;++a) {
|
||||||
const aiVertexWeight& weight = bone->mWeights[a];
|
const aiVertexWeight& weight = bone->mWeights[a];
|
||||||
avPerVertexWeights[weight.mVertexId].push_back( std::make_pair(i,weight.mWeight) );
|
avPerVertexWeights[weight.mVertexId].emplace_back(i,weight.mWeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return avPerVertexWeights;
|
return avPerVertexWeights;
|
||||||
|
@ -100,7 +99,7 @@ void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, std::vector<std:
|
||||||
// TODO: should better use std::(multi)set for source_mesh_map.
|
// TODO: should better use std::(multi)set for source_mesh_map.
|
||||||
|
|
||||||
if (in_mesh->mNumVertices <= LIMIT) {
|
if (in_mesh->mNumVertices <= LIMIT) {
|
||||||
source_mesh_map.push_back(std::make_pair(in_mesh,a));
|
source_mesh_map.emplace_back(in_mesh,a);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +186,7 @@ void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, std::vector<std:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vFaces.push_back(aiFace());
|
vFaces.emplace_back();
|
||||||
aiFace& rFace = vFaces.back();
|
aiFace& rFace = vFaces.back();
|
||||||
|
|
||||||
// setup face type and number of indices
|
// setup face type and number of indices
|
||||||
|
|
|
@ -24,10 +24,9 @@ struct aiNode;
|
||||||
/** Splits meshes of unique vertices into meshes with no more vertices than
|
/** Splits meshes of unique vertices into meshes with no more vertices than
|
||||||
* a given, configurable threshold value.
|
* a given, configurable threshold value.
|
||||||
*/
|
*/
|
||||||
class MeshSplitter
|
class MeshSplitter {
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
unsigned int LIMIT;
|
||||||
|
|
||||||
void SetLimit(unsigned int l) {
|
void SetLimit(unsigned int l) {
|
||||||
LIMIT = l;
|
LIMIT = l;
|
||||||
|
@ -37,8 +36,6 @@ public:
|
||||||
return LIMIT;
|
return LIMIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
|
@ -46,16 +43,10 @@ public:
|
||||||
*/
|
*/
|
||||||
void Execute(aiScene *pScene);
|
void Execute(aiScene *pScene);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void UpdateNode(aiNode *pcNode, const std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map);
|
void UpdateNode(aiNode *pcNode, const std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map);
|
||||||
void SplitMesh(unsigned int index, aiMesh *mesh, std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map);
|
void SplitMesh(unsigned int index, aiMesh *mesh, std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map);
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
unsigned int LIMIT;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDED_MESH_SPLITTER
|
#endif // INCLUDED_MESH_SPLITTER
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file AssxmlExporter.h
|
/** @file AssxmlExporter.h
|
||||||
* ASSXML Exporter Main Header
|
* ASSXML Exporter Main Header
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_ASSXMLEXPORTER_H_INC
|
#ifndef AI_ASSXMLEXPORTER_H_INC
|
||||||
#define AI_ASSXMLEXPORTER_H_INC
|
#define AI_ASSXMLEXPORTER_H_INC
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file AssxmlFileWriter.h
|
/** @file AssxmlFileWriter.h
|
||||||
* @brief Declaration of Assxml file writer.
|
* @brief Declaration of Assxml file writer.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_ASSXMLFILEWRITER_H_INC
|
#ifndef AI_ASSXMLFILEWRITER_H_INC
|
||||||
#define AI_ASSXMLFILEWRITER_H_INC
|
#define AI_ASSXMLFILEWRITER_H_INC
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -40,8 +39,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @file Definition of the .b3d importer class. */
|
/**
|
||||||
|
* @file Definition of the .b3d importer class.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_B3DIMPORTER_H_INC
|
#ifndef AI_B3DIMPORTER_H_INC
|
||||||
#define AI_B3DIMPORTER_H_INC
|
#define AI_B3DIMPORTER_H_INC
|
||||||
|
|
||||||
|
@ -62,14 +63,12 @@ namespace Assimp{
|
||||||
class B3DImporter : public BaseImporter{
|
class B3DImporter : public BaseImporter{
|
||||||
public:
|
public:
|
||||||
B3DImporter() = default;
|
B3DImporter() = default;
|
||||||
virtual ~B3DImporter();
|
~B3DImporter() override;
|
||||||
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
|
||||||
virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
const aiImporterDesc* GetInfo () const override;
|
||||||
virtual const aiImporterDesc* GetInfo () const;
|
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
|
||||||
virtual void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -113,7 +112,6 @@ private:
|
||||||
void ReadBB3D( aiScene *scene );
|
void ReadBB3D( aiScene *scene );
|
||||||
|
|
||||||
size_t _pos;
|
size_t _pos;
|
||||||
// unsigned _size;
|
|
||||||
std::vector<unsigned char> _buf;
|
std::vector<unsigned char> _buf;
|
||||||
std::vector<size_t> _stack;
|
std::vector<size_t> _stack;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file BlenderLoader.h
|
/** @file BlenderLoader.h
|
||||||
* @brief Declaration of the Blender 3D (*.blend) importer class.
|
* @brief Declaration of the Blender 3D (*.blend) importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef INCLUDED_AI_BLEND_LOADER_H
|
#ifndef INCLUDED_AI_BLEND_LOADER_H
|
||||||
#define INCLUDED_AI_BLEND_LOADER_H
|
#define INCLUDED_AI_BLEND_LOADER_H
|
||||||
|
|
||||||
|
@ -60,15 +60,19 @@ namespace Assimp {
|
||||||
|
|
||||||
// TinyFormatter.h
|
// TinyFormatter.h
|
||||||
namespace Formatter {
|
namespace Formatter {
|
||||||
template <typename T,typename TR, typename A> class basic_formatter;
|
|
||||||
|
template <typename T, typename TR, typename A>
|
||||||
|
class basic_formatter;
|
||||||
|
|
||||||
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
||||||
}
|
|
||||||
|
} // namespace Formatter
|
||||||
|
|
||||||
// BlenderDNA.h
|
// BlenderDNA.h
|
||||||
namespace Blender {
|
namespace Blender {
|
||||||
class FileDatabase;
|
class FileDatabase;
|
||||||
struct ElemBase;
|
struct ElemBase;
|
||||||
}
|
} // namespace Blender
|
||||||
|
|
||||||
// BlenderScene.h
|
// BlenderScene.h
|
||||||
namespace Blender {
|
namespace Blender {
|
||||||
|
@ -80,38 +84,36 @@ namespace Assimp {
|
||||||
struct MTex;
|
struct MTex;
|
||||||
struct Image;
|
struct Image;
|
||||||
struct Material;
|
struct Material;
|
||||||
}
|
} // namespace Blender
|
||||||
|
|
||||||
// BlenderIntermediate.h
|
// BlenderIntermediate.h
|
||||||
namespace Blender {
|
namespace Blender {
|
||||||
struct ConversionData;
|
struct ConversionData;
|
||||||
template <template <typename,typename> class TCLASS, typename T> struct TempArray;
|
template <template <typename, typename> class TCLASS, typename T>
|
||||||
}
|
struct TempArray;
|
||||||
|
} // namespace Blender
|
||||||
|
|
||||||
// BlenderModifier.h
|
// BlenderModifier.h
|
||||||
namespace Blender {
|
namespace Blender {
|
||||||
class BlenderModifierShowcase;
|
class BlenderModifierShowcase;
|
||||||
class BlenderModifier;
|
class BlenderModifier;
|
||||||
}
|
} // namespace Blender
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
/** Load blenders official binary format. The actual file structure (the `DNA` how they
|
/** Load blenders official binary format. The actual file structure (the `DNA` how they
|
||||||
* call it is outsourced to BlenderDNA.cpp/BlenderDNA.h. This class only performs the
|
* call it is outsourced to BlenderDNA.cpp/BlenderDNA.h. This class only performs the
|
||||||
* conversion from intermediate format to aiScene. */
|
* conversion from intermediate format to aiScene. */
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
class BlenderImporter : public BaseImporter, public LogFunctions<BlenderImporter>
|
class BlenderImporter : public BaseImporter, public LogFunctions<BlenderImporter> {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
BlenderImporter();
|
BlenderImporter();
|
||||||
~BlenderImporter();
|
~BlenderImporter() override;
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
|
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||||
void ParseBlendFile(Blender::FileDatabase &out, std::shared_ptr<IOStream> stream);
|
void ParseBlendFile(Blender::FileDatabase &out, std::shared_ptr<IOStream> stream);
|
||||||
void ExtractScene(Blender::Scene &out, const Blender::FileDatabase &file);
|
void ExtractScene(Blender::Scene &out, const Blender::FileDatabase &file);
|
||||||
void ConvertBlendFile(aiScene *out, const Blender::Scene &in, const Blender::FileDatabase &file);
|
void ConvertBlendFile(aiScene *out, const Blender::Scene &in, const Blender::FileDatabase &file);
|
||||||
|
@ -120,52 +122,46 @@ private:
|
||||||
aiNode *ConvertNode(const Blender::Scene &in,
|
aiNode *ConvertNode(const Blender::Scene &in,
|
||||||
const Blender::Object *obj,
|
const Blender::Object *obj,
|
||||||
Blender::ConversionData &conv_info,
|
Blender::ConversionData &conv_info,
|
||||||
const aiMatrix4x4& parentTransform
|
const aiMatrix4x4 &parentTransform);
|
||||||
);
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
void ConvertMesh(const Blender::Scene &in,
|
void ConvertMesh(const Blender::Scene &in,
|
||||||
const Blender::Object *obj,
|
const Blender::Object *obj,
|
||||||
const Blender::Mesh *mesh,
|
const Blender::Mesh *mesh,
|
||||||
Blender::ConversionData &conv_data,
|
Blender::ConversionData &conv_data,
|
||||||
Blender::TempArray<std::vector,aiMesh>& temp
|
Blender::TempArray<std::vector, aiMesh> &temp);
|
||||||
);
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
aiLight *ConvertLight(const Blender::Scene &in,
|
aiLight *ConvertLight(const Blender::Scene &in,
|
||||||
const Blender::Object *obj,
|
const Blender::Object *obj,
|
||||||
const Blender::Lamp *mesh,
|
const Blender::Lamp *mesh,
|
||||||
Blender::ConversionData& conv_data
|
Blender::ConversionData &conv_data);
|
||||||
);
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
aiCamera *ConvertCamera(const Blender::Scene &in,
|
aiCamera *ConvertCamera(const Blender::Scene &in,
|
||||||
const Blender::Object *obj,
|
const Blender::Object *obj,
|
||||||
const Blender::Camera *mesh,
|
const Blender::Camera *mesh,
|
||||||
Blender::ConversionData& conv_data
|
Blender::ConversionData &conv_data);
|
||||||
);
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
void BuildDefaultMaterial(
|
void BuildDefaultMaterial(
|
||||||
Blender::ConversionData& conv_data
|
Blender::ConversionData &conv_data);
|
||||||
);
|
|
||||||
|
|
||||||
|
// --------------------
|
||||||
void AddBlendParams(
|
void AddBlendParams(
|
||||||
aiMaterial *result,
|
aiMaterial *result,
|
||||||
const Blender::Material* source
|
const Blender::Material *source);
|
||||||
);
|
|
||||||
|
|
||||||
|
// --------------------
|
||||||
void BuildMaterials(
|
void BuildMaterials(
|
||||||
Blender::ConversionData& conv_data
|
Blender::ConversionData &conv_data);
|
||||||
);
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
void ResolveTexture(
|
void ResolveTexture(
|
||||||
aiMaterial *out,
|
aiMaterial *out,
|
||||||
const Blender::Material *mat,
|
const Blender::Material *mat,
|
||||||
const Blender::MTex *tex,
|
const Blender::MTex *tex,
|
||||||
Blender::ConversionData& conv_data
|
Blender::ConversionData &conv_data);
|
||||||
);
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
void ResolveImage(
|
void ResolveImage(
|
||||||
|
@ -173,31 +169,25 @@ private:
|
||||||
const Blender::Material *mat,
|
const Blender::Material *mat,
|
||||||
const Blender::MTex *tex,
|
const Blender::MTex *tex,
|
||||||
const Blender::Image *img,
|
const Blender::Image *img,
|
||||||
Blender::ConversionData& conv_data
|
Blender::ConversionData &conv_data);
|
||||||
);
|
|
||||||
|
|
||||||
|
// --------------------
|
||||||
void AddSentinelTexture(
|
void AddSentinelTexture(
|
||||||
aiMaterial *out,
|
aiMaterial *out,
|
||||||
const Blender::Material *mat,
|
const Blender::Material *mat,
|
||||||
const Blender::MTex *tex,
|
const Blender::MTex *tex,
|
||||||
Blender::ConversionData& conv_data
|
Blender::ConversionData &conv_data);
|
||||||
);
|
|
||||||
|
|
||||||
private: // static stuff, mostly logging and error reporting.
|
private: // static stuff, mostly logging and error reporting.
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
static void CheckActualType(const Blender::ElemBase *dt,
|
static void CheckActualType(const Blender::ElemBase *dt,
|
||||||
const char* check
|
const char *check);
|
||||||
);
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
static void NotSupportedObjectType(const Blender::Object *obj,
|
static void NotSupportedObjectType(const Blender::Object *obj,
|
||||||
const char* type
|
const char *type);
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Blender::BlenderModifierShowcase *modifier_cache;
|
Blender::BlenderModifierShowcase *modifier_cache;
|
||||||
|
|
||||||
}; // !class BlenderImporter
|
}; // !class BlenderImporter
|
||||||
|
|
|
@ -56,46 +56,44 @@ namespace Assimp {
|
||||||
|
|
||||||
// TinyFormatter.h
|
// TinyFormatter.h
|
||||||
namespace Formatter {
|
namespace Formatter {
|
||||||
template <typename T,typename TR, typename A> class basic_formatter;
|
template <typename T, typename TR, typename A>
|
||||||
|
class basic_formatter;
|
||||||
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
||||||
}
|
} // namespace Formatter
|
||||||
|
|
||||||
// COBScene.h
|
// COBScene.h
|
||||||
namespace COB {
|
namespace COB {
|
||||||
struct ChunkInfo;
|
struct ChunkInfo;
|
||||||
struct Node;
|
struct Node;
|
||||||
struct Scene;
|
struct Scene;
|
||||||
}
|
} // namespace COB
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
/** Importer class to load TrueSpace files (cob,scn) up to v6.
|
/** Importer class to load TrueSpace files (cob,scn) up to v6.
|
||||||
*
|
*
|
||||||
* Currently relatively limited, loads only ASCII files and needs more test coverage. */
|
* Currently relatively limited, loads only ASCII files and needs more test coverage. */
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
class COBImporter : public BaseImporter
|
class COBImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
COBImporter();
|
COBImporter();
|
||||||
~COBImporter();
|
~COBImporter() override;
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// --------------------
|
||||||
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
const aiImporterDesc* GetInfo () const;
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
// --------------------
|
|
||||||
void SetupProperties(const Importer* pImp);
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Prepend 'COB: ' and throw msg.*/
|
/** Prepend 'COB: ' and throw msg.*/
|
||||||
AI_WONT_RETURN static void ThrowException(const std::string &msg) AI_WONT_RETURN_SUFFIX;
|
AI_WONT_RETURN static void ThrowException(const std::string &msg) AI_WONT_RETURN_SUFFIX;
|
||||||
|
@ -113,7 +111,6 @@ private:
|
||||||
void ReadBinaryFile(COB::Scene &out, StreamReaderLE *stream);
|
void ReadBinaryFile(COB::Scene &out, StreamReaderLE *stream);
|
||||||
|
|
||||||
// Conversion to Assimp output format
|
// Conversion to Assimp output format
|
||||||
|
|
||||||
aiNode *BuildNodes(const COB::Node &root, const COB::Scene &scin, aiScene *fill);
|
aiNode *BuildNodes(const COB::Node &root, const COB::Scene &scin, aiScene *fill);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -122,7 +119,8 @@ private:
|
||||||
void UnsupportedChunk_Ascii(LineSplitter &splitter, const COB::ChunkInfo &nfo, const char *name);
|
void UnsupportedChunk_Ascii(LineSplitter &splitter, const COB::ChunkInfo &nfo, const char *name);
|
||||||
void ReadChunkInfo_Ascii(COB::ChunkInfo &out, const LineSplitter &splitter);
|
void ReadChunkInfo_Ascii(COB::ChunkInfo &out, const LineSplitter &splitter);
|
||||||
void ReadBasicNodeInfo_Ascii(COB::Node &msh, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
void ReadBasicNodeInfo_Ascii(COB::Node &msh, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
||||||
template <typename T> void ReadFloat3Tuple_Ascii(T& fill, const char** in);
|
template <typename T>
|
||||||
|
void ReadFloat3Tuple_Ascii(T &fill, const char **in);
|
||||||
|
|
||||||
void ReadPolH_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
void ReadPolH_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
||||||
void ReadBitM_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
void ReadBitM_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
||||||
|
@ -134,7 +132,6 @@ private:
|
||||||
void ReadUnit_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
void ReadUnit_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
||||||
void ReadChan_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
void ReadChan_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
||||||
|
|
||||||
|
|
||||||
// Binary file support
|
// Binary file support
|
||||||
|
|
||||||
void UnsupportedChunk_Binary(StreamReaderLE &reader, const COB::ChunkInfo &nfo, const char *name);
|
void UnsupportedChunk_Binary(StreamReaderLE &reader, const COB::ChunkInfo &nfo, const char *name);
|
||||||
|
@ -149,7 +146,6 @@ private:
|
||||||
void ReadGrou_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
|
void ReadGrou_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
|
||||||
void ReadUnit_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
|
void ReadUnit_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
|
||||||
|
|
||||||
|
|
||||||
}; // !class COBImporter
|
}; // !class COBImporter
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,16 +42,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file COBScene.h
|
/** @file COBScene.h
|
||||||
* @brief Utilities for the COB importer.
|
* @brief Utilities for the COB importer.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef INCLUDED_AI_COB_SCENE_H
|
#ifndef INCLUDED_AI_COB_SCENE_H
|
||||||
#define INCLUDED_AI_COB_SCENE_H
|
#define INCLUDED_AI_COB_SCENE_H
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <deque>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace COB {
|
namespace COB {
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -59,35 +58,32 @@ namespace Assimp {
|
||||||
* Link to file format specification:
|
* Link to file format specification:
|
||||||
* <max_8_dvd>\samples\Motion\Docs\CSM.rtf
|
* <max_8_dvd>\samples\Motion\Docs\CSM.rtf
|
||||||
*/
|
*/
|
||||||
class CSMImporter : public BaseImporter
|
class CSMImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
CSMImporter();
|
CSMImporter();
|
||||||
~CSMImporter();
|
~CSMImporter() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
const aiImporterDesc* GetInfo () const;
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
void SetupProperties(const Importer* pImp);
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool noSkeletonMesh;
|
bool noSkeletonMesh;
|
||||||
|
|
||||||
}; // end of class CSMImporter
|
}; // end of class CSMImporter
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
#endif // AI_AC3DIMPORTER_H_INC
|
#endif // AI_AC3DIMPORTER_H_INC
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "ColladaParser.h"
|
#include "ColladaParser.h"
|
||||||
#include <assimp/ColladaMetaData.h>
|
#include <assimp/ColladaMetaData.h>
|
||||||
#include <assimp/CreateAnimMesh.h>
|
#include <assimp/CreateAnimMesh.h>
|
||||||
#include <assimp/Defines.h>
|
|
||||||
#include <assimp/ParsingUtils.h>
|
#include <assimp/ParsingUtils.h>
|
||||||
#include <assimp/SkeletonMeshBuilder.h>
|
#include <assimp/SkeletonMeshBuilder.h>
|
||||||
#include <assimp/ZipArchiveIOSystem.h>
|
#include <assimp/ZipArchiveIOSystem.h>
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
* @brief Defines the parser helper class for the collada loader
|
* @brief Defines the parser helper class for the collada loader
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
#ifndef AI_COLLADAPARSER_H_INC
|
#ifndef AI_COLLADAPARSER_H_INC
|
||||||
#define AI_COLLADAPARSER_H_INC
|
#define AI_COLLADAPARSER_H_INC
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file DXFLoader.h
|
/** @file DXFLoader.h
|
||||||
* @brief Declaration of the .dxf importer class.
|
* @brief Declaration of the .dxf importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_DXFLOADER_H_INCLUDED
|
#ifndef AI_DXFLOADER_H_INCLUDED
|
||||||
#define AI_DXFLOADER_H_INCLUDED
|
#define AI_DXFLOADER_H_INCLUDED
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ namespace DXF {
|
||||||
struct Block;
|
struct Block;
|
||||||
struct InsertBlock;
|
struct InsertBlock;
|
||||||
|
|
||||||
typedef std::map<std::string, const DXF::Block*> BlockMap;
|
using BlockMap = std::map<std::string, const DXF::Block*>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@ -69,29 +69,26 @@ namespace DXF {
|
||||||
class DXFImporter : public BaseImporter {
|
class DXFImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
DXFImporter();
|
DXFImporter();
|
||||||
~DXFImporter();
|
~DXFImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details*/
|
* See #BaseImporter::GetInfo for the details*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details */
|
* See BaseImporter::InternReadFile() for details */
|
||||||
void InternReadFile( const std::string& pFile,
|
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
|
||||||
aiScene* pScene,
|
|
||||||
IOSystem* pIOHandler);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
void SkipSection(DXF::LineReader& reader);
|
void SkipSection(DXF::LineReader& reader);
|
||||||
|
|
||||||
|
|
|
@ -70,28 +70,29 @@ typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>
|
||||||
class FBXImporter : public BaseImporter, public LogFunctions<FBXImporter> {
|
class FBXImporter : public BaseImporter, public LogFunctions<FBXImporter> {
|
||||||
public:
|
public:
|
||||||
FBXImporter();
|
FBXImporter();
|
||||||
virtual ~FBXImporter();
|
~FBXImporter() override;
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
bool CanRead(const std::string &pFile,
|
bool CanRead(const std::string &pFile,
|
||||||
IOSystem *pIOHandler,
|
IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// --------------------
|
// --------------------
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
void SetupProperties(const Importer *pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
void InternReadFile(const std::string &pFile,
|
void InternReadFile(const std::string &pFile,
|
||||||
aiScene *pScene,
|
aiScene *pScene,
|
||||||
IOSystem *pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FBX::ImportSettings settings;
|
FBX::ImportSettings settings;
|
||||||
}; // !class FBXImporter
|
}; // !class FBXImporter
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
#endif // !INCLUDED_AI_FBX_IMPORTER_H
|
#endif // !INCLUDED_AI_FBX_IMPORTER_H
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -42,15 +41,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file HMPLoader.h
|
/** @file HMPLoader.h
|
||||||
* @brief Declaration of the HMP importer class
|
* @brief Declaration of the HMP importer class
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_HMPLOADER_H_INCLUDED
|
#ifndef AI_HMPLOADER_H_INCLUDED
|
||||||
#define AI_HMPLOADER_H_INCLUDED
|
#define AI_HMPLOADER_H_INCLUDED
|
||||||
|
|
||||||
// internal headers
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
#include "AssetLib/MDL/MDLLoader.h"
|
// internal headers
|
||||||
#include "AssetLib/HMP/HMPFileData.h"
|
#include "AssetLib/HMP/HMPFileData.h"
|
||||||
|
#include "AssetLib/MDL/MDLLoader.h"
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
using namespace HMP;
|
using namespace HMP;
|
||||||
|
@ -58,39 +57,31 @@ using namespace HMP;
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Used to load 3D GameStudio HMP files (terrains)
|
/** Used to load 3D GameStudio HMP files (terrains)
|
||||||
*/
|
*/
|
||||||
class HMPImporter : public MDLImporter
|
class HMPImporter : public MDLImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
HMPImporter();
|
HMPImporter();
|
||||||
~HMPImporter();
|
~HMPImporter() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Import a HMP4 file
|
/** Import a HMP4 file
|
||||||
|
@ -142,12 +133,8 @@ protected:
|
||||||
*/
|
*/
|
||||||
void ReadFirstSkin(unsigned int iNumSkins, const unsigned char *szCursor,
|
void ReadFirstSkin(unsigned int iNumSkins, const unsigned char *szCursor,
|
||||||
const unsigned char **szCursorOut);
|
const unsigned char **szCursorOut);
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
#endif // AI_HMPIMPORTER_H_INC
|
#endif // AI_HMPIMPORTER_H_INC
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "Common/PolyTools.h"
|
#include "Common/PolyTools.h"
|
||||||
#include "PostProcessing/ProcessHelper.h"
|
#include "PostProcessing/ProcessHelper.h"
|
||||||
|
|
||||||
#include <assimp/Defines.h>
|
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
|
@ -53,14 +53,18 @@ namespace Assimp {
|
||||||
|
|
||||||
// TinyFormatter.h
|
// TinyFormatter.h
|
||||||
namespace Formatter {
|
namespace Formatter {
|
||||||
template <typename T,typename TR, typename A> class basic_formatter;
|
|
||||||
|
template <typename T, typename TR, typename A>
|
||||||
|
class basic_formatter;
|
||||||
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
||||||
}
|
|
||||||
|
} // namespace Formatter
|
||||||
|
|
||||||
namespace STEP {
|
namespace STEP {
|
||||||
class DB;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class DB;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
/** Load the IFC format, which is an open specification to describe building and construction
|
/** Load the IFC format, which is an open specification to describe building and construction
|
||||||
|
@ -69,52 +73,12 @@ namespace Assimp {
|
||||||
See http://en.wikipedia.org/wiki/Industry_Foundation_Classes
|
See http://en.wikipedia.org/wiki/Industry_Foundation_Classes
|
||||||
*/
|
*/
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
class IFCImporter : public BaseImporter, public LogFunctions<IFCImporter>
|
class IFCImporter : public BaseImporter, public LogFunctions<IFCImporter> {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
IFCImporter();
|
|
||||||
~IFCImporter();
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// --------------------
|
|
||||||
bool CanRead( const std::string& pFile,
|
|
||||||
IOSystem* pIOHandler,
|
|
||||||
bool checkSig
|
|
||||||
) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// --------------------
|
|
||||||
const aiImporterDesc* GetInfo () const;
|
|
||||||
|
|
||||||
// --------------------
|
|
||||||
void SetupProperties(const Importer* pImp);
|
|
||||||
|
|
||||||
// --------------------
|
|
||||||
void InternReadFile( const std::string& pFile,
|
|
||||||
aiScene* pScene,
|
|
||||||
IOSystem* pIOHandler
|
|
||||||
);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
// loader settings, publicly accessible via their corresponding AI_CONFIG constants
|
// loader settings, publicly accessible via their corresponding AI_CONFIG constants
|
||||||
struct Settings
|
struct Settings {
|
||||||
{
|
Settings() :
|
||||||
Settings()
|
skipSpaceRepresentations(), useCustomTriangulation(), skipAnnotations(), conicSamplingAngle(10.f), cylindricalTessellation(32) {}
|
||||||
: skipSpaceRepresentations()
|
|
||||||
, useCustomTriangulation()
|
|
||||||
, skipAnnotations()
|
|
||||||
, conicSamplingAngle(10.f)
|
|
||||||
, cylindricalTessellation(32)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
bool skipSpaceRepresentations;
|
bool skipSpaceRepresentations;
|
||||||
bool useCustomTriangulation;
|
bool useCustomTriangulation;
|
||||||
|
@ -123,9 +87,27 @@ public:
|
||||||
int cylindricalTessellation;
|
int cylindricalTessellation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IFCImporter();
|
||||||
|
~IFCImporter() override;
|
||||||
|
|
||||||
|
// --------------------
|
||||||
|
bool CanRead(const std::string &pFile,
|
||||||
|
IOSystem *pIOHandler,
|
||||||
|
bool checkSig) const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// --------------------
|
||||||
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
|
// --------------------
|
||||||
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
|
// --------------------
|
||||||
|
void InternReadFile(const std::string &pFile,
|
||||||
|
aiScene *pScene,
|
||||||
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
|
|
||||||
}; // !class IFCImporter
|
}; // !class IFCImporter
|
||||||
|
|
|
@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AssetLib/IFC/IFCUtil.h"
|
#include "AssetLib/IFC/IFCUtil.h"
|
||||||
#include "Common/PolyTools.h"
|
#include "Common/PolyTools.h"
|
||||||
#include "PostProcessing/ProcessHelper.h"
|
#include "PostProcessing/ProcessHelper.h"
|
||||||
#include <assimp/Defines.h>
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace IFC {
|
namespace IFC {
|
||||||
|
|
|
@ -65,22 +65,21 @@ namespace Assimp {
|
||||||
class IRRImporter : public BaseImporter, public IrrlichtBase {
|
class IRRImporter : public BaseImporter, public IrrlichtBase {
|
||||||
public:
|
public:
|
||||||
IRRImporter();
|
IRRImporter();
|
||||||
~IRRImporter();
|
~IRRImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
|
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** Data structure for a scene-graph node animator
|
/** Data structure for a scene-graph node animator
|
||||||
*/
|
*/
|
||||||
struct Animator {
|
struct Animator {
|
||||||
|
|
|
@ -63,28 +63,28 @@ namespace Assimp {
|
||||||
class IRRMeshImporter : public BaseImporter, public IrrlichtBase {
|
class IRRMeshImporter : public BaseImporter, public IrrlichtBase {
|
||||||
public:
|
public:
|
||||||
IRRMeshImporter();
|
IRRMeshImporter();
|
||||||
~IRRMeshImporter();
|
~IRRMeshImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem *pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/XmlParser.h>
|
#include <assimp/XmlParser.h>
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
|
|
||||||
struct aiMaterial;
|
struct aiMaterial;
|
||||||
|
|
||||||
|
|
|
@ -41,15 +41,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @file Declaration of the LWO importer class. */
|
/** @file Declaration of the LWO importer class. */
|
||||||
|
#pragma once
|
||||||
#ifndef AI_LWOLOADER_H_INCLUDED
|
#ifndef AI_LWOLOADER_H_INCLUDED
|
||||||
#define AI_LWOLOADER_H_INCLUDED
|
#define AI_LWOLOADER_H_INCLUDED
|
||||||
|
|
||||||
#include <assimp/types.h>
|
|
||||||
#include <assimp/material.h>
|
|
||||||
#include <assimp/DefaultLogger.hpp>
|
|
||||||
|
|
||||||
#include "LWOFileData.h"
|
#include "LWOFileData.h"
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
|
#include <assimp/material.h>
|
||||||
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
@ -70,41 +69,38 @@ using namespace LWO;
|
||||||
* they aren't specific to one format version
|
* they aren't specific to one format version
|
||||||
*/
|
*/
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
class LWOImporter : public BaseImporter
|
class LWOImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
LWOImporter();
|
LWOImporter();
|
||||||
~LWOImporter();
|
~LWOImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Get list of supported extensions
|
// Get list of supported extensions
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Loads a LWO file in the older LWOB format (LW < 6)
|
/** Loads a LWO file in the older LWOB format (LW < 6)
|
||||||
*/
|
*/
|
||||||
|
@ -115,7 +111,6 @@ private:
|
||||||
*/
|
*/
|
||||||
void LoadLWO2File();
|
void LoadLWO2File();
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Parsing functions used for all file format versions
|
/** Parsing functions used for all file format versions
|
||||||
*/
|
*/
|
||||||
|
@ -125,7 +120,6 @@ private:
|
||||||
inline uint16_t GetU2();
|
inline uint16_t GetU2();
|
||||||
inline uint8_t GetU1();
|
inline uint8_t GetU1();
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Loads a surface chunk from an LWOB file
|
/** Loads a surface chunk from an LWOB file
|
||||||
* @param size Maximum size to be read, in bytes.
|
* @param size Maximum size to be read, in bytes.
|
||||||
|
@ -270,7 +264,6 @@ private:
|
||||||
*/
|
*/
|
||||||
void ConvertMaterial(const LWO::Surface &surf, aiMaterial *pcMat);
|
void ConvertMaterial(const LWO::Surface &surf, aiMaterial *pcMat);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Get a list of all UV/VC channels required by a specific surface.
|
/** Get a list of all UV/VC channels required by a specific surface.
|
||||||
*
|
*
|
||||||
|
@ -337,7 +330,6 @@ private:
|
||||||
void ComputeNormals(aiMesh *mesh, const std::vector<unsigned int> &smoothingGroups,
|
void ComputeNormals(aiMesh *mesh, const std::vector<unsigned int> &smoothingGroups,
|
||||||
const LWO::Surface &surface);
|
const LWO::Surface &surface);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Setup a new texture after the corresponding chunk was
|
/** Setup a new texture after the corresponding chunk was
|
||||||
* encountered in the file.
|
* encountered in the file.
|
||||||
|
@ -349,7 +341,6 @@ private:
|
||||||
unsigned int size);
|
unsigned int size);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** true if the file is a LWO2 file*/
|
/** true if the file is a LWO2 file*/
|
||||||
bool mIsLWO2;
|
bool mIsLWO2;
|
||||||
|
|
||||||
|
@ -400,10 +391,8 @@ protected:
|
||||||
bool hasNamedLayer;
|
bool hasNamedLayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
inline
|
inline float LWOImporter::GetF4() {
|
||||||
float LWOImporter::GetF4() {
|
|
||||||
float f;
|
float f;
|
||||||
::memcpy(&f, mFileBuffer, 4);
|
::memcpy(&f, mFileBuffer, 4);
|
||||||
mFileBuffer += 4;
|
mFileBuffer += 4;
|
||||||
|
@ -412,8 +401,7 @@ float LWOImporter::GetF4() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
inline uint32_t LWOImporter::GetU4()
|
inline uint32_t LWOImporter::GetU4() {
|
||||||
{
|
|
||||||
uint32_t f;
|
uint32_t f;
|
||||||
::memcpy(&f, mFileBuffer, 4);
|
::memcpy(&f, mFileBuffer, 4);
|
||||||
mFileBuffer += 4;
|
mFileBuffer += 4;
|
||||||
|
@ -422,8 +410,7 @@ inline uint32_t LWOImporter::GetU4()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
inline uint16_t LWOImporter::GetU2()
|
inline uint16_t LWOImporter::GetU2() {
|
||||||
{
|
|
||||||
uint16_t f;
|
uint16_t f;
|
||||||
::memcpy(&f, mFileBuffer, 2);
|
::memcpy(&f, mFileBuffer, 2);
|
||||||
mFileBuffer += 2;
|
mFileBuffer += 2;
|
||||||
|
@ -432,43 +419,40 @@ inline uint16_t LWOImporter::GetU2()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
inline uint8_t LWOImporter::GetU1()
|
inline uint8_t LWOImporter::GetU1() {
|
||||||
{
|
|
||||||
return *mFileBuffer++;
|
return *mFileBuffer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
inline int LWOImporter::ReadVSizedIntLWO2(uint8_t*& inout)
|
inline int LWOImporter::ReadVSizedIntLWO2(uint8_t *&inout) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
int c = *inout;inout++;
|
int c = *inout;
|
||||||
if(c != 0xFF)
|
inout++;
|
||||||
{
|
if (c != 0xFF) {
|
||||||
i = c << 8;
|
i = c << 8;
|
||||||
c = *inout;inout++;
|
c = *inout;
|
||||||
|
inout++;
|
||||||
i |= c;
|
i |= c;
|
||||||
}
|
} else {
|
||||||
else
|
c = *inout;
|
||||||
{
|
inout++;
|
||||||
c = *inout;inout++;
|
|
||||||
i = c << 16;
|
i = c << 16;
|
||||||
c = *inout;inout++;
|
c = *inout;
|
||||||
|
inout++;
|
||||||
i |= c << 8;
|
i |= c << 8;
|
||||||
c = *inout;inout++;
|
c = *inout;
|
||||||
|
inout++;
|
||||||
i |= c;
|
i |= c;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
inline void LWOImporter::GetS0(std::string& out,unsigned int max)
|
inline void LWOImporter::GetS0(std::string &out, unsigned int max) {
|
||||||
{
|
|
||||||
unsigned int iCursor = 0;
|
unsigned int iCursor = 0;
|
||||||
const char *sz = (const char *)mFileBuffer;
|
const char *sz = (const char *)mFileBuffer;
|
||||||
while (*mFileBuffer)
|
while (*mFileBuffer) {
|
||||||
{
|
if (++iCursor > max) {
|
||||||
if (++iCursor > max)
|
|
||||||
{
|
|
||||||
ASSIMP_LOG_WARN("LWO: Invalid file, string is is too long");
|
ASSIMP_LOG_WARN("LWO: Invalid file, string is is too long");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -479,8 +463,6 @@ inline void LWOImporter::GetS0(std::string& out,unsigned int max)
|
||||||
mFileBuffer += (len & 0x1 ? 1 : 2);
|
mFileBuffer += (len & 0x1 ? 1 : 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
#endif // AI_LWOIMPORTER_H_INCLUDED
|
#endif // AI_LWOIMPORTER_H_INCLUDED
|
||||||
|
|
|
@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file LWSLoader.h
|
/** @file LWSLoader.h
|
||||||
* @brief Declaration of the LightWave scene importer class.
|
* @brief Declaration of the LightWave scene importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_LWSLOADER_H_INCLUDED
|
#ifndef AI_LWSLOADER_H_INCLUDED
|
||||||
#define AI_LWSLOADER_H_INCLUDED
|
#define AI_LWSLOADER_H_INCLUDED
|
||||||
|
|
||||||
|
@ -53,6 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
struct aiImporterDesc;
|
struct aiImporterDesc;
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
class BatchLoader;
|
class BatchLoader;
|
||||||
class Importer;
|
class Importer;
|
||||||
class IOSystem;
|
class IOSystem;
|
||||||
|
@ -172,26 +174,26 @@ struct NodeDesc {
|
||||||
class LWSImporter : public BaseImporter {
|
class LWSImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
LWSImporter();
|
LWSImporter();
|
||||||
~LWSImporter();
|
~LWSImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Check whether we can read a specific file
|
// Check whether we can read a specific file
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Get list of supported extensions
|
// Get list of supported extensions
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Import file into given scene data structure
|
// Import file into given scene data structure
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem *pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Setup import properties
|
// Setup import properties
|
||||||
void SetupProperties(const Importer *pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
@ -226,9 +228,7 @@ private:
|
||||||
private:
|
private:
|
||||||
bool configSpeedFlag;
|
bool configSpeedFlag;
|
||||||
IOSystem *io;
|
IOSystem *io;
|
||||||
|
|
||||||
double first, last, fps;
|
double first, last, fps;
|
||||||
|
|
||||||
bool noSkeletonMesh;
|
bool noSkeletonMesh;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -65,21 +65,20 @@ class M3DImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
/// \brief Default constructor
|
/// \brief Default constructor
|
||||||
M3DImporter();
|
M3DImporter();
|
||||||
|
~M3DImporter() override {}
|
||||||
|
|
||||||
public:
|
|
||||||
/// \brief Returns whether the class can handle the format of the given file.
|
/// \brief Returns whether the class can handle the format of the given file.
|
||||||
/// \remark See BaseImporter::CanRead() for details.
|
/// \remark See BaseImporter::CanRead() for details.
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const;
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
|
||||||
|
|
||||||
private:
|
|
||||||
aiScene *mScene = nullptr; // the scene to import to
|
|
||||||
|
|
||||||
|
protected:
|
||||||
//! \brief Appends the supported extension.
|
//! \brief Appends the supported extension.
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
//! \brief File import implementation.
|
//! \brief File import implementation.
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
|
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
|
private:
|
||||||
void importMaterials(const M3DWrapper &m3d);
|
void importMaterials(const M3DWrapper &m3d);
|
||||||
void importTextures(const M3DWrapper &m3d);
|
void importTextures(const M3DWrapper &m3d);
|
||||||
void importMeshes(const M3DWrapper &m3d);
|
void importMeshes(const M3DWrapper &m3d);
|
||||||
|
@ -94,6 +93,9 @@ private:
|
||||||
void populateMesh(const M3DWrapper &m3d, aiMesh *pMesh, std::vector<aiFace> *faces, std::vector<aiVector3D> *verteces,
|
void populateMesh(const M3DWrapper &m3d, aiMesh *pMesh, std::vector<aiFace> *faces, std::vector<aiVector3D> *verteces,
|
||||||
std::vector<aiVector3D> *normals, std::vector<aiVector3D> *texcoords, std::vector<aiColor4D> *colors,
|
std::vector<aiVector3D> *normals, std::vector<aiVector3D> *texcoords, std::vector<aiColor4D> *colors,
|
||||||
std::vector<unsigned int> *vertexids);
|
std::vector<unsigned int> *vertexids);
|
||||||
|
|
||||||
|
private:
|
||||||
|
aiScene *mScene = nullptr; // the scene to import to
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace Assimp
|
} // Namespace Assimp
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,13 +42,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file MD2Loader.h
|
/** @file MD2Loader.h
|
||||||
* @brief Declaration of the .MD2 importer class.
|
* @brief Declaration of the .MD2 importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_MD2LOADER_H_INCLUDED
|
#ifndef AI_MD2LOADER_H_INCLUDED
|
||||||
#define AI_MD2LOADER_H_INCLUDED
|
#define AI_MD2LOADER_H_INCLUDED
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
|
||||||
#include <assimp/types.h>
|
|
||||||
#include <assimp/ByteSwapper.h>
|
|
||||||
#include "MD2FileData.h"
|
#include "MD2FileData.h"
|
||||||
|
#include <assimp/BaseImporter.h>
|
||||||
|
#include <assimp/ByteSwapper.h>
|
||||||
|
#include <assimp/types.h>
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
||||||
|
@ -60,44 +60,37 @@ using namespace MD2;
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Importer class for MD2
|
/** Importer class for MD2
|
||||||
*/
|
*/
|
||||||
class MD2Importer : public BaseImporter
|
class MD2Importer : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MD2Importer();
|
MD2Importer();
|
||||||
~MD2Importer();
|
~MD2Importer() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Validate the header of the file
|
/** Validate the header of the file
|
||||||
|
@ -105,7 +98,6 @@ protected:
|
||||||
void ValidateHeader();
|
void ValidateHeader();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Configuration option: frame to be loaded */
|
/** Configuration option: frame to be loaded */
|
||||||
unsigned int configFrameID;
|
unsigned int configFrameID;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -46,9 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_MD3LOADER_H_INCLUDED
|
#ifndef AI_MD3LOADER_H_INCLUDED
|
||||||
#define AI_MD3LOADER_H_INCLUDED
|
#define AI_MD3LOADER_H_INCLUDED
|
||||||
|
|
||||||
|
#include "MD3FileData.h"
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/ByteSwapper.h>
|
#include <assimp/ByteSwapper.h>
|
||||||
#include "MD3FileData.h"
|
|
||||||
#include <assimp/StringComparison.h>
|
#include <assimp/StringComparison.h>
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
|
|
||||||
|
@ -58,18 +57,15 @@ struct aiMaterial;
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
|
||||||
using namespace MD3;
|
using namespace MD3;
|
||||||
namespace Q3Shader {
|
namespace Q3Shader {
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Tiny utility data structure to hold the data of a .skin file
|
/** @brief Tiny utility data structure to hold the data of a .skin file
|
||||||
*/
|
*/
|
||||||
struct SkinData
|
struct SkinData {
|
||||||
{
|
|
||||||
//! A single entry in texture list
|
//! A single entry in texture list
|
||||||
struct TextureEntry : public std::pair<std::string,std::string>
|
struct TextureEntry : public std::pair<std::string, std::string> {
|
||||||
{
|
|
||||||
// did we resolve this texture entry?
|
// did we resolve this texture entry?
|
||||||
bool resolved;
|
bool resolved;
|
||||||
|
|
||||||
|
@ -88,8 +84,7 @@ struct SkinData
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Specifies cull modi for Quake shader files.
|
/** @brief Specifies cull modi for Quake shader files.
|
||||||
*/
|
*/
|
||||||
enum ShaderCullMode
|
enum ShaderCullMode {
|
||||||
{
|
|
||||||
CULL_NONE,
|
CULL_NONE,
|
||||||
CULL_CW,
|
CULL_CW,
|
||||||
CULL_CCW
|
CULL_CCW
|
||||||
|
@ -98,8 +93,7 @@ enum ShaderCullMode
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Specifies alpha blend modi (src + dest) for Quake shader files
|
/** @brief Specifies alpha blend modi (src + dest) for Quake shader files
|
||||||
*/
|
*/
|
||||||
enum BlendFunc
|
enum BlendFunc {
|
||||||
{
|
|
||||||
BLEND_NONE,
|
BLEND_NONE,
|
||||||
BLEND_GL_ONE,
|
BLEND_GL_ONE,
|
||||||
BLEND_GL_ZERO,
|
BLEND_GL_ZERO,
|
||||||
|
@ -112,8 +106,7 @@ enum BlendFunc
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Specifies alpha test modi for Quake texture maps
|
/** @brief Specifies alpha test modi for Quake texture maps
|
||||||
*/
|
*/
|
||||||
enum AlphaTestFunc
|
enum AlphaTestFunc {
|
||||||
{
|
|
||||||
AT_NONE,
|
AT_NONE,
|
||||||
AT_GT0,
|
AT_GT0,
|
||||||
AT_LT128,
|
AT_LT128,
|
||||||
|
@ -123,13 +116,11 @@ enum AlphaTestFunc
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Tiny utility data structure to hold a .shader map data block
|
/** @brief Tiny utility data structure to hold a .shader map data block
|
||||||
*/
|
*/
|
||||||
struct ShaderMapBlock
|
struct ShaderMapBlock {
|
||||||
{
|
|
||||||
ShaderMapBlock() AI_NO_EXCEPT
|
ShaderMapBlock() AI_NO_EXCEPT
|
||||||
: blend_src (BLEND_NONE)
|
: blend_src(BLEND_NONE),
|
||||||
, blend_dest (BLEND_NONE)
|
blend_dest(BLEND_NONE),
|
||||||
, alpha_test (AT_NONE)
|
alpha_test(AT_NONE) {}
|
||||||
{}
|
|
||||||
|
|
||||||
//! Name of referenced map
|
//! Name of referenced map
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -138,7 +129,6 @@ struct ShaderMapBlock
|
||||||
BlendFunc blend_src, blend_dest;
|
BlendFunc blend_src, blend_dest;
|
||||||
AlphaTestFunc alpha_test;
|
AlphaTestFunc alpha_test;
|
||||||
|
|
||||||
|
|
||||||
//! For std::find()
|
//! For std::find()
|
||||||
bool operator==(const std::string &o) const {
|
bool operator==(const std::string &o) const {
|
||||||
return !ASSIMP_stricmp(o, name);
|
return !ASSIMP_stricmp(o, name);
|
||||||
|
@ -148,11 +138,9 @@ struct ShaderMapBlock
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Tiny utility data structure to hold a .shader data block
|
/** @brief Tiny utility data structure to hold a .shader data block
|
||||||
*/
|
*/
|
||||||
struct ShaderDataBlock
|
struct ShaderDataBlock {
|
||||||
{
|
|
||||||
ShaderDataBlock() AI_NO_EXCEPT
|
ShaderDataBlock() AI_NO_EXCEPT
|
||||||
: cull (CULL_CW)
|
: cull(CULL_CW) {}
|
||||||
{}
|
|
||||||
|
|
||||||
//! Name of referenced data element
|
//! Name of referenced data element
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -163,7 +151,6 @@ struct ShaderDataBlock
|
||||||
//! Maps defined in the shader
|
//! Maps defined in the shader
|
||||||
std::list<ShaderMapBlock> maps;
|
std::list<ShaderMapBlock> maps;
|
||||||
|
|
||||||
|
|
||||||
//! For std::find()
|
//! For std::find()
|
||||||
bool operator==(const std::string &o) const {
|
bool operator==(const std::string &o) const {
|
||||||
return !ASSIMP_stricmp(o, name);
|
return !ASSIMP_stricmp(o, name);
|
||||||
|
@ -173,8 +160,7 @@ struct ShaderDataBlock
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Tiny utility data structure to hold the data of a .shader file
|
/** @brief Tiny utility data structure to hold the data of a .shader file
|
||||||
*/
|
*/
|
||||||
struct ShaderData
|
struct ShaderData {
|
||||||
{
|
|
||||||
//! Shader data blocks
|
//! Shader data blocks
|
||||||
std::list<ShaderDataBlock> blocks;
|
std::list<ShaderDataBlock> blocks;
|
||||||
};
|
};
|
||||||
|
@ -190,7 +176,6 @@ struct ShaderData
|
||||||
*/
|
*/
|
||||||
bool LoadShader(ShaderData &fill, const std::string &file, IOSystem *io);
|
bool LoadShader(ShaderData &fill, const std::string &file, IOSystem *io);
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Convert a Q3Shader to an aiMaterial
|
/** @brief Convert a Q3Shader to an aiMaterial
|
||||||
*
|
*
|
||||||
|
@ -210,48 +195,42 @@ void ConvertShaderToMaterial(aiMaterial* out, const ShaderDataBlock& shader);
|
||||||
*/
|
*/
|
||||||
bool LoadSkin(SkinData &fill, const std::string &file, IOSystem *io);
|
bool LoadSkin(SkinData &fill, const std::string &file, IOSystem *io);
|
||||||
|
|
||||||
} // ! namespace Q3SHader
|
} // namespace Q3Shader
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Importer class to load MD3 files
|
/** @brief Importer class to load MD3 files
|
||||||
*/
|
*/
|
||||||
class MD3Importer : public BaseImporter
|
class MD3Importer : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MD3Importer();
|
MD3Importer();
|
||||||
~MD3Importer();
|
~MD3Importer() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Validate offsets in the header
|
/** Validate offsets in the header
|
||||||
|
@ -287,7 +266,6 @@ protected:
|
||||||
std::string &out) const;
|
std::string &out) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Configuration option: frame to be loaded */
|
/** Configuration option: frame to be loaded */
|
||||||
unsigned int configFrameID;
|
unsigned int configFrameID;
|
||||||
|
|
||||||
|
|
|
@ -43,12 +43,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @brief Definition of the .MD5 importer class.
|
* @brief Definition of the .MD5 importer class.
|
||||||
* http://www.modwiki.net/wiki/MD5_(file_format)
|
* http://www.modwiki.net/wiki/MD5_(file_format)
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_MD5LOADER_H_INCLUDED
|
#ifndef AI_MD5LOADER_H_INCLUDED
|
||||||
#define AI_MD5LOADER_H_INCLUDED
|
#define AI_MD5LOADER_H_INCLUDED
|
||||||
|
|
||||||
#include "MD5Parser.h"
|
#include "MD5Parser.h"
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
@ -65,35 +65,35 @@ using namespace Assimp::MD5;
|
||||||
class MD5Importer : public BaseImporter {
|
class MD5Importer : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
MD5Importer();
|
MD5Importer();
|
||||||
~MD5Importer();
|
~MD5Importer() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer *pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem *pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Load a *.MD5MESH file.
|
/** Load a *.MD5MESH file.
|
||||||
|
|
|
@ -48,8 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
|
||||||
#include "MDCFileData.h"
|
#include "MDCFileData.h"
|
||||||
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/ByteSwapper.h>
|
#include <assimp/ByteSwapper.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -59,45 +59,37 @@ using namespace MDC;
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Importer class to load the RtCW MDC file format
|
/** Importer class to load the RtCW MDC file format
|
||||||
*/
|
*/
|
||||||
class MDCImporter : public BaseImporter
|
class MDCImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MDCImporter();
|
MDCImporter();
|
||||||
~MDCImporter();
|
~MDCImporter() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Validate the header of the file
|
/** Validate the header of the file
|
||||||
|
@ -110,8 +102,6 @@ protected:
|
||||||
void ValidateSurfaceHeader(BE_NCONST MDC::Surface *pcSurf);
|
void ValidateSurfaceHeader(BE_NCONST MDC::Surface *pcSurf);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
/** Configuration option: frame to be loaded */
|
/** Configuration option: frame to be loaded */
|
||||||
unsigned int configFrameID;
|
unsigned int configFrameID;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file MDLLoader.h
|
/** @file MDLLoader.h
|
||||||
* @brief Declaration of the loader for MDL files
|
* @brief Declaration of the loader for MDL files
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_MDLLOADER_H_INCLUDED
|
#ifndef AI_MDLLOADER_H_INCLUDED
|
||||||
#define AI_MDLLOADER_H_INCLUDED
|
#define AI_MDLLOADER_H_INCLUDED
|
||||||
|
|
||||||
|
@ -87,34 +87,34 @@ class MDLImporter : public BaseImporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MDLImporter();
|
MDLImporter();
|
||||||
~MDLImporter();
|
~MDLImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Import a quake 1 MDL file (IDPO)
|
/** Import a quake 1 MDL file (IDPO)
|
||||||
|
|
|
@ -43,10 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_MDL_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_MDL_IMPORTER
|
||||||
|
|
||||||
// internal headers
|
|
||||||
#include "MDLDefaultColorMap.h"
|
#include "MDLDefaultColorMap.h"
|
||||||
#include "MDLLoader.h"
|
#include "MDLLoader.h"
|
||||||
#include <assimp/Defines.h>
|
|
||||||
#include <assimp/StringUtils.h>
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/qnan.h>
|
#include <assimp/qnan.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
|
@ -68,10 +68,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! \brief Appends the supported extension.
|
//! \brief Appends the supported extension.
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo() const override;
|
||||||
|
|
||||||
//! \brief File import implementation.
|
//! \brief File import implementation.
|
||||||
void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
|
void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
//! \brief Create the data from imported content.
|
//! \brief Create the data from imported content.
|
||||||
void CreateDataFromImport(const pmx::PmxModel* pModel, aiScene* pScene);
|
void CreateDataFromImport(const pmx::PmxModel* pModel, aiScene* pScene);
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file MS3DLoader.h
|
/** @file MS3DLoader.h
|
||||||
* @brief Declaration of the MS3D importer class.
|
* @brief Declaration of the MS3D importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_MS3DLOADER_H_INCLUDED
|
#ifndef AI_MS3DLOADER_H_INCLUDED
|
||||||
#define AI_MS3DLOADER_H_INCLUDED
|
#define AI_MS3DLOADER_H_INCLUDED
|
||||||
|
|
||||||
|
@ -55,60 +55,48 @@ namespace Assimp {
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
/** Milkshape 3D importer implementation */
|
/** Milkshape 3D importer implementation */
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
class MS3DImporter
|
class MS3DImporter : public BaseImporter {
|
||||||
: public BaseImporter
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MS3DImporter();
|
MS3DImporter();
|
||||||
~MS3DImporter();
|
~MS3DImporter() override;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details */
|
* See #BaseImporter::GetInfo for the details */
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details */
|
* See BaseImporter::InternReadFile() for details */
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct TempJoint;
|
struct TempJoint;
|
||||||
void CollectChildJoints(const std::vector<TempJoint> &joints, std::vector<bool> &hadit, aiNode *nd, const aiMatrix4x4 &absTrafo);
|
void CollectChildJoints(const std::vector<TempJoint> &joints, std::vector<bool> &hadit, aiNode *nd, const aiMatrix4x4 &absTrafo);
|
||||||
void CollectChildJoints(const std::vector<TempJoint> &joints, aiNode *nd);
|
void CollectChildJoints(const std::vector<TempJoint> &joints, aiNode *nd);
|
||||||
|
|
||||||
template<typename T> void ReadComments(StreamReaderLE& stream, std::vector<T>& outp);
|
template <typename T>
|
||||||
private:
|
void ReadComments(StreamReaderLE &stream, std::vector<T> &outp);
|
||||||
|
|
||||||
|
private:
|
||||||
aiScene *mScene;
|
aiScene *mScene;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct TempVertex {
|
||||||
struct TempVertex
|
|
||||||
{
|
|
||||||
aiVector3D pos;
|
aiVector3D pos;
|
||||||
unsigned int bone_id[4], ref_cnt;
|
unsigned int bone_id[4], ref_cnt;
|
||||||
float weights[4];
|
float weights[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TempTriangle
|
struct TempTriangle {
|
||||||
{
|
|
||||||
unsigned int indices[3];
|
unsigned int indices[3];
|
||||||
aiVector3D normals[3];
|
aiVector3D normals[3];
|
||||||
aiVector2D uv[3];
|
aiVector2D uv[3];
|
||||||
|
@ -116,16 +104,14 @@ private:
|
||||||
unsigned int sg, group;
|
unsigned int sg, group;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TempGroup
|
struct TempGroup {
|
||||||
{
|
|
||||||
char name[33]; // +0
|
char name[33]; // +0
|
||||||
std::vector<unsigned int> triangles;
|
std::vector<unsigned int> triangles;
|
||||||
unsigned int mat; // 0xff is no material
|
unsigned int mat; // 0xff is no material
|
||||||
std::string comment;
|
std::string comment;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TempMaterial
|
struct TempMaterial {
|
||||||
{
|
|
||||||
// again, add an extra 0 character to all strings -
|
// again, add an extra 0 character to all strings -
|
||||||
char name[33];
|
char name[33];
|
||||||
char texture[129];
|
char texture[129];
|
||||||
|
@ -136,14 +122,12 @@ private:
|
||||||
std::string comment;
|
std::string comment;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TempKeyFrame
|
struct TempKeyFrame {
|
||||||
{
|
|
||||||
float time;
|
float time;
|
||||||
aiVector3D value;
|
aiVector3D value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TempJoint
|
struct TempJoint {
|
||||||
{
|
|
||||||
char name[33];
|
char name[33];
|
||||||
char parentName[33];
|
char parentName[33];
|
||||||
aiVector3D rotation, position;
|
aiVector3D rotation, position;
|
||||||
|
@ -158,5 +142,5 @@ private:
|
||||||
//};
|
//};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace Assimp
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,13 +44,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_NDO_LOADER_H
|
#ifndef INCLUDED_AI_NDO_LOADER_H
|
||||||
#define INCLUDED_AI_NDO_LOADER_H
|
#define INCLUDED_AI_NDO_LOADER_H
|
||||||
|
|
||||||
#include <assimp/vector3.h>
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
#include <stdint.h>
|
#include <assimp/vector3.h>
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
struct aiImporterDesc;
|
struct aiImporterDesc;
|
||||||
struct aiScene;
|
struct aiScene;
|
||||||
|
|
||||||
|
@ -64,38 +63,30 @@ namespace Assimp {
|
||||||
* Basing on
|
* Basing on
|
||||||
* <blender>/blender/release/scripts/nendo_import.py by Anthony D'Agostino.
|
* <blender>/blender/release/scripts/nendo_import.py by Anthony D'Agostino.
|
||||||
*/
|
*/
|
||||||
class NDOImporter : public BaseImporter
|
class NDOImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
NDOImporter();
|
NDOImporter();
|
||||||
~NDOImporter();
|
~NDOImporter() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! Represents a single edge
|
//! Represents a single edge
|
||||||
struct Edge
|
struct Edge {
|
||||||
{
|
|
||||||
unsigned int edge[8];
|
unsigned int edge[8];
|
||||||
unsigned int hard;
|
unsigned int hard;
|
||||||
uint8_t color[8];
|
uint8_t color[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Represents a single face
|
//! Represents a single face
|
||||||
struct Face
|
struct Face {
|
||||||
{
|
|
||||||
unsigned int elem;
|
unsigned int elem;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Vertex
|
struct Vertex {
|
||||||
{
|
|
||||||
unsigned int num;
|
unsigned int num;
|
||||||
aiVector3D val;
|
aiVector3D val;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Represents a single object
|
//! Represents a single object
|
||||||
struct Object
|
struct Object {
|
||||||
{
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
std::vector<Edge> edges;
|
std::vector<Edge> edges;
|
||||||
|
@ -105,22 +96,21 @@ public:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
const aiImporterDesc* GetInfo () const;
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
void SetupProperties(const Importer* pImp);
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
}; // end of class NDOImporter
|
}; // end of class NDOImporter
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
#endif // INCLUDED_AI_NDO_LOADER_H
|
#endif // INCLUDED_AI_NDO_LOADER_H
|
||||||
|
|
|
@ -43,15 +43,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file NFFLoader.h
|
/** @file NFFLoader.h
|
||||||
* @brief Declaration of the NFF importer class.
|
* @brief Declaration of the NFF importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_NFFLOADER_H_INCLUDED
|
#ifndef AI_NFFLOADER_H_INCLUDED
|
||||||
#define AI_NFFLOADER_H_INCLUDED
|
#define AI_NFFLOADER_H_INCLUDED
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/types.h>
|
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
#include <assimp/types.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ -61,67 +61,56 @@ namespace Assimp {
|
||||||
* Both are quite different and the loading code is somewhat dirty at
|
* Both are quite different and the loading code is somewhat dirty at
|
||||||
* the moment. Sense8 should be moved to a separate loader.
|
* the moment. Sense8 should be moved to a separate loader.
|
||||||
*/
|
*/
|
||||||
class NFFImporter : public BaseImporter
|
class NFFImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
NFFImporter();
|
NFFImporter();
|
||||||
~NFFImporter();
|
~NFFImporter() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
// describes face material properties
|
// describes face material properties
|
||||||
struct ShadingInfo
|
struct ShadingInfo {
|
||||||
{
|
ShadingInfo() :
|
||||||
ShadingInfo()
|
color(0.6f, 0.6f, 0.6f),
|
||||||
: color (0.6f,0.6f,0.6f)
|
diffuse(1.f, 1.f, 1.f),
|
||||||
, diffuse (1.f,1.f,1.f)
|
specular(1.f, 1.f, 1.f),
|
||||||
, specular (1.f,1.f,1.f)
|
ambient(0.f, 0.f, 0.f),
|
||||||
, ambient (0.f,0.f,0.f)
|
emissive(0.f, 0.f, 0.f),
|
||||||
, emissive (0.f,0.f,0.f)
|
refracti(1.f),
|
||||||
, refracti (1.f)
|
twoSided(false), // for NFF2
|
||||||
, twoSided (false) // for NFF2
|
shaded(true), // for NFF2
|
||||||
, shaded (true) // for NFF2
|
opacity(1.f),
|
||||||
, opacity (1.f)
|
shininess(0.f),
|
||||||
, shininess (0.f)
|
mapping(aiTextureMapping_UV) {
|
||||||
, mapping (aiTextureMapping_UV)
|
// empty
|
||||||
{}
|
}
|
||||||
|
|
||||||
aiColor3D color, diffuse, specular, ambient, emissive;
|
aiColor3D color, diffuse, specular, ambient, emissive;
|
||||||
ai_real refracti;
|
ai_real refracti;
|
||||||
|
|
||||||
std::string texFile;
|
std::string texFile;
|
||||||
|
bool twoSided; // For NFF2
|
||||||
// For NFF2
|
|
||||||
bool twoSided;
|
|
||||||
bool shaded;
|
bool shaded;
|
||||||
ai_real opacity, shininess;
|
ai_real opacity, shininess;
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
// texture mapping to be generated for the mesh - uv is the default
|
// texture mapping to be generated for the mesh - uv is the default
|
||||||
|
@ -130,8 +119,7 @@ private:
|
||||||
aiTextureMapping mapping;
|
aiTextureMapping mapping;
|
||||||
|
|
||||||
// shininess is ignored for the moment
|
// shininess is ignored for the moment
|
||||||
bool operator == (const ShadingInfo& other) const
|
bool operator == (const ShadingInfo &other) const {
|
||||||
{
|
|
||||||
return color == other.color &&
|
return color == other.color &&
|
||||||
diffuse == other.diffuse &&
|
diffuse == other.diffuse &&
|
||||||
specular == other.specular &&
|
specular == other.specular &&
|
||||||
|
@ -147,35 +135,25 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
// describes a NFF light source
|
// describes a NFF light source
|
||||||
struct Light
|
struct Light {
|
||||||
{
|
Light() :
|
||||||
Light()
|
intensity(1.f), color(1.f, 1.f, 1.f) {}
|
||||||
: intensity (1.f)
|
|
||||||
, color (1.f,1.f,1.f)
|
|
||||||
{}
|
|
||||||
|
|
||||||
aiVector3D position;
|
aiVector3D position;
|
||||||
ai_real intensity;
|
ai_real intensity;
|
||||||
aiColor3D color;
|
aiColor3D color;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PatchType
|
enum PatchType {
|
||||||
{
|
|
||||||
PatchType_Simple = 0x0,
|
PatchType_Simple = 0x0,
|
||||||
PatchType_Normals = 0x1,
|
PatchType_Normals = 0x1,
|
||||||
PatchType_UVAndNormals = 0x2
|
PatchType_UVAndNormals = 0x2
|
||||||
};
|
};
|
||||||
|
|
||||||
// describes a NFF mesh
|
// describes a NFF mesh
|
||||||
struct MeshInfo
|
struct MeshInfo {
|
||||||
{
|
MeshInfo(PatchType _pType, bool bL = false) :
|
||||||
MeshInfo(PatchType _pType, bool bL = false)
|
pType(_pType), bLocked(bL), radius(1.f, 1.f, 1.f), dir(0.f, 1.f, 0.f), matIndex(0) {
|
||||||
: pType (_pType)
|
|
||||||
, bLocked (bL)
|
|
||||||
, radius (1.f,1.f,1.f)
|
|
||||||
, dir (0.f,1.f,0.f)
|
|
||||||
, matIndex (0)
|
|
||||||
{
|
|
||||||
name[0] = '\0'; // by default meshes are unnamed
|
name[0] = '\0'; // by default meshes are unnamed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +174,6 @@ private:
|
||||||
unsigned int matIndex;
|
unsigned int matIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Loads the material table for the NFF2 file format from an
|
/** Loads the material table for the NFF2 file format from an
|
||||||
* external file.
|
* external file.
|
||||||
|
@ -207,7 +184,6 @@ private:
|
||||||
*/
|
*/
|
||||||
void LoadNFF2MaterialTable(std::vector<ShadingInfo> &output,
|
void LoadNFF2MaterialTable(std::vector<ShadingInfo> &output,
|
||||||
const std::string &path, IOSystem *pIOHandler);
|
const std::string &path, IOSystem *pIOHandler);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file OFFLoader.h
|
/** @file OFFLoader.h
|
||||||
* @brief Declaration of the OFF importer class.
|
* @brief Declaration of the OFF importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_OFFLOADER_H_INCLUDED
|
#ifndef AI_OFFLOADER_H_INCLUDED
|
||||||
#define AI_OFFLOADER_H_INCLUDED
|
#define AI_OFFLOADER_H_INCLUDED
|
||||||
|
|
||||||
|
@ -55,38 +55,30 @@ namespace Assimp {
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Importer class for the Object File Format (.off)
|
/** Importer class for the Object File Format (.off)
|
||||||
*/
|
*/
|
||||||
class OFFImporter : public BaseImporter
|
class OFFImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
OFFImporter();
|
OFFImporter();
|
||||||
~OFFImporter();
|
~OFFImporter() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct Material;
|
||||||
//! \brief Data structure for a simple obj-face, describes discredit,l.ation and materials
|
//! \brief Data structure for a simple obj-face, describes discredit,l.ation and materials
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
struct Face {
|
struct Face {
|
||||||
typedef std::vector<unsigned int> IndexArray;
|
using IndexArray = std::vector<unsigned int>;
|
||||||
|
|
||||||
//! Primitive type
|
//! Primitive type
|
||||||
aiPrimitiveType m_PrimitiveType;
|
aiPrimitiveType m_PrimitiveType;
|
||||||
|
@ -122,7 +122,6 @@ struct Object {
|
||||||
struct Material {
|
struct Material {
|
||||||
//! Name of material description
|
//! Name of material description
|
||||||
aiString MaterialName;
|
aiString MaterialName;
|
||||||
|
|
||||||
//! Texture names
|
//! Texture names
|
||||||
aiString texture;
|
aiString texture;
|
||||||
aiString textureSpecular;
|
aiString textureSpecular;
|
||||||
|
@ -237,9 +236,9 @@ struct Mesh {
|
||||||
//! \brief Data structure to store all obj-specific model datas
|
//! \brief Data structure to store all obj-specific model datas
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
struct Model {
|
struct Model {
|
||||||
typedef std::map<std::string, std::vector<unsigned int> *> GroupMap;
|
using GroupMap = std::map<std::string, std::vector<unsigned int> *>;
|
||||||
typedef std::map<std::string, std::vector<unsigned int> *>::iterator GroupMapIt;
|
using GroupMapIt = std::map<std::string, std::vector<unsigned int> *>::iterator;
|
||||||
typedef std::map<std::string, std::vector<unsigned int> *>::const_iterator ConstGroupMapIt;
|
using ConstGroupMapIt = std::map<std::string, std::vector<unsigned int> *>::const_iterator;
|
||||||
|
|
||||||
//! Model name
|
//! Model name
|
||||||
std::string m_ModelName;
|
std::string m_ModelName;
|
||||||
|
@ -278,12 +277,12 @@ struct Model {
|
||||||
|
|
||||||
//! \brief The default class constructor
|
//! \brief The default class constructor
|
||||||
Model() :
|
Model() :
|
||||||
m_ModelName(""),
|
m_ModelName(),
|
||||||
m_pCurrent(nullptr),
|
m_pCurrent(nullptr),
|
||||||
m_pCurrentMaterial(nullptr),
|
m_pCurrentMaterial(nullptr),
|
||||||
m_pDefaultMaterial(nullptr),
|
m_pDefaultMaterial(nullptr),
|
||||||
m_pGroupFaceIDs(nullptr),
|
m_pGroupFaceIDs(nullptr),
|
||||||
m_strActiveGroup(""),
|
m_strActiveGroup(),
|
||||||
m_TextureCoordDim(0),
|
m_TextureCoordDim(0),
|
||||||
m_pCurrentMesh(nullptr) {
|
m_pCurrentMesh(nullptr) {
|
||||||
// empty
|
// empty
|
||||||
|
@ -291,27 +290,17 @@ struct Model {
|
||||||
|
|
||||||
//! \brief The class destructor
|
//! \brief The class destructor
|
||||||
~Model() {
|
~Model() {
|
||||||
// Clear all stored object instances
|
for (auto & it : m_Objects) {
|
||||||
for (std::vector<Object *>::iterator it = m_Objects.begin();
|
delete it;
|
||||||
it != m_Objects.end(); ++it) {
|
|
||||||
delete *it;
|
|
||||||
}
|
}
|
||||||
m_Objects.clear();
|
for (auto & Meshe : m_Meshes) {
|
||||||
|
delete Meshe;
|
||||||
// Clear all stored mesh instances
|
|
||||||
for (std::vector<Mesh *>::iterator it = m_Meshes.begin();
|
|
||||||
it != m_Meshes.end(); ++it) {
|
|
||||||
delete *it;
|
|
||||||
}
|
}
|
||||||
m_Meshes.clear();
|
for (auto & Group : m_Groups) {
|
||||||
|
delete Group.second;
|
||||||
for (GroupMapIt it = m_Groups.begin(); it != m_Groups.end(); ++it) {
|
|
||||||
delete it->second;
|
|
||||||
}
|
}
|
||||||
m_Groups.clear();
|
for (auto & it : m_MaterialMap) {
|
||||||
|
delete it.second;
|
||||||
for (std::map<std::string, Material *>::iterator it = m_MaterialMap.begin(); it != m_MaterialMap.end(); ++it) {
|
|
||||||
delete it->second;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,6 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef OBJ_FILE_IMPORTER_H_INC
|
#ifndef OBJ_FILE_IMPORTER_H_INC
|
||||||
#define OBJ_FILE_IMPORTER_H_INC
|
#define OBJ_FILE_IMPORTER_H_INC
|
||||||
|
|
||||||
|
@ -65,19 +66,18 @@ public:
|
||||||
ObjFileImporter();
|
ObjFileImporter();
|
||||||
|
|
||||||
/// \brief Destructor
|
/// \brief Destructor
|
||||||
~ObjFileImporter();
|
~ObjFileImporter() override;
|
||||||
|
|
||||||
public:
|
|
||||||
/// \brief Returns whether the class can handle the format of the given file.
|
/// \brief Returns whether the class can handle the format of the given file.
|
||||||
/// \remark See BaseImporter::CanRead() for details.
|
/// \remark See BaseImporter::CanRead() for details.
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const;
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
//! \brief Appends the supported extension.
|
//! \brief Appends the supported extension.
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
//! \brief File import implementation.
|
//! \brief File import implementation.
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
|
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
//! \brief Create the data from imported content.
|
//! \brief Create the data from imported content.
|
||||||
void CreateDataFromImport(const ObjFile::Model *pModel, aiScene *pScene);
|
void CreateDataFromImport(const ObjFile::Model *pModel, aiScene *pScene);
|
||||||
|
|
|
@ -61,9 +61,9 @@ struct Material;
|
||||||
class ObjFileMtlImporter {
|
class ObjFileMtlImporter {
|
||||||
public:
|
public:
|
||||||
static const size_t BUFFERSIZE = 2048;
|
static const size_t BUFFERSIZE = 2048;
|
||||||
typedef std::vector<char> DataArray;
|
using DataArray = std::vector<char>;
|
||||||
typedef std::vector<char>::iterator DataArrayIt;
|
using DataArrayIt = std::vector<char>::iterator;
|
||||||
typedef std::vector<char>::const_iterator ConstDataArrayIt;
|
using ConstDataArrayIt = std::vector<char>::const_iterator;
|
||||||
|
|
||||||
//! \brief The class default constructor
|
//! \brief The class default constructor
|
||||||
ObjFileMtlImporter(std::vector<char> &buffer, const std::string &strAbsPath,
|
ObjFileMtlImporter(std::vector<char> &buffer, const std::string &strAbsPath,
|
||||||
|
|
|
@ -73,7 +73,6 @@ public:
|
||||||
typedef std::vector<char>::iterator DataArrayIt;
|
typedef std::vector<char>::iterator DataArrayIt;
|
||||||
typedef std::vector<char>::const_iterator ConstDataArrayIt;
|
typedef std::vector<char>::const_iterator ConstDataArrayIt;
|
||||||
|
|
||||||
public:
|
|
||||||
/// @brief The default constructor.
|
/// @brief The default constructor.
|
||||||
ObjFileParser();
|
ObjFileParser();
|
||||||
/// @brief Constructor with data array.
|
/// @brief Constructor with data array.
|
||||||
|
|
|
@ -81,11 +81,11 @@ bool OgreImporter::CanRead(const std::string &pFile, Assimp::IOSystem *pIOHandle
|
||||||
if (EndsWith(pFile, ".mesh.xml", false)) {
|
if (EndsWith(pFile, ".mesh.xml", false)) {
|
||||||
const char *tokens[] = { "<mesh>" };
|
const char *tokens[] = { "<mesh>" };
|
||||||
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
|
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
/// @todo Read and validate first header chunk?
|
/// @todo Read and validate first header chunk?
|
||||||
return EndsWith(pFile, ".mesh", false);
|
return EndsWith(pFile, ".mesh", false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Assimp::IOSystem *pIOHandler) {
|
void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Assimp::IOSystem *pIOHandler) {
|
||||||
// Open source file
|
// Open source file
|
||||||
|
@ -110,9 +110,9 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
||||||
|
|
||||||
// Convert to Assimp
|
// Convert to Assimp
|
||||||
mesh->ConvertToAssimpScene(pScene);
|
mesh->ConvertToAssimpScene(pScene);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// XML .mesh.xml import
|
// XML .mesh.xml import
|
||||||
else {
|
|
||||||
/// @note XmlReader does not take ownership of f, hence the scoped ptr.
|
/// @note XmlReader does not take ownership of f, hence the scoped ptr.
|
||||||
std::unique_ptr<IOStream> scopedFile(f);
|
std::unique_ptr<IOStream> scopedFile(f);
|
||||||
XmlParser xmlParser;
|
XmlParser xmlParser;
|
||||||
|
@ -132,7 +132,6 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
||||||
// Convert to Assimp
|
// Convert to Assimp
|
||||||
mesh->ConvertToAssimpScene(pScene);
|
mesh->ConvertToAssimpScene(pScene);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Ogre
|
} // namespace Ogre
|
||||||
} // namespace Assimp
|
} // namespace Assimp
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -39,42 +38,39 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_OGREIMPORTER_H_INC
|
#ifndef AI_OGREIMPORTER_H_INC
|
||||||
#define AI_OGREIMPORTER_H_INC
|
#define AI_OGREIMPORTER_H_INC
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
#include "OgreStructs.h"
|
|
||||||
#include "OgreParsingUtils.h"
|
|
||||||
|
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
|
||||||
namespace Assimp
|
#include "OgreParsingUtils.h"
|
||||||
{
|
#include "OgreStructs.h"
|
||||||
namespace Ogre
|
|
||||||
{
|
namespace Assimp {
|
||||||
|
namespace Ogre {
|
||||||
|
|
||||||
/** Importer for Ogre mesh, skeleton and material formats.
|
/** Importer for Ogre mesh, skeleton and material formats.
|
||||||
@todo Support vertex colors.
|
@todo Support vertex colors.
|
||||||
@todo Support poses/animations from the mesh file.
|
@todo Support poses/animations from the mesh file.
|
||||||
Currently only skeleton file animations are supported. */
|
Currently only skeleton file animations are supported. */
|
||||||
class OgreImporter : public BaseImporter
|
class OgreImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
/// BaseImporter override.
|
/// BaseImporter override.
|
||||||
virtual bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const;
|
virtual bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/// BaseImporter override.
|
||||||
|
virtual void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
/// BaseImporter override.
|
/// BaseImporter override.
|
||||||
virtual void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
|
virtual const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
/// BaseImporter override.
|
/// BaseImporter override.
|
||||||
virtual const aiImporterDesc *GetInfo() const;
|
virtual void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
/// BaseImporter override.
|
|
||||||
virtual void SetupProperties(const Importer *pImp);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Read materials referenced by the @c mesh to @c pScene.
|
/// Read materials referenced by the @c mesh to @c pScene.
|
||||||
|
@ -90,13 +86,13 @@ private:
|
||||||
bool ReadPass(const std::string &passName, std::stringstream &ss, aiMaterial *material);
|
bool ReadPass(const std::string &passName, std::stringstream &ss, aiMaterial *material);
|
||||||
bool ReadTextureUnit(const std::string &textureUnitName, std::stringstream &ss, aiMaterial *material);
|
bool ReadTextureUnit(const std::string &textureUnitName, std::stringstream &ss, aiMaterial *material);
|
||||||
|
|
||||||
|
private:
|
||||||
std::string m_userDefinedMaterialLibFile;
|
std::string m_userDefinedMaterialLibFile;
|
||||||
bool m_detectTextureTypeFromFilename;
|
bool m_detectTextureTypeFromFilename;
|
||||||
|
|
||||||
std::map<aiTextureType, unsigned int> m_textures;
|
std::map<aiTextureType, unsigned int> m_textures;
|
||||||
};
|
};
|
||||||
} // Ogre
|
} // namespace Ogre
|
||||||
} // Assimp
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // ASSIMP_BUILD_NO_OGRE_IMPORTER
|
#endif // ASSIMP_BUILD_NO_OGRE_IMPORTER
|
||||||
#endif // AI_OGREIMPORTER_H_INC
|
#endif // AI_OGREIMPORTER_H_INC
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -39,6 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_OPENGEX_EXPORTER_H
|
#ifndef AI_OPENGEX_EXPORTER_H
|
||||||
#define AI_OPENGEX_EXPORTER_H
|
#define AI_OPENGEX_EXPORTER_H
|
||||||
|
|
||||||
|
|
|
@ -47,14 +47,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/StringComparison.h>
|
#include <assimp/StringComparison.h>
|
||||||
#include <assimp/StringUtils.h>
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
||||||
#include <assimp/ai_assert.h>
|
#include <assimp/ai_assert.h>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <openddlparser/OpenDDLParser.h>
|
#include <openddlparser/OpenDDLParser.h>
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static const aiImporterDesc desc = {
|
||||||
"Open Game Engine Exchange",
|
"Open Game Engine Exchange",
|
||||||
"",
|
"",
|
||||||
|
|
|
@ -39,6 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_OPENGEX_IMPORTER_H
|
#ifndef AI_OPENGEX_IMPORTER_H
|
||||||
#define AI_OPENGEX_IMPORTER_H
|
#define AI_OPENGEX_IMPORTER_H
|
||||||
|
|
||||||
|
@ -96,21 +97,21 @@ public:
|
||||||
OpenGEXImporter();
|
OpenGEXImporter();
|
||||||
|
|
||||||
/// The class destructor.
|
/// The class destructor.
|
||||||
virtual ~OpenGEXImporter();
|
~OpenGEXImporter() override;
|
||||||
|
|
||||||
/// BaseImporter override.
|
/// BaseImporter override.
|
||||||
virtual bool CanRead( const std::string &file, IOSystem *pIOHandler, bool checkSig ) const;
|
bool CanRead( const std::string &file, IOSystem *pIOHandler, bool checkSig ) const override;
|
||||||
|
|
||||||
/// BaseImporter override.
|
|
||||||
virtual void InternReadFile( const std::string &file, aiScene *pScene, IOSystem *pIOHandler );
|
|
||||||
|
|
||||||
/// BaseImporter override.
|
|
||||||
virtual const aiImporterDesc *GetInfo() const;
|
|
||||||
|
|
||||||
/// BaseImporter override.
|
|
||||||
virtual void SetupProperties( const Importer *pImp );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/// BaseImporter override.
|
||||||
|
void InternReadFile( const std::string &file, aiScene *pScene, IOSystem *pIOHandler ) override;
|
||||||
|
|
||||||
|
/// BaseImporter override.
|
||||||
|
virtual const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
|
/// BaseImporter override.
|
||||||
|
virtual void SetupProperties( const Importer *pImp ) override;
|
||||||
|
|
||||||
void handleNodes( ODDLParser::DDLNode *node, aiScene *pScene );
|
void handleNodes( ODDLParser::DDLNode *node, aiScene *pScene );
|
||||||
void handleMetricNode( ODDLParser::DDLNode *node, aiScene *pScene );
|
void handleMetricNode( ODDLParser::DDLNode *node, aiScene *pScene );
|
||||||
void handleNameNode( ODDLParser::DDLNode *node, aiScene *pScene );
|
void handleNameNode( ODDLParser::DDLNode *node, aiScene *pScene );
|
||||||
|
@ -176,15 +177,15 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ChildInfo {
|
struct ChildInfo {
|
||||||
typedef std::list<aiNode*> NodeList;
|
using NodeList = std::list<aiNode*>;
|
||||||
std::list<aiNode*> m_children;
|
std::list<aiNode*> m_children;
|
||||||
};
|
};
|
||||||
ChildInfo *m_root;
|
ChildInfo *m_root;
|
||||||
typedef std::map<aiNode*, std::unique_ptr<ChildInfo> > NodeChildMap;
|
using NodeChildMap = std::map<aiNode*, std::unique_ptr<ChildInfo> >;
|
||||||
NodeChildMap m_nodeChildMap;
|
NodeChildMap m_nodeChildMap;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<aiMesh> > m_meshCache;
|
std::vector<std::unique_ptr<aiMesh> > m_meshCache;
|
||||||
typedef std::map<std::string, size_t> ReferenceMap;
|
using ReferenceMap = std::map<std::string, size_t>;
|
||||||
std::map<std::string, size_t> m_mesh2refMap;
|
std::map<std::string, size_t> m_mesh2refMap;
|
||||||
std::map<std::string, size_t> m_material2refMap;
|
std::map<std::string, size_t> m_material2refMap;
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file PLYLoader.h
|
/** @file PLYLoader.h
|
||||||
* @brief Declaration of the .ply importer class.
|
* @brief Declaration of the .ply importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_PLYLOADER_H_INCLUDED
|
#ifndef AI_PLYLOADER_H_INCLUDED
|
||||||
#define AI_PLYLOADER_H_INCLUDED
|
#define AI_PLYLOADER_H_INCLUDED
|
||||||
|
|
||||||
|
@ -64,14 +65,14 @@ using namespace PLY;
|
||||||
class PLYImporter : public BaseImporter {
|
class PLYImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
PLYImporter();
|
PLYImporter();
|
||||||
~PLYImporter();
|
~PLYImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Extract a vertex from the DOM
|
/** Extract a vertex from the DOM
|
||||||
|
@ -88,14 +89,14 @@ protected:
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem *pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Extract a material list from the DOM
|
/** Extract a material list from the DOM
|
||||||
|
|
|
@ -48,8 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/IOStreamBuffer.h>
|
#include <assimp/IOStreamBuffer.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
|
||||||
|
|
||||||
//pre-declaration
|
//pre-declaration
|
||||||
class PLYImporter;
|
class PLYImporter;
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -71,19 +70,19 @@ public:
|
||||||
Q3BSPFileImporter();
|
Q3BSPFileImporter();
|
||||||
|
|
||||||
/// @brief Destructor.
|
/// @brief Destructor.
|
||||||
~Q3BSPFileImporter();
|
~Q3BSPFileImporter() override;
|
||||||
|
|
||||||
/// @brief Returns whether the class can handle the format of the given file.
|
/// @brief Returns whether the class can handle the format of the given file.
|
||||||
/// @remark See BaseImporter::CanRead() for details.
|
/// @remark See BaseImporter::CanRead() for details.
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const;
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*> FaceMap;
|
using FaceMap = std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*>;
|
||||||
typedef std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>* >::iterator FaceMapIt;
|
using FaceMapIt = std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>* >::iterator;
|
||||||
typedef std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*>::const_iterator FaceMapConstIt;
|
using FaceMapConstIt = std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*>::const_iterator;
|
||||||
|
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
|
void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
|
||||||
void separateMapName( const std::string &rImportName, std::string &rArchiveName, std::string &rMapName );
|
void separateMapName( const std::string &rImportName, std::string &rArchiveName, std::string &rMapName );
|
||||||
bool findFirstMapInArchive(ZipArchiveIOSystem &rArchive, std::string &rMapName );
|
bool findFirstMapInArchive(ZipArchiveIOSystem &rArchive, std::string &rMapName );
|
||||||
void CreateDataFromImport( const Q3BSP::Q3BSPModel *pModel, aiScene* pScene, ZipArchiveIOSystem *pArchive );
|
void CreateDataFromImport( const Q3BSP::Q3BSPModel *pModel, aiScene* pScene, ZipArchiveIOSystem *pArchive );
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -57,9 +56,9 @@ namespace Q3BSP
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
/// @brief This class implements th Q3DSP file parsing.
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
class Q3BSPFileParser
|
class Q3BSPFileParser {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
Q3BSPFileParser( const std::string &rMapName, ZipArchiveIOSystem *pZipArchive );
|
Q3BSPFileParser( const std::string &rMapName, ZipArchiveIOSystem *pZipArchive );
|
||||||
~Q3BSPFileParser();
|
~Q3BSPFileParser();
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -36,80 +35,66 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @file Q3DLoader.h
|
/** @file Q3DLoader.h
|
||||||
* @brief Declaration of the Q3D importer class.
|
* @brief Declaration of the Q3D importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_Q3DLOADER_H_INCLUDED
|
#ifndef AI_Q3DLOADER_H_INCLUDED
|
||||||
#define AI_Q3DLOADER_H_INCLUDED
|
#define AI_Q3DLOADER_H_INCLUDED
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Importer class for the Quick3D Object and Scene formats.
|
/** Importer class for the Quick3D Object and Scene formats.
|
||||||
*/
|
*/
|
||||||
class Q3DImporter : public BaseImporter
|
class Q3DImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
Q3DImporter();
|
Q3DImporter();
|
||||||
~Q3DImporter();
|
~Q3DImporter() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct Material {
|
||||||
struct Material
|
Material() : diffuse(0.6f,0.6f,0.6f), transparency(0.f), texIdx(UINT_MAX) {
|
||||||
{
|
// empty
|
||||||
Material()
|
}
|
||||||
: diffuse (0.6f,0.6f,0.6f)
|
|
||||||
, transparency (0.f)
|
|
||||||
, texIdx (UINT_MAX)
|
|
||||||
{}
|
|
||||||
|
|
||||||
aiString name;
|
aiString name;
|
||||||
aiColor3D ambient, diffuse, specular;
|
aiColor3D ambient, diffuse, specular;
|
||||||
float transparency;
|
float transparency;
|
||||||
|
|
||||||
unsigned int texIdx;
|
unsigned int texIdx;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Face
|
struct Face {
|
||||||
{
|
explicit Face(unsigned int s) : indices(s), uvindices(s), mat(0) {
|
||||||
explicit Face(unsigned int s)
|
// empty
|
||||||
: indices (s)
|
|
||||||
, uvindices (s)
|
|
||||||
, mat (0)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<unsigned int> indices;
|
std::vector<unsigned int> indices;
|
||||||
|
@ -117,14 +102,11 @@ private:
|
||||||
unsigned int mat;
|
unsigned int mat;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Mesh
|
struct Mesh {
|
||||||
{
|
|
||||||
|
|
||||||
std::vector<aiVector3D> verts;
|
std::vector<aiVector3D> verts;
|
||||||
std::vector<aiVector3D> normals;
|
std::vector<aiVector3D> normals;
|
||||||
std::vector<aiVector3D> uv;
|
std::vector<aiVector3D> uv;
|
||||||
std::vector<Face> faces;
|
std::vector<Face> faces;
|
||||||
|
|
||||||
uint32_t prevUVIdx;
|
uint32_t prevUVIdx;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file RAWLoader.h
|
/** @file RAWLoader.h
|
||||||
* @brief Declaration of the RAW importer class.
|
* @brief Declaration of the RAW importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_RAWLOADER_H_INCLUDED
|
#ifndef AI_RAWLOADER_H_INCLUDED
|
||||||
#define AI_RAWLOADER_H_INCLUDED
|
#define AI_RAWLOADER_H_INCLUDED
|
||||||
|
|
||||||
|
@ -55,59 +55,46 @@ namespace Assimp {
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Importer class for the PovRay RAW triangle format
|
/** Importer class for the PovRay RAW triangle format
|
||||||
*/
|
*/
|
||||||
class RAWImporter : public BaseImporter
|
class RAWImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
RAWImporter();
|
RAWImporter();
|
||||||
~RAWImporter();
|
~RAWImporter();
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct MeshInformation {
|
||||||
struct MeshInformation
|
explicit MeshInformation(const std::string& _name) : name(_name) {
|
||||||
{
|
|
||||||
explicit MeshInformation(const std::string& _name)
|
|
||||||
: name(_name)
|
|
||||||
{
|
|
||||||
vertices.reserve(100);
|
vertices.reserve(100);
|
||||||
colors.reserve(100);
|
colors.reserve(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
std::vector<aiVector3D> vertices;
|
std::vector<aiVector3D> vertices;
|
||||||
std::vector<aiColor4D> colors;
|
std::vector<aiColor4D> colors;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GroupInformation
|
struct GroupInformation {
|
||||||
{
|
explicit GroupInformation(const std::string& _name) : name(_name) {
|
||||||
explicit GroupInformation(const std::string& _name)
|
|
||||||
: name(_name)
|
|
||||||
{
|
|
||||||
meshes.reserve(10);
|
meshes.reserve(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file SIBImporter.h
|
/** @file SIBImporter.h
|
||||||
* @brief Declaration of the SIB importer class.
|
* @brief Declaration of the SIB importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_SIBIMPORTER_H_INCLUDED
|
#ifndef AI_SIBIMPORTER_H_INCLUDED
|
||||||
#define AI_SIBIMPORTER_H_INCLUDED
|
#define AI_SIBIMPORTER_H_INCLUDED
|
||||||
|
|
||||||
|
@ -55,55 +55,46 @@ namespace Assimp {
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Importer class for the Nevercenter Silo SIB scene format
|
/** Importer class for the Nevercenter Silo SIB scene format
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API SIBImporter : public BaseImporter
|
class ASSIMP_API SIBImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
SIBImporter();
|
SIBImporter();
|
||||||
~SIBImporter();
|
~SIBImporter() override;
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct MeshInformation
|
struct MeshInformation {
|
||||||
{
|
explicit MeshInformation(const std::string& _name) : name(_name) {
|
||||||
explicit MeshInformation(const std::string& _name)
|
|
||||||
: name(_name)
|
|
||||||
{
|
|
||||||
vertices.reserve(100);
|
vertices.reserve(100);
|
||||||
colors.reserve(100);
|
colors.reserve(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
std::vector<aiVector3D> vertices;
|
std::vector<aiVector3D> vertices;
|
||||||
std::vector<aiColor4D> colors;
|
std::vector<aiColor4D> colors;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GroupInformation
|
struct GroupInformation {
|
||||||
{
|
explicit GroupInformation(const std::string& _name) : name(_name) {
|
||||||
explicit GroupInformation(const std::string& _name)
|
|
||||||
: name(_name)
|
|
||||||
{
|
|
||||||
meshes.reserve(10);
|
meshes.reserve(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -44,24 +43,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @brief Definition of the Valve SMD file format
|
* @brief Definition of the Valve SMD file format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
#ifndef AI_SMDLOADER_H_INCLUDED
|
#ifndef AI_SMDLOADER_H_INCLUDED
|
||||||
#define AI_SMDLOADER_H_INCLUDED
|
#define AI_SMDLOADER_H_INCLUDED
|
||||||
|
|
||||||
// internal headers
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
#include <assimp/ParsingUtils.h>
|
#include <assimp/ParsingUtils.h>
|
||||||
|
|
||||||
// public Assimp headers
|
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
#include <assimp/texture.h>
|
#include <assimp/texture.h>
|
||||||
#include <assimp/anim.h>
|
#include <assimp/anim.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
|
||||||
struct aiNode;
|
|
||||||
|
|
||||||
// STL headers
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
struct aiNode;
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace SMD {
|
namespace SMD {
|
||||||
|
|
||||||
|
@ -69,8 +65,7 @@ namespace SMD {
|
||||||
/** Data structure for a vertex in a SMD file
|
/** Data structure for a vertex in a SMD file
|
||||||
*/
|
*/
|
||||||
struct Vertex {
|
struct Vertex {
|
||||||
Vertex() AI_NO_EXCEPT
|
Vertex() AI_NO_EXCEPT : iParentNode(UINT_MAX) {
|
||||||
: iParentNode(UINT_MAX) {
|
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,9 +86,8 @@ struct Vertex {
|
||||||
/** Data structure for a face in a SMD file
|
/** Data structure for a face in a SMD file
|
||||||
*/
|
*/
|
||||||
struct Face {
|
struct Face {
|
||||||
Face() AI_NO_EXCEPT
|
Face() AI_NO_EXCEPT :
|
||||||
: iTexture(0x0)
|
iTexture(0x0), avVertices{} {
|
||||||
, avVertices{} {
|
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,17 +103,10 @@ struct Face {
|
||||||
*/
|
*/
|
||||||
struct Bone {
|
struct Bone {
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
Bone() AI_NO_EXCEPT
|
Bone() AI_NO_EXCEPT : iParent(UINT_MAX), bIsUsed(false) {
|
||||||
: iParent(UINT_MAX)
|
|
||||||
, bIsUsed(false) {
|
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Destructor
|
|
||||||
~Bone()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Name of the bone
|
//! Name of the bone
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
||||||
|
@ -129,14 +116,12 @@ struct Bone {
|
||||||
//! Animation of the bone
|
//! Animation of the bone
|
||||||
struct Animation {
|
struct Animation {
|
||||||
//! Public default constructor
|
//! Public default constructor
|
||||||
Animation() AI_NO_EXCEPT
|
Animation() AI_NO_EXCEPT : iFirstTimeKey() {
|
||||||
: iFirstTimeKey() {
|
|
||||||
asKeys.reserve(20);
|
asKeys.reserve(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Data structure for a matrix key
|
//! Data structure for a matrix key
|
||||||
struct MatrixKey
|
struct MatrixKey {
|
||||||
{
|
|
||||||
//! Matrix at this time
|
//! Matrix at this time
|
||||||
aiMatrix4x4 matrix;
|
aiMatrix4x4 matrix;
|
||||||
|
|
||||||
|
@ -174,46 +159,38 @@ struct Bone {
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Used to load Half-life 1 and 2 SMD models
|
/** Used to load Half-life 1 and 2 SMD models
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API SMDImporter : public BaseImporter
|
class ASSIMP_API SMDImporter : public BaseImporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
SMDImporter();
|
SMDImporter();
|
||||||
~SMDImporter();
|
~SMDImporter() override;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ReadFile().
|
/** Called prior to ReadFile().
|
||||||
* The function is a request to the importer to update its configuration
|
* The function is a request to the importer to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Parse the SMD file and create the output scene
|
/** Parse the SMD file and create the output scene
|
||||||
|
@ -405,7 +382,7 @@ private:
|
||||||
*/
|
*/
|
||||||
bool bHasUVs;
|
bool bHasUVs;
|
||||||
|
|
||||||
/** Current line numer
|
/** Current line number
|
||||||
*/
|
*/
|
||||||
unsigned int iLineNumber;
|
unsigned int iLineNumber;
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file STLExporter.h
|
/** @file STLExporter.h
|
||||||
* Declares the exporter class to write a scene to a Stereolithography (STL) file
|
* Declares the exporter class to write a scene to a Stereolithography (STL) file
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_STLEXPORTER_H_INC
|
#ifndef AI_STLEXPORTER_H_INC
|
||||||
#define AI_STLEXPORTER_H_INC
|
#define AI_STLEXPORTER_H_INC
|
||||||
|
|
||||||
|
@ -57,13 +58,12 @@ namespace Assimp {
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
/** Helper class to export a given scene to a STL file. */
|
/** Helper class to export a given scene to a STL file. */
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
class STLExporter
|
class STLExporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
/// Constructor for a specific scene to export
|
/// Constructor for a specific scene to export
|
||||||
STLExporter(const char *filename, const aiScene *pScene, bool exportPOintClouds, bool binary = false);
|
STLExporter(const char *filename, const aiScene *pScene, bool exportPOintClouds, bool binary = false);
|
||||||
|
|
||||||
/// public stringstreams to write all output into
|
/// public string-streams to write all output into
|
||||||
std::ostringstream mOutput;
|
std::ostringstream mOutput;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -72,13 +72,10 @@ private:
|
||||||
void WriteMeshBinary(const aiMesh *m);
|
void WriteMeshBinary(const aiMesh *m);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
const std::string filename;
|
const std::string filename;
|
||||||
|
|
||||||
// this endl() doesn't flush() the stream
|
|
||||||
const std::string endl;
|
const std::string endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,7 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_STL_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_STL_IMPORTER
|
||||||
|
|
||||||
// internal headers
|
|
||||||
#include "STLLoader.h"
|
#include "STLLoader.h"
|
||||||
#include <assimp/ParsingUtils.h>
|
#include <assimp/ParsingUtils.h>
|
||||||
#include <assimp/fast_atof.h>
|
#include <assimp/fast_atof.h>
|
||||||
|
@ -146,7 +145,9 @@ bool STLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool c
|
||||||
|
|
||||||
if (extension == "stl") {
|
if (extension == "stl") {
|
||||||
return true;
|
return true;
|
||||||
} else if (!extension.length() || checkSig) {
|
}
|
||||||
|
|
||||||
|
if (!extension.length() || checkSig) {
|
||||||
if (!pIOHandler) {
|
if (!pIOHandler) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,6 @@ struct aiNode;
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief Importer class for the sterolithography STL file format.
|
* @brief Importer class for the sterolithography STL file format.
|
||||||
|
@ -68,13 +67,13 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief The class destructor.
|
* @brief The class destructor.
|
||||||
*/
|
*/
|
||||||
~STLImporter();
|
~STLImporter() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns whether the class can handle the format of the given file.
|
* @brief Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -82,14 +81,14 @@ protected:
|
||||||
* @brief Return importer meta information.
|
* @brief Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Imports the given file into the given scene structure.
|
* @brief Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Loads a binary .stl file
|
* @brief Loads a binary .stl file
|
||||||
|
|
|
@ -69,11 +69,15 @@ static const aiImporterDesc desc = {
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
TerragenImporter::TerragenImporter() :
|
TerragenImporter::TerragenImporter() :
|
||||||
configComputeUVs(false) {}
|
configComputeUVs(false) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Destructor, private as well
|
// Destructor, private as well
|
||||||
TerragenImporter::~TerragenImporter() {}
|
TerragenImporter::~TerragenImporter() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the class can handle the format of the given file.
|
// Returns whether the class can handle the format of the given file.
|
||||||
|
|
|
@ -42,10 +42,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file TerragenLoader.h
|
/** @file TerragenLoader.h
|
||||||
* @brief Declaration of the .ter importer class.
|
* @brief Declaration of the .ter importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef INCLUDED_AI_TERRAGEN_TERRAIN_LOADER_H
|
#ifndef INCLUDED_AI_TERRAGEN_TERRAIN_LOADER_H
|
||||||
#define INCLUDED_AI_TERRAGEN_TERRAIN_LOADER_H
|
#define INCLUDED_AI_TERRAGEN_TERRAIN_LOADER_H
|
||||||
|
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
// Magic strings
|
// Magic strings
|
||||||
|
@ -71,23 +73,22 @@ namespace Assimp {
|
||||||
class TerragenImporter : public BaseImporter {
|
class TerragenImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
TerragenImporter();
|
TerragenImporter();
|
||||||
~TerragenImporter();
|
~TerragenImporter() override;
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem *pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void SetupProperties(const Importer *pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool configComputeUVs;
|
bool configComputeUVs;
|
||||||
|
|
|
@ -60,7 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
|
@ -50,7 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Importer class to load UNREAL files (*.3d)
|
/**
|
||||||
|
* @brief Importer class to load UNREAL files (*.3d)
|
||||||
*/
|
*/
|
||||||
class UnrealImporter : public BaseImporter {
|
class UnrealImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
|
@ -62,23 +63,22 @@ public:
|
||||||
*
|
*
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
**/
|
**/
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
|
||||||
bool checkSig) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief Called by Importer::GetExtensionList()
|
/** @brief Called by Importer::GetExtensionList()
|
||||||
*
|
*
|
||||||
* See #BaseImporter::GetInfo for the details
|
* @see #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief Setup properties for the importer
|
/** @brief Setup properties for the importer
|
||||||
*
|
*
|
||||||
* See BaseImporter::SetupProperties() for details
|
* See BaseImporter::SetupProperties() for details
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer *pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief Imports the given file into the given scene structure.
|
/** @brief Imports the given file into the given scene structure.
|
||||||
|
@ -86,7 +86,7 @@ protected:
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem *pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! frame to be loaded
|
//! frame to be loaded
|
||||||
|
|
|
@ -40,20 +40,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** @file Defines the helper data structures for importing XFiles */
|
/** @file Defines the helper data structures for importing XFiles */
|
||||||
#ifndef AI_XFILEHELPER_H_INC
|
#ifndef AI_XFILEHELPER_H_INC
|
||||||
#define AI_XFILEHELPER_H_INC
|
#define AI_XFILEHELPER_H_INC
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <assimp/types.h>
|
|
||||||
#include <assimp/quaternion.h>
|
|
||||||
#include <assimp/mesh.h>
|
|
||||||
#include <assimp/anim.h>
|
#include <assimp/anim.h>
|
||||||
#include <assimp/Defines.h>
|
#include <assimp/mesh.h>
|
||||||
|
#include <assimp/quaternion.h>
|
||||||
|
#include <assimp/types.h>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace XFile {
|
namespace XFile {
|
||||||
|
@ -68,14 +66,13 @@ struct TexEntry {
|
||||||
std::string mName;
|
std::string mName;
|
||||||
bool mIsNormalMap; // true if the texname was specified in a NormalmapFilename tag
|
bool mIsNormalMap; // true if the texname was specified in a NormalmapFilename tag
|
||||||
|
|
||||||
TexEntry() AI_NO_EXCEPT
|
TexEntry() AI_NO_EXCEPT :
|
||||||
: mName()
|
mName(),
|
||||||
, mIsNormalMap(false) {
|
mIsNormalMap(false) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
TexEntry(const std::string& pName, bool pIsNormalMap = false)
|
TexEntry(const std::string &pName, bool pIsNormalMap = false) :
|
||||||
: mName(pName)
|
mName(pName), mIsNormalMap(pIsNormalMap) {
|
||||||
, mIsNormalMap(pIsNormalMap) {
|
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -91,10 +88,10 @@ struct Material {
|
||||||
std::vector<TexEntry> mTextures;
|
std::vector<TexEntry> mTextures;
|
||||||
size_t sceneIndex; ///< the index under which it was stored in the scene's material list
|
size_t sceneIndex; ///< the index under which it was stored in the scene's material list
|
||||||
|
|
||||||
Material() AI_NO_EXCEPT
|
Material() AI_NO_EXCEPT :
|
||||||
: mIsReference(false)
|
mIsReference(false),
|
||||||
, mSpecularExponent()
|
mSpecularExponent(),
|
||||||
, sceneIndex(SIZE_MAX) {
|
sceneIndex(SIZE_MAX) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -106,8 +103,7 @@ struct BoneWeight {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Helper structure to represent a bone in a mesh */
|
/** Helper structure to represent a bone in a mesh */
|
||||||
struct Bone
|
struct Bone {
|
||||||
{
|
|
||||||
std::string mName;
|
std::string mName;
|
||||||
std::vector<BoneWeight> mWeights;
|
std::vector<BoneWeight> mWeights;
|
||||||
aiMatrix4x4 mOffsetMatrix;
|
aiMatrix4x4 mOffsetMatrix;
|
||||||
|
@ -131,18 +127,18 @@ struct Mesh {
|
||||||
std::vector<Bone> mBones;
|
std::vector<Bone> mBones;
|
||||||
|
|
||||||
explicit Mesh(const std::string &pName = std::string()) AI_NO_EXCEPT
|
explicit Mesh(const std::string &pName = std::string()) AI_NO_EXCEPT
|
||||||
: mName( pName )
|
: mName(pName),
|
||||||
, mPositions()
|
mPositions(),
|
||||||
, mPosFaces()
|
mPosFaces(),
|
||||||
, mNormals()
|
mNormals(),
|
||||||
, mNormFaces()
|
mNormFaces(),
|
||||||
, mNumTextures(0)
|
mNumTextures(0),
|
||||||
, mTexCoords{}
|
mTexCoords{},
|
||||||
, mNumColorSets(0)
|
mNumColorSets(0),
|
||||||
, mColors{}
|
mColors{},
|
||||||
, mFaceMaterials()
|
mFaceMaterials(),
|
||||||
, mMaterials()
|
mMaterials(),
|
||||||
, mBones() {
|
mBones() {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -156,19 +152,15 @@ struct Node {
|
||||||
std::vector<Mesh *> mMeshes;
|
std::vector<Mesh *> mMeshes;
|
||||||
|
|
||||||
Node() AI_NO_EXCEPT
|
Node() AI_NO_EXCEPT
|
||||||
: mName()
|
: mName(),
|
||||||
, mTrafoMatrix()
|
mTrafoMatrix(),
|
||||||
, mParent(nullptr)
|
mParent(nullptr),
|
||||||
, mChildren()
|
mChildren(),
|
||||||
, mMeshes() {
|
mMeshes() {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
explicit Node( Node* pParent)
|
explicit Node(Node *pParent) :
|
||||||
: mName()
|
mName(), mTrafoMatrix(), mParent(pParent), mChildren(), mMeshes() {
|
||||||
, mTrafoMatrix()
|
|
||||||
, mParent(pParent)
|
|
||||||
, mChildren()
|
|
||||||
, mMeshes() {
|
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,21 +189,18 @@ struct AnimBone {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Helper structure to represent an animation set in a XFile */
|
/** Helper structure to represent an animation set in a XFile */
|
||||||
struct Animation
|
struct Animation {
|
||||||
{
|
|
||||||
std::string mName;
|
std::string mName;
|
||||||
std::vector<AnimBone *> mAnims;
|
std::vector<AnimBone *> mAnims;
|
||||||
|
|
||||||
~Animation()
|
~Animation() {
|
||||||
{
|
|
||||||
for (unsigned int a = 0; a < mAnims.size(); a++)
|
for (unsigned int a = 0; a < mAnims.size(); a++)
|
||||||
delete mAnims[a];
|
delete mAnims[a];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Helper structure analogue to aiScene */
|
/** Helper structure analogue to aiScene */
|
||||||
struct Scene
|
struct Scene {
|
||||||
{
|
|
||||||
Node *mRootNode;
|
Node *mRootNode;
|
||||||
|
|
||||||
std::vector<Mesh *> mGlobalMeshes; // global meshes found outside of any frames
|
std::vector<Mesh *> mGlobalMeshes; // global meshes found outside of any frames
|
||||||
|
@ -221,10 +210,10 @@ struct Scene
|
||||||
unsigned int mAnimTicksPerSecond;
|
unsigned int mAnimTicksPerSecond;
|
||||||
|
|
||||||
Scene() AI_NO_EXCEPT
|
Scene() AI_NO_EXCEPT
|
||||||
: mRootNode(nullptr)
|
: mRootNode(nullptr),
|
||||||
, mGlobalMeshes()
|
mGlobalMeshes(),
|
||||||
, mGlobalMaterials()
|
mGlobalMaterials(),
|
||||||
, mAnimTicksPerSecond(0) {
|
mAnimTicksPerSecond(0) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
~Scene() {
|
~Scene() {
|
||||||
|
|
|
@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "PostProcessing/ConvertToLHProcess.h"
|
#include "PostProcessing/ConvertToLHProcess.h"
|
||||||
|
|
||||||
#include <assimp/TinyFormatter.h>
|
#include <assimp/TinyFormatter.h>
|
||||||
#include <assimp/Defines.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>
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/** @file XFileImporter.h
|
/** @file XFileImporter.h
|
||||||
* @brief Definition of the XFile importer class.
|
* @brief Definition of the XFile importer class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_XFILEIMPORTER_H_INC
|
#ifndef AI_XFILEIMPORTER_H_INC
|
||||||
#define AI_XFILEIMPORTER_H_INC
|
#define AI_XFILEIMPORTER_H_INC
|
||||||
|
|
||||||
|
@ -69,28 +69,27 @@ namespace XFile {
|
||||||
class XFileImporter : public BaseImporter {
|
class XFileImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
XFileImporter();
|
XFileImporter();
|
||||||
~XFileImporter();
|
~XFileImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
||||||
bool CheckSig) const;
|
bool CheckSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details
|
* See #BaseImporter::GetInfo for the details
|
||||||
*/
|
*/
|
||||||
const aiImporterDesc* GetInfo () const;
|
const aiImporterDesc* GetInfo () const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details
|
* See BaseImporter::InternReadFile() for details
|
||||||
*/
|
*/
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
void InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
IOSystem* pIOHandler);
|
IOSystem* pIOHandler) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Constructs the return data structure out of the imported data.
|
/** Constructs the return data structure out of the imported data.
|
||||||
|
@ -140,7 +139,7 @@ protected:
|
||||||
void ConvertMaterials( aiScene* pScene, std::vector<XFile::Material>& pMaterials);
|
void ConvertMaterials( aiScene* pScene, std::vector<XFile::Material>& pMaterials);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Buffer to hold the loaded file */
|
/// Buffer to hold the loaded file
|
||||||
std::vector<char> mBuffer;
|
std::vector<char> mBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -115,12 +115,14 @@ bool XGLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool c
|
||||||
|
|
||||||
if (extension == "xgl" || extension == "zgl") {
|
if (extension == "xgl" || extension == "zgl") {
|
||||||
return true;
|
return true;
|
||||||
} else if (extension == "xml" || checkSig) {
|
}
|
||||||
ai_assert(pIOHandler != NULL);
|
|
||||||
|
|
||||||
|
if (extension == "xml" || checkSig) {
|
||||||
|
ai_assert(pIOHandler != nullptr);
|
||||||
const char *tokens[] = { "<world>", "<World>", "<WORLD>" };
|
const char *tokens[] = { "<world>", "<World>", "<WORLD>" };
|
||||||
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 3);
|
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,12 +456,12 @@ aiMesh *XGLImporter::ToOutputMesh(const TempMaterialMesh &m) {
|
||||||
mesh->mVertices = new aiVector3D[mesh->mNumVertices];
|
mesh->mVertices = new aiVector3D[mesh->mNumVertices];
|
||||||
std::copy(m.positions.begin(), m.positions.end(), mesh->mVertices);
|
std::copy(m.positions.begin(), m.positions.end(), mesh->mVertices);
|
||||||
|
|
||||||
if (m.normals.size()) {
|
if (!m.normals.empty()) {
|
||||||
mesh->mNormals = new aiVector3D[mesh->mNumVertices];
|
mesh->mNormals = new aiVector3D[mesh->mNumVertices];
|
||||||
std::copy(m.normals.begin(), m.normals.end(), mesh->mNormals);
|
std::copy(m.normals.begin(), m.normals.end(), mesh->mNormals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m.uvs.size()) {
|
if (!m.uvs.empty()) {
|
||||||
mesh->mNumUVComponents[0] = 2;
|
mesh->mNumUVComponents[0] = 2;
|
||||||
mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
|
mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
|
||||||
|
|
||||||
|
@ -595,7 +597,7 @@ bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// finally extract output meshes and add them to the scope
|
// finally extract output meshes and add them to the scope
|
||||||
typedef std::pair<const unsigned int, TempMaterialMesh> pairt;
|
using pairt = std::pair<const unsigned int, TempMaterialMesh>;
|
||||||
for (const pairt &p : bymat) {
|
for (const pairt &p : bymat) {
|
||||||
aiMesh *const m = ToOutputMesh(p.second);
|
aiMesh *const m = ToOutputMesh(p.second);
|
||||||
scope.meshes_linear.push_back(m);
|
scope.meshes_linear.push_back(m);
|
||||||
|
@ -620,7 +622,7 @@ unsigned int XGLImporter::ResolveMaterialRef(XmlNode &node, TempScope &scope) {
|
||||||
|
|
||||||
const int id = ReadIndexFromText(node);
|
const int id = ReadIndexFromText(node);
|
||||||
|
|
||||||
std::map<unsigned int, aiMaterial *>::iterator it = scope.materials.find(id), end = scope.materials.end();
|
auto it = scope.materials.find(id), end = scope.materials.end();
|
||||||
if (it == end) {
|
if (it == end) {
|
||||||
ThrowException("<matref> index out of range");
|
ThrowException("<matref> index out of range");
|
||||||
}
|
}
|
||||||
|
@ -644,7 +646,7 @@ unsigned int XGLImporter::ResolveMaterialRef(XmlNode &node, TempScope &scope) {
|
||||||
void XGLImporter::ReadMaterial(XmlNode &node, TempScope &scope) {
|
void XGLImporter::ReadMaterial(XmlNode &node, TempScope &scope) {
|
||||||
const unsigned int mat_id = ReadIDAttr(node);
|
const unsigned int mat_id = ReadIDAttr(node);
|
||||||
|
|
||||||
aiMaterial *mat(new aiMaterial);
|
auto *mat(new aiMaterial);
|
||||||
for (XmlNode &child : node.children()) {
|
for (XmlNode &child : node.children()) {
|
||||||
const std::string &s = ai_stdStrToLower(child.name());
|
const std::string &s = ai_stdStrToLower(child.name());
|
||||||
if (s == "amb") {
|
if (s == "amb") {
|
||||||
|
|
|
@ -70,25 +70,25 @@ namespace Assimp {
|
||||||
class XGLImporter : public BaseImporter, public LogFunctions<XGLImporter> {
|
class XGLImporter : public BaseImporter, public LogFunctions<XGLImporter> {
|
||||||
public:
|
public:
|
||||||
XGLImporter();
|
XGLImporter();
|
||||||
~XGLImporter();
|
~XGLImporter() override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details. */
|
* See BaseImporter::CanRead() for details. */
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details */
|
* See #BaseImporter::GetInfo for the details */
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Imports the given file into the given scene structure.
|
/** Imports the given file into the given scene structure.
|
||||||
* See BaseImporter::InternReadFile() for details */
|
* See BaseImporter::InternReadFile() for details */
|
||||||
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
void InternReadFile(const std::string &pFile, aiScene *pScene,
|
||||||
IOSystem *pIOHandler);
|
IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct TempScope {
|
struct TempScope {
|
||||||
|
|
|
@ -101,8 +101,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "AssetLib/glTF/glTFCommon.h"
|
#include "AssetLib/glTF/glTFCommon.h"
|
||||||
|
|
||||||
namespace glTF
|
namespace glTF {
|
||||||
{
|
|
||||||
using glTFCommon::shared_ptr;
|
using glTFCommon::shared_ptr;
|
||||||
using glTFCommon::IOSystem;
|
using glTFCommon::IOSystem;
|
||||||
using glTFCommon::IOStream;
|
using glTFCommon::IOStream;
|
||||||
|
@ -131,8 +130,7 @@ namespace glTF
|
||||||
|
|
||||||
//! For the KHR_binary_glTF extension (binary .glb file)
|
//! For the KHR_binary_glTF extension (binary .glb file)
|
||||||
//! 20-byte header (+ the JSON + a "body" data section)
|
//! 20-byte header (+ the JSON + a "body" data section)
|
||||||
struct GLB_Header
|
struct GLB_Header {
|
||||||
{
|
|
||||||
uint8_t magic[4]; //!< Magic number: "glTF"
|
uint8_t magic[4]; //!< Magic number: "glTF"
|
||||||
uint32_t version; //!< Version number (always 1 as of the last update)
|
uint32_t version; //!< Version number (always 1 as of the last update)
|
||||||
uint32_t length; //!< Total length of the Binary glTF, including header, scene, and body, in bytes
|
uint32_t length; //!< Total length of the Binary glTF, including header, scene, and body, in bytes
|
||||||
|
@ -146,14 +144,12 @@ namespace glTF
|
||||||
|
|
||||||
|
|
||||||
//! Values for the GLB_Header::sceneFormat field
|
//! Values for the GLB_Header::sceneFormat field
|
||||||
enum SceneFormat
|
enum SceneFormat {
|
||||||
{
|
|
||||||
SceneFormat_JSON = 0
|
SceneFormat_JSON = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Values for the mesh primitive modes
|
//! Values for the mesh primitive modes
|
||||||
enum PrimitiveMode
|
enum PrimitiveMode {
|
||||||
{
|
|
||||||
PrimitiveMode_POINTS = 0,
|
PrimitiveMode_POINTS = 0,
|
||||||
PrimitiveMode_LINES = 1,
|
PrimitiveMode_LINES = 1,
|
||||||
PrimitiveMode_LINE_LOOP = 2,
|
PrimitiveMode_LINE_LOOP = 2,
|
||||||
|
@ -164,8 +160,7 @@ namespace glTF
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Values for the Accessor::componentType field
|
//! Values for the Accessor::componentType field
|
||||||
enum ComponentType
|
enum ComponentType {
|
||||||
{
|
|
||||||
ComponentType_BYTE = 5120,
|
ComponentType_BYTE = 5120,
|
||||||
ComponentType_UNSIGNED_BYTE = 5121,
|
ComponentType_UNSIGNED_BYTE = 5121,
|
||||||
ComponentType_SHORT = 5122,
|
ComponentType_SHORT = 5122,
|
||||||
|
@ -174,8 +169,7 @@ namespace glTF
|
||||||
ComponentType_FLOAT = 5126
|
ComponentType_FLOAT = 5126
|
||||||
};
|
};
|
||||||
|
|
||||||
inline unsigned int ComponentTypeSize(ComponentType t)
|
inline unsigned int ComponentTypeSize(ComponentType t) {
|
||||||
{
|
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case ComponentType_SHORT:
|
case ComponentType_SHORT:
|
||||||
case ComponentType_UNSIGNED_SHORT:
|
case ComponentType_UNSIGNED_SHORT:
|
||||||
|
@ -196,23 +190,20 @@ namespace glTF
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Values for the BufferView::target field
|
//! Values for the BufferView::target field
|
||||||
enum BufferViewTarget
|
enum BufferViewTarget {
|
||||||
{
|
|
||||||
BufferViewTarget_NONE = 0,
|
BufferViewTarget_NONE = 0,
|
||||||
BufferViewTarget_ARRAY_BUFFER = 34962,
|
BufferViewTarget_ARRAY_BUFFER = 34962,
|
||||||
BufferViewTarget_ELEMENT_ARRAY_BUFFER = 34963
|
BufferViewTarget_ELEMENT_ARRAY_BUFFER = 34963
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Values for the Sampler::magFilter field
|
//! Values for the Sampler::magFilter field
|
||||||
enum SamplerMagFilter
|
enum SamplerMagFilter {
|
||||||
{
|
|
||||||
SamplerMagFilter_Nearest = 9728,
|
SamplerMagFilter_Nearest = 9728,
|
||||||
SamplerMagFilter_Linear = 9729
|
SamplerMagFilter_Linear = 9729
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Values for the Sampler::minFilter field
|
//! Values for the Sampler::minFilter field
|
||||||
enum SamplerMinFilter
|
enum SamplerMinFilter {
|
||||||
{
|
|
||||||
SamplerMinFilter_Nearest = 9728,
|
SamplerMinFilter_Nearest = 9728,
|
||||||
SamplerMinFilter_Linear = 9729,
|
SamplerMinFilter_Linear = 9729,
|
||||||
SamplerMinFilter_Nearest_Mipmap_Nearest = 9984,
|
SamplerMinFilter_Nearest_Mipmap_Nearest = 9984,
|
||||||
|
@ -222,8 +213,7 @@ namespace glTF
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Values for the Sampler::wrapS and Sampler::wrapT field
|
//! Values for the Sampler::wrapS and Sampler::wrapT field
|
||||||
enum SamplerWrap
|
enum SamplerWrap {
|
||||||
{
|
|
||||||
SamplerWrap_Clamp_To_Edge = 33071,
|
SamplerWrap_Clamp_To_Edge = 33071,
|
||||||
SamplerWrap_Mirrored_Repeat = 33648,
|
SamplerWrap_Mirrored_Repeat = 33648,
|
||||||
SamplerWrap_Repeat = 10497
|
SamplerWrap_Repeat = 10497
|
||||||
|
|
|
@ -39,6 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef AI_GLTFIMPORTER_H_INC
|
#ifndef AI_GLTFIMPORTER_H_INC
|
||||||
#define AI_GLTFIMPORTER_H_INC
|
#define AI_GLTFIMPORTER_H_INC
|
||||||
|
|
||||||
|
@ -47,10 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
||||||
|
namespace glTF {
|
||||||
namespace glTF
|
|
||||||
{
|
|
||||||
class Asset;
|
class Asset;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -62,21 +62,14 @@ namespace Assimp {
|
||||||
class glTFImporter : public BaseImporter {
|
class glTFImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
glTFImporter();
|
glTFImporter();
|
||||||
virtual ~glTFImporter();
|
~glTFImporter() override;
|
||||||
virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const;
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const aiImporterDesc* GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
virtual void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler );
|
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<unsigned int> meshOffsets;
|
|
||||||
|
|
||||||
std::vector<int> embeddedTexIdxs;
|
|
||||||
|
|
||||||
aiScene* mScene;
|
|
||||||
|
|
||||||
void ImportEmbeddedTextures(glTF::Asset &a);
|
void ImportEmbeddedTextures(glTF::Asset &a);
|
||||||
void ImportMaterials(glTF::Asset &a);
|
void ImportMaterials(glTF::Asset &a);
|
||||||
void ImportMeshes(glTF::Asset &a);
|
void ImportMeshes(glTF::Asset &a);
|
||||||
|
@ -84,9 +77,13 @@ private:
|
||||||
void ImportLights(glTF::Asset &a);
|
void ImportLights(glTF::Asset &a);
|
||||||
void ImportNodes(glTF::Asset &a);
|
void ImportNodes(glTF::Asset &a);
|
||||||
void ImportCommonMetadata(glTF::Asset &a);
|
void ImportCommonMetadata(glTF::Asset &a);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<unsigned int> meshOffsets;
|
||||||
|
std::vector<int> embeddedTexIdxs;
|
||||||
|
aiScene *mScene;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace assimp
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // AI_GLTFIMPORTER_H_INC
|
#endif // AI_GLTFIMPORTER_H_INC
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -46,21 +45,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AssetLib/glTF2/glTF2AssetWriter.h"
|
#include "AssetLib/glTF2/glTF2AssetWriter.h"
|
||||||
#include "PostProcessing/SplitLargeMeshes.h"
|
#include "PostProcessing/SplitLargeMeshes.h"
|
||||||
|
|
||||||
#include <assimp/commonMetaData.h>
|
|
||||||
#include <assimp/Exceptional.h>
|
|
||||||
#include <assimp/StringComparison.h>
|
|
||||||
#include <assimp/ByteSwapper.h>
|
#include <assimp/ByteSwapper.h>
|
||||||
|
#include <assimp/Exceptional.h>
|
||||||
#include <assimp/SceneCombiner.h>
|
#include <assimp/SceneCombiner.h>
|
||||||
#include <assimp/version.h>
|
#include <assimp/StringComparison.h>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/commonMetaData.h>
|
||||||
#include <assimp/Exporter.hpp>
|
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/version.h>
|
||||||
|
#include <assimp/Exporter.hpp>
|
||||||
|
#include <assimp/IOSystem.hpp>
|
||||||
|
|
||||||
// Header files, standard library.
|
// Header files, standard library.
|
||||||
#include <memory>
|
|
||||||
#include <limits>
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <limits>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
|
|
||||||
|
@ -71,16 +70,14 @@ namespace Assimp {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Worker function for exporting a scene to GLTF. Prototyped and registered in Exporter.cpp
|
// Worker function for exporting a scene to GLTF. Prototyped and registered in Exporter.cpp
|
||||||
void ExportSceneGLTF2(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties)
|
void ExportSceneGLTF2(const char *pFile, IOSystem *pIOSystem, const aiScene *pScene, const ExportProperties *pProperties) {
|
||||||
{
|
|
||||||
// invoke the exporter
|
// invoke the exporter
|
||||||
glTF2Exporter exporter(pFile, pIOSystem, pScene, pProperties, false);
|
glTF2Exporter exporter(pFile, pIOSystem, pScene, pProperties, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Worker function for exporting a scene to GLB. Prototyped and registered in Exporter.cpp
|
// Worker function for exporting a scene to GLB. Prototyped and registered in Exporter.cpp
|
||||||
void ExportSceneGLB2(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties)
|
void ExportSceneGLB2(const char *pFile, IOSystem *pIOSystem, const aiScene *pScene, const ExportProperties *pProperties) {
|
||||||
{
|
|
||||||
// invoke the exporter
|
// invoke the exporter
|
||||||
glTF2Exporter exporter(pFile, pIOSystem, pScene, pProperties, true);
|
glTF2Exporter exporter(pFile, pIOSystem, pScene, pProperties, true);
|
||||||
}
|
}
|
||||||
|
@ -88,13 +85,8 @@ namespace Assimp {
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
glTF2Exporter::glTF2Exporter(const char *filename, IOSystem *pIOSystem, const aiScene *pScene,
|
glTF2Exporter::glTF2Exporter(const char *filename, IOSystem *pIOSystem, const aiScene *pScene,
|
||||||
const ExportProperties* pProperties, bool isBinary)
|
const ExportProperties *pProperties, bool isBinary) :
|
||||||
: mFilename(filename)
|
mFilename(filename), mIOSystem(pIOSystem), mScene(pScene), mProperties(pProperties), mAsset(new Asset(pIOSystem)) {
|
||||||
, mIOSystem(pIOSystem)
|
|
||||||
, mScene(pScene)
|
|
||||||
, mProperties(pProperties)
|
|
||||||
, mAsset(new Asset(pIOSystem))
|
|
||||||
{
|
|
||||||
// Always on as our triangulation process is aware of this type of encoding
|
// Always on as our triangulation process is aware of this type of encoding
|
||||||
mAsset->extensionsUsed.FB_ngon_encoding = true;
|
mAsset->extensionsUsed.FB_ngon_encoding = true;
|
||||||
|
|
||||||
|
@ -118,8 +110,7 @@ glTF2Exporter::glTF2Exporter(const char* filename, IOSystem* pIOSystem, const ai
|
||||||
ExportAnimations();
|
ExportAnimations();
|
||||||
|
|
||||||
// export extras
|
// export extras
|
||||||
if(mProperties->HasPropertyCallback("extras"))
|
if (mProperties->HasPropertyCallback("extras")) {
|
||||||
{
|
|
||||||
std::function<void *(void *)> ExportExtras = mProperties->GetPropertyCallback("extras");
|
std::function<void *(void *)> ExportExtras = mProperties->GetPropertyCallback("extras");
|
||||||
mAsset->extras = (rapidjson::Value *)ExportExtras(0);
|
mAsset->extras = (rapidjson::Value *)ExportExtras(0);
|
||||||
}
|
}
|
||||||
|
@ -142,10 +133,22 @@ glTF2Exporter::~glTF2Exporter() {
|
||||||
* Also converts from row-major to column-major storage.
|
* Also converts from row-major to column-major storage.
|
||||||
*/
|
*/
|
||||||
static void CopyValue(const aiMatrix4x4 &v, mat4 &o) {
|
static void CopyValue(const aiMatrix4x4 &v, mat4 &o) {
|
||||||
o[ 0] = v.a1; o[ 1] = v.b1; o[ 2] = v.c1; o[ 3] = v.d1;
|
o[0] = v.a1;
|
||||||
o[ 4] = v.a2; o[ 5] = v.b2; o[ 6] = v.c2; o[ 7] = v.d2;
|
o[1] = v.b1;
|
||||||
o[ 8] = v.a3; o[ 9] = v.b3; o[10] = v.c3; o[11] = v.d3;
|
o[2] = v.c1;
|
||||||
o[12] = v.a4; o[13] = v.b4; o[14] = v.c4; o[15] = v.d4;
|
o[3] = v.d1;
|
||||||
|
o[4] = v.a2;
|
||||||
|
o[5] = v.b2;
|
||||||
|
o[6] = v.c2;
|
||||||
|
o[7] = v.d2;
|
||||||
|
o[8] = v.a3;
|
||||||
|
o[9] = v.b3;
|
||||||
|
o[10] = v.c3;
|
||||||
|
o[11] = v.d3;
|
||||||
|
o[12] = v.a4;
|
||||||
|
o[13] = v.b4;
|
||||||
|
o[14] = v.c4;
|
||||||
|
o[15] = v.d4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CopyValue(const aiMatrix4x4 &v, aiMatrix4x4 &o) {
|
static void CopyValue(const aiMatrix4x4 &v, aiMatrix4x4 &o) {
|
||||||
|
@ -153,16 +156,27 @@ static void CopyValue(const aiMatrix4x4& v, aiMatrix4x4& o) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void IdentityMatrix4(mat4 &o) {
|
static void IdentityMatrix4(mat4 &o) {
|
||||||
o[ 0] = 1; o[ 1] = 0; o[ 2] = 0; o[ 3] = 0;
|
o[0] = 1;
|
||||||
o[ 4] = 0; o[ 5] = 1; o[ 6] = 0; o[ 7] = 0;
|
o[1] = 0;
|
||||||
o[ 8] = 0; o[ 9] = 0; o[10] = 1; o[11] = 0;
|
o[2] = 0;
|
||||||
o[12] = 0; o[13] = 0; o[14] = 0; o[15] = 1;
|
o[3] = 0;
|
||||||
|
o[4] = 0;
|
||||||
|
o[5] = 1;
|
||||||
|
o[6] = 0;
|
||||||
|
o[7] = 0;
|
||||||
|
o[8] = 0;
|
||||||
|
o[9] = 0;
|
||||||
|
o[10] = 1;
|
||||||
|
o[11] = 0;
|
||||||
|
o[12] = 0;
|
||||||
|
o[13] = 0;
|
||||||
|
o[14] = 0;
|
||||||
|
o[15] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void SetAccessorRange(Ref<Accessor> acc, void *data, size_t count,
|
void SetAccessorRange(Ref<Accessor> acc, void *data, size_t count,
|
||||||
unsigned int numCompsIn, unsigned int numCompsOut)
|
unsigned int numCompsIn, unsigned int numCompsOut) {
|
||||||
{
|
|
||||||
ai_assert(numCompsOut <= numCompsIn);
|
ai_assert(numCompsOut <= numCompsIn);
|
||||||
|
|
||||||
// Allocate and initialize with large values.
|
// Allocate and initialize with large values.
|
||||||
|
@ -198,8 +212,7 @@ void SetAccessorRange(Ref<Accessor> acc, void* data, size_t count,
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetAccessorRange(ComponentType compType, Ref<Accessor> acc, void *data,
|
inline void SetAccessorRange(ComponentType compType, Ref<Accessor> acc, void *data,
|
||||||
size_t count, unsigned int numCompsIn, unsigned int numCompsOut)
|
size_t count, unsigned int numCompsIn, unsigned int numCompsOut) {
|
||||||
{
|
|
||||||
switch (compType) {
|
switch (compType) {
|
||||||
case ComponentType_SHORT:
|
case ComponentType_SHORT:
|
||||||
SetAccessorRange<short>(acc, data, count, numCompsIn, numCompsOut);
|
SetAccessorRange<short>(acc, data, count, numCompsIn, numCompsOut);
|
||||||
|
@ -375,8 +388,7 @@ inline Ref<Accessor> ExportDataSparse(Asset &a, std::string &meshName, Ref<Buffe
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
inline Ref<Accessor> ExportData(Asset &a, std::string &meshName, Ref<Buffer> &buffer,
|
inline Ref<Accessor> ExportData(Asset &a, std::string &meshName, Ref<Buffer> &buffer,
|
||||||
size_t count, void* data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, BufferViewTarget target = BufferViewTarget_NONE)
|
size_t count, void *data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, BufferViewTarget target = BufferViewTarget_NONE) {
|
||||||
{
|
|
||||||
if (!count || !data) {
|
if (!count || !data) {
|
||||||
return Ref<Accessor>();
|
return Ref<Accessor>();
|
||||||
}
|
}
|
||||||
|
@ -417,8 +429,7 @@ inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& bu
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetSamplerWrap(SamplerWrap& wrap, aiTextureMapMode map)
|
inline void SetSamplerWrap(SamplerWrap &wrap, aiTextureMapMode map) {
|
||||||
{
|
|
||||||
switch (map) {
|
switch (map) {
|
||||||
case aiTextureMapMode_Clamp:
|
case aiTextureMapMode_Clamp:
|
||||||
wrap = SamplerWrap::Clamp_To_Edge;
|
wrap = SamplerWrap::Clamp_To_Edge;
|
||||||
|
@ -434,8 +445,7 @@ inline void SetSamplerWrap(SamplerWrap& wrap, aiTextureMapMode map)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::GetTexSampler(const aiMaterial& mat, Ref<Texture> texture, aiTextureType tt, unsigned int slot)
|
void glTF2Exporter::GetTexSampler(const aiMaterial &mat, Ref<Texture> texture, aiTextureType tt, unsigned int slot) {
|
||||||
{
|
|
||||||
aiString aId;
|
aiString aId;
|
||||||
std::string id;
|
std::string id;
|
||||||
if (aiGetMaterialString(&mat, AI_MATKEY_GLTF_MAPPINGID(tt, slot), &aId) == AI_SUCCESS) {
|
if (aiGetMaterialString(&mat, AI_MATKEY_GLTF_MAPPINGID(tt, slot), &aId) == AI_SUCCESS) {
|
||||||
|
@ -476,22 +486,19 @@ void glTF2Exporter::GetTexSampler(const aiMaterial& mat, Ref<Texture> texture, a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::GetMatTexProp(const aiMaterial& mat, unsigned int& prop, const char* propName, aiTextureType tt, unsigned int slot)
|
void glTF2Exporter::GetMatTexProp(const aiMaterial &mat, unsigned int &prop, const char *propName, aiTextureType tt, unsigned int slot) {
|
||||||
{
|
|
||||||
std::string textureKey = std::string(_AI_MATKEY_TEXTURE_BASE) + "." + propName;
|
std::string textureKey = std::string(_AI_MATKEY_TEXTURE_BASE) + "." + propName;
|
||||||
|
|
||||||
mat.Get(textureKey.c_str(), tt, slot, prop);
|
mat.Get(textureKey.c_str(), tt, slot, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::GetMatTexProp(const aiMaterial& mat, float& prop, const char* propName, aiTextureType tt, unsigned int slot)
|
void glTF2Exporter::GetMatTexProp(const aiMaterial &mat, float &prop, const char *propName, aiTextureType tt, unsigned int slot) {
|
||||||
{
|
|
||||||
std::string textureKey = std::string(_AI_MATKEY_TEXTURE_BASE) + "." + propName;
|
std::string textureKey = std::string(_AI_MATKEY_TEXTURE_BASE) + "." + propName;
|
||||||
|
|
||||||
mat.Get(textureKey.c_str(), tt, slot, prop);
|
mat.Get(textureKey.c_str(), tt, slot, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::GetMatTex(const aiMaterial& mat, Ref<Texture>& texture, unsigned int &texCoord, aiTextureType tt, unsigned int slot = 0)
|
void glTF2Exporter::GetMatTex(const aiMaterial &mat, Ref<Texture> &texture, unsigned int &texCoord, aiTextureType tt, unsigned int slot = 0) {
|
||||||
{
|
|
||||||
if (mat.GetTextureCount(tt) > 0) {
|
if (mat.GetTextureCount(tt) > 0) {
|
||||||
aiString tex;
|
aiString tex;
|
||||||
|
|
||||||
|
@ -528,16 +535,13 @@ void glTF2Exporter::GetMatTex(const aiMaterial& mat, Ref<Texture>& texture, unsi
|
||||||
else if (memcmp(curTex->achFormatHint, "ktx", 3) == 0) {
|
else if (memcmp(curTex->achFormatHint, "ktx", 3) == 0) {
|
||||||
useBasisUniversal = true;
|
useBasisUniversal = true;
|
||||||
mimeType += "ktx";
|
mimeType += "ktx";
|
||||||
}
|
} else if (memcmp(curTex->achFormatHint, "kx2", 3) == 0) {
|
||||||
else if(memcmp(curTex->achFormatHint, "kx2", 3) == 0) {
|
|
||||||
useBasisUniversal = true;
|
useBasisUniversal = true;
|
||||||
mimeType += "ktx2";
|
mimeType += "ktx2";
|
||||||
}
|
} else if (memcmp(curTex->achFormatHint, "bu", 2) == 0) {
|
||||||
else if(memcmp(curTex->achFormatHint, "bu", 2) == 0) {
|
|
||||||
useBasisUniversal = true;
|
useBasisUniversal = true;
|
||||||
mimeType += "basis";
|
mimeType += "basis";
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
mimeType += curTex->achFormatHint;
|
mimeType += curTex->achFormatHint;
|
||||||
texture->source->mimeType = mimeType;
|
texture->source->mimeType = mimeType;
|
||||||
}
|
}
|
||||||
|
@ -545,12 +549,10 @@ void glTF2Exporter::GetMatTex(const aiMaterial& mat, Ref<Texture>& texture, unsi
|
||||||
// The asset has its own buffer, see Image::SetData
|
// The asset has its own buffer, see Image::SetData
|
||||||
//basisu: "image/ktx2", "image/basis" as is
|
//basisu: "image/ktx2", "image/basis" as is
|
||||||
texture->source->SetData(reinterpret_cast<uint8_t *>(curTex->pcData), curTex->mWidth, *mAsset);
|
texture->source->SetData(reinterpret_cast<uint8_t *>(curTex->pcData), curTex->mWidth, *mAsset);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
texture->source->uri = path;
|
texture->source->uri = path;
|
||||||
if (texture->source->uri.find(".ktx") != std::string::npos ||
|
if (texture->source->uri.find(".ktx") != std::string::npos ||
|
||||||
texture->source->uri.find(".basis")!=std::string::npos)
|
texture->source->uri.find(".basis") != std::string::npos) {
|
||||||
{
|
|
||||||
useBasisUniversal = true;
|
useBasisUniversal = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -568,8 +570,7 @@ void glTF2Exporter::GetMatTex(const aiMaterial& mat, Ref<Texture>& texture, unsi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::GetMatTex(const aiMaterial& mat, TextureInfo& prop, aiTextureType tt, unsigned int slot = 0)
|
void glTF2Exporter::GetMatTex(const aiMaterial &mat, TextureInfo &prop, aiTextureType tt, unsigned int slot = 0) {
|
||||||
{
|
|
||||||
Ref<Texture> &texture = prop.texture;
|
Ref<Texture> &texture = prop.texture;
|
||||||
|
|
||||||
GetMatTex(mat, texture, prop.texCoord, tt, slot);
|
GetMatTex(mat, texture, prop.texCoord, tt, slot);
|
||||||
|
@ -579,8 +580,7 @@ void glTF2Exporter::GetMatTex(const aiMaterial& mat, TextureInfo& prop, aiTextur
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::GetMatTex(const aiMaterial& mat, NormalTextureInfo& prop, aiTextureType tt, unsigned int slot = 0)
|
void glTF2Exporter::GetMatTex(const aiMaterial &mat, NormalTextureInfo &prop, aiTextureType tt, unsigned int slot = 0) {
|
||||||
{
|
|
||||||
Ref<Texture> &texture = prop.texture;
|
Ref<Texture> &texture = prop.texture;
|
||||||
|
|
||||||
GetMatTex(mat, texture, prop.texCoord, tt, slot);
|
GetMatTex(mat, texture, prop.texCoord, tt, slot);
|
||||||
|
@ -591,8 +591,7 @@ void glTF2Exporter::GetMatTex(const aiMaterial& mat, NormalTextureInfo& prop, ai
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::GetMatTex(const aiMaterial& mat, OcclusionTextureInfo& prop, aiTextureType tt, unsigned int slot = 0)
|
void glTF2Exporter::GetMatTex(const aiMaterial &mat, OcclusionTextureInfo &prop, aiTextureType tt, unsigned int slot = 0) {
|
||||||
{
|
|
||||||
Ref<Texture> &texture = prop.texture;
|
Ref<Texture> &texture = prop.texture;
|
||||||
|
|
||||||
GetMatTex(mat, texture, prop.texCoord, tt, slot);
|
GetMatTex(mat, texture, prop.texCoord, tt, slot);
|
||||||
|
@ -603,20 +602,21 @@ void glTF2Exporter::GetMatTex(const aiMaterial& mat, OcclusionTextureInfo& prop,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aiReturn glTF2Exporter::GetMatColor(const aiMaterial& mat, vec4& prop, const char* propName, int type, int idx) const
|
aiReturn glTF2Exporter::GetMatColor(const aiMaterial &mat, vec4 &prop, const char *propName, int type, int idx) const {
|
||||||
{
|
|
||||||
aiColor4D col;
|
aiColor4D col;
|
||||||
aiReturn result = mat.Get(propName, type, idx, col);
|
aiReturn result = mat.Get(propName, type, idx, col);
|
||||||
|
|
||||||
if (result == AI_SUCCESS) {
|
if (result == AI_SUCCESS) {
|
||||||
prop[0] = col.r; prop[1] = col.g; prop[2] = col.b; prop[3] = col.a;
|
prop[0] = col.r;
|
||||||
|
prop[1] = col.g;
|
||||||
|
prop[2] = col.b;
|
||||||
|
prop[3] = col.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
aiReturn glTF2Exporter::GetMatColor(const aiMaterial& mat, vec3& prop, const char* propName, int type, int idx) const
|
aiReturn glTF2Exporter::GetMatColor(const aiMaterial &mat, vec3 &prop, const char *propName, int type, int idx) const {
|
||||||
{
|
|
||||||
aiColor3D col;
|
aiColor3D col;
|
||||||
aiReturn result = mat.Get(propName, type, idx, col);
|
aiReturn result = mat.Get(propName, type, idx, col);
|
||||||
|
|
||||||
|
@ -704,8 +704,7 @@ bool glTF2Exporter::GetMatTransmission(const aiMaterial &mat, glTF2::MaterialTra
|
||||||
return result || transmission.transmissionTexture.texture;
|
return result || transmission.transmissionTexture.texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::ExportMaterials()
|
void glTF2Exporter::ExportMaterials() {
|
||||||
{
|
|
||||||
aiString aiName;
|
aiString aiName;
|
||||||
for (unsigned int i = 0; i < mScene->mNumMaterials; ++i) {
|
for (unsigned int i = 0; i < mScene->mNumMaterials; ++i) {
|
||||||
ai_assert(mScene->mMaterials[i] != nullptr);
|
ai_assert(mScene->mMaterials[i] != nullptr);
|
||||||
|
@ -752,8 +751,7 @@ void glTF2Exporter::ExportMaterials()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
mat.Get(AI_MATKEY_COLOR_SPECULAR, specularColor) == AI_SUCCESS &&
|
mat.Get(AI_MATKEY_COLOR_SPECULAR, specularColor) == AI_SUCCESS &&
|
||||||
mat.Get(AI_MATKEY_SHININESS, shininess) == AI_SUCCESS
|
mat.Get(AI_MATKEY_SHININESS, shininess) == AI_SUCCESS) {
|
||||||
) {
|
|
||||||
// convert specular color to luminance
|
// convert specular color to luminance
|
||||||
float specularIntensity = specularColor[0] * 0.2125f + specularColor[1] * 0.7154f + specularColor[2] * 0.0721f;
|
float specularIntensity = specularColor[0] * 0.2125f + specularColor[1] * 0.7154f + specularColor[2] * 0.0721f;
|
||||||
//normalize shininess (assuming max is 1000) with an inverse exponentional curve
|
//normalize shininess (assuming max is 1000) with an inverse exponentional curve
|
||||||
|
@ -858,8 +856,7 @@ bool FindMeshNode(Ref<Node> &nodeIn, Ref<Node> &meshNode, const std::string &mes
|
||||||
* until a parent is found that does not have a jointName.
|
* until a parent is found that does not have a jointName.
|
||||||
* Returns the first parent Ref<Node> found that does not have a jointName.
|
* Returns the first parent Ref<Node> found that does not have a jointName.
|
||||||
*/
|
*/
|
||||||
Ref<Node> FindSkeletonRootJoint(Ref<Skin>& skinRef)
|
Ref<Node> FindSkeletonRootJoint(Ref<Skin> &skinRef) {
|
||||||
{
|
|
||||||
Ref<Node> startNodeRef;
|
Ref<Node> startNodeRef;
|
||||||
Ref<Node> parentNodeRef;
|
Ref<Node> parentNodeRef;
|
||||||
|
|
||||||
|
@ -875,8 +872,7 @@ Ref<Node> FindSkeletonRootJoint(Ref<Skin>& skinRef)
|
||||||
return parentNodeRef;
|
return parentNodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buffer>& bufferRef, Ref<Skin>& skinRef, std::vector<aiMatrix4x4>& inverseBindMatricesData)
|
void ExportSkin(Asset &mAsset, const aiMesh *aimesh, Ref<Mesh> &meshRef, Ref<Buffer> &bufferRef, Ref<Skin> &skinRef, std::vector<aiMatrix4x4> &inverseBindMatricesData) {
|
||||||
{
|
|
||||||
if (aimesh->mNumBones < 1) {
|
if (aimesh->mNumBones < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -975,8 +971,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
|
||||||
delete[] vertexJointData;
|
delete[] vertexJointData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::ExportMeshes()
|
void glTF2Exporter::ExportMeshes() {
|
||||||
{
|
|
||||||
typedef decltype(aiFace::mNumIndices) IndicesType;
|
typedef decltype(aiFace::mNumIndices) IndicesType;
|
||||||
|
|
||||||
std::string fname = std::string(mFilename);
|
std::string fname = std::string(mFilename);
|
||||||
|
@ -1081,11 +1076,14 @@ void glTF2Exporter::ExportMeshes()
|
||||||
|
|
||||||
switch (aim->mPrimitiveTypes) {
|
switch (aim->mPrimitiveTypes) {
|
||||||
case aiPrimitiveType_POLYGON:
|
case aiPrimitiveType_POLYGON:
|
||||||
p.mode = PrimitiveMode_TRIANGLES; break; // TODO implement this
|
p.mode = PrimitiveMode_TRIANGLES;
|
||||||
|
break; // TODO implement this
|
||||||
case aiPrimitiveType_LINE:
|
case aiPrimitiveType_LINE:
|
||||||
p.mode = PrimitiveMode_LINES; break;
|
p.mode = PrimitiveMode_LINES;
|
||||||
|
break;
|
||||||
case aiPrimitiveType_POINT:
|
case aiPrimitiveType_POINT:
|
||||||
p.mode = PrimitiveMode_POINTS; break;
|
p.mode = PrimitiveMode_POINTS;
|
||||||
|
break;
|
||||||
default: // aiPrimitiveType_TRIANGLE
|
default: // aiPrimitiveType_TRIANGLE
|
||||||
p.mode = PrimitiveMode_TRIANGLES;
|
p.mode = PrimitiveMode_TRIANGLES;
|
||||||
}
|
}
|
||||||
|
@ -1208,8 +1206,7 @@ void glTF2Exporter::ExportMeshes()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merges a node's multiple meshes (with one primitive each) into one mesh with multiple primitives
|
// Merges a node's multiple meshes (with one primitive each) into one mesh with multiple primitives
|
||||||
void glTF2Exporter::MergeMeshes()
|
void glTF2Exporter::MergeMeshes() {
|
||||||
{
|
|
||||||
for (unsigned int n = 0; n < mAsset->nodes.Size(); ++n) {
|
for (unsigned int n = 0; n < mAsset->nodes.Size(); ++n) {
|
||||||
Ref<Node> node = mAsset->nodes.Get(n);
|
Ref<Node> node = mAsset->nodes.Get(n);
|
||||||
|
|
||||||
|
@ -1227,8 +1224,7 @@ void glTF2Exporter::MergeMeshes()
|
||||||
firstMesh->primitives.insert(
|
firstMesh->primitives.insert(
|
||||||
firstMesh->primitives.end(),
|
firstMesh->primitives.end(),
|
||||||
mesh->primitives.begin(),
|
mesh->primitives.begin(),
|
||||||
mesh->primitives.end()
|
mesh->primitives.end());
|
||||||
);
|
|
||||||
|
|
||||||
//remove the mesh from the list of meshes
|
//remove the mesh from the list of meshes
|
||||||
unsigned int removedIndex = mAsset->meshes.Remove(mesh->id.c_str());
|
unsigned int removedIndex = mAsset->meshes.Remove(mesh->id.c_str());
|
||||||
|
@ -1262,8 +1258,7 @@ void glTF2Exporter::MergeMeshes()
|
||||||
* Export the root node of the node hierarchy.
|
* Export the root node of the node hierarchy.
|
||||||
* Calls ExportNode for all children.
|
* Calls ExportNode for all children.
|
||||||
*/
|
*/
|
||||||
unsigned int glTF2Exporter::ExportNodeHierarchy(const aiNode* n)
|
unsigned int glTF2Exporter::ExportNodeHierarchy(const aiNode *n) {
|
||||||
{
|
|
||||||
Ref<Node> node = mAsset->nodes.Create(mAsset->FindUniqueID(n->mName.C_Str(), "node"));
|
Ref<Node> node = mAsset->nodes.Create(mAsset->FindUniqueID(n->mName.C_Str(), "node"));
|
||||||
|
|
||||||
node->name = n->mName.C_Str();
|
node->name = n->mName.C_Str();
|
||||||
|
@ -1289,8 +1284,7 @@ unsigned int glTF2Exporter::ExportNodeHierarchy(const aiNode* n)
|
||||||
* Export node and recursively calls ExportNode for all children.
|
* Export node and recursively calls ExportNode for all children.
|
||||||
* Since these nodes are not the root node, we also export the parent Ref<Node>
|
* Since these nodes are not the root node, we also export the parent Ref<Node>
|
||||||
*/
|
*/
|
||||||
unsigned int glTF2Exporter::ExportNode(const aiNode* n, Ref<Node>& parent)
|
unsigned int glTF2Exporter::ExportNode(const aiNode *n, Ref<Node> &parent) {
|
||||||
{
|
|
||||||
std::string name = mAsset->FindUniqueID(n->mName.C_Str(), "node");
|
std::string name = mAsset->FindUniqueID(n->mName.C_Str(), "node");
|
||||||
Ref<Node> node = mAsset->nodes.Create(name);
|
Ref<Node> node = mAsset->nodes.Create(name);
|
||||||
|
|
||||||
|
@ -1333,9 +1327,7 @@ unsigned int glTF2Exporter::ExportNode(const aiNode* n, Ref<Node>& parent)
|
||||||
return node.GetIndex();
|
return node.GetIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void glTF2Exporter::ExportScene() {
|
||||||
void glTF2Exporter::ExportScene()
|
|
||||||
{
|
|
||||||
// Use the name of the scene if specified
|
// Use the name of the scene if specified
|
||||||
const std::string sceneName = (mScene->mName.length > 0) ? mScene->mName.C_Str() : "defaultScene";
|
const std::string sceneName = (mScene->mName.length > 0) ? mScene->mName.C_Str() : "defaultScene";
|
||||||
|
|
||||||
|
@ -1351,8 +1343,7 @@ void glTF2Exporter::ExportScene()
|
||||||
mAsset->scene = scene;
|
mAsset->scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::ExportMetadata()
|
void glTF2Exporter::ExportMetadata() {
|
||||||
{
|
|
||||||
AssetMetadata &asset = mAsset->asset;
|
AssetMetadata &asset = mAsset->asset;
|
||||||
asset.version = "2.0";
|
asset.version = "2.0";
|
||||||
|
|
||||||
|
@ -1369,13 +1360,11 @@ void glTF2Exporter::ExportMetadata()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Ref<Accessor> GetSamplerInputRef(Asset& asset, std::string& animId, Ref<Buffer>& buffer, std::vector<float>& times)
|
inline Ref<Accessor> GetSamplerInputRef(Asset &asset, std::string &animId, Ref<Buffer> &buffer, std::vector<float> ×) {
|
||||||
{
|
|
||||||
return ExportData(asset, animId, buffer, (unsigned int)times.size(), ×[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT);
|
return ExportData(asset, animId, buffer, (unsigned int)times.size(), ×[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ExtractTranslationSampler(Asset& asset, std::string& animId, Ref<Buffer>& buffer, const aiNodeAnim* nodeChannel, float ticksPerSecond, Animation::Sampler& sampler)
|
inline void ExtractTranslationSampler(Asset &asset, std::string &animId, Ref<Buffer> &buffer, const aiNodeAnim *nodeChannel, float ticksPerSecond, Animation::Sampler &sampler) {
|
||||||
{
|
|
||||||
const unsigned int numKeyframes = nodeChannel->mNumPositionKeys;
|
const unsigned int numKeyframes = nodeChannel->mNumPositionKeys;
|
||||||
|
|
||||||
std::vector<float> times(numKeyframes);
|
std::vector<float> times(numKeyframes);
|
||||||
|
@ -1394,8 +1383,7 @@ inline void ExtractTranslationSampler(Asset& asset, std::string& animId, Ref<Buf
|
||||||
sampler.interpolation = Interpolation_LINEAR;
|
sampler.interpolation = Interpolation_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ExtractScaleSampler(Asset& asset, std::string& animId, Ref<Buffer>& buffer, const aiNodeAnim* nodeChannel, float ticksPerSecond, Animation::Sampler& sampler)
|
inline void ExtractScaleSampler(Asset &asset, std::string &animId, Ref<Buffer> &buffer, const aiNodeAnim *nodeChannel, float ticksPerSecond, Animation::Sampler &sampler) {
|
||||||
{
|
|
||||||
const unsigned int numKeyframes = nodeChannel->mNumScalingKeys;
|
const unsigned int numKeyframes = nodeChannel->mNumScalingKeys;
|
||||||
|
|
||||||
std::vector<float> times(numKeyframes);
|
std::vector<float> times(numKeyframes);
|
||||||
|
@ -1414,8 +1402,7 @@ inline void ExtractScaleSampler(Asset& asset, std::string& animId, Ref<Buffer>&
|
||||||
sampler.interpolation = Interpolation_LINEAR;
|
sampler.interpolation = Interpolation_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ExtractRotationSampler(Asset& asset, std::string& animId, Ref<Buffer>& buffer, const aiNodeAnim* nodeChannel, float ticksPerSecond, Animation::Sampler& sampler)
|
inline void ExtractRotationSampler(Asset &asset, std::string &animId, Ref<Buffer> &buffer, const aiNodeAnim *nodeChannel, float ticksPerSecond, Animation::Sampler &sampler) {
|
||||||
{
|
|
||||||
const unsigned int numKeyframes = nodeChannel->mNumRotationKeys;
|
const unsigned int numKeyframes = nodeChannel->mNumRotationKeys;
|
||||||
|
|
||||||
std::vector<float> times(numKeyframes);
|
std::vector<float> times(numKeyframes);
|
||||||
|
@ -1435,8 +1422,7 @@ inline void ExtractRotationSampler(Asset& asset, std::string& animId, Ref<Buffer
|
||||||
sampler.interpolation = Interpolation_LINEAR;
|
sampler.interpolation = Interpolation_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddSampler(Ref<Animation>& animRef, Ref<Node>& nodeRef, Animation::Sampler& sampler, AnimationPath path)
|
static void AddSampler(Ref<Animation> &animRef, Ref<Node> &nodeRef, Animation::Sampler &sampler, AnimationPath path) {
|
||||||
{
|
|
||||||
Animation::Channel channel;
|
Animation::Channel channel;
|
||||||
channel.sampler = static_cast<int>(animRef->samplers.size());
|
channel.sampler = static_cast<int>(animRef->samplers.size());
|
||||||
channel.target.path = path;
|
channel.target.path = path;
|
||||||
|
@ -1445,8 +1431,7 @@ static void AddSampler(Ref<Animation>& animRef, Ref<Node>& nodeRef, Animation::S
|
||||||
animRef->samplers.push_back(sampler);
|
animRef->samplers.push_back(sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Exporter::ExportAnimations()
|
void glTF2Exporter::ExportAnimations() {
|
||||||
{
|
|
||||||
Ref<Buffer> bufferRef = mAsset->buffers.Get(unsigned(0));
|
Ref<Buffer> bufferRef = mAsset->buffers.Get(unsigned(0));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < mScene->mNumAnimations; ++i) {
|
for (unsigned int i = 0; i < mScene->mNumAnimations; ++i) {
|
||||||
|
@ -1468,22 +1453,19 @@ void glTF2Exporter::ExportAnimations()
|
||||||
|
|
||||||
Ref<Node> animNode = mAsset->nodes.Get(nodeChannel->mNodeName.C_Str());
|
Ref<Node> animNode = mAsset->nodes.Get(nodeChannel->mNodeName.C_Str());
|
||||||
|
|
||||||
if (nodeChannel->mNumPositionKeys > 0)
|
if (nodeChannel->mNumPositionKeys > 0) {
|
||||||
{
|
|
||||||
Animation::Sampler translationSampler;
|
Animation::Sampler translationSampler;
|
||||||
ExtractTranslationSampler(*mAsset, name, bufferRef, nodeChannel, ticksPerSecond, translationSampler);
|
ExtractTranslationSampler(*mAsset, name, bufferRef, nodeChannel, ticksPerSecond, translationSampler);
|
||||||
AddSampler(animRef, animNode, translationSampler, AnimationPath_TRANSLATION);
|
AddSampler(animRef, animNode, translationSampler, AnimationPath_TRANSLATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodeChannel->mNumRotationKeys > 0)
|
if (nodeChannel->mNumRotationKeys > 0) {
|
||||||
{
|
|
||||||
Animation::Sampler rotationSampler;
|
Animation::Sampler rotationSampler;
|
||||||
ExtractRotationSampler(*mAsset, name, bufferRef, nodeChannel, ticksPerSecond, rotationSampler);
|
ExtractRotationSampler(*mAsset, name, bufferRef, nodeChannel, ticksPerSecond, rotationSampler);
|
||||||
AddSampler(animRef, animNode, rotationSampler, AnimationPath_ROTATION);
|
AddSampler(animRef, animNode, rotationSampler, AnimationPath_ROTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodeChannel->mNumScalingKeys > 0)
|
if (nodeChannel->mNumScalingKeys > 0) {
|
||||||
{
|
|
||||||
Animation::Sampler scaleSampler;
|
Animation::Sampler scaleSampler;
|
||||||
ExtractScaleSampler(*mAsset, name, bufferRef, nodeChannel, ticksPerSecond, scaleSampler);
|
ExtractScaleSampler(*mAsset, name, bufferRef, nodeChannel, ticksPerSecond, scaleSampler);
|
||||||
AddSampler(animRef, animNode, scaleSampler, AnimationPath_SCALE);
|
AddSampler(animRef, animNode, scaleSampler, AnimationPath_SCALE);
|
||||||
|
@ -1498,6 +1480,5 @@ void glTF2Exporter::ExportAnimations()
|
||||||
} // End: for-loop mNumAnimations
|
} // End: for-loop mNumAnimations
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // ASSIMP_BUILD_NO_GLTF_EXPORTER
|
#endif // ASSIMP_BUILD_NO_GLTF_EXPORTER
|
||||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
|
@ -141,19 +141,23 @@ static aiTextureMapMode ConvertWrappingMode(SamplerWrap gltfWrapMode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetMaterialColorProperty(Asset & /*r*/, vec4 &prop, aiMaterial *mat, const char *pKey, unsigned int type, unsigned int idx) {
|
inline void SetMaterialColorProperty(Asset & /*r*/, vec4 &prop, aiMaterial *mat,
|
||||||
|
const char *pKey, unsigned int type, unsigned int idx) {
|
||||||
aiColor4D col;
|
aiColor4D col;
|
||||||
CopyValue(prop, col);
|
CopyValue(prop, col);
|
||||||
mat->AddProperty(&col, 1, pKey, type, idx);
|
mat->AddProperty(&col, 1, pKey, type, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetMaterialColorProperty(Asset & /*r*/, vec3 &prop, aiMaterial *mat, const char *pKey, unsigned int type, unsigned int idx) {
|
inline void SetMaterialColorProperty(Asset & /*r*/, vec3 &prop, aiMaterial *mat,
|
||||||
|
const char *pKey, unsigned int type, unsigned int idx) {
|
||||||
aiColor4D col;
|
aiColor4D col;
|
||||||
glTFCommon::CopyValue(prop, col);
|
glTFCommon::CopyValue(prop, col);
|
||||||
mat->AddProperty(&col, 1, pKey, type, idx);
|
mat->AddProperty(&col, 1, pKey, type, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset & /*r*/, glTF2::TextureInfo prop, aiMaterial *mat, aiTextureType texType, unsigned int texSlot = 0) {
|
inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset & /*r*/,
|
||||||
|
glTF2::TextureInfo prop, aiMaterial *mat, aiTextureType texType,
|
||||||
|
unsigned int texSlot = 0) {
|
||||||
if (prop.texture && prop.texture->source) {
|
if (prop.texture && prop.texture->source) {
|
||||||
aiString uri(prop.texture->source->uri);
|
aiString uri(prop.texture->source->uri);
|
||||||
|
|
||||||
|
@ -218,7 +222,9 @@ inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset &r, glTF2::NormalTextureInfo &prop, aiMaterial *mat, aiTextureType texType, unsigned int texSlot = 0) {
|
inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset &r,
|
||||||
|
NormalTextureInfo &prop, aiMaterial *mat, aiTextureType texType,
|
||||||
|
unsigned int texSlot = 0) {
|
||||||
SetMaterialTextureProperty(embeddedTexIdxs, r, (glTF2::TextureInfo)prop, mat, texType, texSlot);
|
SetMaterialTextureProperty(embeddedTexIdxs, r, (glTF2::TextureInfo)prop, mat, texType, texSlot);
|
||||||
|
|
||||||
if (prop.texture && prop.texture->source) {
|
if (prop.texture && prop.texture->source) {
|
||||||
|
@ -226,7 +232,9 @@ inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset &r, glTF2::OcclusionTextureInfo &prop, aiMaterial *mat, aiTextureType texType, unsigned int texSlot = 0) {
|
inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset &r,
|
||||||
|
OcclusionTextureInfo &prop, aiMaterial *mat, aiTextureType texType,
|
||||||
|
unsigned int texSlot = 0) {
|
||||||
SetMaterialTextureProperty(embeddedTexIdxs, r, (glTF2::TextureInfo)prop, mat, texType, texSlot);
|
SetMaterialTextureProperty(embeddedTexIdxs, r, (glTF2::TextureInfo)prop, mat, texType, texSlot);
|
||||||
|
|
||||||
if (prop.texture && prop.texture->source) {
|
if (prop.texture && prop.texture->source) {
|
||||||
|
@ -338,7 +346,7 @@ static aiMaterial *ImportMaterial(std::vector<int> &embeddedTexIdxs, Asset &r, M
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Importer::ImportMaterials(glTF2::Asset &r) {
|
void glTF2Importer::ImportMaterials(Asset &r) {
|
||||||
const unsigned int numImportedMaterials = unsigned(r.materials.Size());
|
const unsigned int numImportedMaterials = unsigned(r.materials.Size());
|
||||||
ASSIMP_LOG_DEBUG("Importing ", numImportedMaterials, " materials");
|
ASSIMP_LOG_DEBUG("Importing ", numImportedMaterials, " materials");
|
||||||
Material defaultMaterial;
|
Material defaultMaterial;
|
||||||
|
@ -363,7 +371,8 @@ static inline void SetFaceAndAdvance1(aiFace*& face, unsigned int numVertices, u
|
||||||
++face;
|
++face;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetFaceAndAdvance2(aiFace*& face, unsigned int numVertices, unsigned int a, unsigned int b) {
|
static inline void SetFaceAndAdvance2(aiFace*& face, unsigned int numVertices,
|
||||||
|
unsigned int a, unsigned int b) {
|
||||||
if ((a >= numVertices) || (b >= numVertices)) {
|
if ((a >= numVertices) || (b >= numVertices)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +383,8 @@ static inline void SetFaceAndAdvance2(aiFace*& face, unsigned int numVertices, u
|
||||||
++face;
|
++face;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetFaceAndAdvance3(aiFace*& face, unsigned int numVertices, unsigned int a, unsigned int b, unsigned int c) {
|
static inline void SetFaceAndAdvance3(aiFace*& face, unsigned int numVertices, unsigned int a,
|
||||||
|
unsigned int b, unsigned int c) {
|
||||||
if ((a >= numVertices) || (b >= numVertices) || (c >= numVertices)) {
|
if ((a >= numVertices) || (b >= numVertices) || (c >= numVertices)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -401,8 +411,8 @@ static inline bool CheckValidFacesIndices(aiFace *faces, unsigned nFaces, unsign
|
||||||
#endif // ASSIMP_BUILD_DEBUG
|
#endif // ASSIMP_BUILD_DEBUG
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
aiColor4D* GetVertexColorsForType(glTF2::Ref<glTF2::Accessor> input) {
|
aiColor4D* GetVertexColorsForType(Ref<Accessor> input) {
|
||||||
float max = std::numeric_limits<T>::max();
|
constexpr float max = std::numeric_limits<T>::max();
|
||||||
aiColor4t<T>* colors;
|
aiColor4t<T>* colors;
|
||||||
input->ExtractData(colors);
|
input->ExtractData(colors);
|
||||||
auto output = new aiColor4D[input->count];
|
auto output = new aiColor4D[input->count];
|
||||||
|
@ -463,19 +473,19 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
|
||||||
|
|
||||||
Mesh::Primitive::Attributes &attr = prim.attributes;
|
Mesh::Primitive::Attributes &attr = prim.attributes;
|
||||||
|
|
||||||
if (attr.position.size() > 0 && attr.position[0]) {
|
if (!attr.position.empty() && attr.position[0]) {
|
||||||
aim->mNumVertices = static_cast<unsigned int>(attr.position[0]->count);
|
aim->mNumVertices = static_cast<unsigned int>(attr.position[0]->count);
|
||||||
attr.position[0]->ExtractData(aim->mVertices);
|
attr.position[0]->ExtractData(aim->mVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr.normal.size() > 0 && attr.normal[0]) {
|
if (!attr.normal.empty() && attr.normal[0]) {
|
||||||
if (attr.normal[0]->count != aim->mNumVertices) {
|
if (attr.normal[0]->count != aim->mNumVertices) {
|
||||||
DefaultLogger::get()->warn("Normal count in mesh \"", mesh.name, "\" does not match the vertex count, normals ignored.");
|
DefaultLogger::get()->warn("Normal count in mesh \"", mesh.name, "\" does not match the vertex count, normals ignored.");
|
||||||
} else {
|
} else {
|
||||||
attr.normal[0]->ExtractData(aim->mNormals);
|
attr.normal[0]->ExtractData(aim->mNormals);
|
||||||
|
|
||||||
// only extract tangents if normals are present
|
// only extract tangents if normals are present
|
||||||
if (attr.tangent.size() > 0 && attr.tangent[0]) {
|
if (!attr.tangent.empty() && attr.tangent[0]) {
|
||||||
if (attr.tangent[0]->count != aim->mNumVertices) {
|
if (attr.tangent[0]->count != aim->mNumVertices) {
|
||||||
DefaultLogger::get()->warn("Tangent count in mesh \"", mesh.name, "\" does not match the vertex count, tangents ignored.");
|
DefaultLogger::get()->warn("Tangent count in mesh \"", mesh.name, "\" does not match the vertex count, tangents ignored.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -538,7 +548,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Mesh::Primitive::Target> &targets = prim.targets;
|
std::vector<Mesh::Primitive::Target> &targets = prim.targets;
|
||||||
if (targets.size() > 0) {
|
if (!targets.empty()) {
|
||||||
aim->mNumAnimMeshes = (unsigned int)targets.size();
|
aim->mNumAnimMeshes = (unsigned int)targets.size();
|
||||||
aim->mAnimMeshes = new aiAnimMesh *[aim->mNumAnimMeshes];
|
aim->mAnimMeshes = new aiAnimMesh *[aim->mNumAnimMeshes];
|
||||||
std::fill(aim->mAnimMeshes, aim->mAnimMeshes + aim->mNumAnimMeshes, nullptr);
|
std::fill(aim->mAnimMeshes, aim->mAnimMeshes + aim->mNumAnimMeshes, nullptr);
|
||||||
|
@ -797,7 +807,9 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Importer::ImportCameras(glTF2::Asset &r) {
|
void glTF2Importer::ImportCameras(glTF2::Asset &r) {
|
||||||
if (!r.cameras.Size()) return;
|
if (!r.cameras.Size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const unsigned int numCameras = r.cameras.Size();
|
const unsigned int numCameras = r.cameras.Size();
|
||||||
ASSIMP_LOG_DEBUG("Importing ", numCameras, " cameras");
|
ASSIMP_LOG_DEBUG("Importing ", numCameras, " cameras");
|
||||||
|
@ -897,7 +909,9 @@ void glTF2Importer::ImportLights(glTF2::Asset &r) {
|
||||||
static void GetNodeTransform(aiMatrix4x4 &matrix, const glTF2::Node &node) {
|
static void GetNodeTransform(aiMatrix4x4 &matrix, const glTF2::Node &node) {
|
||||||
if (node.matrix.isPresent) {
|
if (node.matrix.isPresent) {
|
||||||
CopyValue(node.matrix.value, matrix);
|
CopyValue(node.matrix.value, matrix);
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (node.translation.isPresent) {
|
if (node.translation.isPresent) {
|
||||||
aiVector3D trans;
|
aiVector3D trans;
|
||||||
CopyValue(node.translation.value, trans);
|
CopyValue(node.translation.value, trans);
|
||||||
|
@ -920,7 +934,6 @@ static void GetNodeTransform(aiMatrix4x4 &matrix, const glTF2::Node &node) {
|
||||||
matrix = matrix * s;
|
matrix = matrix * s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void BuildVertexWeightMapping(Mesh::Primitive &primitive, std::vector<std::vector<aiVertexWeight>> &map) {
|
static void BuildVertexWeightMapping(Mesh::Primitive &primitive, std::vector<std::vector<aiVertexWeight>> &map) {
|
||||||
Mesh::Primitive::Attributes &attr = primitive.attributes;
|
Mesh::Primitive::Attributes &attr = primitive.attributes;
|
||||||
|
@ -981,21 +994,21 @@ static std::string GetNodeName(const Node &node) {
|
||||||
|
|
||||||
void ParseExtensions(aiMetadata *metadata, const CustomExtension &extension) {
|
void ParseExtensions(aiMetadata *metadata, const CustomExtension &extension) {
|
||||||
if (extension.mStringValue.isPresent) {
|
if (extension.mStringValue.isPresent) {
|
||||||
metadata->Add(extension.name.c_str(), aiString(extension.mStringValue.value));
|
metadata->Add(extension.name, aiString(extension.mStringValue.value));
|
||||||
} else if (extension.mDoubleValue.isPresent) {
|
} else if (extension.mDoubleValue.isPresent) {
|
||||||
metadata->Add(extension.name.c_str(), extension.mDoubleValue.value);
|
metadata->Add(extension.name, extension.mDoubleValue.value);
|
||||||
} else if (extension.mUint64Value.isPresent) {
|
} else if (extension.mUint64Value.isPresent) {
|
||||||
metadata->Add(extension.name.c_str(), extension.mUint64Value.value);
|
metadata->Add(extension.name, extension.mUint64Value.value);
|
||||||
} else if (extension.mInt64Value.isPresent) {
|
} else if (extension.mInt64Value.isPresent) {
|
||||||
metadata->Add(extension.name.c_str(), static_cast<int32_t>(extension.mInt64Value.value));
|
metadata->Add(extension.name, static_cast<int32_t>(extension.mInt64Value.value));
|
||||||
} else if (extension.mBoolValue.isPresent) {
|
} else if (extension.mBoolValue.isPresent) {
|
||||||
metadata->Add(extension.name.c_str(), extension.mBoolValue.value);
|
metadata->Add(extension.name, extension.mBoolValue.value);
|
||||||
} else if (extension.mValues.isPresent) {
|
} else if (extension.mValues.isPresent) {
|
||||||
aiMetadata val;
|
aiMetadata val;
|
||||||
for (auto const & subExtension : extension.mValues.value) {
|
for (auto const & subExtension : extension.mValues.value) {
|
||||||
ParseExtensions(&val, subExtension);
|
ParseExtensions(&val, subExtension);
|
||||||
}
|
}
|
||||||
metadata->Add(extension.name.c_str(), val);
|
metadata->Add(extension.name, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1041,7 +1054,9 @@ aiNode *ImportNode(aiScene *pScene, glTF2::Asset &r, std::vector<unsigned int> &
|
||||||
// GLTF files contain at most 1 mesh per node.
|
// GLTF files contain at most 1 mesh per node.
|
||||||
if (node.meshes.size() > 1)
|
if (node.meshes.size() > 1)
|
||||||
{
|
{
|
||||||
throw DeadlyImportError("GLTF: Invalid input, found ", node.meshes.size(), " meshes in ", getContextForErrorMessages(node.id, node.name), ", but only 1 mesh per node allowed.");
|
throw DeadlyImportError("GLTF: Invalid input, found ", node.meshes.size(),
|
||||||
|
" meshes in ", getContextForErrorMessages(node.id, node.name),
|
||||||
|
", but only 1 mesh per node allowed.");
|
||||||
}
|
}
|
||||||
int mesh_idx = node.meshes[0].GetIndex();
|
int mesh_idx = node.meshes[0].GetIndex();
|
||||||
int count = meshOffsets[mesh_idx + 1] - meshOffsets[mesh_idx];
|
int count = meshOffsets[mesh_idx + 1] - meshOffsets[mesh_idx];
|
||||||
|
@ -1284,7 +1299,7 @@ aiNodeAnim *CreateNodeAnim(glTF2::Asset&, Node &node, AnimationSamplers &sampler
|
||||||
}
|
}
|
||||||
|
|
||||||
aiMeshMorphAnim *CreateMeshMorphAnim(glTF2::Asset&, Node &node, AnimationSamplers &samplers) {
|
aiMeshMorphAnim *CreateMeshMorphAnim(glTF2::Asset&, Node &node, AnimationSamplers &samplers) {
|
||||||
aiMeshMorphAnim *anim = new aiMeshMorphAnim();
|
auto *anim = new aiMeshMorphAnim();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
anim->mName = GetNodeName(node);
|
anim->mName = GetNodeName(node);
|
||||||
|
@ -1432,7 +1447,7 @@ void glTF2Importer::ImportAnimations(glTF2::Asset &r) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the latest keyframe for the duration of the animation
|
// Use the latest key-frame for the duration of the animation
|
||||||
double maxDuration = 0;
|
double maxDuration = 0;
|
||||||
unsigned int maxNumberOfKeys = 0;
|
unsigned int maxNumberOfKeys = 0;
|
||||||
for (unsigned int j = 0; j < ai_anim->mNumChannels; ++j) {
|
for (unsigned int j = 0; j < ai_anim->mNumChannels; ++j) {
|
||||||
|
@ -1563,7 +1578,6 @@ void glTF2Importer::ImportCommonMetadata(glTF2::Asset& a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void glTF2Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
void glTF2Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||||
|
|
||||||
ASSIMP_LOG_DEBUG("Reading GLTF2 file");
|
ASSIMP_LOG_DEBUG("Reading GLTF2 file");
|
||||||
|
|
||||||
// clean all member arrays
|
// clean all member arrays
|
||||||
|
@ -1579,10 +1593,7 @@ void glTF2Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IO
|
||||||
pScene->mName = asset.scene->name;
|
pScene->mName = asset.scene->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Copy the data out
|
// Copy the data out
|
||||||
//
|
|
||||||
|
|
||||||
ImportEmbeddedTextures(asset);
|
ImportEmbeddedTextures(asset);
|
||||||
ImportMaterials(asset);
|
ImportMaterials(asset);
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
|
|
||||||
|
namespace glTF2 {
|
||||||
namespace glTF2
|
|
||||||
{
|
|
||||||
class Asset;
|
class Asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,21 +60,14 @@ namespace Assimp {
|
||||||
class glTF2Importer : public BaseImporter {
|
class glTF2Importer : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
glTF2Importer();
|
glTF2Importer();
|
||||||
virtual ~glTF2Importer();
|
~glTF2Importer() override;
|
||||||
virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const;
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const aiImporterDesc* GetInfo() const;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
virtual void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler );
|
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<unsigned int> meshOffsets;
|
|
||||||
|
|
||||||
std::vector<int> embeddedTexIdxs;
|
|
||||||
|
|
||||||
aiScene* mScene;
|
|
||||||
|
|
||||||
void ImportEmbeddedTextures(glTF2::Asset &a);
|
void ImportEmbeddedTextures(glTF2::Asset &a);
|
||||||
void ImportMaterials(glTF2::Asset &a);
|
void ImportMaterials(glTF2::Asset &a);
|
||||||
void ImportMeshes(glTF2::Asset &a);
|
void ImportMeshes(glTF2::Asset &a);
|
||||||
|
@ -85,9 +76,13 @@ private:
|
||||||
void ImportNodes(glTF2::Asset &a);
|
void ImportNodes(glTF2::Asset &a);
|
||||||
void ImportAnimations(glTF2::Asset &a);
|
void ImportAnimations(glTF2::Asset &a);
|
||||||
void ImportCommonMetadata(glTF2::Asset &a);
|
void ImportCommonMetadata(glTF2::Asset &a);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<unsigned int> meshOffsets;
|
||||||
|
std::vector<int> embeddedTexIdxs;
|
||||||
|
aiScene *mScene;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace assimp
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // AI_GLTF2IMPORTER_H_INC
|
#endif // AI_GLTF2IMPORTER_H_INC
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,6 @@ SET( PUBLIC_HEADERS
|
||||||
${HEADER_PATH}/ColladaMetaData.h
|
${HEADER_PATH}/ColladaMetaData.h
|
||||||
${HEADER_PATH}/commonMetaData.h
|
${HEADER_PATH}/commonMetaData.h
|
||||||
${HEADER_PATH}/defs.h
|
${HEADER_PATH}/defs.h
|
||||||
${HEADER_PATH}/Defines.h
|
|
||||||
${HEADER_PATH}/cfileio.h
|
${HEADER_PATH}/cfileio.h
|
||||||
${HEADER_PATH}/light.h
|
${HEADER_PATH}/light.h
|
||||||
${HEADER_PATH}/material.h
|
${HEADER_PATH}/material.h
|
||||||
|
|
|
@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assimp/StandardShapes.h>
|
#include <assimp/StandardShapes.h>
|
||||||
#include <assimp/Defines.h>
|
|
||||||
#include <assimp/StringComparison.h>
|
#include <assimp/StringComparison.h>
|
||||||
#include <assimp/mesh.h>
|
#include <assimp/mesh.h>
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_BLOBIOSYSTEM_H_INCLUDED
|
#ifndef AI_BLOBIOSYSTEM_H_INCLUDED
|
||||||
#define AI_BLOBIOSYSTEM_H_INCLUDED
|
#define AI_BLOBIOSYSTEM_H_INCLUDED
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <assimp/cexport.h>
|
#include <assimp/cexport.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/IOStream.hpp>
|
#include <assimp/IOStream.hpp>
|
||||||
|
|
|
@ -46,6 +46,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_COLLADAMETADATA_H_INC
|
#ifndef AI_COLLADAMETADATA_H_INC
|
||||||
#define AI_COLLADAMETADATA_H_INC
|
#define AI_COLLADAMETADATA_H_INC
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#define AI_METADATA_COLLADA_ID "Collada_id"
|
#define AI_METADATA_COLLADA_ID "Collada_id"
|
||||||
#define AI_METADATA_COLLADA_SID "Collada_sid"
|
#define AI_METADATA_COLLADA_SID "Collada_sid"
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @file Default file I/O using fXXX()-family of functions */
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief Default file I/O using fXXX()-family of functions
|
||||||
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#ifndef AI_DEFAULTIOSTREAM_H_INC
|
#ifndef AI_DEFAULTIOSTREAM_H_INC
|
||||||
#define AI_DEFAULTIOSTREAM_H_INC
|
#define AI_DEFAULTIOSTREAM_H_INC
|
||||||
|
@ -48,10 +51,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <assimp/IOStream.hpp>
|
#include <assimp/IOStream.hpp>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include <assimp/Defines.h>
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
@ -72,7 +74,12 @@ class ASSIMP_API DefaultIOStream : public IOStream {
|
||||||
#endif // __ANDROID__
|
#endif // __ANDROID__
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/// @brief
|
||||||
DefaultIOStream() AI_NO_EXCEPT;
|
DefaultIOStream() AI_NO_EXCEPT;
|
||||||
|
|
||||||
|
/// @brief The class constructor with the file name and the stream.
|
||||||
|
/// @param pFile The file-streaam
|
||||||
|
/// @param strFilename The file name
|
||||||
DefaultIOStream(FILE* pFile, const std::string &strFilename);
|
DefaultIOStream(FILE* pFile, const std::string &strFilename);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -39,7 +39,9 @@ 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
|
||||||
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#ifndef AI_DEFAULTIOSYSTEM_H_INC
|
#ifndef AI_DEFAULTIOSYSTEM_H_INC
|
||||||
#define AI_DEFAULTIOSYSTEM_H_INC
|
#define AI_DEFAULTIOSYSTEM_H_INC
|
||||||
|
|
|
@ -38,7 +38,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
/** @file DefaultLogger.hpp
|
|
||||||
|
/**
|
||||||
|
* @file DefaultLogger.hpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
Open Asset Import Library (assimp)
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006-2021, 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
|
|
||||||
#ifndef AI_DEFINES_H_INC
|
|
||||||
#define AI_DEFINES_H_INC
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
# pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// We need those constants, workaround for any platforms where nobody defined them yet
|
|
||||||
#if (!defined SIZE_MAX)
|
|
||||||
# define SIZE_MAX (~((size_t)0))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (!defined UINT_MAX)
|
|
||||||
# define UINT_MAX (~((unsigned int)0))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // AI_DEINES_H_INC
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -48,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <assimp/ParsingUtils.h>
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
#include <assimp/IOStream.hpp>
|
#include <assimp/IOStream.hpp>
|
||||||
#include <assimp/ParsingUtils.h>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -129,28 +128,25 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE IOStreamBuffer<T>::IOStreamBuffer(size_t cache) :
|
||||||
IOStreamBuffer<T>::IOStreamBuffer( size_t cache )
|
m_stream(nullptr),
|
||||||
: m_stream( nullptr )
|
m_filesize(0),
|
||||||
, m_filesize( 0 )
|
m_cacheSize(cache),
|
||||||
, m_cacheSize( cache )
|
m_numBlocks(0),
|
||||||
, m_numBlocks( 0 )
|
m_blockIdx(0),
|
||||||
, m_blockIdx( 0 )
|
m_cachePos(0),
|
||||||
, m_cachePos( 0 )
|
m_filePos(0) {
|
||||||
, m_filePos( 0 ) {
|
|
||||||
m_cache.resize(cache);
|
m_cache.resize(cache);
|
||||||
std::fill(m_cache.begin(), m_cache.end(), '\n');
|
std::fill(m_cache.begin(), m_cache.end(), '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE IOStreamBuffer<T>::~IOStreamBuffer() {
|
||||||
IOStreamBuffer<T>::~IOStreamBuffer() {
|
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE bool IOStreamBuffer<T>::open(IOStream *stream) {
|
||||||
bool IOStreamBuffer<T>::open( IOStream *stream ) {
|
|
||||||
// file still opened!
|
// file still opened!
|
||||||
if (nullptr != m_stream) {
|
if (nullptr != m_stream) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -179,8 +175,7 @@ bool IOStreamBuffer<T>::open( IOStream *stream ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE bool IOStreamBuffer<T>::close() {
|
||||||
bool IOStreamBuffer<T>::close() {
|
|
||||||
if (nullptr == m_stream) {
|
if (nullptr == m_stream) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -198,19 +193,20 @@ bool IOStreamBuffer<T>::close() {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE
|
||||||
size_t IOStreamBuffer<T>::size() const {
|
size_t
|
||||||
|
IOStreamBuffer<T>::size() const {
|
||||||
return m_filesize;
|
return m_filesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE
|
||||||
size_t IOStreamBuffer<T>::cacheSize() const {
|
size_t
|
||||||
|
IOStreamBuffer<T>::cacheSize() const {
|
||||||
return m_cacheSize;
|
return m_cacheSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE bool IOStreamBuffer<T>::readNextBlock() {
|
||||||
bool IOStreamBuffer<T>::readNextBlock() {
|
|
||||||
m_stream->Seek(m_filePos, aiOrigin_SET);
|
m_stream->Seek(m_filePos, aiOrigin_SET);
|
||||||
size_t readLen = m_stream->Read(&m_cache[0], sizeof(T), m_cacheSize);
|
size_t readLen = m_stream->Read(&m_cache[0], sizeof(T), m_cacheSize);
|
||||||
if (readLen == 0) {
|
if (readLen == 0) {
|
||||||
|
@ -227,26 +223,22 @@ bool IOStreamBuffer<T>::readNextBlock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE size_t IOStreamBuffer<T>::getNumBlocks() const {
|
||||||
size_t IOStreamBuffer<T>::getNumBlocks() const {
|
|
||||||
return m_numBlocks;
|
return m_numBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE size_t IOStreamBuffer<T>::getCurrentBlockIndex() const {
|
||||||
size_t IOStreamBuffer<T>::getCurrentBlockIndex() const {
|
|
||||||
return m_blockIdx;
|
return m_blockIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE size_t IOStreamBuffer<T>::getFilePos() const {
|
||||||
size_t IOStreamBuffer<T>::getFilePos() const {
|
|
||||||
return m_filePos;
|
return m_filePos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE bool IOStreamBuffer<T>::getNextDataLine(std::vector<T> &buffer, T continuationToken) {
|
||||||
bool IOStreamBuffer<T>::getNextDataLine( std::vector<T> &buffer, T continuationToken ) {
|
|
||||||
buffer.resize(m_cacheSize);
|
buffer.resize(m_cacheSize);
|
||||||
if (m_cachePos >= m_cacheSize || 0 == m_filePos) {
|
if (m_cachePos >= m_cacheSize || 0 == m_filePos) {
|
||||||
if (!readNextBlock()) {
|
if (!readNextBlock()) {
|
||||||
|
@ -285,14 +277,12 @@ bool IOStreamBuffer<T>::getNextDataLine( std::vector<T> &buffer, T continuationT
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AI_FORCE_INLINE
|
static AI_FORCE_INLINE bool isEndOfCache(size_t pos, size_t cacheSize) {
|
||||||
bool isEndOfCache( size_t pos, size_t cacheSize ) {
|
|
||||||
return (pos == cacheSize);
|
return (pos == cacheSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE bool IOStreamBuffer<T>::getNextLine(std::vector<T> &buffer) {
|
||||||
bool IOStreamBuffer<T>::getNextLine(std::vector<T> &buffer) {
|
|
||||||
buffer.resize(m_cacheSize);
|
buffer.resize(m_cacheSize);
|
||||||
if (isEndOfCache(m_cachePos, m_cacheSize) || 0 == m_filePos) {
|
if (isEndOfCache(m_cachePos, m_cacheSize) || 0 == m_filePos) {
|
||||||
if (!readNextBlock()) {
|
if (!readNextBlock()) {
|
||||||
|
@ -331,8 +321,7 @@ bool IOStreamBuffer<T>::getNextLine(std::vector<T> &buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE
|
AI_FORCE_INLINE bool IOStreamBuffer<T>::getNextBlock(std::vector<T> &buffer) {
|
||||||
bool IOStreamBuffer<T>::getNextBlock( std::vector<T> &buffer) {
|
|
||||||
// Return the last block-value if getNextLine was used before
|
// Return the last block-value if getNextLine was used before
|
||||||
if (0 != m_cachePos) {
|
if (0 != m_cachePos) {
|
||||||
buffer = std::vector<T>(m_cache.begin() + m_cachePos, m_cache.end());
|
buffer = std::vector<T>(m_cache.begin() + m_cachePos, m_cache.end());
|
||||||
|
@ -348,6 +337,6 @@ bool IOStreamBuffer<T>::getNextBlock( std::vector<T> &buffer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // !ns Assimp
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // AI_IOSTREAMBUFFER_H_INC
|
#endif // AI_IOSTREAMBUFFER_H_INC
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -57,6 +56,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
/// @brief Logger class, which will exten the class by log-functions.
|
||||||
|
/// @tparam TDeriving
|
||||||
template<class TDeriving>
|
template<class TDeriving>
|
||||||
class LogFunctions {
|
class LogFunctions {
|
||||||
public:
|
public:
|
||||||
|
@ -109,8 +110,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char* Prefix();
|
static const char* Prefix();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // ! Assimp
|
} // ! Assimp
|
||||||
|
|
||||||
#endif
|
#endif // INCLUDED_AI_LOGAUX_H
|
||||||
|
|
|
@ -51,12 +51,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assimp/Defines.h>
|
|
||||||
#include <assimp/ai_assert.h>
|
#include <assimp/ai_assert.h>
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <cstddef>
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assimp/ByteSwapper.h>
|
#include <assimp/ByteSwapper.h>
|
||||||
#include <assimp/Defines.h>
|
|
||||||
#include <assimp/Exceptional.h>
|
#include <assimp/Exceptional.h>
|
||||||
#include <assimp/IOStream.hpp>
|
#include <assimp/IOStream.hpp>
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_COMMONMETADATA_H_INC
|
#ifndef AI_COMMONMETADATA_H_INC
|
||||||
#define AI_COMMONMETADATA_H_INC
|
#define AI_COMMONMETADATA_H_INC
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Scene metadata holding the name of the importer which loaded the source asset.
|
/// Scene metadata holding the name of the importer which loaded the source asset.
|
||||||
/// This is always present if the scene was created from an imported asset.
|
/// This is always present if the scene was created from an imported asset.
|
||||||
#define AI_METADATA_SOURCE_FORMAT "SourceAsset_Format"
|
#define AI_METADATA_SOURCE_FORMAT "SourceAsset_Format"
|
||||||
|
|
|
@ -93,6 +93,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define ASSIMP_BUILD_NEED_UNZIP
|
#define ASSIMP_BUILD_NEED_UNZIP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// We need those constants, workaround for any platforms where nobody defined them yet
|
||||||
|
#if (!defined SIZE_MAX)
|
||||||
|
#define SIZE_MAX (~((size_t)0))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*#if (!defined UINT_MAX)
|
||||||
|
#define UINT_MAX (~((unsigned int)0))
|
||||||
|
#endif*/
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific
|
/* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific
|
||||||
* post processing step. This is the current list of process names ('XX'):
|
* post processing step. This is the current list of process names ('XX'):
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue