#pragma once
#define MLR_MLR_I_C_DT_PMESH_HPP

#include <MLR\MLR.hpp>
#include <MLR\MLR_I_DT_PMesh.hpp>

namespace MidLevelRenderer {

	class MLR_I_C_DT_TMesh;

	//##########################################################################
	//#### MLRIndexedPolyMesh with color but no lighting two texture layers ####
	//##########################################################################

	class MLR_I_C_DT_PMesh:
		public MLR_I_DT_PMesh
	{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Initialization
	//
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();

		static HGOSHEAP
			PrimitiveHeap;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Constructors/Destructors
	//
	protected:
		MLR_I_C_DT_PMesh(
			ClassData *class_data,
			Stuff::MemoryStream *stream,
			int version
		);
		~MLR_I_C_DT_PMesh();

	public:
		MLR_I_C_DT_PMesh(ClassData *class_data=MLR_I_C_DT_PMesh::DefaultData);

		static MLR_I_C_DT_PMesh*
			Make(
				Stuff::MemoryStream *stream,
				int version
			);

		void
			Save(Stuff::MemoryStream *stream);

	public:
		virtual void
			SetColorData(
				const ColorType *array,
				int point_count
			);
		virtual void
			GetColorData(
				const ColorType **array,
				int *point_count
			);

		virtual int	TransformAndClip(Stuff::Matrix4D *, MLRClippingState, GOSVertexPool*, FogData*, DWORD=0xffffffff, bool=false);

		virtual void
			TransformNoClip(Stuff::Matrix4D*, GOSVertexPool*, FogData*, DWORD=0xffffffff, bool=false);

		bool
			Copy(MLR_I_C_DT_TMesh*);

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Class Data Support
	//
	public:
		static ClassData
			*DefaultData;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Testing
	//
	public:
		void
			TestInstance() const;

	protected:
		Stuff::ReadOnlyArrayOf<ColorType> colors;	// Base address of color list 
	};

	MLR_I_C_DT_PMesh*
		CreateIndexedCube_Color_NoLit_2Tex(
			Stuff::Scalar half, 
			const ColorType *colors,
			MLRState *state,
			MLRState *state1
		);
	MLRShape*
		CreateIndexedIcosahedron_Color_NoLit_2Tex(
			IcoInfo& icoInfo,
			MLRState *state,
			MLRState *state2
		);
}
