source: experimental/TerrainTest/myTerrainTechnique.cpp @ 169

Last change on this file since 169 was 169, checked in by Torben Dannhauer, 13 years ago

Step1: modifying terrain with arbitrary values: done :)
Step2: modify with the corresponding values: todo :)

File size: 1.3 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    GeometryTechnique::init(dirtyMask, assumeMultiThreaded);
35}
Note: See TracBrowser for help on using the repository browser.