diff options
Diffstat (limited to 'examples/web/models/models_billboard.c')
| -rw-r--r-- | examples/web/models/models_billboard.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/examples/web/models/models_billboard.c b/examples/web/models/models_billboard.c index ea64d03..cd83e33 100644 --- a/examples/web/models/models_billboard.c +++ b/examples/web/models/models_billboard.c @@ -18,22 +18,22 @@ //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -int screenWidth = 800; -int screenHeight = 450; +const int screenWidth = 800; +const int screenHeight = 450; // Define the camera to look into our 3d world -Camera camera = {{ 5.0f, 4.0f, 5.0f }, { 0.0f, 2.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f }; +Camera camera = { 0 }; -Texture2D bill; // Our texture billboard +Texture2D bill = { 0 }; // Our texture billboard Vector3 billPosition = { 0.0f, 2.0f, 0.0f }; // Position where draw billboard - + //---------------------------------------------------------------------------------- // Module Functions Declaration //---------------------------------------------------------------------------------- void UpdateDrawFrame(void); // Update and Draw one frame //---------------------------------------------------------------------------------- -// Main Enry Point +// Program Main Entry Point //---------------------------------------------------------------------------------- int main(void) { @@ -41,8 +41,14 @@ int main(void) //-------------------------------------------------------------------------------------- InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards"); + camera.position = (Vector3){ 5.0f, 4.0f, 5.0f }; + camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; + camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; + camera.fovy = 45.0f; + camera.type = CAMERA_PERSPECTIVE; + bill = LoadTexture("resources/billboard.png"); // Our texture billboard - + SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode #if defined(PLATFORM_WEB) @@ -50,7 +56,7 @@ int main(void) #else SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- - + // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { @@ -84,13 +90,12 @@ void UpdateDrawFrame(void) ClearBackground(RAYWHITE); - Begin3dMode(camera); - - DrawBillboard(camera, bill, billPosition, 2.0f, WHITE); + BeginMode3D(camera); DrawGrid(10, 1.0f); // Draw a grid + DrawBillboard(camera, bill, billPosition, 2.0f, WHITE); - End3dMode(); + EndMode3D(); DrawFPS(10, 10); |
