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,40 +48,40 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_FBX_EXPORTER
namespace Assimp {
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'
}; // who knows why, it looks like two integers 32/64 bit (compressed and uncompressed sizes?) + 1 byte (might be compression type?)
const std::string SEPARATOR = {'\x00', '\x01'}; // for use inside strings
const std::string MAGIC_NODE_TAG = "_$AssimpFbx$"; // from import
const int64_t SECOND = 46186158000; // FBX's kTime unit
namespace FBX {
// rotation order. We'll probably use EulerXYZ for everything
enum RotOrder {
RotOrder_EulerXYZ = 0,
RotOrder_EulerXZY,
RotOrder_EulerYZX,
RotOrder_EulerYXZ,
RotOrder_EulerZXY,
RotOrder_EulerZYX,
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'
}; // who knows why, it looks like two integers 32/64 bit (compressed and uncompressed sizes?) + 1 byte (might be compression type?)
const std::string SEPARATOR = { '\x00', '\x01' }; // for use inside strings
const std::string MAGIC_NODE_TAG = "_$AssimpFbx$"; // from import
const int64_t SECOND = 46186158000; // FBX's kTime unit
RotOrder_SphericXYZ,
// rotation order. We'll probably use EulerXYZ for everything
enum RotOrder {
RotOrder_EulerXYZ = 0,
RotOrder_EulerXZY,
RotOrder_EulerYZX,
RotOrder_EulerYXZ,
RotOrder_EulerZXY,
RotOrder_EulerZYX,
RotOrder_MAX // end-of-enum sentinel
};
RotOrder_SphericXYZ,
// transformation inheritance method. Most of the time RSrs
enum TransformInheritance {
TransformInheritance_RrSs = 0,
TransformInheritance_RSrs,
TransformInheritance_Rrs,
RotOrder_MAX // end-of-enum sentinel
};
TransformInheritance_MAX // end-of-enum sentinel
};
}
}
// transformation inheritance method. Most of the time RSrs
enum TransformInheritance {
TransformInheritance_RrSs = 0,
TransformInheritance_RSrs,
TransformInheritance_Rrs,
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,87 +58,81 @@ 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")
{
const Scope& sc = GetRequiredScope(element);
const Element* const Shading = sc["Shading"];
const Element* const Culling = sc["Culling"];
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"];
if(Shading) {
shading = GetRequiredToken(*Shading,0).StringContents();
if (Shading) {
shading = GetRequiredToken(*Shading, 0).StringContents();
}
if (Culling) {
culling = ParseTokenAsString(GetRequiredToken(*Culling,0));
culling = ParseTokenAsString(GetRequiredToken(*Culling, 0));
}
props = GetPropertyTable(doc,"Model.FbxNode",element,sc);
ResolveLinks(element,doc);
props = GetPropertyTable(doc, "Model.FbxNode", element, sc);
ResolveLinks(element, doc);
}
// ------------------------------------------------------------------------------------------------
Model::~Model()
{
Model::~Model() {
}
// ------------------------------------------------------------------------------------------------
void Model::ResolveLinks(const Element& element, const Document& doc)
{
const char* const arr[] = {"Geometry","Material","NodeAttribute"};
void Model::ResolveLinks(const Element&, const Document &doc) {
const char *const arr[] = { "Geometry", "Material", "NodeAttribute" };
// resolve material
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),arr, 3);
const std::vector<const Connection *> &conns = doc.GetConnectionsByDestinationSequenced(ID(), arr, 3);
materials.reserve(conns.size());
geometry.reserve(conns.size());
attributes.reserve(conns.size());
for(const Connection* con : conns) {
for (const Connection *con : conns) {
// material and geometry links should be Object-Object connections
if (con->PropertyName().length()) {
continue;
}
const Object* const ob = con->SourceObject();
if(!ob) {
DOMWarning("failed to read source object for incoming Model link, ignoring",&element);
const Object *const ob = con->SourceObject();
if (!ob) {
DOMWarning("failed to read source object for incoming Model link, ignoring", &element);
continue;
}
const Material* const mat = dynamic_cast<const Material*>(ob);
if(mat) {
const Material *const mat = dynamic_cast<const Material *>(ob);
if (mat) {
materials.push_back(mat);
continue;
}
const Geometry* const geo = dynamic_cast<const Geometry*>(ob);
if(geo) {
const Geometry *const geo = dynamic_cast<const Geometry *>(ob);
if (geo) {
geometry.push_back(geo);
continue;
}
const NodeAttribute* const att = dynamic_cast<const NodeAttribute*>(ob);
if(att) {
const NodeAttribute *const att = dynamic_cast<const NodeAttribute *>(ob);
if (att) {
attributes.push_back(att);
continue;
}
DOMWarning("source object for model link is neither Material, NodeAttribute nor Geometry, ignoring",&element);
DOMWarning("source object for model link is neither Material, NodeAttribute nor Geometry, ignoring", &element);
continue;
}
}
// ------------------------------------------------------------------------------------------------
bool Model::IsNull() const
{
const std::vector<const NodeAttribute*>& attrs = GetAttributes();
for(const NodeAttribute* att : attrs) {
bool Model::IsNull() const {
const std::vector<const NodeAttribute *> &attrs = GetAttributes();
for (const NodeAttribute *att : attrs) {
const Null* null_tag = dynamic_cast<const Null*>(att);
if(null_tag) {
const Null *null_tag = dynamic_cast<const Null *>(att);
if (null_tag) {
return true;
}
}
@ -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
@ -87,186 +87,187 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ------------------------------------------------------------------------------------------------
// helper to add a vertex (private to NodeWalk)
m3dv_t *AddVrtx(m3dv_t *vrtx, uint32_t *numvrtx, m3dv_t *v, uint32_t *idx) {
if (v->x == (M3D_FLOAT)-0.0) v->x = (M3D_FLOAT)0.0;
if (v->y == (M3D_FLOAT)-0.0) v->y = (M3D_FLOAT)0.0;
if (v->z == (M3D_FLOAT)-0.0) v->z = (M3D_FLOAT)0.0;
if (v->w == (M3D_FLOAT)-0.0) v->w = (M3D_FLOAT)0.0;
vrtx = (m3dv_t *)M3D_REALLOC(vrtx, ((*numvrtx) + 1) * sizeof(m3dv_t));
memcpy(&vrtx[*numvrtx], v, sizeof(m3dv_t));
*idx = *numvrtx;
(*numvrtx)++;
return vrtx;
if (v->x == (M3D_FLOAT)-0.0) v->x = (M3D_FLOAT)0.0;
if (v->y == (M3D_FLOAT)-0.0) v->y = (M3D_FLOAT)0.0;
if (v->z == (M3D_FLOAT)-0.0) v->z = (M3D_FLOAT)0.0;
if (v->w == (M3D_FLOAT)-0.0) v->w = (M3D_FLOAT)0.0;
vrtx = (m3dv_t *)M3D_REALLOC(vrtx, ((*numvrtx) + 1) * sizeof(m3dv_t));
memcpy(&vrtx[*numvrtx], v, sizeof(m3dv_t));
*idx = *numvrtx;
(*numvrtx)++;
return vrtx;
}
// ------------------------------------------------------------------------------------------------
// helper to add a tmap (private to NodeWalk)
m3dti_t *AddTmap(m3dti_t *tmap, uint32_t *numtmap, m3dti_t *ti, uint32_t *idx) {
tmap = (m3dti_t *)M3D_REALLOC(tmap, ((*numtmap) + 1) * sizeof(m3dti_t));
memcpy(&tmap[*numtmap], ti, sizeof(m3dti_t));
*idx = *numtmap;
(*numtmap)++;
return tmap;
tmap = (m3dti_t *)M3D_REALLOC(tmap, ((*numtmap) + 1) * sizeof(m3dti_t));
memcpy(&tmap[*numtmap], ti, sizeof(m3dti_t));
*idx = *numtmap;
(*numtmap)++;
return tmap;
}
// ------------------------------------------------------------------------------------------------
// convert aiColor4D into uint32_t
uint32_t mkColor(aiColor4D *c) {
return ((uint8_t)(c->a * 255) << 24L) |
((uint8_t)(c->b * 255) << 16L) |
((uint8_t)(c->g * 255) << 8L) |
((uint8_t)(c->r * 255) << 0L);
return ((uint8_t)(c->a * 255) << 24L) |
((uint8_t)(c->b * 255) << 16L) |
((uint8_t)(c->g * 255) << 8L) |
((uint8_t)(c->r * 255) << 0L);
}
// ------------------------------------------------------------------------------------------------
// add a material property to the output
void addProp(m3dm_t *m, uint8_t type, uint32_t value) {
unsigned int i;
i = m->numprop++;
m->prop = (m3dp_t *)M3D_REALLOC(m->prop, m->numprop * sizeof(m3dp_t));
if (!m->prop) {
throw DeadlyExportError("memory allocation error");
}
m->prop[i].type = type;
m->prop[i].value.num = value;
unsigned int i;
i = m->numprop++;
m->prop = (m3dp_t *)M3D_REALLOC(m->prop, m->numprop * sizeof(m3dp_t));
if (!m->prop) {
throw DeadlyExportError("memory allocation error");
}
m->prop[i].type = type;
m->prop[i].value.num = value;
}
// ------------------------------------------------------------------------------------------------
// convert aiString to identifier safe C string. This is a duplication of _m3d_safestr
char *SafeStr(aiString str, bool isStrict)
{
char *s = (char *)&str.data;
char *d, *ret;
int i, len;
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--);
if(len > 255) len = 255;
ret = (char *)M3D_MALLOC(len + 1);
if (!ret) {
throw DeadlyExportError("memory allocation error");
}
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--);
*d = 0;
return ret;
for (len = str.length + 1; *s && (*s == ' ' || *s == '\t'); s++, len--)
;
if (len > 255) len = 255;
ret = (char *)M3D_MALLOC(len + 1);
if (!ret) {
throw DeadlyExportError("memory allocation error");
}
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--)
;
*d = 0;
return ret;
}
// ------------------------------------------------------------------------------------------------
// add a material to the output
M3D_INDEX addMaterial(const Assimp::M3DWrapper &m3d, const aiMaterial *mat) {
unsigned int mi = M3D_NOTDEFINED;
aiColor4D c;
aiString name;
ai_real f;
char *fn;
unsigned int mi = M3D_NOTDEFINED;
aiColor4D c;
aiString name;
ai_real f;
char *fn;
if (mat && mat->Get(AI_MATKEY_NAME, name) == AI_SUCCESS && name.length &&
strcmp((char *)&name.data, AI_DEFAULT_MATERIAL_NAME)) {
// check if we have saved a material by this name. This has to be done
// because only the referenced materials should be added to the output
for (unsigned int i = 0; i < m3d->nummaterial; i++)
if (!strcmp((char *)&name.data, m3d->material[i].name)) {
mi = i;
break;
}
// if not found, add the material to the output
if (mi == M3D_NOTDEFINED) {
unsigned int k;
mi = m3d->nummaterial++;
m3d->material = (m3dm_t *)M3D_REALLOC(m3d->material, m3d->nummaterial * sizeof(m3dm_t));
if (!m3d->material) {
throw DeadlyExportError("memory allocation error");
}
m3d->material[mi].name = SafeStr(name, true);
m3d->material[mi].numprop = 0;
m3d->material[mi].prop = NULL;
// iterate through the material property table and see what we got
for (k = 0; k < 15; k++) {
unsigned int j;
if (m3d_propertytypes[k].format == m3dpf_map)
continue;
if (aiProps[k].pKey) {
switch (m3d_propertytypes[k].format) {
case m3dpf_color:
if (mat->Get(aiProps[k].pKey, aiProps[k].type,
aiProps[k].index, c) == AI_SUCCESS)
addProp(&m3d->material[mi],
m3d_propertytypes[k].id, mkColor(&c));
break;
case m3dpf_float:
if (mat->Get(aiProps[k].pKey, aiProps[k].type,
aiProps[k].index, f) == AI_SUCCESS)
addProp(&m3d->material[mi],
m3d_propertytypes[k].id,
/* not (uint32_t)f, because we don't want to convert
if (mat && mat->Get(AI_MATKEY_NAME, name) == AI_SUCCESS && name.length &&
strcmp((char *)&name.data, AI_DEFAULT_MATERIAL_NAME)) {
// check if we have saved a material by this name. This has to be done
// because only the referenced materials should be added to the output
for (unsigned int i = 0; i < m3d->nummaterial; i++)
if (!strcmp((char *)&name.data, m3d->material[i].name)) {
mi = i;
break;
}
// if not found, add the material to the output
if (mi == M3D_NOTDEFINED) {
unsigned int k;
mi = m3d->nummaterial++;
m3d->material = (m3dm_t *)M3D_REALLOC(m3d->material, m3d->nummaterial * sizeof(m3dm_t));
if (!m3d->material) {
throw DeadlyExportError("memory allocation error");
}
m3d->material[mi].name = SafeStr(name, true);
m3d->material[mi].numprop = 0;
m3d->material[mi].prop = NULL;
// iterate through the material property table and see what we got
for (k = 0; k < 15; k++) {
unsigned int j;
if (m3d_propertytypes[k].format == m3dpf_map)
continue;
if (aiProps[k].pKey) {
switch (m3d_propertytypes[k].format) {
case m3dpf_color:
if (mat->Get(aiProps[k].pKey, aiProps[k].type,
aiProps[k].index, c) == AI_SUCCESS)
addProp(&m3d->material[mi],
m3d_propertytypes[k].id, mkColor(&c));
break;
case m3dpf_float:
if (mat->Get(aiProps[k].pKey, aiProps[k].type,
aiProps[k].index, f) == AI_SUCCESS)
addProp(&m3d->material[mi],
m3d_propertytypes[k].id,
/* not (uint32_t)f, because we don't want to convert
* it, we want to see it as 32 bits of memory */
*((uint32_t *)&f));
break;
case m3dpf_uint8:
if (mat->Get(aiProps[k].pKey, aiProps[k].type,
aiProps[k].index, j) == AI_SUCCESS) {
// special conversion for illumination model property
if (m3d_propertytypes[k].id == m3dp_il) {
switch (j) {
case aiShadingMode_NoShading: j = 0; break;
case aiShadingMode_Phong: j = 2; break;
default: j = 1; break;
}
}
addProp(&m3d->material[mi],
m3d_propertytypes[k].id, j);
}
break;
default:
if (mat->Get(aiProps[k].pKey, aiProps[k].type,
aiProps[k].index, j) == AI_SUCCESS)
addProp(&m3d->material[mi],
m3d_propertytypes[k].id, j);
break;
}
}
if (aiTxProps[k].pKey &&
mat->GetTexture((aiTextureType)aiTxProps[k].type,
aiTxProps[k].index, &name, NULL, NULL, NULL,
NULL, NULL) == AI_SUCCESS) {
unsigned int i;
for (j = name.length - 1; j > 0 && name.data[j] != '.'; j++)
;
if (j && name.data[j] == '.' &&
(name.data[j + 1] == 'p' || name.data[j + 1] == 'P') &&
(name.data[j + 1] == 'n' || name.data[j + 1] == 'N') &&
(name.data[j + 1] == 'g' || name.data[j + 1] == 'G'))
name.data[j] = 0;
// do we have this texture saved already?
fn = SafeStr(name, true);
for (j = 0, i = M3D_NOTDEFINED; j < m3d->numtexture; j++)
if (!strcmp(fn, m3d->texture[j].name)) {
i = j;
free(fn);
break;
}
if (i == M3D_NOTDEFINED) {
i = m3d->numtexture++;
m3d->texture = (m3dtx_t *)M3D_REALLOC(
m3d->texture,
m3d->numtexture * sizeof(m3dtx_t));
if (!m3d->texture) {
throw DeadlyExportError("memory allocation error");
}
// we don't need the texture itself, only its name
m3d->texture[i].name = fn;
m3d->texture[i].w = 0;
m3d->texture[i].h = 0;
m3d->texture[i].d = NULL;
}
addProp(&m3d->material[mi],
m3d_propertytypes[k].id + 128, i);
}
}
}
}
return mi;
*((uint32_t *)&f));
break;
case m3dpf_uint8:
if (mat->Get(aiProps[k].pKey, aiProps[k].type,
aiProps[k].index, j) == AI_SUCCESS) {
// special conversion for illumination model property
if (m3d_propertytypes[k].id == m3dp_il) {
switch (j) {
case aiShadingMode_NoShading: j = 0; break;
case aiShadingMode_Phong: j = 2; break;
default: j = 1; break;
}
}
addProp(&m3d->material[mi],
m3d_propertytypes[k].id, j);
}
break;
default:
if (mat->Get(aiProps[k].pKey, aiProps[k].type,
aiProps[k].index, j) == AI_SUCCESS)
addProp(&m3d->material[mi],
m3d_propertytypes[k].id, j);
break;
}
}
if (aiTxProps[k].pKey &&
mat->GetTexture((aiTextureType)aiTxProps[k].type,
aiTxProps[k].index, &name, NULL, NULL, NULL,
NULL, NULL) == AI_SUCCESS) {
unsigned int i;
for (j = name.length - 1; j > 0 && name.data[j] != '.'; j++)
;
if (j && name.data[j] == '.' &&
(name.data[j + 1] == 'p' || name.data[j + 1] == 'P') &&
(name.data[j + 1] == 'n' || name.data[j + 1] == 'N') &&
(name.data[j + 1] == 'g' || name.data[j + 1] == 'G'))
name.data[j] = 0;
// do we have this texture saved already?
fn = SafeStr(name, true);
for (j = 0, i = M3D_NOTDEFINED; j < m3d->numtexture; j++)
if (!strcmp(fn, m3d->texture[j].name)) {
i = j;
free(fn);
break;
}
if (i == M3D_NOTDEFINED) {
i = m3d->numtexture++;
m3d->texture = (m3dtx_t *)M3D_REALLOC(
m3d->texture,
m3d->numtexture * sizeof(m3dtx_t));
if (!m3d->texture) {
throw DeadlyExportError("memory allocation error");
}
// we don't need the texture itself, only its name
m3d->texture[i].name = fn;
m3d->texture[i].w = 0;
m3d->texture[i].h = 0;
m3d->texture[i].d = NULL;
}
addProp(&m3d->material[mi],
m3d_propertytypes[k].id + 128, i);
}
}
}
}
return mi;
}
namespace Assimp {
@ -275,161 +276,161 @@ namespace Assimp {
// Worker function for exporting a scene to binary M3D.
// Prototyped and registered in Exporter.cpp
void ExportSceneM3D(
const char *pFile,
IOSystem *pIOSystem,
const aiScene *pScene,
const ExportProperties *pProperties) {
// initialize the exporter
M3DExporter exporter(pScene, pProperties);
const char *pFile,
IOSystem *pIOSystem,
const aiScene *pScene,
const ExportProperties *pProperties) {
// initialize the exporter
M3DExporter exporter(pScene, pProperties);
// perform binary export
exporter.doExport(pFile, pIOSystem, false);
// perform binary export
exporter.doExport(pFile, pIOSystem, false);
}
// ---------------------------------------------------------------------
// 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
// initialize the exporter
M3DExporter exporter(pScene, pProperties);
// initialize the exporter
M3DExporter exporter(pScene, pProperties);
// perform ascii export
exporter.doExport(pFile, pIOSystem, true);
// perform ascii export
exporter.doExport(pFile, pIOSystem, true);
#else
throw DeadlyExportError("Assimp configured without M3D_ASCII support");
throw DeadlyExportError("Assimp configured without M3D_ASCII support");
#endif
}
// ------------------------------------------------------------------------------------------------
M3DExporter::M3DExporter(const aiScene *pScene, const ExportProperties *pProperties) :
mScene(pScene),
mProperties(pProperties),
outfile() {}
mScene(pScene),
mProperties(pProperties),
outfile() {}
// ------------------------------------------------------------------------------------------------
void M3DExporter::doExport(
const char *pFile,
IOSystem *pIOSystem,
bool toAscii) {
// TODO: convert mProperties into M3D_EXP_* flags
(void)mProperties;
const char *pFile,
IOSystem *pIOSystem,
bool toAscii) {
// TODO: convert mProperties into M3D_EXP_* flags
(void)mProperties;
// open the indicated file for writing (in binary / ASCII mode)
outfile.reset(pIOSystem->Open(pFile, toAscii ? "wt" : "wb"));
if (!outfile) {
throw DeadlyExportError("could not open output .m3d file: " + std::string(pFile));
}
// open the indicated file for writing (in binary / ASCII mode)
outfile.reset(pIOSystem->Open(pFile, toAscii ? "wt" : "wb"));
if (!outfile) {
throw DeadlyExportError("could not open output .m3d file: " + std::string(pFile));
}
M3DWrapper m3d;
if (!m3d) {
throw DeadlyExportError("memory allocation error");
}
m3d->name = SafeStr(mScene->mRootNode->mName, false);
M3DWrapper m3d;
if (!m3d) {
throw DeadlyExportError("memory allocation error");
}
m3d->name = SafeStr(mScene->mRootNode->mName, false);
// Create a model from assimp structures
aiMatrix4x4 m;
NodeWalk(m3d, mScene->mRootNode, m);
// Create a model from assimp structures
aiMatrix4x4 m;
NodeWalk(m3d, mScene->mRootNode, m);
// serialize the structures
unsigned int size;
unsigned char *output = m3d.Save(M3D_EXP_FLOAT, M3D_EXP_EXTRA | (toAscii ? M3D_EXP_ASCII : 0), size);
// serialize the structures
unsigned int size;
unsigned char *output = m3d.Save(M3D_EXP_FLOAT, M3D_EXP_EXTRA | (toAscii ? M3D_EXP_ASCII : 0), size);
if (!output || size < 8) {
throw DeadlyExportError("unable to serialize into Model 3D");
}
if (!output || size < 8) {
throw DeadlyExportError("unable to serialize into Model 3D");
}
// Write out serialized model
outfile->Write(output, size, 1);
// Write out serialized model
outfile->Write(output, size, 1);
// explicitly release file pointer,
// so we don't have to rely on class destruction.
outfile.reset();
// explicitly release file pointer,
// so we don't have to rely on class destruction.
outfile.reset();
}
// ------------------------------------------------------------------------------------------------
// recursive node walker
void M3DExporter::NodeWalk(const M3DWrapper &m3d, const aiNode *pNode, aiMatrix4x4 m) {
aiMatrix4x4 nm = m * pNode->mTransformation;
aiMatrix4x4 nm = m * pNode->mTransformation;
for (unsigned int i = 0; i < pNode->mNumMeshes; i++) {
const aiMesh *mesh = mScene->mMeshes[pNode->mMeshes[i]];
unsigned int mi = M3D_NOTDEFINED;
if (mScene->mMaterials) {
// get the material for this mesh
mi = addMaterial(m3d, mScene->mMaterials[mesh->mMaterialIndex]);
}
// iterate through the mesh faces
for (unsigned int j = 0; j < mesh->mNumFaces; j++) {
unsigned int n;
const aiFace *face = &(mesh->mFaces[j]);
// only triangle meshes supported for now
if (face->mNumIndices != 3) {
throw DeadlyExportError("use aiProcess_Triangulate before export");
}
// add triangle to the output
n = m3d->numface++;
m3d->face = (m3df_t *)M3D_REALLOC(m3d->face,
m3d->numface * sizeof(m3df_t));
if (!m3d->face) {
throw DeadlyExportError("memory allocation error");
}
/* set all index to -1 by default */
m3d->face[n].vertex[0] = m3d->face[n].vertex[1] = m3d->face[n].vertex[2] =
m3d->face[n].normal[0] = m3d->face[n].normal[1] = m3d->face[n].normal[2] =
m3d->face[n].texcoord[0] = m3d->face[n].texcoord[1] = m3d->face[n].texcoord[2] = M3D_UNDEF;
m3d->face[n].materialid = mi;
for (unsigned int k = 0; k < face->mNumIndices; k++) {
// get the vertex's index
unsigned int l = face->mIndices[k];
unsigned int idx;
m3dv_t vertex;
m3dti_t ti;
// multiply the position vector by the transformation matrix
aiVector3D v = mesh->mVertices[l];
v *= nm;
vertex.x = v.x;
vertex.y = v.y;
vertex.z = v.z;
vertex.w = 1.0;
vertex.color = 0;
vertex.skinid = M3D_UNDEF;
// add color if defined
if (mesh->HasVertexColors(0))
vertex.color = mkColor(&mesh->mColors[0][l]);
// save the vertex to the output
m3d->vertex = AddVrtx(m3d->vertex, &m3d->numvertex,
&vertex, &idx);
m3d->face[n].vertex[k] = (M3D_INDEX)idx;
// do we have texture coordinates?
if (mesh->HasTextureCoords(0)) {
ti.u = mesh->mTextureCoords[0][l].x;
ti.v = mesh->mTextureCoords[0][l].y;
m3d->tmap = AddTmap(m3d->tmap, &m3d->numtmap, &ti, &idx);
m3d->face[n].texcoord[k] = (M3D_INDEX)idx;
}
// do we have normal vectors?
if (mesh->HasNormals()) {
vertex.x = mesh->mNormals[l].x;
vertex.y = mesh->mNormals[l].y;
vertex.z = mesh->mNormals[l].z;
vertex.color = 0;
m3d->vertex = AddVrtx(m3d->vertex, &m3d->numvertex, &vertex, &idx);
m3d->face[n].normal[k] = (M3D_INDEX)idx;
}
}
}
}
// repeat for the children nodes
for (unsigned int i = 0; i < pNode->mNumChildren; i++) {
NodeWalk(m3d, pNode->mChildren[i], nm);
}
for (unsigned int i = 0; i < pNode->mNumMeshes; i++) {
const aiMesh *mesh = mScene->mMeshes[pNode->mMeshes[i]];
unsigned int mi = M3D_NOTDEFINED;
if (mScene->mMaterials) {
// get the material for this mesh
mi = addMaterial(m3d, mScene->mMaterials[mesh->mMaterialIndex]);
}
// iterate through the mesh faces
for (unsigned int j = 0; j < mesh->mNumFaces; j++) {
unsigned int n;
const aiFace *face = &(mesh->mFaces[j]);
// only triangle meshes supported for now
if (face->mNumIndices != 3) {
throw DeadlyExportError("use aiProcess_Triangulate before export");
}
// add triangle to the output
n = m3d->numface++;
m3d->face = (m3df_t *)M3D_REALLOC(m3d->face,
m3d->numface * sizeof(m3df_t));
if (!m3d->face) {
throw DeadlyExportError("memory allocation error");
}
/* set all index to -1 by default */
m3d->face[n].vertex[0] = m3d->face[n].vertex[1] = m3d->face[n].vertex[2] =
m3d->face[n].normal[0] = m3d->face[n].normal[1] = m3d->face[n].normal[2] =
m3d->face[n].texcoord[0] = m3d->face[n].texcoord[1] = m3d->face[n].texcoord[2] = M3D_UNDEF;
m3d->face[n].materialid = mi;
for (unsigned int k = 0; k < face->mNumIndices; k++) {
// get the vertex's index
unsigned int l = face->mIndices[k];
unsigned int idx;
m3dv_t vertex;
m3dti_t ti;
// multiply the position vector by the transformation matrix
aiVector3D v = mesh->mVertices[l];
v *= nm;
vertex.x = v.x;
vertex.y = v.y;
vertex.z = v.z;
vertex.w = 1.0;
vertex.color = 0;
vertex.skinid = M3D_UNDEF;
// add color if defined
if (mesh->HasVertexColors(0))
vertex.color = mkColor(&mesh->mColors[0][l]);
// save the vertex to the output
m3d->vertex = AddVrtx(m3d->vertex, &m3d->numvertex,
&vertex, &idx);
m3d->face[n].vertex[k] = (M3D_INDEX)idx;
// do we have texture coordinates?
if (mesh->HasTextureCoords(0)) {
ti.u = mesh->mTextureCoords[0][l].x;
ti.v = mesh->mTextureCoords[0][l].y;
m3d->tmap = AddTmap(m3d->tmap, &m3d->numtmap, &ti, &idx);
m3d->face[n].texcoord[k] = (M3D_INDEX)idx;
}
// do we have normal vectors?
if (mesh->HasNormals()) {
vertex.x = mesh->mNormals[l].x;
vertex.y = mesh->mNormals[l].y;
vertex.z = mesh->mNormals[l].z;
vertex.color = 0;
m3d->vertex = AddVrtx(m3d->vertex, &m3d->numvertex, &vertex, &idx);
m3d->face[n].normal[k] = (M3D_INDEX)idx;
}
}
}
}
// repeat for the children nodes
for (unsigned int i = 0; i < pNode->mNumChildren; i++) {
NodeWalk(m3d, pNode->mChildren[i], nm);
}
}
} // namespace Assimp

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);

File diff suppressed because it is too large Load Diff

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,23 +43,22 @@ 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;
namespace {
static const aiImporterDesc desc = {
"Stereolithography (STL) Importer",
"",
@ -77,14 +76,14 @@ static const aiImporterDesc desc = {
// 1) 80 byte header
// 2) 4 byte face count
// 3) 50 bytes per face
static bool IsBinarySTL(const char* buffer, unsigned int fileSize) {
if( fileSize < 84 ) {
static bool IsBinarySTL(const char *buffer, unsigned int fileSize) {
if (fileSize < 84) {
return false;
}
const char *facecount_pos = buffer + 80;
uint32_t faceCount( 0 );
::memcpy( &faceCount, facecount_pos, sizeof( uint32_t ) );
uint32_t faceCount(0);
::memcpy(&faceCount, facecount_pos, sizeof(uint32_t));
const uint32_t expectedBinaryFileSize = faceCount * 50 + 84;
return expectedBinaryFileSize == fileSize;
@ -96,11 +95,11 @@ static const char UnicodeBoundary = 127;
// An ascii STL buffer will begin with "solid NAME", where NAME is optional.
// Note: The "solid NAME" check is necessary, but not sufficient, to determine
// if the buffer is ASCII; a binary header could also begin with "solid NAME".
static bool IsAsciiSTL(const char* buffer, unsigned int fileSize) {
static bool IsAsciiSTL(const char *buffer, unsigned int fileSize) {
if (IsBinarySTL(buffer, fileSize))
return false;
const char* bufferEnd = buffer + fileSize;
const char *bufferEnd = buffer + fileSize;
if (!SkipSpaces(&buffer))
return false;
@ -108,13 +107,13 @@ static bool IsAsciiSTL(const char* buffer, unsigned int fileSize) {
if (buffer + 5 >= bufferEnd)
return false;
bool isASCII( strncmp( buffer, "solid", 5 ) == 0 );
if( isASCII ) {
bool isASCII(strncmp(buffer, "solid", 5) == 0);
if (isASCII) {
// A lot of importers are write solid even if the file is binary. So we have to check for ASCII-characters.
if( fileSize >= BufferSize) {
if (fileSize >= BufferSize) {
isASCII = true;
for( unsigned int i = 0; i < BufferSize; i++ ) {
if( buffer[ i ] > UnicodeBoundary) {
for (unsigned int i = 0; i < BufferSize; i++) {
if (buffer[i] > UnicodeBoundary) {
isASCII = false;
break;
}
@ -127,49 +126,49 @@ 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" ) {
if (extension == "stl") {
return true;
} else if (!extension.length() || checkSig) {
if( !pIOHandler ) {
} else if (!extension.length() || checkSig) {
if (!pIOHandler) {
return true;
}
const char* tokens[] = {"STL","solid"};
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,2);
const char *tokens[] = { "STL", "solid" };
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 2);
}
return false;
}
// ------------------------------------------------------------------------------------------------
const aiImporterDesc* STLImporter::GetInfo () const {
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) {
for (unsigned int i = 0, p = 0; i < pMesh->mNumFaces; ++i) {
aiFace& face = pMesh->mFaces[i];
aiFace &face = pMesh->mFaces[i];
face.mIndices = new unsigned int[face.mNumIndices = 3];
for (unsigned int o = 0; o < 3;++o,++p) {
for (unsigned int o = 0; o < 3; ++o, ++p) {
face.mIndices[o] = p;
}
}
@ -177,137 +176,132 @@ void addFacesToMesh(aiMesh* pMesh)
// ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure.
void STLImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler )
{
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
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
if( file.get() == nullptr) {
throw DeadlyImportError( "Failed to open STL file " + pFile + ".");
if (file.get() == nullptr) {
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);
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 + ".");
throw DeadlyImportError("Failed to determine STL storage representation for " + pFile + ".");
}
// create a single default material, using a white diffuse color for consistency with
// other geometric types (e.g., PLY).
aiMaterial* pcMat = new aiMaterial();
aiMaterial *pcMat = new aiMaterial();
aiString s;
s.Set(AI_DEFAULT_MATERIAL_NAME);
pcMat->AddProperty(&s, AI_MATKEY_NAME);
aiColor4D clrDiffuse(ai_real(1.0),ai_real(1.0),ai_real(1.0),ai_real(1.0));
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);
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;
}
// ------------------------------------------------------------------------------------------------
// Read an ASCII STL file
void STLImporter::LoadASCIIFile( aiNode *root ) {
std::vector<aiMesh*> meshes;
std::vector<aiNode*> nodes;
const char* sz = mBuffer;
const char* bufferEnd = mBuffer + fileSize;
void STLImporter::LoadASCIIFile(aiNode *root) {
std::vector<aiMesh *> meshes;
std::vector<aiNode *> nodes;
const char *sz = mBuffer;
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);
while (IsAsciiSTL(sz, static_cast<unsigned int>(bufferEnd - sz))) {
std::vector<unsigned int> meshIndices;
aiMesh* pMesh = new aiMesh();
aiMesh *pMesh = new aiMesh();
pMesh->mMaterialIndex = 0;
meshIndices.push_back((unsigned int) meshes.size() );
meshIndices.push_back((unsigned int)meshes.size());
meshes.push_back(pMesh);
aiNode *node = new aiNode;
node->mParent = root;
nodes.push_back( node );
nodes.push_back(node);
SkipSpaces(&sz);
ai_assert(!IsLineEnd(sz));
sz += 5; // skip the "solid"
SkipSpaces(&sz);
const char* szMe = sz;
const char *szMe = sz;
while (!::IsSpaceOrNewLine(*sz)) {
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" );
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';
std::string name(szMe, temp);
node->mName.Set(name.c_str());
pMesh->mName.Set(name.c_str());
} else {
pScene->mRootNode->mName.Set("<STL_ASCII>");
mScene->mRootNode->mName.Set("<STL_ASCII>");
}
unsigned int faceVertexCounter = 3;
for ( ;; ) {
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;
}
// facet normal -0.13 -0.13 -0.98
if (!strncmp(sz,"facet",5) && IsSpaceOrNewLine(*(sz+5)) && *(sz + 5) != '\0') {
if (!strncmp(sz, "facet", 5) && IsSpaceOrNewLine(*(sz + 5)) && *(sz + 5) != '\0') {
if (faceVertexCounter != 3) {
ASSIMP_LOG_WARN("STL: A new facet begins but the old is not yet complete");
}
faceVertexCounter = 0;
normalBuffer.push_back(aiVector3D());
aiVector3D* vn = &normalBuffer.back();
aiVector3D *vn = &normalBuffer.back();
sz += 6;
SkipSpaces(&sz);
if (strncmp(sz,"normal",6)) {
if (strncmp(sz, "normal", 6)) {
ASSIMP_LOG_WARN("STL: a facet normal vector was expected but not found");
} else {
if (sz[6] == '\0') {
@ -315,15 +309,15 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
}
sz += 7;
SkipSpaces(&sz);
sz = fast_atoreal_move<ai_real>(sz, (ai_real&)vn->x );
sz = fast_atoreal_move<ai_real>(sz, (ai_real &)vn->x);
SkipSpaces(&sz);
sz = fast_atoreal_move<ai_real>(sz, (ai_real&)vn->y );
sz = fast_atoreal_move<ai_real>(sz, (ai_real &)vn->y);
SkipSpaces(&sz);
sz = fast_atoreal_move<ai_real>(sz, (ai_real&)vn->z );
sz = fast_atoreal_move<ai_real>(sz, (ai_real &)vn->z);
normalBuffer.push_back(*vn);
normalBuffer.push_back(*vn);
}
} else if (!strncmp(sz,"vertex",6) && ::IsSpaceOrNewLine(*(sz+6))) { // vertex 1.50000 1.50000 0.00000
} else if (!strncmp(sz, "vertex", 6) && ::IsSpaceOrNewLine(*(sz + 6))) { // vertex 1.50000 1.50000 0.00000
if (faceVertexCounter >= 3) {
ASSIMP_LOG_ERROR("STL: a facet with more than 3 vertices has been found");
++sz;
@ -334,15 +328,15 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
sz += 7;
SkipSpaces(&sz);
positionBuffer.push_back(aiVector3D());
aiVector3D* vn = &positionBuffer.back();
sz = fast_atoreal_move<ai_real>(sz, (ai_real&)vn->x );
aiVector3D *vn = &positionBuffer.back();
sz = fast_atoreal_move<ai_real>(sz, (ai_real &)vn->x);
SkipSpaces(&sz);
sz = fast_atoreal_move<ai_real>(sz, (ai_real&)vn->y );
sz = fast_atoreal_move<ai_real>(sz, (ai_real &)vn->y);
SkipSpaces(&sz);
sz = fast_atoreal_move<ai_real>(sz, (ai_real&)vn->z );
sz = fast_atoreal_move<ai_real>(sz, (ai_real &)vn->z);
faceVertexCounter++;
}
} else if (!::strncmp(sz,"endsolid",8)) {
} else if (!::strncmp(sz, "endsolid", 8)) {
do {
++sz;
} while (!::IsLineEnd(*sz));
@ -356,15 +350,15 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
}
}
if (positionBuffer.empty()) {
if (positionBuffer.empty()) {
pMesh->mNumFaces = 0;
ASSIMP_LOG_WARN("STL: mesh is empty or invalid; no data loaded");
}
if (positionBuffer.size() % 3 != 0) {
if (positionBuffer.size() % 3 != 0) {
pMesh->mNumFaces = 0;
throw DeadlyImportError("STL: Invalid number of vertices");
}
if (normalBuffer.size() != positionBuffer.size()) {
if (normalBuffer.size() != positionBuffer.size()) {
pMesh->mNumFaces = 0;
throw DeadlyImportError("Normal buffer size does not match position buffer size");
}
@ -390,67 +384,66 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
addFacesToMesh(pMesh);
// assign the meshes to the current node
pushMeshesToNode( meshIndices, node );
pushMeshesToNode(meshIndices, node);
}
// 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();
root->mChildren = new aiNode*[ root->mNumChildren ];
for ( size_t i=0; i<nodes.size(); ++i ) {
root->mChildren[ i ] = nodes[ i ];
root->mNumChildren = (unsigned int)nodes.size();
root->mChildren = new aiNode *[root->mNumChildren];
for (size_t i = 0; i < nodes.size(); ++i) {
root->mChildren[i] = nodes[i];
}
}
// ------------------------------------------------------------------------------------------------
// 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;
// search for an occurrence of "COLOR=" in the header
const unsigned char* sz2 = (const unsigned char*)mBuffer;
const unsigned char* const szEnd = sz2+80;
const unsigned char *sz2 = (const unsigned char *)mBuffer;
const unsigned char *const szEnd = sz2 + 80;
while (sz2 < szEnd) {
if ('C' == *sz2++ && 'O' == *sz2++ && 'L' == *sz2++ &&
'O' == *sz2++ && 'R' == *sz2++ && '=' == *sz2++) {
'O' == *sz2++ && 'R' == *sz2++ && '=' == *sz2++) {
// read the default vertex color for facets
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;
const ai_real invByte = (ai_real)1.0 / (ai_real)255.0;
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;
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);
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");
}
@ -458,123 +451,127 @@ bool STLImporter::LoadBinaryFile()
throw DeadlyImportError("STL: file is empty. There are no facets defined");
}
pMesh->mNumVertices = pMesh->mNumFaces*3;
pMesh->mNumVertices = pMesh->mNumFaces * 3;
aiVector3D *vp = pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
aiVector3D *vn = pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
typedef aiVector3t<float> aiVector3F;
aiVector3F* theVec;
aiVector3F *theVec;
aiVector3F theVec3F;
for ( unsigned int i = 0; i < pMesh->mNumFaces; ++i ) {
for (unsigned int i = 0; i < pMesh->mNumFaces; ++i) {
// NOTE: Blender sometimes writes empty normals ... this is not
// our fault ... the RemoveInvalidData helper step should fix that
// There's one normal for the face in the STL; use it three times
// for vertex normals
theVec = (aiVector3F*) sz;
::memcpy( &theVec3F, theVec, sizeof(aiVector3F) );
vn->x = theVec3F.x; vn->y = theVec3F.y; vn->z = theVec3F.z;
*(vn+1) = *vn;
*(vn+2) = *vn;
theVec = (aiVector3F *)sz;
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
vn->x = theVec3F.x;
vn->y = theVec3F.y;
vn->z = theVec3F.z;
*(vn + 1) = *vn;
*(vn + 2) = *vn;
++theVec;
vn += 3;
// vertex 1
::memcpy( &theVec3F, theVec, sizeof(aiVector3F) );
vp->x = theVec3F.x; vp->y = theVec3F.y; vp->z = theVec3F.z;
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
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;
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
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;
::memcpy(&theVec3F, theVec, sizeof(aiVector3F));
vp->x = theVec3F.x;
vp->y = theVec3F.y;
vp->z = theVec3F.z;
++theVec;
++vp;
sz = (const unsigned char*) theVec;
uint16_t color = *((uint16_t*)sz);
sz = (const unsigned char *)theVec;
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");
}
aiColor4D* clr = &pMesh->mColors[0][i*3];
aiColor4D *clr = &pMesh->mColors[0][i * 3];
clr->a = 1.0;
const ai_real invVal( (ai_real)1.0 / ( ai_real )31.0 );
const ai_real invVal((ai_real)1.0 / (ai_real)31.0);
if (bIsMaterialise) // this is reversed
{
clr->r = (color & 0x31u) *invVal;
clr->g = ((color & (0x31u<<5))>>5u) *invVal;
clr->b = ((color & (0x31u<<10))>>10u) *invVal;
}
else
{
clr->b = (color & 0x31u) *invVal;
clr->g = ((color & (0x31u<<5))>>5u) *invVal;
clr->r = ((color & (0x31u<<10))>>10u) *invVal;
clr->r = (color & 0x31u) * invVal;
clr->g = ((color & (0x31u << 5)) >> 5u) * invVal;
clr->b = ((color & (0x31u << 10)) >> 10u) * invVal;
} else {
clr->b = (color & 0x31u) * invVal;
clr->g = ((color & (0x31u << 5)) >> 5u) * invVal;
clr->r = ((color & (0x31u << 10)) >> 10u) * invVal;
}
// assign the color to all vertices of the face
*(clr+1) = *clr;
*(clr+2) = *clr;
*(clr + 1) = *clr;
*(clr + 2) = *clr;
}
}
// now copy faces
addFacesToMesh(pMesh);
aiNode* root = pScene->mRootNode;
aiNode *root = mScene->mRootNode;
// allocate one node
aiNode* node = new aiNode();
aiNode *node = new aiNode();
node->mParent = root;
root->mNumChildren = 1u;
root->mChildren = new aiNode*[root->mNumChildren];
root->mChildren = new aiNode *[root->mNumChildren];
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;
}
return false;
}
void STLImporter::pushMeshesToNode( std::vector<unsigned int> &meshIndices, aiNode *node ) {
ai_assert( nullptr != node );
if ( meshIndices.empty() ) {
void STLImporter::pushMeshesToNode(std::vector<unsigned int> &meshIndices, aiNode *node) {
ai_assert(nullptr != node);
if (meshIndices.empty()) {
return;
}
node->mNumMeshes = static_cast<unsigned int>( meshIndices.size() );
node->mMeshes = new unsigned int[ meshIndices.size() ];
for ( size_t i=0; i<meshIndices.size(); ++i ) {
node->mMeshes[ i ] = meshIndices[ i ];
node->mNumMeshes = static_cast<unsigned int>(meshIndices.size());
node->mMeshes = new unsigned int[meshIndices.size()];
for (size_t i = 0; i < meshIndices.size(); ++i) {
node->mMeshes[i] = meshIndices[i];
}
meshIndices.clear();
}

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,9 +258,10 @@ void TerragenImporter::InternReadFile( const std::string& pFile,
}
// Get to the next chunk (4 byte aligned)
unsigned dtt;
if ((dtt = reader.GetCurrentPos() & 0x3))
reader.IncPtr(4-dtt);
unsigned dtt = reader.GetCurrentPos();
if (dtt & 0x3) {
reader.IncPtr(4 - dtt);
}
}
// Check whether we have a mesh now

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];
floatArray[v * stride + d] = m_quantFloatArray[v * stride + d] * idelta[d] + minFloatArray[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;