Fix namespaces.
parent
8cf2d6e588
commit
4535e37fc6
|
@ -52,9 +52,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
|
|
||||||
static const unsigned int NotSet = 0xcdcdcdcd;
|
static constexpr unsigned int NotSet = 0xcdcdcdcd;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Setup final material indices, generae a default material if necessary
|
// Setup final material indices, generae a default material if necessary
|
||||||
|
@ -805,4 +805,6 @@ void Discreet3DSImporter::ConvertScene(aiScene *pcOut) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2022, 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,8 +56,7 @@ struct aiNode;
|
||||||
struct aiMaterial;
|
struct aiMaterial;
|
||||||
struct aiMesh;
|
struct aiMesh;
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +86,7 @@ private:
|
||||||
|
|
||||||
std::map<const aiNode*, aiMatrix4x4> trafos;
|
std::map<const aiNode*, aiMatrix4x4> trafos;
|
||||||
|
|
||||||
typedef std::multimap<const aiNode*, unsigned int> MeshesByNodeMap;
|
using MeshesByNodeMap = std::multimap<const aiNode*, unsigned int>;
|
||||||
MeshesByNodeMap meshes;
|
MeshesByNodeMap meshes;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
|
|
||||||
static constexpr aiImporterDesc desc = {
|
static constexpr aiImporterDesc desc = {
|
||||||
"Discreet 3DS Importer",
|
"Discreet 3DS Importer",
|
||||||
|
@ -1335,4 +1335,6 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) {
|
||||||
(void)bGamma;
|
(void)bGamma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||||
|
|
|
@ -81,10 +81,6 @@ static constexpr aiImporterDesc desc = {
|
||||||
"3mf"
|
"3mf"
|
||||||
};
|
};
|
||||||
|
|
||||||
D3MFImporter::D3MFImporter() = default;
|
|
||||||
|
|
||||||
D3MFImporter::~D3MFImporter() = default;
|
|
||||||
|
|
||||||
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||||
if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
|
if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -56,10 +56,10 @@ namespace Assimp {
|
||||||
class D3MFImporter : public BaseImporter {
|
class D3MFImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
/// @brief The default class constructor.
|
/// @brief The default class constructor.
|
||||||
D3MFImporter();
|
D3MFImporter() = default;
|
||||||
|
|
||||||
/// @brief The class destructor.
|
/// @brief The class destructor.
|
||||||
~D3MFImporter() override;
|
~D3MFImporter() override = default;
|
||||||
|
|
||||||
/// @brief Performs the data format detection.
|
/// @brief Performs the data format detection.
|
||||||
/// @param pFile The filename to check.
|
/// @param pFile The filename to check.
|
||||||
|
|
|
@ -68,7 +68,7 @@ using OpcPackageRelationshipPtr = std::shared_ptr<OpcPackageRelationship>;
|
||||||
class OpcPackageRelationshipReader {
|
class OpcPackageRelationshipReader {
|
||||||
public:
|
public:
|
||||||
OpcPackageRelationshipReader(XmlParser &parser) :
|
OpcPackageRelationshipReader(XmlParser &parser) :
|
||||||
m_relationShips() {
|
mRelations() {
|
||||||
XmlNode root = parser.getRootNode();
|
XmlNode root = parser.getRootNode();
|
||||||
ParseRootNode(root);
|
ParseRootNode(root);
|
||||||
}
|
}
|
||||||
|
@ -108,13 +108,13 @@ public:
|
||||||
relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE).as_string();
|
relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE).as_string();
|
||||||
relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET).as_string();
|
relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET).as_string();
|
||||||
if (validateRels(relPtr)) {
|
if (validateRels(relPtr)) {
|
||||||
m_relationShips.push_back(relPtr);
|
mRelations.push_back(relPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<OpcPackageRelationshipPtr> m_relationShips;
|
std::vector<OpcPackageRelationshipPtr> mRelations;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool IsEmbeddedTexture( const std::string &filename ) {
|
static bool IsEmbeddedTexture( const std::string &filename ) {
|
||||||
|
@ -217,11 +217,11 @@ std::string D3MFOpcPackage::ReadPackageRootRelationship(IOStream *stream) {
|
||||||
|
|
||||||
OpcPackageRelationshipReader reader(xmlParser);
|
OpcPackageRelationshipReader reader(xmlParser);
|
||||||
|
|
||||||
auto itr = std::find_if(reader.m_relationShips.begin(), reader.m_relationShips.end(), [](const OpcPackageRelationshipPtr &rel) {
|
auto itr = std::find_if(reader.mRelations.begin(), reader.mRelations.end(), [](const OpcPackageRelationshipPtr &rel) {
|
||||||
return rel->type == XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE;
|
return rel->type == XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (itr == reader.m_relationShips.end()) {
|
if (itr == reader.mRelations.end()) {
|
||||||
throw DeadlyImportError("Cannot find ", XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE);
|
throw DeadlyImportError("Cannot find ", XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,12 +49,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace D3MF {
|
namespace D3MF {
|
||||||
|
|
||||||
static const int IdNotSet = -1;
|
static constexpr int IdNotSet = -1;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static const size_t ColRGBA_Len = 9;
|
static constexpr size_t ColRGBA_Len = 9;
|
||||||
static const size_t ColRGB_Len = 7;
|
static constexpr size_t ColRGB_Len = 7;
|
||||||
|
|
||||||
// format of the color string: #RRGGBBAA or #RRGGBB (3MF Core chapter 5.1.1)
|
// format of the color string: #RRGGBBAA or #RRGGBB (3MF Core chapter 5.1.1)
|
||||||
bool validateColorString(const char *color) {
|
bool validateColorString(const char *color) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
|
|
||||||
static constexpr aiImporterDesc desc = {
|
static constexpr aiImporterDesc desc = {
|
||||||
"AC3D Importer",
|
"AC3D Importer",
|
||||||
|
@ -862,4 +862,6 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif //!defined ASSIMP_BUILD_NO_AC_IMPORTER
|
#endif //!defined ASSIMP_BUILD_NO_AC_IMPORTER
|
||||||
|
|
|
@ -63,7 +63,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// utilities
|
// utilities
|
||||||
#include <assimp/fast_atof.h>
|
#include <assimp/fast_atof.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
using namespace Assimp::ASE;
|
using namespace Assimp::ASE;
|
||||||
|
|
||||||
static constexpr aiImporterDesc desc = {
|
static constexpr aiImporterDesc desc = {
|
||||||
|
@ -1262,6 +1262,8 @@ bool ASEImporter::GenerateNormals(ASE::Mesh &mesh) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER
|
||||||
|
|
|
@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/fast_atof.h>
|
#include <assimp/fast_atof.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
using namespace Assimp::ASE;
|
using namespace Assimp::ASE;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -1864,6 +1864,8 @@ void Parser::ParseLV4MeshLong(unsigned int &iOut) {
|
||||||
iOut = strtoul10(filePtr, &filePtr);
|
iOut = strtoul10(filePtr, &filePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER
|
||||||
|
|
|
@ -59,7 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static constexpr aiImporterDesc desc = {
|
static constexpr aiImporterDesc desc = {
|
||||||
|
@ -738,4 +738,6 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
|
||||||
flip.Execute(scene);
|
flip.Execute(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_B3D_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_B3D_IMPORTER
|
||||||
|
|
|
@ -55,7 +55,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
|
|
||||||
using namespace Assimp::Formatter;
|
using namespace Assimp::Formatter;
|
||||||
|
|
||||||
static constexpr aiImporterDesc desc = {
|
static constexpr aiImporterDesc desc = {
|
||||||
|
@ -487,24 +488,21 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
||||||
aiMatrix3x3 rotMatrix;
|
aiMatrix3x3 rotMatrix;
|
||||||
for (unsigned int channelIdx = 0; channelIdx < node.mChannels.size(); ++channelIdx) {
|
for (unsigned int channelIdx = 0; channelIdx < node.mChannels.size(); ++channelIdx) {
|
||||||
switch (node.mChannels[channelIdx]) {
|
switch (node.mChannels[channelIdx]) {
|
||||||
case Channel_RotationX:
|
case Channel_RotationX: {
|
||||||
{
|
|
||||||
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
||||||
aiMatrix4x4::RotationX( angle, temp); rotMatrix *= aiMatrix3x3( temp);
|
aiMatrix4x4::RotationX(angle, temp);
|
||||||
}
|
rotMatrix *= aiMatrix3x3(temp);
|
||||||
break;
|
} break;
|
||||||
case Channel_RotationY:
|
case Channel_RotationY: {
|
||||||
{
|
|
||||||
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
||||||
aiMatrix4x4::RotationY( angle, temp); rotMatrix *= aiMatrix3x3( temp);
|
aiMatrix4x4::RotationY(angle, temp);
|
||||||
}
|
rotMatrix *= aiMatrix3x3(temp);
|
||||||
break;
|
} break;
|
||||||
case Channel_RotationZ:
|
case Channel_RotationZ: {
|
||||||
{
|
|
||||||
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
||||||
aiMatrix4x4::RotationZ( angle, temp); rotMatrix *= aiMatrix3x3( temp);
|
aiMatrix4x4::RotationZ(angle, temp);
|
||||||
}
|
rotMatrix *= aiMatrix3x3(temp);
|
||||||
break;
|
} break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -525,4 +523,6 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_BVH_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_BVH_IMPORTER
|
||||||
|
|
|
@ -61,7 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
using namespace Assimp::COB;
|
using namespace Assimp::COB;
|
||||||
using namespace Assimp::Formatter;
|
using namespace Assimp::Formatter;
|
||||||
|
|
||||||
|
@ -1164,4 +1164,6 @@ void COBImporter::ReadUnit_Binary(COB::Scene &out, StreamReaderLE &reader, const
|
||||||
ASSIMP_LOG_WARN("`Unit` chunk ", nfo.id, " is a child of ", nfo.parent_id, " which does not exist");
|
ASSIMP_LOG_WARN("`Unit` chunk ", nfo.id, " is a child of ", nfo.parent_id, " which does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // ASSIMP_BUILD_NO_COB_IMPORTER
|
#endif // ASSIMP_BUILD_NO_COB_IMPORTER
|
||||||
|
|
|
@ -64,9 +64,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define strtok_s strtok_r
|
#define strtok_s strtok_r
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static constexpr aiImporterDesc desc = {
|
||||||
"Valve SMD Importer",
|
"Valve SMD Importer",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
@ -1077,4 +1077,6 @@ void SMDImporter::ParseVertex(const char* szCurrent,
|
||||||
SMDI_PARSE_RETURN;
|
SMDI_PARSE_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_SMD_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_SMD_IMPORTER
|
||||||
|
|
|
@ -52,11 +52,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/IOSystem.hpp>
|
#include <assimp/IOSystem.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static constexpr aiImporterDesc desc = {
|
||||||
"Stereolithography (STL) Importer",
|
"Stereolithography (STL) Importer",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
@ -250,7 +250,7 @@ void STLImporter::LoadASCIIFile(aiNode *root) {
|
||||||
sz += 5; // skip the "solid"
|
sz += 5; // skip the "solid"
|
||||||
SkipSpaces(&sz);
|
SkipSpaces(&sz);
|
||||||
const char *szMe = sz;
|
const char *szMe = sz;
|
||||||
while (!::IsSpaceOrNewLine(*sz)) {
|
while (!IsSpaceOrNewLine(*sz)) {
|
||||||
sz++;
|
sz++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ void STLImporter::LoadASCIIFile(aiNode *root) {
|
||||||
normalBuffer.emplace_back(vn);
|
normalBuffer.emplace_back(vn);
|
||||||
normalBuffer.emplace_back(vn);
|
normalBuffer.emplace_back(vn);
|
||||||
}
|
}
|
||||||
} else if (!strncmp(sz, "vertex", 6) && ::IsSpaceOrNewLine(*(sz + 6))) { // vertex 1.50000 1.50000 0.00000
|
} else if (!strncmp(sz, "vertex", 6) && IsSpaceOrNewLine(*(sz + 6))) { // vertex 1.50000 1.50000 0.00000
|
||||||
if (faceVertexCounter >= 3) {
|
if (faceVertexCounter >= 3) {
|
||||||
ASSIMP_LOG_ERROR("STL: a facet with more than 3 vertices has been found");
|
ASSIMP_LOG_ERROR("STL: a facet with more than 3 vertices has been found");
|
||||||
++sz;
|
++sz;
|
||||||
|
@ -325,14 +325,14 @@ void STLImporter::LoadASCIIFile(aiNode *root) {
|
||||||
} else if (!::strncmp(sz, "endsolid", 8)) {
|
} else if (!::strncmp(sz, "endsolid", 8)) {
|
||||||
do {
|
do {
|
||||||
++sz;
|
++sz;
|
||||||
} while (!::IsLineEnd(*sz));
|
} while (!IsLineEnd(*sz));
|
||||||
SkipSpacesAndLineEnd(&sz);
|
SkipSpacesAndLineEnd(&sz);
|
||||||
// finished!
|
// finished!
|
||||||
break;
|
break;
|
||||||
} else { // else skip the whole identifier
|
} else { // else skip the whole identifier
|
||||||
do {
|
do {
|
||||||
++sz;
|
++sz;
|
||||||
} while (!::IsSpaceOrNewLine(*sz));
|
} while (!IsSpaceOrNewLine(*sz));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,9 +450,8 @@ bool STLImporter::LoadBinaryFile() {
|
||||||
aiVector3D *vp = pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
aiVector3D *vp = pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
||||||
aiVector3D *vn = pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
aiVector3D *vn = pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
||||||
|
|
||||||
typedef aiVector3t<float> aiVector3F;
|
aiVector3f *theVec;
|
||||||
aiVector3F *theVec;
|
aiVector3f theVec3F;
|
||||||
aiVector3F theVec3F;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < pMesh->mNumFaces; ++i) {
|
for (unsigned int i = 0; i < pMesh->mNumFaces; ++i) {
|
||||||
// NOTE: Blender sometimes writes empty normals ... this is not
|
// NOTE: Blender sometimes writes empty normals ... this is not
|
||||||
|
@ -460,8 +459,8 @@ bool STLImporter::LoadBinaryFile() {
|
||||||
|
|
||||||
// There's one normal for the face in the STL; use it three times
|
// There's one normal for the face in the STL; use it three times
|
||||||
// for vertex normals
|
// for vertex normals
|
||||||
theVec = (aiVector3F *)sz;
|
theVec = (aiVector3f *)sz;
|
||||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
|
::memcpy(&theVec3F, theVec, sizeof(aiVector3f));
|
||||||
vn->x = theVec3F.x;
|
vn->x = theVec3F.x;
|
||||||
vn->y = theVec3F.y;
|
vn->y = theVec3F.y;
|
||||||
vn->z = theVec3F.z;
|
vn->z = theVec3F.z;
|
||||||
|
@ -471,7 +470,7 @@ bool STLImporter::LoadBinaryFile() {
|
||||||
vn += 3;
|
vn += 3;
|
||||||
|
|
||||||
// vertex 1
|
// vertex 1
|
||||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
|
::memcpy(&theVec3F, theVec, sizeof(aiVector3f));
|
||||||
vp->x = theVec3F.x;
|
vp->x = theVec3F.x;
|
||||||
vp->y = theVec3F.y;
|
vp->y = theVec3F.y;
|
||||||
vp->z = theVec3F.z;
|
vp->z = theVec3F.z;
|
||||||
|
@ -479,7 +478,7 @@ bool STLImporter::LoadBinaryFile() {
|
||||||
++vp;
|
++vp;
|
||||||
|
|
||||||
// vertex 2
|
// vertex 2
|
||||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
|
::memcpy(&theVec3F, theVec, sizeof(aiVector3f));
|
||||||
vp->x = theVec3F.x;
|
vp->x = theVec3F.x;
|
||||||
vp->y = theVec3F.y;
|
vp->y = theVec3F.y;
|
||||||
vp->z = theVec3F.z;
|
vp->z = theVec3F.z;
|
||||||
|
@ -487,7 +486,7 @@ bool STLImporter::LoadBinaryFile() {
|
||||||
++vp;
|
++vp;
|
||||||
|
|
||||||
// vertex 3
|
// vertex 3
|
||||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
|
::memcpy(&theVec3F, theVec, sizeof(aiVector3f));
|
||||||
vp->x = theVec3F.x;
|
vp->x = theVec3F.x;
|
||||||
vp->y = theVec3F.y;
|
vp->y = theVec3F.y;
|
||||||
vp->z = theVec3F.z;
|
vp->z = theVec3F.z;
|
||||||
|
@ -570,4 +569,6 @@ void STLImporter::pushMeshesToNode(std::vector<unsigned int> &meshIndices, aiNod
|
||||||
meshIndices.clear();
|
meshIndices.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_STL_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_STL_IMPORTER
|
||||||
|
|
|
@ -51,9 +51,9 @@ 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>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static constexpr aiImporterDesc desc = {
|
||||||
"Terragen Heightmap Importer",
|
"Terragen Heightmap Importer",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
@ -73,10 +73,6 @@ TerragenImporter::TerragenImporter() :
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
TerragenImporter::~TerragenImporter() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the class can handle the format of the given file.
|
// Returns whether the class can handle the format of the given file.
|
||||||
bool TerragenImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
bool TerragenImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||||
|
@ -244,4 +240,6 @@ void TerragenImporter::InternReadFile(const std::string &pFile,
|
||||||
pScene->mFlags |= AI_SCENE_FLAGS_TERRAIN;
|
pScene->mFlags |= AI_SCENE_FLAGS_TERRAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_TERRAGEN_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_TERRAGEN_IMPORTER
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace Assimp {
|
||||||
class TerragenImporter : public BaseImporter {
|
class TerragenImporter : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
TerragenImporter();
|
TerragenImporter();
|
||||||
~TerragenImporter() override;
|
~TerragenImporter() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
|
|
|
@ -63,7 +63,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
namespace Assimp {
|
||||||
|
|
||||||
namespace Unreal {
|
namespace Unreal {
|
||||||
|
|
||||||
|
@ -336,12 +336,12 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
||||||
tempTextures.emplace_back();
|
tempTextures.emplace_back();
|
||||||
std::pair<std::string, std::string> &me = tempTextures.back();
|
std::pair<std::string, std::string> &me = tempTextures.back();
|
||||||
for (; !IsLineEnd(*data); ++data) {
|
for (; !IsLineEnd(*data); ++data) {
|
||||||
if (!::ASSIMP_strincmp(data, "NAME=", 5)) {
|
if (!ASSIMP_strincmp(data, "NAME=", 5)) {
|
||||||
const char *d = data += 5;
|
const char *d = data += 5;
|
||||||
for (; !IsSpaceOrNewLine(*data); ++data)
|
for (; !IsSpaceOrNewLine(*data); ++data)
|
||||||
;
|
;
|
||||||
me.first = std::string(d, (size_t)(data - d));
|
me.first = std::string(d, (size_t)(data - d));
|
||||||
} else if (!::ASSIMP_strincmp(data, "FILE=", 5)) {
|
} else if (!ASSIMP_strincmp(data, "FILE=", 5)) {
|
||||||
const char *d = data += 5;
|
const char *d = data += 5;
|
||||||
for (; !IsSpaceOrNewLine(*data); ++data)
|
for (; !IsSpaceOrNewLine(*data); ++data)
|
||||||
;
|
;
|
||||||
|
@ -363,10 +363,10 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
||||||
std::pair<unsigned int, std::string> &me = textures.back();
|
std::pair<unsigned int, std::string> &me = textures.back();
|
||||||
|
|
||||||
for (; !IsLineEnd(*data); ++data) {
|
for (; !IsLineEnd(*data); ++data) {
|
||||||
if (!::ASSIMP_strincmp(data, "NUM=", 4)) {
|
if (!ASSIMP_strincmp(data, "NUM=", 4)) {
|
||||||
data += 4;
|
data += 4;
|
||||||
me.first = strtoul10(data, &data);
|
me.first = strtoul10(data, &data);
|
||||||
} else if (!::ASSIMP_strincmp(data, "TEXTURE=", 8)) {
|
} else if (!ASSIMP_strincmp(data, "TEXTURE=", 8)) {
|
||||||
data += 8;
|
data += 8;
|
||||||
const char *d = data;
|
const char *d = data;
|
||||||
for (; !IsSpaceOrNewLine(*data); ++data)
|
for (; !IsSpaceOrNewLine(*data); ++data)
|
||||||
|
@ -516,4 +516,6 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
||||||
flipper.Execute(pScene);
|
flipper.Execute(pScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_3D_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_3D_IMPORTER
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Assimp {
|
||||||
|
|
||||||
using namespace Assimp::Formatter;
|
using namespace Assimp::Formatter;
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static constexpr aiImporterDesc desc = {
|
||||||
"Direct3D XFile Importer",
|
"Direct3D XFile Importer",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
|
|
@ -78,7 +78,7 @@ XGLImporter::XGLImporter() : mXmlParser(nullptr), m_scene(nullptr) {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
XGLImporter::~XGLImporter() {
|
XGLImporter::~XGLImporter() {
|
||||||
delete mXmlParser;
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -94,6 +94,7 @@ const aiImporterDesc *XGLImporter::GetInfo() const {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||||
|
clear();
|
||||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_XGL
|
#ifndef ASSIMP_BUILD_NO_COMPRESSED_XGL
|
||||||
std::vector<char> uncompressed;
|
std::vector<char> uncompressed;
|
||||||
#endif
|
#endif
|
||||||
|
@ -165,6 +166,13 @@ void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||||
scope.dismiss();
|
scope.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void XGLImporter::clear() {
|
||||||
|
delete mXmlParser;
|
||||||
|
mXmlParser = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void XGLImporter::ReadWorld(XmlNode &node, TempScope &scope) {
|
void XGLImporter::ReadWorld(XmlNode &node, TempScope &scope) {
|
||||||
for (XmlNode ¤tNode : node.children()) {
|
for (XmlNode ¤tNode : node.children()) {
|
||||||
|
|
|
@ -81,6 +81,8 @@ public:
|
||||||
bool checkSig) const override;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void clear();
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Return importer meta information.
|
/** Return importer meta information.
|
||||||
* See #BaseImporter::GetInfo for the details */
|
* See #BaseImporter::GetInfo for the details */
|
||||||
|
|
|
@ -151,6 +151,8 @@ public:
|
||||||
|
|
||||||
|
|
||||||
typedef aiVector3t<ai_real> aiVector3D;
|
typedef aiVector3t<ai_real> aiVector3D;
|
||||||
|
typedef aiVector3t<float> aiVector3f;
|
||||||
|
typedef aiVector3t<double> aiVector3d;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue