remove IntegralConstant hack

remove IntegralConstant hack

diff --git a/libs/math/aabb.h b/libs/math/aabb.h
index 1705613..21cf988 100644
--- a/libs/math/aabb.h
+++ b/libs/math/aabb.h
@@ -66,39 +66,39 @@ inline AABB aabb_for_minmax( const Vector3& min, const Vector3& max ){
 	return aabb;
 }
 
-template<typename Index>
+template<size_t Index>
 class AABBExtend
 {
 public:
 	static void apply( AABB& aabb, const Vector3& point ){
-		float displacement = point[Index::VALUE] - aabb.origin[Index::VALUE];
-		float half_difference = static_cast<float>( 0.5 * ( fabs( displacement ) - aabb.extents[Index::VALUE] ) );
+		float displacement = point[Index] - aabb.origin[Index];
+		float half_difference = static_cast<float>( 0.5 * ( fabs( displacement ) - aabb.extents[Index] ) );
 		if ( half_difference > 0.0f ) {
-			aabb.origin[Index::VALUE] += ( displacement >= 0.0f ) ? half_difference : -half_difference;
-			aabb.extents[Index::VALUE] += half_difference;
+			aabb.origin[Index] += ( displacement >= 0.0f ) ? half_difference : -half_difference;
+			aabb.extents[Index] += half_difference;
 		}
 	}
 	static void apply( AABB& aabb, const AABB& other ){
-		float displacement = other.origin[Index::VALUE] - aabb.origin[Index::VALUE];
-		float difference = other.extents[Index::VALUE] - aabb.extents[Index::VALUE];
+		float displacement = other.origin[Index] - aabb.origin[Index];
+		float difference = other.extents[Index] - aabb.extents[Index];
 		if ( fabs( displacement ) > fabs( difference ) ) {
 			float half_difference = static_cast<float>( 0.5 * ( fabs( displacement ) + difference ) );
 			if ( half_difference > 0.0f ) {
-				aabb.origin[Index::VALUE] += ( displacement >= 0.0f ) ? half_difference : -half_difference;
-				aabb.extents[Index::VALUE] += half_difference;
+				aabb.origin[Index] += ( displacement >= 0.0f ) ? half_difference : -half_difference;
+				aabb.extents[Index] += half_difference;
 			}
 		}
 		else if ( difference > 0.0f ) {
-			aabb.origin[Index::VALUE] = other.origin[Index::VALUE];
-			aabb.extents[Index::VALUE] = other.extents[Index::VALUE];
+			aabb.origin[Index] = other.origin[Index];
+			aabb.extents[Index] = other.extents[Index];
 		}
 	}
 };
 
 inline void aabb_extend_by_point( AABB& aabb, const Vector3& point ){
-	AABBExtend< IntegralConstant<0> >::apply( aabb, point );
-	AABBExtend< IntegralConstant<1> >::apply( aabb, point );
-	AABBExtend< IntegralConstant<2> >::apply( aabb, point );
+	AABBExtend< 0 >::apply( aabb, point );
+	AABBExtend< 1 >::apply( aabb, point );
+	AABBExtend< 2 >::apply( aabb, point );
 }
 
 inline void aabb_extend_by_point_safe( AABB& aabb, const Vector3& point ){
@@ -124,9 +124,9 @@ public:
 };
 
 inline void aabb_extend_by_aabb( AABB& aabb, const AABB& other ){
-	AABBExtend< IntegralConstant<0> >::apply( aabb, other );
-	AABBExtend< IntegralConstant<1> >::apply( aabb, other );
-	AABBExtend< IntegralConstant<2> >::apply( aabb, other );
+	AABBExtend< 0 >::apply( aabb, other );
+	AABBExtend< 1 >::apply( aabb, other );
+	AABBExtend< 2 >::apply( aabb, other );
 }
 
 inline void aabb_extend_by_aabb_safe( AABB& aabb, const AABB& other ){
@@ -145,26 +145,26 @@ inline void aabb_extend_by_vec3( AABB& aabb, const Vector3& extension ){
 
 
 
-template<typename Index>
+template<size_t Index>
 inline bool aabb_intersects_point_dimension( const AABB& aabb, const Vector3& point ){
-	return fabs( point[Index::VALUE] - aabb.origin[Index::VALUE] ) < aabb.extents[Index::VALUE];
+	return fabs( point[Index] - aabb.origin[Index] ) < aabb.extents[Index];
 }
 
 inline bool aabb_intersects_point( const AABB& aabb, const Vector3& point ){
-	return aabb_intersects_point_dimension< IntegralConstant<0> >( aabb, point )
-	    && aabb_intersects_point_dimension< IntegralConstant<1> >( aabb, point )
-	    && aabb_intersects_point_dimension< IntegralConstant<2> >( aabb, point );
+	return aabb_intersects_point_dimension< 0 >( aabb, point )
+	    && aabb_intersects_point_dimension< 1 >( aabb, point )
+	    && aabb_intersects_point_dimension< 2 >( aabb, point );
 }
 
-template<typename Index>
+template<size_t Index>
 inline bool aabb_intersects_aabb_dimension( const AABB& aabb, const AABB& other ){
-	return fabs( other.origin[Index::VALUE] - aabb.origin[Index::VALUE] ) < ( aabb.extents[Index::VALUE] + other.extents[Index::VALUE] );
+	return fabs( other.origin[Index] - aabb.origin[Index] ) < ( aabb.extents[Index] + other.extents[Index] );
 }
 
 inline bool aabb_intersects_aabb( const AABB& aabb, const AABB& other ){
-	return aabb_intersects_aabb_dimension< IntegralConstant<0> >( aabb, other )
-	    && aabb_intersects_aabb_dimension< IntegralConstant<1> >( aabb, other )
-	    && aabb_intersects_aabb_dimension< IntegralConstant<2> >( aabb, other );
+	return aabb_intersects_aabb_dimension< 0 >( aabb, other )
+	    && aabb_intersects_aabb_dimension< 1 >( aabb, other )
+	    && aabb_intersects_aabb_dimension< 2 >( aabb, other );
 }
 
 inline unsigned int aabb_classify_plane( const AABB& aabb, const Plane3& plane ){
diff --git a/libs/math/curve.h b/libs/math/curve.h
index 62c4a86..ac21c74 100644
--- a/libs/math/curve.h
+++ b/libs/math/curve.h
@@ -30,7 +30,7 @@
 #include <math/matrix.h>
 
 
-template<typename I, typename Degree>
+template<int I, int Degree>
 struct BernsteinPolynomial
 {
 	static double apply( double t ){
@@ -38,14 +38,8 @@ struct BernsteinPolynomial
 	}
 };
 
-typedef IntegralConstant<0> Zero;
-typedef IntegralConstant<1> One;
-typedef IntegralConstant<2> Two;
-typedef IntegralConstant<3> Three;
-typedef IntegralConstant<4> Four;
-
 template<>
-struct BernsteinPolynomial<Zero, Zero>
+struct BernsteinPolynomial<0, 0>
 {
 	static double apply( double t ){
 		return 1;
@@ -53,7 +47,7 @@ struct BernsteinPolynomial<Zero, Zero>
 };
 
 template<>
-struct BernsteinPolynomial<Zero, One>
+struct BernsteinPolynomial<0, 1>
 {
 	static double apply( double t ){
 		return 1 - t;
@@ -61,7 +55,7 @@ struct BernsteinPolynomial<Zero, One>
 };
 
 template<>
-struct BernsteinPolynomial<One, One>
+struct BernsteinPolynomial<1, 1>
 {
 	static double apply( double t ){
 		return t;
@@ -69,7 +63,7 @@ struct BernsteinPolynomial<One, One>
 };
 
 template<>
-struct BernsteinPolynomial<Zero, Two>
+struct BernsteinPolynomial<0, 2>
 {
 	static double apply( double t ){
 		return ( 1 - t ) * ( 1 - t );
@@ -77,7 +71,7 @@ struct BernsteinPolynomial<Zero, Two>
 };
 
 template<>
-struct BernsteinPolynomial<One, Two>
+struct BernsteinPolynomial<1, 2>
 {
 	static double apply( double t ){
 		return 2 * ( 1 - t ) * t;
@@ -85,7 +79,7 @@ struct BernsteinPolynomial<One, Two>
 };
 
 template<>
-struct BernsteinPolynomial<Two, Two>
+struct BernsteinPolynomial<2, 2>
 {
 	static double apply( double t ){
 		return t * t;
@@ -93,7 +87,7 @@ struct BernsteinPolynomial<Two, Two>
 };
 
 template<>
-struct BernsteinPolynomial<Zero, Three>
+struct BernsteinPolynomial<0, 3>
 {
 	static double apply( double t ){
 		return ( 1 - t ) * ( 1 - t ) * ( 1 - t );
@@ -101,7 +95,7 @@ struct BernsteinPolynomial<Zero, Three>
 };
 
 template<>
-struct BernsteinPolynomial<One, Three>
+struct BernsteinPolynomial<1, 3>
 {
 	static double apply( double t ){
 		return 3 * ( 1 - t ) * ( 1 - t ) * t;
@@ -109,7 +103,7 @@ struct BernsteinPolynomial<One, Three>
 };
 
 template<>
-struct BernsteinPolynomial<Two, Three>
+struct BernsteinPolynomial<2, 3>
 {
 	static double apply( double t ){
 		return 3 * ( 1 - t ) * t * t;
@@ -117,7 +111,7 @@ struct BernsteinPolynomial<Two, Three>
 };
 
 template<>
-struct BernsteinPolynomial<Three, Three>
+struct BernsteinPolynomial<3, 3>
 {
 	static double apply( double t ){
 		return t * t * t;
@@ -131,22 +125,22 @@ inline Vector3 CubicBezier_evaluate( const Vector3* firstPoint, double t ){
 	double denominator = 0;
 
 	{
-		double weight = BernsteinPolynomial<Zero, Three>::apply( t );
+		double weight = BernsteinPolynomial<0, 3>::apply( t );
 		result += vector3_scaled( *firstPoint++, weight );
 		denominator += weight;
 	}
 	{
-		double weight = BernsteinPolynomial<One, Three>::apply( t );

[... diff too long, it was truncated ...]

GitHub
sha: f8ab9a3b