NAME

Games::3D::Model::MD2 - load/render 3D models based on the .md2 file format

SYNOPSIS

use Games::3D::Model::MD2;

my $model = Games::3D::Model::MD2->new( 'ogre.md2' );

$model->render_frame(0);

EXPORTS

Exports nothing on default.

DESCRIPTION

This package let's you load and render (via OpenGL) models based on the popular .md2 file format.

METHODS

new()
my $model = Games::3D::Model::MD2->new( $filename );

Load a model into memory and return an object reference.

render_frame()
$model->render_frame($frame_num);

Render one frame from the model.

frames()
$model->frames();

Return the number of frames in the model.

color()
$rgb = $model->color();		# [$r,$g, $b ]
$model->color(1,0.1,0.8);	# set RGB
$model->color(undef);		# random color (default)

Sets the color, that will be set to render the model. The random color setting means each triangle will get a random RGB color.

alpha()
$a = $model->alpha();		# $a
$model->color(0.8);		# set A
$model->alpha(undef);		# set's it to 1.0 (seems an OpenGL
				# specific set because
				# glColor($r,$g,$b) also sets $a == 1

Sets the alpha value. Only usefull when using blending (e.g. transparency).

See Games::3D::Model for more documentation.

BUGS

states

The states are hardcoded and corrospond (probably) to the states for Quake 2 models, which might not necc. be right for other models. There is currently no way to override the state and frame list.

AUTHORS

(c) 2003 Tels <http://bloodgate.com/>

SEE ALSO

Games::3D, SDL:App::FPS, and SDL::OpenGL.