//==========================================================================//
// File:	 gosFX_Singleton.hpp										//
// Project:  gosFX					                                        //
// Contents: Base Singleton Particle									//
//--------------------------------------------------------------------------//
// Date      Who    Modification                                            //
// 09/28/98  JTR    Created													//
//																			//
//--------------------------------------------------------------------------//
// Copyright (C) 1997-1998, Virtual World Entertainment, Inc.               //
// All Rights reserved worldwide                                            //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL              //
//==========================================================================//
//
#pragma once

#include "gosFX.hpp"
#include "Effect.hpp"

namespace gosFX
{
	//############################################################################
	//########################  Singleton__Specification  #############################
	//############################################################################

	class Singleton__Specification:
		public Effect__Specification
	{
	//----------------------------------------------------------------------
	// Constructors/Destructors
	//
	protected:
		Singleton__Specification(
			Stuff::RegisteredClass::ClassID class_id,
			Stuff::MemoryStream *stream,
			int gfx_version
		);

	public:
		typedef Effect__Specification BaseClass;

		Singleton__Specification(Stuff::RegisteredClass::ClassID class_id);
		~Singleton__Specification();

		void
			Copy(Singleton__Specification *spec);

		void
			Save(Stuff::MemoryStream *stream);

		void 
			BuildDefaults();

		bool 
			IsDataValid(bool fix_data=false);

	//-------------------------------------------------------------------------
	// FCurves
	//
	public:
		SeededCurveOf<ComplexCurve, LinearCurve,Curve::e_ComplexLinearType>
			m_red,
			m_green,
			m_blue,
			m_alpha;
		SeededCurveOf<ConstantCurve, LinearCurve,Curve::e_ConstantLinearType>
			m_spin;
		SeededCurveOf<ComplexCurve, ComplexCurve,Curve::e_ComplexComplexType>
			m_scale;

		bool
			m_randomStartingRotation,
			m_alignZUsingX,
			m_alignZUsingY;
	};

	//############################################################################
	//##############################  Singleton  #############################
	//############################################################################

	class _declspec(novtable) Singleton:
		public Effect
	{
	public:
		typedef Effect BaseClass;

		static void
			InitializeClass();
		static void
			TerminateClass();

		static ClassData
			*DefaultData;

		typedef Singleton__Specification Specification;

	protected:
		Stuff::DynamicArrayOf<char>
			m_data;

		Singleton(
			ClassData *class_data,
			Specification *spec,
			unsigned flags
		);

	//----------------------------------------------------------------------------
	// Class Data Support
	//
	public:
		Specification*
			GetSpecification()
				{
					Check_Object(this);
					return
						Cast_Object(Specification*, m_specification);
				}

	//----------------------------------------------------------------------------
	// API
	//
	public:
		void
			Start(ExecuteInfo *info);
		bool
			Execute(ExecuteInfo *info);

	protected:
		Stuff::Vector3D
			m_angularVelocity;
		Stuff::UnitQuaternion
			m_localRotation,
			m_worldRotation;
		Stuff::RGBAColor
			m_color;
		Stuff::Scalar
			m_radius,
			m_scale;

	//----------------------------------------------------------------------------
	// Testing
	//
	public:
		void
			TestInstance() const;
	};
}
