6#include "CommandBuffer.h"
7#include "GLIndexBuffer.h"
9#include "GLVertexBuffer.h"
18 void begin()
override;
21 void begin_render_pass()
override;
22 void end_render_pass()
override;
24 void set_viewport(
const Viewport& viewport)
override;
26 void set_pipeline(std::shared_ptr<Pipeline> pipeline)
override;
28 void set_vertex_buffer(std::shared_ptr<VertexBuffer> vertex_buffer)
override;
29 void set_index_buffer(std::shared_ptr<IndexBuffer> index_buffer)
override;
30 void set_texture(std::shared_ptr<Texture> texture,
unsigned int slot)
override;
32 void clear(uint8_t flags)
override;
37 void draw(uint32_t vertex_count, uint32_t first_vertex)
override;
38 void draw_indexed(uint32_t index_count, uint32_t first_index)
override;
40 const auto& get_data()
const;
43 void add_command(GLOpcode opcode);
45 T* add_command(GLOpcode opcode);
47 std::vector<uint8_t> buffer;
50inline const auto& GLCommandBuffer::get_data()
const
56inline T* GLCommandBuffer::add_command(GLOpcode opcode)
58 auto offset = buffer.size();
59 buffer.push_back(
static_cast<uint8_t
>(opcode));
60 buffer.resize(offset +
sizeof(GLOpcode) +
sizeof(T));
61 return reinterpret_cast<T*
>(&buffer[offset +
sizeof(GLOpcode)]);
86 GLsizei width, height;
92 std::shared_ptr<Pipeline> pipeline;
97 std::shared_ptr<GLVertexBuffer> vertexBuffer;
102 std::shared_ptr<GLIndexBuffer> indexBuffer;
107 std::shared_ptr<GLTexture> texture;
133 uint32_t firstVertex;
134 uint32_t vertexCount;
命令缓冲区.
Definition: CommandBuffer.h:31
Definition: GLCommandBuffer.h:16
void set_clear_depth(float depth) override
设置清空深度缓冲区的默认值.
Definition: GLCommandBuffer.cpp:83
void set_clear_color(const Vector4 &color) override
设置清空颜色缓冲区的默认值.
Definition: GLCommandBuffer.cpp:77
void end() override
结束记录命令.
Definition: GLCommandBuffer.cpp:23
void set_clear_stencil(uint32_t value) override
设置清空模板缓冲区的默认值.
Definition: GLCommandBuffer.cpp:89
void clear(uint8_t flags) override
清空缓冲区.
Definition: GLCommandBuffer.cpp:71
void begin() override
开始记录命令.
Definition: GLCommandBuffer.cpp:18
Definition: GLCommandBuffer.h:112
Definition: GLCommandBuffer.h:132
Definition: GLCommandBuffer.h:138
Definition: GLCommandBuffer.h:117
Definition: GLCommandBuffer.h:122
Definition: GLCommandBuffer.h:127
Definition: GLCommandBuffer.h:101
Definition: GLCommandBuffer.h:91
Definition: GLCommandBuffer.h:106
Definition: GLCommandBuffer.h:96
Definition: GLCommandBuffer.h:84
视口.
Definition: Viewport.hpp:12