[264] | 1 | #pragma once |
---|
[272] | 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 | |
---|
[262] | 18 | #include <osg/Referenced> |
---|
| 19 | #include <osgTerrain/GeometryTechnique> |
---|
[264] | 20 | #include <osgTerrain/TerrainTile> |
---|
[272] | 21 | #include "region.h" |
---|
[274] | 22 | #include <limits> |
---|
[262] | 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 | */ |
---|
| 31 | class terrainModificationTechnique : public osg::Referenced |
---|
| 32 | { |
---|
| 33 | public: |
---|
| 34 | terrainModificationTechnique(); |
---|
| 35 | virtual ~terrainModificationTechnique(); |
---|
| 36 | |
---|
| 37 | /** |
---|
| 38 | * \brief This function performs the terrain data modification. Must be subclassed. |
---|
| 39 | * |
---|
[266] | 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 |
---|
[262] | 41 | * @param h : Heightfield of the tile which should be modified |
---|
[265] | 42 | * @param tileExtends : This vector contains the extents of the tile: lat_min, lat_max, long_min, long_max |
---|
[262] | 43 | */ |
---|
[269] | 44 | virtual void modifyHeightfield(region& modificationROI, osg::HeightField* h, region tileExtends)=0; |
---|
[262] | 45 | |
---|
[265] | 46 | protected: |
---|
| 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;} |
---|
[274] | 49 | double round(double x) {return (x > 0.5) ? ceil(x) : floor(x);} |
---|
[262] | 50 | }; |
---|