Pre-prending RL_ prefix for some raylib header macros.
This commit is contained in:
parent
e48f2f9d43
commit
8cea5f28b0
7 changed files with 210 additions and 210 deletions
|
|
@ -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);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue