Custom command is used to draw all things except triangle commands. More...
Inherits RenderCommand.
Inherited by MeshCommand.
Public Types | |
| using | BufferUsage = backend::BufferUsage |
| Buffer usage of vertex/index buffer. More... | |
| using | IndexFormat = backend::IndexFormat |
| The index format determine the size for index data. More... | |
Public Types inherited from RenderCommand | |
| enum | 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. More... | |
| void | init (float globalZOrder) |
| Init function. More... | |
| void | init (float globalZOrder, const BlendFunc &blendFunc) |
| Init function. More... | |
| void | createVertexBuffer (std::size_t vertexSize, std::size_t capacity, BufferUsage usage) |
| Create a vertex buffer of the custom command. More... | |
| void | createIndexBuffer (IndexFormat format, std::size_t capacity, BufferUsage usage) |
| Create an index buffer of the custom command. More... | |
| void | updateVertexBuffer (void *data, std::size_t length) |
| Update vertex buffer contents. More... | |
| void | updateIndexBuffer (void *data, std::size_t length) |
| Update index buffer contents. More... | |
| void | updateVertexBuffer (void *data, std::size_t offset, std::size_t length) |
| Update some or all contents of vertex buffer. More... | |
| void | updateIndexBuffer (void *data, std::size_t offset, std::size_t length) |
| Update some or call contents of index buffer. More... | |
| 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. More... | |
| void | setIndexBuffer (backend::Buffer *indexBuffer, IndexFormat indexFormat) |
| Set the index buffer. More... | |
| void | setVertexDrawInfo (std::size_t start, std::size_t count) |
| Set the drawing information if the drawing type is ARRAY. More... | |
| void | setIndexDrawInfo (std::size_t start, std::size_t count) |
| Set the drawing information if the drawing type is ELEMENT. More... | |
| 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 | |
Public Member Functions inherited from RenderCommand | |
| void | init (float globalZOrder, const Mat4 &modelViewTransform, unsigned int flags) |
| Init function, will be called by all the render commands. More... | |
| 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. | |
| PipelineDescriptor & | getPipelineDescriptor () |
| Can use the result to change the descriptor content. | |
Public Attributes | |
| std::function< void()> | func |
| Callback function. | |
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 is not updated every frame, then use STATIC, other use DYNAMIC.
| using IndexFormat = backend::IndexFormat |
The index format determine the size for index data.
U_SHORT is enough for most cases.
| 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 | ( | 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 | ( | 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 | ( | 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 | ( | 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