#pragma once
#define MLR_MLR_I_C_PMESH_HPP

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

namespace MidLevelRenderer {

	class MLR_I_C_TMesh;

	//##########################################################################
	//#### MLRIndexedPolyMesh with color but no lighting one texture layer  ####
	//##########################################################################


	class MLR_I_C_PMesh:
		public MLR_I_PMesh
	{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Initialization
	//
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();

		static HGOSHEAP
			PrimitiveHeap;

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

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

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

		void
			Save(Stuff::MemoryStream *stream);

	public:
		bool
			Copy(MLR_I_C_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_PMesh*
		CreateIndexedCube_Color_NoLit(
			Stuff::Scalar half, 
			const ColorType *colors,
			MLRState *state
		);

	MLR_I_PMesh*
		CreateIndexedViewFrustrum_Color_NoLit(
			MLRState *state,
			Stuff::Scalar near_clip,
			Stuff::Scalar far_clip,
			Stuff::Scalar left_clip,
			Stuff::Scalar right_clip,
			Stuff::Scalar top_clip,
			Stuff::Scalar bottom_clip,
			const ColorType &color
		);

	MLRShape*
		CreateIndexedIcosahedron_Color_NoLit(
			IcoInfo& icoInfo,
			MLRState *state
		);
}
