Adam Kennedy > SDL-Tutorial-3DWorld-0.33 > SDL::Tutorial::3DWorld::Skybox

Download:
SDL-Tutorial-3DWorld-0.33.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.33   Source  

NAME ^

SDL::Tutorial::3DWorld::Skybox - Better than a uniform sky colour

DESCRIPTION ^

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).

METHODS ^

new

  # 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.

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

The directory accessor returns the skybox texture directory.

type

The type accessor returns the file type of the skybox textures.

SUPPORT ^

Bugs should be reported via the CPAN bug tracker at

http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SDL-Tutorial-3DWorld

AUTHOR ^

Adam Kennedy <adamk@cpan.org>

SEE ALSO ^

SDL, OpenGL

COPYRIGHT ^

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.

syntax highlighting: