Ejemplo n.º 1
0
        public override bool Register(ref RenderPassBuilder builder, ref Resolver resolver)
        {
            var resources = new PipelineResources();
            var settings  = resolver.GetComponent <PipelineSettings>();

            resources.SceneColor = builder.CreatePrimaryOutputRelativeTexture(
                TextureDesc.CreateRenderTargetDesc(DataFormat.R8G8B8A8UnsignedNormalized, Rgba128.CornflowerBlue, settings.Msaa),
                ResourceState.RenderTarget,
                debugName: nameof(resources.SceneColor)
                );

            resources.SceneDepth = builder.CreatePrimaryOutputRelativeTexture(
                TextureDesc.CreateDepthStencilDesc(DataFormat.Depth32Single, 1.0f, 0, false, settings.Msaa),
                ResourceState.DepthWrite,
                debugName: nameof(resources.SceneDepth)
                );

            resolver.CreateComponent(resources);

            DefaultPipelineState = settings.Msaa.IsMultiSampled ? _texMsaa8x : _tex;

            var fovAngleY = 70.0f * MathF.PI / 180.0f;

            _frameConstants.Projection = Matrix4x4.CreatePerspectiveFieldOfView(fovAngleY, settings.AspectRatio, 0.001f, 100f);

            return(true);
        }
Ejemplo n.º 2
0
        public override bool Register(ref RenderPassBuilder builder, ref Resolver resolver)
        {
            var settings = resolver.GetComponent <RenderSettings>();

            RenderResources resources;

            resources.SceneColor = builder.CreatePrimaryOutputRelativeTexture(
                TextureDesc.CreateRenderTargetDesc(BackBufferFormat.R8G8B8A8UnsignedNormalized, DefaultSkyColor, settings.Msaa),
                ResourceState.RenderTarget
                );

            resources.SceneDepth = builder.CreatePrimaryOutputRelativeTexture(
                TextureDesc.CreateDepthStencilDesc(DataFormat.Depth32Single, 1, 0, false, settings.Msaa),
                ResourceState.DepthWrite
                );

            resolver.CreateComponent(resources);

            DefaultPipelineState = settings.Msaa.IsMultiSampled ? MsaaPso : Pso;

            builder.SetOutput(resources.SceneColor);

            return(true);
        }