Ejemplo n.º 1
0
        public void AddMultistepOrder(MultistepRenderingProcessOrder <Texture, TextureRenderingTemplate> processOrder)
        {
            var template = processOrder.Order;

            Preconditions.Assert(template.RenderingRectangle == null, "E781: Cannot render multistep when filling RenderTexture!");

            var outTextureInfo = template.OutTextureInfo;
            var shaderName     = template.ShaderName;
            var pack           = template.UniformPack;
            var material       = new Material(Shader.Find(shaderName));

            template.Keywords.EnableInMaterial(material);
            pack.SetUniformsToMaterial(material);
            var renderTextureFormat = template.RenderTextureFormat;

            MultistepTextureRenderingInput input = new MultistepTextureRenderingInput()
            {
                MultistepCoordUniform = new MultistepRenderingCoordUniform(
                    new Vector4(
                        template.Coords.X,
                        template.Coords.Y,
                        template.Coords.Width,
                        template.Coords.Height
                        ), "_Coords"),
                OutTextureinfo          = outTextureInfo,
                RenderTextureInfoFormat = renderTextureFormat,
                RenderMaterial          = material,
                StepSize        = _configuration.StepSize,
                CreateTexture2D = template.CreateTexture2D
            };

            _multistepTextureRenderer.StartRendering(input);
            _multistepProcessOrder = processOrder;
        }
Ejemplo n.º 2
0
 public void Update()
 {
     if (_multistepTextureRenderer.IsActive)
     {
         if (_multistepTextureRenderer.RenderingCompleted())
         {
             var texture = _multistepTextureRenderer.RetriveRenderedTexture();
             _multistepProcessOrder.Tcs.SetResult(texture);
             _multistepProcessOrder = null;
         }
         else
         {
             _multistepTextureRenderer.Update();
         }
     }
 }