Demonstrates usage of cube map textures and texture blending.
Simulates open world with two tarnish reflective spheres in front of the camera. This example also demonstrates usage of scene graph, resource manager and pre-made primitives.
The application tries to load a cube map texture from the directory in which it is run, implicitly six JEPG files
-z.jpg, each representing one side of the cube. Note that all images must be turned upside down (+Y is top):
+----+ | -Y | +----+----+----+----+ | -Z | -X | +Z | +X | +----+----+----+----+ | +Y | +----+
You can also pass a path to the application as a parameter:
The application will then load
~/images/city-x.jpg etc. as a cube map texture. Alternatively, if you have a combined cube map file (such as an EXR), you can load it directly:
Sample cube map files are supplied alongside the source. If you install the examples, the images are also copied into
<prefix>/share/magnum/examples/cubemap/. Running the example with the bundled files can be then done like this:
Arrow keys rotate the camera around the spheres. It is not possible, due to nature of the cube map projection, to move around the scene.
Full source code is linked below and together with assets available in the magnum-examples GitHub repository. This example depends on either the JpegImporter, StbImageImporter or any other plugin providing JPEG loading. These are not a part of the core Magnum repository, see their documentation for usage instructions.