예제 #1
0
        private static void SetCam(TextureTarget f, Cam3D Cam)
        {
            switch (f)
            {
            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, -1, 0), new Vector3(0, 0, -1));
                break;

            case TextureTarget.TextureCubeMapNegativeY:
                Cam.LookAtZero(new Vector3(0, 1, 0), new Vector3(0, 0, 1));
                break;

            case TextureTarget.TextureCubeMapPositiveZ:
                Cam.LookAtZero(new Vector3(0, 0, 1), new Vector3(0, -1, 0));
                break;

            case TextureTarget.TextureCubeMapNegativeZ:
                Cam.LookAtZero(new Vector3(0, 0, -1), new Vector3(0, -1, 0));
                break;
            }
        }
예제 #2
0
        public override void Present(Cam3D c)
        {
            SetMats(c);
            Bind();
            PreRender();
            Render();
            PostRender();
            Release();

            // Console.WriteLine("Rendering Particle.");
        }
예제 #3
0
        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;
        }
예제 #4
0
파일: Light3D.cs 프로젝트: Hengle/Fusion3D
        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;
        }