00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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