Axmol Engine 2.4.0-258ceca
|
Custom command is used to draw all things except triangle commands. More...
#include <CustomCommand.h>
Inherits RenderCommand.
Public Types | |
using | BufferUsage = backend::BufferUsage |
Buffer usage of vertex/index buffer. | |
using | IndexFormat = backend::IndexFormat |
The index format that determines the size of index data. | |
![]() | |
enum class | Type { UNKNOWN_COMMAND , QUAD_COMMAND , CUSTOM_COMMAND , GROUP_COMMAND , MESH_COMMAND , TRIANGLES_COMMAND , CALLBACK_COMMAND } |
Enum the type of render command. More... | |
Public Member Functions | |
CustomCommand () | |
Constructor. | |
~CustomCommand () | |
Destructor. | |
void | init (float globalZOrder, const Mat4 &modelViewTransform, unsigned int flags) |
TODO: should remove it. | |
void | init (float globalZOrder) |
Init function. | |
void | init (float globalZOrder, const BlendFunc &blendFunc) |
Init function. | |
void | createVertexBuffer (std::size_t vertexSize, std::size_t capacity, BufferUsage usage) |
Create a vertex buffer of the custom command. | |
void | createIndexBuffer (IndexFormat format, std::size_t capacity, BufferUsage usage) |
Create an index buffer of the custom command. | |
void | updateVertexBuffer (const void *data, std::size_t length) |
Update vertex buffer contents. | |
void | updateIndexBuffer (const void *data, std::size_t length) |
Update index buffer contents. | |
void | updateVertexBuffer (const void *data, std::size_t offset, std::size_t length) |
Update some or all contents of vertex buffer. | |
void | updateIndexBuffer (const void *data, std::size_t offset, std::size_t length) |
Update some or call contents of index buffer. | |
std::size_t | getVertexCapacity () const |
Get vertex buffer capacity. | |
std::size_t | getIndexCapacity () const |
Get index buffer capacity. | |
void | setVertexBuffer (backend::Buffer *vertexBuffer) |
Set the vertex buffer. | |
void | setIndexBuffer (backend::Buffer *indexBuffer, IndexFormat indexFormat) |
Set the index buffer. | |
void | setVertexDrawInfo (std::size_t start, std::size_t count) |
Set the drawing information if the drawing type is ARRAY. | |
void | setIndexDrawInfo (std::size_t start, std::size_t count) |
Set the drawing information if the drawing type is ELEMENT. | |
void | setBeforeCallback (const CallBackFunc &before) |
set a callback which will be invoke before rendering | |
void | setAfterCallback (const CallBackFunc &after) |
set a callback which will be invoke after rendering | |
![]() | |
void | init (float globalZOrder, const Mat4 &modelViewTransform, unsigned int flags) |
Init function, will be called by all the render commands. | |
float | getGlobalOrder () const |
Get global Z order. | |
Type | getType () const |
Returns the Command type. | |
bool | isTransparent () const |
Returns whether is transparent. | |
void | setTransparent (bool isTransparent) |
Set transparent flag. | |
bool | isSkipBatching () const |
Get skip batching status, if a rendering is skip batching, it will be forced to be rendering separately. | |
void | setSkipBatching (bool value) |
Set skip batching. | |
bool | is3D () const |
Whether the command should be rendered at 3D mode. | |
void | set3D (bool value) |
Set the command rendered in 3D mode or not. | |
float | getDepth () const |
Get the depth by current model view matrix. | |
bool | isWireframe () const |
Whether the command should be rendered in wireframe mode. | |
void | setWireframe (bool value) |
Set wireframe render mode for this command. | |
PipelineDescriptor & | getPipelineDescriptor () |
Can use the result to change the descriptor content. | |
Custom command is used to draw all things except triangle commands.
You can use this command to draw things, just provide vertex/index data and set corret flags.
using BufferUsage = backend::BufferUsage |
Buffer usage of vertex/index buffer.
If the contents are not updated every frame, then STATIC should be used. Otherwise, DYNAMIC should be used. This flag is not improtant because most GPU drivers ignore it, so it's best left to STATIC.
using IndexFormat = backend::IndexFormat |
The index format that determines the size of index data.
U_SHORT (65535 vertices) is enough for most cases, But support for U_INT (4294967295 vertices) has been added.
void init | ( | float | globalZOrder, |
const Mat4 & | modelViewTransform, | ||
unsigned int | flags ) |
TODO: should remove it.
Init function.
globalZOrder | GlobalZOrder of the render command. |
modelViewTransform | When in 3D mode, depth sorting needs modelViewTransform. |
flags | Use to identify that the render command is 3D mode or not. |
void init | ( | float | globalZOrder | ) |
Init function.
The render command will be in 2D mode.
globalZOrder | GlobalZOrder of the render command. |
void init | ( | float | globalZOrder, |
const BlendFunc & | blendFunc ) |
Init function.
The render command will be in 2D mode.
globalZOrder | GlobalZOrder of the render command. |
blendFunc | blend function of the render command. |
void createVertexBuffer | ( | std::size_t | vertexSize, |
std::size_t | capacity, | ||
BufferUsage | usage ) |
Create a vertex buffer of the custom command.
The buffer size is (vertexSize * capacity). If the buffer already exists, then it will delete the old buffer and create a new one.
vertexSize | the size of every vertex data. |
capacity | how many vertices of the buffer |
usage | the usage of the vertex buffer. Use Static of the vertex data are not updated every frame, otherwise use DYNAMIC. |
void createIndexBuffer | ( | IndexFormat | format, |
std::size_t | capacity, | ||
BufferUsage | usage ) |
Create an index buffer of the custom command.
The buffer size is (indexSize * capacity). Index size is determined by format. If the buffer already exists, then it will delete the old buffer and create a new one.
format | index fomrat, if format is U_SHORT, then the index data type should be unsigned short, otherwise should be unsigned int. |
capacity | how many indices of the buffer |
usage | the usage of the vertex buffer. Use Static of the index data are not updated every frame, otherwise use DYNAMIC. |
void updateVertexBuffer | ( | const void * | data, |
std::size_t | length ) |
Update vertex buffer contents.
data | Specifies a pointer to the new data that will be copied into the data store. |
length | Specifies the length in bytes of the data store region being replaced. |
void updateIndexBuffer | ( | const void * | data, |
std::size_t | length ) |
Update index buffer contents.
data | Specifies a pointer to the new data that will be copied into the data store. |
length | Specifies the size in bytes of the data store region being replaced. |
void updateVertexBuffer | ( | const void * | data, |
std::size_t | offset, | ||
std::size_t | length ) |
Update some or all contents of vertex buffer.
data | Specifies a pointer to the new data that will be copied into the data store. |
offset | Specifies the offset into the buffer object's data store where data replacement will begin, measured in bytes. |
length | Specifies the size in bytes of the data store region being replaced. |
void updateIndexBuffer | ( | const void * | data, |
std::size_t | offset, | ||
std::size_t | length ) |
Update some or call contents of index buffer.
data | Specifies a pointer to the new data that will be copied into the data store. |
offset | specifies the offset into the buffer object's data store where data replacement will begin, measured in bytes. |
length | Specifies the size in bytes of the data store region being replaced. |
void setVertexBuffer | ( | backend::Buffer * | vertexBuffer | ) |
Set the vertex buffer.
The existing vertex buffer will be replaced if exist.
void setIndexBuffer | ( | backend::Buffer * | indexBuffer, |
IndexFormat | indexFormat ) |
Set the index buffer.
The existing index buffer will be replaced if exist.
|
inline |
Set the drawing information if the drawing type is ARRAY.
@start specifices the starting index of vertex buffer @count specifices the number of vertices to be rendered
|
inline |
Set the drawing information if the drawing type is ELEMENT.
@start specifices the starting index of index buffer @count specifices the number of indices to be rendered