mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
update assimp to 6.0.5
This commit is contained in:
parent
2d2eb57e2e
commit
f5cf21cfeb
941 changed files with 22718 additions and 12240 deletions
|
|
@ -2,8 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -396,9 +395,12 @@ void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ObjExporter::AddNode(const aiNode* nd, const aiMatrix4x4& mParent, bool merge_identical_vertices) {
|
||||
if (nd == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const aiMatrix4x4& mAbs = mParent * nd->mTransformation;
|
||||
|
||||
aiMesh *cm( nullptr );
|
||||
aiMesh *cm{nullptr};
|
||||
for(unsigned int i = 0; i < nd->mNumMeshes; ++i) {
|
||||
cm = pScene->mMeshes[nd->mMeshes[i]];
|
||||
if (nullptr != cm) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
|
@ -62,7 +62,7 @@ namespace Assimp {
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
/** Helper class to export a given scene to an OBJ file. */
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
class ObjExporter {
|
||||
class ObjExporter final {
|
||||
public:
|
||||
/// Constructor for a specific scene to export
|
||||
ObjExporter(const char* filename, const aiScene* pScene, bool noMtl=false, const ExportProperties* props = nullptr);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -165,21 +165,23 @@ struct Material {
|
|||
//! Ambient color
|
||||
aiColor3D ambient;
|
||||
//! Diffuse color
|
||||
aiColor3D diffuse;
|
||||
aiColor3D diffuse = aiColor3D(0.6f, 0.6f, 0.6f);
|
||||
//! Specular color
|
||||
aiColor3D specular;
|
||||
//! Emissive color
|
||||
aiColor3D emissive;
|
||||
//! Alpha value
|
||||
ai_real alpha;
|
||||
ai_real alpha = ai_real(1.0);
|
||||
//! Shineness factor
|
||||
ai_real shineness;
|
||||
ai_real shineness = ai_real(0.0);
|
||||
//! Illumination model
|
||||
int illumination_model;
|
||||
int illumination_model = 1;
|
||||
//! Index of refraction
|
||||
ai_real ior;
|
||||
ai_real ior = ai_real(1.0);
|
||||
//! Transparency color
|
||||
aiColor3D transparent;
|
||||
aiColor3D transparent = aiColor3D(1.0f, 1.0f, 1.0f);
|
||||
//! Ambient occlusion
|
||||
Maybe<ai_real> ambient_occlusion;
|
||||
|
||||
//! PBR Roughness
|
||||
Maybe<ai_real> roughness;
|
||||
|
|
@ -187,31 +189,33 @@ struct Material {
|
|||
Maybe<ai_real> metallic;
|
||||
//! PBR Metallic
|
||||
Maybe<aiColor3D> sheen;
|
||||
//! PBR Sheen: an additional grazing component, primarily intended for cloth.
|
||||
Maybe<ai_real> sheen_grazing;
|
||||
//! PBR Sheen Tint: amount to tint sheen towards base color.
|
||||
Maybe<ai_real> sheen_tint;
|
||||
//! PBR Clearcoat
|
||||
Maybe<ai_real> clearcoat;
|
||||
//! PBR Clearcoat Thickness
|
||||
Maybe<ai_real> clearcoat_thickness;
|
||||
//! PBR Clearcoat Rougness
|
||||
Maybe<ai_real> clearcoat_roughness;
|
||||
//! PBR clearcoatGloss: controls clearcoat glossiness (0 = a “satin” appearance, 1 = a “gloss” appearance).
|
||||
Maybe<ai_real> clearcoat_gloss;
|
||||
//! PBR Anisotropy
|
||||
ai_real anisotropy;
|
||||
ai_real anisotropy = ai_real(0.0);
|
||||
//! PBR Anisotropy Rotation
|
||||
Maybe<ai_real> anisotropy_rotation;
|
||||
//! PBR Subsurface Scattering
|
||||
Maybe<ai_real> subsurface_scattering;
|
||||
//! PBR Specular Tint: a concession for artistic control that tints incident specular towards the base color.
|
||||
Maybe<ai_real> specular_tint;
|
||||
// See: https://disneyanimation.com/publications/physically-based-shading-at-disney/
|
||||
|
||||
//! bump map multipler (normal map scalar)(-bm)
|
||||
ai_real bump_multiplier;
|
||||
//! bump map multiplier (normal map scalar)(-bm)
|
||||
ai_real bump_multiplier = ai_real(1.0);
|
||||
|
||||
//! Constructor
|
||||
Material() :
|
||||
diffuse(0.6f, 0.6f, 0.6f),
|
||||
alpha(ai_real(1.0)),
|
||||
shineness(ai_real(0.0)),
|
||||
illumination_model(1),
|
||||
ior(ai_real(1.0)),
|
||||
transparent(1.0f, 1.0, 1.0),
|
||||
roughness(),
|
||||
metallic(),
|
||||
sheen(),
|
||||
clearcoat_thickness(),
|
||||
clearcoat_roughness(),
|
||||
anisotropy(ai_real(0.0)),
|
||||
bump_multiplier(ai_real(1.0)) {
|
||||
Material() {
|
||||
std::fill_n(clamp, static_cast<unsigned int>(TextureTypeCount), false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model *pModel, const ObjFile
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Create topology data
|
||||
std::unique_ptr<aiMesh> ObjFileImporter::createTopology(const ObjFile::Model *pModel, const ObjFile::Object *pData, unsigned int meshIndex) {
|
||||
if (nullptr == pData || pModel == nullptr) {
|
||||
if (nullptr == pData || pModel == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ std::unique_ptr<aiMesh> ObjFileImporter::createTopology(const ObjFile::Model *pM
|
|||
if (inp == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (inp->mPrimitiveType == aiPrimitiveType_LINE) {
|
||||
pMesh->mNumFaces += static_cast<unsigned int>(inp->m_vertices.size() - 1);
|
||||
pMesh->mPrimitiveTypes |= aiPrimitiveType_LINE;
|
||||
|
|
@ -403,7 +403,7 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model *pModel,
|
|||
// Checking preconditions
|
||||
if (pCurrentObject == nullptr || pModel == nullptr || pMesh == nullptr) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Break, if no faces are stored in object
|
||||
if (pCurrentObject->m_Meshes.empty()) {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct Model;
|
|||
/// \class ObjFileImporter
|
||||
/// \brief Imports a waveform obj file
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
class ObjFileImporter : public BaseImporter {
|
||||
class ObjFileImporter final : public BaseImporter {
|
||||
public:
|
||||
/// \brief Default constructor
|
||||
ObjFileImporter();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "ObjFileMtlImporter.h"
|
||||
#include "ObjFileData.h"
|
||||
#include "ObjTools.h"
|
||||
#include <assimp/DefaultIOSystem.h>
|
||||
#include <assimp/ParsingUtils.h>
|
||||
#include <assimp/fast_atof.h>
|
||||
#include <assimp/material.h>
|
||||
|
|
@ -89,8 +90,9 @@ static constexpr char TypeOption[] = "-type";
|
|||
// -------------------------------------------------------------------
|
||||
// Constructor
|
||||
ObjFileMtlImporter::ObjFileMtlImporter(std::vector<char> &buffer,
|
||||
const std::string &,
|
||||
const std::string &strAbsPath,
|
||||
ObjFile::Model *pModel) :
|
||||
m_strAbsPath(strAbsPath),
|
||||
m_DataIt(buffer.begin()),
|
||||
m_DataItEnd(buffer.end()),
|
||||
m_pModel(pModel),
|
||||
|
|
@ -103,13 +105,23 @@ ObjFileMtlImporter::ObjFileMtlImporter(std::vector<char> &buffer,
|
|||
m_pModel->mDefaultMaterial = new ObjFile::Material;
|
||||
m_pModel->mDefaultMaterial->MaterialName.Set("default");
|
||||
}
|
||||
|
||||
// Try with OS folder separator first
|
||||
char folderSeparator = DefaultIOSystem().getOsSeparator();
|
||||
std::size_t found = m_strAbsPath.find_last_of(folderSeparator);
|
||||
if (found == std::string::npos) {
|
||||
// Not found, try alternative folder separator
|
||||
folderSeparator = (folderSeparator == '/' ? '\\' : '/');
|
||||
found = m_strAbsPath.find_last_of(folderSeparator);
|
||||
}
|
||||
if (found != std::string::npos) {
|
||||
m_strAbsPath = m_strAbsPath.substr(0, found + 1);
|
||||
} else {
|
||||
m_strAbsPath = "";
|
||||
}
|
||||
load();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Destructor
|
||||
ObjFileMtlImporter::~ObjFileMtlImporter() = default;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Loads the material description
|
||||
void ObjFileMtlImporter::load() {
|
||||
|
|
@ -223,24 +235,64 @@ void ObjFileMtlImporter::load() {
|
|||
++m_DataIt;
|
||||
if (m_pModel->mCurrentMaterial != nullptr)
|
||||
getFloatValue(m_pModel->mCurrentMaterial->clearcoat_roughness);
|
||||
} else {
|
||||
} else if (*m_DataIt == 't') {
|
||||
++m_DataIt;
|
||||
if (m_pModel->mCurrentMaterial != nullptr)
|
||||
getFloatValue(m_pModel->mCurrentMaterial->clearcoat_thickness);
|
||||
} else {
|
||||
if (m_pModel->mCurrentMaterial != nullptr)
|
||||
getFloatValue(m_pModel->mCurrentMaterial->clearcoat);
|
||||
}
|
||||
break;
|
||||
}
|
||||
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm': // Texture or metallic
|
||||
{
|
||||
// Save start of token (after 'm')
|
||||
auto tokenStart = m_DataIt; // points to 'm'
|
||||
auto tokenEnd = getNextDelimiter(m_DataIt, m_DataItEnd); // move iterator to end of token
|
||||
|
||||
std::string keyword(tokenStart, tokenEnd);
|
||||
m_DataIt = getNextWord(tokenEnd, m_DataItEnd); // advance iterator
|
||||
|
||||
if (keyword.compare(0, 3, "map") == 0) {
|
||||
// starts with "map", treat as texture map
|
||||
m_DataIt = tokenStart;
|
||||
getTexture();
|
||||
} else if (keyword == "metallic" || keyword == "metal" || keyword == "metalness") {
|
||||
// parse metallic float value instead of texture
|
||||
getFloatIfMaterialValid(&ObjFile::Material::metallic);
|
||||
}
|
||||
|
||||
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
||||
} break;
|
||||
|
||||
case 'm': // Texture
|
||||
case 'b': // quick'n'dirty - for 'bump' sections
|
||||
case 'r': // quick'n'dirty - for 'refl' sections
|
||||
{
|
||||
getTexture();
|
||||
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
||||
} break;
|
||||
|
||||
case 'r': // refl (map) or roughness (float)
|
||||
{
|
||||
auto tokenStart = m_DataIt; // points to 'r'
|
||||
auto tokenEnd = getNextDelimiter(m_DataIt, m_DataItEnd);
|
||||
std::string keyword(tokenStart, tokenEnd);
|
||||
m_DataIt = getNextWord(tokenEnd, m_DataItEnd);
|
||||
|
||||
if (keyword == "roughness" || keyword == "rough") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::roughness);
|
||||
} else if (keyword == "refl" || keyword == "reflection") {
|
||||
m_DataIt = tokenStart;
|
||||
getTexture();
|
||||
}
|
||||
|
||||
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
||||
} break;
|
||||
|
||||
case 'i': // Illumination model
|
||||
{
|
||||
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
||||
|
|
@ -249,11 +301,60 @@ void ObjFileMtlImporter::load() {
|
|||
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
||||
} break;
|
||||
|
||||
case 'a': // Anisotropy
|
||||
{
|
||||
++m_DataIt;
|
||||
if (m_pModel->mCurrentMaterial != nullptr)
|
||||
getFloatValue(m_pModel->mCurrentMaterial->anisotropy);
|
||||
case 'a': {
|
||||
auto tokenStart = m_DataIt;
|
||||
auto tokenEnd = getNextDelimiter(m_DataIt, m_DataItEnd);
|
||||
std::string keyword(tokenStart, tokenEnd);
|
||||
m_DataIt = getNextWord(tokenEnd, m_DataItEnd);
|
||||
|
||||
if (keyword == "aniso" || keyword == "anisotropy") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::anisotropy);
|
||||
} else if (keyword == "ao") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::ambient_occlusion);
|
||||
} else if (keyword == "anisor" || ai_stdStrToLower(keyword) == "anisotropicrotation") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::anisotropy_rotation);
|
||||
} else {
|
||||
ASSIMP_LOG_WARN("Unhandled keyword: ", keyword );
|
||||
}
|
||||
|
||||
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
||||
} break;
|
||||
|
||||
case 's': {
|
||||
auto tokenStart = m_DataIt;
|
||||
auto tokenEnd = getNextDelimiter(m_DataIt, m_DataItEnd);
|
||||
std::string keyword(tokenStart, tokenEnd);
|
||||
m_DataIt = getNextWord(tokenEnd,m_DataItEnd);
|
||||
|
||||
if (keyword == "subsurface" || keyword == "scattering") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::subsurface_scattering);
|
||||
} else if (ai_stdStrToLower(keyword) == "speculartint") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::specular_tint);
|
||||
} else if (keyword == "sheen") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::sheen_grazing);
|
||||
} else if (ai_stdStrToLower(keyword) == "sheentint") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::sheen_tint);
|
||||
} else {
|
||||
ASSIMP_LOG_WARN("Unhandled keyword: ", keyword );
|
||||
}
|
||||
|
||||
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
||||
} break;
|
||||
|
||||
case 'c': {
|
||||
auto tokenStart = m_DataIt;
|
||||
auto tokenEnd = getNextDelimiter(m_DataIt, m_DataItEnd);
|
||||
std::string keyword(tokenStart, tokenEnd);
|
||||
m_DataIt = getNextWord(tokenEnd, m_DataItEnd);
|
||||
|
||||
if (ai_stdStrToLower(keyword) == "clearcoat") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::clearcoat);
|
||||
} else if (ai_stdStrToLower(keyword) == "clearcoatgloss") {
|
||||
getFloatIfMaterialValid(&ObjFile::Material::clearcoat_gloss);
|
||||
} else {
|
||||
ASSIMP_LOG_WARN("Unhandled keyword: ", keyword );
|
||||
}
|
||||
|
||||
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
||||
} break;
|
||||
|
||||
|
|
@ -320,6 +421,23 @@ void ObjFileMtlImporter::getFloatValue(Maybe<ai_real> &value) {
|
|||
value = Maybe<ai_real>();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Writes a loaded single float value if material not null
|
||||
void ObjFileMtlImporter::getFloatIfMaterialValid(ai_real ObjFile::Material::*member) {
|
||||
if (m_pModel != nullptr && m_pModel->mCurrentMaterial != nullptr) {
|
||||
// This will call getFloatValue(ai_real&)
|
||||
getFloatValue(m_pModel->mCurrentMaterial->*member);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
void ObjFileMtlImporter::getFloatIfMaterialValid(Maybe<ai_real> ObjFile::Material::*member) {
|
||||
// It can directly access `m_pModel` because it's part of the class
|
||||
if (m_pModel != nullptr && m_pModel->mCurrentMaterial != nullptr) {
|
||||
getFloatValue(m_pModel->mCurrentMaterial->*member);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Creates a material from loaded data.
|
||||
void ObjFileMtlImporter::createMaterial() {
|
||||
|
|
@ -446,7 +564,7 @@ void ObjFileMtlImporter::getTexture() {
|
|||
std::string texture;
|
||||
m_DataIt = getName<DataArrayIt>(m_DataIt, m_DataItEnd, texture);
|
||||
if (nullptr != out) {
|
||||
out->Set(texture);
|
||||
out->Set(m_strAbsPath + texture);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -71,13 +71,12 @@ public:
|
|||
ObjFile::Model *pModel);
|
||||
|
||||
//! \brief The class destructor
|
||||
~ObjFileMtlImporter();
|
||||
~ObjFileMtlImporter() = default;
|
||||
|
||||
ObjFileMtlImporter(const ObjFileMtlImporter &rOther) = delete;
|
||||
ObjFileMtlImporter &operator=(const ObjFileMtlImporter &rOther) = delete;
|
||||
|
||||
private:
|
||||
/// Copy constructor, empty.
|
||||
/// Load the whole material description
|
||||
void load();
|
||||
/// Get color data.
|
||||
|
|
@ -88,6 +87,8 @@ private:
|
|||
/// Gets a float value from data.
|
||||
void getFloatValue(ai_real &value);
|
||||
void getFloatValue(Maybe<ai_real> &value);
|
||||
void getFloatIfMaterialValid(ai_real ObjFile::Material::*member);
|
||||
void getFloatIfMaterialValid(Maybe<ai_real> ObjFile::Material::*member);
|
||||
/// Creates a new material from loaded data.
|
||||
void createMaterial();
|
||||
/// Get texture name from loaded data.
|
||||
|
|
@ -109,8 +110,6 @@ private:
|
|||
std::vector<char> m_buffer;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
} // Namespace Assimp
|
||||
|
||||
#endif // OBJFILEMTLIMPORTER_H_INC
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -55,18 +55,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
namespace Assimp {
|
||||
|
||||
// Forward declarations
|
||||
class ObjFileImporter;
|
||||
class IOSystem;
|
||||
class ProgressHandler;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/// \class ObjFileParser
|
||||
/// \brief Parser for a obj waveform file
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
class ASSIMP_API ObjFileParser {
|
||||
public:
|
||||
static const size_t Buffersize = 4096;
|
||||
typedef std::vector<char> DataArray;
|
||||
typedef std::vector<char>::iterator DataArrayIt;
|
||||
typedef std::vector<char>::const_iterator ConstDataArrayIt;
|
||||
static constexpr size_t Buffersize = 4096;
|
||||
using DataArray = std::vector<char>;
|
||||
using DataArrayIt = std::vector<char>::iterator;
|
||||
using ConstDataArrayIt = std::vector<char>::const_iterator;
|
||||
|
||||
/// @brief The default constructor.
|
||||
ObjFileParser();
|
||||
|
|
@ -87,8 +90,6 @@ protected:
|
|||
void parseFile(IOStreamBuffer<char> &streamBuffer);
|
||||
/// Method to copy the new delimited word in the current line.
|
||||
void copyNextWord(char *pBuffer, size_t length);
|
||||
/// Method to copy the new line.
|
||||
// void copyNextLine(char *pBuffer, size_t length);
|
||||
/// Get the number of components in a line.
|
||||
size_t getNumComponentsInDataDefinition();
|
||||
/// Stores the vector
|
||||
|
|
@ -105,8 +106,8 @@ protected:
|
|||
void getFace(aiPrimitiveType type);
|
||||
/// Reads the material description.
|
||||
void getMaterialDesc();
|
||||
/// Gets a comment.
|
||||
void getComment();
|
||||
/// Skip a comment.
|
||||
void skipComment();
|
||||
/// Gets a a material library.
|
||||
void getMaterialLib();
|
||||
/// Creates a new material.
|
||||
|
|
@ -114,9 +115,9 @@ protected:
|
|||
/// Gets the group name from file.
|
||||
void getGroupName();
|
||||
/// Gets the group number from file.
|
||||
void getGroupNumber();
|
||||
void skipGroupNumber();
|
||||
/// Gets the group number and resolution from file.
|
||||
void getGroupNumberAndResolution();
|
||||
void skipGroupNumberAndResolution();
|
||||
/// Returns the index of the material. Is -1 if not material was found.
|
||||
int getMaterialIndex(const std::string &strMaterialName);
|
||||
/// Parse object name
|
||||
|
|
@ -134,22 +135,23 @@ private:
|
|||
/// Default material name
|
||||
static constexpr const char DEFAULT_MATERIAL[] = AI_DEFAULT_MATERIAL_NAME;
|
||||
//! Iterator to current position in buffer
|
||||
DataArrayIt m_DataIt;
|
||||
DataArrayIt mDataIt{};
|
||||
//! Iterator to end position of buffer
|
||||
DataArrayIt m_DataItEnd;
|
||||
DataArrayIt mDataItEnd{};
|
||||
//! Pointer to model instance
|
||||
std::unique_ptr<ObjFile::Model> m_pModel;
|
||||
std::unique_ptr<ObjFile::Model> mModel{};
|
||||
//! Current line (for debugging)
|
||||
unsigned int m_uiLine;
|
||||
unsigned int mLine{ 0 };
|
||||
//! Helper buffer
|
||||
char m_buffer[Buffersize];
|
||||
const char *mEnd;
|
||||
char mBuffer[Buffersize];
|
||||
/// End of buffer
|
||||
const char *mEnd{ nullptr };
|
||||
/// Pointer to IO system instance.
|
||||
IOSystem *m_pIO;
|
||||
IOSystem *mIO{ nullptr };
|
||||
//! Pointer to progress handler
|
||||
ProgressHandler *m_progress;
|
||||
ProgressHandler *mProgress{ nullptr };
|
||||
/// Path to the current model, name of the obj file where the buffer comes from
|
||||
const std::string m_originalObjFileName;
|
||||
const std::string mOriginalObjFileName{};
|
||||
};
|
||||
|
||||
} // Namespace Assimp
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -85,6 +85,23 @@ inline Char_T getNextWord(Char_T pBuffer, Char_T pEnd) {
|
|||
return pBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns next space
|
||||
* @param[in] pBuffer Pointer to data buffer
|
||||
* @param[in] pEnd Pointer to end of buffer
|
||||
* @return Pointer to next space
|
||||
*/
|
||||
template <class Char_T>
|
||||
inline Char_T getNextDelimiter(Char_T pBuffer, Char_T pEnd) {
|
||||
while (!isEndOfBuffer(pBuffer, pEnd)) {
|
||||
if (IsSpaceOrNewLine(*pBuffer)) {
|
||||
break;
|
||||
}
|
||||
++pBuffer;
|
||||
}
|
||||
return pBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns pointer a next token
|
||||
* @param[in] pBuffer Pointer to data buffer
|
||||
|
|
@ -93,12 +110,7 @@ inline Char_T getNextWord(Char_T pBuffer, Char_T pEnd) {
|
|||
*/
|
||||
template <class Char_T>
|
||||
inline Char_T getNextToken(Char_T pBuffer, Char_T pEnd) {
|
||||
while (!isEndOfBuffer(pBuffer, pEnd)) {
|
||||
if (IsSpaceOrNewLine(*pBuffer)) {
|
||||
break;
|
||||
}
|
||||
++pBuffer;
|
||||
}
|
||||
pBuffer = getNextDelimiter(pBuffer, pEnd);
|
||||
return getNextWord(pBuffer, pEnd);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue