#ifndef TEXTURE_SAMPLER_H
#define TEXTURE_SAMPLER_H

#include "TextureSupport.h"

namespace textureSampler
{

template <typename DATA> InternalTextureData<DATA> sampleNearestNeighbour( const InternalTextureData<DATA>& texData, unsigned int sizeX, unsigned int sizeY )
{
	float dx = texData.sizeX / sizeX;
	float dy = texData.sizeY / sizeY;
	int bpp = texData.pixelData.size() / ( texData.sizeX * texData.sizeY );

	InternalTextureData<DATA> sampledTex;
	sampledTex.format = texData.format;
	sampledTex.sizeX = sizeX;
	sampledTex.sizeY = sizeY;
	sampledTex.type = texData.type;
	sampledTex.pixelData.reserve( sizeX * sizeY * bpp );
	
	for ( int y= 0; y< sizeY; ++y)
	{
		for ( int x=0; x< sizeX; ++x)
		{
			for ( int p = 0; p< bpp; ++p)
			{
				sampledTex.pixelData.push_back( texData[ (y * sizeX * bpp * dy) +  (x * bpp * dx) + p] );
			}
		}
	}

}

}
#endif