NAME

SDL::Tutorial::3DWorld::Light - A light source in the 3D world

SYNOPSIS

# An overhead light at a nice room ceiling height
my $light = SDL::Tutorial::3DWorld::Light->new(
    X => 0,
    Y => 3.5,
    Z => 0,
);

DESCRIPTION

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.

METHODS

new

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

In the initial demonstration, only the position of the light is controllable and the nature of the light source (colour, diffusion etc) is fixed.

X

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.

Y

The Y accessor is location of the actor in metres on the vertical dimension within the 3D world. The positive direction is up.

Z

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.

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.