OGRE-Next  3.0.0
Object-Oriented Graphics Rendering Engine
Ogre::RenderQueue Class Reference

Class to manage the scene object rendering queue. More...

#include <OgreRenderQueue.h>

+ Inheritance diagram for Ogre::RenderQueue:

Public Types

enum  Modes { V1_LEGACY , V1_FAST , FAST }
 
enum  RqSortMode { DisableSort , NormalSort , StableSort }
 

Public Member Functions

 RenderQueue (HlmsManager *hlmsManager, SceneManager *sceneManager, VaoManager *vaoManager)
 
 ~RenderQueue ()
 
void addRenderableV1 (uint8 renderQueueId, bool casterPass, Renderable *pRend, const MovableObject *pMovableObject)
 Add a renderable (Ogre v1.x) object to the queue. More...
 
void addRenderableV2 (size_t threadIdx, uint8 renderQueueId, bool casterPass, Renderable *pRend, const MovableObject *pMovableObject)
 Add a renderable (Ogre v2.0, i.e. More...
 
void clear ()
 Empty the queue - should only be called by SceneManagers. More...
 
void clearState ()
 The RenderQueue keeps track of API state to avoid redundant state change passes Calling this function forces the RenderQueue to re-set the Macro- & Blendblocks, shaders, and any other API dependendant calls on the next render. More...
 
void frameEnded ()
 Called when the frame has fully ended (ALL passes have been executed to all RTTs) More...
 
RenderQueue::Modes getRenderQueueMode (uint8 rqId) const
 
RqSortMode getSortRenderQueue (uint8 rqId) const
 
void render (RenderSystem *rs, uint8 firstRq, uint8 lastRq, bool casterPass, bool dualParaboloid)
 
void renderPassPrepare (bool casterPass, bool dualParaboloid)
 If you need to call RenderQueue::render, then you must call this function. More...
 
void renderSingleObject (Renderable *pRend, const MovableObject *pMovableObject, RenderSystem *rs, bool casterPass, bool dualParaboloid)
 Don't call this too often. Only renders v1 objects at the moment. More...
 
void setRenderQueueMode (uint8 rqId, RenderQueue::Modes newMode)
 Sets the mode for the RenderQueue ID. More...
 
void setSortRenderQueue (uint8 rqId, RqSortMode sortMode)
 Sets whether we should sort the render queue ID every frame. More...
 
void warmUpShaders (uint8 firstRq, uint8 lastRq, bool casterPass)
 Simulates what render() would do. More...
 

Detailed Description

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.
This class 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.
Remarks
By default, movables will be assigned the following render queue ID:
Decal: 0
Light: 0-5 (depends on light type, cannot be changed)
Item: 10
Rectangle2D: 10
v1::Entity: 110
v1::Rectangle2D: 110
ParticleSystem: 110
[.. more unlisted ..]
By default, the render queues have the following mode set:
0-99: FAST
100-199: V1_FAST
200-224: FAST
225-255: V1_FAST

Member Enumeration Documentation

◆ Modes

Enumerator
V1_LEGACY 

This is the slowest mode.

Renders the same or similar way to how Ogre 1.x rendered meshes. Only v1 entities can be put in this type of queue. Ideal for low level materials, InstancedEntity via InstanceManager, and any other weird custom object.

V1_FAST 

Renders v1 entities using HLMS materials with some of the new benefits, but some deprecated features from Ogre 1.x might not be available or work properly (like global instancing buffer).

Ideal for most v1 entities, particle effects and billboards using HLMS materials. Cannot be used by RenderSystems that don't support constant buffers (i.e. OpenGL ES 2)

FAST 

Renders v2 items using HLMS materials with minimum driver overhead Recommended method for rendering extremely large amounts of objects of homogeneous and heterogenous meshes, with many different kinds of materials and textures.

Only v2 Items can be put in this queue.

◆ RqSortMode

Enumerator
DisableSort 
NormalSort 
StableSort 

Constructor & Destructor Documentation

◆ RenderQueue()

Ogre::RenderQueue::RenderQueue ( HlmsManager hlmsManager,
SceneManager sceneManager,
VaoManager vaoManager 
)

◆ ~RenderQueue()

Ogre::RenderQueue::~RenderQueue ( )

Member Function Documentation

◆ addRenderableV1()

void Ogre::RenderQueue::addRenderableV1 ( uint8  renderQueueId,
bool  casterPass,
Renderable pRend,
const MovableObject pMovableObject 
)

Add a renderable (Ogre v1.x) object to the queue.

See also
addRenderable

◆ addRenderableV2()

void Ogre::RenderQueue::addRenderableV2 ( size_t  threadIdx,
uint8  renderQueueId,
bool  casterPass,
Renderable pRend,
const MovableObject pMovableObject 
)

Add a renderable (Ogre v2.0, i.e.

Items; they use VAOs) object to the queue.

Remarks
If sorting mode is set to DisableSort (RenderQueue::setSortRenderQueue) for the given renderQueueId, then the order in which renderables are added via RenderQueue::addRenderableV2 (and V1) determines the render order (the first added get rendered first) within that renderQueueId.
Parameters
threadIdxThe unique index of the thread from which this function is called from. Valid range is [0; SceneManager::mNumWorkerThreads)
renderQueueIdThe ID of the render queue. Must be the same as the ID in pMovableObject->getRenderQueueGroup()
casterPassWhether we're performing the shadow mapping pass.
pRendPointer to the Renderable to be added to the queue.
pMovableObjectPointer to the MovableObject linked to the Renderable.

◆ clear()

void Ogre::RenderQueue::clear ( )

Empty the queue - should only be called by SceneManagers.

◆ clearState()

void Ogre::RenderQueue::clearState ( )

The RenderQueue keeps track of API state to avoid redundant state change passes Calling this function forces the RenderQueue to re-set the Macro- & Blendblocks, shaders, and any other API dependendant calls on the next render.

Remarks
Calling this function inside render or renderES2 won't have any effect.

◆ frameEnded()

void Ogre::RenderQueue::frameEnded ( )

Called when the frame has fully ended (ALL passes have been executed to all RTTs)

◆ getRenderQueueMode()

RenderQueue::Modes Ogre::RenderQueue::getRenderQueueMode ( uint8  rqId) const

◆ getSortRenderQueue()

RqSortMode Ogre::RenderQueue::getSortRenderQueue ( uint8  rqId) const

◆ render()

void Ogre::RenderQueue::render ( RenderSystem rs,
uint8  firstRq,
uint8  lastRq,
bool  casterPass,
bool  dualParaboloid 
)

◆ renderPassPrepare()

void Ogre::RenderQueue::renderPassPrepare ( bool  casterPass,
bool  dualParaboloid 
)

If you need to call RenderQueue::render, then you must call this function.

This function MUST be called (all listed functions are called in this order):

  1. After RenderSystem::beginRenderPassDescriptor
  2. After SceneManager::fireRenderQueueStarted
  3. Before RenderSystem::executeRenderPassDescriptorDelayedActions
  4. Before RenderQueue::render

Note that fireRenderQueueStarted just fires arbitrary listeners. You don't have to call that function if you are sure you don't need it.

To clarify functions are called in this order:

mRenderSystem->beginRenderPassDescriptor();
mSceneManager->fireRenderQueueStarted();
mRenderQueue->renderPassPrepare();
mRenderSystem->executeRenderPassDescriptorDelayedActions();
mRenderQueue->render();

Calling these functions in proper order is needed for best compatibility with Metal

Parameters
casterPass
dualParaboloid

◆ renderSingleObject()

void Ogre::RenderQueue::renderSingleObject ( Renderable pRend,
const MovableObject pMovableObject,
RenderSystem rs,
bool  casterPass,
bool  dualParaboloid 
)

Don't call this too often. Only renders v1 objects at the moment.

◆ setRenderQueueMode()

void Ogre::RenderQueue::setRenderQueueMode ( uint8  rqId,
RenderQueue::Modes  newMode 
)

Sets the mode for the RenderQueue ID.

See also
RenderQueue::Modes
Parameters
rqIdID of the render queue
newModeThe new mode to use.

◆ setSortRenderQueue()

void Ogre::RenderQueue::setSortRenderQueue ( uint8  rqId,
RqSortMode  sortMode 
)

Sets whether we should sort the render queue ID every frame.

Parameters
rqIdID of the render queue
bSortWhen false, the render queue group won't be sorted. Useful when the RQ needs to be drawn exactly in the order that Renderables were added, or when you have a deep CPU bottleneck where the time taken to sort hurts more than it is supposed to help.

◆ warmUpShaders()

void Ogre::RenderQueue::warmUpShaders ( uint8  firstRq,
uint8  lastRq,
bool  casterPass 
)

Simulates what render() would do.

But doesn't actually render and skips as much as possible We are only interested in generating the PSOs for compiling them early.

Parameters
firstRq
lastRq
casterPass

The documentation for this class was generated from the following file: