SDL::Tutorial::3DWorld::Light - A light source in the 3D world
# An overhead light at a nice room ceiling height my $light = SDL::Tutorial::3DWorld::Light->new( X => 0, Y => 3.5, Z => 0, );
Other than in very simple worlds with intentionally flat colour, most game worlds are lit by light sources.
Lights may sometimes be seen as part of the landscape in the sense they are fixed and generally places to best highlight the game world. They can also sometimes be seen as actors, for example when a light source is used as a weapon special effect.
However, for the purpose of this tutorial we will treat lights as first class entities in their own right.
For the purpose of the tutorial only the position of the lighting can be controlled. All lights will have a fixed colour, intensity, and diffusion.
# A light in the sky at noon my $sun = SDL::Tutorial::3DWorld::Light->new( X => 0, Y => 10000, Z => 0, );
The new constructor creates a new light source in the 3D world.
new
In the initial demonstration, only the position of the light is controllable and the nature of the light source (colour, diffusion etc) is fixed.
The X accessor provides the location of the actor in metres on the east to west dimension within the 3D world. The positive direction is east.
X
The Y accessor is location of the actor in metres on the vertical dimension within the 3D world. The positive direction is up.
Y
The Z accessor provides the actor of the camera in metres on the north to south dimension within the 3D world. The positive direction is north.
Z
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.
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.