13#ifdef GALAXY_WIN_PLATFORM
21 : m_quads {
Settings::max_quads(), 4,
galaxy::graphics::gen_default_indices()}
23 , m_pipeline {nullptr}
24 , m_uniform_data_index {0u}
55 glBindFramebuffer(GL_FRAMEBUFFER, pass.
target);
61 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
68 for (
const auto& feature : pipeline.
enabled)
73 for (
const auto& feature : pipeline.
disabled)
83 glUseProgram(pipeline.
shader);
84 glActiveTexture(GL_TEXTURE0);
94 m_uniform_data[m_uniform_data_index] = cmd.data;
97 for (
auto& vert : cmd.vertices)
99 vert.m_index = m_uniform_data_index;
103 m_uniform_data_index++;
108 m_quads.push(cmd.vertices);
112 m_commands.emplace_back(cmd);
132 glDrawElements(
static_cast<unsigned int>(cmd.type), cmd.vao->count(), GL_UNSIGNED_INT, cmd.vao->offset());
137#ifdef GALAXY_WIN_PLATFORM
#define GALAXY_DISABLE_WARNING_POP
#define GALAXY_DISABLE_WARNING(x)
#define GALAXY_DISABLE_WARNING_PUSH
Macro for windows platform detection.
Data & get_data() noexcept
Get camera view and proj.
ShaderBuffer m_camera_storage
Camera buffer.
unsigned int m_uniform_data_index
Uniform data current max index.
std::vector< RenderCmd > m_commands
RenderCmd storage.
std::vector< RenderData > m_uniform_data
Renderable uniform data storage.
void end_pass(Camera &camera)
Renders everything configured in this pass.
ShaderBuffer m_uniform_storage
Renderable uniforms buffer.
VertexBatch m_quads
Quad vertex batch.
void push_cmd(RenderCmd &cmd) noexcept
Push a renderable object.
void bind_pipeline(RenderPipeline &pipeline)
Binds the GPU state specified in pipeline.
RenderPass * m_pass
Currently active pass.
void begin_pass(RenderPass &pass)
Binds framebuffer, viewport, sissor region and clears buffers.
void prepare()
Called only in the update loop when we need to refresh data to render.
RenderPipeline * m_pipeline
Currently active pipeline.
void bind() const
Bind buffer.
void buffer(const unsigned int count, Object *data)
Buffer data.
void set_index(const GLBufferBinding index)
Set vertex shader binding point.
void bind() const noexcept
Bind this batchs vertex array object.
void flush() noexcept
Copy all data to GPU.
int count() const noexcept
Get the index count.
void prepare() noexcept
Sets up counters to begin pushing vertices.
void * offset() noexcept
Gets index offset.
@ UNIFORMS
Shader uniforms.
@ CAMERA
Camera transform data.
Data required to draw an object.
The configuration for drawing something.
unsigned int target
This is the framebuffer to draw to.
glm::ivec4 viewport
This is the glViewport. z,w is width/height.
glm::ivec4 scissor
OpenGL scissor region. https://gamedev.stackexchange.com/a/40713.
glm::vec4 clear_col
Colour buffer clear colour.
float clear_depth
Depth buffer clear depth.
unsigned int blend_equation
glBlendEquation.
unsigned int cull_face
glCullFace.
std::vector< unsigned int > enabled
glEnable features.
unsigned int blend_function
glBlendFunc for GL_SRC_ALPHA.
unsigned int depth_func
glDepthFunc.
std::vector< unsigned int > disabled
glDisable features.
unsigned int shader
Pipeline Ubershader.
Helper class to encapsulate our global settings we want to quickly access across app.
static auto max_quads() noexcept -> int
Max quads to render at once.