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' ) );
The new constructor creates a new skybox object.
new
It takes a single directory parameter which should be a directory that exists, and contains the six named BMP skybox texture files.
directory
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).
The directory accessor returns the skybox texture directory.
The type accessor returns the file type of the skybox textures.
type
Bugs should be reported via the CPAN bug tracker at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SDL-Tutorial-3DWorld
Adam Kennedy <adamk@cpan.org>
SDL, OpenGL
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:
=cut found outside a pod block. Skipping to next block.
To install SDL::Tutorial::3DWorld, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SDL::Tutorial::3DWorld
CPAN shell
perl -MCPAN -e shell install SDL::Tutorial::3DWorld
For more information on module installation, please visit the detailed CPAN module installation guide.