3MF: reformattings.
authorKim Kulling <kim.kulling@goolemail.com>
Mon, 27 Mar 2017 22:35:56 +0000 (00:35 +0200)
committerKim Kulling <kim.kulling@goolemail.com>
Mon, 27 Mar 2017 22:35:56 +0000 (00:35 +0200)
code/D3MFImporter.cpp
packaging/windows-innosetup/script.iss

index 500b275..0d006d9 100644 (file)
@@ -87,14 +87,11 @@ namespace XmlTag {
     static const std::string transform = "transform";
 }
 
-
-class XmlSerializer
-{
+class XmlSerializer {
 public:
     XmlSerializer(XmlReader* xmlReader)
-        : xmlReader(xmlReader)
-    {
-
+    : xmlReader(xmlReader) {
+        // empty
     }
 
     void ImportXml(aiScene* scene) {
@@ -109,8 +106,9 @@ public:
             }
         }
 
-        if(scene->mRootNode->mName.length == 0)
-            scene->mRootNode->mName.Set("3MF");
+        if ( scene->mRootNode->mName.length == 0 ) {
+            scene->mRootNode->mName.Set( "3MF" );
+        }
 
         scene->mNumMeshes = static_cast<unsigned int>(meshes.size());
         scene->mMeshes = new aiMesh*[scene->mNumMeshes]();
@@ -121,12 +119,10 @@ public:
         scene->mRootNode->mChildren = new aiNode*[scene->mRootNode->mNumChildren]();
 
         std::copy(children.begin(), children.end(), scene->mRootNode->mChildren);
-
     }
 
 private:
-    aiNode* ReadObject(aiScene* scene)
-    {
+    aiNode* ReadObject(aiScene* scene) {
         ScopeGuard<aiNode> node(new aiNode());
 
         std::vector<unsigned long> meshIds;
@@ -147,17 +143,14 @@ private:
 
         size_t meshIdx = meshes.size();
 
-        while(ReadToEndElement(D3MF::XmlTag::object))
-        {
-            if(xmlReader->getNodeName() == D3MF::XmlTag::mesh)
-            {
+        while(ReadToEndElement(D3MF::XmlTag::object)) {
+            if(xmlReader->getNodeName() == D3MF::XmlTag::mesh) {
                 auto mesh = ReadMesh();
 
                 mesh->mName.Set(name);
                 meshes.push_back(mesh);
                 meshIds.push_back(static_cast<unsigned long>(meshIdx));
                 meshIdx++;
-
             }
         }
 
@@ -168,49 +161,35 @@ private:
         std::copy(meshIds.begin(), meshIds.end(), node->mMeshes);
 
         return node.dismiss();
-
     }
 
-    aiMesh* ReadMesh()
-    {
+    aiMesh* ReadMesh() {
         aiMesh* mesh = new aiMesh();
-
-        while(ReadToEndElement(D3MF::XmlTag::mesh))
-        {
-            if(xmlReader->getNodeName() == D3MF::XmlTag::vertices)
-            {
+        while(ReadToEndElement(D3MF::XmlTag::mesh)) {
+            if(xmlReader->getNodeName() == D3MF::XmlTag::vertices) {
                 ImportVertices(mesh);
-            }
-            else if(xmlReader->getNodeName() == D3MF::XmlTag::triangles)
-            {
+            } else if(xmlReader->getNodeName() == D3MF::XmlTag::triangles) {
                 ImportTriangles(mesh);
             }
-
         }
 
-
         return mesh;
     }
 
-    void ImportVertices(aiMesh* mesh)
-    {
+    void ImportVertices(aiMesh* mesh) {
         std::vector<aiVector3D> vertices;
 
-        while(ReadToEndElement(D3MF::XmlTag::vertices))
-        {
-            if(xmlReader->getNodeName() == D3MF::XmlTag::vertex)
-            {
+        while ( ReadToEndElement(D3MF::XmlTag::vertices) ) {
+            if(xmlReader->getNodeName() == D3MF::XmlTag::vertex) {
                 vertices.push_back(ReadVertex());
             }
         }
         mesh->mNumVertices = static_cast<unsigned int>(vertices.size());
         mesh->mVertices = new aiVector3D[mesh->mNumVertices];
-
         std::copy(vertices.begin(), vertices.end(), mesh->mVertices);
-
     }
-    aiVector3D ReadVertex()
-    {
+
+    aiVector3D ReadVertex() {
         aiVector3D vertex;
 
         vertex.x = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr);
@@ -220,15 +199,11 @@ private:
         return vertex;
     }
 
-    void ImportTriangles(aiMesh* mesh)
-    {
+    void ImportTriangles(aiMesh* mesh) {
          std::vector<aiFace> faces;
 
-
-         while(ReadToEndElement(D3MF::XmlTag::triangles))
-         {
-             if(xmlReader->getNodeName() == D3MF::XmlTag::triangle)
-             {
+         while(ReadToEndElement(D3MF::XmlTag::triangles)) {
+             if(xmlReader->getNodeName() == D3MF::XmlTag::triangle) {
                  faces.push_back(ReadTriangle());
              }
          }
@@ -239,13 +214,10 @@ private:
 
 
         std::copy(faces.begin(), faces.end(), mesh->mFaces);
-
     }
 
-    aiFace ReadTriangle()
-    {
+    aiFace ReadTriangle() {
         aiFace face;
-
         face.mNumIndices = 3;
         face.mIndices = new unsigned int[face.mNumIndices];
         face.mIndices[0] = static_cast<unsigned int>(std::atoi(xmlReader->getAttributeValue(D3MF::XmlTag::v1.c_str())));
@@ -256,35 +228,25 @@ private:
     }
 
 private:
-
-    bool ReadToStartElement(const std::string& startTag)
-    {
-        while(xmlReader->read())
-        {
-            if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT && xmlReader->getNodeName() == startTag)
-            {
+    bool ReadToStartElement(const std::string& startTag) {
+        while(xmlReader->read()) {
+            if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT && xmlReader->getNodeName() == startTag) {
                 return true;
-            }
-            else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END &&
-                     xmlReader->getNodeName() == startTag)
-            {
+            } else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END &&
+                     xmlReader->getNodeName() == startTag) {
                 return false;
             }
         }
-        //DefaultLogger::get()->error("unexpected EOF, expected closing <" + closeTag + "> tag");
+//        DefaultLogger::get()->error("unexpected EOF, expected closing <" + closeTag + "> tag");
         return false;
     }
 
-    bool ReadToEndElement(const std::string& closeTag)
-    {
-        while(xmlReader->read())
-        {
+    bool ReadToEndElement(const std::string& closeTag) {
+        while(xmlReader->read()) {
             if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT) {
                 return true;
-            }
-            else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END
-                     && xmlReader->getNodeName() == closeTag)
-            {
+            } else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END
+                     && xmlReader->getNodeName() == closeTag) {
                 return false;
             }
         }
@@ -292,7 +254,6 @@ private:
         return false;
     }
 
-
 private:
     std::vector<aiMesh*> meshes;
     XmlReader* xmlReader;
@@ -300,7 +261,6 @@ private:
 
 } //namespace D3MF
 
-
 static const aiImporterDesc desc = {
     "3mf Importer",
     "",
@@ -314,19 +274,15 @@ static const aiImporterDesc desc = {
     "3mf"
 };
 
-
-D3MFImporter::D3MFImporter()
-{
-
+D3MFImporter::D3MFImporter() {
+    // empty
 }
 
-D3MFImporter::~D3MFImporter()
-{
-
+D3MFImporter::~D3MFImporter() {
+    // empty
 }
 
-bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const
-{
+bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const {
     const std::string extension = GetExtension(pFile);
     if(extension == "3mf") {
         return true;
@@ -339,18 +295,15 @@ bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool
     return false;
 }
 
-void D3MFImporter::SetupProperties(const Importer *pImp)
-{
-
+void D3MFImporter::SetupProperties(const Importer *pImp) {
+    // empty
 }
 
-const aiImporterDesc *D3MFImporter::GetInfo() const
-{
+const aiImporterDesc *D3MFImporter::GetInfo() const {
     return &desc;
 }
 
-void D3MFImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler)
-{
+void D3MFImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
     D3MF::D3MFOpcPackage opcPackage(pIOHandler, pFile);
 
     std::unique_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(opcPackage.RootStream()));
index d8e0d08..648cf6f 100644 (file)
@@ -19,35 +19,32 @@ VersionInfoCompany=Assimp Development Team
 ArchitecturesInstallIn64BitMode=x64\r
 \r
 [Types]\r
-Name: "full"; Description: "Full installation"\r
+Name: "full";    Description: "Full installation"\r
 Name: "compact"; Description: "Compact installation, no test models or language bindings"\r
-Name: "custom"; Description: "Custom installation"; Flags: iscustom\r
+Name: "custom";  Description: "Custom installation"; Flags: iscustom\r
 \r
 [Components]\r
-Name: "main"; Description: "Main Files (32 and 64 Bit)"; Types: full compact custom; Flags: fixed\r
-Name: "tools"; Description: "Asset Viewer & Command Line Tools (32 and 64 Bit)"; Types: full compact\r
-Name: "help"; Description: "Help Files"; Types: full compact\r
-Name: "samples"; Description: "Samples"; Types: full\r
-;Name: "wsource"; Description: "Source Code"; Types: full\r
-Name: "test"; Description: "Test Models (BSD-licensed)"; Types: full\r
+Name: "main";        Description: "Main Files (32 and 64 Bit)"; Types: full compact custom; Flags: fixed\r
+Name: "tools";       Description: "Asset Viewer & Command Line Tools (32 and 64 Bit)"; Types: full compact\r
+Name: "help";        Description: "Help Files"; Types: full compact\r
+Name: "samples";     Description: "Samples"; Types: full\r
+Name: "test";        Description: "Test Models (BSD-licensed)"; Types: full\r
 Name: "test_nonbsd"; Description: "Test Models (other (free) licenses)"; Types: full\r
-Name: "pyassimp"; Description: "Python Bindings"; Types: full\r
-Name: "dassimp"; Description: "D Bindings"; Types: full\r
-Name: "assimp_net"; Description: "C#/.NET Bindings"; Types: full\r
-;Name: "vc8"; Description: "VC8 project files"; Types: full\r
-;Name: "vc9"; Description: "VC9 project files"; Types: full\r
+Name: "pyassimp";    Description: "Python Bindings"; Types: full\r
+Name: "dassimp";     Description: "D Bindings"; Types: full\r
+Name: "assimp_net";  Description: "C#/.NET Bindings"; Types: full\r
 \r
 [Run]\r
-Filename: "{app}\stub\vcredist_x86.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2012 SP1 redistributable package (32 Bit)"; Check: not IsWin64\r
-Filename: "{app}\stub\vcredist_x64.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2012 SP1 redistributable package (64 Bit)"; Check: IsWin64\r
+Filename: "{app}\stub\vc_redist.x86.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2015 redistributable package (32 Bit)"; Check: not IsWin64\r
+Filename: "{app}\stub\vc_redist.x64.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2015 redistributable package (64 Bit)"; Check: IsWin64\r
 \r
 [Files]\r
 \r
 Source: "readme_installer.txt"; DestDir: "{app}"; Flags: isreadme\r
 \r
 ; Installer stub\r
-Source: "vcredist_x86.exe"; DestDir: "{app}\stub\"; Check: not IsWin64\r
-Source: "vcredist_x64.exe"; DestDir: "{app}\stub\"; Check: IsWin64\r
+Source: "vc_redist.x86.exe"; DestDir: "{app}\stub\"; Check: not IsWin64\r
+Source: "vc_redist.x64.exe"; DestDir: "{app}\stub\"; Check: IsWin64\r
 \r
 ; Common stuff\r
 Source: "..\..\CREDITS"; DestDir: "{app}"\r
@@ -58,18 +55,18 @@ Source: "WEB"; DestDir: "{app}"
 Source: "..\..\scripts\*"; DestDir: "{app}\scripts"; Flags: recursesubdirs\r
 \r
 ; x86 binaries\r
-Source: "..\..\bin\assimp_release-dll_Win32\Assimp32.dll"; DestDir: "{app}\bin\x86"\r
-Source: "..\..\bin\assimpview_release-dll_Win32\assimp_view.exe"; DestDir: "{app}\bin\x86"; Components: tools\r
-Source: "D3DCompiler_42.dll"; DestDir: "{app}\bin\x86"; Components: tools\r
-Source: "D3DX9_42.dll"; DestDir: "{app}\bin\x86"; Components: tools\r
-Source: "..\..\bin\assimpcmd_release-dll_Win32\assimp.exe"; DestDir: "{app}\bin\x86"; Components: tools\r
+Source: "..\..\bin\release\x86\assimp-vc140-mt.dll";  DestDir: "{app}\bin\x86"\r
+Source: "..\..\bin\release\x86\assimp_view.exe";      DestDir: "{app}\bin\x86"; Components: tools\r
+Source: "D3DCompiler_42.dll";                         DestDir: "{app}\bin\x86"; Components: tools\r
+Source: "D3DX9_42.dll";                               DestDir: "{app}\bin\x86"; Components: tools\r
+Source: "..\..\bin\release\x86\assimp.exe";           DestDir: "{app}\bin\x86"; Components: tools\r
 \r
 ; x64 binaries\r
-Source: "..\..\bin\assimp_release-dll_x64\Assimp64.dll"; DestDir: "{app}\bin\x64"\r
-Source: "..\..\bin\assimpview_release-dll_x64\assimp_view.exe"; DestDir: "{app}\bin\x64"; Components: tools\r
-Source: "D3DCompiler_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DCompiler_42.dll"; Components: tools\r
-Source: "D3DX9_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DX9_42.dll"; Components: tools\r
-Source: "..\..\bin\assimpcmd_release-dll_x64\assimp.exe"; DestDir: "{app}\bin\x64"; Components: tools\r
+Source: "..\..\bin\release\x64\assimp-vc140-mt.dll";  DestDir: "{app}\bin\x64"\r
+Source: "..\..\bin\release\x64\assimp_view.exe";      DestDir: "{app}\bin\x64"; Components: tools\r
+Source: "D3DCompiler_42_x64.dll";                     DestDir: "{app}\bin\x64"; DestName: "D3DCompiler_42.dll"; Components: tools\r
+Source: "D3DX9_42_x64.dll";                           DestDir: "{app}\bin\x64"; DestName: "D3DX9_42.dll"; Components: tools\r
+Source: "..\..\bin\release\x64\assimp.exe";           DestDir: "{app}\bin\x64"; Components: tools\r
 \r
 ; Documentation\r
 Source: "..\..\doc\AssimpDoc_Html\AssimpDoc.chm"; DestDir: "{app}\doc"; Components: help\r