OGRE  1.9.0
OgreQueuedProgressiveMeshGenerator.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 __QueuedProgressiveMeshGenerator_H_
30#define __QueuedProgressiveMeshGenerator_H_
31
33#include "OgreSingleton.h"
34#include "OgreWorkQueue.h"
35#include "OgreFrameListener.h"
36
37namespace Ogre
38{
39
69
74 public Singleton<PMWorker>,
77 public LodAlloc
78{
79public:
81 virtual ~PMWorker();
84
100 static PMWorker& getSingleton(void);
117
118private:
119 PMGenRequest* mRequest; // This is a copy of the current processed request from stack. This is needed to pass it to overloaded functions like bakeLods().
121
123 void buildRequest(LodConfig& lodConfigs);
126 void addVertexBuffer(const PMGenRequest::VertexBuffer& vertexBuffer, bool useSharedVertexLookup);
127 void addIndexBuffer(PMGenRequest::IndexBuffer& indexBuffer, bool useSharedVertexLookup, unsigned short submeshID);
128 void bakeLods();
129};
130
132{
133public:
136 virtual bool shouldInject(PMGenRequest* request) = 0;
137 virtual void injectionCompleted(PMGenRequest* request) = 0;
138};
139
144 public Singleton<PMInjector>,
146 public LodAlloc
147{
148public:
150 virtual ~PMInjector();
151
184
185 void handleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
186
187 void setInjectorListener(PMInjectorListener* injectorListener) {mInjectorListener = injectorListener;}
189protected:
190
191 // Copies every generated LOD level to the mesh.
192 void inject(PMGenRequest* request);
193
195};
196
215
216}
217#endif
#define _OgreExport
Summary class collecting together index data source information.
Resource holding data about 3D mesh.
Definition OgreMesh.h:94
virtual void injectionCompleted(PMGenRequest *request)=0
virtual bool shouldInject(PMGenRequest *request)=0
static PMInjector * getSingletonPtr(void)
Override standard Singleton retrieval.
void setInjectorListener(PMInjectorListener *injectorListener)
static PMInjector & getSingleton(void)
Override standard Singleton retrieval.
void inject(PMGenRequest *request)
void handleResponse(const WorkQueue::Response *res, const WorkQueue *srcQ)
The handler method every subclass must implement.
virtual ~PMInjector()
void addRequestToQueue(PMGenRequest *request)
static PMWorker * getSingletonPtr(void)
Override standard Singleton retrieval.
static PMWorker & getSingleton(void)
Override standard Singleton retrieval.
virtual ~PMWorker()
void addIndexBuffer(PMGenRequest::IndexBuffer &indexBuffer, bool useSharedVertexLookup, unsigned short submeshID)
WorkQueue::Response * handleRequest(const WorkQueue::Request *req, const WorkQueue *srcQ)
The handler method every subclass must implement.
void clearPendingLodRequests()
void tuneContainerSize()
void buildRequest(LodConfig &lodConfigs)
void addVertexBuffer(const PMGenRequest::VertexBuffer &vertexBuffer, bool useSharedVertexLookup)
void generateLodLevels(LodConfig &lodConfig)
Generates the LOD levels for a mesh.
void copyBuffers(Mesh *mesh, PMGenRequest *req)
void copyIndexBuffer(IndexData *data, PMGenRequest::IndexBuffer &out)
void copyVertexBuffer(VertexData *data, PMGenRequest::VertexBuffer &out)
Singleton(const Singleton< PMWorker > &)
Standard 3-dimensional vector.
Definition OgreVector3.h:52
Summary class collecting together vertex source information.
Interface definition for a handler of requests.
General purpose request structure.
Interface definition for a handler of responses.
Interface to a general purpose request / response style background work queue.
SceneCtlAllocatedObject LodAlloc
_StringBase String
unsigned short ushort
vector< SubmeshInfo >::type submesh
General purpose response structure.
std::vector< T, A > type