Merge branch 'master' into bound
commit
27231c3f52
|
@ -103,7 +103,7 @@ namespace XmlTag {
|
|||
const char* const PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
|
||||
const char* const PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
||||
const char* const PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
|
||||
}
|
||||
}
|
||||
|
||||
} // Namespace D3MF
|
||||
} // Namespace Assimp
|
||||
|
|
|
@ -231,11 +231,7 @@ void ColladaParser::UriDecodePath(aiString &ss) {
|
|||
|
||||
// Maxon Cinema Collada Export writes "file:///C:\andsoon" with three slashes...
|
||||
// I need to filter it without destroying linux paths starting with "/somewhere"
|
||||
#if defined(_MSC_VER)
|
||||
if (ss.data[0] == '/' && isalpha((unsigned char)ss.data[1]) && ss.data[2] == ':') {
|
||||
#else
|
||||
if (ss.data[0] == '/' && isalpha((unsigned char)ss.data[1]) && ss.data[2] == ':') {
|
||||
#endif
|
||||
--ss.length;
|
||||
::memmove(ss.data, ss.data + 1, ss.length);
|
||||
ss.data[ss.length] = 0;
|
||||
|
|
|
@ -516,13 +516,13 @@ namespace pmx
|
|||
stream->read((char*) magic, sizeof(char) * 4);
|
||||
if (magic[0] != 0x50 || magic[1] != 0x4d || magic[2] != 0x58 || magic[3] != 0x20)
|
||||
{
|
||||
throw DeadlyImportError("MMD: Invalid magic number.");
|
||||
}
|
||||
throw DeadlyImportError("MMD: Invalid magic number.");
|
||||
}
|
||||
stream->read((char*) &version, sizeof(float));
|
||||
if (version != 2.0f && version != 2.1f)
|
||||
{
|
||||
throw DeadlyImportError("MMD: Unsupported version (must be 2.0 or 2.1): ", ai_to_string(version));
|
||||
}
|
||||
}
|
||||
this->setting.Read(stream);
|
||||
|
||||
this->model_name = ReadString(stream, setting.encoding);
|
||||
|
|
|
@ -58,13 +58,13 @@ using namespace Assimp;
|
|||
namespace EXPRESS = STEP::EXPRESS;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = "")
|
||||
std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = std::string())
|
||||
{
|
||||
return line == STEP::SyntaxError::LINE_NOT_SPECIFIED ? prefix+s : static_cast<std::string>( (Formatter::format(),prefix,"(line ",line,") ",s) );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
std::string AddEntityID(const std::string& s,uint64_t entity /*= ENTITY_NOT_SPECIFIED*/, const std::string& prefix = "")
|
||||
std::string AddEntityID(const std::string& s,uint64_t entity /*= ENTITY_NOT_SPECIFIED*/, const std::string& prefix = std::string())
|
||||
{
|
||||
return entity == STEP::TypeError::ENTITY_NOT_SPECIFIED ? prefix+s : static_cast<std::string>( (Formatter::format(),prefix,"(entity #",entity,") ",s));
|
||||
}
|
||||
|
|
|
@ -175,12 +175,11 @@ void StepExporter::WriteFile()
|
|||
fColor.b = 0.8f;
|
||||
|
||||
int ind = 100; // the start index to be used
|
||||
int faceEntryLen = 30; // number of entries for a triangle/face
|
||||
std::vector<int> faceEntryLen; // numbers of entries for a triangle/face
|
||||
// prepare unique (count triangles and vertices)
|
||||
|
||||
VectorIndexUMap uniqueVerts; // use a map to reduce find complexity to log(n)
|
||||
VectorIndexUMap::iterator it;
|
||||
int countFace = 0;
|
||||
|
||||
for (unsigned int i=0; i<mScene->mNumMeshes; ++i)
|
||||
{
|
||||
|
@ -189,7 +188,7 @@ void StepExporter::WriteFile()
|
|||
{
|
||||
aiFace* face = &(mesh->mFaces[j]);
|
||||
|
||||
if (face->mNumIndices == 3) countFace++;
|
||||
if (face->mNumIndices >= 3) faceEntryLen.push_back(15 + 5 * face->mNumIndices);
|
||||
}
|
||||
for (unsigned int j=0; j<mesh->mNumVertices; ++j)
|
||||
{
|
||||
|
@ -218,10 +217,13 @@ void StepExporter::WriteFile()
|
|||
// write the top of data
|
||||
mOutput << "DATA" << endstr;
|
||||
mOutput << "#1=MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION(' ',(";
|
||||
for (int i=0; i<countFace; ++i)
|
||||
size_t countFace = faceEntryLen.size();
|
||||
size_t faceLenIndex = ind + 2 * uniqueVerts.size();
|
||||
for (size_t i=0; i<countFace; ++i)
|
||||
{
|
||||
mOutput << "#" << i*faceEntryLen + ind + 2*uniqueVerts.size();
|
||||
mOutput << "#" << faceLenIndex;
|
||||
if (i!=countFace-1) mOutput << ",";
|
||||
faceLenIndex += faceEntryLen[i];
|
||||
}
|
||||
mOutput << "),#6)" << endstr;
|
||||
|
||||
|
@ -253,10 +255,12 @@ void StepExporter::WriteFile()
|
|||
mOutput << "#27=DIRECTION('',(1.0,0.0,0.0))" << endstr;
|
||||
mOutput << "#28= (NAMED_UNIT(#21)LENGTH_UNIT()SI_UNIT(.MILLI.,.METRE.))" << endstr;
|
||||
mOutput << "#29=CLOSED_SHELL('',(";
|
||||
for (int i=0; i<countFace; ++i)
|
||||
faceLenIndex = ind + 2 * uniqueVerts.size() + 8;
|
||||
for (size_t i=0; i<countFace; ++i)
|
||||
{
|
||||
mOutput << "#" << i*faceEntryLen + ind + 2*uniqueVerts.size() + 8;
|
||||
mOutput << "#" << faceLenIndex;
|
||||
if (i!=countFace-1) mOutput << ",";
|
||||
faceLenIndex += faceEntryLen[i];
|
||||
}
|
||||
mOutput << "))" << endstr;
|
||||
|
||||
|
@ -289,28 +293,29 @@ void StepExporter::WriteFile()
|
|||
{
|
||||
aiFace* face = &(mesh->mFaces[j]);
|
||||
|
||||
if (face->mNumIndices != 3) continue;
|
||||
const int numIndices = face->mNumIndices;
|
||||
if (numIndices < 3) continue;
|
||||
|
||||
aiVector3D* v1 = &(mesh->mVertices[face->mIndices[0]]);
|
||||
aiVector3D* v2 = &(mesh->mVertices[face->mIndices[1]]);
|
||||
aiVector3D* v3 = &(mesh->mVertices[face->mIndices[2]]);
|
||||
aiVector3D dv12 = *v2 - *v1;
|
||||
aiVector3D dv23 = *v3 - *v2;
|
||||
aiVector3D dv31 = *v1 - *v3;
|
||||
aiVector3D dv13 = *v3 - *v1;
|
||||
dv12.Normalize();
|
||||
dv23.Normalize();
|
||||
dv31.Normalize();
|
||||
dv13.Normalize();
|
||||
std::vector<int> pidArray(numIndices, -1); // vertex id
|
||||
std::vector<aiVector3D> dvArray(numIndices); // edge dir
|
||||
for (int k = 0; k < numIndices; ++k)
|
||||
{
|
||||
aiVector3D *v1 = &(mesh->mVertices[face->mIndices[k]]);
|
||||
pidArray[k] = uniqueVerts.find(v1)->second;
|
||||
|
||||
aiVector3D dvY = dv12;
|
||||
aiVector3D dvX = dvY ^ dv13;
|
||||
aiVector3D *v2 = nullptr;
|
||||
if (k + 1 == numIndices)
|
||||
v2 = &(mesh->mVertices[face->mIndices[0]]);
|
||||
else
|
||||
v2 = &(mesh->mVertices[face->mIndices[k + 1]]);
|
||||
dvArray[k] = *v2 - *v1;
|
||||
dvArray[k].Normalize();
|
||||
}
|
||||
|
||||
aiVector3D dvY = dvArray[1];
|
||||
aiVector3D dvX = dvY ^ dvArray[0];
|
||||
dvX.Normalize();
|
||||
|
||||
int pid1 = uniqueVerts.find(v1)->second;
|
||||
int pid2 = uniqueVerts.find(v2)->second;
|
||||
int pid3 = uniqueVerts.find(v3)->second;
|
||||
|
||||
// mean vertex color for the face if available
|
||||
if (mesh->HasVertexColors(0))
|
||||
{
|
||||
|
@ -339,35 +344,62 @@ void StepExporter::WriteFile()
|
|||
|
||||
/* 2 directions of the plane */
|
||||
mOutput << "#" << sid+9 << "=PLANE('',#" << sid+10 << ")" << endstr;
|
||||
mOutput << "#" << sid+10 << "=AXIS2_PLACEMENT_3D('',#" << pid1 << ", #" << sid+11 << ",#" << sid+12 << ")" << endstr;
|
||||
mOutput << "#" << sid+10 << "=AXIS2_PLACEMENT_3D('',#" << pidArray[0] << ",#" << sid+11 << ",#" << sid+12 << ")" << endstr;
|
||||
|
||||
mOutput << "#" << sid + 11 << "=DIRECTION('',(" << dvX.x << "," << dvX.y << "," << dvX.z << "))" << endstr;
|
||||
mOutput << "#" << sid + 12 << "=DIRECTION('',(" << dvY.x << "," << dvY.y << "," << dvY.z << "))" << endstr;
|
||||
|
||||
mOutput << "#" << sid+13 << "=FACE_BOUND('',#" << sid+14 << ",.T.)" << endstr;
|
||||
mOutput << "#" << sid+14 << "=EDGE_LOOP('',(#" << sid+15 << ",#" << sid+16 << ",#" << sid+17 << "))" << endstr;
|
||||
mOutput << "#" << sid+14 << "=EDGE_LOOP('',(";
|
||||
int edgeLoopStart = sid + 15;
|
||||
for (int k = 0; k < numIndices; ++k)
|
||||
{
|
||||
if (k == 0)
|
||||
mOutput << "#";
|
||||
else
|
||||
mOutput << ",#";
|
||||
mOutput << edgeLoopStart + k;
|
||||
}
|
||||
mOutput << "))" << endstr;
|
||||
|
||||
/* edge loop */
|
||||
mOutput << "#" << sid+15 << "=ORIENTED_EDGE('',*,*,#" << sid+18 << ",.T.)" << endstr;
|
||||
mOutput << "#" << sid+16 << "=ORIENTED_EDGE('',*,*,#" << sid+19 << ",.T.)" << endstr;
|
||||
mOutput << "#" << sid+17 << "=ORIENTED_EDGE('',*,*,#" << sid+20 << ",.T.)" << endstr;
|
||||
int orientedEdgesStart = edgeLoopStart + numIndices;
|
||||
for (int k=0; k < numIndices; k++)
|
||||
{
|
||||
mOutput << "#" << edgeLoopStart+k << "=ORIENTED_EDGE('',*,*,#" << orientedEdgesStart + k << ",.T.)" << endstr;
|
||||
}
|
||||
|
||||
/* oriented edges */
|
||||
mOutput << "#" << sid+18 << "=EDGE_CURVE('',#" << pid1+1 << ",#" << pid2+1 << ",#" << sid+21 << ",.F.)" << endstr;
|
||||
mOutput << "#" << sid+19 << "=EDGE_CURVE('',#" << pid2+1 << ",#" << pid3+1 << ",#" << sid+22 << ",.T.)" << endstr;
|
||||
mOutput << "#" << sid+20 << "=EDGE_CURVE('',#" << pid3+1 << ",#" << pid1+1 << ",#" << sid+23 << ",.T.)" << endstr;
|
||||
int lineStart = orientedEdgesStart + numIndices;
|
||||
for (int k=0; k < numIndices; ++k)
|
||||
{
|
||||
if (k == 0)
|
||||
mOutput << "#" << orientedEdgesStart+k << "=EDGE_CURVE('',#" << pidArray[k]+1 << ",#" << pidArray[k+1]+1 << ",#" << lineStart+k << ",.F.)" << endstr;
|
||||
else if (k+1 == numIndices)
|
||||
mOutput << "#" << orientedEdgesStart+k << "=EDGE_CURVE('',#" << pidArray[k]+1 << ",#" << pidArray[0]+1 << ",#" << lineStart+k << ",.T.)" << endstr;
|
||||
else
|
||||
mOutput << "#" << orientedEdgesStart+k << "=EDGE_CURVE('',#" << pidArray[k]+1 << ",#" << pidArray[k+1]+1 << ",#" << lineStart+k << ",.T.)" << endstr;
|
||||
}
|
||||
|
||||
/* 3 lines and 3 vectors for the lines for the 3 edge curves */
|
||||
mOutput << "#" << sid+21 << "=LINE('',#" << pid1 << ",#" << sid+24 << ")" << endstr;
|
||||
mOutput << "#" << sid+22 << "=LINE('',#" << pid2 << ",#" << sid+25 << ")" << endstr;
|
||||
mOutput << "#" << sid+23 << "=LINE('',#" << pid3 << ",#" << sid+26 << ")" << endstr;
|
||||
mOutput << "#" << sid+24 << "=VECTOR('',#" << sid+27 << ",1.0)" << endstr;
|
||||
mOutput << "#" << sid+25 << "=VECTOR('',#" << sid+28 << ",1.0)" << endstr;
|
||||
mOutput << "#" << sid+26 << "=VECTOR('',#" << sid+29 << ",1.0)" << endstr;
|
||||
mOutput << "#" << sid+27 << "=DIRECTION('',(" << dv12.x << "," << dv12.y << "," << dv12.z << "))" << endstr;
|
||||
mOutput << "#" << sid+28 << "=DIRECTION('',(" << dv23.x << "," << dv23.y << "," << dv23.z << "))" << endstr;
|
||||
mOutput << "#" << sid+29 << "=DIRECTION('',(" << dv31.x << "," << dv31.y << "," << dv31.z << "))" << endstr;
|
||||
ind += faceEntryLen; // increase counter
|
||||
/* n lines and n vectors for the lines for the n edge curves */
|
||||
int vectorStart = lineStart + numIndices;
|
||||
for (int k=0; k < numIndices; ++k)
|
||||
{
|
||||
mOutput << "#" << lineStart+k << "=LINE('',#" << pidArray[k] << ",#" << vectorStart+k << ")" << endstr;
|
||||
}
|
||||
|
||||
int directionStart = vectorStart + numIndices;
|
||||
for (int k=0; k < numIndices; ++k)
|
||||
{
|
||||
mOutput << "#" << vectorStart+k << "=VECTOR('',#" << directionStart+k << ",1.0)" << endstr;
|
||||
}
|
||||
|
||||
for (int k=0; k < numIndices; ++k)
|
||||
{
|
||||
const aiVector3D &dv = dvArray[k];
|
||||
mOutput << "#" << directionStart + k << "=DIRECTION('',(" << dv.x << "," << dv.y << "," << dv.z << "))" << endstr;
|
||||
}
|
||||
ind += 15 + 5*numIndices; // increase counter
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -667,9 +667,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( (unsigned char) sz[ c ] ) ) {
|
||||
sz[ c ] = (char) tolower( (unsigned char) sz[ c ] );
|
||||
}
|
||||
sz[ c ] = (char) tolower( (unsigned char) sz[ c ] );
|
||||
}
|
||||
|
||||
// Place texture filename property under the corresponding name
|
||||
|
|
|
@ -196,7 +196,7 @@ inline std::string getCurrentAssetDir(const std::string &pFile) {
|
|||
std::string path = pFile;
|
||||
int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
|
||||
if (pos == int(std::string::npos)) {
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
return pFile.substr(0, pos + 1);
|
||||
|
|
|
@ -99,8 +99,8 @@ public:
|
|||
virtual ~Logger();
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a info message
|
||||
* @param message Info message*/
|
||||
/** @brief Writes a debug message
|
||||
* @param message Debug message*/
|
||||
void debug(const char* message);
|
||||
|
||||
template<typename... T>
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a debug message
|
||||
/** @brief Writes a debug message
|
||||
* @param message Debug message*/
|
||||
void verboseDebug(const char* message);
|
||||
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes an error message
|
||||
* @param message Info message*/
|
||||
* @param message Error message*/
|
||||
void error(const char* message);
|
||||
|
||||
template<typename... T>
|
||||
|
|
|
@ -194,7 +194,7 @@ uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int* max_ino
|
|||
|
||||
if ( *in < '0' || *in > '9' ) {
|
||||
// The string is known to be bad, so don't risk printing the whole thing.
|
||||
throw ExceptionType("The string \"", ai_str_toprintable(in, 30), "\" cannot be converted into a value." );
|
||||
throw ExceptionType("The string \"", ai_str_toprintable(in, (int)strlen(in)), "\" cannot be converted into a value." );
|
||||
}
|
||||
|
||||
for ( ;; ) {
|
||||
|
@ -294,7 +294,7 @@ const char* fast_atoreal_move(const char* c, Real& out, bool check_comma = true)
|
|||
if (!(c[0] >= '0' && c[0] <= '9') &&
|
||||
!((c[0] == '.' || (check_comma && c[0] == ',')) && c[1] >= '0' && c[1] <= '9')) {
|
||||
// The string is known to be bad, so don't risk printing the whole thing.
|
||||
throw ExceptionType("Cannot parse string \"", ai_str_toprintable(c, 30),
|
||||
throw ExceptionType("Cannot parse string \"", ai_str_toprintable(c, (int)strlen(c)),
|
||||
"\" as a real number: does not start with digit "
|
||||
"or decimal point followed by digit.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue