AreaLightTest.AreaLightForm.BilinearSample C# (CSharp) Метод

BilinearSample() приватный Метод

private BilinearSample ( float4 _Source, float _X, float _Y ) : float4
_Source float4
_X float
_Y float
Результат float4
		float4	BilinearSample( float4[,] _Source, float _X, float _Y ) {
			int		X = (int) Math.Floor( _X );
			float	x = _X - X;
			int		Y = (int) Math.Floor( _Y );
			float	y = _Y - Y;
			int		W = _Source.GetLength( 0 );
			int		H = _Source.GetLength( 1 );
			float4	V00 = X >= 0 && Y >= 0 && X < W && Y < H ? _Source[X,Y] : float4.Zero;
			X++;
			float4	V01 = X >= 0 && Y >= 0 && X < W && Y < H ? _Source[X,Y] : float4.Zero;
			Y++;
			float4	V11 = X >= 0 && Y >= 0 && X < W && Y < H ? _Source[X,Y] : float4.Zero;
			X--;
			float4	V10 = X >= 0 && Y >= 0 && X < W && Y < H ? _Source[X,Y] : float4.Zero;

			float4	V0 = (1.0f - x) * V00 + x * V01;
			float4	V1 = (1.0f - x) * V10 + x * V11;
			float4	Result = (1.0f - y) * V0 + y * V1;
			return Result;
		}