Bläddra i källkod

various fixes and formatting tweaks

pull/5351/head
RobinsAviary 3 månader sedan
förälder
incheckning
4cae195763
1 ändrade filer med 9 tillägg och 11 borttagningar
  1. +9
    -11
      examples/models/models_directional_billboard.c

+ 9
- 11
examples/models/models_directional_billboard.c Visa fil

@ -18,6 +18,7 @@
#include "raylib.h"
#include "raymath.h"
#include <math.h>
//------------------------------------------------------------------------------------
// Program main entry point
@ -68,9 +69,15 @@ int main(void)
}
// Reset frame index to zero on overflow
if (anim >= 4)
if (anim >= 4) anim = 0;
// Find the current direction frame based on the camera position to the billboard object
float dir = (float)floor(((Vector2Angle((Vector2){ 2.0f, 0.0f }, (Vector2){ camera.position.x, camera.position.z })/PI)*4.0f) + 0.25f);
// Correct frame index if angle is negative
if (dir < 0.0f)
{
anim = 0;
dir = 8.0f - (float)abs((int)dir);
}
//----------------------------------------------------------------------------------
@ -83,15 +90,6 @@ int main(void)
BeginMode3D(camera);
DrawGrid(10, 1.0f);
// Find the current direction frame based on the camera position to the billboard object
float dir = (float)floor(((Vector2Angle((Vector2){ 2.0f, 0.0f }, (Vector2){ camera.position.x, camera.position.z })/PI)*4.0f) + 0.25f);
// Correct frame index if angle is negative
if (dir < 0.0f)
{
dir = 8.0f - (float)abs((int)dir);
}
// Draw billboard pointing straight up to the sky, rotated relative to the camera and offset from the bottom
DrawBillboardPro(camera, skillbot, (Rectangle){ 0.0f + (anim*24.0f), 0.0f + (dir*24.0f), 24.0f, 24.0f }, Vector3Zero(), (Vector3){ 0.0f, 1.0f, 0.0f }, Vector2One(), (Vector2){ 0.5f, 0.0f }, 0, WHITE);

Laddar…
Avbryt
Spara