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 <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
|
||||
|
@ -68,7 +68,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial() {
|
|||
unsigned int idx(NotSet);
|
||||
for (unsigned int i = 0; i < mScene->mMaterials.size(); ++i) {
|
||||
std::string s = mScene->mMaterials[i].mName;
|
||||
for (char & it : s) {
|
||||
for (char &it : s) {
|
||||
it = static_cast<char>(::tolower(static_cast<unsigned char>(it)));
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
|
|||
unsigned int iWire = 1;
|
||||
mat.AddProperty<int>((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME);
|
||||
}
|
||||
[[fallthrough]];
|
||||
[[fallthrough]];
|
||||
|
||||
case D3DS::Discreet3DS::Gouraud:
|
||||
eShading = aiShadingMode_Gouraud;
|
||||
|
@ -805,4 +805,6 @@ void Discreet3DSImporter::ConvertScene(aiScene *pcOut) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
|||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -57,8 +56,7 @@ struct aiNode;
|
|||
struct aiMaterial;
|
||||
struct aiMesh;
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Assimp {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -88,7 +86,7 @@ private:
|
|||
|
||||
std::map<const aiNode*, aiMatrix4x4> trafos;
|
||||
|
||||
typedef std::multimap<const aiNode*, unsigned int> MeshesByNodeMap;
|
||||
using MeshesByNodeMap = std::multimap<const aiNode*, unsigned int>;
|
||||
MeshesByNodeMap meshes;
|
||||
|
||||
};
|
||||
|
|
|
@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Discreet 3DS Importer",
|
||||
|
@ -1335,4 +1335,6 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) {
|
|||
(void)bGamma;
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
|
|
@ -81,10 +81,6 @@ static constexpr aiImporterDesc desc = {
|
|||
"3mf"
|
||||
};
|
||||
|
||||
D3MFImporter::D3MFImporter() = default;
|
||||
|
||||
D3MFImporter::~D3MFImporter() = default;
|
||||
|
||||
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||
if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
|
||||
return false;
|
||||
|
|
|
@ -56,10 +56,10 @@ namespace Assimp {
|
|||
class D3MFImporter : public BaseImporter {
|
||||
public:
|
||||
/// @brief The default class constructor.
|
||||
D3MFImporter();
|
||||
D3MFImporter() = default;
|
||||
|
||||
/// @brief The class destructor.
|
||||
~D3MFImporter() override;
|
||||
~D3MFImporter() override = default;
|
||||
|
||||
/// @brief Performs the data format detection.
|
||||
/// @param pFile The filename to check.
|
||||
|
|
|
@ -68,7 +68,7 @@ using OpcPackageRelationshipPtr = std::shared_ptr<OpcPackageRelationship>;
|
|||
class OpcPackageRelationshipReader {
|
||||
public:
|
||||
OpcPackageRelationshipReader(XmlParser &parser) :
|
||||
m_relationShips() {
|
||||
mRelations() {
|
||||
XmlNode root = parser.getRootNode();
|
||||
ParseRootNode(root);
|
||||
}
|
||||
|
@ -108,13 +108,13 @@ public:
|
|||
relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE).as_string();
|
||||
relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET).as_string();
|
||||
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 ) {
|
||||
|
@ -217,11 +217,11 @@ std::string D3MFOpcPackage::ReadPackageRootRelationship(IOStream *stream) {
|
|||
|
||||
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;
|
||||
});
|
||||
|
||||
if (itr == reader.m_relationShips.end()) {
|
||||
if (itr == reader.mRelations.end()) {
|
||||
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 D3MF {
|
||||
|
||||
static const int IdNotSet = -1;
|
||||
static constexpr int IdNotSet = -1;
|
||||
|
||||
namespace {
|
||||
|
||||
static const size_t ColRGBA_Len = 9;
|
||||
static const size_t ColRGB_Len = 7;
|
||||
static constexpr size_t ColRGBA_Len = 9;
|
||||
static constexpr size_t ColRGB_Len = 7;
|
||||
|
||||
// format of the color string: #RRGGBBAA or #RRGGBB (3MF Core chapter 5.1.1)
|
||||
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 <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"AC3D Importer",
|
||||
|
@ -862,4 +862,6 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif //!defined ASSIMP_BUILD_NO_AC_IMPORTER
|
||||
|
|
|
@ -63,7 +63,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// utilities
|
||||
#include <assimp/fast_atof.h>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
using namespace Assimp::ASE;
|
||||
|
||||
static constexpr aiImporterDesc desc = {
|
||||
|
@ -1262,6 +1262,8 @@ bool ASEImporter::GenerateNormals(ASE::Mesh &mesh) {
|
|||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_3DS_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/DefaultLogger.hpp>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
using namespace Assimp::ASE;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -1864,6 +1864,8 @@ void Parser::ParseLV4MeshLong(unsigned int &iOut) {
|
|||
iOut = strtoul10(filePtr, &filePtr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_3DS_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>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
using namespace std;
|
||||
|
||||
static constexpr aiImporterDesc desc = {
|
||||
|
@ -79,9 +79,9 @@ static constexpr aiImporterDesc desc = {
|
|||
#pragma warning(disable : 4018)
|
||||
#endif
|
||||
|
||||
//#define DEBUG_B3D
|
||||
// #define DEBUG_B3D
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void DeleteAllBarePointers(std::vector<T> &x) {
|
||||
for (auto p : x) {
|
||||
delete p;
|
||||
|
@ -329,7 +329,7 @@ void B3DImporter::ReadBRUS() {
|
|||
mat->AddProperty(&i, 1, AI_MATKEY_TWOSIDED);
|
||||
}
|
||||
|
||||
//Textures
|
||||
// Textures
|
||||
for (int i = 0; i < n_texs; ++i) {
|
||||
int texid = ReadInt();
|
||||
if (texid < -1 || (texid >= 0 && texid >= static_cast<int>(_textures.size()))) {
|
||||
|
@ -372,7 +372,7 @@ void B3DImporter::ReadVRTS() {
|
|||
}
|
||||
|
||||
if (_vflags & 2) {
|
||||
ReadQuat(); //skip v 4bytes...
|
||||
ReadQuat(); // skip v 4bytes...
|
||||
}
|
||||
|
||||
for (int j = 0; j < _tcsets; ++j) {
|
||||
|
@ -704,22 +704,22 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
|
|||
}
|
||||
}
|
||||
|
||||
//nodes
|
||||
// nodes
|
||||
scene->mRootNode = _nodes[0];
|
||||
_nodes.clear(); // node ownership now belongs to scene
|
||||
|
||||
//material
|
||||
// material
|
||||
if (!_materials.size()) {
|
||||
_materials.emplace_back(std::unique_ptr<aiMaterial>(new aiMaterial));
|
||||
}
|
||||
scene->mNumMaterials = static_cast<unsigned int>(_materials.size());
|
||||
scene->mMaterials = unique_to_array(_materials);
|
||||
|
||||
//meshes
|
||||
// meshes
|
||||
scene->mNumMeshes = static_cast<unsigned int>(_meshes.size());
|
||||
scene->mMeshes = unique_to_array(_meshes);
|
||||
|
||||
//animations
|
||||
// animations
|
||||
if (_animations.size() == 1 && _nodeAnims.size()) {
|
||||
|
||||
aiAnimation *anim = _animations.back().get();
|
||||
|
@ -738,4 +738,6 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
|
|||
flip.Execute(scene);
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#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 <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
using namespace Assimp::Formatter;
|
||||
|
||||
static constexpr aiImporterDesc desc = {
|
||||
|
@ -73,8 +74,8 @@ static constexpr aiImporterDesc desc = {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Aborts the file reading with an exception
|
||||
template<typename... T>
|
||||
AI_WONT_RETURN void BVHLoader::ThrowException(T&&... args) {
|
||||
template <typename... T>
|
||||
AI_WONT_RETURN void BVHLoader::ThrowException(T &&...args) {
|
||||
throw DeadlyImportError(mFileName, ":", mLine, " - ", args...);
|
||||
}
|
||||
|
||||
|
@ -426,7 +427,7 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
|||
nodeAnim->mNodeName.Set(nodeName);
|
||||
std::map<BVHLoader::ChannelType, int> channelMap;
|
||||
|
||||
//Build map of channels
|
||||
// Build map of channels
|
||||
for (unsigned int channel = 0; channel < node.mChannels.size(); ++channel) {
|
||||
channelMap[node.mChannels[channel]] = channel;
|
||||
}
|
||||
|
@ -441,7 +442,7 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
|||
|
||||
// Now compute all translations
|
||||
for (BVHLoader::ChannelType channel = Channel_PositionX; channel <= Channel_PositionZ; channel = (BVHLoader::ChannelType)(channel + 1)) {
|
||||
//Find channel in node
|
||||
// Find channel in node
|
||||
std::map<BVHLoader::ChannelType, int>::iterator mapIter = channelMap.find(channel);
|
||||
|
||||
if (mapIter == channelMap.end())
|
||||
|
@ -485,30 +486,27 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
|||
for (unsigned int fr = 0; fr < mAnimNumFrames; ++fr) {
|
||||
aiMatrix4x4 temp;
|
||||
aiMatrix3x3 rotMatrix;
|
||||
for (unsigned int channelIdx = 0; channelIdx < node.mChannels.size(); ++ channelIdx) {
|
||||
switch (node.mChannels[channelIdx]) {
|
||||
case Channel_RotationX:
|
||||
{
|
||||
for (unsigned int channelIdx = 0; channelIdx < node.mChannels.size(); ++channelIdx) {
|
||||
switch (node.mChannels[channelIdx]) {
|
||||
case Channel_RotationX: {
|
||||
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
||||
aiMatrix4x4::RotationX( angle, temp); rotMatrix *= aiMatrix3x3( temp);
|
||||
}
|
||||
break;
|
||||
case Channel_RotationY:
|
||||
{
|
||||
aiMatrix4x4::RotationX(angle, temp);
|
||||
rotMatrix *= aiMatrix3x3(temp);
|
||||
} break;
|
||||
case Channel_RotationY: {
|
||||
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
||||
aiMatrix4x4::RotationY( angle, temp); rotMatrix *= aiMatrix3x3( temp);
|
||||
}
|
||||
break;
|
||||
case Channel_RotationZ:
|
||||
{
|
||||
aiMatrix4x4::RotationY(angle, temp);
|
||||
rotMatrix *= aiMatrix3x3(temp);
|
||||
} break;
|
||||
case Channel_RotationZ: {
|
||||
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
||||
aiMatrix4x4::RotationZ( angle, temp); rotMatrix *= aiMatrix3x3( temp);
|
||||
}
|
||||
break;
|
||||
aiMatrix4x4::RotationZ(angle, temp);
|
||||
rotMatrix *= aiMatrix3x3(temp);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rotkey->mTime = double(fr);
|
||||
rotkey->mValue = aiQuaternion(rotMatrix);
|
||||
++rotkey;
|
||||
|
@ -525,4 +523,6 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_BVH_IMPORTER
|
||||
|
|
|
@ -61,7 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
using namespace Assimp::COB;
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#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
|
||||
#endif
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Valve SMD Importer",
|
||||
"",
|
||||
"",
|
||||
|
@ -1077,4 +1077,6 @@ void SMDImporter::ParseVertex(const char* szCurrent,
|
|||
SMDI_PARSE_RETURN;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#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 <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
namespace {
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Stereolithography (STL) Importer",
|
||||
"",
|
||||
"",
|
||||
|
@ -129,7 +129,7 @@ STLImporter::STLImporter() :
|
|||
mBuffer(),
|
||||
mFileSize(0),
|
||||
mScene() {
|
||||
// empty
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -250,13 +250,13 @@ void STLImporter::LoadASCIIFile(aiNode *root) {
|
|||
sz += 5; // skip the "solid"
|
||||
SkipSpaces(&sz);
|
||||
const char *szMe = sz;
|
||||
while (!::IsSpaceOrNewLine(*sz)) {
|
||||
while (!IsSpaceOrNewLine(*sz)) {
|
||||
sz++;
|
||||
}
|
||||
|
||||
size_t temp = (size_t)(sz - szMe);
|
||||
// setup the name of the node
|
||||
if ( temp ) {
|
||||
if (temp) {
|
||||
if (temp >= MAXLEN) {
|
||||
throw DeadlyImportError("STL: Node name too long");
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ void STLImporter::LoadASCIIFile(aiNode *root) {
|
|||
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) {
|
||||
ASSIMP_LOG_ERROR("STL: a facet with more than 3 vertices has been found");
|
||||
++sz;
|
||||
|
@ -325,14 +325,14 @@ void STLImporter::LoadASCIIFile(aiNode *root) {
|
|||
} else if (!::strncmp(sz, "endsolid", 8)) {
|
||||
do {
|
||||
++sz;
|
||||
} while (!::IsLineEnd(*sz));
|
||||
} while (!IsLineEnd(*sz));
|
||||
SkipSpacesAndLineEnd(&sz);
|
||||
// finished!
|
||||
break;
|
||||
} else { // else skip the whole identifier
|
||||
do {
|
||||
++sz;
|
||||
} while (!::IsSpaceOrNewLine(*sz));
|
||||
} while (!IsSpaceOrNewLine(*sz));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,14 +349,14 @@ void STLImporter::LoadASCIIFile(aiNode *root) {
|
|||
throw DeadlyImportError("Normal buffer size does not match position buffer size");
|
||||
}
|
||||
|
||||
// only process positionbuffer when filled, else exception when accessing with index operator
|
||||
// only process position buffer when filled, else exception when accessing with index operator
|
||||
// see line 353: only warning is triggered
|
||||
// see line 373(now): access to empty positionbuffer with index operator forced exception
|
||||
// see line 373(now): access to empty position buffer with index operator forced exception
|
||||
if (!positionBuffer.empty()) {
|
||||
pMesh->mNumFaces = static_cast<unsigned int>(positionBuffer.size() / 3);
|
||||
pMesh->mNumVertices = static_cast<unsigned int>(positionBuffer.size());
|
||||
pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
||||
for (size_t i=0; i<pMesh->mNumVertices; ++i ) {
|
||||
for (size_t i = 0; i < pMesh->mNumVertices; ++i) {
|
||||
pMesh->mVertices[i].x = positionBuffer[i].x;
|
||||
pMesh->mVertices[i].y = positionBuffer[i].y;
|
||||
pMesh->mVertices[i].z = positionBuffer[i].z;
|
||||
|
@ -366,7 +366,7 @@ void STLImporter::LoadASCIIFile(aiNode *root) {
|
|||
// also only process normalBuffer when filled, else exception when accessing with index operator
|
||||
if (!normalBuffer.empty()) {
|
||||
pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
||||
for (size_t i=0; i<pMesh->mNumVertices; ++i ) {
|
||||
for (size_t i = 0; i < pMesh->mNumVertices; ++i) {
|
||||
pMesh->mNormals[i].x = normalBuffer[i].x;
|
||||
pMesh->mNormals[i].y = normalBuffer[i].y;
|
||||
pMesh->mNormals[i].z = normalBuffer[i].z;
|
||||
|
@ -450,9 +450,8 @@ bool STLImporter::LoadBinaryFile() {
|
|||
aiVector3D *vp = pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
||||
aiVector3D *vn = pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
||||
|
||||
typedef aiVector3t<float> aiVector3F;
|
||||
aiVector3F *theVec;
|
||||
aiVector3F theVec3F;
|
||||
aiVector3f *theVec;
|
||||
aiVector3f theVec3F;
|
||||
|
||||
for (unsigned int i = 0; i < pMesh->mNumFaces; ++i) {
|
||||
// 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
|
||||
// for vertex normals
|
||||
theVec = (aiVector3F *)sz;
|
||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
|
||||
theVec = (aiVector3f *)sz;
|
||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3f));
|
||||
vn->x = theVec3F.x;
|
||||
vn->y = theVec3F.y;
|
||||
vn->z = theVec3F.z;
|
||||
|
@ -471,7 +470,7 @@ bool STLImporter::LoadBinaryFile() {
|
|||
vn += 3;
|
||||
|
||||
// vertex 1
|
||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
|
||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3f));
|
||||
vp->x = theVec3F.x;
|
||||
vp->y = theVec3F.y;
|
||||
vp->z = theVec3F.z;
|
||||
|
@ -479,7 +478,7 @@ bool STLImporter::LoadBinaryFile() {
|
|||
++vp;
|
||||
|
||||
// vertex 2
|
||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
|
||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3f));
|
||||
vp->x = theVec3F.x;
|
||||
vp->y = theVec3F.y;
|
||||
vp->z = theVec3F.z;
|
||||
|
@ -487,7 +486,7 @@ bool STLImporter::LoadBinaryFile() {
|
|||
++vp;
|
||||
|
||||
// vertex 3
|
||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
|
||||
::memcpy(&theVec3F, theVec, sizeof(aiVector3f));
|
||||
vp->x = theVec3F.x;
|
||||
vp->y = theVec3F.y;
|
||||
vp->z = theVec3F.z;
|
||||
|
@ -570,4 +569,6 @@ void STLImporter::pushMeshesToNode(std::vector<unsigned int> &meshIndices, aiNod
|
|||
meshIndices.clear();
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#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/Importer.hpp>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Terragen Heightmap Importer",
|
||||
"",
|
||||
"",
|
||||
|
@ -73,10 +73,6 @@ TerragenImporter::TerragenImporter() :
|
|||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
TerragenImporter::~TerragenImporter() = default;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
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;
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_TERRAGEN_IMPORTER
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace Assimp {
|
|||
class TerragenImporter : public BaseImporter {
|
||||
public:
|
||||
TerragenImporter();
|
||||
~TerragenImporter() override;
|
||||
~TerragenImporter() override = default;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
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 <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
namespace Unreal {
|
||||
|
||||
|
@ -178,7 +178,7 @@ UnrealImporter::~UnrealImporter() = default;
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool UnrealImporter::CanRead(const std::string & filename, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const {
|
||||
bool UnrealImporter::CanRead(const std::string &filename, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const {
|
||||
return SimpleExtensionCheck(filename, "3d", "uc");
|
||||
}
|
||||
|
||||
|
@ -336,12 +336,12 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
|||
tempTextures.emplace_back();
|
||||
std::pair<std::string, std::string> &me = tempTextures.back();
|
||||
for (; !IsLineEnd(*data); ++data) {
|
||||
if (!::ASSIMP_strincmp(data, "NAME=", 5)) {
|
||||
if (!ASSIMP_strincmp(data, "NAME=", 5)) {
|
||||
const char *d = data += 5;
|
||||
for (; !IsSpaceOrNewLine(*data); ++data)
|
||||
;
|
||||
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;
|
||||
for (; !IsSpaceOrNewLine(*data); ++data)
|
||||
;
|
||||
|
@ -363,10 +363,10 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
|||
std::pair<unsigned int, std::string> &me = textures.back();
|
||||
|
||||
for (; !IsLineEnd(*data); ++data) {
|
||||
if (!::ASSIMP_strincmp(data, "NUM=", 4)) {
|
||||
if (!ASSIMP_strincmp(data, "NUM=", 4)) {
|
||||
data += 4;
|
||||
me.first = strtoul10(data, &data);
|
||||
} else if (!::ASSIMP_strincmp(data, "TEXTURE=", 8)) {
|
||||
} else if (!ASSIMP_strincmp(data, "TEXTURE=", 8)) {
|
||||
data += 8;
|
||||
const char *d = data;
|
||||
for (; !IsSpaceOrNewLine(*data); ++data)
|
||||
|
@ -516,4 +516,6 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
|
|||
flipper.Execute(pScene);
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_3D_IMPORTER
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace Assimp {
|
|||
|
||||
using namespace Assimp::Formatter;
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Direct3D XFile Importer",
|
||||
"",
|
||||
"",
|
||||
|
|
|
@ -78,7 +78,7 @@ XGLImporter::XGLImporter() : mXmlParser(nullptr), m_scene(nullptr) {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
XGLImporter::~XGLImporter() {
|
||||
delete mXmlParser;
|
||||
clear();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -94,7 +94,8 @@ const aiImporterDesc *XGLImporter::GetInfo() const {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_XGL
|
||||
clear();
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_XGL
|
||||
std::vector<char> uncompressed;
|
||||
#endif
|
||||
|
||||
|
@ -165,6 +166,13 @@ void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
scope.dismiss();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void XGLImporter::clear() {
|
||||
delete mXmlParser;
|
||||
mXmlParser = nullptr;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void XGLImporter::ReadWorld(XmlNode &node, TempScope &scope) {
|
||||
for (XmlNode ¤tNode : node.children()) {
|
||||
|
|
|
@ -81,6 +81,8 @@ public:
|
|||
bool checkSig) const override;
|
||||
|
||||
protected:
|
||||
void clear();
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Return importer meta information.
|
||||
* See #BaseImporter::GetInfo for the details */
|
||||
|
|
|
@ -151,6 +151,8 @@ public:
|
|||
|
||||
|
||||
typedef aiVector3t<ai_real> aiVector3D;
|
||||
typedef aiVector3t<float> aiVector3f;
|
||||
typedef aiVector3t<double> aiVector3d;
|
||||
|
||||
#else
|
||||
|
||||
|
|
Loading…
Reference in New Issue