00001 #ifndef POSITION_PATH_
00002 #define POSITION_PATH_
00003
00004 #include <stdio.h>
00005 #include <windows.h>
00006 #include <GL/gl.h>
00007 #include <GL/glu.h>
00008 #include <GL/glut.h>
00009 #include <math.h>
00010
00011 #include "Geometry.h"
00012
00013 #define PP_LINEAR 1
00014 #define PP_SINE 2
00015 #define PP_COSINE 3
00016 #define PP_JUMP 4
00017
00018
00031 typedef struct Position6DOF
00032 {
00033 float x, y, z;
00034 float roll, pitch, yaw;
00035 }Position;
00036
00037
00056 class PositionPath
00057 {
00058 public:
00062 PositionPath ();
00063
00067 ~PositionPath ();
00068
00076 Position GetPosition (int time);
00077
00088 void SetConstantPosition (float x, float y, float z, float roll, float pitch, float yaw);
00089
00096 bool IsDefined (int time);
00097
00104 bool HasDynamicRotation ();
00105
00112 bool HasStaticRotation ();
00113
00121 BoundingBox GetTranslationBox ();
00122
00135 void StartPath (int offset, float x, float y, float z, float roll, float pitch, float yaw);
00136
00148 void CompletePath (float x, float y, float z, float roll, float pitch, float yaw);
00149
00161 void AddCheckpoint (float x, float y, float z, float roll, float pitch, float yaw);
00162
00169 void SetDuration (int time);
00170
00180 void SetGlobalTransition (int mode, float parameter);
00181
00194 void SetTransitionModes (int mode_x, int mode_y, int mode_z, int mode_roll, int mode_pitch, int mode_yaw);
00195
00208 void SetParameters (float param_x, float param_y, float param_z, float param_roll, float param_pitch, float param_yaw);
00209
00217 void Shift (float x, float y, float z);
00218
00222 void PrintToConsole ();
00223
00224 private:
00226 bool is_constant;
00227
00229 bool has_dynamic_rotation;
00230
00232 bool has_static_rotation;
00233
00235 BoundingBox translation_box;
00236
00238 Position constant_position;
00239
00241 typedef struct PathNode
00242 {
00243 int start_time;
00244 int end_time;
00245 Position start_position;
00246 Position end_position;
00247 bool global_transition_evaluator;
00248 int transition_evaluator[6];
00249 float transition_parameter[6];
00251 PathNode * next;
00252 PathNode * previous;
00253 }Path;
00254
00256 Path * first_node;
00257
00259 bool not_complete;
00260
00262 PathNode * current_node;
00263
00265 PathNode * node_pointer;
00266
00274 void SeekTime (int time);
00275
00279 void DeletePath ();
00280
00284 void Initialize ();
00285
00294 void ConservativeUpdate (PathNode * node);
00295
00305 Position EvaluateNode (PathNode * node, float progress);
00306
00316 float inline EvaluateValue (int mode, float value, float parameter);
00317
00318 };
00319
00320 #endif