NAME
SDL::Tutorial::3DWorld::Actor - A moving object within the game world
SYNOPSIS
# Create a vertical stack of teapots
my @stack = ();
foreach my $height ( 1 .. 10 ) {
push @stack, SDL::Tutorial::3DWorld::Actor->new(
X => 0,
Y => $height * 0.30, # Each teapot is 30cm high
Z => 0,
);
}
DESCRIPTION
Within the game, the term "Actor" is used to describe anything that has a shape and moves around the world based on it's own set of rules.
In practice, an actor could be anything from a bullet or a grenade flying through the air, to a fully articulated roaring dragon with flaming breath and it's own artificial intelligence.
To the game engine, all of these "actors" are basically the same. They are merely things that need to describe where they are and what they look like each time the engine wants to render a frame.
In this demonstration, the default actor is a 30cm x 30cm teapot. We are using a teapot because it is the "official" test mesh object for OpenGL and is built directly into the library itself via the glutCreateTeapot
function.
METHODS
new
my $teapot = SDL::Tutorial::3DWorld::Actor->new;
The new
constructor is used to create a new actor within the 3D World.
In the demonstration implementation, the default actor consists of a teapot.
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
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.