diff options
| author | Ray <[email protected]> | 2019-05-20 16:36:42 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2019-05-20 16:36:42 +0200 |
| commit | b525039e0ab8bcaa2fd6bde34c72a6405f88ae49 (patch) | |
| tree | 08f1c79bfe693643564ed78202c9474b7eb83a79 /examples/models/models_skybox.c | |
| parent | a43a7980a30a52462956b23f2473e8ef8f38d1fb (diff) | |
| download | raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.tar.gz raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.zip | |
Review ALL examples
Diffstat (limited to 'examples/models/models_skybox.c')
| -rw-r--r-- | examples/models/models_skybox.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/models/models_skybox.c b/examples/models/models_skybox.c index d3369b70..1693d9bc 100644 --- a/examples/models/models_skybox.c +++ b/examples/models/models_skybox.c @@ -11,22 +11,22 @@ #include "raylib.h" -int main() +int main(void) { // Initialization //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; + const int screenWidth = 800; + const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [models] example - skybox loading and drawing"); // Define the camera to look into our 3d world Camera camera = {{ 1.0f, 1.0f, 1.0f }, { 4.0f, 1.0f, 4.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 }; - // Load skybox model + // Load skybox model Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f); Model skybox = LoadModelFromMesh(cube); - + // Load skybox shader and set required locations // NOTE: Some locations are automatically set at shader loading #if defined(PLATFORM_DESKTOP) @@ -43,17 +43,17 @@ int main() Shader shdrCubemap = LoadShader("resources/shaders/glsl100/cubemap.vs", "resources/shaders/glsl100/cubemap.fs"); #endif SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, UNIFORM_INT); - + // Load HDR panorama (sphere) texture Texture2D texHDR = LoadTexture("resources/dresden_square.hdr"); - + // Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture // NOTE: New texture is generated rendering to texture, shader computes the sphre->cube coordinates mapping skybox.materials[0].maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, texHDR, 512); - + UnloadTexture(texHDR); // Texture not required anymore, cubemap already generated UnloadShader(shdrCubemap); // Unload cubemap generation shader, not required anymore - + SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode SetTargetFPS(60); // Set our game to run at 60 frames-per-second @@ -76,7 +76,7 @@ int main() BeginMode3D(camera); DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE); - + DrawGrid(10, 1.0f); EndMode3D(); |
