OgreDistanceLodStrategy.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 #ifndef __Distance_Lod_Strategy_H__
29 #define __Distance_Lod_Strategy_H__
30 
31 #include "OgrePrerequisites.h"
32 
33 #include "OgreLodStrategy.h"
34 #include "OgreSingleton.h"
35 #include "OgreNode.h"
36 
37 namespace Ogre {
56  {
57  protected:
59  virtual Real getValueImpl(const MovableObject *movableObject, const Camera *camera) const;
60 
61  public:
64 
66  virtual Real getBaseValue() const;
67 
69  virtual Real transformBias(Real factor) const;
70 
72  virtual Real transformUserValue(Real userValue) const;
73 
75  virtual ushort getIndex(Real value, const Mesh::MeshLodUsageList& meshLodUsageList) const;
76 
78  virtual ushort getIndex(Real value, const Material::LodValueList& materialLodValueList) const;
79 
81  virtual void sort(Mesh::MeshLodUsageList& meshLodUsageList) const;
82 
84  virtual bool isSorted(const Mesh::LodValueList& values) const;
85 
87  virtual Real getSquaredDepth(const MovableObject *movableObject, const Ogre::Camera *camera) const = 0;
88 
96  void setReferenceView(Real viewportWidth, Real viewportHeight, Radian fovY);
97 
101  void setReferenceViewEnabled(bool value);
102 
105 
106  private:
109 
110  };
131  class _OgreExport DistanceLodSphereStrategy : public DistanceLodStrategy, public Singleton<DistanceLodSphereStrategy>
132  {
133  public:
136 
138  Real getSquaredDepth(const MovableObject *movableObject, const Ogre::Camera *camera) const;
139 
172  };
193  class _OgreExport DistanceLodBoxStrategy : public DistanceLodStrategy, public Singleton<DistanceLodBoxStrategy>
194  {
195  public:
198 
200  Real getSquaredDepth(const MovableObject *movableObject, const Ogre::Camera *camera) const;
201 
234  };
238 } // namespace
239 
240 #endif
Ogre::DistanceLodSphereStrategy
Level of detail strategy based on distance from camera to an object's bounding sphere.
Definition: OgreDistanceLodStrategy.h:132
Ogre::Mesh::MeshLodUsageList
vector< MeshLodUsage >::type MeshLodUsageList
Definition: OgreMesh.h:103
Ogre::DistanceLodStrategy::mReferenceViewEnabled
bool mReferenceViewEnabled
Definition: OgreDistanceLodStrategy.h:107
Ogre::Mesh::LodValueList
vector< Real >::type LodValueList
Definition: OgreMesh.h:102
Ogre
Definition: OgreAndroidLogListener.h:35
OgreSingleton.h
Ogre::ushort
unsigned short ushort
Definition: OgrePrerequisites.h:113
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:87
Ogre::DistanceLodSphereStrategy::getSingleton
static DistanceLodSphereStrategy & getSingleton(void)
Override standard Singleton retrieval.
Ogre::DistanceLodStrategy::DistanceLodStrategy
DistanceLodStrategy(const String &name)
Default constructor.
Ogre::MovableObject
Abstract class defining a movable object in a scene.
Definition: OgreMovableObject.h:61
Ogre::DistanceLodStrategy::getValueImpl
virtual Real getValueImpl(const MovableObject *movableObject, const Camera *camera) const
Compute the LOD value for a given movable object relative to a given camera.
Ogre::DistanceLodBoxStrategy::getSingleton
static DistanceLodBoxStrategy & getSingleton(void)
Override standard Singleton retrieval.
Ogre::DistanceLodStrategy::transformUserValue
virtual Real transformUserValue(Real userValue) const
Transform user supplied value to internal value.
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::DistanceLodStrategy::getIndex
virtual ushort getIndex(Real value, const Material::LodValueList &materialLodValueList) const
Get the index of the LOD usage which applies to a given value.
Ogre::DistanceLodBoxStrategy::DistanceLodBoxStrategy
DistanceLodBoxStrategy()
Default constructor.
Ogre::LodStrategy
Strategy for determining level of detail.
Definition: OgreLodStrategy.h:55
Ogre::DistanceLodBoxStrategy::getSquaredDepth
Real getSquaredDepth(const MovableObject *movableObject, const Ogre::Camera *camera) const
Get the squared depth from camera to the LOD object.
OgrePrerequisites.h
Ogre::Material::LodValueList
vector< Real >::type LodValueList
distance list used to specify LOD
Definition: OgreMaterial.h:95
Ogre::DistanceLodBoxStrategy
Level of detail strategy based on distance from camera to an object's bounding box.
Definition: OgreDistanceLodStrategy.h:194
Ogre::DistanceLodStrategy::isSorted
virtual bool isSorted(const Mesh::LodValueList &values) const
Determine if the LOD values are sorted from greatest detail to least detail.
Ogre::Singleton
Template class for creating single-instance global classes.
Definition: OgreSingleton.h:65
Ogre::DistanceLodStrategy::setReferenceViewEnabled
void setReferenceViewEnabled(bool value)
Enables to disables use of the reference view.
Ogre::Radian
Wrapper class which indicates a given angle value is in Radians.
Definition: OgreMath.h:48
Ogre::DistanceLodStrategy::sort
virtual void sort(Mesh::MeshLodUsageList &meshLodUsageList) const
Sort mesh LOD usage list from greatest to least detail.
Ogre::DistanceLodStrategy
Level of detail strategy based on distance from camera.
Definition: OgreDistanceLodStrategy.h:56
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::DistanceLodBoxStrategy::getSingletonPtr
static DistanceLodBoxStrategy * getSingletonPtr(void)
Override standard Singleton retrieval.
Ogre::DistanceLodSphereStrategy::DistanceLodSphereStrategy
DistanceLodSphereStrategy()
Default constructor.
Ogre::DistanceLodStrategy::getBaseValue
virtual Real getBaseValue() const
Get the value of the first (highest) level of detail.
Ogre::DistanceLodSphereStrategy::getSingletonPtr
static DistanceLodSphereStrategy * getSingletonPtr(void)
Override standard Singleton retrieval.
OgreNode.h
Ogre::DistanceLodSphereStrategy::getSquaredDepth
Real getSquaredDepth(const MovableObject *movableObject, const Ogre::Camera *camera) const
Get the squared depth from camera to the LOD object.
Ogre::DistanceLodStrategy::mReferenceViewValue
Real mReferenceViewValue
Definition: OgreDistanceLodStrategy.h:108
Ogre::DistanceLodStrategy::setReferenceView
void setReferenceView(Real viewportWidth, Real viewportHeight, Radian fovY)
Sets the reference view upon which the distances were based.
Ogre::DistanceLodStrategy::transformBias
virtual Real transformBias(Real factor) const
Transform LOD bias so it only needs to be multiplied by the LOD value.
Ogre::DistanceLodStrategy::getSquaredDepth
virtual Real getSquaredDepth(const MovableObject *movableObject, const Ogre::Camera *camera) const =0
Get the squared depth from camera to the LOD object.
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
OgreLodStrategy.h
Ogre::DistanceLodStrategy::getIndex
virtual ushort getIndex(Real value, const Mesh::MeshLodUsageList &meshLodUsageList) const
Get the index of the LOD usage which applies to a given value.
Ogre::DistanceLodStrategy::isReferenceViewEnabled
bool isReferenceViewEnabled() const
Determine if use of the reference view is enabled.

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