renamed SDL PI constants to SDL_PI_D and SDL_PI_F.
parent
199423612c
commit
0b8309da0c
|
@ -6,6 +6,6 @@ This is a list of major changes in SDL's version history.
|
|||
---------------------------------------------------------------------------
|
||||
|
||||
General:
|
||||
* M_PI is no longer defined in SDL_stdinc.h, now the symbols SDL_M_PIl (double) and SDL_M_PIf (float) are available
|
||||
* M_PI is no longer defined in SDL_stdinc.h, now the symbols SDL_PI_D (double) and SDL_PI_F (float) are available
|
||||
* SDL_GetWindowWMInfo() returns a standard int result code instead of SDL_bool, and takes SDL_SYSWM_CURRENT_VERSION as a new third parameter
|
||||
* SDL_RWFromFP has been removed from the API
|
||||
|
|
|
@ -119,7 +119,7 @@ SDL_RWFromFP(void *fp, SDL_bool autoclose)
|
|||
|
||||
## SDL_stdinc.h
|
||||
|
||||
M_PI is no longer defined in SDL_stdinc.h, you can use the new symbols SDL_M_PIl (double) and SDL_M_PIf (float) instead.
|
||||
M_PI is no longer defined in SDL_stdinc.h, you can use the new symbols SDL_PI_D (double) and SDL_PI_F (float) instead.
|
||||
|
||||
## SDL_syswm.h
|
||||
|
||||
|
|
|
@ -608,11 +608,11 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size
|
|||
extern DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, const char *fmt, va_list ap);
|
||||
|
||||
#ifndef SDL_M_PIl
|
||||
#define SDL_M_PIl 3.141592653589793238462643383279502884L /**< pi (double) */
|
||||
#ifndef SDL_PI_D
|
||||
#define SDL_PI_D 3.141592653589793238462643383279502884L /**< pi (double) */
|
||||
#endif
|
||||
#ifndef SDL_M_PIf
|
||||
#define SDL_M_PIf ((float)3.141592653589793238462643383279502884) /**< pi (float) */
|
||||
#ifndef SDL_PI_F
|
||||
#define SDL_PI_F 3.141592653589793238462643383279502884F /**< pi (float) */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -304,9 +304,9 @@ static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
|
|||
-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-
|
||||
-"http://depts.washington.edu/aimgroup/proj/dollar/"
|
||||
*/
|
||||
double ta = -SDL_M_PIl/4;
|
||||
double tb = SDL_M_PIl/4;
|
||||
double dt = SDL_M_PIl/90;
|
||||
double ta = -SDL_PI_D/4;
|
||||
double tb = SDL_PI_D/4;
|
||||
double dt = SDL_PI_D/90;
|
||||
float x1 = (float)(PHI*ta + (1-PHI)*tb);
|
||||
float f1 = dollarDifference(points,templ,x1);
|
||||
float x2 = (float)((1-PHI)*ta + PHI*tb);
|
||||
|
|
|
@ -716,7 +716,7 @@ SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
|
|||
--> add 45000 in total
|
||||
--> finally convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
|
||||
*/
|
||||
tmp = (((Sint32) (f * 18000.0 / SDL_M_PIl)) + 45000) % 36000;
|
||||
tmp = (((Sint32) (f * 18000.0 / SDL_PI_D)) + 45000) % 36000;
|
||||
tmp = (tmp * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
|
||||
*dest = (Uint16) tmp;
|
||||
}
|
||||
|
|
|
@ -567,7 +567,7 @@ HIDAPI_DriverPS4_ApplyCalibrationData(SDL_DriverPS4_Context *ctx, int index, Sin
|
|||
|
||||
/* Convert the raw data to the units expected by SDL */
|
||||
if (index < 3) {
|
||||
result = (result / GYRO_RES_PER_DEGREE) * SDL_M_PIf / 180.0f;
|
||||
result = (result / GYRO_RES_PER_DEGREE) * SDL_PI_F / 180.0f;
|
||||
} else {
|
||||
result = (result / ACCEL_RES_PER_G) * SDL_STANDARD_GRAVITY;
|
||||
}
|
||||
|
|
|
@ -612,7 +612,7 @@ HIDAPI_DriverPS5_ApplyCalibrationData(SDL_DriverPS5_Context *ctx, int index, Sin
|
|||
|
||||
/* Convert the raw data to the units expected by SDL */
|
||||
if (index < 3) {
|
||||
result = (result / GYRO_RES_PER_DEGREE) * SDL_M_PIf / 180.0f;
|
||||
result = (result / GYRO_RES_PER_DEGREE) * SDL_PI_F / 180.0f;
|
||||
} else {
|
||||
result = (result / ACCEL_RES_PER_G) * SDL_STANDARD_GRAVITY;
|
||||
}
|
||||
|
|
|
@ -1260,9 +1260,9 @@ HIDAPI_DriverSteam_UpdateDevice(SDL_HIDAPI_Device *device)
|
|||
|
||||
ctx->timestamp_us += ctx->update_rate_in_us;
|
||||
|
||||
values[0] = (ctx->m_state.sGyroX / 32768.0f) * (2000.0f * (SDL_M_PIf / 180.0f));
|
||||
values[1] = (ctx->m_state.sGyroZ / 32768.0f) * (2000.0f * (SDL_M_PIf / 180.0f));
|
||||
values[2] = (ctx->m_state.sGyroY / 32768.0f) * (2000.0f * (SDL_M_PIf / 180.0f));
|
||||
values[0] = (ctx->m_state.sGyroX / 32768.0f) * (2000.0f * (SDL_PI_F / 180.0f));
|
||||
values[1] = (ctx->m_state.sGyroZ / 32768.0f) * (2000.0f * (SDL_PI_F / 180.0f));
|
||||
values[2] = (ctx->m_state.sGyroY / 32768.0f) * (2000.0f * (SDL_PI_F / 180.0f));
|
||||
SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, ctx->timestamp_us, values, 3);
|
||||
|
||||
values[0] = (ctx->m_state.sAccelX / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY;
|
||||
|
|
|
@ -805,7 +805,7 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context* ctx)
|
|||
|
||||
if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t*)&readParams, sizeof(readParams), &reply)) {
|
||||
const float accelScale = SDL_STANDARD_GRAVITY / SWITCH_ACCEL_SCALE;
|
||||
const float gyroScale = SDL_M_PIf / 180.0f / SWITCH_GYRO_SCALE;
|
||||
const float gyroScale = SDL_PI_F / 180.0f / SWITCH_GYRO_SCALE;
|
||||
|
||||
ctx->m_IMUScaleData.fAccelScaleX = accelScale;
|
||||
ctx->m_IMUScaleData.fAccelScaleY = accelScale;
|
||||
|
@ -850,9 +850,9 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context* ctx)
|
|||
ctx->m_IMUScaleData.fAccelScaleZ = SWITCH_ACCEL_SCALE_MULT / (float)(SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawZ) * SDL_STANDARD_GRAVITY;
|
||||
|
||||
/* Gyro scale */
|
||||
ctx->m_IMUScaleData.fGyroScaleX = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawX) * SDL_M_PIf / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleY = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawY) * SDL_M_PIf / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleZ = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawZ) * SDL_M_PIf / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleX = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawX) * SDL_PI_F / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleY = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawY) * SDL_PI_F / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleZ = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawZ) * SDL_PI_F / 180.0f;
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
|
|
@ -1192,9 +1192,9 @@ static void HandleMotionPlusData(SDL_DriverWii_Context *ctx, SDL_Joystick *joyst
|
|||
z *= 2000;
|
||||
}
|
||||
|
||||
values[0] = -((float)z / GYRO_RES_PER_DEGREE) * SDL_M_PIf / 180.0f;
|
||||
values[1] = ((float)x / GYRO_RES_PER_DEGREE) * SDL_M_PIf / 180.0f;
|
||||
values[2] = ((float)y / GYRO_RES_PER_DEGREE) * SDL_M_PIf / 180.0f;
|
||||
values[0] = -((float)z / GYRO_RES_PER_DEGREE) * SDL_PI_F / 180.0f;
|
||||
values[1] = ((float)x / GYRO_RES_PER_DEGREE) * SDL_PI_F / 180.0f;
|
||||
values[2] = ((float)y / GYRO_RES_PER_DEGREE) * SDL_PI_F / 180.0f;
|
||||
SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, 0, values, 3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3679,7 +3679,7 @@ SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
float s_minx, s_miny, s_maxx, s_maxy;
|
||||
float c_minx, c_miny, c_maxx, c_maxy;
|
||||
|
||||
const float radian_angle = (float)((SDL_M_PIl * angle) / 180.0);
|
||||
const float radian_angle = (float)((SDL_PI_D * angle) / 180.0);
|
||||
const float s = SDL_sinf(radian_angle);
|
||||
const float c = SDL_cosf(radian_angle);
|
||||
|
||||
|
|
|
@ -1821,13 +1821,13 @@ D3D11_UpdateViewport(SDL_Renderer * renderer)
|
|||
projection = MatrixIdentity();
|
||||
break;
|
||||
case DXGI_MODE_ROTATION_ROTATE270:
|
||||
projection = MatrixRotationZ(SDL_M_PIf * 0.5f);
|
||||
projection = MatrixRotationZ(SDL_PI_F * 0.5f);
|
||||
break;
|
||||
case DXGI_MODE_ROTATION_ROTATE180:
|
||||
projection = MatrixRotationZ(SDL_M_PIf);
|
||||
projection = MatrixRotationZ(SDL_PI_F);
|
||||
break;
|
||||
case DXGI_MODE_ROTATION_ROTATE90:
|
||||
projection = MatrixRotationZ(-SDL_M_PIf * 0.5f);
|
||||
projection = MatrixRotationZ(-SDL_PI_F * 0.5f);
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("An unknown DisplayOrientation is being used");
|
||||
|
|
|
@ -2366,13 +2366,13 @@ D3D12_UpdateViewport(SDL_Renderer * renderer)
|
|||
projection = MatrixIdentity();
|
||||
break;
|
||||
case DXGI_MODE_ROTATION_ROTATE270:
|
||||
projection = MatrixRotationZ(SDL_M_PIf * 0.5f);
|
||||
projection = MatrixRotationZ(SDL_PI_F * 0.5f);
|
||||
break;
|
||||
case DXGI_MODE_ROTATION_ROTATE180:
|
||||
projection = MatrixRotationZ(SDL_M_PIf);
|
||||
projection = MatrixRotationZ(SDL_PI_F);
|
||||
break;
|
||||
case DXGI_MODE_ROTATION_ROTATE90:
|
||||
projection = MatrixRotationZ(-SDL_M_PIf * 0.5f);
|
||||
projection = MatrixRotationZ(-SDL_PI_F * 0.5f);
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("An unknown DisplayOrientation is being used");
|
||||
|
|
|
@ -122,7 +122,7 @@ SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, const SDL_FP
|
|||
double sinangle;
|
||||
double cosangle;
|
||||
|
||||
radangle = angle * (SDL_M_PIl / 180.0);
|
||||
radangle = angle * (SDL_PI_D / 180.0);
|
||||
sinangle = SDL_sin(radangle);
|
||||
cosangle = SDL_cos(radangle);
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnDataUpdated(ISensorEvents *
|
|||
hrZ = ISensorDataReport_GetSensorValue(pNewData, &SDL_SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Z_DEGREES_PER_SECOND, &valueZ);
|
||||
if (SUCCEEDED(hrX) && SUCCEEDED(hrY) && SUCCEEDED(hrZ) &&
|
||||
valueX.vt == VT_R8 && valueY.vt == VT_R8 && valueZ.vt == VT_R8) {
|
||||
const float DEGREES_TO_RADIANS = (SDL_M_PIf / 180.0f);
|
||||
const float DEGREES_TO_RADIANS = (SDL_PI_F / 180.0f);
|
||||
float values[3];
|
||||
|
||||
values[0] = (float)valueX.dblVal * DEGREES_TO_RADIANS;
|
||||
|
|
|
@ -79,12 +79,12 @@ SDL_acos(double val)
|
|||
#else
|
||||
double result;
|
||||
if (val == -1.0) {
|
||||
result = SDL_M_PIl;
|
||||
result = SDL_PI_D;
|
||||
} else {
|
||||
result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
|
||||
if (result < 0.0)
|
||||
{
|
||||
result += SDL_M_PIl;
|
||||
result += SDL_PI_D;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -109,9 +109,9 @@ SDL_asin(double val)
|
|||
#else
|
||||
double result;
|
||||
if (val == -1.0) {
|
||||
result = -(SDL_M_PIl / 2.0);
|
||||
result = -(SDL_PI_D / 2.0);
|
||||
} else {
|
||||
result = (SDL_M_PIl / 2.0) - SDL_acos(val);
|
||||
result = (SDL_PI_D / 2.0) - SDL_acos(val);
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
|
|
|
@ -1963,10 +1963,10 @@ static int
|
|||
cos_regularCases(void *args)
|
||||
{
|
||||
const d_to_d regular_cases[] = {
|
||||
{ -SDL_M_PIl, -1.0 },
|
||||
{ -SDL_PI_D, -1.0 },
|
||||
{ -0.0, 1.0 },
|
||||
{ 0.0, 1.0 },
|
||||
{ SDL_M_PIl, -1.0 }
|
||||
{ SDL_PI_D, -1.0 }
|
||||
};
|
||||
return helper_dtod("Cos", SDL_cos, regular_cases, SDL_arraysize(regular_cases));
|
||||
}
|
||||
|
@ -1979,24 +1979,24 @@ static int
|
|||
cos_precisionTest(void *args)
|
||||
{
|
||||
const d_to_d precision_cases[] = {
|
||||
{ SDL_M_PIl * 1.0 / 10.0, 0.9510565162 },
|
||||
{ SDL_M_PIl * 2.0 / 10.0, 0.8090169943 },
|
||||
{ SDL_M_PIl * 3.0 / 10.0, 0.5877852522 },
|
||||
{ SDL_M_PIl * 4.0 / 10.0, 0.3090169943 },
|
||||
{ SDL_M_PIl * 5.0 / 10.0, 0.0 },
|
||||
{ SDL_M_PIl * 6.0 / 10.0, -0.3090169943 },
|
||||
{ SDL_M_PIl * 7.0 / 10.0, -0.5877852522 },
|
||||
{ SDL_M_PIl * 8.0 / 10.0, -0.8090169943 },
|
||||
{ SDL_M_PIl * 9.0 / 10.0, -0.9510565162 },
|
||||
{ SDL_M_PIl * -1.0 / 10.0, 0.9510565162 },
|
||||
{ SDL_M_PIl * -2.0 / 10.0, 0.8090169943 },
|
||||
{ SDL_M_PIl * -3.0 / 10.0, 0.5877852522 },
|
||||
{ SDL_M_PIl * -4.0 / 10.0, 0.3090169943 },
|
||||
{ SDL_M_PIl * -5.0 / 10.0, 0.0 },
|
||||
{ SDL_M_PIl * -6.0 / 10.0, -0.3090169943 },
|
||||
{ SDL_M_PIl * -7.0 / 10.0, -0.5877852522 },
|
||||
{ SDL_M_PIl * -8.0 / 10.0, -0.8090169943 },
|
||||
{ SDL_M_PIl * -9.0 / 10.0, -0.9510565162 }
|
||||
{ SDL_PI_D * 1.0 / 10.0, 0.9510565162 },
|
||||
{ SDL_PI_D * 2.0 / 10.0, 0.8090169943 },
|
||||
{ SDL_PI_D * 3.0 / 10.0, 0.5877852522 },
|
||||
{ SDL_PI_D * 4.0 / 10.0, 0.3090169943 },
|
||||
{ SDL_PI_D * 5.0 / 10.0, 0.0 },
|
||||
{ SDL_PI_D * 6.0 / 10.0, -0.3090169943 },
|
||||
{ SDL_PI_D * 7.0 / 10.0, -0.5877852522 },
|
||||
{ SDL_PI_D * 8.0 / 10.0, -0.8090169943 },
|
||||
{ SDL_PI_D * 9.0 / 10.0, -0.9510565162 },
|
||||
{ SDL_PI_D * -1.0 / 10.0, 0.9510565162 },
|
||||
{ SDL_PI_D * -2.0 / 10.0, 0.8090169943 },
|
||||
{ SDL_PI_D * -3.0 / 10.0, 0.5877852522 },
|
||||
{ SDL_PI_D * -4.0 / 10.0, 0.3090169943 },
|
||||
{ SDL_PI_D * -5.0 / 10.0, 0.0 },
|
||||
{ SDL_PI_D * -6.0 / 10.0, -0.3090169943 },
|
||||
{ SDL_PI_D * -7.0 / 10.0, -0.5877852522 },
|
||||
{ SDL_PI_D * -8.0 / 10.0, -0.8090169943 },
|
||||
{ SDL_PI_D * -9.0 / 10.0, -0.9510565162 }
|
||||
};
|
||||
return helper_dtod_inexact("Cos", SDL_cos, precision_cases, SDL_arraysize(precision_cases));
|
||||
}
|
||||
|
@ -2080,10 +2080,10 @@ static int
|
|||
sin_regularCases(void *args)
|
||||
{
|
||||
const d_to_d regular_cases[] = {
|
||||
{ -SDL_M_PIl / 2, -1.0 },
|
||||
{ -SDL_PI_D / 2, -1.0 },
|
||||
{ -0.0, -0.0 },
|
||||
{ 0.0, 0.0 },
|
||||
{ SDL_M_PIl / 2, 1.0 }
|
||||
{ SDL_PI_D / 2, 1.0 }
|
||||
};
|
||||
return helper_dtod("Sin", SDL_sin, regular_cases, SDL_arraysize(regular_cases));
|
||||
}
|
||||
|
@ -2097,24 +2097,24 @@ static int
|
|||
sin_precisionTest(void *args)
|
||||
{
|
||||
const d_to_d precision_cases[] = {
|
||||
{ SDL_M_PIl * 1.0 / 10.0, 0.3090169943 },
|
||||
{ SDL_M_PIl * 2.0 / 10.0, 0.5877852522 },
|
||||
{ SDL_M_PIl * 3.0 / 10.0, 0.8090169943 },
|
||||
{ SDL_M_PIl * 4.0 / 10.0, 0.9510565162 },
|
||||
{ SDL_M_PIl * 6.0 / 10.0, 0.9510565162 },
|
||||
{ SDL_M_PIl * 7.0 / 10.0, 0.8090169943 },
|
||||
{ SDL_M_PIl * 8.0 / 10.0, 0.5877852522 },
|
||||
{ SDL_M_PIl * 9.0 / 10.0, 0.3090169943 },
|
||||
{ SDL_M_PIl, 0.0 },
|
||||
{ SDL_M_PIl * -1.0 / 10.0, -0.3090169943 },
|
||||
{ SDL_M_PIl * -2.0 / 10.0, -0.5877852522 },
|
||||
{ SDL_M_PIl * -3.0 / 10.0, -0.8090169943 },
|
||||
{ SDL_M_PIl * -4.0 / 10.0, -0.9510565162 },
|
||||
{ SDL_M_PIl * -6.0 / 10.0, -0.9510565162 },
|
||||
{ SDL_M_PIl * -7.0 / 10.0, -0.8090169943 },
|
||||
{ SDL_M_PIl * -8.0 / 10.0, -0.5877852522 },
|
||||
{ SDL_M_PIl * -9.0 / 10.0, -0.3090169943 },
|
||||
{ -SDL_M_PIl, 0.0 },
|
||||
{ SDL_PI_D * 1.0 / 10.0, 0.3090169943 },
|
||||
{ SDL_PI_D * 2.0 / 10.0, 0.5877852522 },
|
||||
{ SDL_PI_D * 3.0 / 10.0, 0.8090169943 },
|
||||
{ SDL_PI_D * 4.0 / 10.0, 0.9510565162 },
|
||||
{ SDL_PI_D * 6.0 / 10.0, 0.9510565162 },
|
||||
{ SDL_PI_D * 7.0 / 10.0, 0.8090169943 },
|
||||
{ SDL_PI_D * 8.0 / 10.0, 0.5877852522 },
|
||||
{ SDL_PI_D * 9.0 / 10.0, 0.3090169943 },
|
||||
{ SDL_PI_D, 0.0 },
|
||||
{ SDL_PI_D * -1.0 / 10.0, -0.3090169943 },
|
||||
{ SDL_PI_D * -2.0 / 10.0, -0.5877852522 },
|
||||
{ SDL_PI_D * -3.0 / 10.0, -0.8090169943 },
|
||||
{ SDL_PI_D * -4.0 / 10.0, -0.9510565162 },
|
||||
{ SDL_PI_D * -6.0 / 10.0, -0.9510565162 },
|
||||
{ SDL_PI_D * -7.0 / 10.0, -0.8090169943 },
|
||||
{ SDL_PI_D * -8.0 / 10.0, -0.5877852522 },
|
||||
{ SDL_PI_D * -9.0 / 10.0, -0.3090169943 },
|
||||
{ -SDL_PI_D, 0.0 },
|
||||
};
|
||||
return helper_dtod_inexact("Sin", SDL_sin, precision_cases, SDL_arraysize(precision_cases));
|
||||
}
|
||||
|
@ -2213,26 +2213,26 @@ static int
|
|||
tan_precisionTest(void *args)
|
||||
{
|
||||
const d_to_d precision_cases[] = {
|
||||
{ SDL_M_PIl * 1.0 / 11.0, 0.2936264929 },
|
||||
{ SDL_M_PIl * 2.0 / 11.0, 0.6426609771 },
|
||||
{ SDL_M_PIl * 3.0 / 11.0, 1.1540615205 },
|
||||
{ SDL_M_PIl * 4.0 / 11.0, 2.1896945629 },
|
||||
{ SDL_M_PIl * 5.0 / 11.0, 6.9551527717 },
|
||||
{ SDL_M_PIl * 6.0 / 11.0, -6.9551527717 },
|
||||
{ SDL_M_PIl * 7.0 / 11.0, -2.1896945629 },
|
||||
{ SDL_M_PIl * 8.0 / 11.0, -1.1540615205 },
|
||||
{ SDL_M_PIl * 9.0 / 11.0, -0.6426609771 },
|
||||
{ SDL_M_PIl * 10.0 / 11.0, -0.2936264929 },
|
||||
{ SDL_M_PIl * -1.0 / 11.0, -0.2936264929 },
|
||||
{ SDL_M_PIl * -2.0 / 11.0, -0.6426609771 },
|
||||
{ SDL_M_PIl * -3.0 / 11.0, -1.1540615205 },
|
||||
{ SDL_M_PIl * -4.0 / 11.0, -2.1896945629 },
|
||||
{ SDL_M_PIl * -5.0 / 11.0, -6.9551527717 },
|
||||
{ SDL_M_PIl * -6.0 / 11.0, 6.9551527717 },
|
||||
{ SDL_M_PIl * -7.0 / 11.0, 2.1896945629 },
|
||||
{ SDL_M_PIl * -8.0 / 11.0, 1.1540615205 },
|
||||
{ SDL_M_PIl * -9.0 / 11.0, 0.6426609771 },
|
||||
{ SDL_M_PIl * -10.0 / 11.0, 0.2936264929 }
|
||||
{ SDL_PI_D * 1.0 / 11.0, 0.2936264929 },
|
||||
{ SDL_PI_D * 2.0 / 11.0, 0.6426609771 },
|
||||
{ SDL_PI_D * 3.0 / 11.0, 1.1540615205 },
|
||||
{ SDL_PI_D * 4.0 / 11.0, 2.1896945629 },
|
||||
{ SDL_PI_D * 5.0 / 11.0, 6.9551527717 },
|
||||
{ SDL_PI_D * 6.0 / 11.0, -6.9551527717 },
|
||||
{ SDL_PI_D * 7.0 / 11.0, -2.1896945629 },
|
||||
{ SDL_PI_D * 8.0 / 11.0, -1.1540615205 },
|
||||
{ SDL_PI_D * 9.0 / 11.0, -0.6426609771 },
|
||||
{ SDL_PI_D * 10.0 / 11.0, -0.2936264929 },
|
||||
{ SDL_PI_D * -1.0 / 11.0, -0.2936264929 },
|
||||
{ SDL_PI_D * -2.0 / 11.0, -0.6426609771 },
|
||||
{ SDL_PI_D * -3.0 / 11.0, -1.1540615205 },
|
||||
{ SDL_PI_D * -4.0 / 11.0, -2.1896945629 },
|
||||
{ SDL_PI_D * -5.0 / 11.0, -6.9551527717 },
|
||||
{ SDL_PI_D * -6.0 / 11.0, 6.9551527717 },
|
||||
{ SDL_PI_D * -7.0 / 11.0, 2.1896945629 },
|
||||
{ SDL_PI_D * -8.0 / 11.0, 1.1540615205 },
|
||||
{ SDL_PI_D * -9.0 / 11.0, 0.6426609771 },
|
||||
{ SDL_PI_D * -10.0 / 11.0, 0.2936264929 }
|
||||
};
|
||||
return helper_dtod_inexact("Tan", SDL_tan, precision_cases, SDL_arraysize(precision_cases));
|
||||
}
|
||||
|
@ -2254,9 +2254,9 @@ acos_limitCases(void *args)
|
|||
1.0, 0.0, result);
|
||||
|
||||
result = SDL_acos(-1.0);
|
||||
SDLTest_AssertCheck(SDL_M_PIl == result,
|
||||
SDLTest_AssertCheck(SDL_PI_D == result,
|
||||
"Acos(%f), expected %f, got %f",
|
||||
-1.0, SDL_M_PIl, result);
|
||||
-1.0, SDL_PI_D, result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -2341,14 +2341,14 @@ asin_limitCases(void *args)
|
|||
double result;
|
||||
|
||||
result = SDL_asin(1.0);
|
||||
SDLTest_AssertCheck(SDL_M_PIl / 2.0 == result,
|
||||
SDLTest_AssertCheck(SDL_PI_D / 2.0 == result,
|
||||
"Asin(%f), expected %f, got %f",
|
||||
1.0, SDL_M_PIl / 2.0, result);
|
||||
1.0, SDL_PI_D / 2.0, result);
|
||||
|
||||
result = SDL_asin(-1.0);
|
||||
SDLTest_AssertCheck(-SDL_M_PIl / 2.0 == result,
|
||||
SDLTest_AssertCheck(-SDL_PI_D / 2.0 == result,
|
||||
"Asin(%f), expected %f, got %f",
|
||||
-1.0, -SDL_M_PIl / 2.0, result);
|
||||
-1.0, -SDL_PI_D / 2.0, result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -2433,16 +2433,16 @@ atan_limitCases(void *args)
|
|||
double result;
|
||||
|
||||
result = SDL_atan(INFINITY);
|
||||
SDLTest_AssertCheck((SDL_M_PIl / 2.0) - EPSILON <= result &&
|
||||
result <= (SDL_M_PIl / 2.0) + EPSILON,
|
||||
SDLTest_AssertCheck((SDL_PI_D / 2.0) - EPSILON <= result &&
|
||||
result <= (SDL_PI_D / 2.0) + EPSILON,
|
||||
"Atan(%f), expected %f, got %f",
|
||||
INFINITY, SDL_M_PIl / 2.0, result);
|
||||
INFINITY, SDL_PI_D / 2.0, result);
|
||||
|
||||
result = SDL_atan(-INFINITY);
|
||||
SDLTest_AssertCheck((-SDL_M_PIl / 2.0) - EPSILON <= result &&
|
||||
result <= (-SDL_M_PIl / 2.0) + EPSILON,
|
||||
SDLTest_AssertCheck((-SDL_PI_D / 2.0) - EPSILON <= result &&
|
||||
result <= (-SDL_PI_D / 2.0) + EPSILON,
|
||||
"Atan(%f), expected %f, got %f",
|
||||
-INFINITY, -SDL_M_PIl / 2.0, result);
|
||||
-INFINITY, -SDL_PI_D / 2.0, result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -2530,8 +2530,8 @@ atan2_bothZeroCases(void *args)
|
|||
const dd_to_d cases[] = {
|
||||
{ 0.0, 0.0, 0.0 },
|
||||
{ -0.0, 0.0, -0.0 },
|
||||
{ 0.0, -0.0, SDL_M_PIl },
|
||||
{ -0.0, -0.0, -SDL_M_PIl },
|
||||
{ 0.0, -0.0, SDL_PI_D },
|
||||
{ -0.0, -0.0, -SDL_PI_D },
|
||||
};
|
||||
return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases));
|
||||
}
|
||||
|
@ -2548,9 +2548,9 @@ atan2_yZeroCases(void *args)
|
|||
{
|
||||
const dd_to_d cases[] = {
|
||||
{ 0.0, 1.0, 0.0 },
|
||||
{ 0.0, -1.0, SDL_M_PIl },
|
||||
{ 0.0, -1.0, SDL_PI_D },
|
||||
{ -0.0, 1.0, -0.0 },
|
||||
{ -0.0, -1.0, -SDL_M_PIl }
|
||||
{ -0.0, -1.0, -SDL_PI_D }
|
||||
};
|
||||
return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases));
|
||||
}
|
||||
|
@ -2563,10 +2563,10 @@ static int
|
|||
atan2_xZeroCases(void *args)
|
||||
{
|
||||
const dd_to_d cases[] = {
|
||||
{ 1.0, 0.0, SDL_M_PIl / 2.0 },
|
||||
{ -1.0, 0.0, -SDL_M_PIl / 2.0 },
|
||||
{ 1.0, -0.0, SDL_M_PIl / 2.0 },
|
||||
{ -1.0, -0.0, -SDL_M_PIl / 2.0 }
|
||||
{ 1.0, 0.0, SDL_PI_D / 2.0 },
|
||||
{ -1.0, 0.0, -SDL_PI_D / 2.0 },
|
||||
{ 1.0, -0.0, SDL_PI_D / 2.0 },
|
||||
{ -1.0, -0.0, -SDL_PI_D / 2.0 }
|
||||
};
|
||||
return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases));
|
||||
}
|
||||
|
@ -2587,24 +2587,24 @@ atan2_bothInfCases(void *args)
|
|||
double result;
|
||||
|
||||
result = SDL_atan2(INFINITY, INFINITY);
|
||||
SDLTest_AssertCheck(SDL_M_PIl / 4.0 == result,
|
||||
SDLTest_AssertCheck(SDL_PI_D / 4.0 == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
INFINITY, INFINITY, SDL_M_PIl / 4.0, result);
|
||||
INFINITY, INFINITY, SDL_PI_D / 4.0, result);
|
||||
|
||||
result = SDL_atan2(INFINITY, -INFINITY);
|
||||
SDLTest_AssertCheck(3.0 * SDL_M_PIl / 4.0 == result,
|
||||
SDLTest_AssertCheck(3.0 * SDL_PI_D / 4.0 == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
INFINITY, -INFINITY, 3.0 * SDL_M_PIl / 4.0, result);
|
||||
INFINITY, -INFINITY, 3.0 * SDL_PI_D / 4.0, result);
|
||||
|
||||
result = SDL_atan2(-INFINITY, INFINITY);
|
||||
SDLTest_AssertCheck(-SDL_M_PIl / 4.0 == result,
|
||||
SDLTest_AssertCheck(-SDL_PI_D / 4.0 == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
-INFINITY, INFINITY, -SDL_M_PIl / 4.0, result);
|
||||
-INFINITY, INFINITY, -SDL_PI_D / 4.0, result);
|
||||
|
||||
result = SDL_atan2(-INFINITY, -INFINITY);
|
||||
SDLTest_AssertCheck(-3.0 * SDL_M_PIl / 4.0 == result,
|
||||
SDLTest_AssertCheck(-3.0 * SDL_PI_D / 4.0 == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
-INFINITY, -INFINITY, -3.0 * SDL_M_PIl / 4.0, result);
|
||||
-INFINITY, -INFINITY, -3.0 * SDL_PI_D / 4.0, result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -2619,24 +2619,24 @@ atan2_yInfCases(void *args)
|
|||
double result;
|
||||
|
||||
result = SDL_atan2(INFINITY, 1.0);
|
||||
SDLTest_AssertCheck(SDL_M_PIl / 2.0 == result,
|
||||
SDLTest_AssertCheck(SDL_PI_D / 2.0 == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
INFINITY, 1.0, SDL_M_PIl / 2.0, result);
|
||||
INFINITY, 1.0, SDL_PI_D / 2.0, result);
|
||||
|
||||
result = SDL_atan2(INFINITY, -1.0);
|
||||
SDLTest_AssertCheck(SDL_M_PIl / 2.0 == result,
|
||||
SDLTest_AssertCheck(SDL_PI_D / 2.0 == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
INFINITY, -1.0, SDL_M_PIl / 2.0, result);
|
||||
INFINITY, -1.0, SDL_PI_D / 2.0, result);
|
||||
|
||||
result = SDL_atan2(-INFINITY, 1.0);
|
||||
SDLTest_AssertCheck(-SDL_M_PIl / 2.0 == result,
|
||||
SDLTest_AssertCheck(-SDL_PI_D / 2.0 == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
-INFINITY, 1.0, -SDL_M_PIl / 2.0, result);
|
||||
-INFINITY, 1.0, -SDL_PI_D / 2.0, result);
|
||||
|
||||
result = SDL_atan2(-INFINITY, -1.0);
|
||||
SDLTest_AssertCheck(-SDL_M_PIl / 2.0 == result,
|
||||
SDLTest_AssertCheck(-SDL_PI_D / 2.0 == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
-INFINITY, -1.0, -SDL_M_PIl / 2.0, result);
|
||||
-INFINITY, -1.0, -SDL_PI_D / 2.0, result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -2663,14 +2663,14 @@ atan2_xInfCases(void *args)
|
|||
-1.0, INFINITY, -0.0, result);
|
||||
|
||||
result = SDL_atan2(1.0, -INFINITY);
|
||||
SDLTest_AssertCheck(SDL_M_PIl == result,
|
||||
SDLTest_AssertCheck(SDL_PI_D == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
1.0, -INFINITY, SDL_M_PIl, result);
|
||||
1.0, -INFINITY, SDL_PI_D, result);
|
||||
|
||||
result = SDL_atan2(-1.0, -INFINITY);
|
||||
SDLTest_AssertCheck(-SDL_M_PIl == result,
|
||||
SDLTest_AssertCheck(-SDL_PI_D == result,
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
-1.0, -INFINITY, -SDL_M_PIl, result);
|
||||
-1.0, -INFINITY, -SDL_PI_D, result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -2712,9 +2712,9 @@ static int
|
|||
atan2_topRightQuadrantTest(void *args)
|
||||
{
|
||||
const dd_to_d top_right_cases[] = {
|
||||
{ 1.0, 1.0, SDL_M_PIl / 4.0 },
|
||||
{ SQRT3, 3.0, SDL_M_PIl / 6.0 },
|
||||
{ SQRT3, 1.0, SDL_M_PIl / 3.0 }
|
||||
{ 1.0, 1.0, SDL_PI_D / 4.0 },
|
||||
{ SQRT3, 3.0, SDL_PI_D / 6.0 },
|
||||
{ SQRT3, 1.0, SDL_PI_D / 3.0 }
|
||||
};
|
||||
return helper_ddtod_inexact("SDL_atan2", SDL_atan2, top_right_cases, SDL_arraysize(top_right_cases));
|
||||
}
|
||||
|
@ -2727,9 +2727,9 @@ static int
|
|||
atan2_topLeftQuadrantTest(void *args)
|
||||
{
|
||||
const dd_to_d top_left_cases[] = {
|
||||
{ 1.0, -1.0, 3.0 * SDL_M_PIl / 4.0 },
|
||||
{ SQRT3, -3.0, 5.0 * SDL_M_PIl / 6.0 },
|
||||
{ SQRT3, -1.0, 2.0 * SDL_M_PIl / 3.0 }
|
||||
{ 1.0, -1.0, 3.0 * SDL_PI_D / 4.0 },
|
||||
{ SQRT3, -3.0, 5.0 * SDL_PI_D / 6.0 },
|
||||
{ SQRT3, -1.0, 2.0 * SDL_PI_D / 3.0 }
|
||||
};
|
||||
return helper_ddtod_inexact("SDL_atan2", SDL_atan2, top_left_cases, SDL_arraysize(top_left_cases));
|
||||
}
|
||||
|
@ -2742,9 +2742,9 @@ static int
|
|||
atan2_bottomRightQuadrantTest(void *args)
|
||||
{
|
||||
const dd_to_d bottom_right_cases[] = {
|
||||
{ -1.0, 1.0, -SDL_M_PIl / 4 },
|
||||
{ -SQRT3, 3.0, -SDL_M_PIl / 6.0 },
|
||||
{ -SQRT3, 1.0, -SDL_M_PIl / 3.0 }
|
||||
{ -1.0, 1.0, -SDL_PI_D / 4 },
|
||||
{ -SQRT3, 3.0, -SDL_PI_D / 6.0 },
|
||||
{ -SQRT3, 1.0, -SDL_PI_D / 3.0 }
|
||||
};
|
||||
return helper_ddtod_inexact("SDL_atan2", SDL_atan2, bottom_right_cases, SDL_arraysize(bottom_right_cases));
|
||||
}
|
||||
|
@ -2757,9 +2757,9 @@ static int
|
|||
atan2_bottomLeftQuadrantTest(void *args)
|
||||
{
|
||||
const dd_to_d bottom_left_cases[] = {
|
||||
{ -1.0, -1.0, -3.0 * SDL_M_PIl / 4.0 },
|
||||
{ -SQRT3, -3.0, -5.0 * SDL_M_PIl / 6.0 },
|
||||
{ -SQRT3, -1.0, -4.0 * SDL_M_PIl / 6.0 }
|
||||
{ -1.0, -1.0, -3.0 * SDL_PI_D / 4.0 },
|
||||
{ -SQRT3, -3.0, -5.0 * SDL_PI_D / 6.0 },
|
||||
{ -SQRT3, -1.0, -4.0 * SDL_PI_D / 6.0 }
|
||||
};
|
||||
return helper_ddtod_inexact("SDL_atan2", SDL_atan2, bottom_left_cases, SDL_arraysize(bottom_left_cases));
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ rotate_matrix(float angle, float x, float y, float z, float *r)
|
|||
float radians, c, s, c1, u[3], length;
|
||||
int i, j;
|
||||
|
||||
radians = (angle * SDL_M_PIf) / 180.0f;
|
||||
radians = (angle * SDL_PI_F) / 180.0f;
|
||||
|
||||
c = SDL_cosf(radians);
|
||||
s = SDL_sinf(radians);
|
||||
|
|
|
@ -1032,8 +1032,8 @@ static SDL_bool render(void)
|
|||
}
|
||||
currentTime = (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency();
|
||||
clearColor.float32[0] = (float)(0.5 + 0.5 * SDL_sin(currentTime));
|
||||
clearColor.float32[1] = (float)(0.5 + 0.5 * SDL_sin(currentTime + SDL_M_PIl * 2 / 3));
|
||||
clearColor.float32[2] = (float)(0.5 + 0.5 * SDL_sin(currentTime + SDL_M_PIl * 4 / 3));
|
||||
clearColor.float32[1] = (float)(0.5 + 0.5 * SDL_sin(currentTime + SDL_PI_D * 2 / 3));
|
||||
clearColor.float32[2] = (float)(0.5 + 0.5 * SDL_sin(currentTime + SDL_PI_D * 4 / 3));
|
||||
clearColor.float32[3] = 1;
|
||||
rerecordCommandBuffer(frameIndex, &clearColor);
|
||||
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
|
|
Loading…
Reference in New Issue