mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
update assimp lib
This commit is contained in:
parent
03a348deb7
commit
d3f8fee74e
1725 changed files with 196314 additions and 62009 deletions
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
|
@ -346,10 +346,22 @@ void PlyExporter::WriteMeshVertsBinary(const aiMesh* m, unsigned int components)
|
|||
|
||||
for (unsigned int n = PLY_EXPORT_HAS_COLORS, c = 0; (components & n) && c != AI_MAX_NUMBER_OF_COLOR_SETS; n <<= 1, ++c) {
|
||||
if (m->HasVertexColors(c)) {
|
||||
mOutput.write(reinterpret_cast<const char*>(&m->mColors[c][i].r), 16);
|
||||
unsigned char rgba[4] = {
|
||||
static_cast<unsigned char>(m->mColors[c][i].r * 255),
|
||||
static_cast<unsigned char>(m->mColors[c][i].g * 255),
|
||||
static_cast<unsigned char>(m->mColors[c][i].b * 255),
|
||||
static_cast<unsigned char>(m->mColors[c][i].a * 255)
|
||||
};
|
||||
mOutput.write(reinterpret_cast<const char*>(&rgba), 4);
|
||||
}
|
||||
else {
|
||||
mOutput.write(reinterpret_cast<const char*>(&defaultColor.r), 16);
|
||||
unsigned char rgba[4] = {
|
||||
static_cast<unsigned char>(defaultColor.r * 255),
|
||||
static_cast<unsigned char>(defaultColor.g * 255),
|
||||
static_cast<unsigned char>(defaultColor.b * 255),
|
||||
static_cast<unsigned char>(defaultColor.a * 255)
|
||||
};
|
||||
mOutput.write(reinterpret_cast<const char*>(&rgba), 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -53,9 +53,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/IOSystem.hpp>
|
||||
#include <memory>
|
||||
|
||||
using namespace ::Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Stanford Polygon Library (PLY) Importer",
|
||||
"",
|
||||
"",
|
||||
|
|
@ -71,16 +71,37 @@ static const aiImporterDesc desc = {
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Internal stuff
|
||||
namespace {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Checks that property index is within range
|
||||
template <class T>
|
||||
inline const T &GetProperty(const std::vector<T> &props, int idx) {
|
||||
if (static_cast<size_t>(idx) >= props.size()) {
|
||||
throw DeadlyImportError("Invalid .ply file: Property index is out of range.");
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Checks that property index is within range
|
||||
template <class T>
|
||||
inline const T &GetProperty(const std::vector<T> &props, int idx) {
|
||||
if (static_cast<size_t>(idx) >= props.size()) {
|
||||
throw DeadlyImportError("Invalid .ply file: Property index is out of range.");
|
||||
}
|
||||
|
||||
return props[idx];
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static bool isBigEndian(const char *szMe) {
|
||||
ai_assert(nullptr != szMe);
|
||||
|
||||
// binary_little_endian
|
||||
// binary_big_endian
|
||||
bool isBigEndian{ false };
|
||||
#if (defined AI_BUILD_BIG_ENDIAN)
|
||||
if ('l' == *szMe || 'L' == *szMe) {
|
||||
isBigEndian = true;
|
||||
}
|
||||
#else
|
||||
if ('b' == *szMe || 'B' == *szMe) {
|
||||
isBigEndian = true;
|
||||
}
|
||||
#endif // ! AI_BUILD_BIG_ENDIAN
|
||||
|
||||
return isBigEndian;
|
||||
}
|
||||
|
||||
return props[idx];
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
@ -93,8 +114,9 @@ PLYImporter::PLYImporter() :
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
PLYImporter::~PLYImporter() = default;
|
||||
PLYImporter::~PLYImporter() {
|
||||
delete mGeneratedMesh;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
|
|
@ -108,37 +130,17 @@ const aiImporterDesc *PLYImporter::GetInfo() const {
|
|||
return &desc;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static bool isBigEndian(const char *szMe) {
|
||||
ai_assert(nullptr != szMe);
|
||||
|
||||
// binary_little_endian
|
||||
// binary_big_endian
|
||||
bool isBigEndian(false);
|
||||
#if (defined AI_BUILD_BIG_ENDIAN)
|
||||
if ('l' == *szMe || 'L' == *szMe) {
|
||||
isBigEndian = true;
|
||||
}
|
||||
#else
|
||||
if ('b' == *szMe || 'B' == *szMe) {
|
||||
isBigEndian = true;
|
||||
}
|
||||
#endif // ! AI_BUILD_BIG_ENDIAN
|
||||
|
||||
return isBigEndian;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||
const std::string mode = "rb";
|
||||
std::unique_ptr<IOStream> fileStream(pIOHandler->Open(pFile, mode));
|
||||
if (!fileStream.get()) {
|
||||
if (!fileStream) {
|
||||
throw DeadlyImportError("Failed to open file ", pFile, ".");
|
||||
}
|
||||
|
||||
// Get the file-size
|
||||
const size_t fileSize(fileStream->FileSize());
|
||||
const size_t fileSize = fileStream->FileSize();
|
||||
if (0 == fileSize) {
|
||||
throw DeadlyImportError("File ", pFile, " is empty.");
|
||||
}
|
||||
|
|
@ -163,7 +165,8 @@ void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
mBuffer = (unsigned char *)&mBuffer2[0];
|
||||
|
||||
char *szMe = (char *)&this->mBuffer[0];
|
||||
SkipSpacesAndLineEnd(szMe, (const char **)&szMe);
|
||||
const char *end = &mBuffer2[0] + mBuffer2.size();
|
||||
SkipSpacesAndLineEnd(szMe, (const char **)&szMe, end);
|
||||
|
||||
// determine the format of the file data and construct the aiMesh
|
||||
PLY::DOM sPlyDom;
|
||||
|
|
@ -171,7 +174,7 @@ void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
|
||||
if (TokenMatch(szMe, "format", 6)) {
|
||||
if (TokenMatch(szMe, "ascii", 5)) {
|
||||
SkipLine(szMe, (const char **)&szMe);
|
||||
SkipLine(szMe, (const char **)&szMe, end);
|
||||
if (!PLY::DOM::ParseInstance(streamedBuffer, &sPlyDom, this)) {
|
||||
if (mGeneratedMesh != nullptr) {
|
||||
delete (mGeneratedMesh);
|
||||
|
|
@ -183,7 +186,7 @@ void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
}
|
||||
} else if (!::strncmp(szMe, "binary_", 7)) {
|
||||
szMe += 7;
|
||||
const bool bIsBE(isBigEndian(szMe));
|
||||
const bool bIsBE = isBigEndian(szMe);
|
||||
|
||||
// skip the line, parse the rest of the header and build the DOM
|
||||
if (!PLY::DOM::ParseInstanceBinary(streamedBuffer, &sPlyDom, this, bIsBE)) {
|
||||
|
|
@ -215,7 +218,7 @@ void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
throw DeadlyImportError("Invalid .ply file: Missing format specification");
|
||||
}
|
||||
|
||||
//free the file buffer
|
||||
// free the file buffer
|
||||
streamedBuffer.close();
|
||||
|
||||
if (mGeneratedMesh == nullptr) {
|
||||
|
|
@ -244,7 +247,9 @@ void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
// fill the mesh list
|
||||
pScene->mNumMeshes = 1;
|
||||
pScene->mMeshes = new aiMesh *[pScene->mNumMeshes];
|
||||
pScene->mMeshes[0] = mGeneratedMesh;
|
||||
pScene->mMeshes[0] = mGeneratedMesh;
|
||||
|
||||
// Move the mesh ownership into the scene instance
|
||||
mGeneratedMesh = nullptr;
|
||||
|
||||
// generate a simple node structure
|
||||
|
|
@ -257,20 +262,22 @@ void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
}
|
||||
}
|
||||
|
||||
static constexpr ai_uint NotSet = 0xFFFFFFFF;
|
||||
|
||||
void PLYImporter::LoadVertex(const PLY::Element *pcElement, const PLY::ElementInstance *instElement, unsigned int pos) {
|
||||
ai_assert(nullptr != pcElement);
|
||||
ai_assert(nullptr != instElement);
|
||||
|
||||
ai_uint aiPositions[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
ai_uint aiPositions[3] = { NotSet, NotSet, NotSet };
|
||||
PLY::EDataType aiTypes[3] = { EDT_Char, EDT_Char, EDT_Char };
|
||||
|
||||
ai_uint aiNormal[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
ai_uint aiNormal[3] = { NotSet, NotSet, NotSet };
|
||||
PLY::EDataType aiNormalTypes[3] = { EDT_Char, EDT_Char, EDT_Char };
|
||||
|
||||
unsigned int aiColors[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
unsigned int aiColors[4] = { NotSet, NotSet, NotSet, NotSet };
|
||||
PLY::EDataType aiColorsTypes[4] = { EDT_Char, EDT_Char, EDT_Char, EDT_Char };
|
||||
|
||||
unsigned int aiTexcoord[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
unsigned int aiTexcoord[2] = { NotSet, NotSet };
|
||||
PLY::EDataType aiTexcoordTypes[2] = { EDT_Char, EDT_Char };
|
||||
|
||||
// now check whether which normal components are available
|
||||
|
|
@ -340,17 +347,17 @@ void PLYImporter::LoadVertex(const PLY::Element *pcElement, const PLY::ElementIn
|
|||
if (0 != cnt) {
|
||||
// Position
|
||||
aiVector3D vOut;
|
||||
if (0xFFFFFFFF != aiPositions[0]) {
|
||||
if (NotSet != aiPositions[0]) {
|
||||
vOut.x = PLY::PropertyInstance::ConvertTo<ai_real>(
|
||||
GetProperty(instElement->alProperties, aiPositions[0]).avList.front(), aiTypes[0]);
|
||||
}
|
||||
|
||||
if (0xFFFFFFFF != aiPositions[1]) {
|
||||
if (NotSet != aiPositions[1]) {
|
||||
vOut.y = PLY::PropertyInstance::ConvertTo<ai_real>(
|
||||
GetProperty(instElement->alProperties, aiPositions[1]).avList.front(), aiTypes[1]);
|
||||
}
|
||||
|
||||
if (0xFFFFFFFF != aiPositions[2]) {
|
||||
if (NotSet != aiPositions[2]) {
|
||||
vOut.z = PLY::PropertyInstance::ConvertTo<ai_real>(
|
||||
GetProperty(instElement->alProperties, aiPositions[2]).avList.front(), aiTypes[2]);
|
||||
}
|
||||
|
|
@ -358,28 +365,28 @@ void PLYImporter::LoadVertex(const PLY::Element *pcElement, const PLY::ElementIn
|
|||
// Normals
|
||||
aiVector3D nOut;
|
||||
bool haveNormal = false;
|
||||
if (0xFFFFFFFF != aiNormal[0]) {
|
||||
if (NotSet != aiNormal[0]) {
|
||||
nOut.x = PLY::PropertyInstance::ConvertTo<ai_real>(
|
||||
GetProperty(instElement->alProperties, aiNormal[0]).avList.front(), aiNormalTypes[0]);
|
||||
haveNormal = true;
|
||||
}
|
||||
|
||||
if (0xFFFFFFFF != aiNormal[1]) {
|
||||
if (NotSet != aiNormal[1]) {
|
||||
nOut.y = PLY::PropertyInstance::ConvertTo<ai_real>(
|
||||
GetProperty(instElement->alProperties, aiNormal[1]).avList.front(), aiNormalTypes[1]);
|
||||
haveNormal = true;
|
||||
}
|
||||
|
||||
if (0xFFFFFFFF != aiNormal[2]) {
|
||||
if (NotSet != aiNormal[2]) {
|
||||
nOut.z = PLY::PropertyInstance::ConvertTo<ai_real>(
|
||||
GetProperty(instElement->alProperties, aiNormal[2]).avList.front(), aiNormalTypes[2]);
|
||||
haveNormal = true;
|
||||
}
|
||||
|
||||
//Colors
|
||||
// Colors
|
||||
aiColor4D cOut;
|
||||
bool haveColor = false;
|
||||
if (0xFFFFFFFF != aiColors[0]) {
|
||||
if (NotSet != aiColors[0]) {
|
||||
cOut.r = NormalizeColorValue(GetProperty(instElement->alProperties,
|
||||
aiColors[0])
|
||||
.avList.front(),
|
||||
|
|
@ -387,7 +394,7 @@ void PLYImporter::LoadVertex(const PLY::Element *pcElement, const PLY::ElementIn
|
|||
haveColor = true;
|
||||
}
|
||||
|
||||
if (0xFFFFFFFF != aiColors[1]) {
|
||||
if (NotSet != aiColors[1]) {
|
||||
cOut.g = NormalizeColorValue(GetProperty(instElement->alProperties,
|
||||
aiColors[1])
|
||||
.avList.front(),
|
||||
|
|
@ -395,7 +402,7 @@ void PLYImporter::LoadVertex(const PLY::Element *pcElement, const PLY::ElementIn
|
|||
haveColor = true;
|
||||
}
|
||||
|
||||
if (0xFFFFFFFF != aiColors[2]) {
|
||||
if (NotSet != aiColors[2]) {
|
||||
cOut.b = NormalizeColorValue(GetProperty(instElement->alProperties,
|
||||
aiColors[2])
|
||||
.avList.front(),
|
||||
|
|
@ -404,7 +411,7 @@ void PLYImporter::LoadVertex(const PLY::Element *pcElement, const PLY::ElementIn
|
|||
}
|
||||
|
||||
// assume 1.0 for the alpha channel if it is not set
|
||||
if (0xFFFFFFFF == aiColors[3]) {
|
||||
if (NotSet == aiColors[3]) {
|
||||
cOut.a = 1.0;
|
||||
} else {
|
||||
cOut.a = NormalizeColorValue(GetProperty(instElement->alProperties,
|
||||
|
|
@ -415,23 +422,23 @@ void PLYImporter::LoadVertex(const PLY::Element *pcElement, const PLY::ElementIn
|
|||
haveColor = true;
|
||||
}
|
||||
|
||||
//Texture coordinates
|
||||
// Texture coordinates
|
||||
aiVector3D tOut;
|
||||
tOut.z = 0;
|
||||
bool haveTextureCoords = false;
|
||||
if (0xFFFFFFFF != aiTexcoord[0]) {
|
||||
if (NotSet != aiTexcoord[0]) {
|
||||
tOut.x = PLY::PropertyInstance::ConvertTo<ai_real>(
|
||||
GetProperty(instElement->alProperties, aiTexcoord[0]).avList.front(), aiTexcoordTypes[0]);
|
||||
haveTextureCoords = true;
|
||||
}
|
||||
|
||||
if (0xFFFFFFFF != aiTexcoord[1]) {
|
||||
if (NotSet != aiTexcoord[1]) {
|
||||
tOut.y = PLY::PropertyInstance::ConvertTo<ai_real>(
|
||||
GetProperty(instElement->alProperties, aiTexcoord[1]).avList.front(), aiTexcoordTypes[1]);
|
||||
haveTextureCoords = true;
|
||||
}
|
||||
|
||||
//create aiMesh if needed
|
||||
// create aiMesh if needed
|
||||
if (nullptr == mGeneratedMesh) {
|
||||
mGeneratedMesh = new aiMesh();
|
||||
mGeneratedMesh->mMaterialIndex = 0;
|
||||
|
|
@ -441,6 +448,9 @@ void PLYImporter::LoadVertex(const PLY::Element *pcElement, const PLY::ElementIn
|
|||
mGeneratedMesh->mNumVertices = pcElement->NumOccur;
|
||||
mGeneratedMesh->mVertices = new aiVector3D[mGeneratedMesh->mNumVertices];
|
||||
}
|
||||
if (pos >= mGeneratedMesh->mNumVertices) {
|
||||
throw DeadlyImportError("Invalid .ply file: Too many vertices");
|
||||
}
|
||||
|
||||
mGeneratedMesh->mVertices[pos] = vOut;
|
||||
|
||||
|
|
@ -507,16 +517,12 @@ void PLYImporter::LoadFace(const PLY::Element *pcElement, const PLY::ElementInst
|
|||
bool bOne = false;
|
||||
|
||||
// index of the vertex index list
|
||||
unsigned int iProperty = 0xFFFFFFFF;
|
||||
unsigned int iProperty = NotSet;
|
||||
PLY::EDataType eType = EDT_Char;
|
||||
bool bIsTriStrip = false;
|
||||
|
||||
// index of the material index property
|
||||
//unsigned int iMaterialIndex = 0xFFFFFFFF;
|
||||
//PLY::EDataType eType2 = EDT_Char;
|
||||
|
||||
// texture coordinates
|
||||
unsigned int iTextureCoord = 0xFFFFFFFF;
|
||||
unsigned int iTextureCoord = NotSet;
|
||||
PLY::EDataType eType3 = EDT_Char;
|
||||
|
||||
// face = unique number of vertex indices
|
||||
|
|
@ -567,11 +573,15 @@ void PLYImporter::LoadFace(const PLY::Element *pcElement, const PLY::ElementInst
|
|||
if (mGeneratedMesh->mFaces == nullptr) {
|
||||
mGeneratedMesh->mNumFaces = pcElement->NumOccur;
|
||||
mGeneratedMesh->mFaces = new aiFace[mGeneratedMesh->mNumFaces];
|
||||
} else {
|
||||
if (mGeneratedMesh->mNumFaces < pcElement->NumOccur) {
|
||||
throw DeadlyImportError("Invalid .ply file: Too many faces");
|
||||
}
|
||||
}
|
||||
|
||||
if (!bIsTriStrip) {
|
||||
// parse the list of vertex indices
|
||||
if (0xFFFFFFFF != iProperty) {
|
||||
if (NotSet != iProperty) {
|
||||
const unsigned int iNum = (unsigned int)GetProperty(instElement->alProperties, iProperty).avList.size();
|
||||
mGeneratedMesh->mFaces[pos].mNumIndices = iNum;
|
||||
mGeneratedMesh->mFaces[pos].mIndices = new unsigned int[iNum];
|
||||
|
|
@ -584,18 +594,10 @@ void PLYImporter::LoadFace(const PLY::Element *pcElement, const PLY::ElementInst
|
|||
}
|
||||
}
|
||||
|
||||
// parse the material index
|
||||
// cannot be handled without processing the whole file first
|
||||
/*if (0xFFFFFFFF != iMaterialIndex)
|
||||
{
|
||||
mGeneratedMesh->mFaces[pos]. = PLY::PropertyInstance::ConvertTo<unsigned int>(
|
||||
GetProperty(instElement->alProperties, iMaterialIndex).avList.front(), eType2);
|
||||
}*/
|
||||
|
||||
if (0xFFFFFFFF != iTextureCoord) {
|
||||
if (NotSet != iTextureCoord) {
|
||||
const unsigned int iNum = (unsigned int)GetProperty(instElement->alProperties, iTextureCoord).avList.size();
|
||||
|
||||
//should be 6 coords
|
||||
// should be 6 coords
|
||||
std::vector<PLY::PropertyInstance::ValueUnion>::const_iterator p =
|
||||
GetProperty(instElement->alProperties, iTextureCoord).avList.begin();
|
||||
|
||||
|
|
@ -625,7 +627,7 @@ void PLYImporter::LoadFace(const PLY::Element *pcElement, const PLY::ElementInst
|
|||
// a value of -1 indicates a restart of the strip
|
||||
bool flip = false;
|
||||
const std::vector<PLY::PropertyInstance::ValueUnion> &quak = GetProperty(instElement->alProperties, iProperty).avList;
|
||||
//pvOut->reserve(pvOut->size() + quak.size() + (quak.size()>>2u)); //Limits memory consumption
|
||||
// pvOut->reserve(pvOut->size() + quak.size() + (quak.size()>>2u)); //Limits memory consumption
|
||||
|
||||
int aiTable[2] = { -1, -1 };
|
||||
for (std::vector<PLY::PropertyInstance::ValueUnion>::const_iterator a = quak.begin(); a != quak.end(); ++a) {
|
||||
|
|
@ -678,41 +680,29 @@ void PLYImporter::GetMaterialColor(const std::vector<PLY::PropertyInstance> &avL
|
|||
aiColor4D *clrOut) {
|
||||
ai_assert(nullptr != clrOut);
|
||||
|
||||
if (0xFFFFFFFF == aiPositions[0])
|
||||
if (NotSet == aiPositions[0]) {
|
||||
clrOut->r = 0.0f;
|
||||
else {
|
||||
clrOut->r = NormalizeColorValue(GetProperty(avList,
|
||||
aiPositions[0])
|
||||
.avList.front(),
|
||||
aiTypes[0]);
|
||||
} else {
|
||||
clrOut->r = NormalizeColorValue(GetProperty(avList, aiPositions[0]).avList.front(), aiTypes[0]);
|
||||
}
|
||||
|
||||
if (0xFFFFFFFF == aiPositions[1])
|
||||
if (NotSet == aiPositions[1]) {
|
||||
clrOut->g = 0.0f;
|
||||
else {
|
||||
clrOut->g = NormalizeColorValue(GetProperty(avList,
|
||||
aiPositions[1])
|
||||
.avList.front(),
|
||||
aiTypes[1]);
|
||||
} else {
|
||||
clrOut->g = NormalizeColorValue(GetProperty(avList, aiPositions[1]).avList.front(), aiTypes[1]);
|
||||
}
|
||||
|
||||
if (0xFFFFFFFF == aiPositions[2])
|
||||
if (NotSet == aiPositions[2])
|
||||
clrOut->b = 0.0f;
|
||||
else {
|
||||
clrOut->b = NormalizeColorValue(GetProperty(avList,
|
||||
aiPositions[2])
|
||||
.avList.front(),
|
||||
aiTypes[2]);
|
||||
clrOut->b = NormalizeColorValue(GetProperty(avList, aiPositions[2]).avList.front(), aiTypes[2]);
|
||||
}
|
||||
|
||||
// assume 1.0 for the alpha channel ifit is not set
|
||||
if (0xFFFFFFFF == aiPositions[3])
|
||||
if (NotSet == aiPositions[3])
|
||||
clrOut->a = 1.0f;
|
||||
else {
|
||||
clrOut->a = NormalizeColorValue(GetProperty(avList,
|
||||
aiPositions[3])
|
||||
.avList.front(),
|
||||
aiTypes[3]);
|
||||
clrOut->a = NormalizeColorValue(GetProperty(avList, aiPositions[3]).avList.front(), aiTypes[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -863,7 +853,7 @@ void PLYImporter::LoadMaterial(std::vector<aiMaterial *> *pvOut, std::string &de
|
|||
const int two_sided = 1;
|
||||
pcHelper->AddProperty(&two_sided, 1, AI_MATKEY_TWOSIDED);
|
||||
|
||||
//default texture
|
||||
// default texture
|
||||
if (!defaultTexture.empty()) {
|
||||
const aiString name(defaultTexture.c_str());
|
||||
pcHelper->AddProperty(&name, _AI_MATKEY_TEXTURE_BASE, aiTextureType_DIFFUSE, 0);
|
||||
|
|
@ -873,7 +863,7 @@ void PLYImporter::LoadMaterial(std::vector<aiMaterial *> *pvOut, std::string &de
|
|||
pcHelper->AddProperty(&two_sided, 1, AI_MATKEY_TWOSIDED);
|
||||
}
|
||||
|
||||
//set to wireframe, so when using this material info we can switch to points rendering
|
||||
// set to wireframe, so when using this material info we can switch to points rendering
|
||||
if (pointsOnly) {
|
||||
const int wireframe = 1;
|
||||
pcHelper->AddProperty(&wireframe, 1, AI_MATKEY_ENABLE_WIREFRAME);
|
||||
|
|
@ -890,7 +880,7 @@ void PLYImporter::LoadMaterial(std::vector<aiMaterial *> *pvOut, std::string &de
|
|||
int iMode = (int)aiShadingMode_Gouraud;
|
||||
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);
|
||||
|
||||
//generate white material most 3D engine just multiply ambient / diffuse color with actual ambient / light color
|
||||
// generate white material most 3D engine just multiply ambient / diffuse color with actual ambient / light color
|
||||
aiColor3D clr;
|
||||
clr.b = clr.g = clr.r = 1.0f;
|
||||
pcHelper->AddProperty<aiColor3D>(&clr, 1, AI_MATKEY_COLOR_DIFFUSE);
|
||||
|
|
@ -906,13 +896,13 @@ void PLYImporter::LoadMaterial(std::vector<aiMaterial *> *pvOut, std::string &de
|
|||
pcHelper->AddProperty(&two_sided, 1, AI_MATKEY_TWOSIDED);
|
||||
}
|
||||
|
||||
//default texture
|
||||
// default texture
|
||||
if (!defaultTexture.empty()) {
|
||||
const aiString name(defaultTexture.c_str());
|
||||
pcHelper->AddProperty(&name, _AI_MATKEY_TEXTURE_BASE, aiTextureType_DIFFUSE, 0);
|
||||
}
|
||||
|
||||
//set to wireframe, so when using this material info we can switch to points rendering
|
||||
// set to wireframe, so when using this material info we can switch to points rendering
|
||||
if (pointsOnly) {
|
||||
const int wireframe = 1;
|
||||
pcHelper->AddProperty(&wireframe, 1, AI_MATKEY_ENABLE_WIREFRAME);
|
||||
|
|
@ -922,4 +912,6 @@ void PLYImporter::LoadMaterial(std::vector<aiMaterial *> *pvOut, std::string &de
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_PLY_IMPORTER
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ using namespace PLY;
|
|||
// ---------------------------------------------------------------------------
|
||||
/** Importer class to load the stanford PLY file format
|
||||
*/
|
||||
class PLYImporter : public BaseImporter {
|
||||
class PLYImporter final : public BaseImporter {
|
||||
public:
|
||||
PLYImporter();
|
||||
~PLYImporter() override;
|
||||
|
|
@ -120,13 +120,9 @@ protected:
|
|||
PLY::PropertyInstance::ValueUnion val,
|
||||
PLY::EDataType eType);
|
||||
|
||||
/** Buffer to hold the loaded file */
|
||||
private:
|
||||
unsigned char *mBuffer;
|
||||
|
||||
/** Document object model representation extracted from the file */
|
||||
PLY::DOM *pcDOM;
|
||||
|
||||
/** Mesh generated by loader */
|
||||
aiMesh *mGeneratedMesh;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
|
@ -48,8 +48,28 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/ByteSwapper.h>
|
||||
#include <assimp/fast_atof.h>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
std::string to_string(EElementSemantic e) {
|
||||
|
||||
switch (e) {
|
||||
case EEST_Vertex:
|
||||
return std::string{ "vertex" };
|
||||
case EEST_TriStrip:
|
||||
return std::string{ "tristrips" };
|
||||
case EEST_Edge:
|
||||
return std::string{ "edge" };
|
||||
case EEST_Material:
|
||||
return std::string{ "material" };
|
||||
case EEST_TextureFile:
|
||||
return std::string{ "TextureFile" };
|
||||
default:
|
||||
return std::string{ "invalid" };
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
PLY::EDataType PLY::Property::ParseDataType(std::vector<char> &buffer) {
|
||||
|
|
@ -280,6 +300,8 @@ bool PLY::Element::ParseElement(IOStreamBuffer<char> &streamBuffer, std::vector<
|
|||
// if the exact semantic can't be determined, just store
|
||||
// the original string identifier
|
||||
pOut->szName = std::string(&buffer[0], &buffer[0] + strlen(&buffer[0]));
|
||||
auto pos = pOut->szName.find_last_of(' ');
|
||||
pOut->szName.erase(pos, pOut->szName.size());
|
||||
}
|
||||
|
||||
if (!PLY::DOM::SkipSpaces(buffer))
|
||||
|
|
@ -295,7 +317,7 @@ bool PLY::Element::ParseElement(IOStreamBuffer<char> &streamBuffer, std::vector<
|
|||
return true;
|
||||
}
|
||||
|
||||
//parse the number of occurrences of this element
|
||||
// parse the number of occurrences of this element
|
||||
const char *pCur = (char *)&buffer[0];
|
||||
pOut->NumOccur = strtoul10(pCur, &pCur);
|
||||
|
||||
|
|
@ -307,8 +329,8 @@ bool PLY::Element::ParseElement(IOStreamBuffer<char> &streamBuffer, std::vector<
|
|||
streamBuffer.getNextLine(buffer);
|
||||
pCur = (char *)&buffer[0];
|
||||
|
||||
// skip all comments
|
||||
PLY::DOM::SkipComments(buffer);
|
||||
// skip all comments and go to next line
|
||||
if (PLY::DOM::SkipComments(buffer)) continue;
|
||||
|
||||
PLY::Property prop;
|
||||
if (!PLY::Property::ParseProperty(buffer, &prop))
|
||||
|
|
@ -320,13 +342,13 @@ bool PLY::Element::ParseElement(IOStreamBuffer<char> &streamBuffer, std::vector<
|
|||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool PLY::DOM::SkipSpaces(std::vector<char> &buffer) {
|
||||
const char *pCur = buffer.empty() ? nullptr : (char *)&buffer[0];
|
||||
const char *end = pCur + buffer.size();
|
||||
bool ret = false;
|
||||
if (pCur) {
|
||||
const char *szCur = pCur;
|
||||
ret = Assimp::SkipSpaces(pCur, &pCur);
|
||||
ret = Assimp::SkipSpaces(pCur, &pCur, end);
|
||||
|
||||
uintptr_t iDiff = (uintptr_t)pCur - (uintptr_t)szCur;
|
||||
buffer.erase(buffer.begin(), buffer.begin() + iDiff);
|
||||
|
|
@ -338,10 +360,11 @@ bool PLY::DOM::SkipSpaces(std::vector<char> &buffer) {
|
|||
|
||||
bool PLY::DOM::SkipLine(std::vector<char> &buffer) {
|
||||
const char *pCur = buffer.empty() ? nullptr : (char *)&buffer[0];
|
||||
const char *end = pCur + buffer.size();
|
||||
bool ret = false;
|
||||
if (pCur) {
|
||||
const char *szCur = pCur;
|
||||
ret = Assimp::SkipLine(pCur, &pCur);
|
||||
ret = Assimp::SkipLine(pCur, &pCur, end);
|
||||
|
||||
uintptr_t iDiff = (uintptr_t)pCur - (uintptr_t)szCur;
|
||||
buffer.erase(buffer.begin(), buffer.begin() + iDiff);
|
||||
|
|
@ -368,10 +391,11 @@ bool PLY::DOM::TokenMatch(std::vector<char> &buffer, const char *token, unsigned
|
|||
|
||||
bool PLY::DOM::SkipSpacesAndLineEnd(std::vector<char> &buffer) {
|
||||
const char *pCur = buffer.empty() ? nullptr : (char *)&buffer[0];
|
||||
const char *end = pCur + buffer.size();
|
||||
bool ret = false;
|
||||
if (pCur) {
|
||||
const char *szCur = pCur;
|
||||
ret = Assimp::SkipSpacesAndLineEnd(pCur, &pCur);
|
||||
ret = Assimp::SkipSpacesAndLineEnd(pCur, &pCur, end);
|
||||
|
||||
uintptr_t iDiff = (uintptr_t)pCur - (uintptr_t)szCur;
|
||||
buffer.erase(buffer.begin(), buffer.begin() + iDiff);
|
||||
|
|
@ -381,10 +405,10 @@ bool PLY::DOM::SkipSpacesAndLineEnd(std::vector<char> &buffer) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool PLY::DOM::SkipComments(std::vector<char> &buffer) {
|
||||
bool PLY::DOM::SkipComments(std::vector<char> buffer) {
|
||||
ai_assert(!buffer.empty());
|
||||
|
||||
std::vector<char> nbuffer = buffer;
|
||||
std::vector<char> nbuffer = std::move(buffer);
|
||||
// skip spaces
|
||||
if (!SkipSpaces(nbuffer)) {
|
||||
return false;
|
||||
|
|
@ -410,6 +434,7 @@ bool PLY::DOM::SkipComments(std::vector<char> &buffer) {
|
|||
bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char> &buffer, bool isBinary) {
|
||||
ASSIMP_LOG_VERBOSE_DEBUG("PLY::DOM::ParseHeader() begin");
|
||||
|
||||
std::unordered_set<std::string> definedAlElements;
|
||||
// parse all elements
|
||||
while (!buffer.empty()) {
|
||||
// skip all comments
|
||||
|
|
@ -418,13 +443,21 @@ bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char>
|
|||
PLY::Element out;
|
||||
if (PLY::Element::ParseElement(streamBuffer, buffer, &out)) {
|
||||
// add the element to the list of elements
|
||||
|
||||
const auto propertyName = (out.szName.empty()) ? to_string(out.eSemantic) : out.szName;
|
||||
auto alreadyDefined = definedAlElements.find(propertyName);
|
||||
if (alreadyDefined != definedAlElements.end()) {
|
||||
throw DeadlyImportError("Property '" + propertyName + "' in header already defined ");
|
||||
}
|
||||
definedAlElements.insert(propertyName);
|
||||
alElements.push_back(out);
|
||||
} else if (TokenMatch(buffer, "end_header", 10)) { //checks for /n ending, if it doesn't end with /r/n
|
||||
} else if (TokenMatch(buffer, "end_header", 10)) {
|
||||
// we have reached the end of the header
|
||||
break;
|
||||
} else {
|
||||
// ignore unknown header elements
|
||||
streamBuffer.getNextLine(buffer);
|
||||
if (!streamBuffer.getNextLine(buffer))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -444,7 +477,7 @@ bool PLY::DOM::ParseElementInstanceLists(IOStreamBuffer<char> &streamBuffer, std
|
|||
std::vector<PLY::ElementInstanceList>::iterator a = alElementData.begin();
|
||||
|
||||
// parse all element instances
|
||||
//construct vertices and faces
|
||||
// construct vertices and faces
|
||||
for (; i != alElements.end(); ++i, ++a) {
|
||||
if ((*i).eSemantic == EEST_Vertex || (*i).eSemantic == EEST_Face || (*i).eSemantic == EEST_TriStrip) {
|
||||
PLY::ElementInstanceList::ParseInstanceList(streamBuffer, buffer, &(*i), nullptr, loader);
|
||||
|
|
@ -501,10 +534,6 @@ bool PLY::DOM::ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM *p_pc
|
|||
|
||||
streamBuffer.getNextBlock(buffer);
|
||||
|
||||
// remove first char if it's /n in case of file with /r/n
|
||||
if (((char *)&buffer[0])[0] == '\n')
|
||||
buffer.erase(buffer.begin(), buffer.begin() + 1);
|
||||
|
||||
unsigned int bufferSize = static_cast<unsigned int>(buffer.size());
|
||||
const char *pCur = (char *)&buffer[0];
|
||||
if (!p_pcOut->ParseElementInstanceListsBinary(streamBuffer, buffer, pCur, bufferSize, loader, p_bBE)) {
|
||||
|
|
@ -530,7 +559,7 @@ bool PLY::DOM::ParseInstance(IOStreamBuffer<char> &streamBuffer, DOM *p_pcOut, P
|
|||
return false;
|
||||
}
|
||||
|
||||
//get next line after header
|
||||
// get next line after header
|
||||
streamBuffer.getNextLine(buffer);
|
||||
if (!p_pcOut->ParseElementInstanceLists(streamBuffer, buffer, loader)) {
|
||||
ASSIMP_LOG_VERBOSE_DEBUG("PLY::DOM::ParseInstance() failure");
|
||||
|
|
@ -560,23 +589,24 @@ bool PLY::ElementInstanceList::ParseInstanceList(
|
|||
}
|
||||
} else {
|
||||
const char *pCur = (const char *)&buffer[0];
|
||||
const char *end = pCur + buffer.size();
|
||||
// be sure to have enough storage
|
||||
for (unsigned int i = 0; i < pcElement->NumOccur; ++i) {
|
||||
if (p_pcOut)
|
||||
PLY::ElementInstance::ParseInstance(pCur, pcElement, &p_pcOut->alInstances[i]);
|
||||
PLY::ElementInstance::ParseInstance(pCur, end, pcElement, &p_pcOut->alInstances[i]);
|
||||
else {
|
||||
ElementInstance elt;
|
||||
PLY::ElementInstance::ParseInstance(pCur, pcElement, &elt);
|
||||
PLY::ElementInstance::ParseInstance(pCur, end, pcElement, &elt);
|
||||
|
||||
// Create vertex or face
|
||||
if (pcElement->eSemantic == EEST_Vertex) {
|
||||
//call loader instance from here
|
||||
// call loader instance from here
|
||||
loader->LoadVertex(pcElement, &elt, i);
|
||||
} else if (pcElement->eSemantic == EEST_Face) {
|
||||
//call loader instance from here
|
||||
// call loader instance from here
|
||||
loader->LoadFace(pcElement, &elt, i);
|
||||
} else if (pcElement->eSemantic == EEST_TriStrip) {
|
||||
//call loader instance from here
|
||||
// call loader instance from here
|
||||
loader->LoadFace(pcElement, &elt, i);
|
||||
}
|
||||
}
|
||||
|
|
@ -613,13 +643,13 @@ bool PLY::ElementInstanceList::ParseInstanceListBinary(
|
|||
|
||||
// Create vertex or face
|
||||
if (pcElement->eSemantic == EEST_Vertex) {
|
||||
//call loader instance from here
|
||||
// call loader instance from here
|
||||
loader->LoadVertex(pcElement, &elt, i);
|
||||
} else if (pcElement->eSemantic == EEST_Face) {
|
||||
//call loader instance from here
|
||||
// call loader instance from here
|
||||
loader->LoadFace(pcElement, &elt, i);
|
||||
} else if (pcElement->eSemantic == EEST_TriStrip) {
|
||||
//call loader instance from here
|
||||
// call loader instance from here
|
||||
loader->LoadFace(pcElement, &elt, i);
|
||||
}
|
||||
}
|
||||
|
|
@ -628,7 +658,7 @@ bool PLY::ElementInstanceList::ParseInstanceListBinary(
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool PLY::ElementInstance::ParseInstance(const char *&pCur,
|
||||
bool PLY::ElementInstance::ParseInstance(const char *&pCur, const char *end,
|
||||
const PLY::Element *pcElement,
|
||||
PLY::ElementInstance *p_pcOut) {
|
||||
ai_assert(nullptr != pcElement);
|
||||
|
|
@ -640,7 +670,7 @@ bool PLY::ElementInstance::ParseInstance(const char *&pCur,
|
|||
std::vector<PLY::PropertyInstance>::iterator i = p_pcOut->alProperties.begin();
|
||||
std::vector<PLY::Property>::const_iterator a = pcElement->alProperties.begin();
|
||||
for (; i != p_pcOut->alProperties.end(); ++i, ++a) {
|
||||
if (!(PLY::PropertyInstance::ParseInstance(pCur, &(*a), &(*i)))) {
|
||||
if (!(PLY::PropertyInstance::ParseInstance(pCur, end, &(*a), &(*i)))) {
|
||||
ASSIMP_LOG_WARN("Unable to parse property instance. "
|
||||
"Skipping this element instance");
|
||||
|
||||
|
|
@ -680,13 +710,13 @@ bool PLY::ElementInstance::ParseInstanceBinary(
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool PLY::PropertyInstance::ParseInstance(const char *&pCur,
|
||||
const PLY::Property *prop, PLY::PropertyInstance *p_pcOut) {
|
||||
bool PLY::PropertyInstance::ParseInstance(const char *&pCur, const char *end, const PLY::Property *prop,
|
||||
PLY::PropertyInstance *p_pcOut) {
|
||||
ai_assert(nullptr != prop);
|
||||
ai_assert(nullptr != p_pcOut);
|
||||
|
||||
// skip spaces at the beginning
|
||||
if (!SkipSpaces(&pCur)) {
|
||||
if (!SkipSpaces(&pCur, end)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -701,7 +731,7 @@ bool PLY::PropertyInstance::ParseInstance(const char *&pCur,
|
|||
// parse all list elements
|
||||
p_pcOut->avList.resize(iNum);
|
||||
for (unsigned int i = 0; i < iNum; ++i) {
|
||||
if (!SkipSpaces(&pCur))
|
||||
if (!SkipSpaces(&pCur, end))
|
||||
return false;
|
||||
|
||||
PLY::PropertyInstance::ParseValue(pCur, prop->eType, &p_pcOut->avList[i]);
|
||||
|
|
@ -713,7 +743,7 @@ bool PLY::PropertyInstance::ParseInstance(const char *&pCur,
|
|||
PLY::PropertyInstance::ParseValue(pCur, prop->eType, &v);
|
||||
p_pcOut->avList.push_back(v);
|
||||
}
|
||||
SkipSpacesAndLineEnd(&pCur);
|
||||
SkipSpacesAndLineEnd(&pCur, end);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -776,7 +806,7 @@ bool PLY::PropertyInstance::ParseValue(const char *&pCur,
|
|||
ai_assert(nullptr != pCur);
|
||||
ai_assert(nullptr != out);
|
||||
|
||||
//calc element size
|
||||
// calc element size
|
||||
bool ret = true;
|
||||
switch (eType) {
|
||||
case EDT_UInt:
|
||||
|
|
@ -826,7 +856,7 @@ bool PLY::PropertyInstance::ParseValueBinary(IOStreamBuffer<char> &streamBuffer,
|
|||
bool p_bBE) {
|
||||
ai_assert(nullptr != out);
|
||||
|
||||
//calc element size
|
||||
// calc element size
|
||||
unsigned int lsize = 0;
|
||||
switch (eType) {
|
||||
case EDT_Char:
|
||||
|
|
@ -854,11 +884,11 @@ bool PLY::PropertyInstance::ParseValueBinary(IOStreamBuffer<char> &streamBuffer,
|
|||
break;
|
||||
}
|
||||
|
||||
//read the next file block if needed
|
||||
// read the next file block if needed
|
||||
if (bufferSize < lsize) {
|
||||
std::vector<char> nbuffer;
|
||||
if (streamBuffer.getNextBlock(nbuffer)) {
|
||||
//concat buffer contents
|
||||
// concat buffer contents
|
||||
buffer = std::vector<char>(buffer.end() - bufferSize, buffer.end());
|
||||
buffer.insert(buffer.end(), nbuffer.begin(), nbuffer.end());
|
||||
nbuffer.clear();
|
||||
|
|
@ -960,4 +990,6 @@ bool PLY::PropertyInstance::ParseValueBinary(IOStreamBuffer<char> &streamBuffer,
|
|||
return ret;
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_PLY_IMPORTER
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -296,9 +296,7 @@ class PropertyInstance
|
|||
public:
|
||||
|
||||
//! Default constructor
|
||||
PropertyInstance() AI_NO_EXCEPT {
|
||||
// empty
|
||||
}
|
||||
PropertyInstance() AI_NO_EXCEPT = default;
|
||||
|
||||
union ValueUnion
|
||||
{
|
||||
|
|
@ -326,7 +324,7 @@ public:
|
|||
|
||||
// -------------------------------------------------------------------
|
||||
//! Parse a property instance
|
||||
static bool ParseInstance(const char* &pCur,
|
||||
static bool ParseInstance(const char* &pCur, const char *end,
|
||||
const Property* prop, PropertyInstance* p_pcOut);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
|
@ -359,17 +357,14 @@ public:
|
|||
class ElementInstance {
|
||||
public:
|
||||
//! Default constructor
|
||||
ElementInstance() AI_NO_EXCEPT
|
||||
: alProperties() {
|
||||
// empty
|
||||
}
|
||||
ElementInstance() AI_NO_EXCEPT = default;
|
||||
|
||||
//! List of all parsed properties
|
||||
std::vector< PropertyInstance > alProperties;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//! Parse an element instance
|
||||
static bool ParseInstance(const char* &pCur,
|
||||
static bool ParseInstance(const char *&pCur, const char *end,
|
||||
const Element* pcElement, ElementInstance* p_pcOut);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
|
@ -386,10 +381,7 @@ class ElementInstanceList
|
|||
public:
|
||||
|
||||
//! Default constructor
|
||||
ElementInstanceList() AI_NO_EXCEPT
|
||||
: alInstances() {
|
||||
// empty
|
||||
}
|
||||
ElementInstanceList() AI_NO_EXCEPT = default;
|
||||
|
||||
//! List of all element instances
|
||||
std::vector< ElementInstance > alInstances;
|
||||
|
|
@ -413,11 +405,7 @@ class DOM
|
|||
public:
|
||||
|
||||
//! Default constructor
|
||||
DOM() AI_NO_EXCEPT
|
||||
: alElements()
|
||||
, alElementData() {
|
||||
|
||||
}
|
||||
DOM() AI_NO_EXCEPT = default;
|
||||
|
||||
|
||||
//! Contains all elements of the file format
|
||||
|
|
@ -431,7 +419,7 @@ public:
|
|||
static bool ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM* p_pcOut, PLYImporter* loader, bool p_bBE);
|
||||
|
||||
//! Skip all comment lines after this
|
||||
static bool SkipComments(std::vector<char> &buffer);
|
||||
static bool SkipComments(std::vector<char> buffer);
|
||||
|
||||
static bool SkipSpaces(std::vector<char> &buffer);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue