#pragma once

#include "Adept.hpp"
#include "VideoRenderer.hpp"
#include "VideoComponent.hpp"

namespace Adept {

	//#########################################################################
	//##########################  SlidingShapeComponent  ##############################
	//#########################################################################
	//
	// When instantiating this class, the following methods must be explicitly
	// defined:
	//
	//   void InitializeClass();
	//   void ReadGeometryFromResource(...)
	//   SlidingShapeComponent<C,G,B>* Make(...)
	//	  Derivation* CreateFactoryRequest(...)
	//
	// The methods having templates in this header file should work fine, but
	// explicitly define whatever you need.
	//

	class SlidingShapeComponent:
		public ShapeComponent
	{
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();
		static ClassData
			*DefaultData;

		typedef ShapeComponent BaseClass;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Constructor/Destructor
	//
	protected:
		SlidingShapeComponent(
			ClassData *class_data,
			MemoryStream *stream,
			VideoComponentWeb *owning_web,
			Entity *watched_entity
		);

		void
			SkipStreamData(MemoryStream *stream);

	protected:
		Entity
			*m_entity;
		AttributeEntry
			*m_attribute;
		const Stuff::Vector2DOf<Stuff::Scalar>
			*m_originalUVs;
		Stuff::DynamicArrayOf<Stuff::Vector2DOf<Stuff::Scalar> >
			*m_UVs;

	public:
		static SlidingShapeComponent*
			Create(
				MemoryStream *stream,
				VideoComponentWeb *owning_web,
				Entity *entity
			);

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Data flow
	//
	public:
		void
			Execute();

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Accessors
	//
	public:
		void
			TestInstance();

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Tool-related Functions
	//
	public:
		static ClassData*
			CreateFactoryRequest(
				FactoryRequestParameters *parameters,
				Entity__ClassData *class_data
			);
	};

}

