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


C# Graphics.Texture类代码示例

本文整理汇总了C#中SiliconStudio.Xenko.Graphics.Texture的典型用法代码示例。如果您正苦于以下问题:C# Texture类的具体用法?C# Texture怎么用?C# Texture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Texture类属于SiliconStudio.Xenko.Graphics命名空间,在下文中一共展示了Texture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SwapChainGraphicsPresenter

        public SwapChainGraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters) : base(device, presentationParameters)
        {
            gameWindow = (iPhoneOSGameView)Description.DeviceWindowHandle.NativeHandle;
            device.InitDefaultRenderTarget(presentationParameters);

            backBuffer = Texture.New2D(device, Description.BackBufferWidth, Description.BackBufferHeight, presentationParameters.BackBufferFormat, TextureFlags.RenderTarget | TextureFlags.ShaderResource);
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:7,代码来源:SwapChainGraphicsPresenter.iOS.cs

示例2: GetDepthStenctilAsShaderResource_Copy

        /// <summary>
        /// Gets a texture view which can be used to copy the depth buffer
        /// </summary>
        /// <param name="texture">The depthStencil texture originally used for render target</param>
        /// <returns>A texture view which can be used to copy the depth buffer</returns>
        private Texture GetDepthStenctilAsShaderResource_Copy(Texture texture)
        {
            var textureDescription = texture.Description;
            textureDescription.Flags = TextureFlags.ShaderResource;
            textureDescription.Format = PixelFormat.R24_UNorm_X8_Typeless;

            return renderContext.RenderContext.Allocator.GetTemporaryTexture2D(textureDescription);
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:13,代码来源:ResourceResolver.cs

示例3: ReleaseDepthStenctilAsShaderResource

        /// <summary>
        /// Frees previously acquired SRV texture. Should be called when the view is no longer needed
        /// </summary>
        /// <param name="depthAsSR">The previously acquired SRV texture</param>
        public void ReleaseDepthStenctilAsShaderResource(Texture depthAsSR)
        {
            // If no resources were allocated in the first place there is nothing to release
            if (depthAsSR == null || !renderContext.GraphicsDevice.Features.HasDepthAsSRV || renderContext.GraphicsDevice.Features.HasDepthAsReadOnlyRT)
                return;

            renderContext.RenderContext.Allocator.ReleaseReference(depthAsSR);
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:12,代码来源:ResourceResolver.cs

示例4: SwapChainGraphicsPresenter

 public SwapChainGraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters) : base(device, presentationParameters)
 {
     device.Begin();
     device.InitDefaultRenderTarget(presentationParameters);
     device.End();
     backBuffer = device.DefaultRenderTarget;
     DepthStencilBuffer = device.windowProvidedDepthTexture;
 }
开发者ID:psowinski,项目名称:xenko,代码行数:8,代码来源:SwapChainGraphicsPresenter.OpenTK.cs

示例5: GetDepthStenctilAsShaderResource

        /// <summary>
        /// Returns a texture view which should be used as DepthStencil Shader Resource View. Can be <c>null</c> if not supported
        /// </summary>
        /// <param name="texture">The depthStencil texture originally used for render target</param>
        /// <returns>The texture view which should be used as DepthStencil SRV. Can be <c>null</c> if not supported</returns>
        public Texture GetDepthStenctilAsShaderResource(Texture texture)
        {
            if (!renderContext.GraphicsDevice.Features.HasDepthAsSRV)
                return null;

            if (renderContext.GraphicsDevice.Features.HasDepthAsReadOnlyRT)
                return texture;

            return GetDepthStenctilAsShaderResource_Copy(texture);
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:15,代码来源:ResourceResolver.cs

示例6: ComputeTextureBase

 /// <summary>
 /// Initializes a new instance of the <see cref="ComputeTextureColor" /> class.
 /// </summary>
 /// <param name="texture">The texture.</param>
 /// <param name="texcoordIndex">Index of the texcoord.</param>
 /// <param name="scale">The scale.</param>
 /// <param name="offset">The offset.</param>
 protected ComputeTextureBase(Texture texture, TextureCoordinate texcoordIndex, Vector2 scale, Vector2 offset)
 {
     Enabled = true;
     Texture = texture;
     TexcoordIndex = texcoordIndex;
     Sampler = new ComputeColorParameterSampler();
     Scale = scale;
     Offset = offset;
     Key = null;
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:17,代码来源:ComputeTextureBase.cs

示例7: SetInput

        /// <summary>
        /// Sets an input texture
        /// </summary>
        /// <param name="slot">The slot.</param>
        /// <param name="texture">The texture.</param>
        public void SetInput(int slot, Texture texture)
        {
            if (slot < 0 || slot >= inputTextures.Length)
                throw new ArgumentOutOfRangeException("slot", "slot must be in the range [0, 128[");

            inputTextures[slot] = texture;
            if (slot > maxInputTextureIndex)
            {
                maxInputTextureIndex = slot;
            }
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:16,代码来源:ImageEffect.cs

示例8: GetDepthStencilAsRenderTarget

        /// <summary>
        /// Returns a texture view which should be used as DepthStencil render target while SRV is also used
        /// </summary>
        /// <param name="texture">The depthStencil texture originally used for render target</param>
        /// <param name="readOnlyCached">The cached view for the texture resource</param>
        /// <returns>The texture view which should be used as DepthStencil render target while SRV is also used</returns>
        public Texture GetDepthStencilAsRenderTarget(Texture texture, Texture readOnlyCached)
        {
            if (!renderContext.GraphicsDevice.Features.HasDepthAsSRV || !renderContext.GraphicsDevice.Features.HasDepthAsReadOnlyRT)
                return texture;

            // Check if changed
            if (readOnlyCached != null && readOnlyCached.ParentTexture == texture)
                return readOnlyCached;

            return texture.ToDepthStencilReadOnlyTexture();
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:17,代码来源:ResourceResolver.cs

示例9: ShadowMapAtlasTexture

        public ShadowMapAtlasTexture(Texture texture, int textureId)
        {
            if (texture == null) throw new ArgumentNullException("texture");
            Texture = texture;
            Clear(Texture.Width, Texture.Height);
            Width = texture.Width;
            Height = texture.Height;

            RenderFrame = RenderFrame.FromTexture((Texture)null, texture);
            Id = textureId;
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:11,代码来源:ShadowMapAtlasTexture.cs

示例10: SwapChainGraphicsPresenter

        public SwapChainGraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters)
            : base(device, presentationParameters)
        {
            PresentInterval = presentationParameters.PresentationInterval;

            backbuffer = new Texture(device);

            CreateSurface();

            // Initialize the swap chain
            CreateSwapChain();
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:12,代码来源:SwapChainGraphicsPresenter.Vulkan.cs

示例11: SwapChainGraphicsPresenter

        public SwapChainGraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters)
            : base(device, presentationParameters)
        {
            PresentInterval = presentationParameters.PresentationInterval;

            // Initialize the swap chain
            swapChain = CreateSwapChain();

            backBuffer = new Texture(device).InitializeFrom(swapChain.GetBackBuffer<SharpDX.Direct3D11.Texture2D>(0), Description.BackBufferFormat.IsSRgb());

            // Reload should get backbuffer from swapchain as well
            //backBufferTexture.Reload = graphicsResource => ((Texture)graphicsResource).Recreate(swapChain.GetBackBuffer<SharpDX.Direct3D11.Texture>(0));
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:13,代码来源:SwapChainGraphicsPresenter.Direct3D.cs

示例12: Sprite

 /// <summary>
 /// Creates a <see cref="Sprite"/> having the provided texture and name.
 /// The region size is initialized with the whole size of the texture.
 /// </summary>
 /// <param name="fragmentName">The name of the sprite</param>
 /// <param name="texture">The texture to use as texture</param>
 public Sprite(string fragmentName, Texture texture)
 {
     Name = fragmentName;
     PixelsPerUnit = new Vector2(DefaultPixelsPerUnit);
     IsTransparent = true;
     
     Texture = texture;
     if (texture != null)
     {
         Region = new Rectangle(0, 0, texture.ViewWidth, texture.ViewHeight);
         Center = new Vector2(Region.Width/2, Region.Height/2);
     }
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:19,代码来源:Sprite.cs

示例13: SpriteFromTexture

        private SpriteFromTexture(Sprite source)
            : this()
        {
            sprite = source;
            isSpriteDirty = false;

            center = sprite.Center;
            centerFromMiddle = false;
            isTransparent = sprite.IsTransparent;
            // FIXME: should we use the Max, Min, average of X and/or Y?
            pixelsPerUnit = sprite.PixelsPerUnit.X;
            texture = sprite.Texture;
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:13,代码来源:SpriteFromTexture.cs

示例14: InitializeCore

        protected override void InitializeCore()
        {
            base.InitializeCore();

            LuminanceLogEffect = ToLoadAndUnload(new LuminanceLogEffect());

            // Create 1x1 texture
            luminance1x1 = Texture.New2D(GraphicsDevice, 1, 1, 1, luminanceFormat, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);

            // Use a multiscaler
            multiScaler = ToLoadAndUnload(new ImageMultiScaler());

            // Readback is always going to be done on the 1x1 texture
            readback = ToLoadAndUnload(readback);

            // Blur used before upscaling 
            blur = ToLoadAndUnload(new GaussianBlur());
            blur.Radius = 4;
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:19,代码来源:LuminanceEffect.cs

示例15: CreateBackground

        private void CreateBackground(Texture bgTexture, RectangleF texReg)
        {
            texture = bgTexture;
            textureRegion = texReg;

            // Set offset to rectangle
            firstQuadRegion.X = textureRegion.X;
            firstQuadRegion.Y = textureRegion.Y;

            firstQuadRegion.Width = (textureRegion.Width > screenResolution.X) ? screenResolution.X : textureRegion.Width;
            firstQuadRegion.Height = (textureRegion.Height > screenResolution.Y) ? screenResolution.Y : textureRegion.Height;

            // Centering the content
            firstQuadOrigin.X = 0.5f * firstQuadRegion.Width;
            firstQuadOrigin.Y = 0.5f * firstQuadRegion.Height;

            // Copy data from first quad to second one
            secondQuadRegion = firstQuadRegion;
            secondQuadOrigin = firstQuadOrigin;
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:20,代码来源:BackgroundSection.cs


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