HyperspaceExplorer 0.7.1
|
00001 /* 00002 Hyperspace Explorer - visualizing higher-dimensional geometry 00003 Copyright (C) 2008-2010 Lene Preuss <lene.preuss@gmail.com> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License along 00016 with this program; if not, write to the Free Software Foundation, Inc., 00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00019 */ 00020 00021 #ifndef VIEW_IMPL_H 00022 #define VIEW_IMPL_H 1 00023 00024 #include "View.h" 00025 #include "Light.h" 00026 00027 namespace UI { 00028 00030 00041 class ViewImpl: public View { 00042 00043 public: 00044 00046 ViewImpl(); 00047 00049 virtual const std::shared_ptr<Displayable> &F() const; 00051 virtual void setF(Displayable *_f); 00052 00054 virtual const VecMath::Rotation<4> &getdR(); 00056 00057 virtual void setdR(const VecMath::Rotation<4> &_dr); 00058 00060 virtual void setNumFrames(unsigned frames); 00062 virtual void setNumLoops(unsigned loops); 00063 00065 virtual const std::string &getImgDir(); 00067 virtual void setImgDir(const std::string &); 00069 virtual const std::string &getImgPrefix(); 00071 virtual void setImgPrefix(const std::string &); 00072 00074 virtual const Color &getBackground(); 00076 virtual void setBackground(const Color &bg); 00077 00079 00080 virtual void addLight(Light *l); 00082 virtual void removeLight(std::vector<Light *>::iterator); 00084 00085 virtual const std::vector<Light *> &getLights(); 00086 00088 virtual bool getColors() const; 00090 virtual void setColors(bool on); 00091 00093 virtual bool getCoordinates() const; 00095 virtual void setCoordinates(bool on); 00096 00098 virtual bool getFog() const; 00100 virtual void setFog(bool on); 00101 00103 virtual bool getHyperfog() const; 00105 virtual void setHyperfog(bool on); 00106 00108 virtual bool getLighting() const; 00110 virtual void setLighting(bool on); 00111 00113 virtual bool getShading() const; 00115 virtual void setShading(bool on); 00116 00118 virtual bool getSolid() const; 00120 00121 virtual void setSolid(bool on); 00122 00124 virtual bool getTransparence() const; 00126 virtual void setTransparence(bool on); 00127 00129 virtual void drawTriangle(const VecMath::Vector< 4 >&, const VecMath::Vector< 4 >&, 00130 const VecMath::Vector< 4 >&, 00131 const VecMath::Vector< 3 >&, const VecMath::Vector< 3 >&, 00132 const VecMath::Vector< 3 >&); 00134 virtual void drawPolygon(const std::vector< VecMath::Vector< 4 > >&, 00135 const std::vector< VecMath::Vector< 3 > >&); 00136 00138 virtual void drawCube(const VecMath::MultiDimensionalVector< VecMath::Vector< 4 >, 3 >& X, 00139 unsigned int t, unsigned int u, unsigned int v, 00140 const VecMath::Vector< 3 >& v0, const VecMath::Vector< 3 >& v1, 00141 const VecMath::Vector< 3 >& v2, const VecMath::Vector< 3 >& v3, 00142 const VecMath::Vector< 3 >& v4, const VecMath::Vector< 3 >& v5, 00143 const VecMath::Vector< 3 >& v6, const VecMath::Vector< 3 >& v7); 00144 00146 virtual void commitDraw(); 00147 00148 protected: 00149 00151 virtual unsigned getNumFrames(); 00153 virtual unsigned getNumLoops(); 00154 00156 virtual bool getWriteImages(); 00158 virtual void setWriteImages(bool on); 00159 00161 virtual void setDefaultBackground(); 00162 00164 virtual void setT(const VecMath::Vector<4> &_t); 00166 virtual const VecMath::Vector<4> &T(); 00168 00169 virtual void addT(const VecMath::Vector<4> &_dT); 00170 00172 virtual void setR(const VecMath::Rotation<4> &_r); 00174 virtual const VecMath::Rotation<4> &R(); 00176 virtual void addR(const VecMath::Rotation<4> &_dR); 00177 00179 virtual void adddR(const VecMath::Rotation<4> &); 00180 00182 double CamW() const; 00184 void setCamW(const double &_cw); 00186 double ScrW() const; 00188 void setScrW(const double &_sw); 00189 00191 double distance(); 00192 00194 static const LightSource &getDefaultLightSource(); 00196 static const LightSource &getFlatLightSource(); 00197 00198 private: 00199 00200 class Impl; 00201 00202 Impl *pImpl_; 00203 00205 static Color _defaultBackground; 00206 00208 static LightSource _defaultLightSource; 00210 static LightSource _flatLightSource; 00211 00212 }; 00213 00214 } 00215 00216 #endif