e3c85324c6
Also moved all the code for each pipeline into the header files rather than the .cpp files to keep it all in one place. Considering just moving all the code into one file just to make it easier to create new pipelines but that may be overkill and may make the project harder to maintain in the future.
30 lines
723 B
C++
30 lines
723 B
C++
#pragma once
|
|
|
|
#include <charcoal/Pipeline.h>
|
|
|
|
namespace charcoal
|
|
{
|
|
namespace builtin
|
|
{
|
|
template <typename ShaderProgramType, typename BatchType>
|
|
class Pipeline : public charcoal::Pipeline<ShaderProgramType, BatchType>
|
|
{
|
|
public:
|
|
void render() override
|
|
{
|
|
prepare_opengl();
|
|
charcoal::Pipeline<ShaderProgramType, BatchType>::m_shader_program.use();
|
|
prepare_uniforms();
|
|
for (auto iter = charcoal::Pipeline<ShaderProgramType, BatchType>::m_batches.begin(); iter != charcoal::Pipeline<ShaderProgramType, BatchType>::m_batches.end(); ++iter)
|
|
{
|
|
BatchType* batch = *iter;
|
|
batch->render();
|
|
}
|
|
}
|
|
|
|
virtual void prepare_opengl() {};
|
|
|
|
virtual void prepare_uniforms() {};
|
|
};
|
|
}
|
|
} |