SDL::Tutorial::3DWorld::Skybox - Better than a uniform sky colour
A Skybox is a common method for drawing a full photographic background for a 3D World visible in all directions.
It consists of a large cube with a set of six special pre-rendered textures that stich together at the edges, creating the appearance of a large surrounding environment.
For more information on the general concept of a sky box see http://en.wikipedia.org/wiki/Skybox_%28video_games%29.
This basic implementation takes a directory and looks for six image files within it called north.bmp, south.bmp, east.bmp, west.bmp, up.bmp and down.bmp.
The textures are projected onto the cube and uniformly lit, ignoring the normal lighting model.
The main special effects "trick" to implementing a skybox is that it will rotate with the rest of the world but match the movements of the camera so that artifacts in the skybox texture stay the same size regardless of the movement of the camera (making them appear to be a long way away).
# Load a skybox from a set of files included within a distribution my $sky = SDL::Tutorial::3DWorld::Skybox->new( directory => File::Spec->catdir( File::ShareDir::dist_dir('SDL-Tutorial-3DWorld'), 'skybox' ) );
new constructor creates a new skybox object.
It takes a single
directory parameter which should be a directory that exists, and contains the six named BMP skybox texture files.
Although the existance of the texture files will be checked at constructor time, they will not actually be loaded until you run the world (during the init phase).
directory accessor returns the skybox texture directory.
type accessor returns the file type of the skybox textures.
Bugs should be reported via the CPAN bug tracker at
Adam Kennedy <firstname.lastname@example.org>
Copyright 2010 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 262:
=cut found outside a pod block. Skipping to next block.