#pragma once

#include "..\dxfunctions\dllinterface.h"
#include "..\dxfunctions\dxmatrix.h"
#include "..\dxfunctions\shadermanager.h"
#include "..\dxfunctions\mesh.h"
#include "..\dxfunctions\renderlist.h"
#include "..\Utilities\xstring.h"

#include "SceneObject.h"

class ShadowApp;

class MeshObject : public SceneObject
{
protected:
	//ShadowApp* m_App;
	XString m_MeshFile;
	//DXMatrix m_matWorld;
	CMesh* m_Mesh;
	//OBS m_Bound;
	ShaderEffect* m_FX;
	
	LList<RenderJob> m_RenderJobs;
	LList<RenderJob> m_RenderJobsDS;
	LList<RenderJob> m_ShadowRenderJobs;
	
	SHADERPARAMETER m_MatWorld;
	SHADERPARAMETER m_SMMatWorld;
	SHADERPARAMETER m_SMID;

	LList<SHADERPARAMETER> m_SP;
	LList<TEXTUREPARAMETER> m_TP;

	void BuildRenderJobs(void);

public:
	
	MeshObject(ShadowScene* const pScene, CMesh* const mesh, const DXMatrix& pos);
	virtual ~MeshObject(void);

	//const IBoundingVolume& GetBoundingVolume(void) const { return m_Bound; }
	void AddToRenderList(RenderList& rl);
	void AddToShadowRenderList(RenderList& rl);
	
	//void Render(const bool depthmap);
	//void Update(const float dt);
	//void UpdateShadow(void);

	virtual void UpdateTechnique(void);
};
