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

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.