00001 //---------------------------------------------------------------------- 00002 // The Motion Strategy Library (MSL) 00003 //---------------------------------------------------------------------- 00004 // 00005 // Copyright (c) 1998-2000 Iowa State University and Steve 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 // Iowa State University 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 <LEDA/file.h> 00023 #include <LEDA/list.h> 00024 #include <LEDA/matrix.h> 00025 #include <LEDA/point.h> 00026 #include <LEDA/polygon.h> 00027 #include <LEDA/stream.h> 00028 #include <LEDA/string.h> 00029 #include <LEDA/vector.h> 00030 #include <LEDA/window.h> 00031 00032 #include "scene.h" 00033 #include "gui.h" // Seems circular, but needed because of mutual reference 00034 00035 class Gui; // This needs to be here because of mutual reference 00036 00037 #include <LEDA/REDEFINE_NAMES.h> 00038 00039 #define RENDERCOLORS 10 // Number of colors 00040 00044 00061 class Render 00062 { 00063 protected: 00065 Scene *S; 00066 00069 virtual void SetCurrentAnimationFrame(); 00070 00072 virtual void ShowCurrentAnimationFrame() {}; 00073 00075 list<vector> StateList; 00076 00078 list<double> TimeList; 00079 00080 list<string> EnvList; // File names of all stationary environment objects 00081 list<string> BodyList; // File names of all movable bodies 00082 00084 float RGBRed[RENDERCOLORS]; 00085 float RGBGreen[RENDERCOLORS]; 00086 float RGBBlue[RENDERCOLORS]; 00087 00088 public: 00090 string FilePath; 00091 00093 list<vector> FrameList; 00094 00096 double FrameTime; 00097 00099 float LastFrameTime; 00100 00102 float FrameStuckTime; 00103 00105 int NumFrames; 00106 00108 double AnimationStartPause; 00109 00111 double AnimationEndPause; 00112 00114 double AnimationTimeScale; 00115 00117 int AnimationFrameIndex; 00118 00120 vector CurrentAnimationFrame; 00121 00123 bool AnimationActive; 00124 00127 bool ControlFreak; 00128 00130 window *RenderCtlWindow; 00131 00133 bool RenderCtlWindowOn; 00134 00136 bool AttachedCameraOn; 00137 00139 bool BoundingBoxOn; 00140 00142 bool MultipleViewsOn; 00143 00145 bool ShowPathOn; 00146 00148 double AmbientLight; 00149 00150 Render(); 00151 Render(string filepath); 00152 Render(Scene *s, string filepath); 00153 virtual ~Render() {} 00154 00156 virtual void Init(); 00157 00159 virtual void HandleEvents() {}; 00160 00162 virtual void MainLoop(Gui *g); 00163 00165 virtual void Reset(); 00166 00168 virtual void Terminate() {}; 00169 00171 virtual void SetFrameList(); 00172 00174 virtual void MakeAnimationFrames(const list<vector> &xlist, double deltat); 00175 virtual void MakeAnimationFrames(const list<vector> &xlist, 00176 const list<double> &timelist); 00177 00179 virtual void DrawPath() {}; 00180 00182 virtual void ButtonHandle(int b); 00183 00185 void SetScene(Scene *s); 00186 00188 void ToggleRenderCtlWindow(); 00189 }; 00190 00191 #include <LEDA/UNDEFINE_NAMES.h> 00192 00193 #endif