src/Terrain3D.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by                                                 *
00003  *         Pierre-yves JEZEQUEL, Julien MICHOT, Loic MOISAN,               *
00004  *         Julien PAPILLON, Sebastien PINEAUD, Barthelemy SERRES           *
00005  *                                                                         *
00006  *   https://sourceforge.net/projects/anidam                               *
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 #ifndef _TERRAIN_3D
00024 #define _TERRAIN_3D
00025 
00026 #include <osgProducer/Viewer>
00027 #include <osg/PositionAttitudeTransform>
00028 #include <osg/Texture2D>
00029 #include <osgDB/ReadFile>
00030 #include <osg/ShapeDrawable>
00031 #include <SDL.h>
00032 
00033 class Terrain3D
00034 {
00035 public:
00036         Terrain3D(char* path, osg::Group* terrain,int nbTree);
00037 
00038         bool Ok();
00039 
00040         osg::Geode* getGeode();
00041 
00042 private:
00043         bool ok;
00044         osg::HeightField* HeightMap;
00045         osg::Geode* HeightMapGeode;
00046 
00047 protected:
00048         void RemplitPerc(float*,unsigned char);
00049         unsigned char GetPixelColor(SDL_Surface*,int,int,int);
00050         void SetPixel(SDL_Surface*,int,int,Uint32);
00051         void TextureHeightMap();
00052         void addTrees(osg::Group*, osg::Texture2D*, float,float,float, int number, float hmin, float hmax);
00053         osg::Drawable* createBillboardDrawable(float scale, osg::StateSet* bbState,float width,float height);
00054 };
00055 
00056 #endif

Generated on Tue Jun 5 16:56:49 2007 for Anidam by  doxygen 1.5.1