/****************************************************************************************************

		I3DParticleEmitter.h
		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Charles
		Date:	3/21/2002

****************************************************************************************************/

#ifndef __I3DParticleEmitter__
#define __I3DParticleEmitter__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCCompObj.h"

MCDEFINE_GUID(IID_I3DParticleEmitter, 0x99d66702, 0xdbbe, 0x11d2, 0xa0, 0x37, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);


/// \addtogroup ExternalInterface
/// \{


// ****************************************************************************
//								I3DParticleEmitter
//  
/// This interface just gives us a way to safely cast into a particle emitter.
/// 
/// \param ParticleNb  
/// 
struct I3DParticleEmitter : public IMCUnknown
{ 
	/// Define a particle property
	enum EParticleProp 
	{
		kProp_Age = 0,		///< Age of the particle
		kProp_Size,			///< Size of the particle
		kProp_Mass,			///< Mass of the particle
		kProp_Speed,		///< Velocity of the particle
		kProp_Order,		///< Index of the particle
		kProp_Last=0xffffffff
	};

	// ****************************************************************************
	//								GetParticleColorInterpolant
	// 
	/// Return the color between 0 and 1 of a particle property
	/// 
	/// \param ParticleNb  Index of the particle
	/// \param property    Type of property to pick
	/// 
	virtual real MCCOMAPI GetParticleColorInterpolant( uint32 ParticleNb, EParticleProp property ) = 0;


	// ****************************************************************************
	//								ChangeLocalSpaceInHit
	// 
	/// Set local space in hit to match particle's space and not emitter's space
	/// 
	/// \param ParticleNb  Index of the particle
	/// \param hit         The hit to modify
	/// 
	virtual void MCCOMAPI ChangeLocalSpaceInHit( uint32 ParticleNb, RayHit3D &hit ) = 0;

	// ****************************************************************************
	//								IsSceneDependent
	// 
	/// Returns true if the particle system needs the scene to be updated during the
	/// simulation (free particles). 
	/// 
	virtual boolean MCCOMAPI IsSceneDependent() = 0;

	// ****************************************************************************
	//								GetCurrentState
	// 
	/// Returns the state of the current particle simulation that is to say the time
	/// up to which the simulation has been calculated.
	///
	/// \param simulationTime  Reference to where the time should be stored
	/// 
	virtual void MCCOMAPI GetCurrentState(MicroTick& simulationTime) =0;


	// ****************************************************************************
	//								UpdateSimulation
	// 
	/// Update the particle system up to a new time. Time must be superior or equal
	/// to the time returned by GetCurrentState.
	/// 
	/// \param time              Target time for the particule simulation
	/// \param maxDelta          Maximum time before next simulation
	/// \param emitterTransform  The transform of the emitter at the target time
	/// 
	virtual void MCCOMAPI UpdateSimulation(MicroTick time, MicroTick maxDelta, const TTransform3D& emitterTransform)=0;

	// ****************************************************************************
	//								BeginRendering
	// 
	/// Called just before a rendering
	/// 
	virtual void MCCOMAPI BeginRendering()=0;

	// ****************************************************************************
	//								EndRendering
	// 
	/// Called just after a rendering
	/// 
	virtual void MCCOMAPI EndRendering()=0;
	
};

/// \}

#endif
