#include "BuildCurves.hpp"

//----------------------------------------------------------------------------
//
gosFX::PointCloud::Specification*
	CreatePointCloud(
		gosFX::EffectLibrary *library,
		unsigned index,
		unsigned child
	)
{
	//
	//-----------------------------------------
	// Stick a new specification in the library
	//-----------------------------------------
	//
	Check_Object(library);
	Verify(!library->m_effects[index]);
	gosFX::PointCloud::Specification* spec =
		new gosFX::PointCloud::Specification(gosFX::PointCloudClassID);
	Check_Object(spec);
	library->m_effects[index] = spec;
	spec->m_name = "PointCloud";

	//
	//------------------
	// Set up the events
	//------------------
	//
	if (child < EFFECT_COUNT)
	{
		gosFX::Event *event = new gosFX::Event;
		Check_Object(event);
		event->m_time = 0.0f;
		event->m_flags = gosFX::Effect::DynamicWorldSpaceSimulationMode;
		event->m_effectID = child;
		event->m_localToParent = Stuff::LinearMatrix4D::Identity;
		event->m_localToParent(3,1) = -0.2f;
		spec->AdoptEvent(event);
	}

	//
	//--------------------------
	// Set up the default curves
	//--------------------------
	//
	spec->BuildDefaults();

	//
	//----------------------
	// Override given curves
	//----------------------
	//
	spec->m_minimumChildSeed.SetCurve(0.5f, 0.0f);
	spec->m_maximumChildSeed.SetCurve(1.0f, 0.5f);

	spec->m_maxParticleCount = 150;

	spec->m_startingPopulation.SetCurve(3.0f);
	spec->m_particlesPerSecond.SetCurve(50.0f);

	spec->m_maximumDeviation.SetCurve(Stuff::Pi_Over_6);

	spec->m_startingSpeed.m_ageCurve.SetCurve(1.0f);
	spec->m_startingSpeed.m_seeded = true;
	spec->m_startingSpeed.m_seedCurve.SetCurve(1.0f, 3.0f);

	spec->m_pLifeSpan.m_ageCurve.SetCurve(2.0f);
	spec->m_pLifeSpan.m_seeded = false;
	spec->m_pLifeSpan.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationY.m_ageCurve.SetCurve(3.0f);
	spec->m_pAccelerationY.m_seeded = false;
	spec->m_pAccelerationY.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityX.m_ageCurve.SetCurve(7.0f);
	spec->m_pEtherVelocityX.m_seeded = false;
	spec->m_pEtherVelocityX.m_seedCurve.SetCurve(1.0f);

	spec->m_pDrag.m_ageCurve.SetCurve(0.3f);
	spec->m_pDrag.m_seeded = false;
	spec->m_pDrag.m_seedCurve.SetCurve(1.0f);

	spec->m_pRed.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_pRed.m_seeded = true;
	spec->m_pRed.m_seedCurve.SetCurve(0.5f, 1.0f);

	spec->m_pGreen.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_pGreen.m_seeded = true;
	spec->m_pGreen.m_seedCurve.SetCurve(1.0f, 0.5f);

	spec->m_pBlue.m_ageCurve.SetCurve(0.25f);
	spec->m_pBlue.m_seeded = true;
	spec->m_pBlue.m_seedCurve.SetCurve(0.0f, 2.0f);

	return spec;
}

//----------------------------------------------------------------------------
//
gosFX::ShardCloud::Specification*
	CreateShardCloud(
		gosFX::EffectLibrary *library,
		unsigned index,
		unsigned child
	)
{
	//
	//-----------------------------------------
	// Stick a new specification in the library
	//-----------------------------------------
	//
	Check_Object(library);
	Verify(!library->m_effects[index]);
	gosFX::ShardCloud::Specification* spec = new gosFX::ShardCloud::Specification;
	Check_Object(spec);
	library->m_effects[index] = spec;

	//
	//-------------------------
	// Build a simple FX holder
	//-------------------------
	//
	spec->m_name = "ShardCloud";

	//
	//------------------
	// Set up the events
	//------------------
	//
	if (child < EFFECT_COUNT)
	{
		gosFX::Event *event = new gosFX::Event;
		Check_Object(event);
		event->m_time = 0.0f;
		event->m_flags = gosFX::Effect::DynamicWorldSpaceSimulationMode;
		event->m_effectID = child;
		event->m_localToParent = Stuff::LinearMatrix4D::Identity;
		spec->AdoptEvent(event);
	}

	//
	//--------------------------
	// Set up the default curves
	//--------------------------
	//
	spec->BuildDefaults();

	//
	//-------------------------
	// Set up the effect curves
	//-------------------------
	//
	spec->m_lifeSpan.SetCurve(10.0f);

	spec->m_minimumChildSeed.SetCurve(0.0f);
	spec->m_maximumChildSeed.SetCurve(1.0f);

	//
	//---------------------------------
	// Set up the particle cloud curves
	//---------------------------------
	//
	spec->m_maxParticleCount = 200;

	spec->m_startingPopulation.SetCurve(0.0f);
	spec->m_particlesPerSecond.SetCurve(50.0f);

	spec->m_emitterSizeX.SetCurve(0.0f);
	spec->m_emitterSizeY.SetCurve(0.0f);
	spec->m_emitterSizeZ.SetCurve(0.0f);

	spec->m_minimumDeviation.SetCurve(0.0f);
	spec->m_maximumDeviation.SetCurve(Stuff::Pi_Over_6);

	spec->m_startingSpeed.m_ageCurve.SetCurve(1.0f);
	spec->m_startingSpeed.m_seeded = true;
	spec->m_startingSpeed.m_seedCurve.SetCurve(1.0f, 3.0f);

	spec->m_pLifeSpan.m_ageCurve.SetCurve(4.0f);
	spec->m_pLifeSpan.m_seeded = false;
	spec->m_pLifeSpan.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationX.m_ageCurve.SetCurve(0.0f);
	spec->m_pAccelerationX.m_seeded = false;
	spec->m_pAccelerationX.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationY.m_ageCurve.SetCurve(1.0f);
	spec->m_pAccelerationY.m_seeded = false;
	spec->m_pAccelerationY.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationZ.m_ageCurve.SetCurve(0.0f);
	spec->m_pAccelerationZ.m_seeded = false;
	spec->m_pAccelerationZ.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityX.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityX.m_seeded = false;
	spec->m_pEtherVelocityX.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityY.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityY.m_seeded = false;
	spec->m_pEtherVelocityY.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityZ.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityZ.m_seeded = false;
	spec->m_pEtherVelocityZ.m_seedCurve.SetCurve(1.0f);

	spec->m_pDrag.m_ageCurve.SetCurve(0.0f);
	spec->m_pDrag.m_seeded = false;
	spec->m_pDrag.m_seedCurve.SetCurve(1.0f);

	spec->m_pRed.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_pRed.m_seeded = false;
	spec->m_pRed.m_seedCurve.SetCurve(1.0f);

	spec->m_pGreen.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_pGreen.m_seeded = false;
	spec->m_pGreen.m_seedCurve.SetCurve(1.0f);

	spec->m_pBlue.m_ageCurve.SetCurve(0.25f);
	spec->m_pBlue.m_seeded = false;
	spec->m_pBlue.m_seedCurve.SetCurve(1.0f);

	spec->m_pAlpha.m_ageCurve.SetCurve(1.0f);
	spec->m_pAlpha.m_seeded = false;
	spec->m_pAlpha.m_seedCurve.SetCurve(1.0f);

	//
	//----------------------------------
	// Fill in the Spinning cloud curves
	//----------------------------------
	//
	spec->m_randomStartingRotation = true;
	spec->m_alignZUsingX = false;
	spec->m_alignZUsingY = true;

	spec->m_pSpin.m_ageCurve.SetCurve(Stuff::Pi_Over_2);
	spec->m_pSpin.m_seeded = true;
	spec->m_pSpin.m_seedCurve.SetCurve(-1.0f, 1.0f);

	spec->m_pScale.m_ageCurve.SetCurve(1.0f);
	spec->m_pScale.m_seeded = false;
	spec->m_pScale.m_seedCurve.SetCurve(1.0f);

	//
	//-------------------------------
	// Fill in the Shard cloud curves
	//-------------------------------
	//
	spec->m_size.m_ageCurve.SetCurve(1.0f, 2.0f);
	spec->m_size.m_seeded = false;
	spec->m_size.m_seedCurve.SetCurve(1.0f);

	spec->m_angularity.m_ageCurve.SetCurve(Stuff::Pi_Over_2);
	spec->m_angularity.m_seeded = true;
	spec->m_angularity.m_seedCurve.SetCurve(-0.9f, 0.9f);

	return spec;
}

//----------------------------------------------------------------------------
//
gosFX::PertCloud::Specification*
	CreatePertCloud(
		gosFX::EffectLibrary *library,
		unsigned index,
		unsigned child
	)
{
	//
	//-----------------------------------------
	// Stick a new specification in the library
	//-----------------------------------------
	//
	Check_Object(library);
	Verify(!library->m_effects[index]);
	gosFX::PertCloud::Specification* spec = new gosFX::PertCloud::Specification(5);
	Check_Object(spec);
	library->m_effects[index] = spec;

	//
	//-------------------------
	// Build a simple FX holder
	//-------------------------
	//
	spec->m_name = "PertCloud";
	spec->m_state.SetAlphaMode(MidLevelRenderer::MLRState::AlphaInvAlphaMode);
	spec->m_state.SetPriority(MidLevelRenderer::MLRState::AlphaPriority);

	//
	//------------------
	// Set up the events
	//------------------
	//
	if (child < EFFECT_COUNT)
	{
		gosFX::Event *event = new gosFX::Event;
		Check_Object(event);
		event->m_time = 0.0f;
		event->m_flags = gosFX::Effect::DynamicWorldSpaceSimulationMode;
		event->m_effectID = child;
		event->m_localToParent = Stuff::LinearMatrix4D::Identity;
//		event->m_localToParent(3,1) = -1.5f;
		spec->AdoptEvent(event);
	}

	//
	//--------------------------
	// Set up the default curves
	//--------------------------
	//
	spec->BuildDefaults();

	//
	//-------------------------
	// Set up the effect curves
	//-------------------------
	//
	spec->m_lifeSpan.SetCurve(10.0f);

	spec->m_minimumChildSeed.SetCurve(0.0f);
	spec->m_maximumChildSeed.SetCurve(1.0f);

	//
	//---------------------------------
	// Set up the particle cloud curves
	//---------------------------------
	//
	spec->m_maxParticleCount = 140;

	spec->m_startingPopulation.SetCurve(0.0f);
	spec->m_particlesPerSecond.SetCurve(50.0f);

	spec->m_emitterSizeX.SetCurve(1.0f);
	spec->m_emitterSizeY.SetCurve(1.0f);
	spec->m_emitterSizeZ.SetCurve(1.0f);

	spec->m_minimumDeviation.SetCurve(0.0f);
	spec->m_maximumDeviation.SetCurve(Stuff::Pi_Over_6);

	spec->m_startingSpeed.m_ageCurve.SetCurve(2.0f);
	spec->m_startingSpeed.m_seeded = true;
	spec->m_startingSpeed.m_seedCurve.SetCurve(1.0f, 2.0f);

	spec->m_pLifeSpan.m_ageCurve.SetCurve(2.0f);
	spec->m_pLifeSpan.m_seeded = false;
	spec->m_pLifeSpan.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationX.m_ageCurve.SetCurve(0.0f);
	spec->m_pAccelerationX.m_seeded = false;
	spec->m_pAccelerationX.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationY.m_ageCurve.SetCurve(-3.0f);
	spec->m_pAccelerationY.m_seeded = false;
	spec->m_pAccelerationY.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationZ.m_ageCurve.SetCurve(0.0f);
	spec->m_pAccelerationZ.m_seeded = false;
	spec->m_pAccelerationZ.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityX.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityX.m_seeded = false;
	spec->m_pEtherVelocityX.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityY.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityY.m_seeded = false;
	spec->m_pEtherVelocityY.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityZ.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityZ.m_seeded = false;
	spec->m_pEtherVelocityZ.m_seedCurve.SetCurve(1.0f);

	spec->m_pDrag.m_ageCurve.SetCurve(0.0f);
	spec->m_pDrag.m_seeded = false;
	spec->m_pDrag.m_seedCurve.SetCurve(1.0f);

	spec->m_pRed.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_pRed.m_seeded = false;
	spec->m_pRed.m_seedCurve.SetCurve(1.0f);

	spec->m_pGreen.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_pGreen.m_seeded = false;
	spec->m_pGreen.m_seedCurve.SetCurve(1.0f);

	spec->m_pBlue.m_ageCurve.SetCurve(0.25f);
	spec->m_pBlue.m_seeded = false;
	spec->m_pBlue.m_seedCurve.SetCurve(1.0f);

	spec->m_pAlpha.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_pAlpha.m_seeded = false;
	spec->m_pAlpha.m_seedCurve.SetCurve(1.0f);

	//
	//----------------------------------
	// Fill in the Spinning cloud curves
	//----------------------------------
	//
	spec->m_randomStartingRotation = true;
	spec->m_alignZUsingX = true;
	spec->m_alignZUsingY = false;

	spec->m_pSpin.m_ageCurve.SetCurve(Stuff::Pi_Over_2);
	spec->m_pSpin.m_seeded = true;
	spec->m_pSpin.m_seedCurve.SetCurve(-1.0f, 1.0f);

	spec->m_pScale.m_ageCurve.SetCurve(4.0, 1.0f);
	spec->m_pScale.m_seeded = false;
	spec->m_pScale.m_seedCurve.SetCurve(1.0f);

	//
	//-------------------------------
	// Fill in the pert cloud curves
	//-------------------------------
	//
	spec->m_pCenterRed.m_ageCurve.SetCurve(1.0, 1.0f);
	spec->m_pCenterRed.m_seeded = false;
	spec->m_pCenterRed.m_seedCurve.SetCurve(1.0f);

	spec->m_pCenterGreen.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_pCenterGreen.m_seeded = false;
	spec->m_pCenterGreen.m_seedCurve.SetCurve(1.0f);

	spec->m_pCenterBlue.m_ageCurve.SetCurve(0.25f);
	spec->m_pCenterBlue.m_seeded = false;
	spec->m_pCenterBlue.m_seedCurve.SetCurve(1.0f);

	spec->m_pCenterAlpha.m_ageCurve.SetCurve(1.0f);
	spec->m_pCenterAlpha.m_seeded = false;
	spec->m_pCenterAlpha.m_seedCurve.SetCurve(1.0f);

	spec->m_size.m_ageCurve.SetCurve(0.2f);
	spec->m_size.m_seeded = false;
	spec->m_size.m_seedCurve.SetCurve(1.0f);

	spec->m_perturbation.m_ageCurve.SetCurve(0.25f);
	spec->m_perturbation.m_seeded = true;
	spec->m_perturbation.m_seedCurve.SetCurve(-1.0f, 1.0f);

	return spec;
}

//----------------------------------------------------------------------------
//
gosFX::CardCloud::Specification*
	CreateCardCloud(
		gosFX::EffectLibrary *library,
		unsigned index,
		MidLevelRenderer::MLRTexture *texture,
		unsigned child
	)
{
	//
	//-----------------------------------------
	// Stick a new specification in the library
	//-----------------------------------------
	//
	Check_Object(library);
	Verify(!library->m_effects[index]);
	gosFX::CardCloud::Specification* spec = new gosFX::CardCloud::Specification;
	Check_Object(spec);
	library->m_effects[index] = spec;

	//
	//-------------------------
	// Build a simple FX holder
	//-------------------------
	//
	spec->m_name = "CardCloud";
	spec->m_state.SetAlphaMode(MidLevelRenderer::MLRState::AlphaInvAlphaMode);
	spec->m_state.SetPriority(MidLevelRenderer::MLRState::AlphaPriority);
	Check_Object(texture);
	spec->m_state.SetTextureHandle(texture->GetTextureHandle());

	//
	//------------------
	// Set up the events
	//------------------
	//
	if (child < EFFECT_COUNT)
	{
		gosFX::Event *event = new gosFX::Event;
		Check_Object(event);
		event->m_time = 0.0f;
		event->m_flags = gosFX::Effect::DynamicWorldSpaceSimulationMode;
		event->m_effectID = child;
		event->m_localToParent = Stuff::LinearMatrix4D::Identity;
//		event->m_localToParent(3,1) = -1.5f;
		spec->AdoptEvent(event);
	}

	//
	//--------------------------
	// Set up the default curves
	//--------------------------
	//
	spec->BuildDefaults();

	//
	//-------------------------
	// Set up the effect curves
	//-------------------------
	//
	spec->m_lifeSpan.SetCurve(1.0f);

	spec->m_minimumChildSeed.SetCurve(0.0f);
	spec->m_maximumChildSeed.SetCurve(1.0f);

	//
	//---------------------------------
	// Set up the particle cloud curves
	//---------------------------------
	//
	spec->m_maxParticleCount = 20;

	spec->m_startingPopulation.SetCurve(0.0f);
	spec->m_particlesPerSecond.SetCurve(5.0f);

	spec->m_emitterSizeX.SetCurve(1.0f);
	spec->m_emitterSizeY.SetCurve(1.0f);
	spec->m_emitterSizeZ.SetCurve(1.0f);

	spec->m_minimumDeviation.SetCurve(0.0f);
	spec->m_maximumDeviation.SetCurve(Stuff::Pi_Over_6);

	spec->m_startingSpeed.m_ageCurve.SetCurve(1.0f);
	spec->m_startingSpeed.m_seeded = true;
	spec->m_startingSpeed.m_seedCurve.SetCurve(-1.0f, 1.0f);

	spec->m_pLifeSpan.m_ageCurve.SetCurve(3.0f);
	spec->m_pLifeSpan.m_seeded = false;
	spec->m_pLifeSpan.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationX.m_ageCurve.SetCurve(0.0f);
	spec->m_pAccelerationX.m_seeded = false;
	spec->m_pAccelerationX.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationY.m_ageCurve.SetCurve(1.0f);
	spec->m_pAccelerationY.m_seeded = false;
	spec->m_pAccelerationY.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationZ.m_ageCurve.SetCurve(0.0f);
	spec->m_pAccelerationZ.m_seeded = false;
	spec->m_pAccelerationZ.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityX.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityX.m_seeded = false;
	spec->m_pEtherVelocityX.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityY.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityY.m_seeded = false;
	spec->m_pEtherVelocityY.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityZ.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityZ.m_seeded = false;
	spec->m_pEtherVelocityZ.m_seedCurve.SetCurve(1.0f);

	spec->m_pDrag.m_ageCurve.SetCurve(0.0f);
	spec->m_pDrag.m_seeded = false;
	spec->m_pDrag.m_seedCurve.SetCurve(1.0f);

	spec->m_pRed.m_ageCurve.SetCurve(1.0f);
	spec->m_pRed.m_seeded = false;
	spec->m_pRed.m_seedCurve.SetCurve(1.0f);

	spec->m_pGreen.m_ageCurve.SetCurve(1.0f);
	spec->m_pGreen.m_seeded = false;
	spec->m_pGreen.m_seedCurve.SetCurve(1.0f);

	spec->m_pBlue.m_ageCurve.SetCurve(1.0f);
	spec->m_pBlue.m_seeded = false;
	spec->m_pBlue.m_seedCurve.SetCurve(1.0f);

	spec->m_pAlpha.m_ageCurve.SetCurve(1.0f);
	spec->m_pAlpha.m_seeded = false;
	spec->m_pAlpha.m_seedCurve.SetCurve(1.0f);

	//
	//----------------------------------
	// Fill in the Spinning cloud curves
	//----------------------------------
	//
	spec->m_randomStartingRotation = false;
	spec->m_alignZUsingX = true;
	spec->m_alignZUsingY = true;

	spec->m_pSpin.m_ageCurve.SetCurve(Stuff::Pi_Over_2);
	spec->m_pSpin.m_seeded = true;
	spec->m_pSpin.m_seedCurve.SetCurve(-1.0f, 1.0f);

	spec->m_pScale.m_ageCurve.SetCurve(0.2f);
	spec->m_pScale.m_seeded = false;
	spec->m_pScale.m_seedCurve.SetCurve(1.0f);

	spec->m_pIndex.m_ageCurve.SetCurve(0.0f, 3.999f);
	spec->m_pIndex.m_seeded = false;
	spec->m_pIndex.m_seedCurve.SetCurve(1.0f);

	spec->m_USize.SetCurve(0.5f);
	spec->m_VSize.SetCurve(0.5f);

	spec->m_animated = true;
	spec->m_width = 2;
	return spec;
}

//----------------------------------------------------------------------------
//
gosFX::EffectCloud::Specification*
	CreateEffectCloud(
		gosFX::EffectLibrary *library,
		unsigned index,
		unsigned effect,
		unsigned child
	)
{
	//
	//-----------------------------------------
	// Stick a new specification in the library
	//-----------------------------------------
	//
	Check_Object(library);
	Verify(!library->m_effects[index]);
	gosFX::EffectCloud::Specification* spec = new gosFX::EffectCloud::Specification;
	Check_Object(spec);
	library->m_effects[index] = spec;

	//
	//-------------------------
	// Build a simple FX holder
	//-------------------------
	//
	spec->m_name = "EffectCloud";
	spec->m_effectID = index;

	//
	//------------------
	// Set up the events
	//------------------
	//
	if (child < EFFECT_COUNT)
	{
		gosFX::Event *event = new gosFX::Event;
		Check_Object(event);
		event->m_time = 0.0f;
		event->m_flags = gosFX::Effect::DynamicWorldSpaceSimulationMode;
		event->m_effectID = child;
		event->m_localToParent = Stuff::LinearMatrix4D::Identity;
//		event->m_localToParent(3,1) = -1.5f;
		spec->AdoptEvent(event);
	}

	//
	//--------------------------
	// Set up the default curves
	//--------------------------
	//
	spec->BuildDefaults();

	//
	//-------------------------
	// Set up the effect curves
	//-------------------------
	//
	spec->m_lifeSpan.SetCurve(10.0f);

	spec->m_minimumChildSeed.SetCurve(0.0f);
	spec->m_maximumChildSeed.SetCurve(1.0f);

	//
	//---------------------------------
	// Set up the particle cloud curves
	//---------------------------------
	//
	spec->m_maxParticleCount = 12;

	spec->m_startingPopulation.SetCurve(3.0f);
	spec->m_particlesPerSecond.SetCurve(2.0f);

	spec->m_emitterSizeX.SetCurve(1.0f);
	spec->m_emitterSizeY.SetCurve(1.0f);
	spec->m_emitterSizeZ.SetCurve(1.0f);

	spec->m_minimumDeviation.SetCurve(0.0f);
	spec->m_maximumDeviation.SetCurve(Stuff::Pi_Over_6);

	spec->m_startingSpeed.m_ageCurve.SetCurve(2.0f);
	spec->m_startingSpeed.m_seeded = true;
	spec->m_startingSpeed.m_seedCurve.SetCurve(1.0f, 2.0f);

	spec->m_pLifeSpan.m_ageCurve.SetCurve(1.0f);
	spec->m_pLifeSpan.m_seeded = false;
	spec->m_pLifeSpan.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationX.m_ageCurve.SetCurve(0.0f);
	spec->m_pAccelerationX.m_seeded = false;
	spec->m_pAccelerationX.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationY.m_ageCurve.SetCurve(-2.0f);
	spec->m_pAccelerationY.m_seeded = false;
	spec->m_pAccelerationY.m_seedCurve.SetCurve(1.0f);

	spec->m_pAccelerationZ.m_ageCurve.SetCurve(0.0f);
	spec->m_pAccelerationZ.m_seeded = false;
	spec->m_pAccelerationZ.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityX.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityX.m_seeded = false;
	spec->m_pEtherVelocityX.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityY.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityY.m_seeded = false;
	spec->m_pEtherVelocityY.m_seedCurve.SetCurve(1.0f);

	spec->m_pEtherVelocityZ.m_ageCurve.SetCurve(0.0f);
	spec->m_pEtherVelocityZ.m_seeded = false;
	spec->m_pEtherVelocityZ.m_seedCurve.SetCurve(1.0f);

	spec->m_pDrag.m_ageCurve.SetCurve(0.0f);
	spec->m_pDrag.m_seeded = false;
	spec->m_pDrag.m_seedCurve.SetCurve(1.0f);

	spec->m_pRed.m_ageCurve.SetCurve(1.0f);
	spec->m_pRed.m_seeded = false;
	spec->m_pRed.m_seedCurve.SetCurve(1.0f);

	spec->m_pGreen.m_ageCurve.SetCurve(1.0f);
	spec->m_pGreen.m_seeded = false;
	spec->m_pGreen.m_seedCurve.SetCurve(1.0f);

	spec->m_pBlue.m_ageCurve.SetCurve(1.0f);
	spec->m_pBlue.m_seeded = false;
	spec->m_pBlue.m_seedCurve.SetCurve(1.0f);

	spec->m_pAlpha.m_ageCurve.SetCurve(1.0f);
	spec->m_pAlpha.m_seeded = false;
	spec->m_pAlpha.m_seedCurve.SetCurve(1.0f);

	//
	//----------------------------------
	// Fill in the Spinning cloud curves
	//----------------------------------
	//
	spec->m_particleEffectID = effect;
	spec->m_randomStartingRotation = false;
	spec->m_alignZUsingX = false;
	spec->m_alignZUsingY = false;

	spec->m_pSpin.m_ageCurve.SetCurve(Stuff::Pi_Over_2);
	spec->m_pSpin.m_seeded = true;
	spec->m_pSpin.m_seedCurve.SetCurve(-1.0f, 1.0f);

	spec->m_pScale.m_ageCurve.SetCurve(1.0f);
	spec->m_pScale.m_seeded = false;
	spec->m_pScale.m_seedCurve.SetCurve(1.0f);

	return spec;
}

//----------------------------------------------------------------------------
//
gosFX::Card::Specification*
	CreateCard(
		gosFX::EffectLibrary *library,
		unsigned index,
		MidLevelRenderer::MLRTexture *texture,
		unsigned child
	)
{
	//
	//-----------------------------------------
	// Stick a new specification in the library
	//-----------------------------------------
	//
	Check_Object(library);
	Verify(!library->m_effects[index]);
	gosFX::Card::Specification* spec =
		new gosFX::Card::Specification(gosFX::CardClassID);
	Check_Object(spec);
	library->m_effects[index] = spec;

	//
	//-------------------------
	// Build a simple FX holder
	//-------------------------
	//
	spec->m_name = "Card";
	spec->m_state.SetAlphaMode(MidLevelRenderer::MLRState::AlphaInvAlphaMode);
	spec->m_state.SetPriority(MidLevelRenderer::MLRState::AlphaPriority);
	Check_Object(texture);
	spec->m_state.SetTextureHandle(texture->GetTextureHandle());

	//
	//------------------
	// Set up the events
	//------------------
	//
	if (child < EFFECT_COUNT)
	{
		gosFX::Event *event = new gosFX::Event;
		Check_Object(event);
		event->m_time = 0.0f;
		event->m_flags = gosFX::Effect::DynamicWorldSpaceSimulationMode;
		event->m_effectID = child;
		event->m_localToParent = Stuff::LinearMatrix4D::Identity;
		spec->AdoptEvent(event);
	}

	//
	//--------------------------
	// Set up the default curves
	//--------------------------
	//
	spec->BuildDefaults();

	//
	//-------------------------
	// Set up the effect curves
	//-------------------------
	//
	spec->m_lifeSpan.SetCurve(1.0f);

	spec->m_minimumChildSeed.SetCurve(0.0f);
	spec->m_maximumChildSeed.SetCurve(1.0f);

	//
	//----------------------------
	// Set up the singleton curves
	//----------------------------
	//
	spec->m_red.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_red.m_seeded = false;
	spec->m_red.m_seedCurve.SetCurve(1.0f);

	spec->m_green.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_green.m_seeded = false;
	spec->m_green.m_seedCurve.SetCurve(1.0f);

	spec->m_blue.m_ageCurve.SetCurve(0.25f);
	spec->m_blue.m_seeded = false;
	spec->m_blue.m_seedCurve.SetCurve(1.0f);

	spec->m_alpha.m_ageCurve.SetCurve(1.0f);
	spec->m_alpha.m_seeded = false;
	spec->m_alpha.m_seedCurve.SetCurve(1.0f);

	spec->m_spin.m_ageCurve.SetCurve(1.0f);
	spec->m_spin.m_seeded = false;
	spec->m_spin.m_seedCurve.SetCurve(1.0f);

	spec->m_scale.m_ageCurve.SetCurve(0.2f);
	spec->m_scale.m_seeded = false;
	spec->m_scale.m_seedCurve.SetCurve(1.0f);

	spec->m_randomStartingRotation = true;
	spec->m_alignZUsingX = false;
	spec->m_alignZUsingY = false;

	//
	//-------------------------------
	// Fill in the Card cloud curves
	//-------------------------------
	//
	spec->m_halfHeight.m_ageCurve.SetCurve(1.0f);
	spec->m_halfHeight.m_seeded = false;
	spec->m_halfHeight.m_seedCurve.SetCurve(1.0f);

	spec->m_aspectRatio.m_ageCurve.SetCurve(1.0f);
	spec->m_aspectRatio.m_seeded = false;
	spec->m_aspectRatio.m_seedCurve.SetCurve(1.0f);

	spec->m_index.m_ageCurve.SetCurve(0.0f, 3.999f);
	spec->m_index.m_seeded = false;
	spec->m_index.m_seedCurve.SetCurve(1.0f);

	spec->m_USize.SetCurve(0.5f);
	spec->m_VSize.SetCurve(0.5f);

	spec->m_animated = true;
	spec->SetWidth();
//	spec->m_width = 2;

	return spec;
}

//----------------------------------------------------------------------------
//
gosFX::Tube::Specification*
	CreateTube(
		gosFX::EffectLibrary *library,
		unsigned index,
		MidLevelRenderer::MLRTexture *texture,
		unsigned child
	)
{
	//
	//-----------------------------------------
	// Stick a new specification in the library
	//-----------------------------------------
	//
	Check_Object(library);
	Verify(!library->m_effects[index]);
	gosFX::Tube::Specification* spec = new gosFX::Tube::Specification;
	Check_Object(spec);
	library->m_effects[index] = spec;

	//
	//-------------------------
	// Build a simple FX holder
	//-------------------------
	//
	spec->m_name = "Tube";
	spec->m_state.SetAlphaMode(MidLevelRenderer::MLRState::OneOneMode);
	spec->m_state.SetPriority(MidLevelRenderer::MLRState::AlphaPriority);
	Check_Object(texture);
	spec->m_state.SetTextureHandle(texture->GetTextureHandle());

	//
	//------------------
	// Set up the events
	//------------------
	//
	if (child < EFFECT_COUNT)
	{
		gosFX::Event *event = new gosFX::Event;
		Check_Object(event);
		event->m_time = 0.0f;
		event->m_flags = gosFX::Effect::DynamicWorldSpaceSimulationMode;
		event->m_effectID = child;
		event->m_localToParent = Stuff::LinearMatrix4D::Identity;
		spec->AdoptEvent(event);
	}

	//
	//--------------------------
	// Set up the default curves
	//--------------------------
	//
	spec->BuildDefaults();
	spec->m_lifeSpan.SetCurve(4.0f);

#if 0
	spec->m_minimumDeviation.SetCurve(0.0);
	spec->m_maximumDeviation.SetCurve(1.0f);

	spec->m_pDisplacement.m_ageCurve.SetCurve(0.0f, 2.0f);
	spec->m_pDisplacement.m_seeded = false;
	spec->m_pDisplacement.m_seedCurve.SetCurve(1.0f);
#endif

	//
	//---------------------------------
	// Set up the particle cloud curves
	//---------------------------------
	//
	spec->m_maxProfileCount = 21;
	spec->m_profileType = gosFX::Tube::Specification::e_Pentagon;
	spec->m_insideOut = false;
	spec->BuildTemplate();

	spec->m_profilesPerSecond.SetCurve(10.0f);
	spec->m_pLifeSpan.SetCurve(2.0f);

	return spec;
}

//----------------------------------------------------------------------------
//
gosFX::Beam::Specification*
	CreateBeam(
		gosFX::EffectLibrary *library,
		unsigned index,
		MidLevelRenderer::MLRTexture *texture,
		unsigned child
	)
{
	//
	//-----------------------------------------
	// Stick a new specification in the library
	//-----------------------------------------
	//
	Check_Object(library);
	Verify(!library->m_effects[index]);
	gosFX::Beam::Specification* spec = new gosFX::Beam::Specification;
	Check_Object(spec);
	library->m_effects[index] = spec;

	//
	//-------------------------
	// Build a simple FX holder
	//-------------------------
	//
	spec->m_name = "Beam";
	spec->m_state.SetAlphaMode(MidLevelRenderer::MLRState::OneOneMode);
	spec->m_state.SetPriority(MidLevelRenderer::MLRState::AlphaPriority);
	Check_Object(texture);
	spec->m_state.SetTextureHandle(texture->GetTextureHandle());

	//
	//------------------
	// Set up the events
	//------------------
	//
	if (child < EFFECT_COUNT)
	{
		gosFX::Event *event = new gosFX::Event;
		Check_Object(event);
		event->m_time = 0.0f;
		event->m_flags = gosFX::Effect::DynamicWorldSpaceSimulationMode;
		event->m_effectID = child;
		event->m_localToParent = Stuff::LinearMatrix4D::Identity;
		spec->AdoptEvent(event);
	}

	//
	//--------------------------
	// Set up the default curves
	//--------------------------
	//
	spec->BuildDefaults();
	spec->m_lifeSpan.SetCurve(4.0f);

#if 0
	spec->m_minimumDeviation.SetCurve(0.0);
	spec->m_maximumDeviation.SetCurve(1.0f);

	spec->m_pDisplacement.m_ageCurve.SetCurve(0.0f, 2.0f);
	spec->m_pDisplacement.m_seeded = false;
	spec->m_pDisplacement.m_seedCurve.SetCurve(1.0f);
#endif

	//
	//---------------------------------
	// Set up the particle cloud curves
	//---------------------------------
	//
	spec->m_maxProfileCount = 21;
	spec->m_profileType = gosFX::Beam::Specification::e_Pentagon;
	spec->m_insideOut = false;
	spec->BuildTemplate();

	spec->m_profilesPerMeter.SetCurve(2.43f);

	return spec;
}

//----------------------------------------------------------------------------
//
gosFX::Flare::Specification*
	CreateFlare(
		gosFX::EffectLibrary *library,
		unsigned index,
		MidLevelRenderer::MLRTexture *texture,
		unsigned child
	)
{
	//
	//-----------------------------------------
	// Stick a new specification in the library
	//-----------------------------------------
	//
	Check_Object(library);
	Verify(!library->m_effects[index]);
	gosFX::Flare::Specification* spec =
		new gosFX::Flare::Specification;
	Check_Object(spec);
	library->m_effects[index] = spec;

	//
	//-------------------------
	// Build a simple FX holder
	//-------------------------
	//
	spec->m_name = "Flare";
	spec->m_state.SetAlphaMode(MidLevelRenderer::MLRState::AlphaInvAlphaMode);
	spec->m_state.SetPriority(MidLevelRenderer::MLRState::AlphaPriority);
	Check_Object(texture);
	spec->m_state.SetTextureHandle(texture->GetTextureHandle());

	//
	//------------------
	// Set up the events
	//------------------
	//
	if (child < EFFECT_COUNT)
	{
		gosFX::Event *event = new gosFX::Event;
		Check_Object(event);
		event->m_time = 0.0f;
		event->m_flags = gosFX::Effect::DynamicWorldSpaceSimulationMode;
		event->m_effectID = child;
		event->m_localToParent = Stuff::LinearMatrix4D::Identity;
		spec->AdoptEvent(event);
	}

	//
	//--------------------------
	// Set up the default curves
	//--------------------------
	//
	spec->BuildDefaults();

	//
	//-------------------------
	// Set up the effect curves
	//-------------------------
	//
	spec->m_lifeSpan.SetCurve(1.0f);

	spec->m_minimumChildSeed.SetCurve(0.0f);
	spec->m_maximumChildSeed.SetCurve(1.0f);

	//
	//----------------------------
	// Set up the singleton curves
	//----------------------------
	//
	spec->m_red.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_red.m_seeded = false;
	spec->m_red.m_seedCurve.SetCurve(1.0f);

	spec->m_green.m_ageCurve.SetCurve(1.0f, 0.0f);
	spec->m_green.m_seeded = false;
	spec->m_green.m_seedCurve.SetCurve(1.0f);

	spec->m_blue.m_ageCurve.SetCurve(0.25f);
	spec->m_blue.m_seeded = false;
	spec->m_blue.m_seedCurve.SetCurve(1.0f);

	spec->m_alpha.m_ageCurve.SetCurve(1.0f);
	spec->m_alpha.m_seeded = false;
	spec->m_alpha.m_seedCurve.SetCurve(1.0f);

	spec->m_scale.m_ageCurve.SetCurve(0.2f);
	spec->m_scale.m_seeded = false;
	spec->m_scale.m_seedCurve.SetCurve(1.0f);

	return spec;
}

