예제 #1
0
        public TextureCube(
            GraphicsDevice graphicsDevice,
            int size,
            bool mipMap,
            SurfaceFormat format
            )
        {
            if (graphicsDevice == null)
            {
                throw new ArgumentNullException("graphicsDevice");
            }

            GraphicsDevice = graphicsDevice;
            Size           = size;
            LevelCount     = mipMap ? CalculateMipLevels(size) : 1;

            // TODO: Use QueryRenderTargetFormat!
            if (this is IRenderTarget &&
                format != SurfaceFormat.Color &&
                format != SurfaceFormat.Rgba1010102 &&
                format != SurfaceFormat.Rg32 &&
                format != SurfaceFormat.Rgba64 &&
                format != SurfaceFormat.Single &&
                format != SurfaceFormat.Vector2 &&
                format != SurfaceFormat.Vector4 &&
                format != SurfaceFormat.HalfSingle &&
                format != SurfaceFormat.HalfVector2 &&
                format != SurfaceFormat.HalfVector4 &&
                format != SurfaceFormat.HdrBlendable)
            {
                Format = SurfaceFormat.Color;
            }
            else
            {
                Format = format;
            }

            texture = FNA3D.FNA3D_CreateTextureCube(
                GraphicsDevice.GLDevice,
                Format,
                Size,
                LevelCount,
                (byte)((this is IRenderTarget) ? 1 : 0)
                );
        }
예제 #2
0
        public TextureCube(
            int size,
            bool mipMap,
            SurfaceFormat format
            )
        {
            GraphicsDevice = GraphicsDeviceManager.Instance.GraphicsDevice;
            Size           = size;
            LevelCount     = mipMap ? CalculateMipLevels(size) : 1;

            // TODO: Use QueryRenderTargetFormat!
            if (this is IRenderTarget &&
                format != SurfaceFormat.Color &&
                format != SurfaceFormat.Rgba1010102 &&
                format != SurfaceFormat.Rg32 &&
                format != SurfaceFormat.Rgba64 &&
                format != SurfaceFormat.Single &&
                format != SurfaceFormat.Vector2 &&
                format != SurfaceFormat.Vector4 &&
                format != SurfaceFormat.HalfSingle &&
                format != SurfaceFormat.HalfVector2 &&
                format != SurfaceFormat.HalfVector4 &&
                format != SurfaceFormat.HdrBlendable)
            {
                Format = SurfaceFormat.Color;
            }
            else
            {
                Format = format;
            }

            texture = FNA3D.FNA3D_CreateTextureCube(
                GraphicsDevice.GLDevice,
                Format,
                Size,
                LevelCount,
                (byte)((this is IRenderTarget) ? 1 : 0)
                );
        }