erebus

annotate liberebus/src/scene.h @ 37:db8a90307386

implemented console and rudimentary commandline parser
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 09 Jun 2014 16:01:00 +0300
parents e2d9bf168a41
children 9d6368850fe1
rev   line source
nuclear@2 1 #ifndef SCENE_H_
nuclear@2 2 #define SCENE_H_
nuclear@2 3
nuclear@19 4 #include <stdio.h>
nuclear@2 5 #include <vector>
nuclear@2 6 #include "snode.h"
nuclear@2 7 #include "camera.h"
nuclear@8 8 #include "color.h"
nuclear@8 9
nuclear@8 10 struct Environment {
nuclear@8 11 Color bgcolor;
nuclear@8 12 Color ambient;
nuclear@8 13 // TODO map & image-based lighting
nuclear@8 14
nuclear@8 15 Environment();
nuclear@8 16 };
nuclear@2 17
nuclear@2 18 class Scene {
nuclear@2 19 private:
nuclear@8 20 Environment env;
nuclear@8 21
nuclear@2 22 std::vector<Object*> objects;
nuclear@2 23 std::vector<SceneNode*> nodes;
nuclear@2 24
nuclear@4 25 SceneNode *root;
nuclear@4 26
nuclear@2 27 Camera *active_cam;
nuclear@2 28
nuclear@2 29 public:
nuclear@2 30 Scene();
nuclear@2 31 ~Scene();
nuclear@2 32
nuclear@8 33 void set_env(const Environment &env);
nuclear@8 34 Environment &get_env();
nuclear@8 35 const Environment &get_env() const;
nuclear@8 36
nuclear@8 37 Color get_env_color() const;
nuclear@8 38 Color get_env_color(const Ray &ray) const;
nuclear@8 39
nuclear@2 40 void add_object(Object *obj);
nuclear@2 41 int get_object_count() const;
nuclear@2 42 Object *get_object(int idx) const;
nuclear@2 43
nuclear@2 44 void add_node(SceneNode *node);
nuclear@2 45 int get_node_count() const;
nuclear@2 46 SceneNode *get_node(int idx) const;
nuclear@2 47
nuclear@4 48 void use_camera(Camera *cam);
nuclear@4 49 Camera *get_active_camera() const;
nuclear@4 50
nuclear@4 51 void update(long msec = 0);
nuclear@4 52
nuclear@2 53 bool intersect(const Ray &ray, RayHit *hit) const;
nuclear@4 54
nuclear@4 55 bool load(const char *fname);
nuclear@19 56 bool load(FILE *fp);
nuclear@19 57
nuclear@19 58 bool proc_cmd(int argc, char **argv);
nuclear@2 59 };
nuclear@2 60
nuclear@2 61 #endif // SCENE_H_