private void Setup3D()
        {
            Console.WriteLine("Setting up 3D test.");
            Import.RegDefaults();
            Console.WriteLine("Setting up post-processing.");
            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\\testshadow1.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, 25, 120);


            //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(20, 40, 5);
            l3.Diff     = new OpenTK.Vector3(0, 1, 2);

            l2.LocalPos = new OpenTK.Vector3(5, 25, 20);
            l2.Diff     = new OpenTK.Vector3(1, 1, 1);


            light1.LocalPos = new OpenTK.Vector3(0, 10, 60);

            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(1, 1, 1);
        }
Exemple #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);
        }