当前位置: 首页>>代码示例>>C#>>正文


C# ITexture.GetMipMap方法代码示例

本文整理汇总了C#中ITexture.GetMipMap方法的典型用法代码示例。如果您正苦于以下问题:C# ITexture.GetMipMap方法的具体用法?C# ITexture.GetMipMap怎么用?C# ITexture.GetMipMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITexture的用法示例。


在下文中一共展示了ITexture.GetMipMap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetMipMapAndTransformedCoordinates

        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);
        }
开发者ID:modulexcite,项目名称:slimshader,代码行数:11,代码来源:Texture2DSampler.cs

示例2: GetMipMapAndTransformedCoordinates

		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);
		}
开发者ID:modulexcite,项目名称:slimshader,代码行数:12,代码来源:Texture2DArraySampler.cs

示例3: GetMipMapAndTransformedCoordinates

		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;
		}
开发者ID:modulexcite,项目名称:slimshader,代码行数:14,代码来源:TextureCubeSampler.cs

示例4: CalculateLevelOfDetail

        public override float CalculateLevelOfDetail(
            ITexture texture, SamplerState samplerState, 
            ref Number4 ddx, ref Number4 ddy)
        {
            var mostDetailedMipMap = texture.GetMipMap(0, 0);
            int width = mostDetailedMipMap.Width;
            int height = mostDetailedMipMap.Height;
            float xBound2 = width * width;
            float yBound2 = height * height;

            float dudx2 = ddx.Float0 * ddx.Float0 * xBound2;
            float dvdx2 = ddx.Float1 * ddx.Float1 * yBound2;
            float dudy2 = ddy.Float0 * ddy.Float0 * xBound2;
            float dvdy2 = ddy.Float1 * ddy.Float1 * yBound2;

            // Proportional to the amount of a texel on display in a single pixel
            float pixelSizeTexelRatio2 = Math.Max(dudx2 + dvdx2, dudy2 + dvdy2);

            // Uses formula for p410 of Essential Mathematics for Games and Interactive Applications
            float result = 0.5f * MathUtility.Log2(pixelSizeTexelRatio2);

            // Clamp to >= 0.
            return Math.Max(result, 0.0f);
        }
开发者ID:modulexcite,项目名称:slimshader,代码行数:24,代码来源:Texture2DSampler.cs


注:本文中的ITexture.GetMipMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。