Lit pipelines work!
Problem was that I didn't set the material (or the normals)
This commit is contained in:
parent
8ee0ab2edb
commit
fd4cd2a407
@ -36,7 +36,7 @@ namespace charcoal
|
||||
{
|
||||
glutil::uniform_matrix(0, get_camera()->get_world_to_view_matrix());
|
||||
glutil::uniform_vec3(4, get_camera()->get_position());
|
||||
glutil::uniform_uint(5, m_lights.size());
|
||||
glutil::uniform_uint(5, (unsigned int)m_lights.size());
|
||||
glutil::uniform_lights(6, m_lights);
|
||||
}
|
||||
private:
|
||||
|
@ -20,7 +20,7 @@ namespace charcoal
|
||||
namespace meshgenerator
|
||||
{
|
||||
template <typename VertexType, typename IndexType>
|
||||
Mesh<VertexType, IndexType>* set_material(Mesh<VertexType, IndexType>* mesh, const Material& material)
|
||||
Mesh<VertexType, IndexType>* set_material(Mesh<VertexType, IndexType>* mesh, const PhongMaterial& material)
|
||||
{
|
||||
for (unsigned int i = 0; i < mesh->vertex_count; ++i)
|
||||
{
|
||||
|
@ -11,10 +11,22 @@
|
||||
|
||||
MyBuiltinLitScene::MyBuiltinLitScene(Application& application)
|
||||
: Scene(application),
|
||||
m_shape(meshgenerator::gen_cube_p<lit::Vertex, lit::Index>(DRAW_TRIANGLES, 2.0f, 2.0f, 2.0f), DrawMode::DRAW_TRIANGLES),
|
||||
m_shape(
|
||||
meshgenerator::set_material<lit::Vertex, lit::Index>(
|
||||
meshgenerator::gen_cube_pn<lit::Vertex, lit::Index>(DRAW_TRIANGLES, 2.0f, 2.0f, 2.0f),
|
||||
PhongMaterial(1.0f, 1.0f, 0.2f, 1.0f)
|
||||
), DrawMode::DRAW_TRIANGLES
|
||||
),
|
||||
m_camera((float)TAU_1_4, (float)m_screen_size.x / m_screen_size.y, 1.0f, 10.0f, vec3(0.0f, 0.0f, 5.0f)),
|
||||
m_batch(&m_shape, 2),
|
||||
m_light(Position(0.0f, 5.0f, 0.0f), PhongLight::Power(0.1f, 100.0f, 1.0f), ColorRGB(1.0f, 1.0f, 1.0f), ColorRGB(1.0f, 1.0f, 1.0f), ColorRGB(1.0f, 1.0f, 1.0f), PhongLight::Fade(1.0f, 0.1f, 0.01f))
|
||||
m_light(
|
||||
Position(0.0f, 2.0f, 2.0f),
|
||||
PhongLight::Power(0.2f, 1.0f, 1.0f),
|
||||
ColorRGB(1.0f, 1.0f, 1.0f),
|
||||
ColorRGB(1.0f, 1.0f, 1.0f),
|
||||
ColorRGB(1.0f, 1.0f, 1.0f),
|
||||
PhongLight::Fade(1.0f, 0.1f, 0.01f)
|
||||
)
|
||||
{
|
||||
m_pipeline.add_batch(&m_batch);
|
||||
m_pipeline.set_camera(&m_camera);
|
||||
|
Loading…
Reference in New Issue
Block a user