/*
/ BSTMSCENE.H
/ ***********
/ A Scene is a 3D space that contains nodes, such
/ as a model or some terrain. This implementation
/ handles all objects in the scene as well as the main
/ rendering process.
/
/ Will Beddow 2010 - http://343gs.com/brainstem
/
/ This software is currently under development
/ and is subject to change and improvement. Some
/ aspects of the system are incomplete and/or 
/ unstable due to ongoing implementation.
/
*/

#ifndef __BSTMSCENE_H__
#define __BSTMSCENE_H__

#include "Compile.h"
#include "Types.h"
#include "Scene.h"
#include "Texture.h"
#include "Mesh.h"
#include "Bounds.h"
#include "Node.h"
#include "Model.h"
#include "Primitive.h"

#include "BstmDevice.h"
#include "BstmDisplay.h"
#include "BstmTerrain.h"
#include "BstmSprite.h"
#include "BstmSky.h"
#include "BstmCamera.h"

#include <vector>
#include <map>
#include <sstream>

namespace Brainstem
{
class Scene : public IScene
	{
		#ifndef SCENE_MAX_LIGHTS
		#define SCENE_MAX_LIGHTS 10
		#endif

	public:
		Scene(IKernel* kernel, IDirect3DDevice9* device, ID3DXEffect* effect);
		~Scene();

		void Init();
		void Update();
		void Render();
		void Release();

		void AddNode(ISceneNode* node);
		void AddCamera(ICamera* camera);
		void AddLight(ILight* light);

		void RemoveLight(ILight* light);

		void NextCamera();

		ICamera* GetActiveCamera();
		void SetActiveCamera(ICamera* camera);

		void ToggleMappingMode();
		void ToggleRenderMode();

		IDirect3DTexture9* BstmDiffuseTexture;
		IDirect3DTexture9* BstmNormalTexture;
		IDirect3DTexture9* BstmHeightTexture;
		IDirect3DTexture9* BstmBlankTexture;

		AUTO_OBJECT_SIZE;
		const char* GetName() { return "Scene"; }

	private:
		std::vector<IPtr<ICamera>> Cameras;
		std::vector<ILight*> Lights;
		std::vector<IPtr<ISceneNode>> Nodes;

		IKernel* Kernel;
		IDirect3DDevice9* Device;
		ID3DXEffect* Effect;

		Material BstmMaterial;

		IPtr<IMesh> BoundsMesh;

		bool ParallaxMappingEnabled;
		bool NormalMappingEnabled;

		ENUM_RENDERMODE RenderMode;
	};
}
#endif 