//===========================================================================//
// File:	ScreenPolyManager.hpp                                               //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  -----------------------------------------------------------//
// 07/21/98  DPB  File Creation													        //
//---------------------------------------------------------------------------//
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc.                //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

#pragma once

#include "Adept.hpp"
#include <ElementRenderer\ScreenQuadsElement.hpp>
#include <ElementRenderer\CameraElement.hpp>
	
namespace ElementRenderer
{
	class ScreenQuadsElement;
	class CameraElement;
};

namespace MidLevelRenderer
{
	class MLRTexture;
	class MLRTexturePool;
};

namespace Adept {

	//##########################################################################
	//#######################    ScreenPolyManager    ##########################
	//##########################################################################

	class ScreenPolyManager:
		public Stuff::Node
	{
	public:
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Initialization
	//
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();
		static ClassData
			*DefaultData;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Constructors
	//
		ScreenPolyManager();

		~ScreenPolyManager();

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Members
	//
		void
			AdoptCamera(ElementRenderer::CameraElement *camera);

		static ScreenPolyManager
			*Instance;


		MString
			CreateScreenPoly(int *polyIndex,
									Vector4D **corners,
									RGBAColor **colors,
									Vector2DOf<Scalar> **uvs,
									bool **status,
									int priority_level,
									MString texture_name,
									MString alpha_name);

		MString
			CreateTextString(int str_len,
									char *string_text,
									Vector4D **text_corners,
									RGBAColor **text_colors,
									Vector2DOf<Scalar> **text_uvs,
									bool **text_status,
									int priority_level,
									MString string_texture);
		void
			RemovePolyGroup(const MString& group_name);

#if 0
		void
			ReleaseScreenPoly(MString group_name,
									int index);
#endif
		Scalar
			GetWValue(Scalar z);
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Private methods
	//
	private:

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Private data
	//
	protected:
		Stuff::SortedChainOf<ElementRenderer::ScreenQuadsElement *, MString> polyGroupSocket;

		int 
			nextGroup;
		ElementRenderer::CameraElement 
			*Camera;
	
	};

}
