45 lines
749 B
C++
45 lines
749 B
C++
#include "BasicScene.h"
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "GLUtil.h"
|
|
#include "MeshFactory.h"
|
|
|
|
namespace charcoal
|
|
{
|
|
namespace builtin
|
|
{
|
|
void BasicScene::init()
|
|
{
|
|
for (auto iter = m_batches.begin(); iter != m_batches.end(); ++iter)
|
|
{
|
|
BasicBatch& batch = *iter;
|
|
batch.init();
|
|
add_prerenderable(&batch);
|
|
}
|
|
}
|
|
|
|
void BasicScene::use()
|
|
{
|
|
// TODO: move to glutil
|
|
glEnable(GL_DEPTH_TEST);
|
|
glDepthFunc(GL_LESS);
|
|
}
|
|
|
|
void BasicScene::unuse()
|
|
{
|
|
|
|
}
|
|
|
|
void BasicScene::render()
|
|
{
|
|
glutil::clear_screen();
|
|
m_shader_program.use();
|
|
glutil::uniform_matrix(0, m_p_camera->get_world_to_view_matrix());
|
|
for (auto iter = m_batches.begin(); iter != m_batches.end(); ++iter)
|
|
{
|
|
iter->render();
|
|
}
|
|
}
|
|
}
|
|
} |