/**
*
* \file Asura_Platform_Shard_Effect.cpp
*
* Created by Andrew Weinkove - 24/07/2002
*
* Copyright (C) 2002 Rebellion, All Rights Reserved.
*
* \brief
*
**/

#include "Core/Asura.h"

#include "Camera/Asura_Camera.h"
#include "Rendering/Asura_Render.h"
#include "SpecialFX/Asura_Shard_Effect.h"

void Asura_Shard_Effect::Platform_Render(unsigned uCamVisFlags)
{
	extern void RenderShard(Asura_Shard *shardPtr, int TextureIndex, u_int uColour);

	unsigned uColour = 0x00ffffff & m_uColour;
	unsigned uAlpha = (m_uColour >> 24);
	uAlpha = unsigned(Asura_Maths::FloatToInt(float(uAlpha) * (1.0f - m_fAlpha)));
	uColour |= (uAlpha << 24);
	for(int i=0; i<Asura_Camera::GetNumberOfCameras(); i++)
	{
		if (uCamVisFlags & (1 << i))
		{
			Asura_Camera::SetCameraIndex(i);

			Asura_Render::ApplyCameraSettings();
	
			for(int s=0; s<m_iNumberOfActiveShards; s++ )
			{
				RenderShard(m_apxShards[s], m_iTextureIndex, uColour);
			}
		}
	}
}
