public void DrawShadowMap(SceneGraph3D graph) { Active = this; Cam3D cam = new Cam3D(); Effect.FXG.Cam = cam; cam.FOV = 90; cam.MaxZ = Quality.ShadowDepth; graph.CamOverride = cam; cam.LocalPos = LocalPos; cam.MaxZ = Quality.ShadowDepth; // cam.LocalTurn = LocalTurn; int fn = 0; GL.Disable(EnableCap.ScissorTest); App.SetVP.Set(0, 0, App.AppInfo.W, App.AppInfo.H); TextureTarget f = ShadowFB.SetFace(fn); SetCam(f, cam); graph.RenderingShadows = true; graph.RenderDepth(); SetCam(ShadowFB.SetFace(1), cam); graph.RenderDepth(); // ShadowFB.Release(); graph.CamOverride = null; SetCam(ShadowFB.SetFace(2), cam); graph.RenderDepth(); SetCam(ShadowFB.SetFace(3), cam); graph.RenderDepth(); SetCam(ShadowFB.SetFace(4), cam); graph.RenderDepth(); SetCam(ShadowFB.SetFace(5), cam); graph.RenderDepth(); ShadowFB.Release(); graph.RenderingShadows = false; graph.CamOverride = null; }
public void DrawShadowMap(SceneGraph3D graph) { Active = this; Cam3D cam = new Cam3D(); Effect.FXG.Cam = cam; cam.FOV = 90; cam.MaxZ = Quality.ShadowDepth; Effect.FXG.Proj = cam.ProjMat; graph.CamOverride = cam; cam.LocalPos = LocalPos; cam.MaxZ = Quality.ShadowDepth; // cam.LocalTurn = LocalTurn; int fn = 0; TextureTarget f = ShadowFB.SetFace(fn); SetCam(f, cam); graph.RenderDepth( ); SetCam(ShadowFB.SetFace(1), cam); graph.RenderDepth( ); // ShadowFB.Release(); graph.CamOverride = null; SetCam(ShadowFB.SetFace(2), cam); graph.RenderDepth( ); SetCam(ShadowFB.SetFace(3), cam); graph.RenderDepth( ); SetCam(ShadowFB.SetFace(4), cam); graph.RenderDepth( ); SetCam(ShadowFB.SetFace(5), cam); graph.RenderDepth( ); ShadowFB.Release( ); graph.CamOverride = null; }
private void DrawFace(int i) { TextureTarget face = FB.SetFace(i); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); switch (face) { case TextureTarget.TextureCubeMapPositiveX: Cam.LookAtZero(new Vector3(1, 0, 0), new Vector3(0, 1, 0)); break; case TextureTarget.TextureCubeMapNegativeX: Cam.LookAtZero(new Vector3(-1, 0, 0), new Vector3(0, 1, 0)); break; case TextureTarget.TextureCubeMapPositiveY: Cam.LookAtZero(new Vector3(0, 10, 0), new Vector3(1, 0, 0)); break; case TextureTarget.TextureCubeMapNegativeY: Cam.LookAtZero(new Vector3(0, -10, 0), new Vector3(1, 0, 0)); break; case TextureTarget.TextureCubeMapPositiveZ: Cam.LookAtZero(new Vector3(0, 0, 10), new Vector3(0, 1, 0)); break; case TextureTarget.TextureCubeMapNegativeZ: Cam.LookAtZero(new Vector3(0, 0, -10), new Vector3(0, 1, 0)); break; } Scene.CamOverride = Cam; Scene.Render(); Scene.CamOverride = null; FB.Release(); }