#ifndef _MOVABLE_H_
#define _MOVABLE_H_

#include "getglut.h"

/* A movable is basically an anchor in the world, with velocity, which can */
/* be used to position the graphics cursor for rendering an object.        */
/* Note that movables don't do glLoadIdentity, so can hold relative        */
/* co-ordinates and angles.                                                */

typedef struct movable_s {
	/* void (*destroy) (struct movable_s* m); *//* movables do not need destruction */
	void (*locate)  (struct movable_s* m); /* Position the GL cursor */
	void (*animate) (struct movable_s* m, int elapsed); /* Step animation */
	/* Animation of this nature is not implemented in this version, */
	/* as it is not needed. Velocities have no effect.              */

	GLfloat x,   y,   z;   /* Location         (wu)        */
	GLfloat xv,  yv,  zv;  /* Velocity         (wu/s)      */
	GLfloat xa,  ya,  za;  /* Angle            (degrees)   */
	GLfloat xav, yav, zav; /* Angular velocity (degrees/s) */

	struct movable_s* next; /* Hack for tour mode */
	long int duration; /* Hack for tour mode */
} movable;

/* Initialize a movable to the origin, with no rotation. */
void movable_init(movable* m);

/* Set a movable to a new location */
void movable_moveto(movable* m, movable* n);

/* For the sake of speed, allow non-dynamic method invocation of these */
void movable_locate(movable *m);
void movable_animate(movable *m, int elapsed);

#endif
