瀏覽代碼

Fix compilation on VS2013 due to compiler bug with brace initialisers. This fixes issue #2678.

Paul Arden 5 年之前
父節點
當前提交
e6a051d953
共有 2 個文件被更改,包括 20 次插入10 次删除
  1. 14 1
      code/Common/BaseImporter.cpp
  2. 6 9
      include/assimp/BaseImporter.h

+ 14 - 1
code/Common/BaseImporter.cpp

@@ -67,7 +67,20 @@ using namespace Assimp;
 // Constructor to be privately used by Importer
 // Constructor to be privately used by Importer
 BaseImporter::BaseImporter() AI_NO_EXCEPT
 BaseImporter::BaseImporter() AI_NO_EXCEPT
 : m_progress() {
 : m_progress() {
-    // nothing to do here
+    /**
+    * Assimp Importer
+    * unit conversions available
+    * if you need another measurment unit add it below.
+    * it's currently defined in assimp that we prefer meters.
+    *
+    * NOTE: Initialised here rather than in the header file
+    * to workaround a VS2013 bug with brace initialisers
+    * */
+    importerUnits[ImporterUnits::M] = 1.0;
+    importerUnits[ImporterUnits::CM] = 0.01;
+    importerUnits[ImporterUnits::MM] = 0.001;
+    importerUnits[ImporterUnits::INCHES] = 0.0254;
+    importerUnits[ImporterUnits::FEET] = 0.3048;
 }
 }
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------

+ 6 - 9
include/assimp/BaseImporter.h

@@ -196,16 +196,13 @@ public:
     /**
     /**
      * Assimp Importer
      * Assimp Importer
      * unit conversions available 
      * unit conversions available 
-     * if you need another measurment unit add it below.
-     * it's currently defined in assimp that we prefer meters.
+     * NOTE: Valid options are initialised in the
+     * constructor in the implementation file to
+     * work around a VS2013 compiler bug if support
+     * for that compiler is dropped in the future
+     * initialisation can be moved back here
      * */
      * */
-    std::map<ImporterUnits, double> importerUnits = {
-        {ImporterUnits::M, 1},
-        {ImporterUnits::CM, 0.01},
-        {ImporterUnits::MM, 0.001},
-        {ImporterUnits::INCHES, 0.0254},
-        {ImporterUnits::FEET, 0.3048}
-    };
+    std::map<ImporterUnits, double> importerUnits;
 
 
     virtual void SetApplicationUnits( const ImporterUnits& unit )
     virtual void SetApplicationUnits( const ImporterUnits& unit )
     {
     {