absence_thelab

view src/3deng/3dscene.h @ 0:1cffe3409164

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 23 Oct 2014 01:46:07 +0300
parents
children
line source
1 #ifndef _3DSCENE_H_
2 #define _3DSCENE_H_
4 #include <list>
5 #include "3dengine.h"
6 #include "camera.h"
7 #include "lights.h"
8 #include "objects.h"
9 #include "curves.h"
11 struct ShadowVolume {
12 TriMesh *shadow_mesh;
13 const Light *light;
14 };
16 class Scene {
17 private:
18 GraphicsContext *gc;
20 Light *lights[8];
21 std::list<Camera *> cameras;
22 std::list<Object *> objects;
23 std::list<ShadowVolume> StaticShadowVolumes;
24 std::list<Curve *> curves;
25 bool ManageData;
27 Camera *ActiveCamera;
29 bool Shadows;
30 bool LightHalos;
31 float HaloSize;
33 Color AmbientLight;
35 bool UseFog;
36 Color FogColor;
37 float NearFogRange, FarFogRange;
39 public:
41 Scene(GraphicsContext *gc = 0);
42 ~Scene();
44 void SetGraphicsContext(GraphicsContext *gc);
46 void AddCamera(Camera *cam);
47 void AddLight(Light *light);
48 void AddObject(Object *obj);
49 void AddStaticShadowVolume(TriMesh *mesh, const Light *light);
50 void AddCurve(Curve *curve);
52 void RemoveObject(const Object *obj);
53 void RemoveLight(const Light *light);
55 Camera *GetCamera(const char *name);
56 Light *GetLight(const char *name);
57 Object *GetObject(const char *name);
58 Curve *GetCurve(const char *name);
60 std::list<Object*> *GetObjectsList();
62 void SetActiveCamera(Camera *cam);
63 Camera *GetActiveCamera() const;
65 void SetShadows(bool enable);
66 void SetHaloDrawing(bool enable);
67 void SetHaloSize(float size);
68 void SetAmbientLight(Color ambient);
69 Color GetAmbientLight() const;
70 void SetFog(bool enable, Color FogColor = Color(0l), float Near = 0.0f, float Far = 1000.0f);
72 // render states
73 void SetupLights() const;
75 void RenderShadows() const;
76 void Render() const;
77 };
81 #endif // _3DSCENE_H_