|
50 | 50 | // Function specifiers in case library is build/used as a shared library (Windows) |
51 | 51 | // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll |
52 | 52 | #if defined(_WIN32) |
53 | | -#if defined(BUILD_LIBTYPE_SHARED) |
54 | | -#if defined(__TINYC__) |
55 | | -#define __declspec(x) __attribute__((x)) |
56 | | -#endif |
57 | | -#define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) |
58 | | -#elif defined(USE_LIBTYPE_SHARED) |
59 | | -#define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) |
60 | | -#endif |
| 53 | + #if defined(BUILD_LIBTYPE_SHARED) |
| 54 | + #if defined(__TINYC__) |
| 55 | + #define __declspec(x) __attribute__((x)) |
| 56 | + #endif |
| 57 | + #define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) |
| 58 | + #elif defined(USE_LIBTYPE_SHARED) |
| 59 | + #define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) |
| 60 | + #endif |
61 | 61 | #endif |
62 | 62 |
|
63 | 63 | #ifndef RLAPI |
@@ -191,19 +191,21 @@ RLAPI Matrix GetCameraProjectionMatrix(Camera *camera, float aspect); |
191 | 191 | // IsKeyDown() |
192 | 192 | // IsKeyPressed() |
193 | 193 | // GetFrameTime() |
| 194 | + |
| 195 | +#include <math.h> // Required for: fabsf() |
194 | 196 |
|
195 | 197 | //---------------------------------------------------------------------------------- |
196 | 198 | // Defines and Macros |
197 | 199 | //---------------------------------------------------------------------------------- |
198 | | -#define CAMERA_MOVE_SPEED 5.4f // Units per second |
199 | | -#define CAMERA_ROTATION_SPEED 0.03f |
200 | | -#define CAMERA_PAN_SPEED 0.2f |
| 200 | +#define CAMERA_MOVE_SPEED 5.4f // Units per second |
| 201 | +#define CAMERA_ROTATION_SPEED 0.03f |
| 202 | +#define CAMERA_PAN_SPEED 0.2f |
201 | 203 |
|
202 | 204 | // Camera mouse movement sensitivity |
203 | | -#define CAMERA_MOUSE_MOVE_SENSITIVITY 0.003f |
| 205 | +#define CAMERA_MOUSE_MOVE_SENSITIVITY 0.003f |
204 | 206 |
|
205 | 207 | // Camera orbital speed in CAMERA_ORBITAL mode |
206 | | -#define CAMERA_ORBITAL_SPEED 0.5f // Radians per second |
| 208 | +#define CAMERA_ORBITAL_SPEED 0.5f // Radians per second |
207 | 209 |
|
208 | 210 | //---------------------------------------------------------------------------------- |
209 | 211 | // Types and Structures Definition |
@@ -253,12 +255,10 @@ void CameraMoveForward(Camera *camera, float distance, bool moveInWorldPlane) |
253 | 255 | if (moveInWorldPlane) |
254 | 256 | { |
255 | 257 | // Project vector onto world plane (the plane defined by the up vector) |
256 | | - if (fabsf(camera->up.z) > 0) |
257 | | - forward.z = 0; |
258 | | - else if (fabsf(camera->up.x) > 0) |
259 | | - forward.x = 0; |
260 | | - else |
261 | | - forward.y = 0; |
| 258 | + if (fabsf(camera->up.z) > 0) forward.z = 0; |
| 259 | + else if (fabsf(camera->up.x) > 0) forward.x = 0; |
| 260 | + else forward.y = 0; |
| 261 | + |
262 | 262 | forward = Vector3Normalize(forward); |
263 | 263 | } |
264 | 264 |
|
@@ -291,12 +291,9 @@ void CameraMoveRight(Camera *camera, float distance, bool moveInWorldPlane) |
291 | 291 | if (moveInWorldPlane) |
292 | 292 | { |
293 | 293 | // Project vector onto world plane (the plane defined by the up vector) |
294 | | - if (fabsf(camera->up.z) > 0) |
295 | | - right.z = 0; |
296 | | - else if (fabsf(camera->up.x) > 0) |
297 | | - right.x = 0; |
298 | | - else |
299 | | - right.y = 0; |
| 294 | + if (fabsf(camera->up.z) > 0) right.z = 0; |
| 295 | + else if (fabsf(camera->up.x) > 0) right.x = 0; |
| 296 | + else right.y = 0; |
300 | 297 |
|
301 | 298 | right = Vector3Normalize(right); |
302 | 299 | } |
@@ -356,7 +353,7 @@ void CameraYaw(Camera *camera, float angle, bool rotateAroundTarget) |
356 | 353 | // - lockView prevents camera overrotation (aka "somersaults") |
357 | 354 | // - rotateAroundTarget defines if rotation is around target or around its position |
358 | 355 | // - rotateUp rotates the up direction as well (typically only usefull in CAMERA_FREE) |
359 | | -// NOTE: angle must be provided in radians |
| 356 | +// NOTE: [angle] must be provided in radians |
360 | 357 | void CameraPitch(Camera *camera, float angle, bool lockView, bool rotateAroundTarget, bool rotateUp) |
361 | 358 | { |
362 | 359 | // Up direction |
@@ -393,7 +390,7 @@ void CameraPitch(Camera *camera, float angle, bool lockView, bool rotateAroundTa |
393 | 390 | // Move position relative to target |
394 | 391 | camera->position = Vector3Subtract(camera->target, targetPosition); |
395 | 392 | } |
396 | | - else // rotate around camera.position |
| 393 | + else // Rotate around camera.position |
397 | 394 | { |
398 | 395 | // Move target relative to position |
399 | 396 | camera->target = Vector3Add(camera->position, targetPosition); |
|
0 commit comments