Browse Source

Use std::numeric_limits for double max

Cory Fabre 5 years ago
parent
commit
136996e1f6
2 changed files with 6 additions and 4 deletions
  1. 3 2
      code/glTF/glTFExporter.cpp
  2. 3 2
      code/glTF2/glTF2Exporter.cpp

+ 3 - 2
code/glTF/glTFExporter.cpp

@@ -58,6 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 // Header files, standard library.
 #include <memory>
+#include <limits>
 #include <inttypes.h>
 
 #ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
@@ -181,8 +182,8 @@ void SetAccessorRange(Ref<Accessor> acc, void* data, unsigned int count,
 
 	// Allocate and initialize with large values.
 	for (unsigned int i = 0 ; i < numCompsOut ; i++) {
-		acc->min.push_back(DBL_MAX);
-		acc->max.push_back(DBL_MIN);
+		acc->min.push_back( std::numeric_limits<double>::max());
+		acc->max.push_back(-std::numeric_limits<double>::max());
 	}
 
 	size_t totalComps = count * numCompsIn;

+ 3 - 2
code/glTF2/glTF2Exporter.cpp

@@ -58,6 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 // Header files, standard library.
 #include <memory>
+#include <limits>
 #include <inttypes.h>
 
 using namespace rapidjson;
@@ -160,8 +161,8 @@ void SetAccessorRange(Ref<Accessor> acc, void* data, size_t count,
 
 	// Allocate and initialize with large values.
 	for (unsigned int i = 0 ; i < numCompsOut ; i++) {
-		acc->min.push_back(DBL_MAX);
-		acc->max.push_back(DBL_MIN);
+		acc->min.push_back( std::numeric_limits<double>::max());
+		acc->max.push_back(-std::numeric_limits<double>::max());
 	}
 
 	size_t totalComps = count * numCompsIn;