Esempio n. 1
0
 public void Visit(MaterialGeneratorContext context)
 {
 }
 public void Visit(MaterialGeneratorContext context)
 {
     MetalnessMap.Visit(context);
 }
 public void Visit(MaterialGeneratorContext context)
 {
     valueBuffer ??= GraphicsBuffer.New(context.GraphicsDevice, Value, GraphicsBufferFlags.ConstantBuffer, GraphicsHeapType.Upload).DisposeBy(context.GraphicsDevice);
     context.ConstantBufferViews.Add(valueBuffer);
 }
        public static async Task <Material> GenerateAsync(MaterialDescriptor descriptor, MaterialGeneratorContext context)
        {
            context.PushMaterialDescriptor(descriptor);

            for (int passIndex = 0; passIndex < context.PassCount; passIndex++)
            {
                MaterialPass materialPass = context.PushPass();

                descriptor.Visit(context);

                materialPass.PipelineState = await context.CreateGraphicsPipelineStateAsync();

                var shaderResources = context.ConstantBufferViews.Concat(context.ShaderResourceViews).Concat(context.UnorderedAccessViews);

                if (shaderResources.Count() > 0)
                {
                    materialPass.ShaderResourceViewDescriptorSet = new DescriptorSet(context.GraphicsDevice, shaderResources.Count());
                    materialPass.ShaderResourceViewDescriptorSet.AddConstantBufferViews(context.ConstantBufferViews);
                    materialPass.ShaderResourceViewDescriptorSet.AddShaderResourceViews(context.ShaderResourceViews);
                    materialPass.ShaderResourceViewDescriptorSet.AddUnorderedAccessViews(context.UnorderedAccessViews);
                }

                if (context.Samplers.Count > 0)
                {
                    materialPass.SamplerDescriptorSet = new DescriptorSet(context.GraphicsDevice, context.Samplers.Count, DescriptorHeapType.Sampler);
                    materialPass.SamplerDescriptorSet.AddSamplers(context.Samplers);
                }

                context.PopPass();
            }

            context.PopMaterialDescriptor();

            return(context.Material);
        }
 public void Visit(MaterialGeneratorContext context)
 {
     Fresnel.Visit(context);
     Visibility.Visit(context);
     NormalDistribution.Visit(context);
 }
 public void Visit(MaterialGeneratorContext context)
 {
     valueBuffer ??= GraphicsBuffer.Constant.New(context.GraphicsDevice, Value).DisposeBy(context.GraphicsDevice);
     context.ConstantBufferViews.Add(valueBuffer);
 }
Esempio n. 7
0
        public static async Task <Material> GenerateAsync(MaterialDescriptor descriptor, MaterialGeneratorContext context)
        {
            context.PushMaterialDescriptor(descriptor);

            for (int passIndex = 0; passIndex < context.PassCount; passIndex++)
            {
                MaterialPass materialPass = context.PushPass();

                context.Visit(descriptor.Attributes);

                InputElementDescription[] inputElements = new[]
                {
                    new InputElementDescription("Position", 0, PixelFormat.R32G32B32Float, 0),
                    new InputElementDescription("Normal", 0, PixelFormat.R32G32B32Float, 1),
                    new InputElementDescription("Tangent", 0, PixelFormat.R32G32B32A32Float, 2),
                    new InputElementDescription("TexCoord", 0, PixelFormat.R32G32Float, 3)
                };

                materialPass.PipelineState = await context.CreateGraphicsPipelineStateAsync(inputElements);

                materialPass.ShaderResourceViewDescriptorSet = context.CreateShaderResourceViewDescriptorSet();
                materialPass.SamplerDescriptorSet            = context.CreateSamplerDescriptorSet();

                context.PopPass();
            }

            context.PopMaterialDescriptor();

            return(context.Material);
        }
Esempio n. 8
0
 public void Visit(MaterialGeneratorContext context)
 {
     Attributes.Visit(context);
 }
Esempio n. 9
0
 public void Visit(MaterialGeneratorContext context)
 {
     DiffuseMap.Visit(context);
 }
 public void Visit(MaterialGeneratorContext context)
 {
     NormalMap.Visit(context);
 }
Esempio n. 11
0
 public void Visit(MaterialGeneratorContext context)
 {
     SpecularMap.Visit(context);
 }