/*
/ MODEL.H
/ *******
/ Support for loading and rendering of external
/ models. Currently only .X files, but .OBJ support
/ is planned.
/
/ 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 __MODEL_H__
#define __MODEL_H__

#include "Compile.h"
#include "Types.h"
#include "Node.h"
#include "Mesh.h"
#include "Kernel.h"
#include "Texture.h"

#include "BstmDevice.h"

namespace Brainstem
{
	class Model : public ISceneNode
	{
	public:
		Model(IDirect3DDevice9* device, ID3DXEffect* effect, const char* filename);
		~Model() { }

		bool Init();
		void Update();
		void Render(ICamera* camera);
		void Release(); 

		void ApplyTexture(ITexture* texture);
		ITexture* GetTexture();

		BoundingVolume GetBounds() 
		{ 
			BoundingVolume mBounds = Mesh->Bounds;
			mBounds.ApplyTransforms(World);

			return mBounds; 
		}

		IMesh* Mesh;

		AUTO_OBJECT_SIZE;
		virtual const char* GetName() { return "Imported Model"; }

		void SetTechnique(const char* technique) { Technique = technique; }
		const char* GetTechnique() { return Technique; };

	private:

		IDirect3DDevice9* Device;
		ID3DXEffect* Effect;
		const char* Filename;
		const char* Technique;
	};
}

#endif