OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreMeshLodGenerator.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-2014 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 __MeshLodGenerator_H_
30 #define __MeshLodGenerator_H_
31 
32 #include "OgreLodPrerequisites.h"
33 #include "OgreLodData.h"
34 #include "OgreLodInputProvider.h"
35 #include "OgreLodOutputProvider.h"
36 #include "OgreLodCollapseCost.h"
37 #include "OgreLodCollapser.h"
38 #include "OgreSharedPtr.h"
39 #include "OgreSingleton.h"
40 
41 namespace Ogre
42 {
43 
45 public Singleton<MeshLodGenerator>
46 {
47 public:
48 
49  static MeshLodGenerator* getSingletonPtr();
50  static MeshLodGenerator& getSingleton();
51 
56  virtual ~MeshLodGenerator();
57 
63  virtual void generateLodLevels(LodConfig& lodConfig, LodCollapseCostPtr cost = LodCollapseCostPtr(), LodDataPtr data = LodDataPtr(), LodInputProviderPtr input = LodInputProviderPtr(), LodOutputProviderPtr output = LodOutputProviderPtr(), LodCollapserPtr collapser = LodCollapserPtr());
64 
70  void generateAutoconfiguredLodLevels(MeshPtr& mesh);
71 
78  void getAutoconfig(MeshPtr& inMesh, LodConfig& outLodConfig);
79 
80  static void _configureMeshLodUsage(const LodConfig& lodConfig);
81  void _resolveComponents(LodConfig& lodConfig, LodCollapseCostPtr& cost, LodDataPtr& data, LodInputProviderPtr& input, LodOutputProviderPtr& output, LodCollapserPtr& collapser);
82  void _process(LodConfig& lodConfig, LodCollapseCost* cost, LodData* data, LodInputProvider* input, LodOutputProvider* output, LodCollapser* collapser);
83 
86  void _generateManualLodLevels(LodConfig& lodConfig);
87 
88  void _initWorkQueue();
89 protected:
90  void computeLods(LodConfig& lodConfig, LodData* data, LodCollapseCost* cost, LodOutputProvider* output, LodCollapser* collapser);
91  void calcLodVertexCount(const LodLevel& lodLevel, size_t uniqueVertexCount, size_t& outVertexCountLimit, Real& outCollapseCostLimit);
92 
95 };
96 
97 }
98 #endif
float Real
Software floating point type.
Template class for creating single-instance global classes.
Definition: OgreSingleton.h:64
LodWorkQueueInjector * mWQInjector
Structure for automatic Lod configuration.
Definition: OgreLodConfig.h:49
LodWorkQueueWorker * mWQWorker
#define _OgreLodExport
Injects the output of a request to the mesh in a thread safe way.
SharedPtr< LodCollapser > LodCollapserPtr
SharedPtr< LodOutputProvider > LodOutputProviderPtr
SharedPtr< LodCollapseCost > LodCollapseCostPtr
SharedPtr< LodInputProvider > LodInputProviderPtr
SharedPtr< LodData > LodDataPtr