Axiom.RenderSystems.Xna.XnaTexture.CreateNormalTexture C# (CSharp) Method

CreateNormalTexture() private method

private CreateNormalTexture ( ) : void
return void
		private void CreateNormalTexture()
		{
			Debug.Assert( SrcWidth > 0 && SrcHeight > 0 );

			// use current back buffer format for render textures, else use the one
			// defined by this texture format
			XFG.SurfaceFormat xnaPixelFormat =
				( Usage == TextureUsage.RenderTarget ) ? _bbPixelFormat : ChooseXnaFormat();


			// how many mips to use?  make sure its at least one
			int numMips = ( MipmapCount > 0 ) ? MipmapCount : 1;
           
            //bloody 'ell, it's great that Xa 4.0 checks capabilities for the programmer, but it's incredibly annoying
            //that it doesn't tell the programer anything about them. Anyway, there's no way for us to know if MipMaps are supported,
            //but in the c'tor of the Texture is a paramater bool mipMap, which, if set to true and mipMaps aren't supported, Xna will take care of it
            //-DoubleA

            //MipmapsHardwareGenerated = false;
            //if ( _devCaps.TextureCapabilities.SupportsMipMap )
            //{
            //    MipmapsHardwareGenerated = CanAutoGenMipMaps( xnaUsage, XFG.ResourceType.Texture2D, xnaPixelFormat );
            //    if ( MipmapsHardwareGenerated )
            //    {
            //        numMips = 0;
            //    }
            //}
            //else
            //{
            //    // no mip map support for this kind of texture
            //    this.MipmapCount = 0;
            //    numMips = 1;
            //}
            
			if ( Usage == TextureUsage.RenderTarget )
			{
				renderTarget = new XFG.RenderTarget2D(_device, SrcWidth, SrcHeight, MipmapCount > 0 ? true : false, xnaPixelFormat, XFG.DepthFormat.Depth24Stencil8 );
				_normTexture = renderTarget;
				CreateDepthStencil();
			}
			else
			{
				_normTexture = new XFG.Texture2D(_device, SrcWidth, SrcHeight, MipmapCount > 0 ? true : false,xnaPixelFormat);
			}
			_texture = _normTexture;

			SetFinalAttributes( SrcWidth, SrcHeight, 1, XnaHelper.Convert( xnaPixelFormat ) );

			if ( MipmapsHardwareGenerated )
			{
                //Generating mip maps API is no longer exposed. RenderTargets will auto-generate their mipmaps
                //but for other textures you're S.O.L. -DoubleA. See Shawn Hargreaves response to this thread: http://forums.create.msdn.com/forums/p/71559/436835.aspx
				//_texture.GenerateMipMaps( GetBestFilterMethod() );
			}
		}