OgreLodStrategy.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-2013 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#ifndef __Lod_Strategy_H__
29#define __Lod_Strategy_H__
30
31#include "OgrePrerequisites.h"
32
33#include "OgreMesh.h"
34
35#include "OgreMovableObject.h"
36#include "OgreCamera.h"
37#include "OgreHeaderPrefix.h"
38
39namespace Ogre {
40
55 {
56 protected:
59
61 virtual Real getValueImpl(const MovableObject *movableObject, const Camera *camera) const = 0;
62
63 public:
65 LodStrategy(const String& name);
66
68 virtual ~LodStrategy();
69
71 virtual Real getBaseValue() const = 0;
72
74 virtual Real transformBias(Real factor) const = 0;
75
83 virtual Real transformUserValue(Real userValue) const;
84
86 Real getValue(const MovableObject *movableObject, const Camera *camera) const;
87
90
93
96
98 virtual bool isSorted(const Mesh::LodValueList& values) const = 0;
99
101 void assertSorted(const Mesh::LodValueList& values) const;
102
104 const String& getName() const { return mName; }
105
106 protected:
108 static bool isSortedAscending(const Mesh::LodValueList& values);
110 static bool isSortedDescending(const Mesh::LodValueList& values);
111
116
121
126
127 };
131} // namespace
132
133#include "OgreHeaderSuffix.h"
134
135#endif
#define _OgreExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
A viewpoint from which the scene will be rendered.
Definition OgreCamera.h:87
Strategy for determining level of detail.
static ushort getIndexAscending(Real value, const Material::LodValueList &materialLodValueList)
Implementation of getIndex suitable for ascending values.
static void sortDescending(Mesh::MeshLodUsageList &meshLodUsageList)
Implementation of sort suitable for descending values.
virtual Real getBaseValue() const =0
Get the value of the first (highest) level of detail.
static bool isSortedDescending(const Mesh::LodValueList &values)
Implementation of isSorted suitable for descending values.
virtual ushort getIndex(Real value, const Mesh::MeshLodUsageList &meshLodUsageList) const =0
Get the index of the LOD usage which applies to a given value.
virtual Real getValueImpl(const MovableObject *movableObject, const Camera *camera) const =0
Compute the LOD value for a given movable object relative to a given camera.
LodStrategy(const String &name)
Constructor accepting name.
virtual void sort(Mesh::MeshLodUsageList &meshLodUsageList) const =0
Sort mesh LOD usage list from greatest to least detail.
virtual Real transformUserValue(Real userValue) const
Transform user supplied value to internal value.
virtual ~LodStrategy()
Virtual destructor.
static ushort getIndexDescending(Real value, const Mesh::MeshLodUsageList &meshLodUsageList)
Implementation of getIndex suitable for descending values.
String mName
Name of this strategy.
static ushort getIndexDescending(Real value, const Material::LodValueList &materialLodValueList)
Implementation of getIndex suitable for descending values.
virtual bool isSorted(const Mesh::LodValueList &values) const =0
Determine if the LOD values are sorted from greatest detail to least detail.
void assertSorted(const Mesh::LodValueList &values) const
Assert that the LOD values are sorted from greatest detail to least detail.
virtual ushort getIndex(Real value, const Material::LodValueList &materialLodValueList) const =0
Get the index of the LOD usage which applies to a given value.
static void sortAscending(Mesh::MeshLodUsageList &meshLodUsageList)
Implementation of sort suitable for ascending values.
Real getValue(const MovableObject *movableObject, const Camera *camera) const
Compute the LOD value for a given movable object relative to a given camera.
static bool isSortedAscending(const Mesh::LodValueList &values)
Implementation of isSorted suitable for ascending values.
virtual Real transformBias(Real factor) const =0
Transform LOD bias so it only needs to be multiplied by the LOD value.
static ushort getIndexAscending(Real value, const Mesh::MeshLodUsageList &meshLodUsageList)
Implementation of getIndex suitable for ascending values.
const String & getName() const
Get the name of this strategy.
vector< Real >::type LodValueList
distance list used to specify LOD
vector< Real >::type LodValueList
Definition OgreMesh.h:102
vector< MeshLodUsage >::type MeshLodUsageList
Definition OgreMesh.h:103
Abstract class defining a movable object in a scene.
Reference-counted shared pointer, used for objects where implicit destruction is required.
float Real
Software floating point type.
_StringBase String

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