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


C# Quad.Draw方法代码示例

本文整理汇总了C#中Quad.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# Quad.Draw方法的具体用法?C# Quad.Draw怎么用?C# Quad.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Quad的用法示例。


在下文中一共展示了Quad.Draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RestoreDepth

        public static void RestoreDepth(Renderer renderer, Quad quad, Material restoreDepth, bool clearDepth = true)
        {
            // work arround for a bug in xna 4.0
            renderer.Device.SamplerStates[0] = SamplerState.LinearClamp;
            renderer.Device.SamplerStates[0] = SamplerState.PointClamp;

            if (clearDepth)
                renderer.Device.Clear(ClearOptions.DepthBuffer, Color.Transparent, 1, 0);

            renderer.Device.DepthStencilState = DepthStencilState.Default;
            renderer.Device.BlendState = BlendState.Additive;
            quad.Draw(restoreDepth, renderer.Data);
        }
开发者ID:xoxota99,项目名称:Myre,代码行数:13,代码来源:RestoreDepthPhase.cs

示例2: PerformLightingPass

        internal static void PerformLightingPass(Renderer renderer, bool ssao, Quad quad, Material restoreDepth, Material copyTexture, IReadOnlyList<IDirectLight> directLights, IReadOnlyList<IIndirectLight> indirectLights, out RenderTarget2D directLightBuffer, out RenderTarget2D indirectLightBuffer)
        {
            //Get some handy objects
            var device = renderer.Device;
            var resolution = renderer.Data.GetValue(new TypedName<Vector2>("resolution"));
            var width = (int)resolution.X;
            var height = (int)resolution.Y;

            //Enable or disable SSAO
            renderer.Data.Set("ssao", ssao);

            // prepare direct lights
            for (int i = 0; i < directLights.Count; i++)
                directLights[i].Prepare(renderer);

            // set and clear direct light buffer
            directLightBuffer = RenderTargetManager.GetTarget(device, width, height, SurfaceFormat.HdrBlendable, DepthFormat.Depth24Stencil8);
            device.SetRenderTarget(directLightBuffer);
            device.Clear(Color.Transparent);

            // work around for a bug in xna 4.0
            renderer.Device.SamplerStates[0] = SamplerState.LinearClamp;
            renderer.Device.SamplerStates[0] = SamplerState.PointClamp;

            // set render states to draw opaque geometry
            device.BlendState = BlendState.Opaque;
            device.DepthStencilState = DepthStencilState.Default;

            // restore depth
            quad.Draw(restoreDepth, renderer.Data);

            // set render states to additive blend
            device.BlendState = BlendState.Additive;

            // draw direct lights
            foreach (IDirectLight light in directLights)
                light.Draw(renderer);

            // prepare indirect lights
            for (int i = 0; i < indirectLights.Count; i++)
                indirectLights[i].Prepare(renderer);

            // set and clear indirect light buffer
            indirectLightBuffer = RenderTargetManager.GetTarget(device, width, height, SurfaceFormat.HdrBlendable, DepthFormat.Depth24Stencil8);
            device.SetRenderTarget(indirectLightBuffer);
            device.Clear(Color.Transparent);

            //draw indirect lights
            foreach (IIndirectLight light in indirectLights)
                light.Draw(renderer);

            // blend direct lighting into the indirect light buffer
            copyTexture.Parameters["Texture"].SetValue(directLightBuffer);
            quad.Draw(copyTexture, renderer.Data);
        }
开发者ID:xoxota99,项目名称:Myre,代码行数:55,代码来源:LightingComponent.cs


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