mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-22 16:13:45 +00:00
update assimp lib
This commit is contained in:
parent
03a348deb7
commit
d3f8fee74e
1725 changed files with 196314 additions and 62009 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue