コード例 #1
0
ファイル: VLight.cs プロジェクト: VividMaster/Rebound
        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;
        }
コード例 #2
0
        public override void InitState()
        {
            MenuBG = new VTex2D("Data\\2D\\Backgrounds\\MainMenu\\menubg.jpg", LoadMethod.Single, false);

            Music = StarSoundSys.Play2DFile("Data\\Music\\Menu\\MainMenu\\MenuTheme1.mp3");

            UI = new UI();

            UI.Root = new ImageForm().Set(0, 0, StarEngine.App.StarApp.W, StarEngine.App.StarApp.H, "ImageForm").SetImage(MenuBG);

            UI.Root = new ButtonForm().Set(50, 100, 200, 40, "Test");

            var test = UI.Root;

            test.Click = (b) =>
            {
                Console.WriteLine("Yep!");
            };

            ppRen = new StarEngine.PostProcess.PostProcessRender(512, 512);
            Console.WriteLine("Creating 3D Scene graph.");
            scene3d = new SceneGraph3D();

            ppRen.Scene = scene3d;

            Console.WriteLine("Importing mesh.");
            ent1 = Import.ImportNode("Data\\3D\\Logo\\Menu\\Rebound1.3ds");
            Console.WriteLine("Set up.");
            var mat1 = new Material3D();

            //Console.WriteLine("Loading texture.");
            mat1.TCol  = new Tex2D("Data\\3D\\brick_2.png");
            mat1.TNorm = new Tex2D("Data\\3D\\brick_2_NRM.png");
            Console.WriteLine("Loaded.");


            var ge = ent1 as GraphEntity3D;

            ge.SetMat(mat1);
            cam1          = new GraphCam3D();
            cam1.LocalPos = new OpenTK.Vector3(0, 80, 450);


            cam1.LookAt(ent1);



            light1 = new StarEngine.Lighting.GraphLight3D();
            var l2 = new StarEngine.Lighting.GraphLight3D();
            var l3 = new StarEngine.Lighting.GraphLight3D();

            l3.LocalPos = new OpenTK.Vector3(300, 80, 450);
            l3.Diff     = new OpenTK.Vector3(0, 1, 2);

            l2.LocalPos = new OpenTK.Vector3(5, 200, 500);
            l2.Diff     = new OpenTK.Vector3(2, 2, 1);


            light1.LocalPos = new OpenTK.Vector3(0, 80, 350);

            //  ent1.Rot(new OpenTK.Vector3(0, 45, 0), Space.Local);



            scene3d.Add(ent1);

            scene3d.Add(l2);

            scene3d.Add(l3);

            scene3d.Add(light1);

            scene3d.Add(cam1);

            light1.Diff = new OpenTK.Vector3(3, 3, 3);
        }