source: experimental/TerrainTest/myTerrainTechnique.cpp @ 420

Last change on this file since 420 was 277, checked in by Torben Dannhauer, 14 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        //OpenThreads::Thread::microSleep( 50000 );     / To simulate some complex tile modification.
35
36         /*
37         ImageLayer* il = dynamic_cast<ImageLayer*>( getTerrainTile()->getColorLayer(0) );
38         osg::Image* img = il->getImage();
39         //img->setInternalTextureFormat( GL_RGBA );
40
41          if( img->getPixelFormat() == GL_RGBA )
42                 OSG_ALWAYS << "Format ist RGBA" << std::endl;
43          if( img->getPixelFormat() == GL_RGB )
44                 OSG_ALWAYS << "Format ist RGB" << std::endl;
45          if( img->getPixelFormat() == GL_COMPRESSED_RGB_S3TC_DXT1_EXT )
46                 OSG_ALWAYS << "Format ist GL_COMPRESSED_RGB_S3TC_DXT1_EXT" << std::endl;*/
47
48         
49    GeometryTechnique::init(dirtyMask, assumeMultiThreaded);
50}
Note: See TracBrowser for help on using the repository browser.