Reviewed example PR

This commit is contained in:
Ray 2023-12-19 10:35:45 +01:00
parent dad6f8eeaa
commit f992dd73c9

View File

@ -25,8 +25,10 @@
#define GLSL_VERSION 120 #define GLSL_VERSION 120
#endif #endif
#define MAX_LIGHTS 4 // Max dynamic lights supported by shader #include <stdlib.h> // Required for: NULL
int lightsCount; // Current number of dynamic lights that have been created
#define MAX_LIGHTS 4 // Max dynamic lights supported by shader
int lightsCount; // Current number of dynamic lights that have been created
typedef struct { typedef struct {
int enabled; int enabled;
@ -186,7 +188,9 @@ int main()
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(BLACK); ClearBackground(BLACK);
BeginMode3D(camera); BeginMode3D(camera);
SetShaderValue(shader, textureTilingLoc, &floorTiling, SHADER_UNIFORM_VEC2); SetShaderValue(shader, textureTilingLoc, &floorTiling, SHADER_UNIFORM_VEC2);
@ -214,9 +218,10 @@ int main()
if (lights[i].enabled) DrawSphereEx(lights[i].position, 0.2f, 8, 8, col); if (lights[i].enabled) DrawSphereEx(lights[i].position, 0.2f, 8, 8, col);
else DrawSphereWires(lights[i].position, 0.2f, 8, 8, ColorAlpha(col, 0.3f)); else DrawSphereWires(lights[i].position, 0.2f, 8, 8, ColorAlpha(col, 0.3f));
} }
EndMode3D(); EndMode3D();
DrawText("(c) Old Rusty Car model by Renafox (https://skfb.ly/LxRy)", screenWidth - 320, screenHeight - 20, 10, GRAY); DrawText("(c) Old Rusty Car model by Renafox (https://skfb.ly/LxRy)", screenWidth - 320, screenHeight - 20, 10, LIGHTGRAY);
DrawFPS(10, 10); DrawFPS(10, 10);
EndDrawing(); EndDrawing();
@ -228,12 +233,12 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
model.materials[0].shader = (Shader){ 0 }; model.materials[0].shader = (Shader){ 0 };
floor.materials[0].shader = (Shader){ 0 }; floor.materials[0].shader = (Shader){ 0 };
UnloadMaterial(model.materials[0]); // Unload PBRMaterial UnloadMaterial(model.materials[0]);
UnloadMaterial(floor.materials[0]); // Unload PBRMaterial UnloadMaterial(floor.materials[0]);
model.materials[0].maps = NULL; model.materials[0].maps = NULL;
floor.materials[0].maps = NULL; floor.materials[0].maps = NULL;
UnloadModel(floor); // Unload model UnloadModel(floor); // Unload model
UnloadModel(model); // Unload model UnloadModel(model); // Unload model
UnloadShader(shader); // Unload Shader UnloadShader(shader); // Unload Shader
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context