Merge branch 'master' into master
commit
12ee223a1a
|
@ -1,6 +1,6 @@
|
|||
FROM ubuntu:22.04
|
||||
|
||||
RUN apt-get update && apt-get install -y ninja-build \
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y ninja-build \
|
||||
git cmake build-essential software-properties-common
|
||||
|
||||
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update
|
||||
|
|
|
@ -57,8 +57,8 @@ 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) {
|
||||
const size_t len = strlen(color);
|
||||
bool validateColorString(const std::string color) {
|
||||
const size_t len = color.size();
|
||||
if (ColRGBA_Len != len && ColRGB_Len != len) {
|
||||
return false;
|
||||
}
|
||||
|
@ -157,8 +157,8 @@ aiMatrix4x4 parseTransformMatrix(const std::string& matrixStr) {
|
|||
return transformMatrix;
|
||||
}
|
||||
|
||||
bool parseColor(const char *color, aiColor4D &diffuse) {
|
||||
if (nullptr == color) {
|
||||
bool parseColor(const std::string &color, aiColor4D &diffuse) {
|
||||
if (color.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ bool parseColor(const char *color, aiColor4D &diffuse) {
|
|||
|
||||
char b[3] = { color[5], color[6], '\0' };
|
||||
diffuse.b = static_cast<ai_real>(strtol(b, nullptr, 16)) / ai_real(255.0);
|
||||
const size_t len = strlen(color);
|
||||
const size_t len = color.size();
|
||||
if (ColRGB_Len == len) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -178,28 +178,6 @@ bool AMFImporter::XML_SearchNode(const std::string &nodeName) {
|
|||
return nullptr != mXmlParser->findNode(nodeName);
|
||||
}
|
||||
|
||||
void AMFImporter::ParseHelper_FixTruncatedFloatString(const char *pInStr, std::string &pOutString) {
|
||||
size_t instr_len;
|
||||
|
||||
pOutString.clear();
|
||||
instr_len = strlen(pInStr);
|
||||
if (!instr_len) return;
|
||||
|
||||
pOutString.reserve(instr_len * 3 / 2);
|
||||
// check and correct floats in format ".x". Must be "x.y".
|
||||
if (pInStr[0] == '.') pOutString.push_back('0');
|
||||
|
||||
pOutString.push_back(pInStr[0]);
|
||||
for (size_t ci = 1; ci < instr_len; ci++) {
|
||||
if ((pInStr[ci] == '.') && ((pInStr[ci - 1] == ' ') || (pInStr[ci - 1] == '-') || (pInStr[ci - 1] == '+') || (pInStr[ci - 1] == '\t'))) {
|
||||
pOutString.push_back('0');
|
||||
pOutString.push_back('.');
|
||||
} else {
|
||||
pOutString.push_back(pInStr[ci]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool ParseHelper_Decode_Base64_IsBase64(const char pChar) {
|
||||
return (isalnum((unsigned char)pChar) || (pChar == '+') || (pChar == '/'));
|
||||
}
|
||||
|
@ -213,7 +191,10 @@ void AMFImporter::ParseHelper_Decode_Base64(const std::string &pInputBase64, std
|
|||
uint8_t arr4[4], arr3[3];
|
||||
|
||||
// check input data
|
||||
if (pInputBase64.size() % 4) throw DeadlyImportError("Base64-encoded data must have size multiply of four.");
|
||||
if (pInputBase64.size() % 4) {
|
||||
throw DeadlyImportError("Base64-encoded data must have size multiply of four.");
|
||||
}
|
||||
|
||||
// prepare output place
|
||||
pOutputData.clear();
|
||||
pOutputData.reserve(pInputBase64.size() / 4 * 3);
|
||||
|
|
|
@ -168,7 +168,6 @@ public:
|
|||
AI_WONT_RETURN void Throw_ID_NotFound(const std::string &pID) const AI_WONT_RETURN_SUFFIX;
|
||||
void XML_CheckNode_MustHaveChildren(pugi::xml_node &node);
|
||||
bool XML_SearchNode(const std::string &nodeName);
|
||||
void ParseHelper_FixTruncatedFloatString(const char *pInStr, std::string &pOutString);
|
||||
AMFImporter(const AMFImporter &pScene) = delete;
|
||||
AMFImporter &operator=(const AMFImporter &pScene) = delete;
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/// \class CAMFImporter_NodeElement
|
||||
/// Base class for elements of nodes.
|
||||
class AMFNodeElementBase {
|
||||
public:
|
||||
|
@ -106,7 +105,6 @@ protected:
|
|||
}
|
||||
}; // class IAMFImporter_NodeElement
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Constellation
|
||||
/// A collection of objects or constellations with specific relative locations.
|
||||
struct AMFConstellation : public AMFNodeElementBase {
|
||||
/// Constructor.
|
||||
|
@ -116,7 +114,6 @@ struct AMFConstellation : public AMFNodeElementBase {
|
|||
|
||||
}; // struct CAMFImporter_NodeElement_Constellation
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Instance
|
||||
/// Part of constellation.
|
||||
struct AMFInstance : public AMFNodeElementBase {
|
||||
|
||||
|
@ -135,7 +132,6 @@ struct AMFInstance : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Instance, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Metadata
|
||||
/// Structure that define metadata node.
|
||||
struct AMFMetadata : public AMFNodeElementBase {
|
||||
|
||||
|
@ -148,7 +144,6 @@ struct AMFMetadata : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Metadata, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Root
|
||||
/// Structure that define root node.
|
||||
struct AMFRoot : public AMFNodeElementBase {
|
||||
|
||||
|
@ -161,7 +156,6 @@ struct AMFRoot : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Root, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Color
|
||||
/// Structure that define object node.
|
||||
struct AMFColor : public AMFNodeElementBase {
|
||||
bool Composed; ///< Type of color stored: if true then look for formula in \ref Color_Composed[4], else - in \ref Color.
|
||||
|
@ -177,7 +171,6 @@ struct AMFColor : public AMFNodeElementBase {
|
|||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Material
|
||||
/// Structure that define material node.
|
||||
struct AMFMaterial : public AMFNodeElementBase {
|
||||
|
||||
|
@ -187,7 +180,6 @@ struct AMFMaterial : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Material, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Object
|
||||
/// Structure that define object node.
|
||||
struct AMFObject : public AMFNodeElementBase {
|
||||
|
||||
|
@ -206,7 +198,6 @@ struct AMFMesh : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Mesh, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Vertex
|
||||
/// Structure that define vertex node.
|
||||
struct AMFVertex : public AMFNodeElementBase {
|
||||
/// Constructor.
|
||||
|
@ -215,7 +206,6 @@ struct AMFVertex : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Vertex, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Edge
|
||||
/// Structure that define edge node.
|
||||
struct AMFEdge : public AMFNodeElementBase {
|
||||
/// Constructor.
|
||||
|
@ -224,7 +214,6 @@ struct AMFEdge : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Edge, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Vertices
|
||||
/// Structure that define vertices node.
|
||||
struct AMFVertices : public AMFNodeElementBase {
|
||||
/// Constructor.
|
||||
|
@ -233,7 +222,6 @@ struct AMFVertices : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Vertices, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Volume
|
||||
/// Structure that define volume node.
|
||||
struct AMFVolume : public AMFNodeElementBase {
|
||||
std::string MaterialID; ///< Which material to use.
|
||||
|
@ -245,7 +233,6 @@ struct AMFVolume : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Volume, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Coordinates
|
||||
/// Structure that define coordinates node.
|
||||
struct AMFCoordinates : public AMFNodeElementBase {
|
||||
aiVector3D Coordinate; ///< Coordinate.
|
||||
|
@ -256,7 +243,6 @@ struct AMFCoordinates : public AMFNodeElementBase {
|
|||
AMFNodeElementBase(ENET_Coordinates, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_TexMap
|
||||
/// Structure that define texture coordinates node.
|
||||
struct AMFTexMap : public AMFNodeElementBase {
|
||||
aiVector3D TextureCoordinate[3]; ///< Texture coordinates.
|
||||
|
@ -273,7 +259,6 @@ struct AMFTexMap : public AMFNodeElementBase {
|
|||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Triangle
|
||||
/// Structure that define triangle node.
|
||||
struct AMFTriangle : public AMFNodeElementBase {
|
||||
size_t V[3]; ///< Triangle vertices.
|
||||
|
|
|
@ -224,7 +224,8 @@ size_t AMFImporter::PostprocessHelper_GetTextureID_Or_Create(const std::string &
|
|||
}
|
||||
|
||||
// Create format hint.
|
||||
strcpy(converted_texture.FormatHint, "rgba0000"); // copy initial string.
|
||||
constexpr char templateColor[] = "rgba0000";
|
||||
memcpy(converted_texture.FormatHint, templateColor, 8);
|
||||
if (!r.empty()) converted_texture.FormatHint[4] = '8';
|
||||
if (!g.empty()) converted_texture.FormatHint[5] = '8';
|
||||
if (!b.empty()) converted_texture.FormatHint[6] = '8';
|
||||
|
@ -867,7 +868,7 @@ nl_clean_loop:
|
|||
pScene->mTextures[idx]->mHeight = static_cast<unsigned int>(tex_convd.Height);
|
||||
pScene->mTextures[idx]->pcData = (aiTexel *)tex_convd.Data;
|
||||
// texture format description.
|
||||
strcpy(pScene->mTextures[idx]->achFormatHint, tex_convd.FormatHint);
|
||||
strncpy(pScene->mTextures[idx]->achFormatHint, tex_convd.FormatHint, HINTMAXTEXTURELEN);
|
||||
idx++;
|
||||
} // for(const SPP_Texture& tex_convd: mTexture_Converted)
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ void ASEImporter::InternReadFile(const std::string &pFile,
|
|||
// Allocate storage and copy the contents of the file to a memory buffer
|
||||
std::vector<char> mBuffer2;
|
||||
TextFileToBuffer(file.get(), mBuffer2);
|
||||
|
||||
const size_t fileSize = mBuffer2.size();
|
||||
this->mBuffer = &mBuffer2[0];
|
||||
this->pcScene = pScene;
|
||||
|
||||
|
@ -146,7 +146,7 @@ void ASEImporter::InternReadFile(const std::string &pFile,
|
|||
};
|
||||
|
||||
// Construct an ASE parser and parse the file
|
||||
ASE::Parser parser(mBuffer, defaultFormat);
|
||||
ASE::Parser parser(mBuffer, fileSize, defaultFormat);
|
||||
mParser = &parser;
|
||||
mParser->Parse();
|
||||
|
||||
|
@ -446,10 +446,9 @@ void ASEImporter::BuildLights() {
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
|
||||
aiNode *pcParent, const char *szName) {
|
||||
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes, aiNode *pcParent, const std::string &name) {
|
||||
aiMatrix4x4 m;
|
||||
AddNodes(nodes, pcParent, szName, m);
|
||||
AddNodes(nodes, pcParent, name, m);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -506,10 +505,9 @@ void ASEImporter::AddMeshes(const ASE::BaseNode *snode, aiNode *node) {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Add child nodes to a given parent node
|
||||
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
|
||||
aiNode *pcParent, const char *szName,
|
||||
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes, aiNode *pcParent, const std::string &name,
|
||||
const aiMatrix4x4 &mat) {
|
||||
const size_t len = szName ? ::strlen(szName) : 0;
|
||||
const size_t len = name.size();
|
||||
ai_assert(4 <= AI_MAX_NUMBER_OF_COLOR_SETS);
|
||||
|
||||
// Receives child nodes for the pcParent node
|
||||
|
@ -519,16 +517,18 @@ void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
|
|||
// which has *us* as parent.
|
||||
for (std::vector<BaseNode *>::const_iterator it = nodes.begin(), end = nodes.end(); it != end; ++it) {
|
||||
const BaseNode *snode = *it;
|
||||
if (szName) {
|
||||
if (len != snode->mParent.length() || ::strcmp(szName, snode->mParent.c_str()))
|
||||
if (!name.empty()) {
|
||||
if (len != snode->mParent.length() || name != snode->mParent.c_str()) {
|
||||
continue;
|
||||
} else if (snode->mParent.length())
|
||||
}
|
||||
} else if (snode->mParent.length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
(*it)->mProcessed = true;
|
||||
|
||||
// Allocate a new node and add it to the output data structure
|
||||
apcNodes.push_back(new aiNode());
|
||||
apcNodes.push_back(new aiNode);
|
||||
aiNode *node = apcNodes.back();
|
||||
|
||||
node->mName.Set((snode->mName.length() ? snode->mName.c_str() : "Unnamed_Node"));
|
||||
|
@ -541,7 +541,7 @@ void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
|
|||
|
||||
// Add sub nodes - prevent stack overflow due to recursive parenting
|
||||
if (node->mName != node->mParent->mName && node->mName != node->mParent->mParent->mName) {
|
||||
AddNodes(nodes, node, node->mName.data, snode->mTransform);
|
||||
AddNodes(nodes, node, node->mName.C_Str(), snode->mTransform);
|
||||
}
|
||||
|
||||
// Further processing depends on the type of the node
|
||||
|
@ -619,7 +619,8 @@ void ASEImporter::BuildNodes(std::vector<BaseNode *> &nodes) {
|
|||
}
|
||||
|
||||
// add all nodes
|
||||
AddNodes(nodes, ch, nullptr);
|
||||
static const std::string none = "";
|
||||
AddNodes(nodes, ch, none);
|
||||
|
||||
// now iterate through al nodes and find those that have not yet
|
||||
// been added to the nodegraph (= their parent could not be recognized)
|
||||
|
|
|
@ -153,13 +153,13 @@ private:
|
|||
* \param matrix Current transform
|
||||
*/
|
||||
void AddNodes(const std::vector<ASE::BaseNode*>& nodes,
|
||||
aiNode* pcParent,const char* szName);
|
||||
aiNode* pcParent, const std::string &name);
|
||||
|
||||
void AddNodes(const std::vector<ASE::BaseNode*>& nodes,
|
||||
aiNode* pcParent,const char* szName,
|
||||
aiNode* pcParent, const std::string &name,
|
||||
const aiMatrix4x4& matrix);
|
||||
|
||||
void AddMeshes(const ASE::BaseNode* snode,aiNode* node);
|
||||
void AddMeshes(const ASE::BaseNode* snode, aiNode* node);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Generate a default material and add it to the parser's list
|
||||
|
@ -188,5 +188,4 @@ protected:
|
|||
|
||||
} // end of namespace Assimp
|
||||
|
||||
|
||||
#endif // AI_3DSIMPORTER_H_INC
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -391,11 +391,11 @@ public:
|
|||
// -------------------------------------------------------------------
|
||||
//! Construct a parser from a given input file which is
|
||||
//! guaranteed to be terminated with zero.
|
||||
//! @param szFile Input file
|
||||
//! @param file The name of the input file.
|
||||
//! @param fileFormatDefault Assumed file format version. If the
|
||||
//! file format is specified in the file the new value replaces
|
||||
//! the default value.
|
||||
Parser(const char *szFile, unsigned int fileFormatDefault);
|
||||
Parser(const char *file, size_t fileLen, unsigned int fileFormatDefault);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//! Parses the file into the parsers internal representation
|
||||
|
@ -617,11 +617,8 @@ private:
|
|||
bool ParseString(std::string &out, const char *szName);
|
||||
|
||||
public:
|
||||
//! Pointer to current data
|
||||
const char *filePtr;
|
||||
|
||||
/// The end pointer of the file data
|
||||
const char *mEnd;
|
||||
const char *mFilePtr; ////< Pointer to current data
|
||||
const char *mEnd; ///< The end pointer of the file data
|
||||
|
||||
//! background color to be passed to the viewer
|
||||
//! QNAN if none was found
|
||||
|
|
|
@ -625,16 +625,14 @@ aiMesh *ColladaLoader::CreateMesh(const ColladaParser &pParser, const Mesh *pSrc
|
|||
}
|
||||
|
||||
// same for texture coords, as many as we have
|
||||
// empty slots are not allowed, need to pack and adjust UV indexes accordingly
|
||||
for (size_t a = 0, real = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
|
||||
for (size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
|
||||
if (pSrcMesh->mTexCoords[a].size() >= pStartVertex + numVertices) {
|
||||
dstMesh->mTextureCoords[real] = new aiVector3D[numVertices];
|
||||
dstMesh->mTextureCoords[a] = new aiVector3D[numVertices];
|
||||
for (size_t b = 0; b < numVertices; ++b) {
|
||||
dstMesh->mTextureCoords[real][b] = pSrcMesh->mTexCoords[a][pStartVertex + b];
|
||||
dstMesh->mTextureCoords[a][b] = pSrcMesh->mTexCoords[a][pStartVertex + b];
|
||||
}
|
||||
|
||||
dstMesh->mNumUVComponents[real] = pSrcMesh->mNumUVComponents[a];
|
||||
++real;
|
||||
dstMesh->mNumUVComponents[a] = pSrcMesh->mNumUVComponents[a];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -234,8 +234,12 @@ inline void AI_MD5_READ_TRIPLE(aiVector3D &vec, const char **sz, const char *buf
|
|||
AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
|
||||
if ('(' != **sz) {
|
||||
MD5Parser::ReportWarning("Unexpected token: ( was expected", linenumber);
|
||||
if (*sz == bufferEnd)
|
||||
return;
|
||||
++*sz;
|
||||
}
|
||||
if (*sz == bufferEnd)
|
||||
return;
|
||||
++*sz;
|
||||
AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
|
||||
*sz = fast_atoreal_move<float>(*sz, (float &)vec.x);
|
||||
|
@ -247,6 +251,8 @@ inline void AI_MD5_READ_TRIPLE(aiVector3D &vec, const char **sz, const char *buf
|
|||
if (')' != **sz) {
|
||||
MD5Parser::ReportWarning("Unexpected token: ) was expected", linenumber);
|
||||
}
|
||||
if (*sz == bufferEnd)
|
||||
return;
|
||||
++*sz;
|
||||
}
|
||||
|
||||
|
|
|
@ -564,6 +564,10 @@ 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) {
|
||||
|
|
|
@ -1440,7 +1440,7 @@ inline void MaterialSheen::SetDefaults() {
|
|||
inline void MaterialVolume::SetDefaults() {
|
||||
//KHR_materials_volume properties
|
||||
thicknessFactor = 0.f;
|
||||
attenuationDistance = INFINITY;
|
||||
attenuationDistance = std::numeric_limits<float>::infinity();
|
||||
SetVector(attenuationColor, defaultAttenuationColor);
|
||||
}
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ namespace glTF2 {
|
|||
|
||||
WriteTex(materialVolume, volume.thicknessTexture, "thicknessTexture", w.mAl);
|
||||
|
||||
if (volume.attenuationDistance != INFINITY) {
|
||||
if (volume.attenuationDistance != std::numeric_limits<float>::infinity()) {
|
||||
WriteFloat(materialVolume, volume.attenuationDistance, "attenuationDistance", w.mAl);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,11 @@ private:
|
|||
|
||||
} // namespace Assimp
|
||||
|
||||
/// @brief Fixes an undefined reference error when linking in certain build environments.
|
||||
// May throw warnings about needing stdc++17, but should compile without issues on modern compilers.
|
||||
inline const size_t Assimp::StackAllocator::g_maxBytesPerBlock;
|
||||
inline const size_t Assimp::StackAllocator::g_startBytesPerBlock;
|
||||
|
||||
#include "StackAllocator.inl"
|
||||
|
||||
#endif // include guard
|
||||
|
|
|
@ -53,7 +53,8 @@ namespace Assimp {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
LimitBoneWeightsProcess::LimitBoneWeightsProcess() : mMaxWeights(AI_LMW_MAX_WEIGHTS) {
|
||||
LimitBoneWeightsProcess::LimitBoneWeightsProcess() :
|
||||
mMaxWeights(AI_LMW_MAX_WEIGHTS), mRemoveEmptyBones(true) {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
|
|
@ -371,20 +371,7 @@ void ValidateDSProcess::Validate(const aiMesh *pMesh) {
|
|||
ReportWarning("There are unreferenced vertices");
|
||||
}
|
||||
|
||||
// texture channel 2 may not be set if channel 1 is zero ...
|
||||
{
|
||||
unsigned int i = 0;
|
||||
for (; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
|
||||
if (!pMesh->HasTextureCoords(i)) break;
|
||||
}
|
||||
for (; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i)
|
||||
if (pMesh->HasTextureCoords(i)) {
|
||||
ReportError("Texture coordinate channel %i exists "
|
||||
"although the previous channel was nullptr.",
|
||||
i);
|
||||
}
|
||||
}
|
||||
// the same for the vertex colors
|
||||
// vertex color channel 2 may not be set if channel 1 is zero ...
|
||||
{
|
||||
unsigned int i = 0;
|
||||
for (; i < AI_MAX_NUMBER_OF_COLOR_SETS; ++i) {
|
||||
|
|
|
@ -13,10 +13,14 @@
|
|||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
/* For Visual Studio only, NOT MinGW (GCC) -- ThatOSDev */
|
||||
#pragma warning( disable : 4706 )
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(_MSC_VER) || \
|
||||
defined(__MINGW32__)
|
||||
/* Win32, DOS, MSVC, MSVS */
|
||||
#pragma warning( disable : 4706 )
|
||||
/* Win32, DOS, MSVC, MSVS, MinGW(GCC for windows) */
|
||||
#include <direct.h>
|
||||
|
||||
#define STRCLONE(STR) ((STR) ? _strdup(STR) : NULL)
|
||||
|
|
|
@ -729,8 +729,9 @@ struct aiMesh {
|
|||
/**
|
||||
* @brief Vertex texture coordinates, also known as UV channels.
|
||||
*
|
||||
* A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per
|
||||
* vertex. nullptr if not present. The array is mNumVertices in size.
|
||||
* A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS channels per
|
||||
* vertex. Used and unused (nullptr) channels may go in any order.
|
||||
* The array is mNumVertices in size.
|
||||
*/
|
||||
C_STRUCT aiVector3D *mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
||||
|
||||
|
@ -950,8 +951,10 @@ struct aiMesh {
|
|||
//! @return the number of stored uv-channels.
|
||||
unsigned int GetNumUVChannels() const {
|
||||
unsigned int n(0);
|
||||
while (n < AI_MAX_NUMBER_OF_TEXTURECOORDS && mTextureCoords[n]) {
|
||||
++n;
|
||||
for (unsigned i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; i++) {
|
||||
if (mTextureCoords[i]) {
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
|
|
|
@ -113,19 +113,19 @@ struct aiMetadata;
|
|||
*/
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
inline aiMetadataType GetAiType(bool) {
|
||||
inline aiMetadataType GetAiType(const bool &) {
|
||||
return AI_BOOL;
|
||||
}
|
||||
inline aiMetadataType GetAiType(int32_t) {
|
||||
return AI_INT32;
|
||||
}
|
||||
inline aiMetadataType GetAiType(uint64_t) {
|
||||
inline aiMetadataType GetAiType(const uint64_t &) {
|
||||
return AI_UINT64;
|
||||
}
|
||||
inline aiMetadataType GetAiType(float) {
|
||||
inline aiMetadataType GetAiType(const float &) {
|
||||
return AI_FLOAT;
|
||||
}
|
||||
inline aiMetadataType GetAiType(double) {
|
||||
inline aiMetadataType GetAiType(const double &) {
|
||||
return AI_DOUBLE;
|
||||
}
|
||||
inline aiMetadataType GetAiType(const aiString &) {
|
||||
|
@ -137,10 +137,10 @@ inline aiMetadataType GetAiType(const aiVector3D &) {
|
|||
inline aiMetadataType GetAiType(const aiMetadata &) {
|
||||
return AI_AIMETADATA;
|
||||
}
|
||||
inline aiMetadataType GetAiType(int64_t) {
|
||||
inline aiMetadataType GetAiType(const int64_t &) {
|
||||
return AI_INT64;
|
||||
}
|
||||
inline aiMetadataType GetAiType(uint32_t) {
|
||||
inline aiMetadataType GetAiType(const uint32_t &) {
|
||||
return AI_UINT32;
|
||||
}
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ enum aiPostProcessSteps
|
|||
* point primitives to separate meshes.
|
||||
* </li>
|
||||
* <li>Set the <tt>#AI_CONFIG_PP_SBP_REMOVE</tt> importer property to
|
||||
* @code aiPrimitiveType_POINTS | aiPrimitiveType_LINES
|
||||
* @code aiPrimitiveType_POINT | aiPrimitiveType_LINE
|
||||
* @endcode to cause SortByPType to reject point
|
||||
* and line meshes from the scene.
|
||||
* </li>
|
||||
|
|
|
@ -270,7 +270,7 @@ aiProcess_SortByPType = 0x8000
|
|||
# point primitives to separate meshes.
|
||||
# <li>
|
||||
# <li>Set the <tt>AI_CONFIG_PP_SBP_REMOVE<tt> option to
|
||||
# @code aiPrimitiveType_POINTS | aiPrimitiveType_LINES
|
||||
# @code aiPrimitiveType_POINT | aiPrimitiveType_LINE
|
||||
# @endcode to cause SortByPType to reject point
|
||||
# and line meshes from the scene.
|
||||
# <li>
|
||||
|
|
|
@ -348,7 +348,7 @@ extern ( C ) {
|
|||
* <li>Specify the <code>SortByPType</code> flag. This moves line and
|
||||
* point primitives to separate meshes.</li>
|
||||
* <li>Set the <code>AI_CONFIG_PP_SBP_REMOVE</codet> option to
|
||||
* <code>aiPrimitiveType_POINTS | aiPrimitiveType_LINES</code>
|
||||
* <code>aiPrimitiveType_POINT | aiPrimitiveType_LINE</code>
|
||||
* to cause SortByPType to reject point and line meshes from the
|
||||
* scene.</li>
|
||||
* </ul>
|
||||
|
|
|
@ -349,7 +349,7 @@ public enum AiPostProcessSteps {
|
|||
* <li>Specify the #SortByPType flag. This moves line and point
|
||||
* primitives to separate meshes.
|
||||
* <li>Set the <tt>AI_CONFIG_PP_SBP_REMOVE</tt> option to
|
||||
* <code>aiPrimitiveType_POINTS | aiPrimitiveType_LINES</code>
|
||||
* <code>aiPrimitiveType_POINT | aiPrimitiveType_LINE</code>
|
||||
* to cause SortByPType to reject point and line meshes from the
|
||||
* scene.
|
||||
* </ul>
|
||||
|
|
|
@ -56,6 +56,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
TEST_F(utB3DImportExport, importACFromFileTest) {
|
||||
TEST_F(utB3DImportExport, importB3DFromFileTest) {
|
||||
EXPECT_TRUE(importerTest());
|
||||
}
|
||||
|
|
|
@ -242,6 +242,22 @@ TEST_F( utMetadata, copy_test ) {
|
|||
EXPECT_EQ( i32v, v );
|
||||
}
|
||||
|
||||
// uint32_t test
|
||||
{
|
||||
uint32_t v = 0;
|
||||
bool ok = copy.Get("uint32_t", v);
|
||||
EXPECT_TRUE(ok);
|
||||
EXPECT_EQ( ui32, v );
|
||||
}
|
||||
|
||||
// int64_t test
|
||||
{
|
||||
int64_t v = -1;
|
||||
bool ok = copy.Get("int64_t", v);
|
||||
EXPECT_TRUE(ok);
|
||||
EXPECT_EQ( i64, v );
|
||||
}
|
||||
|
||||
// uint64_t test
|
||||
{
|
||||
uint64_t v = 255;
|
||||
|
@ -264,14 +280,14 @@ TEST_F( utMetadata, copy_test ) {
|
|||
EXPECT_EQ( dv, v );
|
||||
}
|
||||
|
||||
// bool test
|
||||
// string test
|
||||
{
|
||||
aiString v;
|
||||
EXPECT_TRUE( copy.Get( "aiString", v ) );
|
||||
EXPECT_EQ( strVal, v );
|
||||
}
|
||||
|
||||
// bool test
|
||||
// vector test
|
||||
{
|
||||
aiVector3D v;
|
||||
EXPECT_TRUE( copy.Get( "aiVector3D", v ) );
|
||||
|
|
Loading…
Reference in New Issue