#pragma once
#define MLR_MLR_I_C_DeT_PMESH_HPP

#include <MLR\MLR.hpp>
#include <MLR\MLR_I_DeT_PMesh.hpp>
#include <MLR\MLR_I_C_PMesh.hpp>

namespace MidLevelRenderer {

	class MLR_I_C_DeT_TMesh;

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

	class MLR_I_C_DeT_PMesh:
		public MLR_I_DeT_PMesh
	{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Initialization
	//
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();

		static HGOSHEAP
			PrimitiveHeap;

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

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

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

		void
			Save(Stuff::MemoryStream *stream);

	public:
		void
			Copy(
				MLR_I_C_PMesh*,
				MLRState detailState,
				Stuff::Scalar xOff,
				Stuff::Scalar yOff,
				Stuff::Scalar xFac,
				Stuff::Scalar yFac
			);

		bool
			Copy(MLR_I_C_DeT_TMesh*);

		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);

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// 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_DeT_PMesh*
		CreateIndexedCube_Color_NoLit_DetTex(
			Scalar half, 
			const ColorType *colors,
			MLRState *state,
			MLRState *state1,
			Stuff::Scalar xOff,
			Stuff::Scalar yOff,
			Stuff::Scalar xFac,
			Stuff::Scalar yFac
			);
	MLRShape*
		CreateIndexedIcosahedron_Color_NoLit_DetTex(
			IcoInfo& icoInfo,
			MLRState *state,
			MLRState *state2
		);
}
