OGRE  1.9.0
OgreTerrainAutoUpdateLod.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28
29#ifndef __Ogre_TerrainAutoUpdateLod_H__
30#define __Ogre_TerrainAutoUpdateLod_H__
31
33#include "OgreTerrain.h"
34
35namespace Ogre
36{
55 {
56 public:
63 virtual void autoUpdateLod(Terrain *terrain, bool synchronous, const Any &data) = 0;
64 virtual uint32 getStrategyId() = 0;
65 };
66
67 // other Strategy's id start from 2
69 {
70 NONE = 0,
71 BY_DISTANCE = 1
72 };
73
78 {
79 public:
80 virtual void autoUpdateLod(Terrain *terrain, bool synchronous, const Any &data);
81 virtual uint32 getStrategyId() { return BY_DISTANCE; }
82
83 protected:
87 void autoUpdateLodByDistance(Terrain *terrain, bool synchronous, const Real holdDistance);
89 int traverseTreeByDistance(TerrainQuadTreeNode *node, const Camera *cam, Real cFactor, const Real holdDistance);
90 };
91
93 {
94 public:
96 {
97 switch(strategy)
98 {
99 case BY_DISTANCE:
101 case NONE:
102 default:
103 return 0;
104 }
105 return 0;
106 }
107 };
110}
111
112#endif
#define _OgreTerrainExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Variant type that can hold Any other type.
Definition: OgreAny.h:57
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:87
Class implementing TerrainAutoUpdateLod interface.
int traverseTreeByDistance(TerrainQuadTreeNode *node, const Camera *cam, Real cFactor, const Real holdDistance)
Traverse Terrain's QuadTree and calculate what LOD level is needed.
void autoUpdateLodByDistance(Terrain *terrain, bool synchronous, const Real holdDistance)
Modifies Terrain's LOD level according to it's distance from camera.
virtual void autoUpdateLod(Terrain *terrain, bool synchronous, const Any &data)
Method to be called to change terrain's LOD level.
static TerrainAutoUpdateLod * getAutoUpdateLod(uint32 strategy)
Terrain automatic LOD loading.
virtual void autoUpdateLod(Terrain *terrain, bool synchronous, const Any &data)=0
Method to be called to change terrain's LOD level.
virtual uint32 getStrategyId()=0
A node in a quad tree used to store a patch of terrain.
The main containing class for a chunk of terrain.
Definition: OgreTerrain.h:264
#define OGRE_NEW
float Real
Software floating point type.
unsigned int uint32
Definition: OgrePlatform.h:344