瀏覽代碼

scene: add Scene::pre_render and post_render

This allows actors to perform draw commands in TickDraw(), even
if it’s not exactly what we want in the future.
undefined
Sam Hocevar 8 年之前
父節點
當前提交
25ad63d33d
共有 3 個文件被更改,包括 26 次插入10 次删除
  1. +4
    -0
      src/engine/ticker.cpp
  2. +20
    -10
      src/scene.cpp
  3. +2
    -0
      src/scene.h

+ 4
- 0
src/engine/ticker.cpp 查看文件

@@ -432,6 +432,8 @@ void TickerData::DrawThreadTick()
scene.EnableDisplay();
Renderer::Get(idx)->Clear(ClearMask::All);

scene.pre_render(data->deltatime);

/* Tick objects for the draw loop */
for (int g = Entity::DRAWGROUP_BEGIN; g < Entity::DRAWGROUP_END && !data->quit /* Stop as soon as required */; ++g)
{
@@ -470,6 +472,8 @@ void TickerData::DrawThreadTick()
/* Do the render step */
scene.render(data->deltatime);

scene.post_render(data->deltatime);

/* Disable display */
scene.DisableDisplay();
}


+ 20
- 10
src/scene.cpp 查看文件

@@ -622,12 +622,11 @@ void Scene::DisableDisplay()
data->m_display->Disable();
}

/* Render everything that the scene contains */
void Scene::render(float seconds)
{
bool do_pp = true;
static bool do_pp = true;

gpu_marker("Start Render");
void Scene::pre_render(float seconds)
{
gpu_marker("Pre Render");

/* First render into the offline buffer */
if (do_pp)
@@ -644,12 +643,23 @@ void Scene::render(float seconds)
}

Renderer::Get()->Clear(ClearMask::Color | ClearMask::Depth);

// FIXME: get rid of the delta time argument
render_primitives();
render_tiles();
render_lines(seconds);
}
}

/* Render everything that the scene contains */
void Scene::render(float seconds)
{
gpu_marker("Render");

// FIXME: get rid of the delta time argument
render_primitives();
render_tiles();
render_lines(seconds);
}

void Scene::post_render(float seconds)
{
gpu_marker("Post Render");

if (do_pp)
{


+ 2
- 0
src/scene.h 查看文件

@@ -251,7 +251,9 @@ public:
void EnableDisplay();
void DisableDisplay();

void pre_render(float seconds);
void render(float seconds);
void post_render(float seconds);

private:
void render_primitives();


Loading…
取消
儲存