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); }); } }
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); }); } }