source: experimental/TerrainTest/myTerrainTechnique.cpp @ 430

Last change on this file since 430 was 277, checked in by Torben Dannhauer, 14 years ago
File size: 1.9 KB
RevLine 
[162]1#include "myTerrainTechnique.h"
2#include <osgTerrain/TerrainTile>
3
[163]4using namespace osgTerrain;
5
[168]6myTerrainTechnique::myTerrainTechnique(void) : osgTerrain::GeometryTechnique()
[162]7{
[170]8        //OSG_ALWAYS<<className()<<"Constructed by Constructor"<<std::endl;
[168]9
[162]10}
11
[165]12myTerrainTechnique::myTerrainTechnique(const GeometryTechnique& TerrainTechnique,const osg::CopyOp& copyop):
13        osgTerrain::GeometryTechnique(TerrainTechnique,copyop)
[163]14{
[165]15        //OSG_ALWAYS<<className()<<"Constructed by Copy-Constructor"<<std::endl;
[163]16}
17
[162]18myTerrainTechnique::~myTerrainTechnique(void)
19{
20}
21
[169]22void myTerrainTechnique::init(int dirtyMask, bool assumeMultiThreaded)
[162]23{
[169]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
[168]30        HeightFieldLayer* hfl = dynamic_cast<HeightFieldLayer*>( getTerrainTile()->getElevationLayer() );
31        osg::HeightField* h = hfl->getHeightField();
32        h->setHeight( 0,0, 1000);
[162]33
[277]34        //OpenThreads::Thread::microSleep( 50000 );     / To simulate some complex tile modification.
35
[275]36         /*
[171]37         ImageLayer* il = dynamic_cast<ImageLayer*>( getTerrainTile()->getColorLayer(0) );
38         osg::Image* img = il->getImage();
[172]39         //img->setInternalTextureFormat( GL_RGBA );
[171]40
[275]41          if( img->getPixelFormat() == GL_RGBA )
[172]42                 OSG_ALWAYS << "Format ist RGBA" << std::endl;
[275]43          if( img->getPixelFormat() == GL_RGB )
[172]44                 OSG_ALWAYS << "Format ist RGB" << std::endl;
45          if( img->getPixelFormat() == GL_COMPRESSED_RGB_S3TC_DXT1_EXT )
[255]46                 OSG_ALWAYS << "Format ist GL_COMPRESSED_RGB_S3TC_DXT1_EXT" << std::endl;*/
[171]47
[172]48         
[169]49    GeometryTechnique::init(dirtyMask, assumeMultiThreaded);
[172]50}
Note: See TracBrowser for help on using the repository browser.