source: experimental/TerrainTest/terrainModificationTechnique.h @ 432

Last change on this file since 432 was 274, checked in by Torben Dannhauer, 14 years ago
File size: 2.1 KB
Line 
1#pragma once
2/* -*-c++-*- osgVisual - Copyright (C) 2009-2011 Torben Dannhauer
3 *
4 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6 * (at your option) any later version.  The full license is in LICENSE file
7 * included with this distribution, and on the openscenegraph.org website.
8 *
9 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
10 * You have to aquire licenses for all used proprietary modules.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * OpenSceneGraph Public License for more details.
16*/
17
18#include <osg/Referenced>
19#include <osgTerrain/GeometryTechnique>
20#include <osgTerrain/TerrainTile>
21#include "region.h"
22#include <limits>
23
24
25/**
26 * \brief This class is the interface definition class for modifying terrain data. Must be subclassed to implement own terrain modification techniques.
27 *
28 * @author Torben Dannhauer
29 * @date  Feb 2011
30 */ 
31class terrainModificationTechnique : public osg::Referenced
32{
33public:
34        terrainModificationTechnique();
35        virtual ~terrainModificationTechnique();
36
37        /**
38         * \brief This function performs the terrain data modification. Must be subclassed.
39         *
40         * @param modificationROI This vector contains the extents of the region of interest which should be modified: lat_min, lat_max, long_min, long_max
41         * @param h : Heightfield of the tile which should be modified
42         * @param tileExtends : This vector contains the extents of the tile: lat_min, lat_max, long_min, long_max
43         */ 
44        virtual void modifyHeightfield(region& modificationROI, osg::HeightField* h, region tileExtends)=0;
45
46protected:
47        void clampValue(double& value, double min, double max){if(value<min)value=min;if(value>max)value=max;}
48        void clampValue(int& value, int min, int max){if(value<min)value=min;if(value>max)value=max;}
49        double round(double x) {return (x > 0.5) ? ceil(x) : floor(x);}
50};
Note: See TracBrowser for help on using the repository browser.