Cocos2d-x  v3.15
RenderQueue Class Reference

Class that knows how to sort RenderCommand objects. More...

Public Types

enum  QUEUE_GROUP {
  GLOBALZ_NEG = 0, OPAQUE_3D = 1, TRANSPARENT_3D = 2, GLOBALZ_ZERO = 3,
  GLOBALZ_POS = 4
}
 RenderCommand will be divided into Queue Groups. More...
 

Public Member Functions

 RenderQueue ()
 Constructor. More...
 
void push_back (RenderCommand *command)
 Push a renderCommand into current renderqueue. More...
 
ssize_t size () const
 Return the number of render commands. More...
 
void sort ()
 Sort the render commands. More...
 
RenderCommandoperator[] (ssize_t index) const
 Treat sorted commands as an array, access them one by one. More...
 
void clear ()
 Clear all rendered commands. More...
 
void realloc (size_t reserveSize)
 Realloc command queues and reserve with given size. More...
 
std::vector< RenderCommand * > & getSubQueue (QUEUE_GROUP group)
 Get a sub group of the render queue. More...
 
ssize_t getSubQueueSize (QUEUE_GROUP group) const
 Get the number of render commands contained in a subqueue. More...
 
void saveRenderState ()
 Save the current DepthState, CullState, DepthWriteState render state. More...
 
void restoreRenderState ()
 Restore the saved DepthState, CullState, DepthWriteState render state. More...
 

Detailed Description

Class that knows how to sort RenderCommand objects.

Since the commands that have z == 0 are "pushed back" in the correct order, the only RenderCommand objects that need to be sorted, are the ones that have z < 0 and z > 0.

Member Enumeration Documentation

◆ QUEUE_GROUP

RenderCommand will be divided into Queue Groups.

Enumerator
GLOBALZ_NEG 

Objects with globalZ smaller than 0.

OPAQUE_3D 

Opaque 3D objects with 0 globalZ.

TRANSPARENT_3D 

Transparent 3D objects with 0 globalZ.

GLOBALZ_ZERO 

2D objects with 0 globalZ.

GLOBALZ_POS 

Objects with globalZ bigger than 0.

Constructor & Destructor Documentation

◆ RenderQueue()

Constructor.

Member Function Documentation

◆ push_back()

void push_back ( RenderCommand command)

Push a renderCommand into current renderqueue.

◆ size()

ssize_t size ( ) const

Return the number of render commands.

◆ sort()

void sort ( )

Sort the render commands.

◆ operator[]()

RenderCommand* operator[] ( ssize_t  index) const

Treat sorted commands as an array, access them one by one.

◆ clear()

void clear ( )

Clear all rendered commands.

◆ realloc()

void realloc ( size_t  reserveSize)

Realloc command queues and reserve with given size.

Note: this clears any existing commands.

◆ getSubQueue()

std::vector<RenderCommand*>& getSubQueue ( QUEUE_GROUP  group)
inline

Get a sub group of the render queue.

◆ getSubQueueSize()

ssize_t getSubQueueSize ( QUEUE_GROUP  group) const
inline

Get the number of render commands contained in a subqueue.

◆ saveRenderState()

void saveRenderState ( )

Save the current DepthState, CullState, DepthWriteState render state.

◆ restoreRenderState()

void restoreRenderState ( )

Restore the saved DepthState, CullState, DepthWriteState render state.


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