public void IncludeComposedShader(ComposedShader shader) { shader.Link(); shader.Use(); CurrentShader = shader; RefreshDefaultUniforms(shader); if (shader.IsTessellator) { RefreshTessUniforms(shader); } ComposedShaders.Add(shader); }
public override void PreRenderOnce(RenderingContext rc) { base.PreRenderOnce(rc); if (typeof(Text).IsInstanceOfType(geometry)) { // 2D Text Shader, used to apply transparancy. Since alpha blending didnt work transparent background IncludeDefaultShader(ColorReplaceShader.vertexShaderSource, ColorReplaceShader.fragmentShaderSource); } else if (typeof(Sphere).IsInstanceOfType(geometry)) { // TESSELLATION IncludeTesselationShaders(TriangleTessShader.tessControlShader, TriangleTessShader.tessEvalShader, TriangleTessShader.geometryShaderSource); //CurrentShader.SetFieldValue("spherical", 1); } else { CurrentShader = ShaderCompiler.BuildDefaultShader(); } if (ComposedShaders.Any()) { CurrentShader = ComposedShaders.First(); } CurrentShader.Link(); CurrentShader.Use(); CollectMaterials(); RefreshDefaultUniforms(); Geometry(rc); }