charcoal/OpenGLEngine/LitShadowedScene.h
elipzer 6a04c835cf Starting an attempt at shadow maps.
Creating this branch in order to spend more time on the 2D engine
stuff since I will probably be doing a 2D thing before I mess
around much with 3D and 3D lighting.
2018-10-07 21:05:25 -04:00

67 lines
1.5 KiB
C++

#pragma once
#include <vector>
#include "AutoPrerenderingScene.h"
#include "LitShadowedTypes.h"
#include "Camera.h"
#include "Batched.h"
#include "LitShadowedBatch.h"
#include "LitShadowedShaderProgram.h"
namespace charcoal
{
namespace builtin
{
namespace litshadowed
{
// A scene lit by the Phong Reflection Model (See https://en.wikipedia.org/wiki/Phong_reflection_model )
class Scene : public AutoPrerenderingScene, public Batched<Renderable, Batch>
{
public:
Scene(Application& application) : AutoPrerenderingScene(application) {}
virtual ~Scene() {}
void init() override;
void use() override;
void unuse() override;
void render() override;
protected:
void set_camera(const Camera* p_camera) { m_p_camera = p_camera; }
Light& add_light(
const Position& position,
const Light::Power& power,
const ColorRGB ambient,
const ColorRGB diffuse,
const ColorRGB specular,
const Light::Fade& fade
)
{
m_lights.emplace_back(position, power, ambient, diffuse, specular, fade);
return m_lights.back();
}
DirectionalLight& set_directional_light(
const Direction& direction,
const ColorRGB& color
)
{
m_directional_light = DirectionalLight(direction, color);
return m_directional_light;
}
private:
ShaderProgram m_shader_program;
const Camera* m_p_camera = nullptr;
std::vector<Light> m_lights;
// TODO: Should this be a vector of directional lights?
DirectionalLight m_directional_light;
};
}
}
}