00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Robot Group Leipzig * 00003 * martius@informatik.uni-leipzig.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 00006 * frankguettler@gmx.de * 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the * 00020 * Free Software Foundation, Inc., * 00021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00022 * * 00023 * $Log: abstractground.h,v $ 00024 * Revision 1.12 2010/03/29 16:28:21 martius 00025 * abstract ground rembers groundsubstance 00026 * comments and typos 00027 * osgprimitive uses white for empty texture 00028 * 00029 * Revision 1.11 2009/04/02 10:12:25 martius 00030 * Texture handling changed 00031 * 00032 * Revision 1.10 2008/04/17 15:59:00 martius 00033 * OSG2 port finished 00034 * 00035 * Revision 1.9.2.1 2008/04/15 16:21:52 martius 00036 * Profiling 00037 * Multithreading also for OSG and ODE but disables because of instabilities 00038 * 00039 * Revision 1.9 2007/12/06 10:02:49 der 00040 * abstractground: returns now cornerpoints 00041 * abstractobstacle: is now trackable 00042 * hudstatistics: supports now AbstractmMeasure 00043 * 00044 * Revision 1.8 2007/09/06 18:46:41 martius 00045 * printContours 00046 * 00047 * Revision 1.7 2007/08/24 11:53:10 martius 00048 * Change geometry 00049 * 00050 * Revision 1.6 2007/07/03 13:06:41 martius 00051 * groundplane thick 00052 * 00053 * Revision 1.5 2007/04/05 15:10:14 martius 00054 * extra ground substance 00055 * 00056 * Revision 1.4 2007/03/16 11:01:37 martius 00057 * abstractobstacle gets mor functionallity 00058 * setSubstance 00059 * 00060 * Revision 1.3 2006/08/11 15:41:04 martius 00061 * playgrounds handle non-quadratic ground planes 00062 * 00063 * Revision 1.2 2006/07/14 12:23:32 martius 00064 * selforg becomes HEAD 00065 * 00066 * Revision 1.1.2.9 2006/07/14 11:36:32 martius 00067 * revert to older revision of robot3 00068 * 00069 * Revision 1.1.2.8 2006/07/13 12:11:26 robot5 00070 * Using overhauled primitives Plane and Box. 00071 * Repeat texturing is supported by them now. 00072 * 00073 * Revision 1.1.2.7 2006/06/29 16:39:55 robot3 00074 * -you can now see bounding shapes if you type ./start -drawboundings 00075 * -includes cleared up 00076 * -abstractobstacle and abstractground have now .cpp-files 00077 * 00078 * Revision 1.1.2.6 2006/06/26 08:25:03 robot3 00079 * fixed ground texture bug 00080 * 00081 * Revision 1.1.2.5 2006/06/22 12:25:45 der 00082 * added setGroundTexture and setGroundColor 00083 * 00084 * Revision 1.1.2.4 2006/06/16 22:27:26 martius 00085 * getMainPrimtive 00086 * 00087 * Revision 1.1.2.3 2006/05/23 14:13:41 der 00088 * fixed initialization bug 00089 * 00090 * Revision 1.1.2.2 2006/05/23 13:37:45 robot3 00091 * -fixed some creating bugs 00092 * -setColor,setTexture and createGround must be 00093 * called before setPosition now 00094 * 00095 * Revision 1.1.2.1 2006/05/19 08:41:27 robot3 00096 * Class AbstractGround contains now basic routines like 00097 * creating the groundPlane, setPose and so on 00098 * 00099 * * 00100 * * 00101 ***************************************************************************/ 00102 #ifndef __ABSTRACTGROUND_H 00103 #define __ABSTRACTGROUND_H 00104 00105 #include <list> 00106 #include "abstractobstacle.h" 00107 #include <selforg/position.h> 00108 00109 namespace lpzrobots { 00110 00111 class Primitive; 00112 00113 // abstract class for any playground 00114 class AbstractGround : public AbstractObstacle { 00115 00116 public: 00117 00118 AbstractGround(const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00119 bool createGround, double groundLength, double groundWidth, double wallThickness); 00120 00121 virtual ~AbstractGround(); 00122 00123 00124 virtual void setPose(const osg::Matrix& pose); 00125 00126 virtual void createGround(bool create); 00127 00128 /// sets texture of walls. Attention, repeats are so far ignored 00129 virtual void setTexture(const std::string& filename, double repeatOnX=1, double repeatOnY=1); 00130 00131 virtual Primitive* getMainPrimitive() const; 00132 00133 virtual void changeGeometry(double length, double width, double height, double factorxy); 00134 00135 /// prints the contour of the boxes into the file 00136 virtual void printContours(FILE* f); 00137 00138 /** 00139 * assigns the texture to the object 00140 */ 00141 virtual void setGroundTexture(const std::string& filename); 00142 00143 /** 00144 * sets the ground color 00145 * should be called before setPosition() 00146 * @param color values in RGBA 00147 */ 00148 virtual void setGroundColor(const Color& color); 00149 00150 /** 00151 * sets the substance of the ground. 00152 * @param substance description of the substance 00153 */ 00154 virtual void setGroundSubstance(const Substance& substance); 00155 00156 00157 /** 00158 * returns the corner points of the groundplane 00159 * @return list of the cornerpoints 00160 */ 00161 virtual std::list<Position> getCornerPointsXY(); 00162 00163 00164 00165 protected: 00166 00167 Primitive* groundPlane; // the groundplane 00168 bool creategroundPlane; 00169 double groundLength; 00170 double groundWidth; 00171 double wallThickness; 00172 Substance groundSubstance; 00173 std::string wallTextureFileName; 00174 Color groundColor; 00175 std::string groundTextureFileName; 00176 00177 virtual void createGround(); 00178 00179 }; 00180 00181 } 00182 00183 #endif