浏览代码

fabsf() not working with TCC

Replaced by fabs() that seem to work ok
Ray 7 年之前
父节点
当前提交
0148432588
共有 6 个文件被更改,包括 18 次插入18 次删除
  1. 2 2
      src/camera.h
  2. 1 1
      src/external/jar_xm.h
  3. 4 4
      src/models.c
  4. 4 4
      src/raymath.h
  5. 1 1
      src/rlgl.c
  6. 6 6
      src/shapes.c

+ 2 - 2
src/camera.h

@@ -244,8 +244,8 @@ void SetCameraMode(Camera camera, int mode)
     distance.y = sqrtf(dx*dx + dy*dy);
     
     // Camera angle calculation
-    cameraAngle.x = asinf(fabsf(dx)/distance.x);  // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
-    cameraAngle.y = -asinf(fabsf(dy)/distance.y); // Camera angle in plane XY (0 aligned with X, move positive CW)
+    cameraAngle.x = asinf(fabs(dx)/distance.x);  // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
+    cameraAngle.y = -asinf(fabs(dy)/distance.y); // Camera angle in plane XY (0 aligned with X, move positive CW)
     
     // NOTE: Just testing what cameraAngle means
     //cameraAngle.x = 0.0f*DEG2RAD;       // Camera angle in plane XZ (0 aligned with Z, move positive CCW)

+ 1 - 1
src/external/jar_xm.h

@@ -2365,7 +2365,7 @@ static void jar_xm_tick(jar_xm_context_t* ctx) {
         float panning, volume;
 
         panning = ch->panning +
-            (ch->panning_envelope_panning - .5f) * (.5f - fabsf(ch->panning - .5f)) * 2.0f;
+            (ch->panning_envelope_panning - .5f) * (.5f - fabs(ch->panning - .5f)) * 2.0f;
 
         if(ch->tremor_on) {
                 volume = .0f;

+ 4 - 4
src/models.c

@@ -1837,9 +1837,9 @@ void DrawBoundingBox(BoundingBox box, Color color)
 {
     Vector3 size;
 
-    size.x = fabsf(box.max.x - box.min.x);
-    size.y = fabsf(box.max.y - box.min.y);
-    size.z = fabsf(box.max.z - box.min.z);
+    size.x = fabs(box.max.x - box.min.x);
+    size.y = fabs(box.max.y - box.min.y);
+    size.z = fabs(box.max.z - box.min.z);
 
     Vector3 center = { box.min.x + size.x/2.0f, box.min.y + size.y/2.0f, box.min.z + size.z/2.0f };
 
@@ -2074,7 +2074,7 @@ RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight)
 
     RayHitInfo result = { 0 };
 
-    if (fabsf(ray.direction.y) > EPSILON)
+    if (fabs(ray.direction.y) > EPSILON)
     {
         float distance = (ray.position.y - groundHeight)/-ray.direction.y;
 

+ 4 - 4
src/raymath.h

@@ -296,17 +296,17 @@ RMDEF Vector3 Vector3Perpendicular(Vector3 v)
 {
     Vector3 result = { 0 };
 
-    float min = fabsf(v.x);
+    float min = fabs(v.x);
     Vector3 cardinalAxis = {1.0f, 0.0f, 0.0f};
 
-    if (fabsf(v.y) < min)
+    if (fabs(v.y) < min)
     {
-        min = fabsf(v.y);
+        min = fabs(v.y);
         Vector3 tmp = {0.0f, 1.0f, 0.0f};
         cardinalAxis = tmp;
     }
 
-    if (fabsf(v.z) < min)
+    if (fabs(v.z) < min)
     {
         Vector3 tmp = {0.0f, 0.0f, 1.0f};
         cardinalAxis = tmp;

+ 1 - 1
src/rlgl.c

@@ -3948,7 +3948,7 @@ static void SetStereoConfig(VrDeviceInfo hmd)
 
     // Compute distortion scale parameters
     // NOTE: To get lens max radius, lensShift must be normalized to [-1..1]
-    float lensRadius = fabsf(-1.0f - 4.0f*lensShift);
+    float lensRadius = fabs(-1.0f - 4.0f*lensShift);
     float lensRadiusSq = lensRadius*lensRadius;
     float distortionScale = hmd.lensDistortionValues[0] +
                             hmd.lensDistortionValues[1]*lensRadiusSq +

+ 6 - 6
src/shapes.c

@@ -648,8 +648,8 @@ bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2)
 {
     bool collision = false;
 
-    float dx = fabsf((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2));
-    float dy = fabsf((rec1.y + rec1.height/2) - (rec2.y + rec2.height/2));
+    float dx = fabs((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2));
+    float dy = fabs((rec1.y + rec1.height/2) - (rec2.y + rec2.height/2));
 
     if ((dx <= (rec1.width/2 + rec2.width/2)) && ((dy <= (rec1.height/2 + rec2.height/2)))) collision = true;
 
@@ -678,8 +678,8 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
     int recCenterX = rec.x + rec.width/2;
     int recCenterY = rec.y + rec.height/2;
     
-    float dx = fabsf(center.x - recCenterX);
-    float dy = fabsf(center.y - recCenterY);
+    float dx = fabs(center.x - recCenterX);
+    float dy = fabs(center.y - recCenterY);
 
     if (dx > (rec.width/2.0f + radius)) { return false; }
     if (dy > (rec.height/2.0f + radius)) { return false; }
@@ -700,8 +700,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
 
     if (CheckCollisionRecs(rec1, rec2))
     {
-        float dxx = fabsf(rec1.x - rec2.x);
-        float dyy = fabsf(rec1.y - rec2.y);
+        float dxx = fabs(rec1.x - rec2.x);
+        float dyy = fabs(rec1.y - rec2.y);
 
         if (rec1.x <= rec2.x)
         {