Browse Source

Reviewed skybox example

pull/558/head
Ray 6 years ago
parent
commit
1ff8947864
2 changed files with 7 additions and 2 deletions
  1. +7
    -2
      examples/models/models_skybox.c
  2. BIN
      examples/models/models_skybox.png

+ 7
- 2
examples/models/models_skybox.c View File

@ -36,10 +36,15 @@ int main()
Shader shdrCubemap = LoadShader("resources/shaders/cubemap.vs", "resources/shaders/cubemap.fs");
SetShaderValuei(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, 1);
// 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.material.maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, texHDR, 512);
UnloadShader(shdrCubemap); // Cubemap generation shader not required any more
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
@ -76,7 +81,7 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadModel(skybox); // Unload skybox model
UnloadModel(skybox); // Unload skybox model (and textures)
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

BIN
examples/models/models_skybox.png View File

Before After
Width: 800  |  Height: 450  |  Size: 707 KiB Width: 800  |  Height: 450  |  Size: 417 KiB

Loading…
Cancel
Save