clean all warnings for vs-2019

pull/3012/head
Kim Kulling 2020-03-08 21:24:01 +01:00
parent 920535165d
commit e8d2b84017
55 changed files with 9135 additions and 9009 deletions

View File

@ -80,7 +80,7 @@ namespace {
{
chunk_start_pos = writer.GetCurrentPos();
writer.PutU2(chunk_type);
writer.PutU4(CHUNK_SIZE_NOT_SET);
writer.PutU4((uint32_t)CHUNK_SIZE_NOT_SET);
}
~ChunkWriter() {
@ -193,21 +193,21 @@ Discreet3DSExporter:: Discreet3DSExporter(std::shared_ptr<IOStream> &outfile, co
CollectTrafos(scene->mRootNode, trafos);
CollectMeshes(scene->mRootNode, meshes);
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAIN);
ChunkWriter curRootChunk(writer, Discreet3DS::CHUNK_MAIN);
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_OBJMESH);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_OBJMESH);
WriteMaterials();
WriteMeshes();
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MASTER_SCALE);
ChunkWriter curChunk1(writer, Discreet3DS::CHUNK_MASTER_SCALE);
writer.PutF4(1.0f);
}
}
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_KEYFRAMER);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_KEYFRAMER);
WriteHierarchy(*scene->mRootNode, -1, -1);
}
}
@ -223,9 +223,9 @@ int Discreet3DSExporter::WriteHierarchy(const aiNode& node, int seq, int sibling
{
// 3DS scene hierarchy is serialized as in http://www.martinreddy.net/gfx/3d/3DS.spec
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_TRACKINFO);
ChunkWriter curRootChunk(writer, Discreet3DS::CHUNK_TRACKINFO);
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_TRACKOBJNAME);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_TRACKOBJNAME);
// Assimp node names are unique and distinct from all mesh-node
// names we generate; thus we can use them as-is
@ -237,7 +237,7 @@ int Discreet3DSExporter::WriteHierarchy(const aiNode& node, int seq, int sibling
int16_t hierarchy_pos = static_cast<int16_t>(seq);
if (sibling_level != -1) {
hierarchy_pos = sibling_level;
hierarchy_pos =(uint16_t) sibling_level;
}
// Write the hierarchy position
@ -262,7 +262,7 @@ int Discreet3DSExporter::WriteHierarchy(const aiNode& node, int seq, int sibling
const unsigned int mesh_idx = node.mMeshes[i];
const aiMesh& mesh = *scene->mMeshes[mesh_idx];
ChunkWriter chunk(writer, Discreet3DS::CHUNK_TRACKINFO);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_TRACKINFO);
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_TRACKOBJNAME);
WriteString(GetMeshName(mesh, mesh_idx, node));
@ -279,7 +279,7 @@ int Discreet3DSExporter::WriteHierarchy(const aiNode& node, int seq, int sibling
void Discreet3DSExporter::WriteMaterials()
{
for (unsigned int i = 0; i < scene->mNumMaterials; ++i) {
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_MATERIAL);
ChunkWriter curRootChunk(writer, Discreet3DS::CHUNK_MAT_MATERIAL);
const aiMaterial& mat = *scene->mMaterials[i];
{
@ -290,22 +290,22 @@ void Discreet3DSExporter::WriteMaterials()
aiColor3D color;
if (mat.Get(AI_MATKEY_COLOR_DIFFUSE, color) == AI_SUCCESS) {
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_DIFFUSE);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_DIFFUSE);
WriteColor(color);
}
if (mat.Get(AI_MATKEY_COLOR_SPECULAR, color) == AI_SUCCESS) {
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_SPECULAR);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_SPECULAR);
WriteColor(color);
}
if (mat.Get(AI_MATKEY_COLOR_AMBIENT, color) == AI_SUCCESS) {
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_AMBIENT);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_AMBIENT);
WriteColor(color);
}
if (mat.Get(AI_MATKEY_COLOR_EMISSIVE, color) == AI_SUCCESS) {
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_SELF_ILLUM);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_SELF_ILLUM);
WriteColor(color);
}
@ -389,14 +389,14 @@ void Discreet3DSExporter::WriteTexture(const aiMaterial& mat, aiTextureType type
ChunkWriter chunk(writer, chunk_flags);
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAPFILE);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAPFILE);
WriteString(path);
}
WritePercentChunk(blend);
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_MAP_TILING);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_MAP_TILING);
uint16_t val = 0; // WRAP
if (map_mode[0] == aiTextureMapMode_Mirror) {
val = 0x2;
@ -447,7 +447,7 @@ void Discreet3DSExporter::WriteMeshes()
// Vertices in world space
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_VERTLIST);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_VERTLIST);
const uint16_t count = static_cast<uint16_t>(mesh.mNumVertices);
writer.PutU2(count);
@ -461,7 +461,7 @@ void Discreet3DSExporter::WriteMeshes()
// UV coordinates
if (mesh.HasTextureCoords(0)) {
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAPLIST);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAPLIST);
const uint16_t count = static_cast<uint16_t>(mesh.mNumVertices);
writer.PutU2(count);
@ -474,7 +474,7 @@ void Discreet3DSExporter::WriteMeshes()
// Faces (indices)
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_FACELIST);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_FACELIST);
ai_assert(mesh.mNumFaces <= 0xffff);
@ -513,7 +513,7 @@ void Discreet3DSExporter::WriteMeshes()
// Transformation matrix by which the mesh vertices have been pre-transformed with.
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_TRMATRIX);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_TRMATRIX);
for (unsigned int r = 0; r < 4; ++r) {
for (unsigned int c = 0; c < 3; ++c) {
writer.PutF4(trafo[r][c]);
@ -526,7 +526,7 @@ void Discreet3DSExporter::WriteMeshes()
// ------------------------------------------------------------------------------------------------
void Discreet3DSExporter::WriteFaceMaterialChunk(const aiMesh& mesh)
{
ChunkWriter chunk(writer, Discreet3DS::CHUNK_FACEMAT);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_FACEMAT);
const std::string& name = GetMaterialName(*scene->mMaterials[mesh.mMaterialIndex], mesh.mMaterialIndex);
WriteString(name);
@ -559,7 +559,7 @@ void Discreet3DSExporter::WriteString(const aiString& s) {
// ------------------------------------------------------------------------------------------------
void Discreet3DSExporter::WriteColor(const aiColor3D& color) {
ChunkWriter chunk(writer, Discreet3DS::CHUNK_RGBF);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_RGBF);
writer.PutF4(color.r);
writer.PutF4(color.g);
writer.PutF4(color.b);
@ -567,13 +567,13 @@ void Discreet3DSExporter::WriteColor(const aiColor3D& color) {
// ------------------------------------------------------------------------------------------------
void Discreet3DSExporter::WritePercentChunk(float f) {
ChunkWriter chunk(writer, Discreet3DS::CHUNK_PERCENTF);
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_PERCENTF);
writer.PutF4(f);
}
// ------------------------------------------------------------------------------------------------
void Discreet3DSExporter::WritePercentChunk(double f) {
ChunkWriter chunk(writer, Discreet3DS::CHUNK_PERCENTD);
ChunkWriter ccurChunkhunk(writer, Discreet3DS::CHUNK_PERCENTD);
writer.PutF8(f);
}

View File

@ -256,13 +256,13 @@ void D3MFExporter::writeBaseMaterials() {
tmp.clear();
hexDiffuseColor = "#";
tmp = DecimalToHexa( color.r );
tmp = DecimalToHexa( (ai_real) color.r );
hexDiffuseColor += tmp;
tmp = DecimalToHexa( color.g );
tmp = DecimalToHexa((ai_real)color.g);
hexDiffuseColor += tmp;
tmp = DecimalToHexa( color.b );
tmp = DecimalToHexa((ai_real)color.b);
hexDiffuseColor += tmp;
tmp = DecimalToHexa( color.a );
tmp = DecimalToHexa((ai_real)color.a);
hexDiffuseColor += tmp;
} else {
hexDiffuseColor = "#FFFFFFFF";

View File

@ -61,6 +61,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <time.h>
#pragma warning(push)
#pragma warning(disable : 4706)
namespace Assimp {
template <typename T>
@ -530,7 +533,6 @@ protected:
if (shortened) {
unsigned int processed = 0;
for (unsigned int job;(job = std::min(mesh->mNumFaces-processed,512u));processed += job) {
uint32_t hash = 0;
for (unsigned int a = 0; a < job;++a) {
@ -855,5 +857,6 @@ void DumpSceneToAssbin(
AssbinFileWriter fileWriter(shortened, compressed);
fileWriter.WriteBinaryDump(pFile, cmd, pIOSystem, pScene);
}
#pragma warning(pop)
} // end of namespace Assimp

View File

@ -91,20 +91,20 @@ public:
base64_encodestate s;
base64_init_encodestate(&s);
char* const out = new char[std::max(len * 2, static_cast<size_t>(16u))];
const int n = base64_encode_block(reinterpret_cast<const char*>(buffer), static_cast<int>(len), out, &s);
out[n + base64_encode_blockend(out + n, &s)] = '\0';
char* const cur_out = new char[std::max(len * 2, static_cast<size_t>(16u))];
const int n = base64_encode_block(reinterpret_cast<const char *>(buffer), static_cast<int>(len), cur_out, &s);
cur_out[n + base64_encode_blockend(cur_out + n, &s)] = '\0';
// base64 encoding may add newlines, but JSON strings may not contain 'real' newlines
// (only escaped ones). Remove any newlines in out.
for (char* cur = out; *cur; ++cur) {
for (char *cur = cur_out; *cur; ++cur) {
if (*cur == '\n') {
*cur = ' ';
}
}
buff << '\"' << out << "\"\n";
delete[] out;
buff << '\"' << cur_out << "\"\n";
delete[] cur_out;
}
void StartObj(bool is_element = false) {
@ -464,8 +464,8 @@ void Write(JSONWriter& out, const aiMaterial& ai, bool is_elem = true) {
case aiPTI_Float:
if (prop->mDataLength / sizeof(float) > 1) {
out.StartArray();
for (unsigned int i = 0; i < prop->mDataLength / sizeof(float); ++i) {
out.Element(reinterpret_cast<float*>(prop->mData)[i]);
for (unsigned int ii = 0; ii < prop->mDataLength / sizeof(float); ++ii) {
out.Element(reinterpret_cast<float*>(prop->mData)[ii]);
}
out.EndArray();
}
@ -477,8 +477,8 @@ void Write(JSONWriter& out, const aiMaterial& ai, bool is_elem = true) {
case aiPTI_Integer:
if (prop->mDataLength / sizeof(int) > 1) {
out.StartArray();
for (unsigned int i = 0; i < prop->mDataLength / sizeof(int); ++i) {
out.Element(reinterpret_cast<int*>(prop->mData)[i]);
for (unsigned int ii = 0; ii < prop->mDataLength / sizeof(int); ++ii) {
out.Element(reinterpret_cast<int*>(prop->mData)[ii]);
}
out.EndArray();
} else {

View File

@ -373,25 +373,25 @@ void WriteDump(const char* pFile, const char* cmd, const aiScene* scene, IOStrea
ioprintf(io," size=\"%i\">\n\t\t\t\t",
static_cast<int>(prop->mDataLength/sizeof(float)));
for (unsigned int p = 0; p < prop->mDataLength/sizeof(float);++p) {
ioprintf(io,"%f ",*((float*)(prop->mData+p*sizeof(float))));
for (unsigned int pp = 0; pp < prop->mDataLength/sizeof(float);++pp) {
ioprintf(io,"%f ",*((float*)(prop->mData+pp*sizeof(float))));
}
}
else if (prop->mType == aiPTI_Integer) {
ioprintf(io," size=\"%i\">\n\t\t\t\t",
static_cast<int>(prop->mDataLength/sizeof(int)));
for (unsigned int p = 0; p < prop->mDataLength/sizeof(int);++p) {
ioprintf(io,"%i ",*((int*)(prop->mData+p*sizeof(int))));
for (unsigned int pp = 0; pp < prop->mDataLength/sizeof(int);++pp) {
ioprintf(io,"%i ",*((int*)(prop->mData+pp*sizeof(int))));
}
}
else if (prop->mType == aiPTI_Buffer) {
ioprintf(io," size=\"%i\">\n\t\t\t\t",
static_cast<int>(prop->mDataLength));
for (unsigned int p = 0; p < prop->mDataLength;++p) {
ioprintf(io,"%2x ",prop->mData[p]);
if (p && 0 == p%30) {
for (unsigned int pp = 0; pp< prop->mDataLength;++pp) {
ioprintf(io,"%2x ",prop->mData[pp]);
if (pp && 0 == pp%30) {
ioprintf(io,"\n\t\t\t\t");
}
}

View File

@ -1335,32 +1335,34 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
mOutput << startstr << "<animation id=\"" + idstrEscaped + "\" name=\"" + animation_name_escaped + "\">" << endstr;
PushTag();
std::string node_idstr;
std::string cur_node_idstr;
for (size_t a = 0; a < anim->mNumChannels; ++a) {
const aiNodeAnim * nodeAnim = anim->mChannels[a];
// sanity check
if ( nodeAnim->mNumPositionKeys != nodeAnim->mNumScalingKeys || nodeAnim->mNumPositionKeys != nodeAnim->mNumRotationKeys ) continue;
if (nodeAnim->mNumPositionKeys != nodeAnim->mNumScalingKeys || nodeAnim->mNumPositionKeys != nodeAnim->mNumRotationKeys) {
continue;
}
{
node_idstr.clear();
node_idstr += nodeAnim->mNodeName.data;
node_idstr += std::string( "_matrix-input" );
cur_node_idstr.clear();
cur_node_idstr += nodeAnim->mNodeName.data;
cur_node_idstr += std::string("_matrix-input");
std::vector<ai_real> frames;
for( size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
frames.push_back(static_cast<ai_real>(nodeAnim->mPositionKeys[i].mTime));
}
WriteFloatArray( node_idstr , FloatType_Time, (const ai_real*) frames.data(), frames.size());
WriteFloatArray(cur_node_idstr, FloatType_Time, (const ai_real *)frames.data(), frames.size());
frames.clear();
}
{
node_idstr.clear();
cur_node_idstr.clear();
node_idstr += nodeAnim->mNodeName.data;
node_idstr += std::string("_matrix-output");
cur_node_idstr += nodeAnim->mNodeName.data;
cur_node_idstr += std::string("_matrix-output");
std::vector<ai_real> keyframes;
keyframes.reserve(nodeAnim->mNumPositionKeys * 16);
@ -1385,7 +1387,7 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
}
}
WriteFloatArray( node_idstr, FloatType_Mat4x4, (const ai_real*) keyframes.data(), keyframes.size() / 16);
WriteFloatArray(cur_node_idstr, FloatType_Mat4x4, (const ai_real *)keyframes.data(), keyframes.size() / 16);
}
{
@ -1401,16 +1403,16 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
}
}
const std::string node_idstr = nodeAnim->mNodeName.data + std::string("_matrix-interpolation");
std::string arrayId = XMLIDEncode(node_idstr) + "-array";
const std::string cur_node_idstr2 = nodeAnim->mNodeName.data + std::string("_matrix-interpolation");
std::string arrayId = XMLIDEncode(cur_node_idstr2) + "-array";
mOutput << startstr << "<source id=\"" << XMLIDEncode(node_idstr) << "\">" << endstr;
mOutput << startstr << "<source id=\"" << XMLIDEncode(cur_node_idstr2) << "\">" << endstr;
PushTag();
// source array
mOutput << startstr << "<Name_array id=\"" << arrayId << "\" count=\"" << names.size() << "\"> ";
for( size_t a = 0; a < names.size(); ++a ) {
mOutput << names[a] << " ";
for( size_t aa = 0; aa < names.size(); ++aa ) {
mOutput << names[aa] << " ";
}
mOutput << "</Name_array>" << endstr;
@ -1672,13 +1674,13 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
PushTag();
mOutput << startstr << "<instance_material symbol=\"defaultMaterial\" target=\"#" << XMLIDEncode(materials[mesh->mMaterialIndex].name) << "\">" << endstr;
PushTag();
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
for( size_t aa = 0; aa < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++aa )
{
if( mesh->HasTextureCoords( static_cast<unsigned int>(a) ) )
if( mesh->HasTextureCoords( static_cast<unsigned int>(aa) ) )
// semantic as in <texture texcoord=...>
// input_semantic as in <input semantic=...>
// input_set as in <input set=...>
mOutput << startstr << "<bind_vertex_input semantic=\"CHANNEL" << a << "\" input_semantic=\"TEXCOORD\" input_set=\"" << a << "\"/>" << endstr;
mOutput << startstr << "<bind_vertex_input semantic=\"CHANNEL" << aa << "\" input_semantic=\"TEXCOORD\" input_set=\"" << aa << "\"/>" << endstr;
}
PopTag();
mOutput << startstr << "</instance_material>" << endstr;

View File

@ -48,8 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_FBX_EXPORTER
namespace Assimp {
namespace FBX
{
namespace FBX {
const std::string NULL_RECORD = { // 25 null bytes in 64-bit and 13 null bytes in 32-bit
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'
@ -80,8 +80,8 @@ namespace FBX
TransformInheritance_MAX // end-of-enum sentinel
};
}
}
} // namespace FBX
} // namespace Assimp
#endif // ASSIMP_BUILD_NO_FBX_EXPORTER
#endif // AI_FBXCOMMON_H_INC

File diff suppressed because it is too large Load Diff

View File

@ -189,8 +189,7 @@ private:
const aiMatrix4x4 &absolute_transform);
// ------------------------------------------------------------------------------------------------
std::vector<unsigned int> ConvertLine(const LineGeometry& line, const Model& model,
aiNode *parent, aiNode *root_node);
std::vector<unsigned int> ConvertLine(const LineGeometry& line, aiNode *root_node);
// ------------------------------------------------------------------------------------------------
aiMesh* SetupEmptyMesh(const Geometry& mesh, aiNode *parent);
@ -220,17 +219,15 @@ private:
* - outputVertStartIndices is only used when a material index is specified, it gives for
* each output vertex the DOM index it maps to.
*/
void ConvertWeights(aiMesh *out, const Model &model, const MeshGeometry &geo, const aiMatrix4x4 &absolute_transform,
aiNode *parent = NULL, aiNode *root_node = NULL,
unsigned int materialIndex = NO_MATERIAL_SEPARATION,
void ConvertWeights(aiMesh *out, const MeshGeometry &geo, const aiMatrix4x4 &absolute_transform,
aiNode *parent = NULL, unsigned int materialIndex = NO_MATERIAL_SEPARATION,
std::vector<unsigned int> *outputVertStartIndices = NULL);
// lookup
static const aiNode* GetNodeByName( const aiString& name, aiNode *current_node );
// ------------------------------------------------------------------------------------------------
void ConvertCluster(std::vector<aiBone *> &local_mesh_bones, const Cluster *cl,
std::vector<size_t> &out_indices, std::vector<size_t> &index_out_indices,
std::vector<size_t> &count_out_indices, const aiMatrix4x4 &absolute_transform,
aiNode *parent, aiNode *root_node);
aiNode *parent );
// ------------------------------------------------------------------------------------------------
void ConvertMaterialForMesh(aiMesh* out, const Model& model, const MeshGeometry& geo,
@ -437,7 +434,7 @@ private:
// 0: not assigned yet, others: index is value - 1
unsigned int defaultMaterialIndex;
std::vector<aiMesh*> meshes;
std::vector<aiMesh*> mMeshes;
std::vector<aiMaterial*> materials;
std::vector<aiAnimation*> animations;
std::vector<aiLight*> lights;
@ -467,9 +464,9 @@ private:
double anim_fps;
aiScene* const out;
aiScene* const mSceneOut;
const FBX::Document& doc;
bool mRemoveEmptyBones;
static void BuildBoneList(aiNode *current_node, const aiNode *root_node, const aiScene *scene,
std::vector<aiBone*>& bones);

View File

@ -62,90 +62,81 @@ namespace Assimp {
// so they are specified with an 'A' suffix.
void FBX::Node::AddP70int(
const std::string& name, int32_t value
const std::string& cur_name, int32_t value
) {
FBX::Node n("P");
n.AddProperties(name, "int", "Integer", "", value);
n.AddProperties(cur_name, "int", "Integer", "", value);
AddChild(n);
}
void FBX::Node::AddP70bool(
const std::string& name, bool value
const std::string& cur_name, bool value
) {
FBX::Node n("P");
n.AddProperties(name, "bool", "", "", int32_t(value));
n.AddProperties(cur_name, "bool", "", "", int32_t(value));
AddChild(n);
}
void FBX::Node::AddP70double(
const std::string& name, double value
) {
const std::string &cur_name, double value) {
FBX::Node n("P");
n.AddProperties(name, "double", "Number", "", value);
n.AddProperties(cur_name, "double", "Number", "", value);
AddChild(n);
}
void FBX::Node::AddP70numberA(
const std::string& name, double value
) {
const std::string &cur_name, double value) {
FBX::Node n("P");
n.AddProperties(name, "Number", "", "A", value);
n.AddProperties(cur_name, "Number", "", "A", value);
AddChild(n);
}
void FBX::Node::AddP70color(
const std::string& name, double r, double g, double b
) {
const std::string &cur_name, double r, double g, double b) {
FBX::Node n("P");
n.AddProperties(name, "ColorRGB", "Color", "", r, g, b);
n.AddProperties(cur_name, "ColorRGB", "Color", "", r, g, b);
AddChild(n);
}
void FBX::Node::AddP70colorA(
const std::string& name, double r, double g, double b
) {
const std::string &cur_name, double r, double g, double b) {
FBX::Node n("P");
n.AddProperties(name, "Color", "", "A", r, g, b);
n.AddProperties(cur_name, "Color", "", "A", r, g, b);
AddChild(n);
}
void FBX::Node::AddP70vector(
const std::string& name, double x, double y, double z
) {
const std::string &cur_name, double x, double y, double z) {
FBX::Node n("P");
n.AddProperties(name, "Vector3D", "Vector", "", x, y, z);
n.AddProperties(cur_name, "Vector3D", "Vector", "", x, y, z);
AddChild(n);
}
void FBX::Node::AddP70vectorA(
const std::string& name, double x, double y, double z
) {
const std::string &cur_name, double x, double y, double z) {
FBX::Node n("P");
n.AddProperties(name, "Vector", "", "A", x, y, z);
n.AddProperties(cur_name, "Vector", "", "A", x, y, z);
AddChild(n);
}
void FBX::Node::AddP70string(
const std::string& name, const std::string& value
) {
const std::string &cur_name, const std::string &value) {
FBX::Node n("P");
n.AddProperties(name, "KString", "", "", value);
n.AddProperties(cur_name, "KString", "", "", value);
AddChild(n);
}
void FBX::Node::AddP70enum(
const std::string& name, int32_t value
) {
const std::string &cur_name, int32_t value) {
FBX::Node n("P");
n.AddProperties(name, "enum", "", "", value);
n.AddProperties(cur_name, "enum", "", "", value);
AddChild(n);
}
void FBX::Node::AddP70time(
const std::string& name, int64_t value
) {
const std::string &cur_name, int64_t value) {
FBX::Node n("P");
n.AddProperties(name, "KTime", "Time", "", value);
n.AddProperties(cur_name, "KTime", "Time", "", value);
AddChild(n);
}

View File

@ -944,7 +944,9 @@ void FBXExporter::WriteDefinitions ()
FBX::Node defs("Definitions");
defs.AddChild("Version", int32_t(100));
defs.AddChild("Count", int32_t(total_count));
for (auto &n : object_nodes) { defs.AddChild(n); }
for (auto &on : object_nodes) {
defs.AddChild(on);
}
defs.Dump(outfile, binary, 0);
}
@ -1119,10 +1121,10 @@ void FBXExporter::WriteObjects ()
for (size_t fi = 0; fi < m->mNumFaces; ++fi) {
const aiFace &f = m->mFaces[fi];
for (size_t pvi = 0; pvi < f.mNumIndices; ++pvi) {
const aiVector3D &n = m->mNormals[f.mIndices[pvi]];
normal_data.push_back(n.x);
normal_data.push_back(n.y);
normal_data.push_back(n.z);
const aiVector3D &curN = m->mNormals[f.mIndices[pvi]];
normal_data.push_back(curN.x);
normal_data.push_back(curN.y);
normal_data.push_back(curN.z);
}
}
FBX::Node::WritePropertyNode(
@ -1226,14 +1228,14 @@ void FBXExporter::WriteObjects ()
for (size_t fi = 0; fi < m->mNumFaces; ++fi) {
const aiFace &f = m->mFaces[fi];
for (size_t pvi = 0; pvi < f.mNumIndices; ++pvi) {
const aiVector3D &uv =
const aiVector3D &curUv =
m->mTextureCoords[uvi][f.mIndices[pvi]];
auto elem = index_by_uv.find(uv);
auto elem = index_by_uv.find(curUv);
if (elem == index_by_uv.end()) {
index_by_uv[uv] = index;
index_by_uv[curUv] = index;
uv_indices.push_back(index);
for (unsigned int x = 0; x < m->mNumUVComponents[uvi]; ++x) {
uv_data.push_back(uv[x]);
uv_data.push_back(curUv[x]);
}
++index;
} else {
@ -2246,7 +2248,7 @@ const std::map<std::string,std::pair<std::string,char>> transform_types = {
// write a single model node to the stream
void FBXExporter::WriteModelNode(
StreamWriterLE& outstream,
bool binary,
bool,
const aiNode* node,
int64_t node_uid,
const std::string& type,
@ -2299,16 +2301,13 @@ void FBXExporter::WriteModelNode(
err << item.first;
throw DeadlyExportError(err.str());
}
const std::string &name = elem->second.first;
const std::string &cur_name = elem->second.first;
const aiVector3D &v = item.second;
if (name.compare(0, 4, "Lcl ") == 0) {
if (cur_name.compare(0, 4, "Lcl ") == 0) {
// special handling for animatable properties
p.AddP70(
name, name, "", "A",
double(v.x), double(v.y), double(v.z)
);
p.AddP70( cur_name, cur_name, "", "A", double(v.x), double(v.y), double(v.z) );
} else {
p.AddP70vector(name, v.x, v.y, v.z);
p.AddP70vector(cur_name, v.x, v.y, v.z);
}
}
}

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -53,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXDocumentUtil.h"
#include "FBXProperties.h"
#include <assimp/ByteSwapper.h>
#include <assimp/ParsingUtils.h>
#include <algorithm> // std::transform
#include "FBXUtil.h"
@ -86,7 +86,7 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
std::string templateName;
// lower-case shading because Blender (for example) writes "Phong"
std::transform(shading.begin(), shading.end(), shading.begin(), ::tolower);
std::transform(shading.begin(), shading.end(), shading.begin(), Assimp::ToLower<char>);
if(shading == "phong") {
templateName = "Material.FbxSurfacePhong";
}

View File

@ -46,11 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
#include "FBXParser.h"
#include "FBXMeshGeometry.h"
#include "FBXDocument.h"
#include "FBXImporter.h"
#include "FBXDocumentUtil.h"
#include "FBXImporter.h"
#include "FBXMeshGeometry.h"
#include "FBXParser.h"
namespace Assimp {
namespace FBX {
@ -58,10 +58,8 @@ namespace FBX {
using namespace Util;
// ------------------------------------------------------------------------------------------------
Model::Model(uint64_t id, const Element& element, const Document& doc, const std::string& name)
: Object(id,element,name)
, shading("Y")
{
Model::Model(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
Object(id, element, name), shading("Y") {
const Scope &sc = GetRequiredScope(element);
const Element *const Shading = sc["Shading"];
const Element *const Culling = sc["Culling"];
@ -79,14 +77,11 @@ Model::Model(uint64_t id, const Element& element, const Document& doc, const std
}
// ------------------------------------------------------------------------------------------------
Model::~Model()
{
Model::~Model() {
}
// ------------------------------------------------------------------------------------------------
void Model::ResolveLinks(const Element& element, const Document& doc)
{
void Model::ResolveLinks(const Element&, const Document &doc) {
const char *const arr[] = { "Geometry", "Material", "NodeAttribute" };
// resolve material
@ -132,8 +127,7 @@ void Model::ResolveLinks(const Element& element, const Document& doc)
}
// ------------------------------------------------------------------------------------------------
bool Model::IsNull() const
{
bool Model::IsNull() const {
const std::vector<const NodeAttribute *> &attrs = GetAttributes();
for (const NodeAttribute *att : attrs) {
@ -146,8 +140,7 @@ bool Model::IsNull() const
return false;
}
} //!FBX
} //!Assimp
} // namespace FBX
} // namespace Assimp
#endif

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -49,6 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdint.h>
#include <map>
#include <memory>
#include <vector>
#include <assimp/LogAux.h>
#include <assimp/fast_atof.h>
@ -126,7 +126,7 @@ public:
const Element* operator[] (const std::string& index) const {
ElementMap::const_iterator it = elements.find(index);
return it == elements.end() ? NULL : (*it).second;
return it == elements.end() ? nullptr : (*it).second;
}
const Element* FindElementCaseInsensitive(const std::string& elementName) const {

View File

@ -209,21 +209,25 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const
DirectPropertyMap result;
// Loop through all the lazy properties (which is all the properties)
for(const LazyPropertyMap::value_type& element : lazyProps) {
for(const LazyPropertyMap::value_type& currentElement : lazyProps) {
// Skip parsed properties
if (props.end() != props.find(element.first)) continue;
if (props.end() != props.find(currentElement.first)) {
continue;
}
// Read the element's value.
// Wrap the naked pointer (since the call site is required to acquire ownership)
// std::unique_ptr from C++11 would be preferred both as a wrapper and a return value.
std::shared_ptr<Property> prop = std::shared_ptr<Property>(ReadTypedProperty(*element.second));
std::shared_ptr<Property> prop = std::shared_ptr<Property>(ReadTypedProperty(*currentElement.second));
// Element could not be read. Skip it.
if (!prop) continue;
if (!prop) {
continue;
}
// Add to result
result[element.first] = prop;
result[currentElement.first] = prop;
}
return result;

View File

@ -285,11 +285,11 @@ public:
out.mVerts.reserve(out.mVerts.size() + cnt);
for(const CurveEntry& entry : curves) {
const size_t cnt = out.mVerts.size();
const size_t curCnt = out.mVerts.size();
entry.first->SampleDiscrete(out);
if (!entry.second && cnt != out.mVerts.size()) {
std::reverse(out.mVerts.begin()+cnt,out.mVerts.end());
if (!entry.second && curCnt != out.mVerts.size()) {
std::reverse(out.mVerts.begin() + curCnt, out.mVerts.end());
}
}
}
@ -329,8 +329,8 @@ public:
have_param = true;
break;
}
else if (const Schema_2x3::IfcCartesianPoint* const r = sel->ResolveSelectPtr<Schema_2x3::IfcCartesianPoint>(conv.db)) {
ConvertCartesianPoint(point,*r);
else if (const Schema_2x3::IfcCartesianPoint* const curR = sel->ResolveSelectPtr<Schema_2x3::IfcCartesianPoint>(conv.db)) {
ConvertCartesianPoint(point, *curR);
have_point = true;
}
}
@ -346,8 +346,8 @@ public:
have_param = true;
break;
}
else if (const Schema_2x3::IfcCartesianPoint* const r = sel->ResolveSelectPtr<Schema_2x3::IfcCartesianPoint>(conv.db)) {
ConvertCartesianPoint(point,*r);
else if (const Schema_2x3::IfcCartesianPoint* const curR = sel->ResolveSelectPtr<Schema_2x3::IfcCartesianPoint>(conv.db)) {
ConvertCartesianPoint(point, *curR);
have_point = true;
}
}

View File

@ -101,7 +101,7 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
return;
}
ai_assert(std::count(inmesh.mVertcnt.begin(), inmesh.mVertcnt.end(), 0) == 0);
ai_assert(std::count(inmesh.mVertcnt.begin(), inmesh.mVertcnt.end(), 0u) == 0);
typedef std::vector<unsigned int>::const_iterator face_iter;
@ -379,7 +379,7 @@ void ProcessSweptDiskSolid(const Schema_2x3::IfcSweptDiskSolid &solid, TempMesh&
IfcVector3 q;
bool take_any = false;
for (unsigned int i = 0; i < 2; ++i, take_any = true) {
for (unsigned int j = 0; j < 2; ++j, take_any = true) {
if ((last_dir == 0 || take_any) && std::abs(d.x) > 1e-6) {
q.y = startvec.y;
q.z = startvec.z;

View File

@ -294,7 +294,7 @@ void InsertWindowContours(const ContourVector& contours,
const IfcFloat epsilon = diag/1000.f;
// walk through all contour points and find those that lie on the BB corner
size_t last_hit = -1, very_first_hit = -1;
size_t last_hit = (size_t)-1, very_first_hit = (size_t)-1;
IfcVector2 edge;
for(size_t n = 0, e=0, size = contour.size();; n=(n+1)%size, ++e) {
@ -330,7 +330,7 @@ void InsertWindowContours(const ContourVector& contours,
const size_t old = curmesh.mVerts.size();
size_t cnt = last_hit > n ? size-(last_hit-n) : n-last_hit;
for(size_t a = last_hit, e = 0; e <= cnt; a=(a+1)%size, ++e) {
for(size_t a = last_hit, ee = 0; ee <= cnt; a=(a+1)%size, ++ee) {
// hack: this is to fix cases where opening contours are self-intersecting.
// Clipper doesn't produce such polygons, but as soon as we're back in
// our brave new floating-point world, very small distances are consumed

View File

@ -1311,11 +1311,11 @@ void StepFile::GetSchema(EXPRESS::ConversionSchema& out)
namespace STEP {
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<NotImplemented>(const STEP::DB& db, const LIST& params, NotImplemented* in)
/*template <> size_t GenericFill<NotImplemented>(const STEP::DB& db, const LIST& params, NotImplemented* in)
{
return 0;
}
*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<measure_with_unit>(const DB& db, const LIST& params, measure_with_unit* in)
{
@ -1359,11 +1359,11 @@ template <> size_t GenericFill<absorbed_dose_unit>(const DB& db, const LIST& par
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to absorbed_dose_unit"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<abstract_variable>(const DB& db, const LIST& params, abstract_variable* in)
/*template <> size_t GenericFill<abstract_variable>(const DB& db, const LIST& params, abstract_variable* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<acceleration_measure_with_unit>(const DB& db, const LIST& params, acceleration_measure_with_unit* in)
{
@ -1680,11 +1680,11 @@ template <> size_t GenericFill<amount_of_substance_unit>(const DB& db, const LIS
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to amount_of_substance_unit"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<angle_direction_reference>(const DB& db, const LIST& params, angle_direction_reference* in)
/*template <> size_t GenericFill<angle_direction_reference>(const DB& db, const LIST& params, angle_direction_reference* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<representation_item>(const DB& db, const LIST& params, representation_item* in)
{

View File

@ -452,11 +452,11 @@ template <> size_t GenericFill<applied_person_and_organization_assignment>(const
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<presented_item>(const DB& db, const LIST& params, presented_item* in)
/*template <> size_t GenericFill<presented_item>(const DB& db, const LIST& params, presented_item* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<applied_presented_item>(const DB& db, const LIST& params, applied_presented_item* in)
{
@ -642,11 +642,11 @@ template <> size_t GenericFill<atomic_formula>(const DB& db, const LIST& params,
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to atomic_formula"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<attribute_assertion>(const DB& db, const LIST& params, attribute_assertion* in)
/*template <> size_t GenericFill<attribute_assertion>(const DB& db, const LIST& params, attribute_assertion* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<attribute_language_assignment>(const DB& db, const LIST& params, attribute_language_assignment* in)
{
@ -683,11 +683,11 @@ template <> size_t GenericFill<attribute_value_assignment>(const DB& db, const L
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<auxiliary_geometric_representation_item>(const DB& db, const LIST& params, auxiliary_geometric_representation_item* in)
/*template <> size_t GenericFill<auxiliary_geometric_representation_item>(const DB& db, const LIST& params, auxiliary_geometric_representation_item* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<placement>(const DB& db, const LIST& params, placement* in)
{
@ -946,7 +946,7 @@ template <> size_t GenericFill<back_chaining_rule>(const DB& db, const LIST& par
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to back_chaining_rule"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<back_chaining_rule_body>(const DB& db, const LIST& params, back_chaining_rule_body* in)
/*template <> size_t GenericFill<back_chaining_rule_body>(const DB& db, const LIST& params, back_chaining_rule_body* in)
{
size_t base = 0;
return base;
@ -956,7 +956,7 @@ template <> size_t GenericFill<colour>(const DB& db, const LIST& params, colour*
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<background_colour>(const DB& db, const LIST& params, background_colour* in)
{
@ -987,11 +987,11 @@ template <> size_t GenericFill<bezier_surface>(const DB& db, const LIST& params,
if (params.GetSize() < 7) { throw STEP::TypeError("expected 7 arguments to bezier_surface"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<generic_expression>(const DB& db, const LIST& params, generic_expression* in)
/*template <> size_t GenericFill<generic_expression>(const DB& db, const LIST& params, generic_expression* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<binary_generic_expression>(const DB& db, const LIST& params, binary_generic_expression* in)
{
@ -1004,11 +1004,11 @@ template <> size_t GenericFill<binary_generic_expression>(const DB& db, const LI
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<binary_numeric_expression>(const DB& db, const LIST& params, binary_numeric_expression* in)
/*template <> size_t GenericFill<binary_numeric_expression>(const DB& db, const LIST& params, binary_numeric_expression* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<binary_representation_item>(const DB& db, const LIST& params, binary_representation_item* in)
{
@ -1071,11 +1071,11 @@ template <> size_t GenericFill<boolean_literal>(const DB& db, const LIST& params
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<boolean_representation_item>(const DB& db, const LIST& params, boolean_representation_item* in)
/*template <> size_t GenericFill<boolean_representation_item>(const DB& db, const LIST& params, boolean_representation_item* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<boolean_result>(const DB& db, const LIST& params, boolean_result* in)
{
@ -1128,7 +1128,7 @@ template <> size_t GenericFill<boundary_curve>(const DB& db, const LIST& params,
if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to boundary_curve"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<bounded_pcurve>(const DB& db, const LIST& params, bounded_pcurve* in)
/*template <> size_t GenericFill<bounded_pcurve>(const DB& db, const LIST& params, bounded_pcurve* in)
{
size_t base = 0;
return base;
@ -1144,7 +1144,7 @@ template <> size_t GenericFill<founded_item>(const DB& db, const LIST& params, f
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<box_domain>(const DB& db, const LIST& params, box_domain* in)
{
@ -1218,11 +1218,11 @@ template <> size_t GenericFill<breakdown_element_group_assignment>(const DB& db,
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<breakdown_element_realization>(const DB& db, const LIST& params, breakdown_element_realization* in)
/*template <> size_t GenericFill<breakdown_element_realization>(const DB& db, const LIST& params, breakdown_element_realization* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<breakdown_element_usage>(const DB& db, const LIST& params, breakdown_element_usage* in)
{
@ -1784,11 +1784,11 @@ template <> size_t GenericFill<characteristic_type>(const DB& db, const LIST& pa
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to characteristic_type"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<characterized_class>(const DB& db, const LIST& params, characterized_class* in)
/*template <> size_t GenericFill<characterized_class>(const DB& db, const LIST& params, characterized_class* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<characterized_object>(const DB& db, const LIST& params, characterized_object* in)
{
@ -1947,6 +1947,7 @@ template <> size_t GenericFill<colour_rgb>(const DB& db, const LIST& params, col
} while (0);
return base;
}
/*
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<common_datum>(const DB& db, const LIST& params, common_datum* in)
{
@ -1958,7 +1959,7 @@ template <> size_t GenericFill<comparison_expression>(const DB& db, const LIST&
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<complex_clause>(const DB& db, const LIST& params, complex_clause* in)
{
@ -2792,7 +2793,7 @@ template <> size_t GenericFill<cylindricity_tolerance>(const DB& db, const LIST&
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to cylindricity_tolerance"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<date_representation_item>(const DB& db, const LIST& params, date_representation_item* in)
/*template <> size_t GenericFill<date_representation_item>(const DB& db, const LIST& params, date_representation_item* in)
{
size_t base = 0;
return base;
@ -2802,7 +2803,7 @@ template <> size_t GenericFill<date_time_representation_item>(const DB& db, cons
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<dated_effectivity>(const DB& db, const LIST& params, dated_effectivity* in)
{

View File

@ -98,11 +98,11 @@ template <> size_t GenericFill<dimension_pair>(const DB& db, const LIST& params,
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to dimension_pair"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<dimension_text_associativity>(const DB& db, const LIST& params, dimension_text_associativity* in)
/*template <> size_t GenericFill<dimension_text_associativity>(const DB& db, const LIST& params, dimension_text_associativity* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<dimensional_location_with_path>(const DB& db, const LIST& params, dimensional_location_with_path* in)
{
@ -160,11 +160,11 @@ template <> size_t GenericFill<direction>(const DB& db, const LIST& params, dire
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<document_file>(const DB& db, const LIST& params, document_file* in)
/*template <> size_t GenericFill<document_file>(const DB& db, const LIST& params, document_file* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<document_identifier>(const DB& db, const LIST& params, document_identifier* in)
{
@ -347,11 +347,11 @@ template <> size_t GenericFill<draughting_model_item_association>(const DB& db,
if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to draughting_model_item_association"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<pre_defined_colour>(const DB& db, const LIST& params, pre_defined_colour* in)
/*template <> size_t GenericFill<pre_defined_colour>(const DB& db, const LIST& params, pre_defined_colour* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<draughting_pre_defined_colour>(const DB& db, const LIST& params, draughting_pre_defined_colour* in)
{
@ -461,11 +461,11 @@ template <> size_t GenericFill<draughting_text_literal_with_delineation>(const D
if (params.GetSize() < 7) { throw STEP::TypeError("expected 7 arguments to draughting_text_literal_with_delineation"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<presentation_set>(const DB& db, const LIST& params, presentation_set* in)
/*template <> size_t GenericFill<presentation_set>(const DB& db, const LIST& params, presentation_set* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<drawing_revision>(const DB& db, const LIST& params, drawing_revision* in)
{
@ -592,11 +592,11 @@ template <> size_t GenericFill<edge_curve>(const DB& db, const LIST& params, edg
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<edge_loop>(const DB& db, const LIST& params, edge_loop* in)
/*template <> size_t GenericFill<edge_loop>(const DB& db, const LIST& params, edge_loop* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<electric_charge_measure_with_unit>(const DB& db, const LIST& params, electric_charge_measure_with_unit* in)
{
@ -711,11 +711,11 @@ template <> size_t GenericFill<enum_reference_prefix>(const DB& db, const LIST&
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to enum_reference_prefix"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<evaluated_characteristic>(const DB& db, const LIST& params, evaluated_characteristic* in)
/*template <> size_t GenericFill<evaluated_characteristic>(const DB& db, const LIST& params, evaluated_characteristic* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<evaluated_degenerate_pcurve>(const DB& db, const LIST& params, evaluated_degenerate_pcurve* in)
{
@ -867,11 +867,11 @@ template <> size_t GenericFill<explicit_procedural_shape_representation_relation
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to explicit_procedural_shape_representation_relationship"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<expression_conversion_based_unit>(const DB& db, const LIST& params, expression_conversion_based_unit* in)
/*template <> size_t GenericFill<expression_conversion_based_unit>(const DB& db, const LIST& params, expression_conversion_based_unit* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<extension>(const DB& db, const LIST& params, extension* in)
{
@ -903,35 +903,35 @@ template <> size_t GenericFill<external_class_library>(const DB& db, const LIST&
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to external_class_library"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_class>(const DB& db, const LIST& params, externally_defined_class* in)
/*template <> size_t GenericFill<externally_defined_class>(const DB& db, const LIST& params, externally_defined_class* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_colour>(const DB& db, const LIST& params, externally_defined_colour* in)
/*template <> size_t GenericFill<externally_defined_colour>(const DB& db, const LIST& params, externally_defined_colour* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_context_dependent_unit>(const DB& db, const LIST& params, externally_defined_context_dependent_unit* in)
/*template <> size_t GenericFill<externally_defined_context_dependent_unit>(const DB& db, const LIST& params, externally_defined_context_dependent_unit* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_conversion_based_unit>(const DB& db, const LIST& params, externally_defined_conversion_based_unit* in)
/*template <> size_t GenericFill<externally_defined_conversion_based_unit>(const DB& db, const LIST& params, externally_defined_conversion_based_unit* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_currency>(const DB& db, const LIST& params, externally_defined_currency* in)
/*template <> size_t GenericFill<externally_defined_currency>(const DB& db, const LIST& params, externally_defined_currency* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_item>(const DB& db, const LIST& params, externally_defined_item* in)
{
@ -957,7 +957,7 @@ template <> size_t GenericFill<externally_defined_curve_font>(const DB& db, cons
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to externally_defined_curve_font"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_dimension_definition>(const DB& db, const LIST& params, externally_defined_dimension_definition* in)
/*template <> size_t GenericFill<externally_defined_dimension_definition>(const DB& db, const LIST& params, externally_defined_dimension_definition* in)
{
size_t base = 0;
return base;
@ -979,7 +979,7 @@ template <> size_t GenericFill<externally_defined_marker>(const DB& db, const LI
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<picture_representation_item>(const DB& db, const LIST& params, picture_representation_item* in)
{
@ -993,7 +993,7 @@ template <> size_t GenericFill<externally_defined_picture_representation_item>(c
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to externally_defined_picture_representation_item"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_representation_item>(const DB& db, const LIST& params, externally_defined_representation_item* in)
/*template <> size_t GenericFill<externally_defined_representation_item>(const DB& db, const LIST& params, externally_defined_representation_item* in)
{
size_t base = 0;
return base;
@ -1003,7 +1003,7 @@ template <> size_t GenericFill<externally_defined_string>(const DB& db, const LI
{
size_t base = GenericFill(db, params, static_cast<externally_defined_representation_item*>(in));
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_symbol>(const DB& db, const LIST& params, externally_defined_symbol* in)
{
@ -1029,11 +1029,11 @@ template <> size_t GenericFill<externally_defined_tile>(const DB& db, const LIST
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to externally_defined_tile"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<externally_defined_tile_style>(const DB& db, const LIST& params, externally_defined_tile_style* in)
/*template <> size_t GenericFill<externally_defined_tile_style>(const DB& db, const LIST& params, externally_defined_tile_style* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<swept_area_solid>(const DB& db, const LIST& params, swept_area_solid* in)
{
@ -1358,11 +1358,11 @@ template <> size_t GenericFill<forward_chaining_rule>(const DB& db, const LIST&
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to forward_chaining_rule"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<forward_chaining_rule_premise>(const DB& db, const LIST& params, forward_chaining_rule_premise* in)
/*template <> size_t GenericFill<forward_chaining_rule_premise>(const DB& db, const LIST& params, forward_chaining_rule_premise* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<frequency_measure_with_unit>(const DB& db, const LIST& params, frequency_measure_with_unit* in)
{
@ -1454,11 +1454,11 @@ template <> size_t GenericFill<geometric_item_specific_usage>(const DB& db, cons
if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to geometric_item_specific_usage"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<geometric_model_element_relationship>(const DB& db, const LIST& params, geometric_model_element_relationship* in)
/*template <> size_t GenericFill<geometric_model_element_relationship>(const DB& db, const LIST& params, geometric_model_element_relationship* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<representation_context>(const DB& db, const LIST& params, representation_context* in)
{
@ -1633,11 +1633,11 @@ template <> size_t GenericFill<indirectly_selected_elements>(const DB& db, const
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<indirectly_selected_shape_elements>(const DB& db, const LIST& params, indirectly_selected_shape_elements* in)
/*template <> size_t GenericFill<indirectly_selected_shape_elements>(const DB& db, const LIST& params, indirectly_selected_shape_elements* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<inductance_measure_with_unit>(const DB& db, const LIST& params, inductance_measure_with_unit* in)
{
@ -1674,11 +1674,11 @@ template <> size_t GenericFill<instance_usage_context_assignment>(const DB& db,
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<instanced_feature>(const DB& db, const LIST& params, instanced_feature* in)
/*template <> size_t GenericFill<instanced_feature>(const DB& db, const LIST& params, instanced_feature* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<literal_number>(const DB& db, const LIST& params, literal_number* in)
{
@ -1698,11 +1698,11 @@ template <> size_t GenericFill<int_literal>(const DB& db, const LIST& params, in
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to int_literal"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<integer_representation_item>(const DB& db, const LIST& params, integer_representation_item* in)
/*template <> size_t GenericFill<integer_representation_item>(const DB& db, const LIST& params, integer_representation_item* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<surface_curve>(const DB& db, const LIST& params, surface_curve* in)
{
@ -1734,11 +1734,11 @@ template <> size_t GenericFill<intersection_curve>(const DB& db, const LIST& par
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to intersection_curve"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<interval_expression>(const DB& db, const LIST& params, interval_expression* in)
/*template <> size_t GenericFill<interval_expression>(const DB& db, const LIST& params, interval_expression* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<iso4217_currency>(const DB& db, const LIST& params, iso4217_currency* in)
{
@ -1746,11 +1746,11 @@ template <> size_t GenericFill<iso4217_currency>(const DB& db, const LIST& param
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to iso4217_currency"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<known_source>(const DB& db, const LIST& params, known_source* in)
/*template <> size_t GenericFill<known_source>(const DB& db, const LIST& params, known_source* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<laid_defined_transformation>(const DB& db, const LIST& params, laid_defined_transformation* in)
{
@ -1943,11 +1943,11 @@ template <> size_t GenericFill<logical_literal>(const DB& db, const LIST& params
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<logical_representation_item>(const DB& db, const LIST& params, logical_representation_item* in)
/*template <> size_t GenericFill<logical_representation_item>(const DB&, const LIST& params, logical_representation_item* )
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<loop>(const DB& db, const LIST& params, loop* in)
{
@ -2105,11 +2105,11 @@ template <> size_t GenericFill<material_property_representation>(const DB& db, c
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<measure_representation_item>(const DB& db, const LIST& params, measure_representation_item* in)
/*template <> size_t GenericFill<measure_representation_item>(const DB& db, const LIST& params, measure_representation_item* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<product_context>(const DB& db, const LIST& params, product_context* in)
{
@ -2165,11 +2165,11 @@ template <> size_t GenericFill<mechanical_design_shaded_presentation_representat
if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to mechanical_design_shaded_presentation_representation"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<min_and_major_ply_orientation_basis>(const DB& db, const LIST& params, min_and_major_ply_orientation_basis* in)
/*template <> size_t GenericFill<min_and_major_ply_orientation_basis>(const DB& db, const LIST& params, min_and_major_ply_orientation_basis* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<modified_geometric_tolerance>(const DB& db, const LIST& params, modified_geometric_tolerance* in)
{
@ -2211,11 +2211,11 @@ template <> size_t GenericFill<multi_language_attribute_assignment>(const DB& db
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<multiple_arity_boolean_expression>(const DB& db, const LIST& params, multiple_arity_boolean_expression* in)
/*template <> size_t GenericFill<multiple_arity_boolean_expression>(const DB& db, const LIST& params, multiple_arity_boolean_expression* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<multiple_arity_generic_expression>(const DB& db, const LIST& params, multiple_arity_generic_expression* in)
{
@ -2228,11 +2228,11 @@ template <> size_t GenericFill<multiple_arity_generic_expression>(const DB& db,
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<multiple_arity_numeric_expression>(const DB& db, const LIST& params, multiple_arity_numeric_expression* in)
/*template <> size_t GenericFill<multiple_arity_numeric_expression>(const DB& db, const LIST& params, multiple_arity_numeric_expression* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<next_assembly_usage_occurrence>(const DB& db, const LIST& params, next_assembly_usage_occurrence* in)
{
@ -2533,11 +2533,11 @@ template <> size_t GenericFill<parametric_representation_context>(const DB& db,
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to parametric_representation_context"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<partial_document_with_structured_text_representation_assignment>(const DB& db, const LIST& params, partial_document_with_structured_text_representation_assignment* in)
/*template <> size_t GenericFill<partial_document_with_structured_text_representation_assignment>(const DB& db, const LIST& params, partial_document_with_structured_text_representation_assignment* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<pcurve>(const DB& db, const LIST& params, pcurve* in)
{
@ -2591,11 +2591,11 @@ template <> size_t GenericFill<perpendicularity_tolerance>(const DB& db, const L
if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to perpendicularity_tolerance"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<person_and_organization_address>(const DB& db, const LIST& params, person_and_organization_address* in)
/*template <> size_t GenericFill<person_and_organization_address>(const DB& db, const LIST& params, person_and_organization_address* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<personal_address>(const DB& db, const LIST& params, personal_address* in)
{
@ -2715,11 +2715,11 @@ template <> size_t GenericFill<ply_laminate_table>(const DB& db, const LIST& par
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to ply_laminate_table"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<point_and_vector>(const DB& db, const LIST& params, point_and_vector* in)
/*template <> size_t GenericFill<point_and_vector>(const DB& db, const LIST& params, point_and_vector* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<point_on_curve>(const DB& db, const LIST& params, point_on_curve* in)
{
@ -2758,11 +2758,11 @@ template <> size_t GenericFill<point_on_surface>(const DB& db, const LIST& param
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<point_path>(const DB& db, const LIST& params, point_path* in)
/*template <> size_t GenericFill<point_path>(const DB& db, const LIST& params, point_path* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<point_replica>(const DB& db, const LIST& params, point_replica* in)
{
@ -2904,11 +2904,11 @@ template <> size_t GenericFill<pre_defined_marker>(const DB& db, const LIST& par
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to pre_defined_marker"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<pre_defined_point_marker_symbol>(const DB& db, const LIST& params, pre_defined_point_marker_symbol* in)
/*template <> size_t GenericFill<pre_defined_point_marker_symbol>(const DB& db, const LIST& params, pre_defined_point_marker_symbol* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<pre_defined_surface_condition_symbol>(const DB& db, const LIST& params, pre_defined_surface_condition_symbol* in)
{
@ -3002,7 +3002,7 @@ template <> size_t GenericFill<procedural_representation_sequence>(const DB& db,
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<procedural_shape_representation>(const DB& db, const LIST& params, procedural_shape_representation* in)
/*template <> size_t GenericFill<procedural_shape_representation>(const DB& db, const LIST& params, procedural_shape_representation* in)
{
size_t base = 0;
return base;
@ -3012,7 +3012,7 @@ template <> size_t GenericFill<procedural_shape_representation_sequence>(const D
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<product_category>(const DB& db, const LIST& params, product_category* in)
{
@ -3033,11 +3033,11 @@ template <> size_t GenericFill<product_category>(const DB& db, const LIST& param
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<product_class>(const DB& db, const LIST& params, product_class* in)
/*template <> size_t GenericFill<product_class>(const DB& db, const LIST& params, product_class* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<product_concept_context>(const DB& db, const LIST& params, product_concept_context* in)
{
@ -3131,11 +3131,11 @@ template <> size_t GenericFill<product_definition_with_associated_documents>(con
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<product_identification>(const DB& db, const LIST& params, product_identification* in)
/*template <> size_t GenericFill<product_identification>(const DB& db, const LIST& params, product_identification* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<product_material_composition_relationship>(const DB& db, const LIST& params, product_material_composition_relationship* in)
{
@ -3174,11 +3174,11 @@ template <> size_t GenericFill<product_related_product_category>(const DB& db, c
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<product_specification>(const DB& db, const LIST& params, product_specification* in)
/*template <> size_t GenericFill<product_specification>(const DB& db, const LIST& params, product_specification* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<tolerance_zone_definition>(const DB& db, const LIST& params, tolerance_zone_definition* in)
{
@ -3289,11 +3289,11 @@ template <> size_t GenericFill<radius_dimension>(const DB& db, const LIST& param
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to radius_dimension"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<range_characteristic>(const DB& db, const LIST& params, range_characteristic* in)
/*template <> size_t GenericFill<range_characteristic>(const DB& db, const LIST& params, range_characteristic* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<ratio_unit>(const DB& db, const LIST& params, ratio_unit* in)
{
@ -3318,11 +3318,11 @@ template <> size_t GenericFill<rational_b_spline_surface>(const DB& db, const LI
if (params.GetSize() < 7) { throw STEP::TypeError("expected 7 arguments to rational_b_spline_surface"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<rational_representation_item>(const DB& db, const LIST& params, rational_representation_item* in)
/*template <> size_t GenericFill<rational_representation_item>(const DB& db, const LIST& params, rational_representation_item* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<real_literal>(const DB& db, const LIST& params, real_literal* in)
{
@ -3330,11 +3330,11 @@ template <> size_t GenericFill<real_literal>(const DB& db, const LIST& params, r
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to real_literal"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<real_representation_item>(const DB& db, const LIST& params, real_representation_item* in)
/*template <> size_t GenericFill<real_representation_item>(const DB& db, const LIST& params, real_representation_item* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<rectangular_composite_surface>(const DB& db, const LIST& params, rectangular_composite_surface* in)
{
@ -3410,11 +3410,11 @@ template <> size_t GenericFill<relative_event_occurrence>(const DB& db, const LI
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<rep_item_group>(const DB& db, const LIST& params, rep_item_group* in)
/*template <> size_t GenericFill<rep_item_group>(const DB& db, const LIST& params, rep_item_group* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<reparametrised_composite_curve_segment>(const DB& db, const LIST& params, reparametrised_composite_curve_segment* in)
{
@ -3449,11 +3449,11 @@ template <> size_t GenericFill<requirement_assigned_object>(const DB& db, const
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<requirement_assignment>(const DB& db, const LIST& params, requirement_assignment* in)
/*template <> size_t GenericFill<requirement_assignment>(const DB& db, const LIST& params, requirement_assignment* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<requirement_source>(const DB& db, const LIST& params, requirement_source* in)
{
@ -3891,7 +3891,7 @@ template <> size_t GenericFill<shell_based_wireframe_shape_representation>(const
if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to shell_based_wireframe_shape_representation"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<si_absorbed_dose_unit>(const DB& db, const LIST& params, si_absorbed_dose_unit* in)
/*template <> size_t GenericFill<si_absorbed_dose_unit>(const DB& db, const LIST& params, si_absorbed_dose_unit* in)
{
size_t base = 0;
return base;
@ -3991,7 +3991,7 @@ template <> size_t GenericFill<si_resistance_unit>(const DB& db, const LIST& par
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<si_unit>(const DB& db, const LIST& params, si_unit* in)
{
@ -4010,7 +4010,7 @@ template <> size_t GenericFill<si_unit>(const DB& db, const LIST& params, si_uni
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<simple_boolean_expression>(const DB& db, const LIST& params, simple_boolean_expression* in)
/*template <> size_t GenericFill<simple_boolean_expression>(const DB& db, const LIST& params, simple_boolean_expression* in)
{
size_t base = 0;
return base;
@ -4026,7 +4026,7 @@ template <> size_t GenericFill<slash_expression>(const DB& db, const LIST& param
{
size_t base = GenericFill(db, params, static_cast<binary_numeric_expression*>(in));
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<smeared_material_definition>(const DB& db, const LIST& params, smeared_material_definition* in)
{
@ -5450,11 +5450,11 @@ template <> size_t GenericFill<unary_generic_expression>(const DB& db, const LIS
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<unary_numeric_expression>(const DB& db, const LIST& params, unary_numeric_expression* in)
/*template <> size_t GenericFill<unary_numeric_expression>(const DB& db, const LIST& params, unary_numeric_expression* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<uncertainty_assigned_representation>(const DB& db, const LIST& params, uncertainty_assigned_representation* in)
{
@ -5508,7 +5508,7 @@ template <> size_t GenericFill<usage_association>(const DB& db, const LIST& para
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to usage_association"); } return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<user_defined_curve_font>(const DB& db, const LIST& params, user_defined_curve_font* in)
/*template <> size_t GenericFill<user_defined_curve_font>(const DB& db, const LIST& params, user_defined_curve_font* in)
{
size_t base = 0;
return base;
@ -5524,7 +5524,7 @@ template <> size_t GenericFill<user_defined_terminator_symbol>(const DB& db, con
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<user_selected_shape_elements>(const DB& db, const LIST& params, user_selected_shape_elements* in)
{
@ -5549,11 +5549,11 @@ template <> size_t GenericFill<value_representation_item>(const DB& db, const LI
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<variable_semantics>(const DB& db, const LIST& params, variable_semantics* in)
/*template <> size_t GenericFill<variable_semantics>(const DB& db, const LIST& params, variable_semantics* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<variational_representation_item>(const DB& db, const LIST& params, variational_representation_item* in)
{
@ -5577,11 +5577,11 @@ template <> size_t GenericFill<vector>(const DB& db, const LIST& params, vector*
return base;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<vector_style>(const DB& db, const LIST& params, vector_style* in)
/*template <> size_t GenericFill<vector_style>(const DB& db, const LIST& params, vector_style* in)
{
size_t base = 0;
return base;
}
}*/
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<velocity_measure_with_unit>(const DB& db, const LIST& params, velocity_measure_with_unit* in)
{

View File

@ -93,7 +93,7 @@ const aiImporterDesc *StepFileImporter::GetInfo() const {
static const std::string mode = "rb";
static const std::string StepFileSchema = "CONFIG_CONTROL_DESIGN";
void StepFileImporter::InternReadFile(const std::string &file, aiScene* pScene, IOSystem* pIOHandler) {
void StepFileImporter::InternReadFile(const std::string &file, aiScene*, IOSystem* pIOHandler) {
// Read file into memory
std::shared_ptr<IOStream> fileStream(pIOHandler->Open(file, mode));
if (!fileStream.get()) {

View File

@ -64,9 +64,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/Exporter.hpp>
#include <assimp/IOSystem.hpp>
#include "M3DWrapper.h"
#include "M3DExporter.h"
#include "M3DMaterials.h"
#include "M3DWrapper.h"
// RESOURCES:
// https://gitlab.com/bztsrc/model3d/blob/master/docs/m3d_format.md
@ -132,13 +132,13 @@ void addProp(m3dm_t *m, uint8_t type, uint32_t value) {
// ------------------------------------------------------------------------------------------------
// convert aiString to identifier safe C string. This is a duplication of _m3d_safestr
char *SafeStr(aiString str, bool isStrict)
{
char *SafeStr(aiString str, bool isStrict) {
char *s = (char *)&str.data;
char *d, *ret;
int i, len;
for(len = str.length + 1; *s && (*s == ' ' || *s == '\t'); s++, len--);
for (len = str.length + 1; *s && (*s == ' ' || *s == '\t'); s++, len--)
;
if (len > 255) len = 255;
ret = (char *)M3D_MALLOC(len + 1);
if (!ret) {
@ -147,7 +147,8 @@ char *SafeStr(aiString str, bool isStrict)
for (i = 0, d = ret; i < len && *s && *s != '\r' && *s != '\n'; s++, d++, i++) {
*d = isStrict && (*s == ' ' || *s == '\t' || *s == '/' || *s == '\\') ? '_' : (*s == '\t' ? ' ' : *s);
}
for(; d > ret && (*(d-1) == ' ' || *(d-1) == '\t'); d--);
for (; d > ret && (*(d - 1) == ' ' || *(d - 1) == '\t'); d--)
;
*d = 0;
return ret;
}
@ -290,10 +291,10 @@ void ExportSceneM3D(
// Worker function for exporting a scene to ASCII A3D.
// Prototyped and registered in Exporter.cpp
void ExportSceneM3DA(
const char *pFile,
IOSystem *pIOSystem,
const aiScene *pScene,
const ExportProperties *pProperties
const char *,
IOSystem*,
const aiScene*,
const ExportProperties *
) {
#ifdef M3D_ASCII

File diff suppressed because it is too large Load Diff

View File

@ -199,9 +199,9 @@ namespace vmd
stream->write((char*)&ik_count, sizeof(int));
for (int i = 0; i < ik_count; i++)
{
const VmdIkEnable& ik_enable = this->ik_enable.at(i);
stream->write(ik_enable.ik_name.c_str(), 20);
stream->write((char*)&ik_enable.enable, sizeof(uint8_t));
const VmdIkEnable& ik_enable_ref = this->ik_enable.at(i);
stream->write(ik_enable_ref.ik_name.c_str(), 20);
stream->write((char *)&ik_enable_ref.enable, sizeof(uint8_t));
}
}
};

View File

@ -86,7 +86,7 @@ void ExportSceneObj(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene
// ------------------------------------------------------------------------------------------------
// Worker function for exporting a scene to Wavefront OBJ without the material file. Prototyped and registered in Exporter.cpp
void ExportSceneObjNoMtl(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties) {
void ExportSceneObjNoMtl(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* ) {
// invoke the exporter
ObjExporter exporter(pFile, pScene, true);

View File

@ -41,22 +41,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "OgreBinarySerializer.h"
#include "OgreXmlSerializer.h"
#include "OgreParsingUtils.h"
#include "OgreXmlSerializer.h"
#include <assimp/TinyFormatter.h>
#include <assimp/DefaultLogger.hpp>
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
// Define as 1 to get verbose logging.
#define OGRE_BINARY_SERIALIZER_DEBUG 0
namespace Assimp
{
namespace Ogre
{
namespace Assimp {
namespace Ogre {
const std::string MESH_VERSION_1_8 = "[MeshSerializer_v1.8]";
const std::string SKELETON_VERSION_1_8 = "[Serializer_v1.80]";
@ -69,70 +66,58 @@ const long MSTREAM_BONE_SIZE_WITHOUT_SCALE = MSTREAM_OVERHEAD_S
const long MSTREAM_KEYFRAME_SIZE_WITHOUT_SCALE = MSTREAM_OVERHEAD_SIZE + (sizeof(float) * 8);
template <>
inline bool OgreBinarySerializer::Read<bool>()
{
inline bool OgreBinarySerializer::Read<bool>() {
return (m_reader->GetU1() > 0);
}
template <>
inline char OgreBinarySerializer::Read<char>()
{
inline char OgreBinarySerializer::Read<char>() {
return static_cast<char>(m_reader->GetU1());
}
template <>
inline uint8_t OgreBinarySerializer::Read<uint8_t>()
{
inline uint8_t OgreBinarySerializer::Read<uint8_t>() {
return m_reader->GetU1();
}
template <>
inline uint16_t OgreBinarySerializer::Read<uint16_t>()
{
inline uint16_t OgreBinarySerializer::Read<uint16_t>() {
return m_reader->GetU2();
}
template <>
inline uint32_t OgreBinarySerializer::Read<uint32_t>()
{
inline uint32_t OgreBinarySerializer::Read<uint32_t>() {
return m_reader->GetU4();
}
template <>
inline float OgreBinarySerializer::Read<float>()
{
inline float OgreBinarySerializer::Read<float>() {
return m_reader->GetF4();
}
void OgreBinarySerializer::ReadBytes(char *dest, size_t numBytes)
{
void OgreBinarySerializer::ReadBytes(char *dest, size_t numBytes) {
ReadBytes(static_cast<void *>(dest), numBytes);
}
void OgreBinarySerializer::ReadBytes(uint8_t *dest, size_t numBytes)
{
void OgreBinarySerializer::ReadBytes(uint8_t *dest, size_t numBytes) {
ReadBytes(static_cast<void *>(dest), numBytes);
}
void OgreBinarySerializer::ReadBytes(void *dest, size_t numBytes)
{
void OgreBinarySerializer::ReadBytes(void *dest, size_t numBytes) {
m_reader->CopyAndAdvance(dest, numBytes);
}
uint8_t *OgreBinarySerializer::ReadBytes(size_t numBytes)
{
uint8_t *OgreBinarySerializer::ReadBytes(size_t numBytes) {
uint8_t *bytes = new uint8_t[numBytes];
ReadBytes(bytes, numBytes);
return bytes;
}
void OgreBinarySerializer::ReadVector(aiVector3D &vec)
{
void OgreBinarySerializer::ReadVector(aiVector3D &vec) {
m_reader->CopyAndAdvance(&vec.x, sizeof(float) * 3);
}
void OgreBinarySerializer::ReadQuaternion(aiQuaternion &quat)
{
void OgreBinarySerializer::ReadQuaternion(aiQuaternion &quat) {
float temp[4];
m_reader->CopyAndAdvance(temp, sizeof(float) * 4);
quat.x = temp[0];
@ -141,24 +126,20 @@ void OgreBinarySerializer::ReadQuaternion(aiQuaternion &quat)
quat.w = temp[3];
}
bool OgreBinarySerializer::AtEnd() const
{
bool OgreBinarySerializer::AtEnd() const {
return (m_reader->GetRemainingSize() == 0);
}
std::string OgreBinarySerializer::ReadString(size_t len)
{
std::string OgreBinarySerializer::ReadString(size_t len) {
std::string str;
str.resize(len);
ReadBytes(&str[0], len);
return str;
}
std::string OgreBinarySerializer::ReadLine()
{
std::string OgreBinarySerializer::ReadLine() {
std::string str;
while(!AtEnd())
{
while (!AtEnd()) {
char c = Read<char>();
if (c == '\n')
break;
@ -167,30 +148,25 @@ std::string OgreBinarySerializer::ReadLine()
return str;
}
uint16_t OgreBinarySerializer::ReadHeader(bool readLen)
{
uint16_t OgreBinarySerializer::ReadHeader(bool readLen) {
uint16_t id = Read<uint16_t>();
if (readLen)
m_currentLen = Read<uint32_t>();
#if (OGRE_BINARY_SERIALIZER_DEBUG == 1)
if (id != HEADER_CHUNK_ID)
{
ASSIMP_LOG_DEBUG(Formatter::format() << (assetMode == AM_Mesh
? MeshHeaderToString(static_cast<MeshChunkId>(id)) : SkeletonHeaderToString(static_cast<SkeletonChunkId>(id))));
if (id != HEADER_CHUNK_ID) {
ASSIMP_LOG_DEBUG(Formatter::format() << (assetMode == AM_Mesh ? MeshHeaderToString(static_cast<MeshChunkId>(id)) : SkeletonHeaderToString(static_cast<SkeletonChunkId>(id))));
}
#endif
return id;
}
void OgreBinarySerializer::RollbackHeader()
{
void OgreBinarySerializer::RollbackHeader() {
m_reader->IncPtr(-MSTREAM_OVERHEAD_SIZE);
}
void OgreBinarySerializer::SkipBytes(size_t numBytes)
{
void OgreBinarySerializer::SkipBytes(size_t numBytes) {
#if (OGRE_BINARY_SERIALIZER_DEBUG == 1)
ASSIMP_LOG_DEBUG_F("Skipping ", numBytes, " bytes");
#endif
@ -200,8 +176,7 @@ void OgreBinarySerializer::SkipBytes(size_t numBytes)
// Mesh
Mesh *OgreBinarySerializer::ImportMesh(MemoryStreamReader *stream)
{
Mesh *OgreBinarySerializer::ImportMesh(MemoryStreamReader *stream) {
OgreBinarySerializer serializer(stream, OgreBinarySerializer::AM_Mesh);
uint16_t id = serializer.ReadHeader(false);
@ -211,20 +186,16 @@ Mesh *OgreBinarySerializer::ImportMesh(MemoryStreamReader *stream)
/// @todo Check what we can actually support.
std::string version = serializer.ReadLine();
if (version != MESH_VERSION_1_8)
{
if (version != MESH_VERSION_1_8) {
throw DeadlyExportError(Formatter::format() << "Mesh version " << version << " not supported by this importer. Run OgreMeshUpgrader tool on the file and try again."
<< " Supported versions: " << MESH_VERSION_1_8);
}
Mesh *mesh = new Mesh();
while (!serializer.AtEnd())
{
while (!serializer.AtEnd()) {
id = serializer.ReadHeader();
switch(id)
{
case M_MESH:
{
switch (id) {
case M_MESH: {
serializer.ReadMesh(mesh);
break;
}
@ -233,15 +204,13 @@ Mesh *OgreBinarySerializer::ImportMesh(MemoryStreamReader *stream)
return mesh;
}
void OgreBinarySerializer::ReadMesh(Mesh *mesh)
{
void OgreBinarySerializer::ReadMesh(Mesh *mesh) {
mesh->hasSkeletalAnimations = Read<bool>();
ASSIMP_LOG_DEBUG("Reading Mesh");
ASSIMP_LOG_DEBUG_F(" - Skeletal animations: ", mesh->hasSkeletalAnimations ? "true" : "false");
if (!AtEnd())
{
if (!AtEnd()) {
uint16_t id = ReadHeader();
while (!AtEnd() &&
(id == M_GEOMETRY ||
@ -254,63 +223,50 @@ void OgreBinarySerializer::ReadMesh(Mesh *mesh)
id == M_EDGE_LISTS ||
id == M_POSES ||
id == M_ANIMATIONS ||
id == M_TABLE_EXTREMES))
{
switch(id)
{
case M_GEOMETRY:
{
id == M_TABLE_EXTREMES)) {
switch (id) {
case M_GEOMETRY: {
mesh->sharedVertexData = new VertexData();
ReadGeometry(mesh->sharedVertexData);
break;
}
case M_SUBMESH:
{
case M_SUBMESH: {
ReadSubMesh(mesh);
break;
}
case M_MESH_SKELETON_LINK:
{
case M_MESH_SKELETON_LINK: {
ReadMeshSkeletonLink(mesh);
break;
}
case M_MESH_BONE_ASSIGNMENT:
{
case M_MESH_BONE_ASSIGNMENT: {
ReadBoneAssignment(mesh->sharedVertexData);
break;
}
case M_MESH_LOD:
{
case M_MESH_LOD: {
ReadMeshLodInfo(mesh);
break;
}
case M_MESH_BOUNDS:
{
case M_MESH_BOUNDS: {
ReadMeshBounds(mesh);
break;
}
case M_SUBMESH_NAME_TABLE:
{
case M_SUBMESH_NAME_TABLE: {
ReadSubMeshNames(mesh);
break;
}
case M_EDGE_LISTS:
{
case M_EDGE_LISTS: {
ReadEdgeList(mesh);
break;
}
case M_POSES:
{
case M_POSES: {
ReadPoses(mesh);
break;
}
case M_ANIMATIONS:
{
case M_ANIMATIONS: {
ReadAnimations(mesh);
break;
}
case M_TABLE_EXTREMES:
{
case M_TABLE_EXTREMES: {
ReadMeshExtremes(mesh);
break;
}
@ -326,8 +282,7 @@ void OgreBinarySerializer::ReadMesh(Mesh *mesh)
NormalizeBoneWeights(mesh->sharedVertexData);
}
void OgreBinarySerializer::ReadMeshLodInfo(Mesh *mesh)
{
void OgreBinarySerializer::ReadMeshLodInfo(Mesh *mesh) {
// Assimp does not acknowledge LOD levels as far as I can see it. This info is just skipped.
// @todo Put this stuff to scene/mesh custom properties. If manual mesh the app can use the information.
ReadLine(); // strategy name
@ -335,8 +290,7 @@ void OgreBinarySerializer::ReadMeshLodInfo(Mesh *mesh)
bool manual = Read<bool>();
/// @note Main mesh is considered as LOD 0, start from index 1.
for (size_t i=1; i<numLods; ++i)
{
for (size_t i = 1; i < numLods; ++i) {
uint16_t id = ReadHeader();
if (id != M_MESH_LOD_USAGE) {
throw DeadlyImportError("M_MESH_LOD does not contain a M_MESH_LOD_USAGE for each LOD level");
@ -344,19 +298,15 @@ void OgreBinarySerializer::ReadMeshLodInfo(Mesh *mesh)
m_reader->IncPtr(sizeof(float)); // user value
if (manual)
{
if (manual) {
id = ReadHeader();
if (id != M_MESH_LOD_MANUAL) {
throw DeadlyImportError("Manual M_MESH_LOD_USAGE does not contain M_MESH_LOD_MANUAL");
}
ReadLine(); // manual mesh name (ref to another mesh)
}
else
{
for(size_t si=0, silen=mesh->NumSubMeshes(); si<silen; ++si)
{
} else {
for (size_t si = 0, silen = mesh->NumSubMeshes(); si < silen; ++si) {
id = ReadHeader();
if (id != M_MESH_LOD_GENERATED) {
throw DeadlyImportError("Generated M_MESH_LOD_USAGE does not contain M_MESH_LOD_GENERATED");
@ -365,8 +315,7 @@ void OgreBinarySerializer::ReadMeshLodInfo(Mesh *mesh)
uint32_t indexCount = Read<uint32_t>();
bool is32bit = Read<bool>();
if (indexCount > 0)
{
if (indexCount > 0) {
uint32_t len = indexCount * (is32bit ? sizeof(uint32_t) : sizeof(uint16_t));
m_reader->IncPtr(len);
}
@ -375,27 +324,23 @@ void OgreBinarySerializer::ReadMeshLodInfo(Mesh *mesh)
}
}
void OgreBinarySerializer::ReadMeshSkeletonLink(Mesh *mesh)
{
void OgreBinarySerializer::ReadMeshSkeletonLink(Mesh *mesh) {
mesh->skeletonRef = ReadLine();
}
void OgreBinarySerializer::ReadMeshBounds(Mesh * /*mesh*/)
{
void OgreBinarySerializer::ReadMeshBounds(Mesh * /*mesh*/) {
// Skip bounds, not compatible with Assimp.
// 2x float vec3 + 1x float sphere radius
SkipBytes(sizeof(float) * 7);
}
void OgreBinarySerializer::ReadMeshExtremes(Mesh * /*mesh*/)
{
void OgreBinarySerializer::ReadMeshExtremes(Mesh * /*mesh*/) {
// Skip extremes, not compatible with Assimp.
size_t numBytes = m_currentLen - MSTREAM_OVERHEAD_SIZE;
SkipBytes(numBytes);
}
void OgreBinarySerializer::ReadBoneAssignment(VertexData *dest)
{
void OgreBinarySerializer::ReadBoneAssignment(VertexData *dest) {
if (!dest) {
throw DeadlyImportError("Cannot read bone assignments, vertex data is null.");
}
@ -408,8 +353,7 @@ void OgreBinarySerializer::ReadBoneAssignment(VertexData *dest)
dest->boneAssignments.push_back(ba);
}
void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
{
void OgreBinarySerializer::ReadSubMesh(Mesh *mesh) {
uint16_t id = 0;
SubMesh *submesh = new SubMesh();
@ -425,8 +369,7 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
ASSIMP_LOG_DEBUG_F(" - Uses shared geometry: ", submesh->usesSharedVertexData ? "true" : "false");
// Index buffer
if (submesh->indexData->count > 0)
{
if (submesh->indexData->count > 0) {
uint32_t numBytes = submesh->indexData->count * (submesh->indexData->is32bit ? sizeof(uint32_t) : sizeof(uint16_t));
uint8_t *indexBuffer = ReadBytes(numBytes);
submesh->indexData->buffer = MemoryStreamPtr(new Assimp::MemoryIOStream(indexBuffer, numBytes, true));
@ -437,8 +380,7 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
}
// Vertex buffer if not referencing the shared geometry
if (!submesh->usesSharedVertexData)
{
if (!submesh->usesSharedVertexData) {
id = ReadHeader();
if (id != M_GEOMETRY) {
throw DeadlyImportError("M_SUBMESH does not contain M_GEOMETRY, but shader geometry is set to false");
@ -449,28 +391,22 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
}
// Bone assignment, submesh operation and texture aliases
if (!AtEnd())
{
if (!AtEnd()) {
id = ReadHeader();
while (!AtEnd() &&
(id == M_SUBMESH_OPERATION ||
id == M_SUBMESH_BONE_ASSIGNMENT ||
id == M_SUBMESH_TEXTURE_ALIAS))
{
switch(id)
{
case M_SUBMESH_OPERATION:
{
id == M_SUBMESH_TEXTURE_ALIAS)) {
switch (id) {
case M_SUBMESH_OPERATION: {
ReadSubMeshOperation(submesh);
break;
}
case M_SUBMESH_BONE_ASSIGNMENT:
{
case M_SUBMESH_BONE_ASSIGNMENT: {
ReadBoneAssignment(submesh->vertexData);
break;
}
case M_SUBMESH_TEXTURE_ALIAS:
{
case M_SUBMESH_TEXTURE_ALIAS: {
ReadSubMeshTextureAlias(submesh);
break;
}
@ -489,8 +425,7 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
mesh->subMeshes.push_back(submesh);
}
void OgreBinarySerializer::NormalizeBoneWeights(VertexData *vertexData) const
{
void OgreBinarySerializer::NormalizeBoneWeights(VertexData *vertexData) const {
if (!vertexData || vertexData->boneAssignments.empty())
return;
@ -503,18 +438,14 @@ void OgreBinarySerializer::NormalizeBoneWeights(VertexData *vertexData) const
Some exporters won't care if the sum of all bone weights
for a single vertex equals 1 or not, so validate here. */
const float epsilon = 0.05f;
for (const uint32_t vertexIndex : influencedVertices)
{
for (const uint32_t vertexIndex : influencedVertices) {
float sum = 0.0f;
for (VertexBoneAssignmentList::const_iterator baIter=vertexData->boneAssignments.begin(), baEnd=vertexData->boneAssignments.end(); baIter != baEnd; ++baIter)
{
for (VertexBoneAssignmentList::const_iterator baIter = vertexData->boneAssignments.begin(), baEnd = vertexData->boneAssignments.end(); baIter != baEnd; ++baIter) {
if (baIter->vertexIndex == vertexIndex)
sum += baIter->weight;
}
if ((sum < (1.0f - epsilon)) || (sum > (1.0f + epsilon)))
{
for (auto &boneAssign : vertexData->boneAssignments)
{
if ((sum < (1.0f - epsilon)) || (sum > (1.0f + epsilon))) {
for (auto &boneAssign : vertexData->boneAssignments) {
if (boneAssign.vertexIndex == vertexIndex)
boneAssign.weight /= sum;
}
@ -522,26 +453,21 @@ void OgreBinarySerializer::NormalizeBoneWeights(VertexData *vertexData) const
}
}
void OgreBinarySerializer::ReadSubMeshOperation(SubMesh *submesh)
{
void OgreBinarySerializer::ReadSubMeshOperation(SubMesh *submesh) {
submesh->operationType = static_cast<SubMesh::OperationType>(Read<uint16_t>());
}
void OgreBinarySerializer::ReadSubMeshTextureAlias(SubMesh *submesh)
{
void OgreBinarySerializer::ReadSubMeshTextureAlias(SubMesh *submesh) {
submesh->textureAliasName = ReadLine();
submesh->textureAliasRef = ReadLine();
}
void OgreBinarySerializer::ReadSubMeshNames(Mesh *mesh)
{
void OgreBinarySerializer::ReadSubMeshNames(Mesh *mesh) {
uint16_t id = 0;
if (!AtEnd())
{
if (!AtEnd()) {
id = ReadHeader();
while (!AtEnd() && id == M_SUBMESH_NAME_TABLE_ELEMENT)
{
while (!AtEnd() && id == M_SUBMESH_NAME_TABLE_ELEMENT) {
uint16_t submeshIndex = Read<uint16_t>();
SubMesh *submesh = mesh->GetSubMesh(submeshIndex);
if (!submesh) {
@ -559,28 +485,22 @@ void OgreBinarySerializer::ReadSubMeshNames(Mesh *mesh)
}
}
void OgreBinarySerializer::ReadGeometry(VertexData *dest)
{
void OgreBinarySerializer::ReadGeometry(VertexData *dest) {
dest->count = Read<uint32_t>();
ASSIMP_LOG_DEBUG_F(" - Reading geometry of ", dest->count, " vertices");
if (!AtEnd())
{
if (!AtEnd()) {
uint16_t id = ReadHeader();
while (!AtEnd() &&
(id == M_GEOMETRY_VERTEX_DECLARATION ||
id == M_GEOMETRY_VERTEX_BUFFER))
{
switch(id)
{
case M_GEOMETRY_VERTEX_DECLARATION:
{
id == M_GEOMETRY_VERTEX_BUFFER)) {
switch (id) {
case M_GEOMETRY_VERTEX_DECLARATION: {
ReadGeometryVertexDeclaration(dest);
break;
}
case M_GEOMETRY_VERTEX_BUFFER:
{
case M_GEOMETRY_VERTEX_BUFFER: {
ReadGeometryVertexBuffer(dest);
break;
}
@ -594,13 +514,10 @@ void OgreBinarySerializer::ReadGeometry(VertexData *dest)
}
}
void OgreBinarySerializer::ReadGeometryVertexDeclaration(VertexData *dest)
{
if (!AtEnd())
{
void OgreBinarySerializer::ReadGeometryVertexDeclaration(VertexData *dest) {
if (!AtEnd()) {
uint16_t id = ReadHeader();
while (!AtEnd() && id == M_GEOMETRY_VERTEX_ELEMENT)
{
while (!AtEnd() && id == M_GEOMETRY_VERTEX_ELEMENT) {
ReadGeometryVertexElement(dest);
if (!AtEnd())
@ -611,8 +528,7 @@ void OgreBinarySerializer::ReadGeometryVertexDeclaration(VertexData *dest)
}
}
void OgreBinarySerializer::ReadGeometryVertexElement(VertexData *dest)
{
void OgreBinarySerializer::ReadGeometryVertexElement(VertexData *dest) {
VertexElement element;
element.source = Read<uint16_t>();
element.type = static_cast<VertexElement::Type>(Read<uint16_t>());
@ -626,8 +542,7 @@ void OgreBinarySerializer::ReadGeometryVertexElement(VertexData *dest)
dest->vertexElements.push_back(element);
}
void OgreBinarySerializer::ReadGeometryVertexBuffer(VertexData *dest)
{
void OgreBinarySerializer::ReadGeometryVertexBuffer(VertexData *dest) {
uint16_t bindIndex = Read<uint16_t>();
uint16_t vertexSize = Read<uint16_t>();
@ -645,20 +560,16 @@ void OgreBinarySerializer::ReadGeometryVertexBuffer(VertexData *dest)
ASSIMP_LOG_DEBUG_F(" - Read vertex buffer for source ", bindIndex, " of ", numBytes, " bytes");
}
void OgreBinarySerializer::ReadEdgeList(Mesh * /*mesh*/)
{
void OgreBinarySerializer::ReadEdgeList(Mesh * /*mesh*/) {
// Assimp does not acknowledge LOD levels as far as I can see it. This info is just skipped.
if (!AtEnd())
{
if (!AtEnd()) {
uint16_t id = ReadHeader();
while (!AtEnd() && id == M_EDGE_LIST_LOD)
{
while (!AtEnd() && id == M_EDGE_LIST_LOD) {
m_reader->IncPtr(sizeof(uint16_t)); // lod index
bool manual = Read<bool>();
if (!manual)
{
if (!manual) {
m_reader->IncPtr(sizeof(uint8_t));
uint32_t numTriangles = Read<uint32_t>();
uint32_t numEdgeGroups = Read<uint32_t>();
@ -666,16 +577,14 @@ void OgreBinarySerializer::ReadEdgeList(Mesh * /*mesh*/)
size_t skipBytes = (sizeof(uint32_t) * 8 + sizeof(float) * 4) * numTriangles;
m_reader->IncPtr(skipBytes);
for (size_t i=0; i<numEdgeGroups; ++i)
{
for (size_t i = 0; i < numEdgeGroups; ++i) {
uint16_t curId = ReadHeader();
if (curId != M_EDGE_GROUP)
throw DeadlyImportError("M_EDGE_GROUP not found in M_EDGE_LIST_LOD");
m_reader->IncPtr(sizeof(uint32_t) * 3);
uint32_t numEdges = Read<uint32_t>();
for (size_t j=0; j<numEdges; ++j)
{
for (size_t j = 0; j < numEdges; ++j) {
m_reader->IncPtr(sizeof(uint32_t) * 6 + sizeof(uint8_t));
}
}
@ -689,13 +598,10 @@ void OgreBinarySerializer::ReadEdgeList(Mesh * /*mesh*/)
}
}
void OgreBinarySerializer::ReadPoses(Mesh *mesh)
{
if (!AtEnd())
{
void OgreBinarySerializer::ReadPoses(Mesh *mesh) {
if (!AtEnd()) {
uint16_t id = ReadHeader();
while (!AtEnd() && id == M_POSE)
{
while (!AtEnd() && id == M_POSE) {
Pose *pose = new Pose();
pose->name = ReadLine();
pose->target = Read<uint16_t>();
@ -713,13 +619,10 @@ void OgreBinarySerializer::ReadPoses(Mesh *mesh)
}
}
void OgreBinarySerializer::ReadPoseVertices(Pose *pose)
{
if (!AtEnd())
{
void OgreBinarySerializer::ReadPoseVertices(Pose *pose) {
if (!AtEnd()) {
uint16_t id = ReadHeader();
while (!AtEnd() && id == M_POSE_VERTEX)
{
while (!AtEnd() && id == M_POSE_VERTEX) {
Pose::Vertex v;
v.index = Read<uint32_t>();
ReadVector(v.offset);
@ -736,13 +639,10 @@ void OgreBinarySerializer::ReadPoseVertices(Pose *pose)
}
}
void OgreBinarySerializer::ReadAnimations(Mesh *mesh)
{
if (!AtEnd())
{
void OgreBinarySerializer::ReadAnimations(Mesh *mesh) {
if (!AtEnd()) {
uint16_t id = ReadHeader();
while (!AtEnd() && id == M_ANIMATION)
{
while (!AtEnd() && id == M_ANIMATION) {
Animation *anim = new Animation(mesh);
anim->name = ReadLine();
anim->length = Read<float>();
@ -759,13 +659,10 @@ void OgreBinarySerializer::ReadAnimations(Mesh *mesh)
}
}
void OgreBinarySerializer::ReadAnimation(Animation *anim)
{
if (!AtEnd())
{
void OgreBinarySerializer::ReadAnimation(Animation *anim) {
if (!AtEnd()) {
uint16_t id = ReadHeader();
if (id == M_ANIMATION_BASEINFO)
{
if (id == M_ANIMATION_BASEINFO) {
anim->baseName = ReadLine();
anim->baseTime = Read<float>();
@ -773,8 +670,7 @@ void OgreBinarySerializer::ReadAnimation(Animation *anim)
id = ReadHeader();
}
while (!AtEnd() && id == M_ANIMATION_TRACK)
{
while (!AtEnd() && id == M_ANIMATION_TRACK) {
VertexAnimationTrack track;
track.type = static_cast<VertexAnimationTrack::Type>(Read<uint16_t>());
track.target = Read<uint16_t>();
@ -791,17 +687,13 @@ void OgreBinarySerializer::ReadAnimation(Animation *anim)
}
}
void OgreBinarySerializer::ReadAnimationKeyFrames(Animation *anim, VertexAnimationTrack *track)
{
if (!AtEnd())
{
void OgreBinarySerializer::ReadAnimationKeyFrames(Animation *anim, VertexAnimationTrack *track) {
if (!AtEnd()) {
uint16_t id = ReadHeader();
while (!AtEnd() &&
(id == M_ANIMATION_MORPH_KEYFRAME ||
id == M_ANIMATION_POSE_KEYFRAME))
{
if (id == M_ANIMATION_MORPH_KEYFRAME)
{
id == M_ANIMATION_POSE_KEYFRAME)) {
if (id == M_ANIMATION_MORPH_KEYFRAME) {
MorphKeyFrame kf;
kf.timePos = Read<float>();
bool hasNormals = Read<bool>();
@ -814,17 +706,13 @@ void OgreBinarySerializer::ReadAnimationKeyFrames(Animation *anim, VertexAnimati
kf.buffer = MemoryStreamPtr(new Assimp::MemoryIOStream(morphBuffer, numBytes, true));
track->morphKeyFrames.push_back(kf);
}
else if (id == M_ANIMATION_POSE_KEYFRAME)
{
} else if (id == M_ANIMATION_POSE_KEYFRAME) {
PoseKeyFrame kf;
kf.timePos = Read<float>();
if (!AtEnd())
{
if (!AtEnd()) {
id = ReadHeader();
while (!AtEnd() && id == M_ANIMATION_POSE_REF)
{
while (!AtEnd() && id == M_ANIMATION_POSE_REF) {
PoseRef pr;
pr.index = Read<uint16_t>();
pr.influence = Read<float>();
@ -850,15 +738,13 @@ void OgreBinarySerializer::ReadAnimationKeyFrames(Animation *anim, VertexAnimati
// Skeleton
bool OgreBinarySerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh)
{
bool OgreBinarySerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh) {
if (!mesh || mesh->skeletonRef.empty())
return false;
// Highly unusual to see in read world cases but support
// binary mesh referencing a XML skeleton file.
if (EndsWith(mesh->skeletonRef, ".skeleton.xml", false))
{
if (EndsWith(mesh->skeletonRef, ".skeleton.xml", false)) {
OgreXmlSerializer::ImportSkeleton(pIOHandler, mesh);
return false;
}
@ -874,8 +760,7 @@ bool OgreBinarySerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *me
return true;
}
bool OgreBinarySerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *mesh)
{
bool OgreBinarySerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *mesh) {
if (!mesh || mesh->skeletonRef.empty())
return false;
@ -890,16 +775,13 @@ bool OgreBinarySerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml
return true;
}
MemoryStreamReaderPtr OgreBinarySerializer::OpenReader(Assimp::IOSystem *pIOHandler, const std::string &filename)
{
if (!EndsWith(filename, ".skeleton", false))
{
MemoryStreamReaderPtr OgreBinarySerializer::OpenReader(Assimp::IOSystem *pIOHandler, const std::string &filename) {
if (!EndsWith(filename, ".skeleton", false)) {
ASSIMP_LOG_ERROR_F("Imported Mesh is referencing to unsupported '", filename, "' skeleton file.");
return MemoryStreamReaderPtr();
}
if (!pIOHandler->Exists(filename))
{
if (!pIOHandler->Exists(filename)) {
ASSIMP_LOG_ERROR_F("Failed to find skeleton file '", filename, "' that is referenced by imported Mesh.");
return MemoryStreamReaderPtr();
}
@ -912,8 +794,7 @@ MemoryStreamReaderPtr OgreBinarySerializer::OpenReader(Assimp::IOSystem *pIOHand
return MemoryStreamReaderPtr(new MemoryStreamReader(f));
}
void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
{
void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton) {
uint16_t id = ReadHeader(false);
if (id != HEADER_CHUNK_ID) {
throw DeadlyExportError("Invalid Ogre Skeleton file header.");
@ -921,8 +802,7 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
// This deserialization supports both versions of the skeleton spec
std::string version = ReadLine();
if (version != SKELETON_VERSION_1_8 && version != SKELETON_VERSION_1_1)
{
if (version != SKELETON_VERSION_1_8 && version != SKELETON_VERSION_1_1) {
throw DeadlyExportError(Formatter::format() << "Skeleton version " << version << " not supported by this importer."
<< " Supported versions: " << SKELETON_VERSION_1_8 << " and " << SKELETON_VERSION_1_1);
}
@ -932,20 +812,15 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
bool firstBone = true;
bool firstAnim = true;
while (!AtEnd())
{
while (!AtEnd()) {
id = ReadHeader();
switch(id)
{
case SKELETON_BLENDMODE:
{
switch (id) {
case SKELETON_BLENDMODE: {
skeleton->blendMode = static_cast<Skeleton::BlendMode>(Read<uint16_t>());
break;
}
case SKELETON_BONE:
{
if (firstBone)
{
case SKELETON_BONE: {
if (firstBone) {
ASSIMP_LOG_DEBUG(" - Bones");
firstBone = false;
}
@ -953,15 +828,12 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
ReadBone(skeleton);
break;
}
case SKELETON_BONE_PARENT:
{
case SKELETON_BONE_PARENT: {
ReadBoneParent(skeleton);
break;
}
case SKELETON_ANIMATION:
{
if (firstAnim)
{
case SKELETON_ANIMATION: {
if (firstAnim) {
ASSIMP_LOG_DEBUG(" - Animations");
firstAnim = false;
}
@ -969,8 +841,7 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
ReadSkeletonAnimation(skeleton);
break;
}
case SKELETON_ANIMATION_LINK:
{
case SKELETON_ANIMATION_LINK: {
ReadSkeletonAnimationLink(skeleton);
break;
}
@ -978,16 +849,14 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
}
// Calculate bone matrices for root bones. Recursively calculates their children.
for (size_t i=0, len=skeleton->bones.size(); i<len; ++i)
{
for (size_t i = 0, len = skeleton->bones.size(); i < len; ++i) {
Bone *bone = skeleton->bones[i];
if (!bone->IsParented())
bone->CalculateWorldMatrixAndDefaultPose(skeleton);
}
}
void OgreBinarySerializer::ReadBone(Skeleton *skeleton)
{
void OgreBinarySerializer::ReadBone(Skeleton *skeleton) {
Bone *bone = new Bone();
bone->name = ReadLine();
bone->id = Read<uint16_t>();
@ -1010,8 +879,7 @@ void OgreBinarySerializer::ReadBone(Skeleton *skeleton)
skeleton->bones.push_back(bone);
}
void OgreBinarySerializer::ReadBoneParent(Skeleton *skeleton)
{
void OgreBinarySerializer::ReadBoneParent(Skeleton *skeleton) {
uint16_t childId = Read<uint16_t>();
uint16_t parentId = Read<uint16_t>();
@ -1024,17 +892,14 @@ void OgreBinarySerializer::ReadBoneParent(Skeleton *skeleton)
throw DeadlyImportError(Formatter::format() << "Failed to find bones for parenting: Child id " << childId << " for parent id " << parentId);
}
void OgreBinarySerializer::ReadSkeletonAnimation(Skeleton *skeleton)
{
void OgreBinarySerializer::ReadSkeletonAnimation(Skeleton *skeleton) {
Animation *anim = new Animation(skeleton);
anim->name = ReadLine();
anim->length = Read<float>();
if (!AtEnd())
{
if (!AtEnd()) {
uint16_t id = ReadHeader();
if (id == SKELETON_ANIMATION_BASEINFO)
{
if (id == SKELETON_ANIMATION_BASEINFO) {
anim->baseName = ReadLine();
anim->baseTime = Read<float>();
@ -1042,8 +907,7 @@ void OgreBinarySerializer::ReadSkeletonAnimation(Skeleton *skeleton)
id = ReadHeader();
}
while (!AtEnd() && id == SKELETON_ANIMATION_TRACK)
{
while (!AtEnd() && id == SKELETON_ANIMATION_TRACK) {
ReadSkeletonAnimationTrack(skeleton, anim);
if (!AtEnd())
@ -1058,8 +922,7 @@ void OgreBinarySerializer::ReadSkeletonAnimation(Skeleton *skeleton)
ASSIMP_LOG_DEBUG_F(" ", anim->name, " (", anim->length, " sec, ", anim->tracks.size(), " tracks)");
}
void OgreBinarySerializer::ReadSkeletonAnimationTrack(Skeleton * /*skeleton*/, Animation *dest)
{
void OgreBinarySerializer::ReadSkeletonAnimationTrack(Skeleton * /*skeleton*/, Animation *dest) {
uint16_t boneId = Read<uint16_t>();
Bone *bone = dest->parentSkeleton->BoneById(boneId);
if (!bone) {
@ -1071,8 +934,7 @@ void OgreBinarySerializer::ReadSkeletonAnimationTrack(Skeleton * /*skeleton*/, A
track.boneName = bone->name;
uint16_t id = ReadHeader();
while (!AtEnd() && id == SKELETON_ANIMATION_TRACK_KEYFRAME)
{
while (!AtEnd() && id == SKELETON_ANIMATION_TRACK_KEYFRAME) {
ReadSkeletonAnimationKeyFrame(&track);
if (!AtEnd())
@ -1084,8 +946,7 @@ void OgreBinarySerializer::ReadSkeletonAnimationTrack(Skeleton * /*skeleton*/, A
dest->tracks.push_back(track);
}
void OgreBinarySerializer::ReadSkeletonAnimationKeyFrame(VertexAnimationTrack *dest)
{
void OgreBinarySerializer::ReadSkeletonAnimationKeyFrame(VertexAnimationTrack *dest) {
TransformKeyFrame keyframe;
keyframe.timePos = Read<float>();
@ -1100,14 +961,13 @@ void OgreBinarySerializer::ReadSkeletonAnimationKeyFrame(VertexAnimationTrack *d
dest->transformKeyFrames.push_back(keyframe);
}
void OgreBinarySerializer::ReadSkeletonAnimationLink(Skeleton * /*skeleton*/)
{
void OgreBinarySerializer::ReadSkeletonAnimationLink(Skeleton * /*skeleton*/) {
// Skip bounds, not compatible with Assimp.
ReadLine(); // skeleton name
SkipBytes(sizeof(float) * 3); // scale
}
} // Ogre
} // Assimp
} // namespace Ogre
} // namespace Assimp
#endif // ASSIMP_BUILD_NO_OGRE_IMPORTER

View File

@ -476,9 +476,10 @@ size_t Q3BSPFileImporter::countData( const std::vector<sQ3BSPFace*> &faceArray )
sQ3BSPFace *pQ3BSPFace = *it;
if ( pQ3BSPFace->iType == Polygon || pQ3BSPFace->iType == TriangleMesh )
{
Q3BSP::sQ3BSPFace *pQ3BSPFace = *it;
ai_assert( nullptr != pQ3BSPFace );
numVerts += pQ3BSPFace->iNumOfFaceVerts;
Q3BSP::sQ3BSPFace *face = *it;
if (nullptr != face) {
numVerts += face->iNumOfFaceVerts;
}
}
}
@ -589,18 +590,18 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *model
IOStream *pTextureStream = archive->Open( textureName.c_str() );
if ( pTextureStream ) {
size_t texSize = pTextureStream->FileSize();
aiTexture *pTexture = new aiTexture;
pTexture->mHeight = 0;
pTexture->mWidth = static_cast<unsigned int>(texSize);
unsigned char *pData = new unsigned char[ pTexture->mWidth ];
size_t readSize = pTextureStream->Read( pData, sizeof( unsigned char ), pTexture->mWidth );
aiTexture *curTexture = new aiTexture;
curTexture->mHeight = 0;
curTexture->mWidth = static_cast<unsigned int>(texSize);
unsigned char *pData = new unsigned char[curTexture->mWidth];
size_t readSize = pTextureStream->Read(pData, sizeof(unsigned char), curTexture->mWidth);
(void)readSize;
ai_assert( readSize == pTexture->mWidth );
pTexture->pcData = reinterpret_cast<aiTexel*>( pData );
pTexture->achFormatHint[ 0 ] = ext[ 1 ];
pTexture->achFormatHint[ 1 ] = ext[ 2 ];
pTexture->achFormatHint[ 2 ] = ext[ 3 ];
pTexture->achFormatHint[ 3 ] = '\0';
ai_assert(readSize == curTexture->mWidth);
curTexture->pcData = reinterpret_cast<aiTexel *>(pData);
curTexture->achFormatHint[0] = ext[1];
curTexture->achFormatHint[1] = ext[2];
curTexture->achFormatHint[2] = ext[3];
curTexture->achFormatHint[3] = '\0';
res = true;
aiString name;
@ -610,7 +611,7 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *model
archive->Close( pTextureStream );
pMatHelper->AddProperty( &name, AI_MATKEY_TEXTURE_DIFFUSE( 0 ) );
mTextures.push_back( pTexture );
mTextures.push_back(curTexture);
} else {
// If it doesn't exist in the archive, it is probably just a reference to an external file.
// We'll leave it up to the user to figure out which extension the file has.

View File

@ -266,8 +266,11 @@ void Q3DImporter::InternReadFile( const std::string& pFile,
Material& mat = materials.back();
// read the material name
while (( c = stream.GetI1()))
c = stream.GetI1();
while (c) {
mat.name.data[mat.name.length++] = c;
c = stream.GetI1();
}
// add the terminal character
mat.name.data[mat.name.length] = '\0';
@ -554,20 +557,20 @@ outer:
}
// copy texture coordinates
if (uv && m.uv.size())
if (uv && curMesh.uv.size())
{
if (m.prevUVIdx != 0xffffffff && m.uv.size() >= m.verts.size()) // workaround
if (curMesh.prevUVIdx != 0xffffffff && curMesh.uv.size() >= curMesh.verts.size()) // workaround
{
*uv = m.uv[face.indices[n]];
*uv = curMesh.uv[face.indices[n]];
}
else
{
if (face.uvindices[n] >= m.uv.size())
if (face.uvindices[n] >= curMesh.uv.size())
{
ASSIMP_LOG_WARN("Quick3D: Texture coordinate index overflow");
face.uvindices[n] = 0;
}
*uv = m.uv[face.uvindices[n]];
*uv = curMesh.uv[face.uvindices[n]];
}
uv->y = 1.f - uv->y;
++uv;

View File

@ -89,7 +89,7 @@ SMDImporter::SMDImporter()
, iSmallestFrame( INT_MAX )
, dLengthOfAnim( 0.0 )
, bHasUVs(false )
, iLineNumber(-1) {
, iLineNumber((unsigned int)-1) {
// empty
}
@ -129,8 +129,8 @@ void SMDImporter::SetupProperties(const Importer* pImp) {
// ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure.
void SMDImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) {
this->pScene = pScene;
void SMDImporter::InternReadFile( const std::string& pFile, aiScene* scene, IOSystem* pIOHandler) {
this->pScene = scene;
ReadSmd(pFile, pIOHandler);
// If there are no triangles it seems to be an animation SMD,
@ -190,19 +190,19 @@ void SMDImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
// ------------------------------------------------------------------------------------------------
// Write an error message with line number to the log file
void SMDImporter::LogErrorNoThrow(const char* msg) {
const size_t BufferSize = 1024;
char szTemp[BufferSize];
ai_snprintf(szTemp,BufferSize,"Line %u: %s",iLineNumber,msg);
const size_t _BufferSize = 1024;
char szTemp[_BufferSize];
ai_snprintf(szTemp,_BufferSize,"Line %u: %s",iLineNumber,msg);
DefaultLogger::get()->error(szTemp);
}
// ------------------------------------------------------------------------------------------------
// Write a warning with line number to the log file
void SMDImporter::LogWarning(const char* msg) {
const size_t BufferSize = 1024;
char szTemp[BufferSize];
const size_t _BufferSize = 1024;
char szTemp[_BufferSize];
ai_assert(strlen(msg) < 1000);
ai_snprintf(szTemp,BufferSize,"Line %u: %s",iLineNumber,msg);
ai_snprintf(szTemp,_BufferSize,"Line %u: %s",iLineNumber,msg);
ASSIMP_LOG_WARN(szTemp);
}

View File

@ -43,18 +43,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file Implementation of the STL importer class */
#ifndef ASSIMP_BUILD_NO_STL_IMPORTER
// internal headers
#include "STLLoader.h"
#include <assimp/ParsingUtils.h>
#include <assimp/fast_atof.h>
#include <memory>
#include <assimp/IOSystem.hpp>
#include <assimp/importerdesc.h>
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/importerdesc.h>
#include <assimp/IOSystem.hpp>
#include <memory>
using namespace Assimp;
@ -127,21 +126,22 @@ static bool IsAsciiSTL(const char* buffer, unsigned int fileSize) {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
STLImporter::STLImporter()
: mBuffer(),
fileSize(),
pScene()
{}
STLImporter::STLImporter() :
mBuffer(),
mFileSize(0),
mScene() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
STLImporter::~STLImporter()
{}
STLImporter::~STLImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
bool STLImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{
bool STLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const {
const std::string extension = GetExtension(pFile);
if (extension == "stl") {
@ -162,8 +162,7 @@ const aiImporterDesc* STLImporter::GetInfo () const {
return &desc;
}
void addFacesToMesh(aiMesh* pMesh)
{
void addFacesToMesh(aiMesh *pMesh) {
pMesh->mFaces = new aiFace[pMesh->mNumFaces];
for (unsigned int i = 0, p = 0; i < pMesh->mNumFaces; ++i) {
@ -177,8 +176,7 @@ void addFacesToMesh(aiMesh* pMesh)
// ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure.
void STLImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler )
{
void STLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
// Check whether we can read from the file
@ -186,28 +184,28 @@ void STLImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
throw DeadlyImportError("Failed to open STL file " + pFile + ".");
}
fileSize = (unsigned int)file->FileSize();
mFileSize = (unsigned int)file->FileSize();
// allocate storage and copy the contents of the file to a memory buffer
// (terminate it with zero)
std::vector<char> buffer2;
TextFileToBuffer(file.get(), buffer2);
this->pScene = pScene;
this->mBuffer = &buffer2[0];
mScene = pScene;
mBuffer = &buffer2[0];
// the default vertex color is light gray.
clrColorDefault.r = clrColorDefault.g = clrColorDefault.b = clrColorDefault.a = (ai_real) 0.6;
mClrColorDefault.r = mClrColorDefault.g = mClrColorDefault.b = mClrColorDefault.a = (ai_real)0.6;
// allocate a single node
pScene->mRootNode = new aiNode();
mScene->mRootNode = new aiNode();
bool bMatClr = false;
if (IsBinarySTL(mBuffer, fileSize)) {
if (IsBinarySTL(mBuffer, mFileSize)) {
bMatClr = LoadBinaryFile();
} else if (IsAsciiSTL(mBuffer, fileSize)) {
LoadASCIIFile( pScene->mRootNode );
} else if (IsAsciiSTL(mBuffer, mFileSize)) {
LoadASCIIFile(mScene->mRootNode);
} else {
throw DeadlyImportError("Failed to determine STL storage representation for " + pFile + ".");
}
@ -221,16 +219,16 @@ void STLImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
aiColor4D clrDiffuse(ai_real(1.0), ai_real(1.0), ai_real(1.0), ai_real(1.0));
if (bMatClr) {
clrDiffuse = clrColorDefault;
clrDiffuse = mClrColorDefault;
}
pcMat->AddProperty(&clrDiffuse, 1, AI_MATKEY_COLOR_DIFFUSE);
pcMat->AddProperty(&clrDiffuse, 1, AI_MATKEY_COLOR_SPECULAR);
clrDiffuse = aiColor4D(ai_real(0.05), ai_real(0.05), ai_real(0.05), ai_real(1.0));
pcMat->AddProperty(&clrDiffuse, 1, AI_MATKEY_COLOR_AMBIENT);
pScene->mNumMaterials = 1;
pScene->mMaterials = new aiMaterial*[1];
pScene->mMaterials[0] = pcMat;
mScene->mNumMaterials = 1;
mScene->mMaterials = new aiMaterial *[1];
mScene->mMaterials[0] = pcMat;
mBuffer = nullptr;
}
@ -241,13 +239,13 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
std::vector<aiMesh *> meshes;
std::vector<aiNode *> nodes;
const char *sz = mBuffer;
const char* bufferEnd = mBuffer + fileSize;
const char *bufferEnd = mBuffer + mFileSize;
std::vector<aiVector3D> positionBuffer;
std::vector<aiVector3D> normalBuffer;
// try to guess how many vertices we could have
// assume we'll need 160 bytes for each face
size_t sizeEstimate = std::max(1u, fileSize / 160u ) * 3;
size_t sizeEstimate = std::max(1u, mFileSize / 160u) * 3;
positionBuffer.reserve(sizeEstimate);
normalBuffer.reserve(sizeEstimate);
@ -270,27 +268,23 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
sz++;
}
size_t temp;
size_t temp = (size_t)(sz - szMe);
// setup the name of the node
if ((temp = (size_t)(sz-szMe))) {
if ( temp ) {
if (temp >= MAXLEN) {
throw DeadlyImportError("STL: Node name too long");
}
std::string name(szMe, temp);
node->mName.Set(name.c_str());
pMesh->mName.Set(name.c_str());
//pScene->mRootNode->mName.length = temp;
//memcpy(pScene->mRootNode->mName.data,szMe,temp);
//pScene->mRootNode->mName.data[temp] = '\0';
} else {
pScene->mRootNode->mName.Set("<STL_ASCII>");
mScene->mRootNode->mName.Set("<STL_ASCII>");
}
unsigned int faceVertexCounter = 3;
for (;;) {
// go to the next token
if(!SkipSpacesAndLineEnd(&sz))
{
if (!SkipSpacesAndLineEnd(&sz)) {
// seems we're finished although there was no end marker
ASSIMP_LOG_WARN("STL: unexpected EOF. \'endsolid\' keyword was expected");
break;
@ -394,10 +388,10 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
}
// now add the loaded meshes
pScene->mNumMeshes = (unsigned int)meshes.size();
pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
mScene->mNumMeshes = (unsigned int)meshes.size();
mScene->mMeshes = new aiMesh *[mScene->mNumMeshes];
for (size_t i = 0; i < meshes.size(); i++) {
pScene->mMeshes[ i ] = meshes[i];
mScene->mMeshes[i] = meshes[i];
}
root->mNumChildren = (unsigned int)nodes.size();
@ -409,16 +403,15 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
// ------------------------------------------------------------------------------------------------
// Read a binary STL file
bool STLImporter::LoadBinaryFile()
{
bool STLImporter::LoadBinaryFile() {
// allocate one mesh
pScene->mNumMeshes = 1;
pScene->mMeshes = new aiMesh*[1];
aiMesh* pMesh = pScene->mMeshes[0] = new aiMesh();
mScene->mNumMeshes = 1;
mScene->mMeshes = new aiMesh *[1];
aiMesh *pMesh = mScene->mMeshes[0] = new aiMesh();
pMesh->mMaterialIndex = 0;
// skip the first 80 bytes
if (fileSize < 84) {
if (mFileSize < 84) {
throw DeadlyImportError("STL: file is too small for the header");
}
bool bIsMaterialise = false;
@ -435,22 +428,22 @@ bool STLImporter::LoadBinaryFile()
bIsMaterialise = true;
ASSIMP_LOG_INFO("STL: Taking code path for Materialise files");
const ai_real invByte = (ai_real)1.0 / (ai_real)255.0;
clrColorDefault.r = (*sz2++) * invByte;
clrColorDefault.g = (*sz2++) * invByte;
clrColorDefault.b = (*sz2++) * invByte;
clrColorDefault.a = (*sz2++) * invByte;
mClrColorDefault.r = (*sz2++) * invByte;
mClrColorDefault.g = (*sz2++) * invByte;
mClrColorDefault.b = (*sz2++) * invByte;
mClrColorDefault.a = (*sz2++) * invByte;
break;
}
}
const unsigned char *sz = (const unsigned char *)mBuffer + 80;
// now read the number of facets
pScene->mRootNode->mName.Set("<STL_BINARY>");
mScene->mRootNode->mName.Set("<STL_BINARY>");
pMesh->mNumFaces = *((uint32_t *)sz);
sz += 4;
if (fileSize < 84 + pMesh->mNumFaces*50) {
if (mFileSize < 84 + pMesh->mNumFaces * 50) {
throw DeadlyImportError("STL: file is too small to hold all facets");
}
@ -460,7 +453,6 @@ bool STLImporter::LoadBinaryFile()
pMesh->mNumVertices = pMesh->mNumFaces * 3;
aiVector3D *vp = pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
aiVector3D *vn = pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
@ -476,7 +468,9 @@ bool STLImporter::LoadBinaryFile()
// for vertex normals
theVec = (aiVector3F *)sz;
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
vn->x = theVec3F.x; vn->y = theVec3F.y; vn->z = theVec3F.z;
vn->x = theVec3F.x;
vn->y = theVec3F.y;
vn->z = theVec3F.z;
*(vn + 1) = *vn;
*(vn + 2) = *vn;
++theVec;
@ -484,19 +478,25 @@ bool STLImporter::LoadBinaryFile()
// vertex 1
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
vp->x = theVec3F.x; vp->y = theVec3F.y; vp->z = theVec3F.z;
vp->x = theVec3F.x;
vp->y = theVec3F.y;
vp->z = theVec3F.z;
++theVec;
++vp;
// vertex 2
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
vp->x = theVec3F.x; vp->y = theVec3F.y; vp->z = theVec3F.z;
vp->x = theVec3F.x;
vp->y = theVec3F.y;
vp->z = theVec3F.z;
++theVec;
++vp;
// vertex 3
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
vp->x = theVec3F.x; vp->y = theVec3F.y; vp->z = theVec3F.z;
vp->x = theVec3F.x;
vp->y = theVec3F.y;
vp->z = theVec3F.z;
++theVec;
++vp;
@ -505,14 +505,13 @@ bool STLImporter::LoadBinaryFile()
uint16_t color = *((uint16_t *)sz);
sz += 2;
if (color & (1 << 15))
{
if (color & (1 << 15)) {
// seems we need to take the color
if (!pMesh->mColors[0])
{
if (!pMesh->mColors[0]) {
pMesh->mColors[0] = new aiColor4D[pMesh->mNumVertices];
for (unsigned int i = 0; i <pMesh->mNumVertices;++i)
*pMesh->mColors[0]++ = this->clrColorDefault;
for (unsigned int j = 0; j < pMesh->mNumVertices; ++j) {
*pMesh->mColors[0]++ = mClrColorDefault;
}
pMesh->mColors[0] -= pMesh->mNumVertices;
ASSIMP_LOG_INFO("STL: Mesh has vertex colors");
@ -525,9 +524,7 @@ bool STLImporter::LoadBinaryFile()
clr->r = (color & 0x31u) * invVal;
clr->g = ((color & (0x31u << 5)) >> 5u) * invVal;
clr->b = ((color & (0x31u << 10)) >> 10u) * invVal;
}
else
{
} else {
clr->b = (color & 0x31u) * invVal;
clr->g = ((color & (0x31u << 5)) >> 5u) * invVal;
clr->r = ((color & (0x31u << 10)) >> 10u) * invVal;
@ -541,7 +538,7 @@ bool STLImporter::LoadBinaryFile()
// now copy faces
addFacesToMesh(pMesh);
aiNode* root = pScene->mRootNode;
aiNode *root = mScene->mRootNode;
// allocate one node
aiNode *node = new aiNode();
@ -552,13 +549,13 @@ bool STLImporter::LoadBinaryFile()
root->mChildren[0] = node;
// add all created meshes to the single node
node->mNumMeshes = pScene->mNumMeshes;
node->mMeshes = new unsigned int[pScene->mNumMeshes];
for (unsigned int i = 0; i < pScene->mNumMeshes; i++)
node->mNumMeshes = mScene->mNumMeshes;
node->mMeshes = new unsigned int[mScene->mNumMeshes];
for (unsigned int i = 0; i < mScene->mNumMeshes; ++i) {
node->mMeshes[i] = i;
}
if (bIsMaterialise && !pMesh->mColors[0])
{
if (bIsMaterialise && !pMesh->mColors[0]) {
// use the color as diffuse material color
return true;
}

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -111,13 +110,13 @@ protected:
const char* mBuffer;
/** Size of the file, in bytes */
unsigned int fileSize;
unsigned int mFileSize;
/** Output scene */
aiScene* pScene;
aiScene* mScene;
/** Default vertex color */
aiColor4D clrColorDefault;
aiColor4D mClrColorDefault;
};
} // end of namespace Assimp

View File

@ -725,6 +725,8 @@ struct InternGenericConvert<Maybe<T>> {
}
};
#pragma warning( push )
#pragma warning( disable : 4127)
template <typename T, uint64_t min_cnt, uint64_t max_cnt>
struct InternGenericConvertList {
void operator()(ListOf<T, min_cnt, max_cnt> &out, const std::shared_ptr<const EXPRESS::DataType> &inp_base, const STEP::DB &db) {
@ -735,9 +737,10 @@ struct InternGenericConvertList {
}
// XXX is this really how the EXPRESS notation ([?:3],[1:3]) is intended?
if (max_cnt && inp->GetSize() > max_cnt) {
const size_t len = inp->GetSize();
if (0 != max_cnt && len > max_cnt) {
ASSIMP_LOG_WARN("too many aggregate elements");
} else if (inp->GetSize() < min_cnt) {
} else if (len < min_cnt) {
ASSIMP_LOG_WARN("too few aggregate elements");
}
@ -754,6 +757,8 @@ struct InternGenericConvertList {
}
};
#pragma warning( pop )
template <typename T>
struct InternGenericConvert<Lazy<T>> {
void operator()(Lazy<T> &out, const std::shared_ptr<const EXPRESS::DataType> &in_base, const STEP::DB &db) {

View File

@ -258,10 +258,11 @@ void TerragenImporter::InternReadFile( const std::string& pFile,
}
// Get to the next chunk (4 byte aligned)
unsigned dtt;
if ((dtt = reader.GetCurrentPos() & 0x3))
unsigned dtt = reader.GetCurrentPos();
if (dtt & 0x3) {
reader.IncPtr(4 - dtt);
}
}
// Check whether we have a mesh now
if (pScene->mNumMeshes != 1)

View File

@ -211,11 +211,12 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
// read number of frames
const uint32_t numFrames = a_reader.GetI2();
if (configFrameID >= numFrames)
if (configFrameID >= numFrames) {
throw DeadlyImportError("UNREAL: The requested frame does not exist");
}
uint32_t st = a_reader.GetI2();
if (st != numVert*4)
if (st != numVert*4u)
throw DeadlyImportError("UNREAL: Unexpected aniv file length");
// skip to our frame

View File

@ -592,9 +592,9 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, std::vector<XFile::Materi
XFile::Material& oldMat = pMaterials[a];
if( oldMat.mIsReference) {
// find the material it refers to by name, and store its index
for( size_t a = 0; a < pScene->mNumMaterials; ++a ) {
for( size_t b = 0; b < pScene->mNumMaterials; ++b ) {
aiString name;
pScene->mMaterials[a]->Get( AI_MATKEY_NAME, name);
pScene->mMaterials[b]->Get( AI_MATKEY_NAME, name);
if( strcmp( name.C_Str(), oldMat.mName.data()) == 0 ) {
oldMat.sceneIndex = a;
break;
@ -668,7 +668,7 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, std::vector<XFile::Materi
// convert to lower case for easier comparison
for ( unsigned int c = 0; c < sz.length(); ++c ) {
if ( isalpha( sz[ c ] ) ) {
sz[ c ] = tolower( sz[ c ] );
sz[ c ] = (char) tolower( sz[ c ] );
}
}

View File

@ -774,8 +774,8 @@ public:
decoderMap[algorithmUri] = std::move(decoder);
}
virtual void registerVocabulary(const std::string &vocabularyUri, const FIVocabulary *vocabulary) /*override*/ {
vocabularyMap[vocabularyUri] = vocabulary;
virtual void registerVocabulary(const std::string &vocabularyUri, const FIVocabulary *_vocabulary) /*override*/ {
vocabularyMap[vocabularyUri] = _vocabulary;
}
private:
@ -1055,11 +1055,10 @@ private:
bitsAvail += 8;
while (bitsAvail >= bitsPerCharacter) {
bitsAvail -= bitsPerCharacter;
size_t charIndex = (bits >> bitsAvail) & mask;
const size_t charIndex = (bits >> bitsAvail) & mask;
if (charIndex < alphabetLength) {
s.push_back(alphabetUTF32[charIndex]);
}
else if (charIndex != mask) {
s += (char) alphabetUTF32[charIndex];
} else if (charIndex != mask) {
throw DeadlyImportError(parseErrorMessage);
}
}

View File

@ -183,7 +183,7 @@ namespace glTF
return 1;
default:
std::string err = "GLTF: Unsupported Component Type ";
err += t;
err += std::to_string( t );
throw DeadlyImportError(err);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -44,6 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rapidjson/writer.h>
#include <rapidjson/prettywriter.h>
#pragma warning(push)
#pragma warning( disable : 4706)
namespace glTF {
using rapidjson::StringBuffer;
@ -699,6 +701,6 @@ namespace glTF {
w.WriteObjects(d);
}
#pragma warning(pop)
}

View File

@ -347,20 +347,19 @@ void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& pr
prop.texture->source = mAsset->images.Create(imgId);
if (path[0] == '*') { // embedded
aiTexture* tex = mScene->mTextures[atoi(&path[1])];
aiTexture* curTex = mScene->mTextures[atoi(&path[1])];
prop.texture->source->name = tex->mFilename.C_Str();
prop.texture->source->name = curTex->mFilename.C_Str();
uint8_t* data = reinterpret_cast<uint8_t*>(tex->pcData);
prop.texture->source->SetData(data, tex->mWidth, *mAsset);
uint8_t *data = reinterpret_cast<uint8_t *>(curTex->pcData);
prop.texture->source->SetData(data, curTex->mWidth, *mAsset);
if (tex->achFormatHint[0]) {
if (curTex->achFormatHint[0]) {
std::string mimeType = "image/";
mimeType += (memcmp(tex->achFormatHint, "jpg", 3) == 0) ? "jpeg" : tex->achFormatHint;
mimeType += (memcmp(curTex->achFormatHint, "jpg", 3) == 0) ? "jpeg" : curTex->achFormatHint;
prop.texture->source->mimeType = mimeType;
}
}
else {
} else {
prop.texture->source->uri = path;
}
@ -993,7 +992,7 @@ void glTFExporter::ExportAnimations()
for (unsigned int j = 0; j < 3; ++j) {
std::string channelType;
int channelSize;
int channelSize=0;
switch (j) {
case 0:
channelType = "rotation";

File diff suppressed because it is too large Load Diff

View File

@ -675,7 +675,7 @@ namespace glTF2 {
uint32_t binaryChunkLength = 0;
if (bodyBuffer->byteLength > 0) {
binaryChunkLength = (bodyBuffer->byteLength + 3) & ~3; // Round up to next multiple of 4
auto paddingLength = binaryChunkLength - bodyBuffer->byteLength;
//auto curPaddingLength = binaryChunkLength - bodyBuffer->byteLength;
GLB_Chunk binaryChunk;
binaryChunk.chunkLength = binaryChunkLength;
@ -753,19 +753,20 @@ namespace glTF2 {
if (d.mExtId) {
Value* exts = FindObject(mDoc, "extensions");
if (!exts) {
if (nullptr != exts) {
mDoc.AddMember("extensions", Value().SetObject().Move(), mDoc.GetAllocator());
exts = FindObject(mDoc, "extensions");
}
if (!(container = FindObject(*exts, d.mExtId))) {
container = FindObject(*exts, d.mExtId);
if (nullptr != container) {
exts->AddMember(StringRef(d.mExtId), Value().SetObject().Move(), mDoc.GetAllocator());
container = FindObject(*exts, d.mExtId);
}
}
Value* dict;
if (!(dict = FindArray(*container, d.mDictId))) {
Value *dict = FindArray(*container, d.mDictId);
if (nullptr != dict) {
container->AddMember(StringRef(d.mDictId), Value().SetArray().Move(), mDoc.GetAllocator());
dict = FindArray(*container, d.mDictId);
if (nullptr == dict) {
@ -774,7 +775,9 @@ namespace glTF2 {
}
for (size_t i = 0; i < d.mObjs.size(); ++i) {
if (d.mObjs[i]->IsSpecial()) continue;
if (d.mObjs[i]->IsSpecial()) {
continue;
}
Value obj;
obj.SetObject();

View File

@ -347,16 +347,16 @@ void glTF2Exporter::GetMatTex(const aiMaterial* mat, Ref<Texture>& texture, aiTe
texture->source = mAsset->images.Create(imgId);
if (path[0] == '*') { // embedded
aiTexture* tex = mScene->mTextures[atoi(&path[1])];
aiTexture* curTex = mScene->mTextures[atoi(&path[1])];
texture->source->name = tex->mFilename.C_Str();
texture->source->name = curTex->mFilename.C_Str();
// The asset has its own buffer, see Image::SetData
texture->source->SetData(reinterpret_cast<uint8_t*> (tex->pcData), tex->mWidth, *mAsset);
texture->source->SetData(reinterpret_cast<uint8_t *>(curTex->pcData), curTex->mWidth, *mAsset);
if (tex->achFormatHint[0]) {
if (curTex->achFormatHint[0]) {
std::string mimeType = "image/";
mimeType += (memcmp(tex->achFormatHint, "jpg", 3) == 0) ? "jpeg" : tex->achFormatHint;
mimeType += (memcmp(curTex->achFormatHint, "jpg", 3) == 0) ? "jpeg" : curTex->achFormatHint;
texture->source->mimeType = mimeType;
}
}
@ -890,14 +890,14 @@ void glTF2Exporter::MergeMeshes()
//find the presence of the removed mesh in other nodes
for (unsigned int nn = 0; nn < mAsset->nodes.Size(); ++nn) {
Ref<Node> node = mAsset->nodes.Get(nn);
Ref<Node> curNode = mAsset->nodes.Get(nn);
for (unsigned int mm = 0; mm < node->meshes.size(); ++mm) {
Ref<Mesh>& meshRef = node->meshes.at(mm);
for (unsigned int mm = 0; mm < curNode->meshes.size(); ++mm) {
Ref<Mesh> &meshRef = curNode->meshes.at(mm);
unsigned int meshIndex = meshRef.GetIndex();
if (meshIndex == removedIndex) {
node->meshes.erase(node->meshes.begin() + mm);
node->meshes.erase(curNode->meshes.begin() + mm);
} else if (meshIndex > removedIndex) {
Ref<Mesh> newMeshRef = mAsset->meshes.Get(meshIndex - 1);

View File

@ -984,7 +984,7 @@ struct AnimationSamplers {
Animation::Sampler *weight;
};
aiNodeAnim *CreateNodeAnim(glTF2::Asset &r, Node &node, AnimationSamplers &samplers) {
aiNodeAnim *CreateNodeAnim(glTF2::Asset&, Node &node, AnimationSamplers &samplers) {
aiNodeAnim *anim = new aiNodeAnim();
anim->mNodeName = GetNodeName(node);
@ -1063,7 +1063,7 @@ aiNodeAnim *CreateNodeAnim(glTF2::Asset &r, Node &node, AnimationSamplers &sampl
return anim;
}
aiMeshMorphAnim *CreateMeshMorphAnim(glTF2::Asset &r, Node &node, AnimationSamplers &samplers) {
aiMeshMorphAnim *CreateMeshMorphAnim(glTF2::Asset&, Node &node, AnimationSamplers &samplers) {
aiMeshMorphAnim *anim = new aiMeshMorphAnim();
anim->mName = GetNodeName(node);

View File

@ -27,6 +27,9 @@ THE SOFTWARE.
#include "o3dgcArithmeticCodec.h"
#include "o3dgcTimer.h"
#pragma warning(push)
#pragma warning( disable : 4456)
//#define DEBUG_VERBOSE
namespace o3dgc
@ -836,15 +839,16 @@ namespace o3dgc
}
for(unsigned long v = 0; v < numFloatArray; ++v)
{
for(unsigned long d = 0; d < dimFloatArray; ++d)
{
// floatArray[v * stride + d] = m_quantFloatArray[v * stride + d];
for(unsigned long d = 0; d < dimFloatArray; ++d) {
floatArray[v * stride + d] = m_quantFloatArray[v * stride + d] * idelta[d] + minFloatArray[d];
}
}
return O3DGC_OK;
}
}
} // namespace o3dgc
#pragma warning( pop )
#endif // O3DGC_SC3DMC_DECODER_INL

View File

@ -24,7 +24,6 @@ THE SOFTWARE.
#ifndef O3DGC_SC3DMC_ENCODER_INL
#define O3DGC_SC3DMC_ENCODER_INL
#include "o3dgcArithmeticCodec.h"
#include "o3dgcTimer.h"
#include "o3dgcVector.h"
@ -33,6 +32,9 @@ THE SOFTWARE.
//#define DEBUG_VERBOSE
#pragma warning(push)
#pragma warning(disable : 4456)
namespace o3dgc
{
#ifdef DEBUG_VERBOSE
@ -247,8 +249,8 @@ namespace o3dgc
if (predMode == O3DGC_SC3DMC_SURF_NORMALS_PREDICTION)
{
const Real minFloatArray[2] = {(Real)(-2.0),(Real)(-2.0)};
const Real maxFloatArray[2] = {(Real)(2.0),(Real)(2.0)};
const Real curMinFloatArray[2] = {(Real)(-2.0),(Real)(-2.0)};
const Real curMaxFloatArray[2] = {(Real)(2.0),(Real)(2.0)};
if (m_streamType == O3DGC_STREAM_TYPE_ASCII)
{
for(unsigned long i = 0; i < numFloatArray; ++i)
@ -264,7 +266,7 @@ namespace o3dgc
ace.encode(IntToUInt(m_predictors[i]), dModel);
}
}
QuantizeFloatArray(floatArray, numFloatArray, dimFloatArray, stride, minFloatArray, maxFloatArray, nQBits+1);
QuantizeFloatArray(floatArray, numFloatArray, dimFloatArray, stride, curMinFloatArray, curMaxFloatArray, nQBits + 1);
}
else
{
@ -921,7 +923,10 @@ namespace o3dgc
#endif //DEBUG_VERBOSE
return O3DGC_OK;
}
}
} // namespace o3dgc
#pragma warning(pop)
#endif // O3DGC_SC3DMC_ENCODER_INL

View File

@ -353,9 +353,9 @@ namespace o3dgc
m_ctfans.PushTriangleIndex(pred);
prev = m_tmap[t] + 1;
}
for (long t = 0; t < numTriangles; ++t)
for (long tt = 0; tt < numTriangles; ++tt)
{
m_invTMap[m_tmap[t]] = t;
m_invTMap[m_tmap[tt]] = tt;
}
}
m_ctfans.Save(bstream, encodeTrianglesOrder, m_streamType);

View File

@ -36,6 +36,8 @@
namespace p2t {
#pragma warning(push)
#pragma warning( disable : 4702 )
// Triangulate simple polygon with holes
void Sweep::Triangulate(SweepContext& tcx)
{
@ -52,8 +54,8 @@ void Sweep::SweepPoints(SweepContext& tcx)
for (size_t i = 1; i < tcx.point_count(); i++) {
Point& point = *tcx.GetPoint(i);
Node* node = &PointEvent(tcx, point);
for (unsigned int i = 0; i < point.edge_list.size(); i++) {
EdgeEvent(tcx, point.edge_list[i], node);
for (unsigned int ii = 0; ii < point.edge_list.size(); ii++) {
EdgeEvent(tcx, point.edge_list[ii], node);
}
}
}
@ -795,5 +797,6 @@ Sweep::~Sweep() {
}
}
#pragma warning( pop )
}

View File

@ -32,13 +32,14 @@
/***********************************************************************
* Return the next byte in the pseudo-random sequence
*/
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* t)
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
(void)t;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}

View File

@ -13,6 +13,9 @@
#include "zlib.h"
#include "ioapi.h"
#pragma warning(push)
#pragma warning(disable : 4131 4100)
/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
@ -175,3 +178,5 @@ void fill_fopen_filefunc (pzlib_filefunc_def)
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}
#pragma warning(pop)

View File

@ -89,6 +89,8 @@ typedef unsigned long z_crc_t;
#define SIZEZIPLOCALHEADER (0x1e)
#pragma warning(push)
#pragma warning(disable : 4131 4244 4189 4245)
const char unz_copyright[] =
@ -1613,3 +1615,5 @@ extern int ZEXPORT unzSetOffset (file, pos)
s->current_file_ok = (err == UNZ_OK);
return err;
}
#pragma warning(pop)

View File

@ -6085,7 +6085,7 @@ mz_zip_writer_compute_padding_needed_for_file_alignment(mz_zip_archive *pZip) {
if (!pZip->m_file_offset_alignment)
return 0;
n = (mz_uint32)(pZip->m_archive_size & (pZip->m_file_offset_alignment - 1));
return (pZip->m_file_offset_alignment - n) &
return (mz_uint)(pZip->m_file_offset_alignment - n) &
(pZip->m_file_offset_alignment - 1);
}

View File

@ -18,6 +18,9 @@
/* Win32, DOS, MSVC, MSVS */
#include <direct.h>
#pragma warning(push)
#pragma warning(disable : 4706)
#define MKDIR(DIRNAME) _mkdir(DIRNAME)
#define STRCLONE(STR) ((STR) ? _strdup(STR) : NULL)
#define HAS_DEVICE(P) \
@ -684,7 +687,7 @@ ssize_t zip_entry_noallocread(struct zip_t *zip, void *buf, size_t bufsize) {
int zip_entry_fread(struct zip_t *zip, const char *filename) {
mz_zip_archive *pzip = NULL;
mz_uint idx;
mz_uint32 xattr = 0;
//mz_uint32 xattr = 0;
mz_zip_archive_file_stat info;
if (!zip) {
@ -826,7 +829,7 @@ int zip_extract(const char *zipname, const char *dir,
mz_zip_archive zip_archive;
mz_zip_archive_file_stat info;
size_t dirlen = 0;
mz_uint32 xattr = 0;
//mz_uint32 xattr = 0;
memset(path, 0, sizeof(path));
memset(symlink_to, 0, sizeof(symlink_to));
@ -942,3 +945,5 @@ out:
return status;
}
#pragma warning(pop)

View File

@ -139,7 +139,7 @@ std::string DecimalToHexa( T toConvert ) {
ss >> result;
for ( size_t i = 0; i < result.size(); ++i ) {
result[ i ] = toupper( result[ i ] );
result[ i ] = (char) toupper( result[ i ] );
}
return result;