absence_thelab

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/3deng/3dscene.h	Thu Oct 23 01:46:07 2014 +0300
     1.3 @@ -0,0 +1,81 @@
     1.4 +#ifndef _3DSCENE_H_
     1.5 +#define _3DSCENE_H_
     1.6 +
     1.7 +#include <list>
     1.8 +#include "3dengine.h"
     1.9 +#include "camera.h"
    1.10 +#include "lights.h"
    1.11 +#include "objects.h"
    1.12 +#include "curves.h"
    1.13 +
    1.14 +struct ShadowVolume {
    1.15 +	TriMesh *shadow_mesh;
    1.16 +	const Light *light;
    1.17 +};
    1.18 +
    1.19 +class Scene {
    1.20 +private:
    1.21 +	GraphicsContext *gc;
    1.22 +
    1.23 +	Light *lights[8];
    1.24 +	std::list<Camera *> cameras;
    1.25 +	std::list<Object *> objects;
    1.26 +	std::list<ShadowVolume> StaticShadowVolumes;
    1.27 +	std::list<Curve *> curves;
    1.28 +	bool ManageData;
    1.29 +
    1.30 +	Camera *ActiveCamera;
    1.31 +
    1.32 +	bool Shadows;
    1.33 +	bool LightHalos;
    1.34 +	float HaloSize;
    1.35 +
    1.36 +	Color AmbientLight;
    1.37 +	
    1.38 +	bool UseFog;
    1.39 +	Color FogColor;
    1.40 +	float NearFogRange, FarFogRange;
    1.41 +		
    1.42 +public:
    1.43 +
    1.44 +	Scene(GraphicsContext *gc = 0);
    1.45 +	~Scene();
    1.46 +
    1.47 +	void SetGraphicsContext(GraphicsContext *gc);
    1.48 +
    1.49 +	void AddCamera(Camera *cam);
    1.50 +	void AddLight(Light *light);
    1.51 +	void AddObject(Object *obj);
    1.52 +	void AddStaticShadowVolume(TriMesh *mesh, const Light *light);
    1.53 +	void AddCurve(Curve *curve);
    1.54 +
    1.55 +	void RemoveObject(const Object *obj);
    1.56 +	void RemoveLight(const Light *light);
    1.57 +
    1.58 +	Camera *GetCamera(const char *name);
    1.59 +	Light *GetLight(const char *name);
    1.60 +	Object *GetObject(const char *name);
    1.61 +	Curve *GetCurve(const char *name);
    1.62 +
    1.63 +	std::list<Object*> *GetObjectsList();
    1.64 +
    1.65 +	void SetActiveCamera(Camera *cam);
    1.66 +	Camera *GetActiveCamera() const;
    1.67 +
    1.68 +	void SetShadows(bool enable);
    1.69 +	void SetHaloDrawing(bool enable);
    1.70 +	void SetHaloSize(float size);
    1.71 +	void SetAmbientLight(Color ambient);
    1.72 +	Color GetAmbientLight() const;
    1.73 +	void SetFog(bool enable, Color FogColor = Color(0l), float Near = 0.0f, float Far = 1000.0f);
    1.74 +
    1.75 +	// render states
    1.76 +	void SetupLights() const;
    1.77 +
    1.78 +	void RenderShadows() const;
    1.79 +	void Render() const;
    1.80 +};
    1.81 +	
    1.82 +
    1.83 +
    1.84 +#endif	// _3DSCENE_H_
    1.85 \ No newline at end of file