Add Parser::build_scene()
This commit is contained in:
1 parent
c1c8c46ac7
commit
a3684b20b6
3 files changed
+34
-2
No files matched your search
+25
-2
@@ -61,8 +61,31 @@ Scene * Parser::load_scene(const string_view & input_file)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* TODO: populate the Scene from p_result(context). */
|
||||
Scene * scene = new Scene();
|
||||
Scene * scene = build_scene(p_result(context));
|
||||
p_context_delete(context);
|
||||
return scene;
|
||||
}
|
||||
|
||||
Scene * Parser::build_scene(PStart start)
|
||||
{
|
||||
Scene * scene = new Scene();
|
||||
|
||||
for (PRenderParams rps = start.pRenderParams(); p_node_valid(rps); rps = rps.pRenderParams())
|
||||
{
|
||||
PRenderParam rp = rps.pRenderParam();
|
||||
if (PBackground background = rp.pBackground(); p_node_valid(background))
|
||||
{
|
||||
/* TODO: set scene->params.background from the Vector. */
|
||||
}
|
||||
else if (PHeight height = rp.pHeight(); p_node_valid(height))
|
||||
{
|
||||
/* TODO: set scene->params.height from the uint token. */
|
||||
}
|
||||
else if (PWidth width = rp.pWidth(); p_node_valid(width))
|
||||
{
|
||||
/* TODO: set scene->params.width from the uint token. */
|
||||
}
|
||||
}
|
||||
|
||||
return scene;
|
||||
}
|
||||
@@ -2,8 +2,13 @@
|
||||
|
||||
#include <fart/Scene.h>
|
||||
|
||||
struct PStart;
|
||||
|
||||
class Parser
|
||||
{
|
||||
public:
|
||||
static Scene * load_scene(const string_view & input_file);
|
||||
|
||||
private:
|
||||
static Scene * build_scene(PStart start);
|
||||
};
|
||||
@@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <fart/RenderParams.h>
|
||||
|
||||
class Scene
|
||||
{
|
||||
public:
|
||||
RenderParams params;
|
||||
};
|
||||
Reference in new issue
Block a user