Przeglądaj źródła

Fixed fmin/fmax CRT library name collision.

bkaradzic 12 lat temu
rodzic
commit
a4df646179

+ 1 - 1
examples/14-shadowvolumes/shadowvolumes.cpp

@@ -1822,7 +1822,7 @@ void createNearClipVolume(float* __restrict _outPlanes24f
 bool clipTest(const float* _planes, uint8_t _planeNum, const Mesh& _mesh, const float* _scale, const float* _translate)
 {
 	float (*volumePlanes)[4] = (float(*)[4])_planes;
-	float scale = fmax(fmax(_scale[0], _scale[1]), _scale[2]);
+	float scale = fmaxf(fmaxf(_scale[0], _scale[1]), _scale[2]);
 
 	const GroupArray& groups = _mesh.m_groups;
 	for (GroupArray::const_iterator it = groups.begin(), itEnd = groups.end(); it != itEnd; ++it)

+ 5 - 3
examples/common/fpumath.h

@@ -12,19 +12,21 @@
 #include <math.h>
 #include <string.h>
 
-inline float fmin(float _a, float _b)
+#if BX_COMPILER_MSVC
+inline float fminf(float _a, float _b)
 {
 	return _a < _b ? _a : _b;
 }
 
-inline float fmax(float _a, float _b)
+inline float fmaxf(float _a, float _b)
 {
 	return _a > _b ? _a : _b;
 }
+#endif // BX_COMPILER_MSVC
 
 inline float fclamp(float _a, float _min, float _max)
 {
-	return fmin(fmax(_a, _min), _max);
+	return fminf(fmaxf(_a, _min), _max);
 }
 
 inline float fsaturate(float _a)