Review formatting

This commit is contained in:
raysan5 2020-12-23 20:30:00 +01:00
parent 10a57f297e
commit d9a9bacb48
3 changed files with 122 additions and 126 deletions

View file

@ -34,16 +34,17 @@ int main(void)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
Mesh msh = GenMeshCylinder(.2, 1, 32);
Model mod = LoadModelFromMesh(msh);
Mesh mesh = GenMeshCylinder(0.2f, 1.0f, 32);
Model model = LoadModelFromMesh(mesh);
// Some required variables
Quaternion q1 = { 0 };
Matrix m1 = { 0 }, m2 = { 0 }, m3 = { 0 }, m4 = { 0 };
Vector3 v1 = { 0 }, v2 = { 0 };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
Quaternion q1;
Matrix m1,m2,m3,m4;
Vector3 v1,v2;
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@ -51,11 +52,11 @@ int main(void)
//--------------------------------------------------------------------------------------
if (!IsKeyDown(KEY_SPACE))
{
v1.x += 0.01;
v1.y += 0.03;
v1.z += 0.05;
v1.x += 0.01f;
v1.y += 0.03f;
v1.z += 0.05f;
}
if (v1.x > PI*2) v1.x -= PI*2;
if (v1.y > PI*2) v1.y -= PI*2;
if (v1.z > PI*2) v1.z -= PI*2;
@ -70,7 +71,7 @@ int main(void)
v2 = QuaternionToEuler(q1);
v2.x *= DEG2RAD;
v2.y *= DEG2RAD;
v2.z *=DEG2RAD;
v2.z *= DEG2RAD;
m4 = MatrixRotateZYX(v2);
//--------------------------------------------------------------------------------------
@ -80,16 +81,17 @@ int main(void)
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
mod.transform = m1;
DrawModel(mod, (Vector3){-1,0,0},1.0,RED);
mod.transform = m2;
DrawModel(mod, (Vector3){1,0,0},1.0,RED);
mod.transform = m3;
DrawModel(mod, (Vector3){0,0,0},1.0,RED);
mod.transform = m4;
DrawModel(mod, (Vector3){0,0,-1},1.0,RED);
model.transform = m1;
DrawModel(model, (Vector3){ -1, 0, 0 }, 1.0f, RED);
model.transform = m2;
DrawModel(model, (Vector3){ 1, 0, 0 }, 1.0f, RED);
model.transform = m3;
DrawModel(model, (Vector3){ 0, 0, 0 }, 1.0f, RED);
model.transform = m4;
DrawModel(model, (Vector3){ 0, 0, -1 }, 1.0f, RED);
DrawGrid(10, 1.0f);
@ -105,13 +107,13 @@ int main(void)
if (v1.y == v2.y) cy = GREEN;
if (v1.z == v2.z) cz = GREEN;
DrawText(TextFormat("%2.3f",v1.x),20,20,20,cx);
DrawText(TextFormat("%2.3f",v1.y),20,40,20,cy);
DrawText(TextFormat("%2.3f",v1.z),20,60,20,cz);
DrawText(TextFormat("%2.3f", v1.x), 20, 20, 20, cx);
DrawText(TextFormat("%2.3f", v1.y), 20, 40, 20, cy);
DrawText(TextFormat("%2.3f", v1.z), 20, 60, 20, cz);
DrawText(TextFormat("%2.3f",v2.x),200,20,20,cx);
DrawText(TextFormat("%2.3f",v2.y),200,40,20,cy);
DrawText(TextFormat("%2.3f",v2.z),200,60,20,cz);
DrawText(TextFormat("%2.3f", v2.x), 200, 20, 20, cx);
DrawText(TextFormat("%2.3f", v2.y), 200, 40, 20, cy);
DrawText(TextFormat("%2.3f", v2.z), 200, 60, 20, cz);
EndDrawing();
//----------------------------------------------------------------------------------
@ -119,6 +121,8 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadModel(model); // Unload model data (mesh and materials)
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------