base.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __BASE_H
00025 #define __BASE_H
00026
00027 #include <ode-dbl/ode.h>
00028 #include <osg/Transform>
00029 #include <osgText/Text>
00030
00031 #include "osghandle.h"
00032 #include "odehandle.h"
00033
00034 #include "hudstatistics.h"
00035 #include <selforg/configurable.h>
00036
00037 namespace osgShadow
00038 {
00039 class ShadowedScene;
00040 }
00041
00042 namespace lpzrobots
00043 {
00044
00045 class MoveEarthySkyWithEyePointTransform : public osg::Transform
00046 {
00047 public:
00048
00049 virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const;
00050
00051
00052 virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const;
00053 };
00054
00055 class Base : public Configurable
00056 {
00057 public:
00058 Base(const std::string& caption="LpzRobots Simulator (Martius et al)");
00059
00060 static const int PHYSICS_CALLBACKABLE = 1;
00061 static const int GRAPHICS_CALLBACKABLE = 2;
00062
00063
00064 virtual void makePhysicsScene();
00065
00066
00067
00068 virtual void makeScene(OsgScene* scene, const OsgConfig& config);
00069 virtual osg::Node* makeSky(const OsgConfig& config);
00070 virtual osg::Node* makeGround(const OsgConfig& config);
00071
00072
00073 virtual osg::Node* createHUD(OsgScene* scene, const OsgConfig& config);
00074 virtual void createHUDManager(osg::Geode* geode, osgText::Font* font);
00075
00076 virtual void makeLights(osg::Group* node, const OsgConfig& config);
00077
00078
00079
00080
00081
00082
00083
00084
00085 virtual osgShadow::ShadowedScene* createShadowedScene(osg::Node* sceneToShadow, osg::LightSource* lightSource, int shadowType);
00086
00087 virtual void setGroundTexture(const char* filename) {
00088 this->groundTexture = filename;
00089 }
00090
00091
00092 virtual void setCaption(const std::string& caption);
00093
00094
00095 virtual void setTitle(const std::string& title);
00096
00097
00098
00099
00100
00101
00102 virtual HUDStatisticsManager* getHUDSM();
00103
00104 virtual ~Base();
00105
00106 protected:
00107 virtual void setTimeStats(double time, double realtimefactor,
00108 double truerealtimefactor,bool pause);
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 virtual void changeShadowTechnique();
00122
00123
00124 virtual void base_close();
00125
00126 dGeomID ground;
00127
00128
00129 OsgHandle osgHandle;
00130
00131 OdeHandle odeHandle;
00132 std::string caption;
00133 std::string title;
00134 std::string groundTexture;
00135
00136 osg::Group* dummy;
00137
00138 osg::Node* hud;
00139 osgText::Text* timestats;
00140 osgText::Text* captionline;
00141 osgText::Text* titleline;
00142
00143 Primitive* plane;
00144
00145
00146 HUDStatisticsManager* hUDStatisticsManager;
00147
00148 int ReceivesShadowTraversalMask;
00149 int CastsShadowTraversalMask;
00150
00151
00152
00153 int shadowTexSize;
00154 bool useNVidia;
00155
00156
00157 public:
00158
00159
00160 static int contains(char **list, int len, const char *str);
00161
00162 };
00163 }
00164
00165 #endif