///////////////////////////////////////////////////////////////////////////////
//
// File: AVP_GlowOutlines.h
//
// Created by Andrew Southgate 25/07/2008
// 
// Copyright (C) 2008 Rebellion, All Rights Reserved.
//
// Handles AVP Skin outline glow effect
//
///////////////////////////////////////////////////////////////////////////////

#include "Visibility/Asura_Visibility_System.h"
#include "Core/Asura_RingBuffer.h"
#include "Core/Asura_Timers.h"
#include "Core/Asura_Hashtree.h"
#include "Rendering/Asura_Colour.h"
#include "Rendering/Asura_SortedRender.h"

class Asura_Animation;



class AVP_GlowOutlines
{
	struct DepthSortedSkinEntry
	{
		DepthSortedSkinEntry *m_pxNext;
		Asura_SortedRenderItem_Animation m_xSortedRenderItem;
		float m_fDistanceToCamera;
		Asura_RGBA m_xColour;
	};

	static void Platform_Render( DepthSortedSkinEntry * const *pxBuffer);
	static void Platform_Initialise();
	static void Platform_Shutdown();

	static const u_int													NUM_DEPTH_SORT_SLOTS = 500;
	static float														GLOW_MAX_DISTANCE;
	static float														GLOW_MAX_DISTANCE_ALIEN;
	static float														GLOW_MAX_DISTANCE_PREDATOR;
	static float														GLOW_RADIUS;
	static const int													MAX_NUM_SORTED_SKINS = 100;

	static DepthSortedSkinEntry											s_axSortedSkinentries[MAX_NUM_SORTED_SKINS];
	static DepthSortedSkinEntry *										s_axDepthSortedSkins[NUM_DEPTH_SORT_SLOTS];
	static int															s_uCurrentSortedSkin;

public:
	static float GetMaxRenderDistance()  {return GLOW_MAX_DISTANCE; }

	static void Initialise();
	static void Shutdown();

	static void RenderAll( );

	static void Render( const Asura_Animation* const pxAnim,
		u_int uCamVisFlags,
		u_int uRenderFlags,
		const Asura_Vector_3& xBSCentre,
		float fBSRadius,
		const Asura_RGBA &xColour);
};

