cocos2d-x  3.3
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Renderer Class Reference

#include <CCRenderer.h>

Public Member Functions

 Renderer ()
 ~Renderer ()
void initGLView ()
void addCommand (RenderCommand *command)
 Adds a RenderComamnd into the renderer. More...
 
void addCommand (RenderCommand *command, int renderQueue)
 Adds a RenderComamnd into the renderer specifying a particular render queue ID. More...
 
void pushGroup (int renderQueueID)
 Pushes a group into the render queue. More...
 
void popGroup ()
 Pops a group from the render queue. More...
 
int createRenderQueue ()
 Creates a render queue and returns its Id. More...
 
void render ()
 Renders into the GLView all the queued RenderCommand objects. More...
 
void clean ()
 Cleans all RenderCommands in the queue. More...
 
ssize_t getDrawnBatches () const
void addDrawnBatches (ssize_t number)
ssize_t getDrawnVertices () const
void addDrawnVertices (ssize_t number)
void clearDrawStats ()
GroupCommandManagergetGroupCommandManager () const
bool checkVisibility (const Mat4 &transform, const Size &size)
 returns whether or not a rectangle is visible or not More...
 

Static Public Attributes

static const int VBO_SIZE = 65536
static const int INDEX_VBO_SIZE = VBO_SIZE * 6 / 4
static const int BATCH_QUADCOMMAND_RESEVER_SIZE = 64
static const int MATERIAL_ID_DO_NOT_BATCH = 0

Protected Member Functions

void setupBuffer ()
void setupVBOAndVAO ()
void setupVBO ()
void mapBuffers ()
void drawBatchedTriangles ()
void drawBatchedQuads ()
void flush ()
void flush2D ()
void flush3D ()
void visitRenderQueue (const RenderQueue &queue)
void visitTransparentRenderQueue (const TransparentRenderQueue &queue)
void fillVerticesAndIndices (const TrianglesCommand *cmd)
void fillQuads (const QuadCommand *cmd)

Protected Attributes

std::stack< int > _commandGroupStack
std::vector< RenderQueue_renderGroups
TransparentRenderQueue _transparentRenderGroups
uint32_t _lastMaterialID
MeshCommand_lastBatchedMeshCommand
std::vector< TrianglesCommand * > _batchedCommands
std::vector< QuadCommand * > _batchQuadCommands
V3F_C4B_T2F _verts [VBO_SIZE]
GLushort _indices [INDEX_VBO_SIZE]
GLuint _buffersVAO
GLuint _buffersVBO [2]
int _filledVertex
int _filledIndex
V3F_C4B_T2F _quadVerts [VBO_SIZE]
GLushort _quadIndices [INDEX_VBO_SIZE]
GLuint _quadVAO
GLuint _quadbuffersVBO [2]
int _numberQuads
bool _glViewAssigned
ssize_t _drawnBatches
ssize_t _drawnVertices
bool _isRendering
GroupCommandManager_groupCommandManager

Constructor & Destructor Documentation

Renderer ( )
~Renderer ( )

Member Function Documentation

void addCommand ( RenderCommand command)

Adds a RenderComamnd into the renderer.

void addCommand ( RenderCommand command,
int  renderQueue 
)

Adds a RenderComamnd into the renderer specifying a particular render queue ID.

void addDrawnBatches ( ssize_t  number)
inline
void addDrawnVertices ( ssize_t  number)
inline
bool checkVisibility ( const Mat4 transform,
const Size size 
)

returns whether or not a rectangle is visible or not

void clean ( )

Cleans all RenderCommands in the queue.

void clearDrawStats ( )
inline
int createRenderQueue ( )

Creates a render queue and returns its Id.

void drawBatchedQuads ( )
protected
void drawBatchedTriangles ( )
protected
void fillQuads ( const QuadCommand cmd)
protected
void fillVerticesAndIndices ( const TrianglesCommand cmd)
protected
void flush ( )
protected
void flush2D ( )
protected
void flush3D ( )
protected
ssize_t getDrawnBatches ( ) const
inline
ssize_t getDrawnVertices ( ) const
inline
GroupCommandManager*
getGroupCommandManager
( ) const
inline
void initGLView ( )
void mapBuffers ( )
protected
void popGroup ( )

Pops a group from the render queue.

void pushGroup ( int  renderQueueID)

Pushes a group into the render queue.

void render ( )

Renders into the GLView all the queued RenderCommand objects.

void setupBuffer ( )
protected
void setupVBO ( )
protected
void setupVBOAndVAO ( )
protected
void visitRenderQueue ( const RenderQueue queue)
protected
void visitTransparentRenderQueue ( const TransparentRenderQueue queue)
protected

Member Data Documentation

std::vector<TrianglesCommand*>
_batchedCommands
protected
std::vector<QuadCommand*>
_batchQuadCommands
protected
GLuint _buffersVAO
protected
GLuint _buffersVBO[2]
protected
std::stack<int> _commandGroupStack
protected
ssize_t _drawnBatches
protected
ssize_t _drawnVertices
protected
int _filledIndex
protected
int _filledVertex
protected
bool _glViewAssigned
protected
GroupCommandManager*
_groupCommandManager
protected
GLushort _indices[INDEX_VBO_SIZE]
protected
bool _isRendering
protected
MeshCommand*
_lastBatchedMeshCommand
protected
uint32_t _lastMaterialID
protected
int _numberQuads
protected
GLuint _quadbuffersVBO[2]
protected
GLushort _quadIndices[INDEX_VBO_SIZE]
protected
GLuint _quadVAO
protected
V3F_C4B_T2F _quadVerts[VBO_SIZE]
protected
std::vector<RenderQueue>
_renderGroups
protected
TransparentRenderQueue
_transparentRenderGroups
protected
V3F_C4B_T2F _verts[VBO_SIZE]
protected
const int
BATCH_QUADCOMMAND_RESEVER_SIZE = 64
static
const int INDEX_VBO_SIZE = VBO_SIZE * 6 / 4
static
const int MATERIAL_ID_DO_NOT_BATCH = 0
static
const int VBO_SIZE = 65536
static

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