Parse the camera section of a scene
This commit is contained in:
parent
eaabdfddc0
commit
4d5796e6e7
2 changed files with 16 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
#include "cameraParser.hh"
|
||||
#include "objectParser.hh"
|
||||
#include "sceneParser.hh"
|
||||
#include "vectorParser.hh"
|
||||
|
@ -31,6 +32,7 @@ void
|
|||
SceneParser::HandleKeyEvent(const std::string& key)
|
||||
{
|
||||
static const std::map<std::string, Section> sSections = {
|
||||
{"camera", CameraSection},
|
||||
{"dimensions", DimensionsSection},
|
||||
{"objects", ObjectsSection}
|
||||
};
|
||||
|
@ -49,6 +51,7 @@ SceneParser::HandleValueEvent(yaml_event_t& event)
|
|||
{
|
||||
switch (mSection) {
|
||||
case CameraSection:
|
||||
HandleCameraEvent(event);
|
||||
break;
|
||||
case DimensionsSection:
|
||||
HandleDimensionsEvent(event);
|
||||
|
@ -64,6 +67,18 @@ SceneParser::HandleValueEvent(yaml_event_t& event)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
SceneParser::HandleCameraEvent(yaml_event_t& event)
|
||||
{
|
||||
if (event.type != YAML_MAPPING_START_EVENT) {
|
||||
assert(event.type != YAML_MAPPING_START_EVENT);
|
||||
return;
|
||||
}
|
||||
|
||||
GetParsers().push(new CameraParser(GetScene(), GetParsers()));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SceneParser::HandleDimensionsEvent(yaml_event_t& event)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ private:
|
|||
ObjectsSection,
|
||||
};
|
||||
|
||||
void HandleCameraEvent(yaml_event_t& event);
|
||||
void HandleDimensionsEvent(yaml_event_t& event);
|
||||
void HandleObjectsEvent(yaml_event_t& event);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue