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 "mslio.h" 00029 #include "util.h" 00030 00031 class Gui; // This needs to be here because of mutual reference 00032 00033 #define RENDERCOLORS 10 // Number of colors 00034 00038 00055 class Render 00056 { 00057 protected: 00059 Scene *S; 00060 00063 virtual void SetCurrentAnimationFrame(); 00064 00066 virtual void ShowCurrentAnimationFrame() {}; 00067 00069 list<MSLVector> StateList; 00070 00072 list<double> TimeList; 00073 00074 list<string> EnvList; // File names of all stationary environment objects 00075 list<string> BodyList; // File names of all movable bodies 00076 00078 float RGBRed[RENDERCOLORS]; 00079 float RGBGreen[RENDERCOLORS]; 00080 float RGBBlue[RENDERCOLORS]; 00081 00082 public: 00084 string FilePath; 00085 00087 list<MSLVector> FrameList; 00088 00090 double FrameTime; 00091 00093 float LastFrameTime; 00094 00096 float FrameStuckTime; 00097 00099 int NumFrames; 00100 00102 double AnimationStartPause; 00103 00105 double AnimationEndPause; 00106 00108 double AnimationTimeScale; 00109 00110 double realAnimationTimeScale; 00111 double AnimationTimeScale_prev; 00112 double realAnimationTimeScale_prev; 00113 00115 int AnimationFrameIndex; 00116 00118 MSLVector CurrentAnimationFrame; 00119 00121 bool AnimationActive; 00122 00125 bool ControlFreak; 00126 00128 // window *RenderCtlWindow; 00129 00131 bool RenderCtlWindowOn; 00132 00134 bool AttachedCameraOn; 00135 00137 bool BoundingBoxOn; 00138 00140 bool MultipleViewsOn; 00141 00143 bool ShowPathOn; 00144 00146 double AmbientLight; 00147 00148 Render(); 00149 Render(string filepath); 00150 Render(Scene *s, string filepath); 00151 virtual ~Render() {} 00152 00154 virtual void Init(); 00155 00157 virtual void HandleEvents() {}; 00158 00160 virtual void MainLoop(Gui *g); 00161 00163 virtual void Reset(); 00164 00166 virtual void Terminate() {}; 00167 00169 virtual void SetFrameList(); 00170 00172 virtual void MakeAnimationFrames(const list<MSLVector> &xlist, double deltat); 00173 virtual void MakeAnimationFrames(const list<MSLVector> &xlist, 00174 const list<double> &timelist); 00175 00177 virtual void DrawPath() {}; 00178 00180 virtual void ButtonHandle(int b); 00181 00183 void SetScene(Scene *s); 00184 00186 //void ToggleRenderCtlWindow(); 00187 }; 00188 00189 #endif