Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
osgheightfield.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __OSGHEIGHTFIELD_H
25 #define __OSGHEIGHTFIELD_H
26 
27 
28 #include "osgprimitive.h"
29 #include <osg/Shape>
30 
31 namespace lpzrobots {
32 
33  /**
34  Graphical HeightField
35  */
36  class OSGHeightField : public OSGPrimitive {
37  public:
38 
39  /** height coding using in the read in bitmap.
40  * Red: just the red channel is used;
41  * Sum: the sum of all channels is used;
42  * HighMidLow: Blue is least significant, Green is medium significant and Red is most significant
43  */
45 
46 
47  OSGHeightField(osg::HeightField* heightfield,float x_size, float y_size);
48  OSGHeightField(const std::string& filename, float x_size, float y_size, float height);
49 
50  virtual void setMatrix(const osg::Matrix& matrix);
51  virtual void init(const OsgHandle& osgHandle, Quality quality = Middle);
52 
53  virtual const osg::HeightField* getHeightField() const { return field; }
54 
55  /** loads an ppm image and returns the height field using the given coding and the height
56  (maximal height of the heightfield)
57  */
58  static osg::HeightField* loadFromPPM(const std::string& filename, double height,
59  CodingMode codingMode=Red);
60  /// return the height using the given coding mode. The data pointer points to RGB data point
61  static double coding(CodingMode mode, const unsigned char* data);
62 
63  protected:
64  osg::HeightField* field;
65  float x_size;
66  float y_size;
67  };
68 
69 
70 
71 }
72 
73 #endif
static double coding(CodingMode mode, const unsigned char *data)
return the height using the given coding mode. The data pointer points to RGB data point ...
Definition: osgheightfield.cpp:124
static osg::HeightField * loadFromPPM(const std::string &filename, double height, CodingMode codingMode=Red)
loads an ppm image and returns the height field using the given coding and the height (maximal height...
Definition: osgheightfield.cpp:141
virtual void setMatrix(const osg::Matrix &matrix)
Sets the transformation matrix of this object (position and orientation)
Definition: osgheightfield.cpp:88
Matrixd Matrix
Definition: osgforwarddecl.h:47
Interface class for graphic primitives like spheres, boxes, and meshes, which can be drawn by OSG...
Definition: osgprimitive.h:62
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
Definition: osgheightfield.h:44
osg::HeightField * field
Definition: osgheightfield.h:64
float y_size
Definition: osgheightfield.h:66
OsgHandle osgHandle
Definition: osgprimitive.h:107
Quality
Definition: osgprimitive.h:64
Graphical HeightField.
Definition: osgheightfield.h:36
Definition: osgheightfield.h:44
virtual const osg::HeightField * getHeightField() const
Definition: osgheightfield.h:53
virtual void init(const OsgHandle &osgHandle, Quality quality=Middle)
Initialisation of the primitive.
Definition: osgheightfield.cpp:97
Definition: osgheightfield.h:44
Definition: osgprimitive.h:64
OSGHeightField(osg::HeightField *heightfield, float x_size, float y_size)
Definition: osgheightfield.cpp:58
float x_size
Definition: osgheightfield.h:65
CodingMode
height coding using in the read in bitmap.
Definition: osgheightfield.h:44