[Bf-blender-cvs] [28054d8] master: remove MAXFLOAT define

Campbell Barton noreply at git.blender.org
Thu Aug 14 02:36:50 CEST 2014


Commit: 28054d8e386dbaee80d439fdf9c7ba7eb6bfe39f
Author: Campbell Barton
Date:   Thu Aug 14 10:36:07 2014 +1000
Branches: master
https://developer.blender.org/rB28054d8e386dbaee80d439fdf9c7ba7eb6bfe39f

remove MAXFLOAT define

===================================================================

M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/blenlib/BLI_math_base.h
M	source/blender/compositor/intern/COM_ChunkOrder.cpp
M	source/blender/compositor/operations/COM_DilateErodeOperation.cpp
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index cde6d02..e32b46f 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -2638,7 +2638,7 @@ static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr)
 		mul_v3_v3fl(sphdata->flow, flow, 1.0f / pfr->tot_neighbors);
 	}
 	else {
-		sphdata->element_size = MAXFLOAT;
+		sphdata->element_size = FLT_MAX;
 		copy_v3_v3(sphdata->flow, flow);
 	}
 }
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index b639df4..5f94f04 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -75,11 +75,6 @@
 #define M_LN10          2.30258509299404568402
 #endif
 
-/* non-standard defines, used in some places */
-#ifndef MAXFLOAT
-#define MAXFLOAT  ((float)3.40282347e+38)
-#endif
-
 #if defined(__GNUC__)
 #  define NAN_FLT __builtin_nanf("")
 #else
diff --git a/source/blender/compositor/intern/COM_ChunkOrder.cpp b/source/blender/compositor/intern/COM_ChunkOrder.cpp
index 1b7c435..3b09460 100644
--- a/source/blender/compositor/intern/COM_ChunkOrder.cpp
+++ b/source/blender/compositor/intern/COM_ChunkOrder.cpp
@@ -34,7 +34,7 @@ ChunkOrder::ChunkOrder()
 void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int numberOfHotspots)
 {
 	unsigned int index;
-	double distance = MAXFLOAT;
+	double distance = FLT_MAX;
 	for (index = 0; index < numberOfHotspots; index++) {
 		ChunkOrderHotspot *hotspot = hotspots[index];
 		double ndistance = hotspot->determineDistance(this->m_x, this->m_y);
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
index b54e47c..cbf4ce6 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
@@ -371,7 +371,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect)
 	float *rectf = result->buffer;
 
 	// temp holds maxima for every step in the algorithm, buf holds a
-	// single row or column of input values, padded with MAXFLOATs to
+	// single row or column of input values, padded with FLT_MAX's to
 	// simplify the logic.
 	float *temp = (float *)MEM_mallocN(sizeof(float) * (2 * window - 1), "dilate erode temp");
 	float *buf = (float *)MEM_mallocN(sizeof(float) * (max(bwidth, bheight) + 5 * half_window), "dilate erode buf");
@@ -380,7 +380,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect)
 	// first pass, horizontal dilate/erode
 	for (y = ymin; y < ymax; y++) {
 		for (x = 0; x < bwidth + 5 * half_window; x++) {
-			buf[x] = -MAXFLOAT;
+			buf[x] = -FLT_MAX;
 		}
 		for (x = xmin; x < xmax; ++x) {
 			buf[x - rect->xmin + window - 1] = buffer[4 * (y * width + x)];
@@ -405,7 +405,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect)
 	// second pass, vertical dilate/erode
 	for (x = 0; x < bwidth; x++) {
 		for (y = 0; y < bheight + 5 * half_window; y++) {
-			buf[y] = -MAXFLOAT;
+			buf[y] = -FLT_MAX;
 		}
 		for (y = ymin; y < ymax; y++) {
 			buf[y - rect->ymin + window - 1] = rectf[(y - ymin) * bwidth + x];
@@ -498,7 +498,7 @@ void *ErodeStepOperation::initializeTileData(rcti *rect)
 	float *rectf = result->buffer;
 
 	// temp holds maxima for every step in the algorithm, buf holds a
-	// single row or column of input values, padded with MAXFLOATs to
+	// single row or column of input values, padded with FLT_MAX's to
 	// simplify the logic.
 	float *temp = (float *)MEM_mallocN(sizeof(float) * (2 * window - 1), "dilate erode temp");
 	float *buf = (float *)MEM_mallocN(sizeof(float) * (max(bwidth, bheight) + 5 * half_window), "dilate erode buf");
@@ -507,7 +507,7 @@ void *ErodeStepOperation::initializeTileData(rcti *rect)
 	// first pass, horizontal dilate/erode
 	for (y = ymin; y < ymax; y++) {
 		for (x = 0; x < bwidth + 5 * half_window; x++) {
-			buf[x] = MAXFLOAT;
+			buf[x] = FLT_MAX;
 		}
 		for (x = xmin; x < xmax; ++x) {
 			buf[x - rect->xmin + window - 1] = buffer[4 * (y * width + x)];
@@ -532,7 +532,7 @@ void *ErodeStepOperation::initializeTileData(rcti *rect)
 	// second pass, vertical dilate/erode
 	for (x = 0; x < bwidth; x++) {
 		for (y = 0; y < bheight + 5 * half_window; y++) {
-			buf[y] = MAXFLOAT;
+			buf[y] = FLT_MAX;
 		}
 		for (y = ymin; y < ymax; y++) {
 			buf[y - rect->ymin + window - 1] = rectf[(y - ymin) * bwidth + x];
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 1c6d0fa..682a7f4 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3262,7 +3262,7 @@ static void rna_def_bake_data(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 
 	prop = RNA_def_property(srna, "cage_extrusion", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_range(prop, 0.0, MAXFLOAT);
+	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
 	RNA_def_property_ui_text(prop, "Cage Extrusion",
 	                         "Distance to use for the inward ray cast when using selected to active");




More information about the Bf-blender-cvs mailing list