//
// Tools_PhotonMapping_VertexSampleStamp.h
//
// Created by KJFL - 2004-06-14 16:00:49
//
// Copyright (C) 2004 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif

#ifndef __TOOLS_PHOTONMAPPING_VERTEXSAMPLESTAMP_H__
#define __TOOLS_PHOTONMAPPING_VERTEXSAMPLESTAMP_H__

class Tools_PhotonMapping_VertexSampleStamp
{
	public:

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

		static void Reset( void );

		inline static void IncrementSampleNumber( void )
		{
			++s_uCurrentSample;
		}

		inline static bool IsSampleValid( u_int uVertex, u_int uModule )
		{
			u_int& uStamp = s_ppuSampleStamp[uModule][uVertex];
			
			if (uStamp != s_uCurrentSample)
			{
				uStamp = s_uCurrentSample;

				return true;
			}

			return false;
		}

		inline static void ResetSampleStamp( u_int uVertex, u_int uModule )
		{
			u_int& uStamp = s_ppuSampleStamp[uModule][uVertex];
			uStamp = s_uCurrentSample-1;
		}

	private:
		
		static u_int	s_uCurrentSample;
		static u_int**	s_ppuSampleStamp;
};

#endif//__TOOLS_PHOTONMAPPING_VERTEXSAMPLESTAMP_H__
