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

		I3DShInstance.h

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

		Author:	Ray Dream
		Date:	04/16/99

		Revision History

		when		who			what & why
		==========	==========	======================================================
		11/23/99	Yann		Removed I3DShInstance::GetFlatness
		10/27/99	Yann		Fixed MacOS compilation warning on enums
		09/17/99	Gilles		Added Support for Smart BackFaceCulling
		08/10/99	Arnaud		FacetMesh is now counted.
		29/07/99	EricB		added I3DShInstace::UsesDefaultShader (return true if no shader is specified for this instance)
		04/16/99	Charles		Created

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

#ifndef __I3DSHINSTANCE__
#define __I3DSHINSTANCE__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCCompObj.h"
#include "ApiTypes.h"
#include "MCCountedPtr.h"
#include "TreeTypes.h"
#include "ComTypes.h"
#include "Matrix33Fwd.h"
#include "LodParamEnum.h"

class TMCRealRect;
class TBBox3D;
class TAbsorptionFunction;

//****** Globally Unique Ids **************************************************
MCDEFINE_GUID_H(IID_I3DShInstance);
MCDEFINE_GUID_H(IID_I3DInstanceListener);
MCDEFINE_GUID_H(CLSID_StandardInstance);


/*****************************************************************************\
*  I3DShInstance                                                              *
*                                                                             *
*    I3DShInstance defines the object instances in the tree                   *
*    It can return a I3DShTreeElement interface on demand.                    *
*                                                                             *
\*****************************************************************************/

enum
{
	kUVMapColor=1,
	kUVMapHighlight=2,
	kUVMapShininess=4,
	kUVMapBump=8,
	kUVMapReflection=16,
	kUVMapTransparency=32,
	kUVMapRefraction=64,
	kUVMapGlow=128
};

enum EChannelIndex
{
	kUVMapColorIndex,
	kUVMapAlphaIndex,
	kUVMapHighlightIndex,
	kUVMapShininessIndex,
	kUVMapBumpIndex,
	kUVMapReflectionIndex,
	kUVMapTransparencyIndex,
	kUVMapRefractionIndex,
	kUVMapGlowIndex
};

enum
{
	kNbrUVMapsIndices=9
};

// type of backface culling
enum EBackfaceMode
{
	kShowBackface,	///< Always draw the backfaces.
	kSmartBackface, ///< Show the backfaces depending on the orientation
	kHideBackface   ///< Never show the backfaces
};

#define UVMapIndexToMask(index) (1<<index)

class UVMaps;

struct MapParams : TMCObject
{
	boolean  fFlipVert;          ///< true if and only if the map should be flipped FROM ITS ORIGINAL orientation
	boolean  fFlipHoriz;		 ///< true if and only if the map should be flipped FROM ITS ORIGINAL orientation
	real     fBrightness;        ///< A real number between zero and one
	int16    fNinetyDegreeCount; ///<	number between 0 and 3 indicating the number of rotations to do on the map
};

struct TZBInfo;
struct IShLineArt;
struct I3DShCamera;
struct FacetMesh;

struct ShadingFlags;
struct ShadingIn;
struct ShadingOut;
struct ShadedArea;

struct ShadingShape;
struct RayHitParameters;
struct I3DExReflectionFeature;
struct I3DExRefractionFeature;
struct I3DShReflectionFeature;
struct I3DShRefractionFeature;
struct I3DShObject;
struct I3DShMasterShader;
struct IShTextureMapBucketCache;
struct RayHit3D;
struct UVSpaceInfo;
struct LightingDetail;
struct LightingContext;

class  TMCString;
class  TInstanceRenderable;
		
typedef void (*TextureAvailableProc)(void * privData);


struct TInstanceRenderingCache;
struct TRenderingCacheLock;
struct I3DInstanceListener;


/// \addtogroup ShellInterface
/// \{

/// I3DShInstance represents a copy of a primitive located at a certain position
/// in space, with a certain orientation and scaling and a given shader.
///
/// <P>Instances always support the following interfaces : I3DShTreeElement,
/// I3DShShadableTree, ISelectableObject</P>
///
struct I3DShInstance: public IMCUnknown
{
	/// These are the constants returned from GetInstanceKind()
	enum EInstanceKind
	{
		kPrimitiveInstance	= 1,
		kSceneInstance		= 2,
		kCameraInstance		= 3,
		kLightInstance		= 4,
		
		kInstanceKind_Max		= 0x7fffffff // not a valid constant
	};

	enum EInstanceType
	{
		kStandardInstance				= 0x0000,
		kSubInstance					= 0x0001,
		kSubInstanceWithUniformScaling	= 0x0002,
	};

	// ****************************************************************************
	//								Get3DObject
	// 
	/// Returns a pointer to the Master Object that stores the geometry associated
	/// with this instance.
	///
	/// <P>Note that you should call GetDeformed3DObject() if you want to have the
	/// geometry of the instance once the deformers have been applied.</P>
	/// 
	/// \param object  A pointer to the master object.
	/// 
	virtual MCCOMErr MCCOMAPI Get3DObject(I3DShObject** object) = 0;
	
	// ****************************************************************************
	//								Set3DObject
	// 
	/// Sets the Master Object that stores the geometry associated
	/// with this instance.
	/// 
	/// \param object  A pointer to the master object.
	/// 
	virtual MCCOMErr MCCOMAPI Set3DObject(I3DShObject* object) = 0;

	// ****************************************************************************
	//								SetShader
	// 
	/// Sets the master shader that is applied to the instance.
	/// 
	/// \param masterShader  The master shader
	/// 
	virtual MCCOMErr MCCOMAPI SetShader(I3DShMasterShader * masterShader) = 0;
	
	// ****************************************************************************
	//								GetShader
	// 
	/// Returns the master shader.
	/// 
	/// \param masterShader  The master shader
	/// 
	virtual MCCOMErr MCCOMAPI GetShader(I3DShMasterShader ** masterShader) = 0;
	
	// ****************************************************************************
	//								UsesDefaultShader
	// 
	/// Returns true if the instance has the default shader applied to it.
	/// 
	virtual boolean  MCCOMAPI UsesDefaultShader() = 0;

	// ****************************************************************************
	//								GetUVSpaceCount
	// 
	/// Returns the number of shading domaine on the instance.
	/// 
	virtual uint32   MCCOMAPI GetUVSpaceCount() = 0;
	
	// ****************************************************************************
	//								GetUVSpace
	// 
	/// Return the description of a given shading domaine.
	/// 
	/// \param uvSpaceID    The index of the shading domaine.
	/// \param uvSpaceInfo  The information that is returned.
	/// 
	virtual MCCOMErr MCCOMAPI GetUVSpace(uint32 uvSpaceID, UVSpaceInfo* uvSpaceInfo) = 0;

	// ****************************************************************************
	//								GetUVSpaceShader
	// 
	/// Return the master shader of a given shading domaine.
	/// 
	/// \param uvSpaceID    The index of the shading domaine.
	/// \param masterShader The master shader.
	/// 
	virtual MCCOMErr MCCOMAPI GetUVSpaceShader(uint32 uvSpaceID, I3DShMasterShader ** masterShader) = 0;

	// ****************************************************************************
	//								SetUVSpaceShader
	// 
	/// Set the master shader of a given shading domaine.
	/// 
	/// \param uvSpaceID    The index of the shading domaine.
	/// \param masterShader The master shader.
	/// 
	virtual MCCOMErr MCCOMAPI SetUVSpaceShader(uint32 uvSpaceID, I3DShMasterShader * masterShader) = 0;
	
	// ****************************************************************************
	//								GetShadingFlags
	// 
	/// Returns the flags of the master shader.
	/// 
	/// \param theFlags  The flags of the shader.
	/// 
	virtual MCCOMErr MCCOMAPI GetShadingFlags(ShadingFlags& theFlags) = 0;

	// ****************************************************************************
	//								DoShade
	// 
	/// Returns the shading of a point located on this instance.
	/// 
	/// \param shadingOut  The returned shading information.
	/// \param shadingIn   The information about the point.
	/// 
	virtual MCCOMErr MCCOMAPI DoShade(ShadingOut &shadingOut,ShadingIn &shadingIn) = 0;


	// ****************************************************************************
	//								CanBeTransparent
	// 
	/// Returns true if the current shading domain can contain transparent areas or
	/// alpha channel different from 1.
	/// 
	/// \param shadingDomainIndex		The index of the shading domain
	/// 
	virtual boolean MCCOMAPI CanBeTransparent(int32 shadingDomainIndex) = 0;

	// ****************************************************************************
	//								GetShaderApproximation
	// 
	/// Returns the shading of a point located on this instance.
	/// 
	/// \param shadingOut  The returned shading information.
	/// \param shadingIn   The information about the point.
	/// 
	virtual void MCCOMAPI GetShaderApproximation(ShadingOut &shadingOut,ShadingIn &shadingIn)=0;
	
	// ****************************************************************************
	//								GetBump
	// 
	/// Not implemented.
	/// 
	/// 
	virtual MCCOMErr MCCOMAPI GetBump(TVector3 &result,ShadingIn &shadingIn) = 0;

	// ****************************************************************************
	//								GetMainColors
	// 
	/// Return an approximation of the shading.
	///
	/// 
	virtual MCCOMErr MCCOMAPI GetMainColors(TMCColorRGBA& color1, TMCColorRGBA& color2) = 0;
	
	// ****************************************************************************
	//								ShaderModified
	// 
	/// Notify the instance that its shader has been modified.
	/// 
	virtual MCCOMErr MCCOMAPI ShaderModified()=0;

	// ****************************************************************************
	//								GetFlatennedTexturesSync
	// 
	/// Calculates a set of texture maps that approximates the shading on the instance.
	/// 
	/// \param uvSpaceID      The shading domain index.
	/// \param maps           The maps that are returned.
	/// \param wantsProgress  True if a progress bar should be displayed during the calculation.
	/// \param range          The UV range. If nil the default is [0,1]x[0,1]. The range is different only on old raydream objects.
	/// 
	virtual MCCOMErr MCCOMAPI GetFlatennedTexturesSync(uint32 uvSpaceID, UVMaps & maps, boolean wantsProgress, TMCRealRect * range = nil) const = 0;
	
	// ****************************************************************************
	//								GetFlatennedTexturesAsync
	// 
	/// Same as GetFlatennedTexturesSync() but the calculation is done in a thread and
	/// the maps are only returned once they have been calculated.
	/// 
	virtual MCCOMErr MCCOMAPI GetFlatennedTexturesAsync(uint32 uvSpaceID, UVMaps & maps, TextureAvailableProc proc, void * privData, TMCRealRect * range = nil) const = 0;
	
    // ****************************************************************************
    //                             GetRecommendedTextureSize
    //
    /// Calculate the intrinsic appropriate texture size.
    // \return true if there is such a size, or false of the texture is procedural 
    virtual boolean  MCCOMAPI GetRecommendedTextureSize(uint32 uvSpaceID, uint32 channelIndex, uint32& width, uint32& height) const = 0;

    // ****************************************************************************
    //                             GetRelevantTextureBucketCache
    //
    /// Get the texture map file associated to the specified shading domain.
    virtual void MCCOMAPI GetRelevantTextureBucketCache(uint32 uvSpaceID, uint32 channelIndex, boolean allowMultiplierModification, IShTextureMapBucketCache **outTextureMapFile) const = 0;
    
	// ****************************************************************************
	//								FlushFlatennedTextureCaches
	// 
	/// Delete the caches of the flattened textures.
	/// 
	virtual MCCOMErr MCCOMAPI FlushFlatennedTextureCaches() = 0;
	
	// ****************************************************************************
	//								SetShadingFromMaps
	// 
	/// Undocumented.
	///
	virtual MCCOMErr MCCOMAPI SetShadingFromMaps(uint32 uvSpaceID, UVMaps & maps, MapParams* mapParams, TMCRealRect * range = nil) = 0;

	// ****************************************************************************
	//								GetBoundingBox
	// 
	/// Returns the bounding box of the instance in local coordinates.
	/// 
	/// \param bbox        The bounding box that is returned.
	/// \param deformMode  The way the deformers are applied for this calculation (see ETreeDeformBBoxModes)
	/// \param rendering   True if you want a bounding box for rendering (see also GetRenderingFacetMesh())
	/// 
	virtual void	 MCCOMAPI GetBoundingBox(TBBox3D &bbox, ETreeDeformBBoxModes deformMode, boolean rendering=true)= 0;
	
	// ****************************************************************************
	//								GetFacetBoundingBox
	// 
	/// The bounding box calculated here fit exactly the facets of the object in a given direction.
	/// The FacetBounding boxes are cached inside the Object because it can take a long time to calculate.
	/// We added a listener here to accelerate the Get. So we don't have to compare mappingTransform (TMatrix33) in the look-up table.
	/// A last hit is provide inside the GetFacetBoundingBox method to make the Get on same listener very fast.
	/// Each time the BoudingBox of the object changed , the list is flushed.
	/// Each time you ask with a new mappingTransform, increment the matrixChangedPhase
	/// 
	/// \param bbox                The bouding box that is calculated
	/// \param deformMode          The way the deformers are applied for this calculation (see ETreeDeformBBoxModes)
	/// \param mappingTransform    The transform of the bounding box
	/// \param listener            A listener
	/// \param matrixChangedPhase  Each time you ask with a new mappingTransform, increment the matrixChangedPhase.
	/// 
	virtual void	 MCCOMAPI GetFacetBoundingBox(  TBBox3D &bbox, ETreeDeformBBoxModes deformMode, const TMatrix33 &mappingTransform, void *listener, uint32 matrixChangedPhase ) = 0;

	// ****************************************************************************
	//								Dehydrate
	// 
	/// \deprecated Do not use !
	///
	virtual MCCOMErr MCCOMAPI Dehydrate( int16 level) = 0;
	
	// ****************************************************************************
	//								RayHit
	// 
	/// Calculates the intersection of a Ray and the instance. (The ray should be
	/// in local coordinates of the instance.
	/// 
	/// \param param  The parameters of the raytracing.
	/// 
	virtual boolean  MCCOMAPI RayHit( RayHitParameters &param) = 0;
	
	// ****************************************************************************
	//								RayHitFacet
	// 
	/// calculates the intersection between a ray and a triangle of a primitive. Note
	/// that if the primitive is self-Raytracable, the facetIndex is ignored and the
	/// intersection is calculated with the whole primitive.
	/// 
	/// \param params      the raytracing parameters (ray, hit...)
	/// \param facetIndex  the index of the facet to intersect
	/// \param lod         the lod of the primitive from which the facet is coming from
	///
	virtual boolean  MCCOMAPI RayHitFacet( RayHitParameters &params,uint32 facetIndex,real lod)=0;

	// ****************************************************************************
	//								GetDeformed3DObject
	// 
	/// Returns a master object that stores the geometry of the instance once the
	/// deformer have been applied.
	/// 
	/// \param object  The deformed object.
	/// 
	virtual MCCOMErr MCCOMAPI GetDeformed3DObject(I3DShObject** object) = 0;

	// ****************************************************************************
	//								GetURL
	// 
	/// Returns the URL associated with the instance.
	/// 
	virtual MCCOMErr MCCOMAPI GetURL(TMCString& name, int16 & kind) = 0;
	
	// ****************************************************************************
	//								SetURL
	// 
	/// Sets the URL associated with the instance.
	/// 
	virtual MCCOMErr MCCOMAPI SetURL(const TMCString& name, int16 kind) = 0;
	
	// ****************************************************************************
	//								GetClassSignature
	// 
	/// Returns the Class ID of the external object that is associated with the
	/// instance. For a primitive it is the class ID of the external primitive,
	/// for a light it is the class ID of the light source, for a camera it is
	/// the class ID of the camera. 
	/// 
	virtual int32    MCCOMAPI GetClassSignature() = 0;
	
	// ****************************************************************************
	//								GetInstanceKind
	// 
	/// Returns the instance Kind (see EInstanceKind).
	/// 
	/// 
	virtual int32    MCCOMAPI GetInstanceKind() = 0;

	// ****************************************************************************
	//								GetInstanceType
	// 
	/// Returns the instance type (see EInstanceType).
	/// 
	/// 
	virtual int32    MCCOMAPI GetInstanceType() = 0;
	
	// ****************************************************************************
	//								IsVolumeInstance
	// 
	/// Returns true if the instance is a volume primitive.
	/// 
	virtual boolean  MCCOMAPI IsVolumeInstance() = 0;
	
	// ****************************************************************************
	//								UsesShaders
	// 
	/// Returns true if the instance uses the shaders that are applyed to it.
	/// 
	virtual boolean  MCCOMAPI UsesShaders() const = 0;

	// ****************************************************************************
	//								GetFacetMesh
	// 
	/// Returns the facet mesh of the instance for a given level of details.
	/// 
	/// \param lod   The level of details requested.
	/// 
	virtual FacetMesh* MCCOMAPI GetFacetMesh(real lod) = 0;

	// ****************************************************************************
	//								GetRenderingFacetMesh
	// 
	/// Returns the facet mesh used for the final rendering
	/// 
	virtual FacetMesh* MCCOMAPI GetRenderingFacetMesh() = 0;
		
	// ****************************************************************************
	//								GetIndex
	// 
	/// Returns the index of the instance in the master group that contains it. This
	/// is the index that is stored in the instance index GBuffer.
	/// 
	/// \param index  The index of the instance.
	/// 
	virtual MCCOMErr MCCOMAPI GetIndex(int32 &index) = 0;
	
	// ****************************************************************************
	//								GetVertexUV
	// 
	/// Returns the texture coordinates of a 3D point on the surface of the instance.
	/// 
	/// \param res        True if the points is on the instance
	/// \param theVertex  The position of the point in 3D.
	/// \param theUV      The texture coordinates.
	/// 
	//virtual MCCOMErr MCCOMAPI GetVertexUV(boolean &res,const TVector3 &theVertex,TVector2 &theUV) = 0;

	// ****************************************************************************
	//								CastsShadow
	// 
	/// Returns true if the instance is casting shadows on other objects.
	/// 
	virtual boolean  MCCOMAPI CastsShadow() = 0;

	// ****************************************************************************
	//								ReceivesShadow
	// 
	/// Returns true if other objects can cast shadows on this object.
	/// 
	virtual boolean  MCCOMAPI ReceivesShadow() = 0;

	// ****************************************************************************
	//								GetReflectionFeature
	// 
	/// Returns a pointer to the reflection feature of this instance.
	/// 
	/// \param reflectionFeature  The reflection feature.
	/// 
	virtual MCCOMErr MCCOMAPI GetReflectionFeature(I3DExReflectionFeature** reflectionFeature) = 0;
	
	// ****************************************************************************
	//								GetRefractionFeature
	// 
	/// Returns a pointer to the refraction feature of this instance.
	/// 
	/// \param refractionFeature  The refraction feature.
	/// 
	virtual MCCOMErr MCCOMAPI GetRefractionFeature(I3DExRefractionFeature** refractionFeature) = 0;

	// ****************************************************************************
	//								SetReflectionFeature
	// 
	/// Sets reflection feature of this instance.
	/// 
	/// \param feature    The reflection feature.
	/// \param cloneMode  The clone mode (see ECloneMode).
	/// 
	virtual MCCOMErr MCCOMAPI SetReflectionFeature(I3DShReflectionFeature* feature, ECloneMode cloneMode) = 0;

	// ****************************************************************************
	//								SetReflectionFeatureByID
	// 
	/// Sets type of reflection feature of this instance.
	/// 
	/// \param kindID    The class ID of the reflection feature.
	/// 
	virtual MCCOMErr MCCOMAPI SetReflectionFeatureByID(int32 kindID) = 0;

	// ****************************************************************************
	//								GetReflectionFeature
	// 
	/// Returns a pointer to the reflection feature of this instance.
	/// 
	/// \param reflectionFeature  The reflection feature.
	/// 
	virtual MCCOMErr MCCOMAPI GetReflectionFeature(I3DShReflectionFeature** reflectionFeature) = 0;

	// ****************************************************************************
	//								SetRefractionFeature
	// 
	/// Sets refraction feature of this instance.
	/// 
	/// \param feature    The refraction feature.
	/// \param cloneMode  The clone mode (see ECloneMode).
	/// 
	virtual MCCOMErr MCCOMAPI SetRefractionFeature(I3DShRefractionFeature* feature, ECloneMode cloneMode) = 0;
	
	// ****************************************************************************
	//								SetRefractionFeatureByID
	// 
	/// Sets type of refraction feature of this instance.
	/// 
	/// \param kindID  The class ID of the refraction feature.
	/// 
	virtual MCCOMErr MCCOMAPI SetRefractionFeatureByID(int32 kindID) = 0;
	
	// ****************************************************************************
	//								GetRefractionFeature
	// 
	/// Returns a pointer to the refraction feature of this instance.
	/// 
	/// \param refractionFeature  The refraction feature.
	/// 
	virtual MCCOMErr MCCOMAPI GetRefractionFeature(I3DShRefractionFeature** refractionFeature) = 0;

	// ****************************************************************************
	//								SetBackfaceMode
	// 
	/// Sets the backface culling mode (see EBackfaceMode).
	/// 
	/// \param BackfaceMode  The backface culling mode (see EBackfaceMode).
	/// 
	virtual MCCOMErr		MCCOMAPI SetBackfaceMode(EBackfaceMode BackfaceMode) = 0;
	
	// ****************************************************************************
	//								GetBackfaceMode
	// 
	/// Returns the backface culling mode (see EBackfaceMode).
	/// 
	virtual EBackfaceMode	MCCOMAPI GetBackfaceMode() = 0;

	// ****************************************************************************
	//								GetTreeElement
	// 
	/// Returns a pointer to the I3DShTreeElement interface.
	/// 
	virtual	I3DShTreeElement*	MCCOMAPI GetTreeElement() = 0;

	// ****************************************************************************
	//								SetTemporaryCache
	// 
	/// Sets a temporary cache on the instance (example when calculating a postrenderer per instance such as Aura3D)
	/// 
	/// \param cache  A pointer to a cache. Null if you want to delete the cache
	/// 
	virtual void MCCOMAPI  SetTemporaryCache(IMCUnknown* cache) = 0;

	// ****************************************************************************
	//								GetTemporaryCache
	// 
	/// Returns a pointer to the temporary cache store with SetTemporaryCache
	/// 
	virtual const IMCUnknown* MCCOMAPI  GetTemporaryCache() = 0;


	// ****************************************************************************
	//								SetDisplacementMapping
	// 
	/// Enable/Disable the displacement mapping for this instance
	/// 
	/// \param value  True if the displacement mapping is enabled.
	/// 
	//virtual void MCCOMAPI SetDisplacementMapping(boolean value) = 0;


	// ****************************************************************************
	//								LockRenderingCaches
	// 
	/// Takes a lock on the rendering caches. You should call this function before
	/// you start to build a new cache.
	///
	/// The destructor of TRenderingCacheLock will release the lock. So you should
	/// destroy the lock once you have set the cache on the instance.
	/// 
	virtual void MCCOMAPI LockRenderingCaches(TRenderingCacheLock& lock) = 0;

	// ****************************************************************************
	//								SetRenderingCache
	// 
	/// Stores a rendering cache on the instance. Note that this caches are detroyed
	/// when the rendering is finished.
	///
	/// Make sure you call LockRenderingCaches() before calculating your
	/// cache.
	/// 
	/// \param cacheType      The type of the cache.
	/// \param cache          A pointer to the cache itself
	/// 
	virtual void MCCOMAPI SetRenderingCache(const IDType cacheType,TInstanceRenderingCache* cache)=0;

	// ****************************************************************************
	//								GetRenderingCache
	// 
	/// Retrieves a pointer to a rendering cache. Note that you will need to be in
	/// a critical section (see LockRenderingCaches()) to make sure that the cache
	/// does not exist already. However you can still call this function without
	/// being in a critical section to get the cache
	/// 
	/// \param cacheType      The type of the cache.
	/// \param instanceIndex  
	/// 
	virtual TInstanceRenderingCache*	MCCOMAPI GetRenderingCache(IDType cacheType,uint32 instanceIndex)=0;

	// ****************************************************************************
	//								DeleteRenderingCaches
	// 
	/// Delete all the rendering caches (at the end of a frame)
	/// 
	virtual void MCCOMAPI DeleteRenderingCaches()=0;

	// ****************************************************************************
	//								IsGenerator
	// 
	/// Return true if this an instance of a generator and therefore could generate other instances.
	/// 
	virtual boolean		IsGenerator() const = 0;


	///Sets a renderable that overrides the default instance renderable
	virtual	void				 MCCOMAPI	SetOverrideRenderable	(TInstanceRenderable*	inOverrideRenderable) = 0;

	///Gets the renderable currently overriding the default instance renderable (usually null)
	virtual	TInstanceRenderable* MCCOMAPI	GetOverrideRenderable	() = 0;

	// ****************************************************************************
	//								ShadeAndLight2
	// 
	/// Calculate the lighting and shading of a point located on this instance.
	/// 
	/// \param result           The resulting color and lighting info
	/// \param lightingContext  All the info about the point to light and the lighting of the scene
	/// 
	virtual void MCCOMAPI	 ShadeAndLight2(LightingDetail& result,const LightingContext& lightingContext,TAbsorptionFunction* absorptionFunction)=0;
	// ****************************************************************************
	//								GetLodParamType
	// 
	/// \return The type of information used to calculate the appropriate LOD
	/// 
	virtual ELODParamType	MCCOMAPI GetLODParamType() const = 0;
};

/// \}




/// \addtogroup ShellInterface
/// \{

struct I3DInstanceListener : public IMCUnknown
{
	virtual void		MCCOMAPI TreeTransformHasChanged(I3DShInstance* instance) = 0;
	virtual void		MCCOMAPI InstanceMasterShaderHasChanged(I3DShInstance* instance) = 0;
};

/// \}



#endif
