/// <summary> /// this helps clear stencil buffer because `glClear(GL_STENCIL_BUFFER_BIT);` doesn't work on my laptop. /// </summary> /// <returns></returns> public static ClearStencilNode Create() { var model = new ClearStencilModel(); var vs = new VertexShader(vertexCode); var fs = new FragmentShader(fragmentCode); var array = new ShaderArray(vs, fs); var map = new AttributeMap(); var builder = new RenderMethodBuilder(array, map, new DepthMaskState(false), new ColorMaskState(false, false, false, false)); var node = new ClearStencilNode(model, builder); node.Initialize(); return(node); }
/// <summary> /// Render depth buffer, extrude shadow volume, record occlusions by stencil operation, light up the scene according to stencil test and finally render the ambient color. /// </summary> /// <param name="scene"></param> public ShadowVolumeAction(Scene scene) { this.scene = scene; this.clearStencilNode = ClearStencilNode.Create(); }