Ejemplo n.º 1
0
        public static Texture CreateTexture3D(
            GraphicsDevice device,
            uint width,
            uint height,
            uint depth,
            Refresh.ColorFormat format,
            Refresh.TextureUsageFlags usageFlags,
            Refresh.SampleCount sampleCount = Refresh.SampleCount.One,
            uint levelCount = 1
            )
        {
            var textureCreateInfo = new Campari.TextureCreateInfo
            {
                Width       = width,
                Height      = height,
                Depth       = depth,
                IsCube      = false,
                SampleCount = sampleCount,
                LevelCount  = levelCount,
                Format      = format,
                UsageFlags  = usageFlags
            };

            return(new Texture(device, ref textureCreateInfo));
        }
Ejemplo n.º 2
0
        public static ColorTarget CreateBackedColorTarget2D(
            GraphicsDevice device,
            uint width,
            uint height,
            Refresh.ColorFormat format,
            bool canBeSampled,
            Refresh.SampleCount sampleCount = Refresh.SampleCount.One,
            uint levelCount = 1
            )
        {
            var flags = Refresh.TextureUsageFlags.ColorTargetBit;

            if (canBeSampled)
            {
                flags |= Refresh.TextureUsageFlags.SamplerBit;
            }

            var texture = Texture.CreateTexture2D(
                device,
                width,
                height,
                format,
                flags,
                sampleCount,
                levelCount
                );

            var textureSlice = new TextureSlice(texture);

            return(new ColorTarget(device, sampleCount, ref textureSlice));
        }
Ejemplo n.º 3
0
        public static Texture CreateTextureCube(
            GraphicsDevice device,
            uint size,
            Refresh.ColorFormat format,
            Refresh.TextureUsageFlags usageFlags,
            Refresh.SampleCount sampleCount = Refresh.SampleCount.One,
            uint levelCount = 1
            )
        {
            var textureCreateInfo = new Campari.TextureCreateInfo
            {
                Width       = size,
                Height      = size,
                Depth       = 1,
                IsCube      = true,
                SampleCount = sampleCount,
                LevelCount  = levelCount,
                Format      = format,
                UsageFlags  = usageFlags
            };

            return(new Texture(device, ref textureCreateInfo));
        }
Ejemplo n.º 4
0
        public ColorTarget(GraphicsDevice device, Refresh.SampleCount sampleCount, ref TextureSlice textureSlice) : base(device)
        {
            var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();

            Handle = Refresh.Refresh_CreateColorTarget(device.Handle, sampleCount, ref refreshTextureSlice);
        }