source: experimental/TerrainTest/myTerrainTechnique.cpp @ 275

Last change on this file since 275 was 275, checked in by Torben Dannhauer, 13 years ago
File size: 1.9 KB
Line 
1#include "myTerrainTechnique.h"
2#include <osgTerrain/TerrainTile>
3
4using namespace osgTerrain;
5
6myTerrainTechnique::myTerrainTechnique(void) : osgTerrain::GeometryTechnique()
7{
8        //OSG_ALWAYS<<className()<<"Constructed by Constructor"<<std::endl;
9
10}
11
12myTerrainTechnique::myTerrainTechnique(const GeometryTechnique& TerrainTechnique,const osg::CopyOp& copyop):
13        osgTerrain::GeometryTechnique(TerrainTechnique,copyop)
14{
15        //OSG_ALWAYS<<className()<<"Constructed by Copy-Constructor"<<std::endl;
16}
17
18myTerrainTechnique::~myTerrainTechnique(void)
19{
20}
21
22void myTerrainTechnique::init(int dirtyMask, bool assumeMultiThreaded)
23{
24        /* The heightfield es extracted from the tile in the techniques init function. technique->init() calls  technique->generateGeometry() which creates the drawable according to the heightfield.
25        To modify the height, the heightfield must be modified prior to the original techniques init() function.
26
27        To modiy the drawable shape (e.g. Cutting wholes in the area), the function technique->generateGeometry() must be modified.
28        */
29
30        HeightFieldLayer* hfl = dynamic_cast<HeightFieldLayer*>( getTerrainTile()->getElevationLayer() );
31        osg::HeightField* h = hfl->getHeightField();
32        h->setHeight( 0,0, 1000);
33
34         /*
35         ImageLayer* il = dynamic_cast<ImageLayer*>( getTerrainTile()->getColorLayer(0) );
36         osg::Image* img = il->getImage();
37         //img->setInternalTextureFormat( GL_RGBA );
38
39          if( img->getPixelFormat() == GL_RGBA )
40                 OSG_ALWAYS << "Format ist RGBA" << std::endl;
41          if( img->getPixelFormat() == GL_RGB )
42                 OSG_ALWAYS << "Format ist RGB" << std::endl;
43          if( img->getPixelFormat() == GL_COMPRESSED_RGB_S3TC_DXT1_EXT )
44                 OSG_ALWAYS << "Format ist GL_COMPRESSED_RGB_S3TC_DXT1_EXT" << std::endl;*/
45
46         
47    GeometryTechnique::init(dirtyMask, assumeMultiThreaded);
48
49        //OpenThreads::Thread::microSleep( 50000 );     / To simulate some complex tile modification.
50}
Note: See TracBrowser for help on using the repository browser.