/usr/include/OGRE/OgreRenderQueue.h is in libogre-1.8-dev 1.8.0+dfsg1-7+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __RenderQueue_H__
#define __RenderQueue_H__
#include "OgreHeaderPrefix.h"
#include "OgrePrerequisites.h"
#include "OgreIteratorWrappers.h"
namespace Ogre {
class Camera;
class MovableObject;
struct VisibleObjectsBoundsInfo;
/** \addtogroup Core
* @{
*/
/** \addtogroup RenderSystem
* @{
*/
/** Enumeration of queue groups, by which the application may group queued renderables
so that they are rendered together with events in between
@remarks
When passed into methods these are actually passed as a uint8 to allow you
to use values in between if you want to.
*/
enum RenderQueueGroupID
{
/// Use this queue for objects which must be rendered first e.g. backgrounds
RENDER_QUEUE_BACKGROUND = 0,
/// First queue (after backgrounds), used for skyboxes if rendered first
RENDER_QUEUE_SKIES_EARLY = 5,
RENDER_QUEUE_1 = 10,
RENDER_QUEUE_2 = 20,
RENDER_QUEUE_WORLD_GEOMETRY_1 = 25,
RENDER_QUEUE_3 = 30,
RENDER_QUEUE_4 = 40,
/// The default render queue
RENDER_QUEUE_MAIN = 50,
RENDER_QUEUE_6 = 60,
RENDER_QUEUE_7 = 70,
RENDER_QUEUE_WORLD_GEOMETRY_2 = 75,
RENDER_QUEUE_8 = 80,
RENDER_QUEUE_9 = 90,
/// Penultimate queue(before overlays), used for skyboxes if rendered last
RENDER_QUEUE_SKIES_LATE = 95,
/// Use this queue for objects which must be rendered last e.g. overlays
RENDER_QUEUE_OVERLAY = 100,
/// Final possible render queue, don't exceed this
RENDER_QUEUE_MAX = 105
};
#define OGRE_RENDERABLE_DEFAULT_PRIORITY 100
/** Class to manage the scene object rendering queue.
@remarks
Objects are grouped by material to minimise rendering state changes. The map from
material to renderable object is wrapped in a class for ease of use.
@par
This class now includes the concept of 'queue groups' which allows the application
adding the renderable to specifically schedule it so that it is included in
a discrete group. Good for separating renderables into the main scene,
backgrounds and overlays, and also could be used in the future for more
complex multipass routines like stenciling.
*/
class _OgreExport RenderQueue : public RenderQueueAlloc
{
public:
class RenderQueueGroupMap
{
public:
class value_type
{
public:
value_type(uint8 _f, RenderQueueGroup* _g) : first(_f), second(_g)
{
}
value_type() : first(0), second(0)
{
}
uint8 first;
RenderQueueGroup* second;
};
typedef uint8 key_type;
typedef RenderQueueGroup* mapped_type;
typedef value_type& reference;
typedef value_type* pointer;
typedef const value_type& const_reference;
typedef const value_type* const_pointer;
typedef vector<value_type >::type GroupVector;
class iterator
{
friend class RenderQueueGroupMap;
public:
iterator() : mRenderQueueGroupMap(0), mIndex(RENDER_QUEUE_MAX)
{
}
iterator(const RenderQueueGroupMap* _mRenderQueueGroupMap, uint8 _index) : mRenderQueueGroupMap(_mRenderQueueGroupMap), mIndex(_index)
{
}
const_reference operator*() const
{
assert(this->mRenderQueueGroupMap);
return mRenderQueueGroupMap->mGroupVector[mIndex];
}
const_pointer operator->() const
{
assert(this->mRenderQueueGroupMap);
return &(mRenderQueueGroupMap->mGroupVector[mIndex]);
}
iterator& operator++()
{
assert(this->mRenderQueueGroupMap);
while(mIndex < mRenderQueueGroupMap->mMaxID)
{
++mIndex;
if(mRenderQueueGroupMap->mGroupVector[mIndex].second != 0)
{
break;
}
}
return (*this);
}
const iterator& operator++()const
{
assert(this->mRenderQueueGroupMap);
while(mIndex < mRenderQueueGroupMap->mMaxID)
{
++mIndex;
if(mRenderQueueGroupMap->mGroupVector[mIndex].second != 0)
{
break;
}
}
return (*this);
}
iterator operator++(int)
{
assert(this->mRenderQueueGroupMap);
iterator temp = *this;
while(mIndex < mRenderQueueGroupMap->mMaxID)
{
++mIndex;
if(mRenderQueueGroupMap->mGroupVector[mIndex].second != 0)
{
break;
}
}
return (temp);
}
const iterator operator++(int)const
{
assert(this->mRenderQueueGroupMap);
const_iterator temp = *this;
while(mIndex < mRenderQueueGroupMap->mMaxID)
{
++mIndex;
if(mRenderQueueGroupMap->mGroupVector[mIndex].second != 0)
{
break;
}
}
return (temp);
}
bool operator !=(const iterator& o)const
{
assert(mRenderQueueGroupMap);
assert(o.mRenderQueueGroupMap);
assert(o.mRenderQueueGroupMap == this->mRenderQueueGroupMap);
if( o.mIndex != this->mIndex)
return true;
return false;
}
bool operator ==(const iterator& o)const
{
assert(this->mRenderQueueGroupMap);
assert(o.mRenderQueueGroupMap);
assert(o.mRenderQueueGroupMap == this->mRenderQueueGroupMap);
if(o.mIndex == this->mIndex)
{
return true;
}
return false;
}
protected:
const RenderQueueGroupMap* mRenderQueueGroupMap;
mutable uint8 mIndex;
};
typedef const iterator const_iterator;
RenderQueueGroupMap() : mMinID(RENDER_QUEUE_MAX), mMaxID(RENDER_QUEUE_MAX)
{
mGroupVector.resize(RENDER_QUEUE_MAX + 2);
}
void insert(value_type v)
{
mGroupVector[v.first] = v;
if(v.first < mMinID)
{
mMinID = v.first;
}
if(v.first >= mMaxID || mMaxID == RENDER_QUEUE_MAX)
{
mMaxID = v.first + 1;
}
}
iterator find(uint8 key)
{
if(mGroupVector[key].second == 0)
{
return iterator(this, mMaxID);
}
else
{
return iterator(this, key);
}
}
iterator begin()
{
return iterator(this, mMinID);
}
iterator end()
{
return iterator(this, mMaxID);
}
const_iterator begin() const
{
return iterator(this, mMinID);
}
const_iterator end() const
{
return iterator(this, mMaxID);
}
void clear()
{
mGroupVector.reserve(RENDER_QUEUE_MAX + 2);
mGroupVector.clear();
mGroupVector.resize(RENDER_QUEUE_MAX + 2);
mMinID = RENDER_QUEUE_MAX;
mMaxID = RENDER_QUEUE_MAX;
}
protected:
uint8 mMinID;
uint8 mMaxID;
GroupVector mGroupVector;
};
typedef MapIterator<RenderQueueGroupMap> QueueGroupIterator;
typedef ConstMapIterator<RenderQueueGroupMap> ConstQueueGroupIterator;
/** Class to listen in on items being added to the render queue.
@remarks
Use RenderQueue::setRenderableListener to get callbacks when an item
is added to the render queue.
*/
class _OgreExport RenderableListener
{
public:
RenderableListener() {}
virtual ~RenderableListener() {}
/** Method called when a Renderable is added to the queue.
@remarks
You can use this event hook to alter the Technique used to
render a Renderable as the item is added to the queue. This is
a low-level way to override the material settings for a given
Renderable on the fly.
@param rend The Renderable being added to the queue
@param groupID The render queue group this Renderable is being added to
@param priority The priority the Renderable has been given
@param ppTech A pointer to the pointer to the Technique that is
intended to be used; you can alter this to an alternate Technique
if you so wish (the Technique doesn't have to be from the same
Material either).
@param pQueue Pointer to the render queue that this object is being
added to. You can for example call this back to duplicate the
object with a different technique
@return true to allow the Renderable to be added to the queue,
false if you want to prevent it being added
*/
virtual bool renderableQueued(Renderable* rend, uint8 groupID,
ushort priority, Technique** ppTech, RenderQueue* pQueue) = 0;
};
protected:
RenderQueueGroupMap mGroups;
/// The current default queue group
uint8 mDefaultQueueGroup;
/// The default priority
ushort mDefaultRenderablePriority;
bool mSplitPassesByLightingType;
bool mSplitNoShadowPasses;
bool mShadowCastersCannotBeReceivers;
RenderableListener* mRenderableListener;
public:
RenderQueue();
virtual ~RenderQueue();
/** Empty the queue - should only be called by SceneManagers.
@param destroyPassMaps Set to true to destroy all pass maps so that
the queue is completely clean (useful when switching scene managers)
*/
void clear(bool destroyPassMaps = false);
/** Get a render queue group.
@remarks
OGRE registers new queue groups as they are requested,
therefore this method will always return a valid group.
*/
RenderQueueGroup* getQueueGroup(uint8 qid);
/** Add a renderable object to the queue.
@remarks
This methods adds a Renderable to the queue, which will be rendered later by
the SceneManager. This is the advanced version of the call which allows the renderable
to be added to any queue.
@note
Called by implementation of MovableObject::_updateRenderQueue.
@param
pRend Pointer to the Renderable to be added to the queue
@param
groupID The group the renderable is to be added to. This
can be used to schedule renderable objects in separate groups such that the SceneManager
respects the divisions between the groupings and does not reorder them outside these
boundaries. This can be handy for overlays where no matter what you want the overlay to
be rendered last.
@param
priority Controls the priority of the renderable within the queue group. If this number
is raised, the renderable will be rendered later in the group compared to it's peers.
Don't use this unless you really need to, manually ordering renderables prevents OGRE
from sorting them for best efficiency. However this could be useful for ordering 2D
elements manually for example.
*/
void addRenderable(Renderable* pRend, uint8 groupID, ushort priority);
/** Add a renderable object to the queue.
@remarks
This methods adds a Renderable to the queue, which will be rendered later by
the SceneManager. This is the simplified version of the call which does not
require a priority to be specified. The queue priority is take from the
current default (see setDefaultRenderablePriority).
@note
Called by implementation of MovableObject::_updateRenderQueue.
@param
pRend Pointer to the Renderable to be added to the queue
@param
groupID The group the renderable is to be added to. This
can be used to schedule renderable objects in separate groups such that the SceneManager
respects the divisions between the groupings and does not reorder them outside these
boundaries. This can be handy for overlays where no matter what you want the overlay to
be rendered last.
*/
void addRenderable(Renderable* pRend, uint8 groupId);
/** Add a renderable object to the queue.
@remarks
This methods adds a Renderable to the queue, which will be rendered later by
the SceneManager. This is the simplified version of the call which does not
require a queue or priority to be specified. The queue group is taken from the
current default (see setDefaultQueueGroup). The queue priority is take from the
current default (see setDefaultRenderablePriority).
@note
Called by implementation of MovableObject::_updateRenderQueue.
@param
pRend Pointer to the Renderable to be added to the queue
*/
void addRenderable(Renderable* pRend);
/** Gets the current default queue group, which will be used for all renderable which do not
specify which group they wish to be on.
*/
uint8 getDefaultQueueGroup(void) const;
/** Sets the current default renderable priority,
which will be used for all renderables which do not
specify which priority they wish to use.
*/
void setDefaultRenderablePriority(ushort priority);
/** Gets the current default renderable priority, which will be used for all renderables which do not
specify which priority they wish to use.
*/
ushort getDefaultRenderablePriority(void) const;
/** Sets the current default queue group, which will be used for all renderable which do not
specify which group they wish to be on. See the enum RenderQueueGroupID for what kind of
values can be used here.
*/
void setDefaultQueueGroup(uint8 grp);
/** Internal method, returns an iterator for the queue groups. */
QueueGroupIterator _getQueueGroupIterator(void);
ConstQueueGroupIterator _getQueueGroupIterator(void) const;
/** Sets whether or not the queue will split passes by their lighting type,
ie ambient, per-light and decal.
*/
void setSplitPassesByLightingType(bool split);
/** Gets whether or not the queue will split passes by their lighting type,
ie ambient, per-light and decal.
*/
bool getSplitPassesByLightingType(void) const;
/** Sets whether or not the queue will split passes which have shadow receive
turned off (in their parent material), which is needed when certain shadow
techniques are used.
*/
void setSplitNoShadowPasses(bool split);
/** Gets whether or not the queue will split passes which have shadow receive
turned off (in their parent material), which is needed when certain shadow
techniques are used.
*/
bool getSplitNoShadowPasses(void) const;
/** Sets whether or not objects which cast shadows should be treated as
never receiving shadows.
*/
void setShadowCastersCannotBeReceivers(bool ind);
/** Gets whether or not objects which cast shadows should be treated as
never receiving shadows.
*/
bool getShadowCastersCannotBeReceivers(void) const;
/** Set a renderable listener on the queue.
@remarks
There can only be a single renderable listener on the queue, since
that listener has complete control over the techniques in use.
*/
void setRenderableListener(RenderableListener* listener)
{ mRenderableListener = listener; }
RenderableListener* getRenderableListener(void) const
{ return mRenderableListener; }
/** Merge render queue.
*/
void merge( const RenderQueue* rhs );
/** Utility method to perform the standard actions associated with
getting a visible object to add itself to the queue. This is
a replacement for SceneManager implementations of the associated
tasks related to calling MovableObject::_updateRenderQueue.
*/
void processVisibleObject(MovableObject* mo,
Camera* cam,
bool onlyShadowCasters,
VisibleObjectsBoundsInfo* visibleBounds);
};
/** @} */
/** @} */
}
#include "OgreHeaderSuffix.h"
#endif
|