00001 //---------------------------------------------------------------------- 00002 // The Motion Strategy Library (MSL) 00003 //---------------------------------------------------------------------- 00004 // 00005 // Copyright (c) University of Illinois and Steven M. LaValle. 00006 // All Rights Reserved. 00007 // 00008 // Permission to use, copy, and distribute this software and its 00009 // documentation is hereby granted free of charge, provided that 00010 // (1) it is not a component of a commercial product, and 00011 // (2) this notice appears in all copies of the software and 00012 // related documentation. 00013 // 00014 // The University of Illinois and the author make no representations 00015 // about the suitability or fitness of this software for any purpose. 00016 // It is provided "as is" without express or implied warranty. 00017 //---------------------------------------------------------------------- 00018 00019 #ifndef MSL_RENDER_H 00020 #define MSL_RENDER_H 00021 00022 #include <stdlib.h> 00023 #include <stdio.h> 00024 #include <string.h> 00025 00026 #include "scene.h" 00027 #include "gui.h" // Seems circular, but needed because of mutual reference 00028 #include "util.h" 00029 00030 class Gui; // This needs to be here because of mutual reference 00031 00032 #define RENDERCOLORS 10 // Number of colors 00033 00037 00054 class Render 00055 { 00056 protected: 00058 Scene *S; 00059 00062 virtual void SetCurrentAnimationFrame(); 00063 00065 virtual void ShowCurrentAnimationFrame() {}; 00066 00068 list<MSLVector> StateList; 00069 00071 list<double> TimeList; 00072 00073 list<string> EnvList; // File names of all stationary environment objects 00074 list<string> BodyList; // File names of all movable bodies 00075 00077 float RGBRed[RENDERCOLORS]; 00078 float RGBGreen[RENDERCOLORS]; 00079 float RGBBlue[RENDERCOLORS]; 00080 00081 public: 00083 string FilePath; 00084 00086 list<MSLVector> FrameList; 00087 00089 double FrameTime; 00090 00092 float LastFrameTime; 00093 00095 float FrameStuckTime; 00096 00098 int NumFrames; 00099 00101 double AnimationStartPause; 00102 00104 double AnimationEndPause; 00105 00107 double AnimationTimeScale; 00108 00110 int AnimationFrameIndex; 00111 00113 MSLVector CurrentAnimationFrame; 00114 00116 bool AnimationActive; 00117 00120 bool ControlFreak; 00121 00123 // window *RenderCtlWindow; 00124 00126 bool RenderCtlWindowOn; 00127 00129 bool AttachedCameraOn; 00130 00132 bool BoundingBoxOn; 00133 00135 bool MultipleViewsOn; 00136 00138 bool ShowPathOn; 00139 00141 double AmbientLight; 00142 00143 Render(); 00144 Render(string filepath); 00145 Render(Scene *s, string filepath); 00146 virtual ~Render() {} 00147 00149 virtual void Init(); 00150 00152 virtual void HandleEvents() {}; 00153 00155 virtual void MainLoop(Gui *g); 00156 00158 virtual void Reset(); 00159 00161 virtual void Terminate() {}; 00162 00164 virtual void SetFrameList(); 00165 00167 virtual void MakeAnimationFrames(const list<MSLVector> &xlist, double deltat); 00168 virtual void MakeAnimationFrames(const list<MSLVector> &xlist, 00169 const list<double> &timelist); 00170 00172 virtual void DrawPath() {}; 00173 00175 virtual void ButtonHandle(int b); 00176 00178 void SetScene(Scene *s); 00179 00181 //void ToggleRenderCtlWindow(); 00182 }; 00183 00184 #endif