Переглянути джерело

Scene stuff is back to non-static logic with a few tricks

Scene rendering logic is now better
undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 9 роки тому
джерело
коміт
a7d6e0190e
14 змінених файлів з 201 додано та 258 видалено
  1. +10
    -6
      doc/samples/btphystest.cpp
  2. +8
    -4
      doc/samples/meshviewer/meshviewer.cpp
  3. +4
    -2
      doc/tutorial/05_easymesh.cpp
  4. +4
    -2
      doc/tutorial/06_sprite.cpp
  5. +62
    -51
      src/debug/lines.cpp
  6. +4
    -3
      src/easymesh/easymeshrender.cpp
  7. +2
    -2
      src/gradient.cpp
  8. +1
    -1
      src/light.cpp
  9. +6
    -6
      src/mesh/primitive.cpp
  10. +1
    -1
      src/mesh/primitive.h
  11. +1
    -1
      src/platform/nacl/nacl-instance.cpp
  12. +46
    -127
      src/scene.cpp
  13. +27
    -35
      src/scene.h
  14. +25
    -17
      src/ticker.cpp

+ 10
- 6
doc/samples/btphystest.cpp Переглянути файл

@@ -99,7 +99,8 @@ void BtPhysTest::InitApp()
vec3(0, 1, 0));
m_camera->SetProjection(45.f, .1f, 1000.f, (float)Video::GetSize().x, (float)Video::GetSize().y / (float)Video::GetSize().x);
#endif
Scene::PushCamera(m_camera);
Scene& scene = Scene::GetScene();
scene.PushCamera(m_camera);

m_ready = false;

@@ -332,8 +333,9 @@ void BtPhysTest::TickGame(float seconds)
vec3 cam_center(0.f);
float cam_factor = .0f;
vec2 screen_min_max[2] = { vec2(FLT_MAX), vec2(-FLT_MAX) };
mat4 world_cam = Scene::GetCamera()->GetView();
mat4 cam_screen = Scene::GetCamera()->GetProjection();
Scene& scene = Scene::GetScene();
mat4 world_cam = scene.GetCamera()->GetView();
mat4 cam_screen = scene.GetCamera()->GetProjection();

m_target_timer -= seconds;
if (m_target_timer < .0f)
@@ -619,7 +621,8 @@ void BtPhysTest::TickDraw(float seconds, Scene &scene)

BtPhysTest::~BtPhysTest()
{
Scene::PopCamera(m_camera);
Scene& scene = Scene::GetScene();
scene.PopCamera(m_camera);
Ticker::Unref(m_light1);
Ticker::Unref(m_light2);

@@ -700,8 +703,9 @@ void CatShaderData::SetupDefaultData()
//-----------------------------------------------------------------------------
void CatShaderData::SetupShaderDatas(mat4 const &model)
{
mat4 proj = Scene::GetCamera()->GetProjection();
mat4 view = Scene::GetCamera()->GetView();
Scene& scene = Scene::GetScene();
mat4 proj = scene.GetCamera()->GetProjection();
mat4 view = scene.GetCamera()->GetView();

mat4 modelview = view * model;
mat3 normalmat = transpose(inverse(mat3(view)));


+ 8
- 4
doc/samples/meshviewer/meshviewer.cpp Переглянути файл

@@ -173,7 +173,8 @@ void MeshViewer::Start()
m_camera->SetProjection(40.f, .0001f, 2000.f);
//m_camera->SetProjection(90.f, .0001f, 2000.f, WIDTH * SCREEN_W, RATIO_HW);
//m_camera->UseShift(true);
Scene::PushCamera(m_camera);
Scene& scene = Scene::GetScene();
scene.PushCamera(m_camera);

#if HAS_INPUT
InputProfile& ip = m_profile;
@@ -199,7 +200,8 @@ void MeshViewer::Stop()
UpdateSceneSetup(true);

//Destroy core stuff
if (m_camera) Scene::PopCamera(m_camera);
Scene& scene = Scene::GetScene();
if (m_camera) scene.PopCamera(m_camera);

m_file_check->UnregisterFile(m_file_status);

@@ -505,7 +507,8 @@ void MeshViewer::Prepare()
m_camera->SetView(vec3(0.f, 0.f, 10.f), vec3::zero, vec3::axis_y);
m_camera->SetProjection(0.f, .0001f, 2000.f, WIDTH * SCREEN_W, RATIO_HW);
m_camera->UseShift(true);
Scene::PushCamera(m_camera);
Scene& scene = Scene::GetScene();
scene.PushCamera(m_camera);

//Lights setup
m_ssetup = new SceneSetup();
@@ -544,7 +547,8 @@ void MeshViewer::Prepare()

void MeshViewer::Unprepare()
{
if (m_camera) Scene::PopCamera(m_camera);
Scene& scene = Scene::GetScene();
if (m_camera) scene.PopCamera(m_camera);
if (m_ssetup) delete m_ssetup;

MessageService::Destroy();


+ 4
- 2
doc/tutorial/05_easymesh.cpp Переглянути файл

@@ -62,7 +62,8 @@ public:
m_camera->SetView(mat4::lookat(vec3(-15.f, 5.f, 0.f),
vec3(0.f, -1.f, 0.f),
vec3(0.f, 1.f, 0.f)));
Scene::PushCamera(m_camera);
Scene& scene = Scene::GetScene();
scene.PushCamera(m_camera);

/* Add a white directional light */
m_light1 = new Light();
@@ -83,7 +84,8 @@ public:

~EasyMeshTutorial()
{
Scene::PopCamera(m_camera);
Scene& scene = Scene::GetScene();
scene.PopCamera(m_camera);
Ticker::Unref(m_light1);
Ticker::Unref(m_light2);
}


+ 4
- 2
doc/tutorial/06_sprite.cpp Переглянути файл

@@ -25,7 +25,8 @@ public:
m_camera = new Camera();
m_camera->SetView(mat4(1.f));
m_camera->SetProjection(mat4::ortho(0.f, 640.f, 0.f, 480.f, -100.f, 100.f));
Scene::PushCamera(m_camera);
Scene& scene = Scene::GetScene();
scene.PushCamera(m_camera);
Ticker::Ref(m_camera);

m_tileset = Tiler::Register("06_sprite.png");
@@ -45,7 +46,8 @@ public:
{
Tiler::Deregister(m_tileset);

Scene::PopCamera(m_camera);
Scene& scene = Scene::GetScene();
scene.PopCamera(m_camera);
Ticker::Unref(m_camera);
}



+ 62
- 51
src/debug/lines.cpp Переглянути файл

@@ -16,31 +16,36 @@ namespace lol
//Resets draw infos
void Debug::DrawSetupReset()
{
Scene::SetLineTime();
Scene::SetLineMask();
Scene& scene = Scene::GetScene();
scene.SetLineTime();
scene.SetLineMask();
}
//Sets draw infos
void Debug::DrawSetupTime(float new_time)
{
Scene::SetLineTime(new_time);
Scene& scene = Scene::GetScene();
scene.SetLineTime(new_time);
}

//--
void Debug::DrawSetupMask(int new_mask)
{
Scene::SetLineMask(new_mask);
Scene& scene = Scene::GetScene();
scene.SetLineMask(new_mask);
}

//--
void Debug::DrawSetupSegment(float new_segment_size)
{
Scene::SetLineSegmentSize(new_segment_size);
Scene& scene = Scene::GetScene();
scene.SetLineSegmentSize(new_segment_size);
}

//--
void Debug::DrawSetupColor(vec4 color)
{
Scene::SetLineColor(color);
Scene& scene = Scene::GetScene();
scene.SetLineColor(color);
}

//--
@@ -63,9 +68,10 @@ vec3 Debug::WorldToScreen(vec3 pos, mat4 view_proj)
}
vec3 Debug::WorldToScreen(vec4 pos)
{
if (!Scene::GetCamera())
Scene& scene = Scene::GetScene();
if (!scene.GetCamera())
return vec3::zero;
mat4 const view_proj = Scene::GetCamera()->GetProjection() * Scene::GetCamera()->GetView();
mat4 const view_proj = scene.GetCamera()->GetProjection() * scene.GetCamera()->GetView();
return Debug::WorldToScreen(pos, view_proj);
}
vec3 Debug::WorldToScreen(vec4 pos, mat4 view_proj)
@@ -79,9 +85,10 @@ vec3 Debug::ScreenToWorld(vec2 pos, float z)
{ return Debug::ScreenToWorld(vec3(pos, z)); }
vec3 Debug::ScreenToWorld(vec3 pos)
{
if (!Scene::GetCamera())
Scene& scene = Scene::GetScene();
if (!scene.GetCamera())
return vec3::zero;
mat4 const inv_view_proj = inverse(Scene::GetCamera()->GetProjection() * Scene::GetCamera()->GetView());
mat4 const inv_view_proj = inverse(scene.GetCamera()->GetProjection() * scene.GetCamera()->GetView());
return Debug::ScreenToWorld(pos, inv_view_proj);
}
vec3 Debug::ScreenToWorld(vec2 pos, mat4 inv_view_proj, float z)
@@ -100,12 +107,12 @@ vec3 Debug::ScreenToWorld(vec3 pos, mat4 view, mat4 proj)
//Draw stuff in World
//-- LINE: 3D -2D - 3D_to_2D --------------------------------------------------

void Debug::DrawLine(vec3 a, vec3 b) { Debug::DrawLine(a, b, Scene::GetLineColor()); }
void Debug::DrawLine(vec2 a, vec3 b, float az) { Debug::DrawLine(a, b, Scene::GetLineColor(), az); }
void Debug::DrawLine(vec2 a, vec2 b, float az, float bz) { Debug::DrawLine(a, b, Scene::GetLineColor(), az, bz); }
void Debug::DrawLine(vec3 a, vec3 b, vec4 color) { Scene::AddLine(a, b, color); }
void Debug::DrawLine(vec2 a, vec3 b, vec4 color, float az) { Scene::AddLine(vec3(a, az), b, color); }
void Debug::DrawLine(vec2 a, vec2 b, vec4 color, float az, float bz){ Scene::AddLine(vec3(a, az), vec3(b, bz), color); }
void Debug::DrawLine(vec3 a, vec3 b) { Scene& scene = Scene::GetScene(); Debug::DrawLine(a, b, scene.GetLineColor()); }
void Debug::DrawLine(vec2 a, vec3 b, float az) { Scene& scene = Scene::GetScene(); Debug::DrawLine(a, b, scene.GetLineColor(), az); }
void Debug::DrawLine(vec2 a, vec2 b, float az, float bz) { Scene& scene = Scene::GetScene(); Debug::DrawLine(a, b, scene.GetLineColor(), az, bz); }
void Debug::DrawLine(vec3 a, vec3 b, vec4 color) { Scene& scene = Scene::GetScene(); scene.AddLine(a, b, color); }
void Debug::DrawLine(vec2 a, vec3 b, vec4 color, float az) { Scene& scene = Scene::GetScene(); scene.AddLine(vec3(a, az), b, color); }
void Debug::DrawLine(vec2 a, vec2 b, vec4 color, float az, float bz){ Scene& scene = Scene::GetScene(); scene.AddLine(vec3(a, az), vec3(b, bz), color); }

//-- GIZMO --------------------------------------------------------------------
void Debug::DrawGizmo(vec3 pos, vec3 x, vec3 y, vec3 z, float size)
@@ -124,7 +131,8 @@ void Debug::DrawGizmo(vec2 pos, vec3 x, vec3 y, vec3 z, float size, float posz)
//-- GRID ---------------------------------------------------------------------
void Debug::DrawGrid(vec3 pos, vec3 x, vec3 y, vec3 z, float size, bool draw_3d)
{
float seg_sz = Scene::GetLineSegmentSize();
Scene& scene = Scene::GetScene();
float seg_sz = scene.GetLineSegmentSize();
int seg_nb = lol::max((int)(size / seg_sz), 1);
seg_sz = size / (float)seg_nb;

@@ -160,9 +168,9 @@ void Debug::DrawGrid(vec3 pos, vec3 x, vec3 y, vec3 z, float size, bool draw_3d)
void Debug::DrawArrow(vec3 a, vec3 b, vec2 s) { Debug::DrawArrow(a, b, vec3(s.x, s.y, s.y)); }
void Debug::DrawArrow(vec2 a, vec3 b, vec2 s, float az) { Debug::DrawArrow(a, b.xy, vec3(s.x, s.y, s.y), az, b.z); }
void Debug::DrawArrow(vec2 a, vec2 b, vec2 s, float az, float bz) { Debug::DrawArrow(a, b, vec3(s.x, s.y, s.y), az, bz); }
void Debug::DrawArrow(vec3 a, vec3 b, vec3 s) { Debug::DrawArrow(a, b, vec3(s.x, s.y, s.y), Scene::GetLineColor()); }
void Debug::DrawArrow(vec2 a, vec3 b, vec3 s, float az) { Debug::DrawArrow(a, b.xy, vec3(s.x, s.y, s.y), Scene::GetLineColor(), az, b.z); }
void Debug::DrawArrow(vec2 a, vec2 b, vec3 s, float az, float bz) { Debug::DrawArrow(a, b, vec3(s.x, s.y, s.y), Scene::GetLineColor(), az, bz); }
void Debug::DrawArrow(vec3 a, vec3 b, vec3 s) { Scene& scene = Scene::GetScene(); Debug::DrawArrow(a, b, vec3(s.x, s.y, s.y), scene.GetLineColor()); }
void Debug::DrawArrow(vec2 a, vec3 b, vec3 s, float az) { Scene& scene = Scene::GetScene(); Debug::DrawArrow(a, b.xy, vec3(s.x, s.y, s.y), scene.GetLineColor(), az, b.z); }
void Debug::DrawArrow(vec2 a, vec2 b, vec3 s, float az, float bz) { Scene& scene = Scene::GetScene(); Debug::DrawArrow(a, b, vec3(s.x, s.y, s.y), scene.GetLineColor(), az, bz); }
void Debug::DrawArrow(vec3 a, vec3 b, vec3 s, vec4 color)
{
vec3 z = s.x * normalize(b - a);
@@ -212,23 +220,23 @@ void Debug::DrawArrow(vec2 a, vec2 b, vec3 s, vec4 color, float az, float bz)
}

//-- BOX: 3D -2D - 3D_to_2D ---------------------------------------------------
void Debug::DrawBox(box3 a) { Debug::DrawBox(a.aa, a.bb, Scene::GetLineColor()); }
void Debug::DrawBox(box2 a) { Debug::DrawBox(a.aa, a.bb, Scene::GetLineColor()); }
void Debug::DrawBox(box3 a, vec4 color) { Debug::DrawBox(a.aa, a.bb, color); }
void Debug::DrawBox(box2 a, vec4 color) { Debug::DrawBox(a.aa, a.bb, color); }
void Debug::DrawBox(vec3 a, vec3 b) { Debug::DrawBox(a, b, Scene::GetLineColor()); }
void Debug::DrawBox(vec2 a, vec2 b) { Debug::DrawBox(a, b, Scene::GetLineColor()); }
void Debug::DrawBox(vec2 a, float s) { Debug::DrawBox(a, s, Scene::GetLineColor()); }
void Debug::DrawBox(vec3 a, vec3 b, vec4 color) { Debug::DrawBox(a, b, mat4::identity, color); }
void Debug::DrawBox(vec2 a, vec2 b, vec4 color) { Debug::DrawBox(a, b, mat2::identity, color); }
void Debug::DrawBox(vec2 a, float s, vec4 color) { Debug::DrawBox(a, s, mat2::identity, color); }
void Debug::DrawBox(box3 a, mat4 transform) { Debug::DrawBox(a.aa, a.bb, transform, Scene::GetLineColor()); }
void Debug::DrawBox(box2 a, mat2 transform) { Debug::DrawBox(a.aa, a.bb, transform, Scene::GetLineColor()); }
void Debug::DrawBox(box3 a, mat4 transform, vec4 color) { Debug::DrawBox(a.aa, a.bb, transform, color); }
void Debug::DrawBox(box2 a, mat2 transform, vec4 color) { Debug::DrawBox(a.aa, a.bb, transform, color); }
void Debug::DrawBox(vec3 a, vec3 b, mat4 transform) { Debug::DrawBox(a, b, transform, Scene::GetLineColor()); }
void Debug::DrawBox(vec2 a, vec2 b, mat2 transform) { Debug::DrawBox(a, b, transform, Scene::GetLineColor()); }
void Debug::DrawBox(vec2 a, float s, mat2 transform) { Debug::DrawBox(a, s, transform, Scene::GetLineColor()); }
void Debug::DrawBox(box3 a) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a.aa, a.bb, scene.GetLineColor()); }
void Debug::DrawBox(box2 a) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a.aa, a.bb, scene.GetLineColor()); }
void Debug::DrawBox(box3 a, vec4 color) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a.aa, a.bb, color); }
void Debug::DrawBox(box2 a, vec4 color) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a.aa, a.bb, color); }
void Debug::DrawBox(vec3 a, vec3 b) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a, b, scene.GetLineColor()); }
void Debug::DrawBox(vec2 a, vec2 b) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a, b, scene.GetLineColor()); }
void Debug::DrawBox(vec2 a, float s) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a, s, scene.GetLineColor()); }
void Debug::DrawBox(vec3 a, vec3 b, vec4 color) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a, b, mat4::identity, color); }
void Debug::DrawBox(vec2 a, vec2 b, vec4 color) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a, b, mat2::identity, color); }
void Debug::DrawBox(vec2 a, float s, vec4 color) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a, s, mat2::identity, color); }
void Debug::DrawBox(box3 a, mat4 transform) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a.aa, a.bb, transform, scene.GetLineColor()); }
void Debug::DrawBox(box2 a, mat2 transform) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a.aa, a.bb, transform, scene.GetLineColor()); }
void Debug::DrawBox(box3 a, mat4 transform, vec4 color) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a.aa, a.bb, transform, color); }
void Debug::DrawBox(box2 a, mat2 transform, vec4 color) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a.aa, a.bb, transform, color); }
void Debug::DrawBox(vec3 a, vec3 b, mat4 transform) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a, b, transform, scene.GetLineColor()); }
void Debug::DrawBox(vec2 a, vec2 b, mat2 transform) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a, b, transform, scene.GetLineColor()); }
void Debug::DrawBox(vec2 a, float s, mat2 transform) { Scene& scene = Scene::GetScene(); Debug::DrawBox(a, s, transform, scene.GetLineColor()); }
void Debug::DrawBox(vec3 a, vec3 b, mat4 transform, vec4 color)
{
vec4 v[8];
@@ -270,11 +278,11 @@ void Debug::DrawBox(vec2 a, float s, mat2 transform, vec4 color)
}

//-- CIRCLE -------------------------------------------------------------------
void Debug::DrawCircle(vec2 a, float s) { Debug::DrawCircle(a, s * vec2(1.f, g_renderer->GetXYRatio()), Scene::GetLineColor()); }
void Debug::DrawCircle(vec3 a, vec3 n) { Debug::DrawCircle(a, n, Scene::GetLineColor()); }
void Debug::DrawCircle(vec2 a, vec2 s) { Debug::DrawCircle(a, s * vec2(1.f, g_renderer->GetXYRatio()), Scene::GetLineColor()); }
void Debug::DrawCircle(vec3 a, vec3 x, vec3 y) { Debug::DrawCircle(a, x, y, Scene::GetLineColor()); }
void Debug::DrawCircle(vec2 a, vec2 x, vec2 y) { Debug::DrawCircle(a, x, y, Scene::GetLineColor()); }
void Debug::DrawCircle(vec2 a, float s) { Scene& scene = Scene::GetScene(); Debug::DrawCircle(a, s * vec2(1.f, g_renderer->GetXYRatio()), scene.GetLineColor()); }
void Debug::DrawCircle(vec3 a, vec3 n) { Scene& scene = Scene::GetScene(); Debug::DrawCircle(a, n, scene.GetLineColor()); }
void Debug::DrawCircle(vec2 a, vec2 s) { Scene& scene = Scene::GetScene(); Debug::DrawCircle(a, s * vec2(1.f, g_renderer->GetXYRatio()), scene.GetLineColor()); }
void Debug::DrawCircle(vec3 a, vec3 x, vec3 y) { Scene& scene = Scene::GetScene(); Debug::DrawCircle(a, x, y, scene.GetLineColor()); }
void Debug::DrawCircle(vec2 a, vec2 x, vec2 y) { Scene& scene = Scene::GetScene(); Debug::DrawCircle(a, x, y, scene.GetLineColor()); }
void Debug::DrawCircle(vec3 a, vec3 n, vec4 color)
{
vec3 x = orthogonal(n);
@@ -290,8 +298,9 @@ void Debug::DrawCircle(vec2 a, vec2 s, vec4 color)
//--
void Debug::DrawCircle(vec3 a, vec3 x, vec3 y, vec4 color)
{
Scene& scene = Scene::GetScene();
float size = F_PI * 2.f * lol::max(length(x), length(y));
int segment_nb = lol::max(1, (int)((size * .25f) / Scene::GetLineSegmentSize()));
int segment_nb = lol::max(1, (int)((size * .25f) / scene.GetLineSegmentSize()));
for (int i = 0; i < segment_nb; i++)
{
float a0 = (((float)i) / (float)segment_nb) * F_PI_2;
@@ -308,8 +317,9 @@ void Debug::DrawCircle(vec3 a, vec3 x, vec3 y, vec4 color)
//--
void Debug::DrawCircle(vec2 a, vec2 x, vec2 y, vec4 color)
{
Scene& scene = Scene::GetScene();
float size = F_PI * 2.f * lol::max(length(x), length(y));
int segment_nb = lol::max(1, (int)((size * .25f) / Scene::GetLineSegmentSize()));
int segment_nb = lol::max(1, (int)((size * .25f) / scene.GetLineSegmentSize()));
for (int i = 0; i < segment_nb; i++)
{
float a0 = (((float)i) / (float)segment_nb) * F_PI_2;
@@ -325,9 +335,9 @@ void Debug::DrawCircle(vec2 a, vec2 x, vec2 y, vec4 color)
}

//-- SPHERE -------------------------------------------------------------------
void Debug::DrawSphere(vec3 a, float s) { Debug::DrawSphere(a, s, Scene::GetLineColor()); }
void Debug::DrawSphere(vec3 a, float s) { Scene& scene = Scene::GetScene(); Debug::DrawSphere(a, s, scene.GetLineColor()); }
void Debug::DrawSphere(vec3 a, float s, vec4 color) { Debug::DrawSphere(a, vec3::axis_x * s, vec3::axis_y * s, vec3::axis_z * s, color); }
void Debug::DrawSphere(vec3 a, vec3 x, vec3 y, vec3 z) { Debug::DrawSphere(a, x, y, z, Scene::GetLineColor()); }
void Debug::DrawSphere(vec3 a, vec3 x, vec3 y, vec3 z) { Scene& scene = Scene::GetScene(); Debug::DrawSphere(a, x, y, z, scene.GetLineColor()); }
void Debug::DrawSphere(vec3 a, vec3 x, vec3 y, vec3 z, vec4 color)
{
Debug::DrawCircle(a, x, y, color);
@@ -342,8 +352,8 @@ void Debug::DrawSphere(vec3 a, vec3 x, vec3 y, vec3 z, vec4 color)
}

//-- CAPSULE ------------------------------------------------------------------
void Debug::DrawCapsule(vec3 a, float s, vec3 h) { Debug::DrawCapsule(a, s, h, Scene::GetLineColor()); }
void Debug::DrawCapsule(vec3 a, vec3 x, vec3 y, vec3 z, vec3 h) { Debug::DrawCapsule(a, x, y, z, h, Scene::GetLineColor()); }
void Debug::DrawCapsule(vec3 a, float s, vec3 h) { Scene& scene = Scene::GetScene(); Debug::DrawCapsule(a, s, h, scene.GetLineColor()); }
void Debug::DrawCapsule(vec3 a, vec3 x, vec3 y, vec3 z, vec3 h) { Scene& scene = Scene::GetScene(); Debug::DrawCapsule(a, x, y, z, h, scene.GetLineColor()); }
void Debug::DrawCapsule(vec3 a, float s, vec3 h, vec4 color)
{
vec3 x = orthonormal(h) * s;
@@ -353,8 +363,9 @@ void Debug::DrawCapsule(vec3 a, float s, vec3 h, vec4 color)
//--
void Debug::DrawCapsule(vec3 a, vec3 x, vec3 y, vec3 z, vec3 h, vec4 color)
{
Scene& scene = Scene::GetScene();
float size = F_PI * 2.f * lol::max(length(x), length(y));
int segment_nb = lol::max(1, (int)((size * .25f) / Scene::GetLineSegmentSize()));
int segment_nb = lol::max(1, (int)((size * .25f) / scene.GetLineSegmentSize()));
for (int i = -1; i < 2; i += 2)
{
vec3 b = a + h * .5f * (float)i;
@@ -378,8 +389,8 @@ void Debug::DrawCapsule(vec3 a, vec3 x, vec3 y, vec3 z, vec3 h, vec4 color)
}

//-- VIEW PROJ ----------------------------------------------------------------
void Debug::DrawViewProj(mat4 view, mat4 proj) { Debug::DrawViewProj(view, proj, Scene::GetLineColor()); }
void Debug::DrawViewProj(mat4 view_proj) { Debug::DrawViewProj(view_proj, Scene::GetLineColor()); }
void Debug::DrawViewProj(mat4 view, mat4 proj) { Scene& scene = Scene::GetScene(); Debug::DrawViewProj(view, proj, scene.GetLineColor()); }
void Debug::DrawViewProj(mat4 view_proj) { Scene& scene = Scene::GetScene(); Debug::DrawViewProj(view_proj, scene.GetLineColor()); }
void Debug::DrawViewProj(mat4 view, mat4 proj, vec4 color)
{
mat4 const view_proj = proj * view;


+ 4
- 3
src/easymesh/easymeshrender.cpp Переглянути файл

@@ -184,12 +184,13 @@ void DefaultShaderData::SetupDefaultData(bool with_UV)
//-----------------------------------------------------------------------------
void DefaultShaderData::SetupShaderDatas(mat4 const &model)
{
mat4 proj = Scene::GetCamera()->GetProjection();
mat4 view = Scene::GetCamera()->GetView();
Scene& scene = Scene::GetScene();
mat4 proj = scene.GetCamera()->GetProjection();
mat4 view = scene.GetCamera()->GetView();
mat4 modelview = view * model;
mat3 normalmat = transpose(inverse(mat3(modelview)));
/* FIXME: this should be hidden in the shader */
array<Light *> const &lights = Scene::GetLights();
array<Light *> const &lights = scene.GetLights();
array<vec4> light_data;
//This is not very nice, but necessary for emscripten WebGL generation.
float f = 0.f;


+ 2
- 2
src/gradient.cpp Переглянути файл

@@ -88,10 +88,10 @@ void Gradient::TickDraw(float seconds, Scene &scene)
data->shader->Bind();

uni_mat = data->shader->GetUniformLocation("u_projection");
data->shader->SetUniform(uni_mat, Scene::GetCamera()->GetProjection());
uni_mat = data->shader->GetUniformLocation("u_view");
data->shader->SetUniform(uni_mat, Scene::GetCamera()->GetView());
uni_mat = data->shader->GetUniformLocation("u_model");
data->shader->SetUniform(uni_mat, scene.GetCamera()->GetProjection());
data->shader->SetUniform(uni_mat, scene.GetCamera()->GetView());
data->shader->SetUniform(uni_mat, model_matrix);

data->shader->Bind();


+ 1
- 1
src/light.cpp Переглянути файл

@@ -69,7 +69,7 @@ void Light::TickDraw(float seconds, Scene &scene)
{
WorldEntity::TickDraw(seconds, scene);

Scene::AddLight(this);
scene.AddLight(this);
}

} /* namespace lol */


+ 6
- 6
src/mesh/primitive.cpp Переглянути файл

@@ -30,7 +30,7 @@ PrimitiveMesh::~PrimitiveMesh()
{
}

void PrimitiveMesh::Render() const
void PrimitiveMesh::Render(Scene& scene)
{
/* TODO: this should be the main entry for rendering of all
* primitives found in the scene graph. When we have one. */
@@ -53,11 +53,11 @@ void PrimitiveMesh::Render() const
/* Per-scene matrices */
ShaderUniform u_mat;
u_mat = shader->GetUniformLocation("u_projection");
shader->SetUniform(u_mat, Scene::GetCamera()->GetProjection());
u_mat = shader->GetUniformLocation("u_view");
shader->SetUniform(u_mat, Scene::GetCamera()->GetView());
u_mat = shader->GetUniformLocation("u_inv_view");
shader->SetUniform(u_mat, inverse(Scene::GetCamera()->GetView()));
shader->SetUniform(u_mat, scene.GetCamera()->GetProjection());
shader->SetUniform(u_mat, scene.GetCamera()->GetView());
shader->SetUniform(u_mat, inverse(scene.GetCamera()->GetView()));

/* Per-object matrices, will be set later */
u_model = shader->GetUniformLocation("u_model");
@@ -65,7 +65,7 @@ void PrimitiveMesh::Render() const
u_normalmat = shader->GetUniformLocation("u_normalmat");

/* Per-scene environment */
array<Light *> const &lights = Scene::GetLights();
array<Light *> const &lights = scene.GetLights();
array<vec4> light_data;

/* FIXME: the 4th component of the position can be used for other things */
@@ -80,7 +80,7 @@ void PrimitiveMesh::Render() const
}

shader->SetUniform(u_model, m_matrix);
mat4 modelview = Scene::GetCamera()->GetView() * m_matrix;
mat4 modelview = scene.GetCamera()->GetView() * m_matrix;
shader->SetUniform(u_modelview, modelview);
shader->SetUniform(u_normalmat, transpose(inverse(mat3(modelview))));



+ 1
- 1
src/mesh/primitive.h Переглянути файл

@@ -25,7 +25,7 @@ class PrimitiveMesh : public Primitive
public:
PrimitiveMesh(SubMesh *submesh, mat4 const &matrix);
virtual ~PrimitiveMesh();
virtual void Render() const;
virtual void Render(Scene& scene);

private:
SubMesh *m_submesh;


+ 1
- 1
src/platform/nacl/nacl-instance.cpp Переглянути файл

@@ -253,7 +253,7 @@ void NaClInputData::Tick(float seconds)
//----
void NaClInputData::InitViewportSize()
{
if (g_scenes.count())
if (Scene::GetCount())
{
m_app = vec2(Video::GetSize());
//Dunno if its the good idea.


+ 46
- 127
src/scene.cpp Переглянути файл

@@ -110,7 +110,7 @@ Scene::Scene(ivec2 size)
data->m_default_cam = new Camera();
mat4 proj = mat4::ortho(0.f, (float)size.x, 0.f, (float)size.y, -1000.f, 1000.f);
data->m_default_cam->SetProjection(proj);
Scene::PushCamera(this, data->m_default_cam);
PushCamera(data->m_default_cam);

data->m_tile_cam = -1;
data->m_tile_shader = 0;
@@ -123,16 +123,16 @@ Scene::Scene(ivec2 size)

data->m_debug_mask = 1;

SetLineTime(this);
SetLineMask(this);
SetLineSegmentSize(this);
SetLineColor(this);
SetLineTime();
SetLineMask();
SetLineSegmentSize();
SetLineColor();
}

//-----------------------------------------------------------------------------
Scene::~Scene()
{
Scene::PopCamera(this, data->m_default_cam);
PopCamera(data->m_default_cam);

/* FIXME: this must be done while the GL context is still active.
* Change the code architecture to make sure of that. */
@@ -146,10 +146,9 @@ Scene::~Scene()
}

//-----------------------------------------------------------------------------
Scene* Scene::AddNew(ivec2 size)
void Scene::AddNew(ivec2 size)
{
Scene::g_scenes << new Scene(size);
return Scene::g_scenes.last();
}
void Scene::DestroyScene(Scene* scene)
{
@@ -167,34 +166,20 @@ ptrdiff_t Scene::GetCount()
}

//-----------------------------------------------------------------------------
Scene* Scene::GetScene(ptrdiff_t index)
bool Scene::IsReady(ptrdiff_t index)
{
ASSERT(0 <= index && index < g_scenes.count(), "Trying to get a non-existent scene");
return g_scenes[index];
return 0 <= index && index < g_scenes.count() && !!g_scenes[index];
}

//-----------------------------------------------------------------------------
bool Scene::GetScene(Scene*& scene)
Scene& Scene::GetScene(ptrdiff_t index)
{
ASSERT(!!g_scenes.count(), "Trying to access a non-ready scene");
return (scene = g_scenes[0]) != nullptr;
ASSERT(0 <= index && index < g_scenes.count() && !!g_scenes[index], "Trying to get a non-existent scene");
return *g_scenes[index];
}

//-----------------------------------------------------------------------------
bool Scene::GetSceneData(SceneData*& data)
{
ASSERT(!!g_scenes.count(), "Trying to access a non-ready scene");
return (data = g_scenes[0]->data) != nullptr;
}

//-----------------------------------------------------------------------------
bool Scene::IsReady()
{
return !!g_scenes[0];
}

//-----------------------------------------------------------------------------
void Scene::Apply(Entity* entity)
void Scene::Link(Entity* entity)
{
entity->m_scene_mask |= data->m_mask_id;
}
@@ -206,10 +191,9 @@ bool Scene::IsRelevant(Entity* entity)
}

//-----------------------------------------------------------------------------
Camera *Scene::GetCamera(int cam_idx)
Camera* Scene::GetCamera(int cam_idx)
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

return (0 <= cam_idx && cam_idx < data->m_camera_stack.Count()) ?
data->m_camera_stack[cam_idx] :
@@ -217,30 +201,28 @@ Camera *Scene::GetCamera(int cam_idx)
}

//-----------------------------------------------------------------------------
int Scene::PushCamera(Scene* scene, Camera *cam)
int Scene::PushCamera(Camera *cam)
{
ASSERT(!!scene, "Trying to access a non-ready scene");
ASSERT(!!scene->data, "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

Ticker::Ref(cam);
scene->data->m_camera_stack.Push(cam);
return (int)scene->data->m_camera_stack.Count() - 1;
data->m_camera_stack.Push(cam);
return (int)data->m_camera_stack.Count() - 1;
}

//-----------------------------------------------------------------------------
void Scene::PopCamera(Scene* scene, Camera *cam)
void Scene::PopCamera(Camera *cam)
{
ASSERT(!!scene, "Trying to access a non-ready scene");
ASSERT(!!scene->data, "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

/* Parse from the end because that’s probably where we’ll find
* our camera first. */
for (ptrdiff_t i = scene->data->m_camera_stack.Count(); i--;)
for (ptrdiff_t i = data->m_camera_stack.Count(); i--;)
{
if (scene->data->m_camera_stack[i] == cam)
if (data->m_camera_stack[i] == cam)
{
Ticker::Unref(cam);
scene->data->m_camera_stack.Remove(i);
data->m_camera_stack.Remove(i);
return;
}
}
@@ -248,29 +230,10 @@ void Scene::PopCamera(Scene* scene, Camera *cam)
ASSERT(false, "trying to pop a nonexistent camera from the scene");
}

//-----------------------------------------------------------------------------
int Scene::PushCamera(Camera *cam)
{
Scene* scene;
ASSERT(GetScene(scene), "Trying to access a non-ready scene");

return PushCamera(scene, cam);
}

//-----------------------------------------------------------------------------
void Scene::PopCamera(Camera *cam)
{
Scene* scene;
ASSERT(GetScene(scene), "Trying to access a non-ready scene");

PopCamera(scene, cam);
}

//-----------------------------------------------------------------------------
void Scene::SetTileCam(int cam_idx)
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

data->m_tile_cam = cam_idx;
}
@@ -278,8 +241,7 @@ void Scene::SetTileCam(int cam_idx)
//-----------------------------------------------------------------------------
void Scene::Reset()
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

for (int i = 0; i < data->m_tile_bufs.Count(); i++)
delete data->m_tile_bufs[i];
@@ -336,78 +298,42 @@ void Scene::AddTile(TileSet *tileset, int id, vec3 pos, int o, vec2 scale, float
data->m_tiles.Push(t);
}

//-----------------------------------------------------------------------------
void Scene::SetLineTime(Scene* scene, float new_time)
{
ASSERT(!!scene, "Trying to access a non-ready scene");
ASSERT(!!scene->data, "Trying to access a non-ready scene");

scene->data->m_new_line_time = new_time;
}
void Scene::SetLineMask(Scene* scene, int new_mask)
{
ASSERT(!!scene, "Trying to access a non-ready scene");
ASSERT(!!scene->data, "Trying to access a non-ready scene");

scene->data->m_new_line_mask = new_mask;
}
void Scene::SetLineSegmentSize(Scene* scene, float new_segment_size)
{
ASSERT(!!scene, "Trying to access a non-ready scene");
ASSERT(!!scene->data, "Trying to access a non-ready scene");

scene->data->m_new_line_segment_size = new_segment_size;
}
void Scene::SetLineColor(Scene* scene, vec4 new_color)
{
ASSERT(!!scene, "Trying to access a non-ready scene");
ASSERT(!!scene->data, "Trying to access a non-ready scene");

scene->data->m_new_line_color = new_color;
}

//-----------------------------------------------------------------------------
void Scene::SetLineTime(float new_time)
{
Scene* scene;
ASSERT(GetScene(scene), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

SetLineTime(scene, new_time);
data->m_new_line_time = new_time;
}
void Scene::SetLineMask(int new_mask)
{
Scene* scene;
ASSERT(GetScene(scene), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

SetLineMask(scene, new_mask);
data->m_new_line_mask = new_mask;
}
void Scene::SetLineSegmentSize(float new_segment_size)
{
Scene* scene;
ASSERT(GetScene(scene), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

SetLineSegmentSize(scene, new_segment_size);
data->m_new_line_segment_size = new_segment_size;
}
void Scene::SetLineColor(vec4 new_color)
{
Scene* scene;
ASSERT(GetScene(scene), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

SetLineColor(scene, new_color);
data->m_new_line_color = new_color;
}

//-----------------------------------------------------------------------------
float Scene::GetLineSegmentSize()
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

return data->m_new_line_segment_size;
}
vec4 Scene::GetLineColor()
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

return data->m_new_line_color;
}
@@ -415,18 +341,16 @@ vec4 Scene::GetLineColor()
//-----------------------------------------------------------------------------
void Scene::AddLine(vec3 a, vec3 b, vec4 color)
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

data->m_lines.Push(a, b, color, data->m_new_line_time,
data->m_new_line_mask, false, false);
data->m_lines.Push(a, b, color,
data->m_new_line_time, data->m_new_line_mask, false, false);
}

//-----------------------------------------------------------------------------
void Scene::AddLight(Light *l)
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

data->m_lights.Push(l);
}
@@ -434,8 +358,7 @@ void Scene::AddLight(Light *l)
//-----------------------------------------------------------------------------
array<Light *> const &Scene::GetLights()
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

return data->m_lights;
}
@@ -443,23 +366,20 @@ array<Light *> const &Scene::GetLights()
//-----------------------------------------------------------------------------
void Scene::RenderPrimitives()
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

/* TODO: this should be the main entry for rendering of all
* primitives found in the scene graph. When we have one. */

for (Primitive* p : data->m_primitives)
{
p->Render();
p->Render(*this);
}
}

//-----------------------------------------------------------------------------
void Scene::RenderTiles() // XXX: rename to Blit()
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

RenderContext rc;

@@ -581,8 +501,7 @@ void Scene::RenderTiles() // XXX: rename to Blit()
//-----------------------------------------------------------------------------
void Scene::RenderLines(float seconds) // XXX: rename to Blit()
{
SceneData* data;
ASSERT(GetSceneData(data), "Trying to access a non-ready scene");
ASSERT(!!data, "Trying to access a non-ready scene");

RenderContext rc;

@@ -602,7 +521,7 @@ void Scene::RenderLines(float seconds) // XXX: rename to Blit()
array<vec4, vec4, vec4, vec4> buff;
buff.Resize(linecount);
int real_linecount = 0;
mat4 const inv_view_proj = inverse(Scene::GetCamera()->GetProjection() * Scene::GetCamera()->GetView());
mat4 const inv_view_proj = inverse(GetCamera()->GetProjection() * GetCamera()->GetView());
for (int i = 0; i < linecount; i++)
{
if (data->m_lines[i].m5 & data->m_debug_mask)


+ 27
- 35
src/scene.h Переглянути файл

@@ -37,7 +37,7 @@ class Primitive
public:
Primitive() { }
virtual ~Primitive() { }
virtual void Render() const { }
virtual void Render(Scene& scene) { }

private:
};
@@ -66,34 +66,31 @@ private:

Scene(ivec2 size);
~Scene();

public:
static Scene* AddNew(ivec2 size);
static void AddNew(ivec2 size);
private:
//Private because I don't know if we should have it
static void DestroyScene(Scene* scene);
private:
static void DestroyAll();
public:
static ptrdiff_t GetCount();

static Scene* GetScene(ptrdiff_t index);
private:
static bool GetScene(Scene*& scene);
static bool GetSceneData(SceneData*& data);
static bool IsReady(ptrdiff_t index = 0);
static Scene& GetScene(ptrdiff_t index = 0);

public:
static bool IsReady();
//TODO: don't like the name
void Apply(Entity* entity);
void Link(Entity* entity);
bool IsRelevant(Entity* entity);

public:
static Camera *GetCamera(int cam_idx = -1);
private:
static int PushCamera(Scene* scene, Camera *cam);
static void PopCamera(Scene* scene, Camera *cam);
public:
static int PushCamera(Camera *cam);
static void PopCamera(Camera *cam);
static void SetTileCam(int cam_idx);
Camera* GetCamera(int cam_idx = -1);
int PushCamera(Camera *cam);
void PopCamera(Camera *cam);
void SetTileCam(int cam_idx);

static void Reset();
void Reset();

/* New scenegraph */
void AddPrimitive(Mesh const &mesh, mat4 const &matrix);
@@ -104,27 +101,22 @@ public:
* the architecture we want to build */
void AddTile(TileSet *tileset, int id, vec3 pos, int o, vec2 scale, float angle);

private:
static void SetLineTime(Scene* scene, float new_time = -1.f);
static void SetLineMask(Scene* scene, int new_mask = 0xFFFFFFFF);
static void SetLineSegmentSize(Scene* scene, float new_segment_size = 100000.f);
static void SetLineColor(Scene* scene, vec4 new_color = vec4(1.f));
public:
static void SetLineTime(float new_time = -1.f);
static void SetLineMask(int new_mask = 0xFFFFFFFF);
static void SetLineSegmentSize(float new_segment_size = 100000.f);
static void SetLineColor(vec4 new_color = vec4(1.f));
void SetLineTime(float new_time = -1.f);
void SetLineMask(int new_mask = 0xFFFFFFFF);
void SetLineSegmentSize(float new_segment_size = 100000.f);
void SetLineColor(vec4 new_color = vec4(1.f));

static float GetLineSegmentSize();
static vec4 GetLineColor();
static void AddLine(vec3 a, vec3 b, vec4 color);
float GetLineSegmentSize();
vec4 GetLineColor();
void AddLine(vec3 a, vec3 b, vec4 color);

static void AddLight(Light *light);
static array<Light *> const &GetLights();
void AddLight(Light *light);
array<Light *> const &GetLights();

static void RenderPrimitives();
static void RenderTiles();
static void RenderLines(float seconds);
void RenderPrimitives();
void RenderTiles();
void RenderLines(float seconds);

private:
SceneData *data;


+ 25
- 17
src/ticker.cpp Переглянути файл

@@ -325,7 +325,7 @@ void TickerData::GameThreadTick()
for (ptrdiff_t i = 0; i < Scene::GetCount(); i++)
{
//If entity is concerned by this scene, add it in the list
if (Scene::GetScene(i)->IsRelevant(e))
if (Scene::GetScene(i).IsRelevant(e))
removal_count++;
//Update scene index
data->m_scenes[e->m_drawgroup][i] -= removal_count;
@@ -359,7 +359,7 @@ void TickerData::GameThreadTick()
//If the entity has no mask, default it
if (e->m_scene_mask == 0)
{
Scene::GetScene(0)->Apply(e);
Scene::GetScene().Link(e);
}

data->m_todolist.remove(-1);
@@ -373,7 +373,7 @@ void TickerData::GameThreadTick()
for (ptrdiff_t i = 0; i < Scene::GetCount(); i++)
{
//If entity is concerned by this scene, add it in the list
if (Scene::GetScene(i)->IsRelevant(e))
if (Scene::GetScene(i).IsRelevant(e))
{
data->m_list[e->m_drawgroup].insert(e, data->m_scenes[e->m_drawgroup][i]);
added_count++;
@@ -423,27 +423,23 @@ void TickerData::DrawThreadTick()
/* Tick objects for the draw loop */
for (int g = Entity::DRAWGROUP_BEGIN; g < Entity::DRAWGROUP_END && !data->quit /* Stop as soon as required */; ++g)
{
ptrdiff_t scene_idx = 0;
//Scene::GetScene[scene_idx]->EnableDisplay(); //TODO
switch (g)
{
case Entity::DRAWGROUP_BEGIN:
Scene::Reset();
for (ptrdiff_t i = 0; i < Scene::GetCount(); i++)
Scene::GetScene(i).Reset();
g_renderer->Clear(ClearMask::All);
break;
default:
break;
}

ptrdiff_t scene_idx = 0;
for (int i = 0; i < data->m_list[g].Count() && !data->quit /* Stop as soon as required */; ++i)
{
//We're outside of the range of the current scene, on to the next
if (i >= data->m_scenes[g][scene_idx])
{
//Scene::GetScene[scene_idx]->DisableDisplay(); //TODO
scene_idx++;
//Scene::GetScene[scene_idx]->EnableDisplay(); //TODO
}
++scene_idx;

Entity *e = data->m_list[g][i];

@@ -455,7 +451,7 @@ void TickerData::DrawThreadTick()
e->GetName(), e);
e->m_tickstate = Entity::STATE_PRETICK_DRAW;
#endif
e->TickDraw(data->deltatime, *Scene::GetScene(scene_idx));
e->TickDraw(data->deltatime, Scene::GetScene(scene_idx));
#if !LOL_BUILD_RELEASE
if (e->m_tickstate != Entity::STATE_POSTTICK_DRAW)
Log::Error("entity %s [%p] missed super draw tick\n",
@@ -465,12 +461,24 @@ void TickerData::DrawThreadTick()
}
}

/* Do this render step */
Scene::RenderPrimitives();
Scene::RenderTiles();
Scene::RenderLines(data->deltatime);
}
//Scene::GetScene[scene_idx]->DisableDisplay(); //TODO

//Do the scene render loop
for (ptrdiff_t idx = 0; idx < Scene::GetCount(); ++idx)
{
Scene& scene = Scene::GetScene(idx);

/* Enable display */
//scene.EnableDisplay(); //TODO

/* Do the render step */
scene.RenderPrimitives();
scene.RenderTiles();
scene.RenderLines(data->deltatime);

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

Profiler::Stop(Profiler::STAT_TICK_DRAW);
}


Завантаження…
Відмінити
Зберегти