Exemple #1
0
        public void DrawShadowMap(SceneGraph3D graph)
        {
            Active = this;

            GraphCam3D cam = new GraphCam3D();

            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;

            var 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;
        }
Exemple #2
0
        private void DrawFace(int i)
        {
            var 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();
        }