Exemplo n.º 1
0
            public override void UpdateLayout(string compositionName)
            {
                base.UpdateLayout(compositionName);

                traceAttribute = GetTraceAttr();

                intensityKey         = LightVoxelShaderKeys.Intensity.ComposeWith(compositionName);
                specularIntensityKey = LightVoxelShaderKeys.SpecularIntensity.ComposeWith(compositionName);

                diffuseMarcherKey    = LightVoxelShaderKeys.diffuseMarcher.ComposeWith(compositionName);
                specularMarcherKey   = LightVoxelShaderKeys.specularMarcher.ComposeWith(compositionName);
                attributeSamplersKey = MarchAttributesKeys.AttributeSamplers.ComposeWith(compositionName);

                if (traceAttribute != null)
                {
                    if (((LightVoxel)Light.Type).DiffuseMarcher != null)
                    {
                        ((LightVoxel)Light.Type).DiffuseMarcher.UpdateMarchingLayout("diffuseMarcher." + compositionName);
                    }
                    if (((LightVoxel)Light.Type).SpecularMarcher != null)
                    {
                        ((LightVoxel)Light.Type).SpecularMarcher.UpdateMarchingLayout("specularMarcher." + compositionName);
                    }
                    traceAttribute.UpdateSamplingLayout("AttributeSamplers[0]." + compositionName);
                }
            }
Exemplo n.º 2
0
        public ImageEffectShader GetShader(RenderDrawContext context, VoxelAttribute attr)
        {
            VoxelViewContext viewContext = new VoxelViewContext(voxelView: false);

            Matrix ViewProjection = context.RenderContext.RenderView.ViewProjection;

            voxelDebugEffectShader.Parameters.Set(VoxelVisualizationViewShaderKeys.view, ViewProjection);
            voxelDebugEffectShader.Parameters.Set(VoxelVisualizationViewShaderKeys.viewInv, Matrix.Invert(ViewProjection));
            voxelDebugEffectShader.Parameters.Set(VoxelVisualizationViewShaderKeys.background, (Vector4)Background);

            attr.UpdateSamplingLayout("AttributeSamplers[0]");
            attr.ApplySamplingParameters(viewContext, voxelDebugEffectShader.Parameters);
            MarchMethod.UpdateMarchingLayout("marcher");
            MarchMethod.ApplyMarchingParameters(voxelDebugEffectShader.Parameters);
            voxelDebugEffectShader.Parameters.Set(VoxelVisualizationViewShaderKeys.marcher, MarchMethod.GetMarchingShader(0));

            ShaderSourceCollection collection = new ShaderSourceCollection
            {
                attr.GetSamplingShader()
            };

            voxelDebugEffectShader.Parameters.Set(MarchAttributesKeys.AttributeSamplers, collection);

            return(voxelDebugEffectShader);
        }
Exemplo n.º 3
0
        public ImageEffectShader GetShader(RenderDrawContext context, VoxelAttribute attr)
        {
            VoxelViewContext viewContext = new VoxelViewContext(false);

            attr.UpdateSamplingLayout("Attribute");
            attr.ApplySamplingParameters(viewContext, voxelDebugEffectShader.Parameters);
            voxelDebugEffectShader.Parameters.Set(VoxelVisualizationRawShaderKeys.Attribute, attr.GetSamplingShader());
            voxelDebugEffectShader.Parameters.Set(VoxelVisualizationRawShaderKeys.mip, Mipmap);
            voxelDebugEffectShader.Parameters.Set(VoxelVisualizationRawShaderKeys.rangeOffset, RangeOffset);
            voxelDebugEffectShader.Parameters.Set(VoxelVisualizationRawShaderKeys.range, Range);

            return(voxelDebugEffectShader);
        }