charcoal/OpenGLEngine/TexturedScene.cpp

46 lines
836 B
C++
Raw Normal View History

#include "TexturedScene.h"
#include "stdafx.h"
#include "GLUtil.h"
#include "MeshFactory.h"
namespace charcoal
{
namespace builtin
{
void TexturedScene::init()
{
for (auto iter = m_batches.begin(); iter != m_batches.end(); ++iter)
{
TexturedBatch& batch = *iter;
batch.init();
add_prerenderable(&batch);
}
}
void TexturedScene::use()
{
// TODO: move to glutil
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
}
void TexturedScene::unuse()
{
}
void TexturedScene::render()
{
glutil::clear_screen();
m_shader_program.use();
glutil::uniform_matrix(0, m_p_camera->get_world_to_view_matrix());
2018-09-16 00:43:29 +00:00
glutil::uniform_int(4, 0); // The textured batch uses GL_TEXTURE0
for (auto iter = m_batches.begin(); iter != m_batches.end(); ++iter)
{
iter->render();
}
}
}
}