summaryrefslogtreecommitdiffhomepage
path: root/examples/core/core_quat_conversion.c
diff options
context:
space:
mode:
authorRay <[email protected]>2021-04-22 18:55:24 +0200
committerRay <[email protected]>2021-04-22 18:55:24 +0200
commitdcf52c132fb0ca28f37dae9d957155e2541df812 (patch)
treeb6c263e59daba00fc33badd0a45fa6756d5df14c /examples/core/core_quat_conversion.c
parentf92ee46d86b5a0cfb05c10b0c31fb966a4784b44 (diff)
downloadraylib-dcf52c132fb0ca28f37dae9d957155e2541df812.tar.gz
raylib-dcf52c132fb0ca28f37dae9d957155e2541df812.zip
Remove trail spaces
Diffstat (limited to 'examples/core/core_quat_conversion.c')
-rw-r--r--examples/core/core_quat_conversion.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/examples/core/core_quat_conversion.c b/examples/core/core_quat_conversion.c
index a7ea8247..cca6f01e 100644
--- a/examples/core/core_quat_conversion.c
+++ b/examples/core/core_quat_conversion.c
@@ -26,7 +26,7 @@ int main(void)
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - quat conversions");
-
+
Camera3D camera = { 0 };
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
@@ -34,9 +34,9 @@ int main(void)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
- Mesh mesh = GenMeshCylinder(0.2f, 1.0f, 32);
+ 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 };
@@ -44,7 +44,7 @@ int main(void)
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -60,28 +60,28 @@ int main(void)
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;
-
+
q1 = QuaternionFromEuler(v1.x, v1.y, v1.z);
m1 = MatrixRotateZYX(v1);
m2 = QuaternionToMatrix(q1);
q1 = QuaternionFromMatrix(m1);
m3 = QuaternionToMatrix(q1);
-
- v2 = QuaternionToEuler(q1);
- v2.x *= DEG2RAD;
- v2.y *= DEG2RAD;
- v2.z *= DEG2RAD;
-
+
+ v2 = QuaternionToEuler(q1);
+ v2.x *= DEG2RAD;
+ v2.y *= DEG2RAD;
+ v2.z *= DEG2RAD;
+
m4 = MatrixRotateZYX(v2);
//--------------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
-
+
BeginMode3D(camera);
model.transform = m1;
@@ -94,19 +94,19 @@ int main(void)
DrawModel(model, (Vector3){ 0, 0, -1 }, 1.0f, RED);
DrawGrid(10, 1.0f);
-
+
EndMode3D();
-
+
if (v2.x < 0) v2.x += PI*2;
if (v2.y < 0) v2.y += PI*2;
if (v2.z < 0) v2.z += PI*2;
-
+
Color cx,cy,cz;
cx = cy = cz = BLACK;
if (v1.x == v2.x) cx = GREEN;
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);
@@ -122,7 +122,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadModel(model); // Unload model data (mesh and materials)
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------