• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Graphics.Texture类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Start

        // Complete the graphic pipeline, initialize texture data
        public override void Start()
        {
            // create the sprite batch used in our custom rendering function
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // insert the custom renderer in between the 2 camera renderer.
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);
            compositor.Master.Renderers.Insert(2, new SceneDelegateRenderer(RenderTexture));
            
            // Create and initialize the dynamic texture
            renderTexture = Texture.New2D(GraphicsDevice, RenderTextureSize, RenderTextureSize, 1, PixelFormat.R8G8B8A8_UNorm_SRgb, usage: GraphicsResourceUsage.Dynamic);

            // Setup initial data in "SymmetricDefaultShape" to the texture
            for (var i = 0; i < SymmetricDefaultShape.Length; i += 2)
            {
                TogglePixel(SymmetricDefaultShape[i], SymmetricDefaultShape[i + 1]);
                if (SymmetricDefaultShape[i] != (RenderTextureSize - 1) - SymmetricDefaultShape[i])
                    TogglePixel((RenderTextureSize - 1) - SymmetricDefaultShape[i], SymmetricDefaultShape[i + 1]);
            }

            renderTexture.SetData(Game.GraphicsContext.CommandList, textureData);
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:24,代码来源:TextureUpdateScript.cs


示例17: SetShadowMapShaderData

            public void SetShadowMapShaderData(int index, ILightShadowMapShaderData shaderData)
            {
                var singleLightData = (LightDirectionalShadowMapShaderData)shaderData;
                var splits = singleLightData.CascadeSplits;
                var matrices = singleLightData.WorldToShadowCascadeUV;
                int splitIndex = index * cascadeCount;
                for (int i = 0; i < splits.Length; i++)
                {
                    cascadeSplits[splitIndex + i] = splits[i];
                    worldToShadowCascadeUV[splitIndex + i] = matrices[i];
                }

                depthBiases[index] = singleLightData.DepthBias;
                offsetScales[index] = singleLightData.OffsetScale;

                // TODO: should be setup just once at creation time
                if (index == 0)
                {
                    shadowMapTexture = singleLightData.Texture;
                    if (shadowMapTexture != null)
                    {
                        shadowMapTextureSize = new Vector2(shadowMapTexture.Width, shadowMapTexture.Height);
                        shadowMapTextureTexelSize = 1.0f / shadowMapTextureSize;
                    }
                }
            }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:26,代码来源:LightDirectionalShadowMapRenderer.cs


示例18: LuminanceResult

 public LuminanceResult(float averageLuminance, Texture localTexture)
     : this()
 {
     AverageLuminance = averageLuminance;
     LocalTexture = localTexture;
 }
开发者ID:cg123,项目名称:xenko,代码行数:6,代码来源:LuminanceResult.cs


示例19: SetColorDepthInput

 /// <summary>
 /// Provides a color buffer and a depth buffer to apply the depth-of-field to.
 /// </summary>
 /// <param name="colorBuffer">A color buffer to process.</param>
 /// <param name="depthBuffer">The depth buffer corresponding to the color buffer provided.</param>
 public void SetColorDepthInput(Texture colorBuffer, Texture depthBuffer)
 {
     SetInput(0, colorBuffer);
     SetInput(1, depthBuffer);
 }
开发者ID:cg123,项目名称:xenko,代码行数:10,代码来源:DepthOfField.cs


示例20: InitializeCore

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

            coclinearDepthMapEffect = ToLoadAndUnload(new ImageEffectShader("CoCLinearDepthShader"));
            combineLevelsEffect = ToLoadAndUnload(new ImageEffectShader("CombineLevelsFromCoCEffect"));
            combineLevelsFrontEffect = ToLoadAndUnload(new ImageEffectShader("CombineFrontCoCEffect"));
            combineLevelsFrontEffect.BlendState = BlendStates.AlphaBlend;
            textureScaler = ToLoadAndUnload(new ImageScaler());
            cocMapBlur = ToLoadAndUnload(new CoCMapBlur());
            thresholdAlphaCoC = ToLoadAndUnload(new ImageEffectShader("ThresholdAlphaCoC"));
            thresholdAlphaCoCFront = ToLoadAndUnload(new ImageEffectShader("ThresholdAlphaCoCFront"));
            pointDepthShader = ToLoadAndUnload(new ImageEffectShader("PointDepth"));
            depthReadBack = ToLoadAndUnload(new ImageReadback<Half>());
            depthCenter1x1 = Texture.New2D(GraphicsDevice, 1, 1, 1, PixelFormat.R16_Float, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);
        }
开发者ID:cg123,项目名称:xenko,代码行数:16,代码来源:DepthOfField.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Rendering.RenderContext类代码示例发布时间:2022-05-26
下一篇:
C# Graphics.GraphicsDevice类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap