Пример #1
0
        public void IncludeComposedShader(ComposedShader shader)
        {
            shader.Link();
            shader.Use();

            CurrentShader = shader;

            RefreshDefaultUniforms(shader);

            if (shader.IsTessellator)
            {
                RefreshTessUniforms(shader);
            }

            ComposedShaders.Add(shader);
        }
Пример #2
0
        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);
        }