Exemplo n.º 1
0
        protected override Number4 GetLinear(
            SamplerState samplerState, ITextureMipMap mipMap, 
            ref Number4 texCoords)
        {
            int intTexelX = (int) texCoords.Float0;
            int intTexelY = (int) texCoords.Float1;

            float fracX = texCoords.Float0 - intTexelX;
            float fracY = texCoords.Float1 - intTexelY;

            texCoords.Int0 = intTexelX;
            texCoords.Int1 = intTexelY;
            var c00 = GetColor(samplerState, mipMap, ref texCoords);

            texCoords.Int0 = intTexelX + 1;
            texCoords.Int1 = intTexelY;
            var c10 = GetColor(samplerState, mipMap, ref texCoords);

            texCoords.Int0 = intTexelX;
            texCoords.Int1 = intTexelY + 1;
            var c01 = GetColor(samplerState, mipMap, ref texCoords);

            texCoords.Int0 = intTexelX + 1;
            texCoords.Int1 = intTexelY + 1;
            var c11 = GetColor(samplerState, mipMap, ref texCoords);

            var cMinV = Number4.Lerp(ref c00, ref c10, fracX);
            var cMaxV = Number4.Lerp(ref c01, ref c11, fracX);

            return Number4.Lerp(ref cMinV, ref cMaxV, fracY);
        }
Exemplo n.º 2
0
        protected override Number4 GetLinear(
            SamplerState samplerState, ITextureMipMap mipMap,
            ref Number4 texCoords)
        {
            int intTexelX = (int)texCoords.Float0;
            int intTexelY = (int)texCoords.Float1;

            float fracX = texCoords.Float0 - intTexelX;
            float fracY = texCoords.Float1 - intTexelY;

            texCoords.Int0 = intTexelX;
            texCoords.Int1 = intTexelY;
            var c00 = GetColor(samplerState, mipMap, ref texCoords);

            texCoords.Int0 = intTexelX + 1;
            texCoords.Int1 = intTexelY;
            var c10 = GetColor(samplerState, mipMap, ref texCoords);

            texCoords.Int0 = intTexelX;
            texCoords.Int1 = intTexelY + 1;
            var c01 = GetColor(samplerState, mipMap, ref texCoords);

            texCoords.Int0 = intTexelX + 1;
            texCoords.Int1 = intTexelY + 1;
            var c11 = GetColor(samplerState, mipMap, ref texCoords);

            var cMinV = Number4.Lerp(ref c00, ref c10, fracX);
            var cMaxV = Number4.Lerp(ref c01, ref c11, fracX);

            return(Number4.Lerp(ref cMinV, ref cMaxV, fracY));
        }
Exemplo n.º 3
0
 protected override Number4 GetNearestNeighbor(
     SamplerState samplerState, ITextureMipMap mipMap, 
     ref Number4 texCoords)
 {
     texCoords.Int0 = MathUtility.Floor(texCoords.Float0);
     texCoords.Int1 = MathUtility.Floor(texCoords.Float1);
     return GetColor(samplerState, mipMap, ref texCoords);
 }
Exemplo n.º 4
0
 protected override Number4 GetNearestNeighbor(
     SamplerState samplerState, ITextureMipMap mipMap,
     ref Number4 texCoords)
 {
     texCoords.Int0 = MathUtility.Floor(texCoords.Float0);
     texCoords.Int1 = MathUtility.Floor(texCoords.Float1);
     return(GetColor(samplerState, mipMap, ref texCoords));
 }
Exemplo n.º 5
0
        private static Number4 GetColor(SamplerState samplerState, ITextureMipMap mipMap, ref Number4 texCoords)
        {
            if (!GetTextureAddress(texCoords.Int0, mipMap.Width, samplerState.AddressU, out texCoords.Int0))
                return samplerState.BorderColor;
            if (!GetTextureAddress(texCoords.Int1, mipMap.Height, samplerState.AddressV, out texCoords.Int1))
                return samplerState.BorderColor;

            return mipMap.GetData(ref texCoords);
        }
Exemplo n.º 6
0
        protected override void GetMipMapAndTransformedCoordinates(
            ITexture texture, ref Number4 location, 
			int level, out ITextureMipMap mipMap,
            out Number4 textureCoordinates)
        {
            mipMap = texture.GetMipMap(0, level);
            textureCoordinates = new Number4(
                location.Float0 * mipMap.Width,
                location.Float1 * mipMap.Height,
                0, 0);
        }
Exemplo n.º 7
0
 protected override void GetMipMapAndTransformedCoordinates(
     ITexture texture, ref Number4 location,
     int level, out ITextureMipMap mipMap,
     out Number4 textureCoordinates)
 {
     mipMap             = texture.GetMipMap(0, level);
     textureCoordinates = new Number4(
         location.Float0 * mipMap.Width,
         location.Float1 * mipMap.Height,
         0, 0);
 }
		protected override void GetMipMapAndTransformedCoordinates(
			ITexture texture, ref Number4 location,
			int level, out ITextureMipMap mipMap,
			out Number4 textureCoordinates)
		{
			var arraySlice = MathUtility.Round(location.Float2);
			mipMap = texture.GetMipMap(arraySlice, level);
			textureCoordinates = new Number4(
				location.Float0 * mipMap.Width,
				location.Float1 * mipMap.Height,
				0, 0);
		}
Exemplo n.º 9
0
        private static Number4 GetColor(SamplerState samplerState, ITextureMipMap mipMap, ref Number4 texCoords)
        {
            if (!GetTextureAddress(texCoords.Int0, mipMap.Width, samplerState.AddressU, out texCoords.Int0))
            {
                return(samplerState.BorderColor);
            }
            if (!GetTextureAddress(texCoords.Int1, mipMap.Height, samplerState.AddressV, out texCoords.Int1))
            {
                return(samplerState.BorderColor);
            }

            return(mipMap.GetData(ref texCoords));
        }
        protected override void GetMipMapAndTransformedCoordinates(
            ITexture texture, ref Number4 location,
            int level, out ITextureMipMap mipMap,
            out Number4 textureCoordinates)
        {
            var arraySlice = MathUtility.Round(location.Float2);

            mipMap             = texture.GetMipMap(arraySlice, level);
            textureCoordinates = new Number4(
                location.Float0 * mipMap.Width,
                location.Float1 * mipMap.Height,
                0, 0);
        }
Exemplo n.º 11
0
		protected override void GetMipMapAndTransformedCoordinates(
			ITexture texture, ref Number4 location,
			int level, out ITextureMipMap mipMap,
			out Number4 textureCoordinates)
		{
			int arrayIndex;
			CubeMapUtility.GetCubeMapCoordinates(ref location,
				out arrayIndex, out textureCoordinates);

			mipMap = texture.GetMipMap(arrayIndex, level);

			textureCoordinates.X *= mipMap.Width;
			textureCoordinates.Y *= mipMap.Height;
		}
Exemplo n.º 12
0
        protected override void GetMipMapAndTransformedCoordinates(
            ITexture texture, ref Number4 location,
            int level, out ITextureMipMap mipMap,
            out Number4 textureCoordinates)
        {
            int arrayIndex;

            CubeMapUtility.GetCubeMapCoordinates(ref location,
                                                 out arrayIndex, out textureCoordinates);

            mipMap = texture.GetMipMap(arrayIndex, level);

            textureCoordinates.X *= mipMap.Width;
            textureCoordinates.Y *= mipMap.Height;
        }
Exemplo n.º 13
0
 protected abstract Number4 GetLinear(
     SamplerState samplerState, ITextureMipMap mipMap, 
     ref Number4 texCoords);
Exemplo n.º 14
0
 protected abstract void GetMipMapAndTransformedCoordinates(
     ITexture texture, ref Number4 location, int level,
     out ITextureMipMap mipMap,
     out Number4 textureCoordinates);
Exemplo n.º 15
0
 protected abstract Number4 GetNearestNeighbor(
     SamplerState samplerState, ITextureMipMap mipMap, 
     ref Number4 texCoords);
Exemplo n.º 16
0
 protected abstract void GetMipMapAndTransformedCoordinates(
     ITexture texture, ref Number4 location, int level,
     out ITextureMipMap mipMap,
     out Number4 textureCoordinates);
Exemplo n.º 17
0
 protected abstract Number4 GetLinear(
     SamplerState samplerState, ITextureMipMap mipMap,
     ref Number4 texCoords);
Exemplo n.º 18
0
 protected abstract Number4 GetNearestNeighbor(
     SamplerState samplerState, ITextureMipMap mipMap,
     ref Number4 texCoords);