Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

glheightfield.h

00001 /***************************************************************************
00002                           glheightfield.h  -  description
00003                              -------------------
00004     begin                : Wed Nov 19 2003
00005     copyright            : (C) 2003 by Jacques Gasselin de Richebourg
00006     email                : jacquesgasselin@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *
00024  *                                                                         *
00025  ***************************************************************************/
00026 
00027 
00028 #ifndef GLHEIGHTFIELD_H
00029 #define GLHEIGHTFIELD_H
00030 
00031 #include "glscene.h"
00032 #include "glgeometricobject.h"
00033 #include "glsurface.h"
00034 #include "glimage.h"
00035 #include "smltgl.h"
00036 
00040 namespace GLScene
00041 {
00042 
00043    class GLHeightField: public GLGeometricObject, public GLSurfaceGenerator, public GLFieldHolder
00044    {
00045       float* heightMap; //range from -1.00f to 1.00f
00046       bool generated;
00047       GLSurface surface;
00048       GLsizei imageWidth, imageHeight;
00049 
00050    public:
00051       static std::string refvalName;
00052       static std::string imageName;
00053       static std::string widthName;
00054       static std::string lengthName;
00055       static std::string heightName;
00056 
00057       SML_TAG(heightfield)
00058       
00059       GLField<GLuint> referenceValue;
00060       GLField<GLImage> image;
00061       GLField<GLfloat> width;
00062       GLField<GLfloat> length;
00063       GLField<GLfloat> height;
00064 
00065       GLHeightField();
00066     virtual ~GLHeightField();
00067 
00068       virtual bool intersection( GLGeometricObject* ){ return false; };
00069       virtual bool inclusion( GLGeometricObject* ){ return false; };
00070 
00072       virtual FieldBasePtr getFieldByIndex( short index );
00073 
00076       void getVertecies(const GLfloat u, const GLuint nOfV, GLfloat* const verts3) const;
00078       void getNormals(const GLfloat u, const GLuint nOfN, GLfloat* const normals3) const;
00079 
00080       virtual void render();
00081 
00082       private:
00083       
00085       void generate();
00086 
00087       float getHeightAt(const float& u, const float& v) const;
00088    
00089    };
00090 
00091 };//eo namespace
00092 #endif

Generated on Wed Feb 4 23:11:33 2004 by doxygen 1.3.3