fd4cd2a407
Problem was that I didn't set the material (or the normals)
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "GLUtil.h"
|
|
#include "BuiltinPipeline.h"
|
|
#include "WithCamera.h"
|
|
#include "LitShaderProgram.h"
|
|
#include "LitBatch.h"
|
|
|
|
namespace charcoal
|
|
{
|
|
namespace builtin
|
|
{
|
|
namespace lit
|
|
{
|
|
// TODO: May want to abstract this into a base pipeline class since this is the same as basic::Pipeline
|
|
class Pipeline : public builtin::Pipeline<ShaderProgram, Batch>, public WithCamera
|
|
{
|
|
public:
|
|
void reset_lights()
|
|
{
|
|
m_lights.clear();
|
|
}
|
|
|
|
void add_light(const Light& light)
|
|
{
|
|
m_lights.push_back(light);
|
|
}
|
|
protected:
|
|
void prepare_opengl() override
|
|
{
|
|
glEnable(GL_DEPTH_TEST);
|
|
glDepthFunc(GL_LESS);
|
|
}
|
|
|
|
void prepare_uniforms() override
|
|
{
|
|
glutil::uniform_matrix(0, get_camera()->get_world_to_view_matrix());
|
|
glutil::uniform_vec3(4, get_camera()->get_position());
|
|
glutil::uniform_uint(5, (unsigned int)m_lights.size());
|
|
glutil::uniform_lights(6, m_lights);
|
|
}
|
|
private:
|
|
std::vector<PhongLight> m_lights;
|
|
};
|
|
}
|
|
}
|
|
} |