fabsf() not working with TCC
Replaced by fabs() that seem to work ok
This commit is contained in:
parent
dbff40944a
commit
0148432588
6 changed files with 18 additions and 18 deletions
|
@ -244,8 +244,8 @@ void SetCameraMode(Camera camera, int mode)
|
||||||
distance.y = sqrtf(dx*dx + dy*dy);
|
distance.y = sqrtf(dx*dx + dy*dy);
|
||||||
|
|
||||||
// Camera angle calculation
|
// Camera angle calculation
|
||||||
cameraAngle.x = asinf(fabsf(dx)/distance.x); // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
|
cameraAngle.x = asinf(fabs(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.y = -asinf(fabs(dy)/distance.y); // Camera angle in plane XY (0 aligned with X, move positive CW)
|
||||||
|
|
||||||
// NOTE: Just testing what cameraAngle means
|
// NOTE: Just testing what cameraAngle means
|
||||||
//cameraAngle.x = 0.0f*DEG2RAD; // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
|
//cameraAngle.x = 0.0f*DEG2RAD; // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
|
||||||
|
|
2
src/external/jar_xm.h
vendored
2
src/external/jar_xm.h
vendored
|
@ -2365,7 +2365,7 @@ static void jar_xm_tick(jar_xm_context_t* ctx) {
|
||||||
float panning, volume;
|
float panning, volume;
|
||||||
|
|
||||||
panning = ch->panning +
|
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) {
|
if(ch->tremor_on) {
|
||||||
volume = .0f;
|
volume = .0f;
|
||||||
|
|
|
@ -1837,9 +1837,9 @@ void DrawBoundingBox(BoundingBox box, Color color)
|
||||||
{
|
{
|
||||||
Vector3 size;
|
Vector3 size;
|
||||||
|
|
||||||
size.x = fabsf(box.max.x - box.min.x);
|
size.x = fabs(box.max.x - box.min.x);
|
||||||
size.y = fabsf(box.max.y - box.min.y);
|
size.y = fabs(box.max.y - box.min.y);
|
||||||
size.z = fabsf(box.max.z - box.min.z);
|
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 };
|
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 };
|
RayHitInfo result = { 0 };
|
||||||
|
|
||||||
if (fabsf(ray.direction.y) > EPSILON)
|
if (fabs(ray.direction.y) > EPSILON)
|
||||||
{
|
{
|
||||||
float distance = (ray.position.y - groundHeight)/-ray.direction.y;
|
float distance = (ray.position.y - groundHeight)/-ray.direction.y;
|
||||||
|
|
||||||
|
|
|
@ -296,17 +296,17 @@ RMDEF Vector3 Vector3Perpendicular(Vector3 v)
|
||||||
{
|
{
|
||||||
Vector3 result = { 0 };
|
Vector3 result = { 0 };
|
||||||
|
|
||||||
float min = fabsf(v.x);
|
float min = fabs(v.x);
|
||||||
Vector3 cardinalAxis = {1.0f, 0.0f, 0.0f};
|
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};
|
Vector3 tmp = {0.0f, 1.0f, 0.0f};
|
||||||
cardinalAxis = tmp;
|
cardinalAxis = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fabsf(v.z) < min)
|
if (fabs(v.z) < min)
|
||||||
{
|
{
|
||||||
Vector3 tmp = {0.0f, 0.0f, 1.0f};
|
Vector3 tmp = {0.0f, 0.0f, 1.0f};
|
||||||
cardinalAxis = tmp;
|
cardinalAxis = tmp;
|
||||||
|
|
|
@ -3948,7 +3948,7 @@ static void SetStereoConfig(VrDeviceInfo hmd)
|
||||||
|
|
||||||
// Compute distortion scale parameters
|
// Compute distortion scale parameters
|
||||||
// NOTE: To get lens max radius, lensShift must be normalized to [-1..1]
|
// 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 lensRadiusSq = lensRadius*lensRadius;
|
||||||
float distortionScale = hmd.lensDistortionValues[0] +
|
float distortionScale = hmd.lensDistortionValues[0] +
|
||||||
hmd.lensDistortionValues[1]*lensRadiusSq +
|
hmd.lensDistortionValues[1]*lensRadiusSq +
|
||||||
|
|
12
src/shapes.c
12
src/shapes.c
|
@ -648,8 +648,8 @@ bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2)
|
||||||
{
|
{
|
||||||
bool collision = false;
|
bool collision = false;
|
||||||
|
|
||||||
float dx = fabsf((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2));
|
float dx = fabs((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2));
|
||||||
float dy = fabsf((rec1.y + rec1.height/2) - (rec2.y + rec2.height/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;
|
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 recCenterX = rec.x + rec.width/2;
|
||||||
int recCenterY = rec.y + rec.height/2;
|
int recCenterY = rec.y + rec.height/2;
|
||||||
|
|
||||||
float dx = fabsf(center.x - recCenterX);
|
float dx = fabs(center.x - recCenterX);
|
||||||
float dy = fabsf(center.y - recCenterY);
|
float dy = fabs(center.y - recCenterY);
|
||||||
|
|
||||||
if (dx > (rec.width/2.0f + radius)) { return false; }
|
if (dx > (rec.width/2.0f + radius)) { return false; }
|
||||||
if (dy > (rec.height/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))
|
if (CheckCollisionRecs(rec1, rec2))
|
||||||
{
|
{
|
||||||
float dxx = fabsf(rec1.x - rec2.x);
|
float dxx = fabs(rec1.x - rec2.x);
|
||||||
float dyy = fabsf(rec1.y - rec2.y);
|
float dyy = fabs(rec1.y - rec2.y);
|
||||||
|
|
||||||
if (rec1.x <= rec2.x)
|
if (rec1.x <= rec2.x)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue