Pre-prending RL_ prefix for some raylib header macros.
This commit is contained in:
parent
e48f2f9d43
commit
8cea5f28b0
|
|
@ -90,7 +90,7 @@ int main()
|
|||
// Write sine wave.
|
||||
for (int i = 0; i < waveLength*2; i++)
|
||||
{
|
||||
data[i] = (short)(sinf(((2*PI*(float)i/waveLength)))*32000);
|
||||
data[i] = (short)(sinf(((2*RL_PI*(float)i/waveLength)))*32000);
|
||||
}
|
||||
|
||||
// Scale read cursor's position to minimize transition artifacts
|
||||
|
|
|
|||
|
|
@ -143,25 +143,25 @@ void DrawSphereBasic(Color color)
|
|||
{
|
||||
for (int j = 0; j < slices; j++)
|
||||
{
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*i))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*i))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*i))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*i))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i)))*sinf(DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i)))*cosf(DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i)))*sinf(RL_DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i)))*cosf(RL_DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*((j+1)*360/slices)));
|
||||
}
|
||||
}
|
||||
rlEnd();
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ int main()
|
|||
|
||||
Matrix transform = MatrixIdentity();
|
||||
|
||||
transform = MatrixMultiply(transform, MatrixRotateZ(DEG2RAD*roll));
|
||||
transform = MatrixMultiply(transform, MatrixRotateX(DEG2RAD*pitch));
|
||||
transform = MatrixMultiply(transform, MatrixRotateY(DEG2RAD*yaw));
|
||||
transform = MatrixMultiply(transform, MatrixRotateZ(RL_DEG2RAD*roll));
|
||||
transform = MatrixMultiply(transform, MatrixRotateX(RL_DEG2RAD*pitch));
|
||||
transform = MatrixMultiply(transform, MatrixRotateY(RL_DEG2RAD*yaw));
|
||||
|
||||
model.transform = transform;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -75,16 +75,16 @@
|
|||
//----------------------------------------------------------------------------------
|
||||
// Defines and Macros
|
||||
//----------------------------------------------------------------------------------
|
||||
#ifndef PI
|
||||
#define PI 3.14159265358979323846
|
||||
#ifndef RL_PI
|
||||
#define RL_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifndef DEG2RAD
|
||||
#define DEG2RAD (PI/180.0f)
|
||||
#ifndef RL_DEG2RAD
|
||||
#define RL_DEG2RAD (RL_PI/180.0f)
|
||||
#endif
|
||||
|
||||
#ifndef RAD2DEG
|
||||
#define RAD2DEG (180.0f/PI)
|
||||
#ifndef RL_RAD2DEG
|
||||
#define RL_RAD2DEG (180.0f/RL_PI)
|
||||
#endif
|
||||
|
||||
// Return float vector for Matrix
|
||||
|
|
@ -205,7 +205,7 @@ RMDEF float Vector2Distance(Vector2 v1, Vector2 v2)
|
|||
// Calculate angle from two vectors in X-axis
|
||||
RMDEF float Vector2Angle(Vector2 v1, Vector2 v2)
|
||||
{
|
||||
float result = atan2f(v2.y - v1.y, v2.x - v1.x)*(180.0f/PI);
|
||||
float result = atan2f(v2.y - v1.y, v2.x - v1.x)*(180.0f/RL_PI);
|
||||
if (result < 0) result += 360.0f;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1302,18 +1302,18 @@ RMDEF Vector3 QuaternionToEuler(Quaternion q)
|
|||
// roll (x-axis rotation)
|
||||
float x0 = 2.0f*(q.w*q.x + q.y*q.z);
|
||||
float x1 = 1.0f - 2.0f*(q.x*q.x + q.y*q.y);
|
||||
result.x = atan2f(x0, x1)*RAD2DEG;
|
||||
result.x = atan2f(x0, x1)*RL_RAD2DEG;
|
||||
|
||||
// pitch (y-axis rotation)
|
||||
float y0 = 2.0f*(q.w*q.y - q.z*q.x);
|
||||
y0 = y0 > 1.0f ? 1.0f : y0;
|
||||
y0 = y0 < -1.0f ? -1.0f : y0;
|
||||
result.y = asinf(y0)*RAD2DEG;
|
||||
result.y = asinf(y0)*RL_RAD2DEG;
|
||||
|
||||
// yaw (z-axis rotation)
|
||||
float z0 = 2.0f*(q.w*q.z + q.x*q.y);
|
||||
float z1 = 1.0f - 2.0f*(q.y*q.y + q.z*q.z);
|
||||
result.z = atan2f(z0, z1)*RAD2DEG;
|
||||
result.z = atan2f(z0, z1)*RL_RAD2DEG;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@ void DrawAnimatedModelEx(AnimatedModel model, Vector3 position, Vector3 rotation
|
|||
}
|
||||
|
||||
Matrix matScale = MatrixScale(scale.x, scale.y, scale.z);
|
||||
Matrix matRotation = MatrixRotate(rotationAxis, rotationAngle*DEG2RAD);
|
||||
Matrix matRotation = MatrixRotate(rotationAxis, rotationAngle*RL_DEG2RAD);
|
||||
Matrix matTranslation = MatrixTranslate(position.x, position.y, position.z);
|
||||
|
||||
Matrix matTransform = MatrixMultiply(MatrixMultiply(matScale, matRotation), matTranslation);
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ int main(void)
|
|||
// Draw '3D' elements in the scene
|
||||
//-----------------------------------------------
|
||||
// Calculate projection matrix (from perspective) and view matrix from camera look at
|
||||
Matrix matProj = MatrixPerspective(camera.fovy*DEG2RAD, (double)screenWidth/(double)screenHeight, 0.01, 1000.0);
|
||||
Matrix matProj = MatrixPerspective(camera.fovy*RL_DEG2RAD, (double)screenWidth/(double)screenHeight, 0.01, 1000.0);
|
||||
Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);
|
||||
|
||||
SetMatrixModelview(matView); // Set internal modelview matrix (default shader)
|
||||
|
|
|
|||
|
|
@ -47,23 +47,23 @@ int main()
|
|||
// Create left ramp physics body
|
||||
PhysicsBody rectLeft = CreatePhysicsBodyRectangle((Vector2){ 25, screenHeight - 5 }, 250, 250, 10);
|
||||
rectLeft->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
|
||||
SetPhysicsBodyRotation(rectLeft, 30*DEG2RAD);
|
||||
SetPhysicsBodyRotation(rectLeft, 30*RL_DEG2RAD);
|
||||
|
||||
// Create right ramp physics body
|
||||
PhysicsBody rectRight = CreatePhysicsBodyRectangle((Vector2){ screenWidth - 25, screenHeight - 5 }, 250, 250, 10);
|
||||
rectRight->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
|
||||
SetPhysicsBodyRotation(rectRight, 330*DEG2RAD);
|
||||
SetPhysicsBodyRotation(rectRight, 330*RL_DEG2RAD);
|
||||
|
||||
// Create dynamic physics bodies
|
||||
PhysicsBody bodyA = CreatePhysicsBodyRectangle((Vector2){ 35, screenHeight*0.6f }, 40, 40, 10);
|
||||
bodyA->staticFriction = 0.1f;
|
||||
bodyA->dynamicFriction = 0.1f;
|
||||
SetPhysicsBodyRotation(bodyA, 30*DEG2RAD);
|
||||
SetPhysicsBodyRotation(bodyA, 30*RL_DEG2RAD);
|
||||
|
||||
PhysicsBody bodyB = CreatePhysicsBodyRectangle((Vector2){ screenWidth - 35, screenHeight*0.6f }, 40, 40, 10);
|
||||
bodyB->staticFriction = 1;
|
||||
bodyB->dynamicFriction = 1;
|
||||
SetPhysicsBodyRotation(bodyB, 330*DEG2RAD);
|
||||
SetPhysicsBodyRotation(bodyB, 330*RL_DEG2RAD);
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
@ -81,12 +81,12 @@ int main()
|
|||
bodyA->position = (Vector2){ 35, screenHeight*0.6f };
|
||||
bodyA->velocity = (Vector2){ 0, 0 };
|
||||
bodyA->angularVelocity = 0;
|
||||
SetPhysicsBodyRotation(bodyA, 30*DEG2RAD);
|
||||
SetPhysicsBodyRotation(bodyA, 30*RL_DEG2RAD);
|
||||
|
||||
bodyB->position = (Vector2){ screenWidth - 35, screenHeight*0.6f };
|
||||
bodyB->velocity = (Vector2){ 0, 0 };
|
||||
bodyB->angularVelocity = 0;
|
||||
SetPhysicsBodyRotation(bodyB, 330*DEG2RAD);
|
||||
SetPhysicsBodyRotation(bodyB, 330*RL_DEG2RAD);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -145,14 +145,14 @@ void InitGame(void)
|
|||
victory = false;
|
||||
pause = false;
|
||||
|
||||
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*DEG2RAD);
|
||||
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*RL_DEG2RAD);
|
||||
|
||||
// Initialization player
|
||||
player.position = (Vector2){screenWidth/2, screenHeight/2 - shipHeight/2};
|
||||
player.speed = (Vector2){0, 0};
|
||||
player.acceleration = 0;
|
||||
player.rotation = 0;
|
||||
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
|
||||
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
|
||||
player.color = LIGHTGRAY;
|
||||
|
||||
destroyedMeteorsCount = 0;
|
||||
|
|
@ -246,8 +246,8 @@ void UpdateGame(void)
|
|||
if (IsKeyDown(KEY_RIGHT)) player.rotation += 5;
|
||||
|
||||
// Player logic: speed
|
||||
player.speed.x = sin(player.rotation*DEG2RAD)*PLAYER_SPEED;
|
||||
player.speed.y = cos(player.rotation*DEG2RAD)*PLAYER_SPEED;
|
||||
player.speed.x = sin(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
|
||||
player.speed.y = cos(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
|
||||
|
||||
// Player logic: acceleration
|
||||
if (IsKeyDown(KEY_UP))
|
||||
|
|
@ -282,10 +282,10 @@ void UpdateGame(void)
|
|||
{
|
||||
if (!shoot[i].active)
|
||||
{
|
||||
shoot[i].position = (Vector2){ player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight) };
|
||||
shoot[i].position = (Vector2){ player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight) };
|
||||
shoot[i].active = true;
|
||||
shoot[i].speed.x = 1.5*sin(player.rotation*DEG2RAD)*PLAYER_SPEED;
|
||||
shoot[i].speed.y = 1.5*cos(player.rotation*DEG2RAD)*PLAYER_SPEED;
|
||||
shoot[i].speed.x = 1.5*sin(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
|
||||
shoot[i].speed.y = 1.5*cos(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
|
||||
shoot[i].rotation = player.rotation;
|
||||
break;
|
||||
}
|
||||
|
|
@ -341,7 +341,7 @@ void UpdateGame(void)
|
|||
}
|
||||
|
||||
// Collision logic: player vs meteors
|
||||
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
|
||||
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
|
||||
|
||||
for (int a = 0; a < MAX_BIG_METEORS; a++)
|
||||
{
|
||||
|
|
@ -428,12 +428,12 @@ void UpdateGame(void)
|
|||
if (midMeteorsCount%2 == 0)
|
||||
{
|
||||
mediumMeteor[midMeteorsCount].position = (Vector2){bigMeteor[a].position.x, bigMeteor[a].position.y};
|
||||
mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1};
|
||||
mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED*-1};
|
||||
}
|
||||
else
|
||||
{
|
||||
mediumMeteor[midMeteorsCount].position = (Vector2){bigMeteor[a].position.x, bigMeteor[a].position.y};
|
||||
mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED};
|
||||
mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED};
|
||||
}
|
||||
|
||||
mediumMeteor[midMeteorsCount].active = true;
|
||||
|
|
@ -459,12 +459,12 @@ void UpdateGame(void)
|
|||
if (smallMeteorsCount%2 == 0)
|
||||
{
|
||||
smallMeteor[smallMeteorsCount].position = (Vector2){mediumMeteor[b].position.x, mediumMeteor[b].position.y};
|
||||
smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1};
|
||||
smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED*-1};
|
||||
}
|
||||
else
|
||||
{
|
||||
smallMeteor[smallMeteorsCount].position = (Vector2){mediumMeteor[b].position.x, mediumMeteor[b].position.y};
|
||||
smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED};
|
||||
smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED};
|
||||
}
|
||||
|
||||
smallMeteor[smallMeteorsCount].active = true;
|
||||
|
|
@ -515,9 +515,9 @@ void DrawGame(void)
|
|||
if (!gameOver)
|
||||
{
|
||||
// Draw spaceship
|
||||
Vector2 v1 = { player.position.x + sinf(player.rotation*DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*DEG2RAD)*(shipHeight) };
|
||||
Vector2 v2 = { player.position.x - cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
Vector2 v3 = { player.position.x + cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
|
||||
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
DrawTriangle(v1, v2, v3, MAROON);
|
||||
|
||||
// Draw meteors
|
||||
|
|
|
|||
|
|
@ -130,14 +130,14 @@ void InitGame(void)
|
|||
|
||||
framesCounter = 0;
|
||||
|
||||
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*DEG2RAD);
|
||||
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*RL_DEG2RAD);
|
||||
|
||||
// Initialization player
|
||||
player.position = (Vector2){screenWidth/2, screenHeight/2 - shipHeight/2};
|
||||
player.speed = (Vector2){0, 0};
|
||||
player.acceleration = 0;
|
||||
player.rotation = 0;
|
||||
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
|
||||
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
|
||||
player.color = LIGHTGRAY;
|
||||
|
||||
for (int i = 0; i < MAX_MEDIUM_METEORS; i++)
|
||||
|
|
@ -239,8 +239,8 @@ void UpdateGame(void)
|
|||
if (IsKeyDown(KEY_RIGHT)) player.rotation += 5;
|
||||
|
||||
// Speed
|
||||
player.speed.x = sin(player.rotation*DEG2RAD)*PLAYER_SPEED;
|
||||
player.speed.y = cos(player.rotation*DEG2RAD)*PLAYER_SPEED;
|
||||
player.speed.x = sin(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
|
||||
player.speed.y = cos(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
|
||||
|
||||
// Controller
|
||||
if (IsKeyDown(KEY_UP))
|
||||
|
|
@ -269,7 +269,7 @@ void UpdateGame(void)
|
|||
else if (player.position.y < -(shipHeight)) player.position.y = screenHeight + shipHeight;
|
||||
|
||||
// Collision Player to meteors
|
||||
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
|
||||
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
|
||||
|
||||
for (int a = 0; a < MAX_MEDIUM_METEORS; a++)
|
||||
{
|
||||
|
|
@ -336,9 +336,9 @@ void DrawGame(void)
|
|||
if (!gameOver)
|
||||
{
|
||||
// Draw spaceship
|
||||
Vector2 v1 = { player.position.x + sinf(player.rotation*DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*DEG2RAD)*(shipHeight) };
|
||||
Vector2 v2 = { player.position.x - cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
Vector2 v3 = { player.position.x + cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
|
||||
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
DrawTriangle(v1, v2, v3, MAROON);
|
||||
|
||||
// Draw meteor
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ static bool UpdatePlayer(int playerTurn)
|
|||
// Distance (calculating the fire power)
|
||||
player[playerTurn].aimingPower = sqrt(pow(player[playerTurn].position.x - GetMousePosition().x, 2) + pow(player[playerTurn].position.y - GetMousePosition().y, 2));
|
||||
// Calculates the angle via arcsin
|
||||
player[playerTurn].aimingAngle = asin((player[playerTurn].position.y - GetMousePosition().y)/player[playerTurn].aimingPower)*RAD2DEG;
|
||||
player[playerTurn].aimingAngle = asin((player[playerTurn].position.y - GetMousePosition().y)/player[playerTurn].aimingPower)*RL_RAD2DEG;
|
||||
// Point of the screen we are aiming at
|
||||
player[playerTurn].aimingPoint = GetMousePosition();
|
||||
|
||||
|
|
@ -451,7 +451,7 @@ static bool UpdatePlayer(int playerTurn)
|
|||
// Distance (calculating the fire power)
|
||||
player[playerTurn].aimingPower = sqrt(pow(player[playerTurn].position.x - GetMousePosition().x, 2) + pow(player[playerTurn].position.y - GetMousePosition().y, 2));
|
||||
// Calculates the angle via arcsin
|
||||
player[playerTurn].aimingAngle = asin((player[playerTurn].position.y - GetMousePosition().y)/player[playerTurn].aimingPower)*RAD2DEG;
|
||||
player[playerTurn].aimingAngle = asin((player[playerTurn].position.y - GetMousePosition().y)/player[playerTurn].aimingPower)*RL_RAD2DEG;
|
||||
// Point of the screen we are aiming at
|
||||
player[playerTurn].aimingPoint = GetMousePosition();
|
||||
|
||||
|
|
@ -492,14 +492,14 @@ static bool UpdateBall(int playerTurn)
|
|||
{
|
||||
if (player[playerTurn].isLeftTeam)
|
||||
{
|
||||
ball.speed.x = cos(player[playerTurn].previousAngle*DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
|
||||
ball.speed.y = -sin(player[playerTurn].previousAngle*DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
|
||||
ball.speed.x = cos(player[playerTurn].previousAngle*RL_DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
|
||||
ball.speed.y = -sin(player[playerTurn].previousAngle*RL_DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
|
||||
ball.active = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ball.speed.x = -cos(player[playerTurn].previousAngle*DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
|
||||
ball.speed.y = -sin(player[playerTurn].previousAngle*DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
|
||||
ball.speed.x = -cos(player[playerTurn].previousAngle*RL_DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
|
||||
ball.speed.y = -sin(player[playerTurn].previousAngle*RL_DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
|
||||
ball.active = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -943,7 +943,7 @@ void UpdateGameplayScreen(void)
|
|||
if (beeActive == true && !isHitBee)
|
||||
{
|
||||
bee.x -= 3*speed;
|
||||
beeMov = sin(2*PI/400*bee.x) * 5;
|
||||
beeMov = sin(2*RL_PI/400*bee.x) * 5;
|
||||
bee.y += beeMov*TIME_FACTOR;
|
||||
|
||||
if (CheckCollisionRecs(bee, player) && (state != FINALFORM) && (state != KICK))
|
||||
|
|
@ -1870,7 +1870,7 @@ void UpdateGameplayScreen(void)
|
|||
{
|
||||
dandelionParticle.particles[i].position.y += 3*speedMod*TIME_FACTOR;
|
||||
dandelionParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
|
||||
dandelionParticle.particles[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30);
|
||||
dandelionParticle.particles[i].rotation = -(30*sin(2*RL_PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30);
|
||||
|
||||
if (dandelionParticle.particles[i].position.y >= GetScreenHeight()) dandelionParticle.particles[i].active = false;
|
||||
}
|
||||
|
|
@ -1879,7 +1879,7 @@ void UpdateGameplayScreen(void)
|
|||
{
|
||||
dandelionBackParticle.particles[i].position.y += (int)1.5f*speedMod*TIME_FACTOR;
|
||||
dandelionBackParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
|
||||
dandelionBackParticle.particles[i].rotation = 30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30;
|
||||
dandelionBackParticle.particles[i].rotation = 30*sin(2*RL_PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30;
|
||||
|
||||
if (dandelionBackParticle.particles[i].position.y >= GetScreenHeight()) dandelionBackParticle.particles[i].active = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -690,7 +690,7 @@ void UpdateTitleScreen(void)
|
|||
{
|
||||
dandelionParticle.particle[i].position.y += 2.5*TIME_FACTOR;
|
||||
dandelionParticle.particle[i].position.x -= 2*TIME_FACTOR;
|
||||
dandelionParticle.particle[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
|
||||
dandelionParticle.particle[i].rotation = -(30*sin(2*RL_PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
|
||||
if (dandelionParticle.particle[i].position.y >= GetScreenHeight()) dandelionParticle.particle[i].active = false;
|
||||
}
|
||||
|
||||
|
|
@ -698,7 +698,7 @@ void UpdateTitleScreen(void)
|
|||
{
|
||||
dandelionBackParticle.particle[i].position.y += 2*TIME_FACTOR;
|
||||
dandelionBackParticle.particle[i].position.x -= 3*TIME_FACTOR;
|
||||
dandelionBackParticle.particle[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
|
||||
dandelionBackParticle.particle[i].rotation = -(30*sin(2*RL_PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
|
||||
if (dandelionBackParticle.particle[i].position.y >= GetScreenHeight()) dandelionBackParticle.particle[i].active = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ static void InitGame(void)
|
|||
gravity = 0.25f;
|
||||
|
||||
linePosition = (Vector2){ 0.0f , 0.0f };
|
||||
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*DEG2RAD);
|
||||
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*RL_DEG2RAD);
|
||||
|
||||
// Initialization player
|
||||
player.position = (Vector2){ screenWidth/2, screenHeight };
|
||||
|
|
@ -556,9 +556,9 @@ void DrawGame(void)
|
|||
if (!gameOver)
|
||||
{
|
||||
// Draw player
|
||||
Vector2 v1 = { player.position.x + sinf(player.rotation*DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*DEG2RAD)*(shipHeight) };
|
||||
Vector2 v2 = { player.position.x - cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
Vector2 v3 = { player.position.x + cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
|
||||
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
|
||||
DrawTriangle(v1, v2, v3, MAROON);
|
||||
|
||||
// Draw meteors (big)
|
||||
|
|
|
|||
28
src/camera.h
28
src/camera.h
|
|
@ -126,16 +126,16 @@ void SetCameraMoveControls(int frontKey, int backKey,
|
|||
|
||||
#include <math.h> // Required for: sqrt(), sin(), cos()
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.14159265358979323846
|
||||
#ifndef RL_PI
|
||||
#define RL_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifndef DEG2RAD
|
||||
#define DEG2RAD (PI/180.0f)
|
||||
#ifndef RL_DEG2RAD
|
||||
#define RL_DEG2RAD (RL_PI/180.0f)
|
||||
#endif
|
||||
|
||||
#ifndef RAD2DEG
|
||||
#define RAD2DEG (180.0f/PI)
|
||||
#ifndef RL_RAD2DEG
|
||||
#define RL_RAD2DEG (180.0f/RL_PI)
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
@ -248,8 +248,8 @@ void SetCameraMode(Camera camera, int mode)
|
|||
cameraAngle.y = -asinf( (float)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)
|
||||
//cameraAngle.y = -60.0f*DEG2RAD; // Camera angle in plane XY (0 aligned with X, move positive CW)
|
||||
//cameraAngle.x = 0.0f*RL_DEG2RAD; // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
|
||||
//cameraAngle.y = -60.0f*RL_DEG2RAD; // Camera angle in plane XY (0 aligned with X, move positive CW)
|
||||
|
||||
playerEyesPosition = camera.position.y;
|
||||
|
||||
|
|
@ -373,8 +373,8 @@ void UpdateCamera(Camera *camera)
|
|||
cameraAngle.y += mousePositionDelta.y*-CAMERA_FREE_MOUSE_SENSITIVITY;
|
||||
|
||||
// Angle clamp
|
||||
if (cameraAngle.y > CAMERA_FREE_MIN_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_FREE_MIN_CLAMP*DEG2RAD;
|
||||
else if (cameraAngle.y < CAMERA_FREE_MAX_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_FREE_MAX_CLAMP*DEG2RAD;
|
||||
if (cameraAngle.y > CAMERA_FREE_MIN_CLAMP*RL_DEG2RAD) cameraAngle.y = CAMERA_FREE_MIN_CLAMP*RL_DEG2RAD;
|
||||
else if (cameraAngle.y < CAMERA_FREE_MAX_CLAMP*RL_DEG2RAD) cameraAngle.y = CAMERA_FREE_MAX_CLAMP*RL_DEG2RAD;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -424,8 +424,8 @@ void UpdateCamera(Camera *camera)
|
|||
if (cameraMode == CAMERA_THIRD_PERSON)
|
||||
{
|
||||
// Angle clamp
|
||||
if (cameraAngle.y > CAMERA_THIRD_PERSON_MIN_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_THIRD_PERSON_MIN_CLAMP*DEG2RAD;
|
||||
else if (cameraAngle.y < CAMERA_THIRD_PERSON_MAX_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_THIRD_PERSON_MAX_CLAMP*DEG2RAD;
|
||||
if (cameraAngle.y > CAMERA_THIRD_PERSON_MIN_CLAMP*RL_DEG2RAD) cameraAngle.y = CAMERA_THIRD_PERSON_MIN_CLAMP*RL_DEG2RAD;
|
||||
else if (cameraAngle.y < CAMERA_THIRD_PERSON_MAX_CLAMP*RL_DEG2RAD) cameraAngle.y = CAMERA_THIRD_PERSON_MAX_CLAMP*RL_DEG2RAD;
|
||||
|
||||
// Camera zoom
|
||||
cameraTargetDistance -= (mouseWheelMove*CAMERA_MOUSE_SCROLL_SENSITIVITY);
|
||||
|
|
@ -441,8 +441,8 @@ void UpdateCamera(Camera *camera)
|
|||
else // CAMERA_FIRST_PERSON
|
||||
{
|
||||
// Angle clamp
|
||||
if (cameraAngle.y > CAMERA_FIRST_PERSON_MIN_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_FIRST_PERSON_MIN_CLAMP*DEG2RAD;
|
||||
else if (cameraAngle.y < CAMERA_FIRST_PERSON_MAX_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_FIRST_PERSON_MAX_CLAMP*DEG2RAD;
|
||||
if (cameraAngle.y > CAMERA_FIRST_PERSON_MIN_CLAMP*RL_DEG2RAD) cameraAngle.y = CAMERA_FIRST_PERSON_MIN_CLAMP*RL_DEG2RAD;
|
||||
else if (cameraAngle.y < CAMERA_FIRST_PERSON_MAX_CLAMP*RL_DEG2RAD) cameraAngle.y = CAMERA_FIRST_PERSON_MAX_CLAMP*RL_DEG2RAD;
|
||||
|
||||
// Camera is always looking at player
|
||||
camera->target.x = camera->position.x - sinf(cameraAngle.x)*CAMERA_FIRST_PERSON_FOCUS_DISTANCE;
|
||||
|
|
|
|||
|
|
@ -1096,7 +1096,7 @@ void BeginMode2D(Camera2D camera)
|
|||
|
||||
// Camera rotation and scaling is always relative to target
|
||||
Matrix matOrigin = MatrixTranslate(-camera.target.x, -camera.target.y, 0.0f);
|
||||
Matrix matRotation = MatrixRotate((Vector3){ 0.0f, 0.0f, 1.0f }, camera.rotation*DEG2RAD);
|
||||
Matrix matRotation = MatrixRotate((Vector3){ 0.0f, 0.0f, 1.0f }, camera.rotation*RL_DEG2RAD);
|
||||
Matrix matScale = MatrixScale(camera.zoom, camera.zoom, 1.0f);
|
||||
Matrix matTranslation = MatrixTranslate(camera.offset.x + camera.target.x, camera.offset.y + camera.target.y, 0.0f);
|
||||
|
||||
|
|
@ -1127,7 +1127,7 @@ void BeginMode3D(Camera3D camera)
|
|||
if (camera.type == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
// Setup perspective projection
|
||||
double top = 0.01*tan(camera.fovy*0.5*DEG2RAD);
|
||||
double top = 0.01*tan(camera.fovy*0.5*RL_DEG2RAD);
|
||||
double right = top*aspect;
|
||||
|
||||
rlFrustum(-right, right, -top, top, 0.01, 1000.0);
|
||||
|
|
@ -1233,7 +1233,7 @@ Ray GetMouseRay(Vector2 mousePosition, Camera camera)
|
|||
if (camera.type == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
// Calculate projection matrix from perspective
|
||||
matProj = MatrixPerspective(camera.fovy*DEG2RAD, ((double)GetScreenWidth()/(double)GetScreenHeight()), 0.01, 1000.0);
|
||||
matProj = MatrixPerspective(camera.fovy*RL_DEG2RAD, ((double)GetScreenWidth()/(double)GetScreenHeight()), 0.01, 1000.0);
|
||||
}
|
||||
else if (camera.type == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
|
|
@ -1275,7 +1275,7 @@ Vector2 GetWorldToScreen(Vector3 position, Camera camera)
|
|||
if (camera.type == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
// Calculate projection matrix from perspective
|
||||
matProj = MatrixPerspective(camera.fovy*DEG2RAD, ((double)GetScreenWidth()/(double)GetScreenHeight()), 0.01, 1000.0);
|
||||
matProj = MatrixPerspective(camera.fovy*RL_DEG2RAD, ((double)GetScreenWidth()/(double)GetScreenHeight()), 0.01, 1000.0);
|
||||
}
|
||||
else if (camera.type == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -103,9 +103,9 @@ EASEDEF float EaseLinearOut(float t, float b, float c, float d) { return (c*t/d
|
|||
EASEDEF float EaseLinearInOut(float t,float b, float c, float d) { return (c*t/d + b); }
|
||||
|
||||
// Sine Easing functions
|
||||
EASEDEF float EaseSineIn(float t, float b, float c, float d) { return (-c*cos(t/d*(PI/2)) + c + b); }
|
||||
EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sin(t/d*(PI/2)) + b); }
|
||||
EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2*(cos(PI*t/d) - 1) + b); }
|
||||
EASEDEF float EaseSineIn(float t, float b, float c, float d) { return (-c*cos(t/d*(RL_PI/2)) + c + b); }
|
||||
EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sin(t/d*(RL_PI/2)) + b); }
|
||||
EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2*(cos(RL_PI*t/d) - 1) + b); }
|
||||
|
||||
// Circular Easing functions
|
||||
EASEDEF float EaseCircIn(float t, float b, float c, float d) { return (-c*(sqrt(1 - (t/=d)*t) - 1) + b); }
|
||||
|
|
@ -211,7 +211,7 @@ EASEDEF float EaseElasticIn(float t, float b, float c, float d)
|
|||
float s = p/4;
|
||||
float postFix = a*pow(2, 10*(t-=1));
|
||||
|
||||
return (-(postFix*sin((t*d-s)*(2*PI)/p )) + b);
|
||||
return (-(postFix*sin((t*d-s)*(2*RL_PI)/p )) + b);
|
||||
}
|
||||
|
||||
EASEDEF float EaseElasticOut(float t, float b, float c, float d)
|
||||
|
|
@ -223,7 +223,7 @@ EASEDEF float EaseElasticOut(float t, float b, float c, float d)
|
|||
float a = c;
|
||||
float s = p/4;
|
||||
|
||||
return (a*pow(2,-10*t)*sin((t*d-s)*(2*PI)/p) + c + b);
|
||||
return (a*pow(2,-10*t)*sin((t*d-s)*(2*RL_PI)/p) + c + b);
|
||||
}
|
||||
|
||||
EASEDEF float EaseElasticInOut(float t, float b, float c, float d)
|
||||
|
|
@ -238,12 +238,12 @@ EASEDEF float EaseElasticInOut(float t, float b, float c, float d)
|
|||
if (t < 1)
|
||||
{
|
||||
float postFix = a*pow(2, 10*(t-=1));
|
||||
return -0.5f*(postFix*sin((t*d-s)*(2*PI)/p)) + b;
|
||||
return -0.5f*(postFix*sin((t*d-s)*(2*RL_PI)/p)) + b;
|
||||
}
|
||||
|
||||
float postFix = a*pow(2, -10*(t-=1));
|
||||
|
||||
return (postFix*sin((t*d-s)*(2*PI)/p)*0.5f + c + b);
|
||||
return (postFix*sin((t*d-s)*(2*RL_PI)/p)*0.5f + c + b);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
4
src/external/dr_mp3.h
vendored
4
src/external/dr_mp3.h
vendored
|
|
@ -1536,7 +1536,7 @@ static void drmp3d_DCT_II(float *grbuf, int n)
|
|||
x6 = DRMP3_VMUL_S(DRMP3_VADD(x6, x7), 0.70710677f);
|
||||
x7 = DRMP3_VADD(x7, xt);
|
||||
x3 = DRMP3_VMUL_S(DRMP3_VADD(x3, x4), 0.70710677f);
|
||||
x5 = DRMP3_VSUB(x5, DRMP3_VMUL_S(x7, 0.198912367f)); /* rotate by PI/8 */
|
||||
x5 = DRMP3_VSUB(x5, DRMP3_VMUL_S(x7, 0.198912367f)); /* rotate by RL_PI/8 */
|
||||
x7 = DRMP3_VADD(x7, DRMP3_VMUL_S(x5, 0.382683432f));
|
||||
x5 = DRMP3_VSUB(x5, DRMP3_VMUL_S(x7, 0.198912367f));
|
||||
x0 = DRMP3_VSUB(xt, x6); xt = DRMP3_VADD(xt, x6);
|
||||
|
|
@ -1622,7 +1622,7 @@ static void drmp3d_DCT_II(float *grbuf, int n)
|
|||
x6 = (x6 + x7)*0.70710677f;
|
||||
x7 = x7 + xt;
|
||||
x3 = (x3 + x4)*0.70710677f;
|
||||
x5 -= x7*0.198912367f; /* rotate by PI/8 */
|
||||
x5 -= x7*0.198912367f; /* rotate by RL_PI/8 */
|
||||
x7 += x5*0.382683432f;
|
||||
x5 -= x7*0.198912367f;
|
||||
x0 = xt - x6; xt += x6;
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@
|
|||
#ifndef GESTURES_H
|
||||
#define GESTURES_H
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.14159265358979323846
|
||||
#ifndef RL_PI
|
||||
#define RL_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
@ -493,7 +493,7 @@ float GetGesturePinchAngle(void)
|
|||
// Returns angle from two-points vector with X-axis
|
||||
static float Vector2Angle(Vector2 v1, Vector2 v2)
|
||||
{
|
||||
float angle = atan2f(v2.y - v1.y, v2.x - v1.x)*(180.0f/PI);
|
||||
float angle = atan2f(v2.y - v1.y, v2.x - v1.x)*(180.0f/RL_PI);
|
||||
|
||||
if (angle < 0) angle += 360.0f;
|
||||
|
||||
|
|
|
|||
130
src/models.c
130
src/models.c
|
|
@ -124,8 +124,8 @@ void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rota
|
|||
{
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radius, cosf(DEG2RAD*i)*radius, 0.0f);
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 10))*radius, cosf(DEG2RAD*(i + 10))*radius, 0.0f);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radius, cosf(RL_DEG2RAD*i)*radius, 0.0f);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 10))*radius, cosf(RL_DEG2RAD*(i + 10))*radius, 0.0f);
|
||||
}
|
||||
rlEnd();
|
||||
rlPopMatrix();
|
||||
|
|
@ -360,25 +360,25 @@ void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color
|
|||
{
|
||||
for (int j = 0; j < slices; j++)
|
||||
{
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*i))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*i))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*i))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*i))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i)))*sinf(DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i)))*cosf(DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i)))*sinf(RL_DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i)))*cosf(RL_DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*((j+1)*360/slices)));
|
||||
}
|
||||
}
|
||||
rlEnd();
|
||||
|
|
@ -400,26 +400,26 @@ void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Col
|
|||
{
|
||||
for (int j = 0; j < slices; j++)
|
||||
{
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*i))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*i))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*((j+1)*360/slices)));
|
||||
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*((j+1)*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*((j+1)*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*i))*sinf(DEG2RAD*(j*360/slices)),
|
||||
sinf(DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(DEG2RAD*(270+(180/(rings + 1))*i))*cosf(DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1))),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
rlVertex3f(cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*sinf(RL_DEG2RAD*(j*360/slices)),
|
||||
sinf(RL_DEG2RAD*(270+(180/(rings + 1))*i)),
|
||||
cosf(RL_DEG2RAD*(270+(180/(rings + 1))*i))*cosf(RL_DEG2RAD*(j*360/slices)));
|
||||
}
|
||||
}
|
||||
rlEnd();
|
||||
|
|
@ -443,21 +443,21 @@ void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float h
|
|||
// Draw Body -------------------------------------------------------------------------------------
|
||||
for (int i = 0; i < 360; i += 360/sides)
|
||||
{
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusBottom, 0, cosf(DEG2RAD*i)*radiusBottom); //Bottom Left
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(DEG2RAD*(i + 360/sides))*radiusBottom); //Bottom Right
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(DEG2RAD*(i + 360/sides))*radiusTop); //Top Right
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusBottom, 0, cosf(RL_DEG2RAD*i)*radiusBottom); //Bottom Left
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(RL_DEG2RAD*(i + 360/sides))*radiusBottom); //Bottom Right
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(RL_DEG2RAD*(i + 360/sides))*radiusTop); //Top Right
|
||||
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusTop, height, cosf(DEG2RAD*i)*radiusTop); //Top Left
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusBottom, 0, cosf(DEG2RAD*i)*radiusBottom); //Bottom Left
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(DEG2RAD*(i + 360/sides))*radiusTop); //Top Right
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusTop, height, cosf(RL_DEG2RAD*i)*radiusTop); //Top Left
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusBottom, 0, cosf(RL_DEG2RAD*i)*radiusBottom); //Bottom Left
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(RL_DEG2RAD*(i + 360/sides))*radiusTop); //Top Right
|
||||
}
|
||||
|
||||
// Draw Cap --------------------------------------------------------------------------------------
|
||||
for (int i = 0; i < 360; i += 360/sides)
|
||||
{
|
||||
rlVertex3f(0, height, 0);
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusTop, height, cosf(DEG2RAD*i)*radiusTop);
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(DEG2RAD*(i + 360/sides))*radiusTop);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusTop, height, cosf(RL_DEG2RAD*i)*radiusTop);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(RL_DEG2RAD*(i + 360/sides))*radiusTop);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -466,8 +466,8 @@ void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float h
|
|||
for (int i = 0; i < 360; i += 360/sides)
|
||||
{
|
||||
rlVertex3f(0, height, 0);
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusBottom, 0, cosf(DEG2RAD*i)*radiusBottom);
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(DEG2RAD*(i + 360/sides))*radiusBottom);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusBottom, 0, cosf(RL_DEG2RAD*i)*radiusBottom);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(RL_DEG2RAD*(i + 360/sides))*radiusBottom);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -475,8 +475,8 @@ void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float h
|
|||
for (int i = 0; i < 360; i += 360/sides)
|
||||
{
|
||||
rlVertex3f(0, 0, 0);
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(DEG2RAD*(i + 360/sides))*radiusBottom);
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusBottom, 0, cosf(DEG2RAD*i)*radiusBottom);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(RL_DEG2RAD*(i + 360/sides))*radiusBottom);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusBottom, 0, cosf(RL_DEG2RAD*i)*radiusBottom);
|
||||
}
|
||||
rlEnd();
|
||||
rlPopMatrix();
|
||||
|
|
@ -496,17 +496,17 @@ void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, fl
|
|||
|
||||
for (int i = 0; i < 360; i += 360/sides)
|
||||
{
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusBottom, 0, cosf(DEG2RAD*i)*radiusBottom);
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(DEG2RAD*(i + 360/sides))*radiusBottom);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusBottom, 0, cosf(RL_DEG2RAD*i)*radiusBottom);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(RL_DEG2RAD*(i + 360/sides))*radiusBottom);
|
||||
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(DEG2RAD*(i + 360/sides))*radiusBottom);
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(DEG2RAD*(i + 360/sides))*radiusTop);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusBottom, 0, cosf(RL_DEG2RAD*(i + 360/sides))*radiusBottom);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(RL_DEG2RAD*(i + 360/sides))*radiusTop);
|
||||
|
||||
rlVertex3f(sinf(DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(DEG2RAD*(i + 360/sides))*radiusTop);
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusTop, height, cosf(DEG2RAD*i)*radiusTop);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*(i + 360/sides))*radiusTop, height, cosf(RL_DEG2RAD*(i + 360/sides))*radiusTop);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusTop, height, cosf(RL_DEG2RAD*i)*radiusTop);
|
||||
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusTop, height, cosf(DEG2RAD*i)*radiusTop);
|
||||
rlVertex3f(sinf(DEG2RAD*i)*radiusBottom, 0, cosf(DEG2RAD*i)*radiusBottom);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusTop, height, cosf(RL_DEG2RAD*i)*radiusTop);
|
||||
rlVertex3f(sinf(RL_DEG2RAD*i)*radiusBottom, 0, cosf(RL_DEG2RAD*i)*radiusBottom);
|
||||
}
|
||||
rlEnd();
|
||||
rlPopMatrix();
|
||||
|
|
@ -727,8 +727,8 @@ Mesh GenMeshPoly(int sides, float radius)
|
|||
for (int i = 0, v = 0; i < 360; i += 360/sides, v += 3)
|
||||
{
|
||||
vertices[v] = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||
vertices[v + 1] = (Vector3){ sinf(DEG2RAD*i)*radius, 0.0f, cosf(DEG2RAD*i)*radius };
|
||||
vertices[v + 2] = (Vector3){ sinf(DEG2RAD*(i + 360/sides))*radius, 0.0f, cosf(DEG2RAD*(i + 360/sides))*radius };
|
||||
vertices[v + 1] = (Vector3){ sinf(RL_DEG2RAD*i)*radius, 0.0f, cosf(RL_DEG2RAD*i)*radius };
|
||||
vertices[v + 2] = (Vector3){ sinf(RL_DEG2RAD*(i + 360/sides))*radius, 0.0f, cosf(RL_DEG2RAD*(i + 360/sides))*radius };
|
||||
}
|
||||
|
||||
// Normals definition
|
||||
|
|
@ -878,7 +878,7 @@ Mesh GenMeshPlane(float width, float length, int resX, int resZ)
|
|||
|
||||
par_shapes_mesh *plane = par_shapes_create_plane(resX, resZ); // No normals/texcoords generated!!!
|
||||
par_shapes_scale(plane, width, length, 1.0f);
|
||||
par_shapes_rotate(plane, -PI/2.0f, (float[]){ 1, 0, 0 });
|
||||
par_shapes_rotate(plane, -RL_PI/2.0f, (float[]){ 1, 0, 0 });
|
||||
par_shapes_translate(plane, -width/2, 0.0f, length/2);
|
||||
|
||||
mesh.vertices = (float *)malloc(plane->ntriangles*3*3*sizeof(float));
|
||||
|
|
@ -1163,20 +1163,20 @@ Mesh GenMeshCylinder(float radius, float height, int slices)
|
|||
// Height and radius are both 1.0, but they can easily be changed with par_shapes_scale
|
||||
par_shapes_mesh *cylinder = par_shapes_create_cylinder(slices, 8);
|
||||
par_shapes_scale(cylinder, radius, radius, height);
|
||||
par_shapes_rotate(cylinder, -PI/2.0f, (float[]){ 1, 0, 0 });
|
||||
par_shapes_rotate(cylinder, -RL_PI/2.0f, (float[]){ 1, 0, 0 });
|
||||
|
||||
// Generate an orientable disk shape (top cap)
|
||||
par_shapes_mesh *capTop = par_shapes_create_disk(radius, slices, (float[]){ 0, 0, 0 }, (float[]){ 0, 0, 1 });
|
||||
capTop->tcoords = PAR_MALLOC(float, 2*capTop->npoints);
|
||||
for (int i = 0; i < 2*capTop->npoints; i++) capTop->tcoords[i] = 0.0f;
|
||||
par_shapes_rotate(capTop, -PI/2.0f, (float[]){ 1, 0, 0 });
|
||||
par_shapes_rotate(capTop, -RL_PI/2.0f, (float[]){ 1, 0, 0 });
|
||||
par_shapes_translate(capTop, 0, height, 0);
|
||||
|
||||
// Generate an orientable disk shape (bottom cap)
|
||||
par_shapes_mesh *capBottom = par_shapes_create_disk(radius, slices, (float[]){ 0, 0, 0 }, (float[]){ 0, 0, -1 });
|
||||
capBottom->tcoords = PAR_MALLOC(float, 2*capBottom->npoints);
|
||||
for (int i = 0; i < 2*capBottom->npoints; i++) capBottom->tcoords[i] = 0.95f;
|
||||
par_shapes_rotate(capBottom, PI/2.0f, (float[]){ 1, 0, 0 });
|
||||
par_shapes_rotate(capBottom, RL_PI/2.0f, (float[]){ 1, 0, 0 });
|
||||
|
||||
par_shapes_merge_and_free(cylinder, capTop);
|
||||
par_shapes_merge_and_free(cylinder, capBottom);
|
||||
|
|
@ -1824,7 +1824,7 @@ void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rota
|
|||
// Calculate transformation matrix from function parameters
|
||||
// Get transform matrix (rotation -> scale -> translation)
|
||||
Matrix matScale = MatrixScale(scale.x, scale.y, scale.z);
|
||||
Matrix matRotation = MatrixRotate(rotationAxis, rotationAngle*DEG2RAD);
|
||||
Matrix matRotation = MatrixRotate(rotationAxis, rotationAngle*RL_DEG2RAD);
|
||||
Matrix matTranslation = MatrixTranslate(position.x, position.y, position.z);
|
||||
|
||||
Matrix matTransform = MatrixMultiply(MatrixMultiply(matScale, matRotation), matTranslation);
|
||||
|
|
|
|||
|
|
@ -84,12 +84,12 @@
|
|||
//----------------------------------------------------------------------------------
|
||||
// Some basic Defines
|
||||
//----------------------------------------------------------------------------------
|
||||
#ifndef PI
|
||||
#define PI 3.14159265358979323846f
|
||||
#ifndef RL_PI
|
||||
#define RL_PI 3.14159265358979323846f
|
||||
#endif
|
||||
|
||||
#define DEG2RAD (PI/180.0f)
|
||||
#define RAD2DEG (180.0f/PI)
|
||||
#define RL_DEG2RAD (RL_PI/180.0f)
|
||||
#define RL_RAD2DEG (180.0f/RL_PI)
|
||||
|
||||
#define MAX_TOUCH_POINTS 10 // Maximum number of touch points supported
|
||||
|
||||
|
|
|
|||
|
|
@ -74,16 +74,16 @@
|
|||
//----------------------------------------------------------------------------------
|
||||
// Defines and Macros
|
||||
//----------------------------------------------------------------------------------
|
||||
#ifndef PI
|
||||
#define PI 3.14159265358979323846
|
||||
#ifndef RL_PI
|
||||
#define RL_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifndef DEG2RAD
|
||||
#define DEG2RAD (PI/180.0f)
|
||||
#ifndef RL_DEG2RAD
|
||||
#define RL_DEG2RAD (RL_PI/180.0f)
|
||||
#endif
|
||||
|
||||
#ifndef RAD2DEG
|
||||
#define RAD2DEG (180.0f/PI)
|
||||
#ifndef RL_RAD2DEG
|
||||
#define RL_RAD2DEG (180.0f/RL_PI)
|
||||
#endif
|
||||
|
||||
// Return float vector for Matrix
|
||||
|
|
@ -210,7 +210,7 @@ RMDEF float Vector2Distance(Vector2 v1, Vector2 v2)
|
|||
// Calculate angle from two vectors in X-axis
|
||||
RMDEF float Vector2Angle(Vector2 v1, Vector2 v2)
|
||||
{
|
||||
float result = atan2f(v2.y - v1.y, v2.x - v1.x)*(180.0f/PI);
|
||||
float result = atan2f(v2.y - v1.y, v2.x - v1.x)*(180.0f/RL_PI);
|
||||
if (result < 0) result += 360.0f;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1346,18 +1346,18 @@ RMDEF Vector3 QuaternionToEuler(Quaternion q)
|
|||
// roll (x-axis rotation)
|
||||
float x0 = 2.0f*(q.w*q.x + q.y*q.z);
|
||||
float x1 = 1.0f - 2.0f*(q.x*q.x + q.y*q.y);
|
||||
result.x = atan2f(x0, x1)*RAD2DEG;
|
||||
result.x = atan2f(x0, x1)*RL_RAD2DEG;
|
||||
|
||||
// pitch (y-axis rotation)
|
||||
float y0 = 2.0f*(q.w*q.y - q.z*q.x);
|
||||
y0 = y0 > 1.0f ? 1.0f : y0;
|
||||
y0 = y0 < -1.0f ? -1.0f : y0;
|
||||
result.y = asinf(y0)*RAD2DEG;
|
||||
result.y = asinf(y0)*RL_RAD2DEG;
|
||||
|
||||
// yaw (z-axis rotation)
|
||||
float z0 = 2.0f*(q.w*q.z + q.x*q.y);
|
||||
float z1 = 1.0f - 2.0f*(q.y*q.y + q.z*q.z);
|
||||
result.z = atan2f(z0, z1)*RAD2DEG;
|
||||
result.z = atan2f(z0, z1)*RL_RAD2DEG;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1004,7 +1004,7 @@ void rlRotatef(float angleDeg, float x, float y, float z)
|
|||
Matrix matRotation = MatrixIdentity();
|
||||
|
||||
Vector3 axis = (Vector3){ x, y, z };
|
||||
matRotation = MatrixRotate(Vector3Normalize(axis), angleDeg*DEG2RAD);
|
||||
matRotation = MatrixRotate(Vector3Normalize(axis), angleDeg*RL_DEG2RAD);
|
||||
|
||||
// NOTE: We transpose matrix with multiplication order
|
||||
*currentMatrix = MatrixMultiply(matRotation, *currentMatrix);
|
||||
|
|
@ -3010,7 +3010,7 @@ Texture2D GenTextureCubemap(Shader shader, Texture2D skyHDR, int size)
|
|||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
// Create projection (transposed) and different views for each face
|
||||
Matrix fboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, 0.01, 1000.0);
|
||||
Matrix fboProjection = MatrixPerspective(90.0*RL_DEG2RAD, 1.0, 0.01, 1000.0);
|
||||
//MatrixTranspose(&fboProjection);
|
||||
Matrix fboViews[6] = {
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
|
|
@ -3083,7 +3083,7 @@ Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size)
|
|||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
// Create projection (transposed) and different views for each face
|
||||
Matrix fboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, 0.01, 1000.0);
|
||||
Matrix fboProjection = MatrixPerspective(90.0*RL_DEG2RAD, 1.0, 0.01, 1000.0);
|
||||
//MatrixTranspose(&fboProjection);
|
||||
Matrix fboViews[6] = {
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
|
|
@ -3160,7 +3160,7 @@ Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size)
|
|||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
||||
|
||||
// Create projection (transposed) and different views for each face
|
||||
Matrix fboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, 0.01, 1000.0);
|
||||
Matrix fboProjection = MatrixPerspective(90.0*RL_DEG2RAD, 1.0, 0.01, 1000.0);
|
||||
//MatrixTranspose(&fboProjection);
|
||||
Matrix fboViews[6] = {
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
|
|
|
|||
30
src/shapes.c
30
src/shapes.c
|
|
@ -131,7 +131,7 @@ void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
|
|||
|
||||
rlPushMatrix();
|
||||
rlTranslatef((float)startPos.x, (float)startPos.y, 0);
|
||||
rlRotatef(RAD2DEG*angle, 0, 0, 1);
|
||||
rlRotatef(RL_RAD2DEG*angle, 0, 0, 1);
|
||||
rlTranslatef(0, (thick > 1.0f) ? -thick/2.0f : -1.0f, 0);
|
||||
|
||||
rlBegin(RL_QUADS);
|
||||
|
|
@ -194,9 +194,9 @@ void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Co
|
|||
rlColor4ub(color1.r, color1.g, color1.b, color1.a);
|
||||
rlVertex2i(centerX, centerY);
|
||||
rlColor4ub(color2.r, color2.g, color2.b, color2.a);
|
||||
rlVertex2f(centerX + sinf(DEG2RAD*i)*radius, centerY + cosf(DEG2RAD*i)*radius);
|
||||
rlVertex2f(centerX + sinf(RL_DEG2RAD*i)*radius, centerY + cosf(RL_DEG2RAD*i)*radius);
|
||||
rlColor4ub(color2.r, color2.g, color2.b, color2.a);
|
||||
rlVertex2f(centerX + sinf(DEG2RAD*(i + 10))*radius, centerY + cosf(DEG2RAD*(i + 10))*radius);
|
||||
rlVertex2f(centerX + sinf(RL_DEG2RAD*(i + 10))*radius, centerY + cosf(RL_DEG2RAD*(i + 10))*radius);
|
||||
}
|
||||
rlEnd();
|
||||
}
|
||||
|
|
@ -219,13 +219,13 @@ void DrawCircleV(Vector2 center, float radius, Color color)
|
|||
rlVertex2f(center.x, center.y);
|
||||
|
||||
rlTexCoord2f(recTexShapes.x/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height);
|
||||
rlVertex2f(center.x + sinf(DEG2RAD*i)*radius, center.y + cosf(DEG2RAD*i)*radius);
|
||||
rlVertex2f(center.x + sinf(RL_DEG2RAD*i)*radius, center.y + cosf(RL_DEG2RAD*i)*radius);
|
||||
|
||||
rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height);
|
||||
rlVertex2f(center.x + sinf(DEG2RAD*(i + 10))*radius, center.y + cosf(DEG2RAD*(i + 10))*radius);
|
||||
rlVertex2f(center.x + sinf(RL_DEG2RAD*(i + 10))*radius, center.y + cosf(RL_DEG2RAD*(i + 10))*radius);
|
||||
|
||||
rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, recTexShapes.y/texShapes.height);
|
||||
rlVertex2f(center.x + sinf(DEG2RAD*(i + 20))*radius, center.y + cosf(DEG2RAD*(i + 20))*radius);
|
||||
rlVertex2f(center.x + sinf(RL_DEG2RAD*(i + 20))*radius, center.y + cosf(RL_DEG2RAD*(i + 20))*radius);
|
||||
}
|
||||
rlEnd();
|
||||
|
||||
|
|
@ -239,8 +239,8 @@ void DrawCircleV(Vector2 center, float radius, Color color)
|
|||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
rlVertex2f(center.x, center.y);
|
||||
rlVertex2f(center.x + sinf(DEG2RAD*i)*radius, center.y + cosf(DEG2RAD*i)*radius);
|
||||
rlVertex2f(center.x + sinf(DEG2RAD*(i + 10))*radius, center.y + cosf(DEG2RAD*(i + 10))*radius);
|
||||
rlVertex2f(center.x + sinf(RL_DEG2RAD*i)*radius, center.y + cosf(RL_DEG2RAD*i)*radius);
|
||||
rlVertex2f(center.x + sinf(RL_DEG2RAD*(i + 10))*radius, center.y + cosf(RL_DEG2RAD*(i + 10))*radius);
|
||||
}
|
||||
rlEnd();
|
||||
#endif
|
||||
|
|
@ -257,8 +257,8 @@ void DrawCircleLines(int centerX, int centerY, float radius, Color color)
|
|||
// NOTE: Circle outline is drawn pixel by pixel every degree (0 to 360)
|
||||
for (int i = 0; i < 360; i += 10)
|
||||
{
|
||||
rlVertex2f(centerX + sinf(DEG2RAD*i)*radius, centerY + cosf(DEG2RAD*i)*radius);
|
||||
rlVertex2f(centerX + sinf(DEG2RAD*(i + 10))*radius, centerY + cosf(DEG2RAD*(i + 10))*radius);
|
||||
rlVertex2f(centerX + sinf(RL_DEG2RAD*i)*radius, centerY + cosf(RL_DEG2RAD*i)*radius);
|
||||
rlVertex2f(centerX + sinf(RL_DEG2RAD*(i + 10))*radius, centerY + cosf(RL_DEG2RAD*(i + 10))*radius);
|
||||
}
|
||||
rlEnd();
|
||||
}
|
||||
|
|
@ -458,13 +458,13 @@ void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color col
|
|||
rlVertex2f(0, 0);
|
||||
|
||||
rlTexCoord2f(recTexShapes.x/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height);
|
||||
rlVertex2f(sinf(DEG2RAD*i)*radius, cosf(DEG2RAD*i)*radius);
|
||||
rlVertex2f(sinf(RL_DEG2RAD*i)*radius, cosf(RL_DEG2RAD*i)*radius);
|
||||
|
||||
rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height);
|
||||
rlVertex2f(sinf(DEG2RAD*i)*radius, cosf(DEG2RAD*i)*radius);
|
||||
rlVertex2f(sinf(RL_DEG2RAD*i)*radius, cosf(RL_DEG2RAD*i)*radius);
|
||||
|
||||
rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, recTexShapes.y/texShapes.height);
|
||||
rlVertex2f(sinf(DEG2RAD*(i + 360/sides))*radius, cosf(DEG2RAD*(i + 360/sides))*radius);
|
||||
rlVertex2f(sinf(RL_DEG2RAD*(i + 360/sides))*radius, cosf(RL_DEG2RAD*(i + 360/sides))*radius);
|
||||
}
|
||||
rlEnd();
|
||||
rlDisableTexture();
|
||||
|
|
@ -475,8 +475,8 @@ void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color col
|
|||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
rlVertex2f(0, 0);
|
||||
rlVertex2f(sinf(DEG2RAD*i)*radius, cosf(DEG2RAD*i)*radius);
|
||||
rlVertex2f(sinf(DEG2RAD*(i + 360/sides))*radius, cosf(DEG2RAD*(i + 360/sides))*radius);
|
||||
rlVertex2f(sinf(RL_DEG2RAD*i)*radius, cosf(RL_DEG2RAD*i)*radius);
|
||||
rlVertex2f(sinf(RL_DEG2RAD*(i + 360/sides))*radius, cosf(RL_DEG2RAD*(i + 360/sides))*radius);
|
||||
}
|
||||
rlEnd();
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user