public void Draw(DrawState state) { SetupShadowShader(state); //set render mode to shadow map state.PushDrawFlag(new ModelInstance.ShaderProviderFlag(this.shaderProvider)); state.PushDrawFlag(TutorialRenderMode.DrawShadow); //Push the shadow map camera as a post-culler. //This way, anything not within the frustum of the shadow map //camera will not be drawn with the shadow shader state.PushPostCuller(this.shadowMapTarget.Camera); //set an additive blending mode state.PushRenderState(); state.RenderState.AlphaBlend = AlphaBlendState.Additive; state.RenderState.DepthColourCull.DepthWriteEnabled = false; //draw the shadowed scene scene.Draw(state); state.PopRenderState(); state.PopPostCuller(); state.PopDrawFlag <TutorialRenderMode>(); state.PopDrawFlag <ModelInstance.ShaderProviderFlag>(); }
public void Draw(DrawState state) { //set the draw flags up, which will control rendering //this will make the models render depth state.PushDrawFlag(new ModelInstance.ShaderProviderFlag(this.shaderProvider)); state.PushDrawFlag(TutorialRenderMode.DepthOutput); //draw the scene scene.Draw(state); //reset the flags state.PopDrawFlag <ModelInstance.ShaderProviderFlag>(); state.PopDrawFlag <TutorialRenderMode>(); }
protected override void Draw(DrawState state) { //draw the shadow map texture first, drawShadowDepth.Draw(state); //apply the blur filter to the shadow texture shadowDepthBlurFilter.Draw(state); //set a global light collection (that all models will use) state.PushDrawFlag(new MaterialLightCollection.LightCollectionFlag(ambientLight)); //draw the scene to the screen drawToScreen.Draw(state); //reset the flag state.PopDrawFlag <MaterialLightCollection.LightCollectionFlag>(); }