Added presentations from EVI 2017
This commit is contained in:
50
EVI - 2017/EVI 21/EVIray/scene.hpp
Normal file
50
EVI - 2017/EVI 21/EVIray/scene.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#ifndef SCENE_HPP
|
||||
#define SCENE_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <json_spirit_value.h>
|
||||
|
||||
#include "camera.hpp"
|
||||
#include "figure.hpp"
|
||||
#include "light.hpp"
|
||||
#include "material.hpp"
|
||||
#include "environment.hpp"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::runtime_error;
|
||||
using json_spirit::Value;
|
||||
|
||||
class SceneError: public runtime_error {
|
||||
public:
|
||||
explicit SceneError(const string & what_arg): runtime_error(what_arg) { }
|
||||
};
|
||||
|
||||
class Scene {
|
||||
public:
|
||||
typedef enum LIGHT_TYPE { DIRECTIONAL, POINT, SPOT, SPHERE, DISK, PLANE } light_type_t;
|
||||
|
||||
vector<Figure *> m_figures;
|
||||
vector<Light *> m_lights;
|
||||
Environment * m_env;
|
||||
Camera * m_cam;
|
||||
|
||||
Scene(const char * file_name, int h = 480, int w = 640, float fov = 90.0f);
|
||||
~Scene();
|
||||
|
||||
private:
|
||||
void read_vector(Value & val, vec3 & vec);
|
||||
void read_environment(Value & v);
|
||||
void read_camera(Value & v);
|
||||
Material * read_material(Value & v);
|
||||
Figure * read_sphere(Value & v);
|
||||
Figure * read_plane(Value & v);
|
||||
Light * read_light(Value & v, light_type_t t);
|
||||
Light * read_area_light(Value & v, light_type_t t);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user