Draw() public method

public Draw ( ShaderSetupHook hook = null ) : void
hook ShaderSetupHook
return void
Exemplo n.º 1
0
        public void Apply(RenderTexture inRenderTexture = null)
        {
            if (inRenderTexture == null)
            {
                inRenderTexture = renderTexture;
            }

            if (textures != null)
            {
                int texture_unit = 2;
                foreach (string uniform in textures.Keys)
                {
                    Graphics.BindTextureToUnit(textures[uniform].Id, texture_unit);
                    screenMesh.shader.SetUniform(uniform, texture_unit);
                    texture_unit++;
                }
            }

            if (!this.useDepth)
            {
                screenMesh.DrawRenderTexture(inRenderTexture);
            }
            else
            {
                screenMesh.Draw((m) =>
                {
                    Graphics.BindTextureToUnit(inRenderTexture.TextureId, 0);
                    Graphics.BindTextureToUnit(inRenderTexture.DepthTextureId, 1);
                    m.shader.SetUniform("tex", 0);
                    m.shader.SetUniform("depth_tex", 1);
                });
            }
        }
Exemplo n.º 2
0
 public void Apply(Window window)
 {
     if (!this.useDepth)
     {
         screenMesh.DrawTexture(renderTexture);
     }
     else
     {
         screenMesh.Draw((m) =>
         {
             Graphics.BindTextureToUnit(renderTexture.Id, 0);
             Graphics.BindTextureToUnit(renderTexture.DepthId, 1);
             m.shader.SetUniform("tex", 0);
             m.shader.SetUniform("depth_tex", 1);
         });
     }
 }