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 00054 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 00111 int AnimationFrameIndex; 00112 00114 MSLVector CurrentAnimationFrame; 00115 00117 bool AnimationActive; 00118 00121 bool ControlFreak; 00122 00124 // window *RenderCtlWindow; 00125 00127 bool RenderCtlWindowOn; 00128 00130 bool AttachedCameraOn; 00131 00133 bool BoundingBoxOn; 00134 00136 bool MultipleViewsOn; 00137 00139 bool ShowPathOn; 00140 00142 double AmbientLight; 00143 00144 Render(); 00145 Render(string filepath); 00146 Render(Scene *s, string filepath); 00147 virtual ~Render() {} 00148 00150 virtual void Init(); 00151 00153 virtual void HandleEvents() {}; 00154 00156 virtual void MainLoop(Gui *g); 00157 00159 virtual void Reset(); 00160 00162 virtual void Terminate() {}; 00163 00165 virtual void SetFrameList(); 00166 00168 virtual void MakeAnimationFrames(const list<MSLVector> &xlist, double deltat); 00169 virtual void MakeAnimationFrames(const list<MSLVector> &xlist, 00170 const list<double> &timelist); 00171 00173 virtual void DrawPath() {}; 00174 00176 virtual void ButtonHandle(int b); 00177 00179 void SetScene(Scene *s); 00180 00182 //void ToggleRenderCtlWindow(); 00183 }; 00184 00185 #endif