Exemplo n.º 1
0
        protected override void LoadScene()
        {
            //load textures
            List <String> a = new List <string>();

            a.Add("ft.png");
            a.Add("bk.png");
            a.Add("up.png");
            a.Add("dn.png");
            a.Add("rt.png");
            a.Add("lf.png");

            skyboxtex = new Texture("../../assets/sky/darkskies_", a);
            woodtex   = new Texture("../../assets/wood.jpg");
            furtex    = new Texture("../../assets/furt.png");
            martex    = new Texture("../../assets/Mario Kart/Mario/Tex/mariotex.png");
            peatex    = new Texture("../../assets/Mario Kart/Peach/Tex/peachtex.png");
            yostex    = new Texture("../../assets/Mario Kart/Yoshi/Tex/yoshitex.png");
            mkartex   = new Texture("../../assets/Mario Kart/Mario/Tex/karttex.png");
            pkartex   = new Texture("../../assets/Mario Kart/Peach/Tex/karttex.png");
            ykartex   = new Texture("../../assets/Mario Kart/Yoshi/Tex/karttex.png");
            wheeltex  = new Texture("../../assets/Mario Kart/Mario/Tex/wheeltex.png");
            maptex1   = new Texture("../../assets/Mario Kart/Maps/KPBeach/236F857A_c.png");
            nultex    = new Texture("../../assets/null.png");
            startex   = new Texture("../../assets/Mario Kart/Star/Mario's Star Image.png");

            // create shaders
            shader       = new Shader("../../shaders/vs.glsl", "../../shaders/fs.glsl");
            shader_sky   = new Shader("../../shaders/vs_sky.glsl", "../../shaders/fs_sky.glsl");
            postproc     = new Shader("../../shaders/vs_post.glsl", "../../shaders/fs_post.glsl");
            shader_light = new Shader("../../shaders/vs.glsl", "../../shaders/fs_light.glsl");
            shader_fur   = new Shader("../../shaders/vs_fur.glsl", "../../shaders/fs_fur.glsl");

            // load entities
            kart1  = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Kart.obj"), shader, mkartex, skyboxtex);
            mario  = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Mario.obj"), shader, martex, skyboxtex);
            wheel1 = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Wheels.obj"), shader, wheeltex, skyboxtex);
            kart2  = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Kart.obj"), shader, pkartex, skyboxtex);
            peach  = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Peach/Peach.obj"), shader, peatex, skyboxtex);
            wheel2 = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Wheels.obj"), shader, wheeltex, skyboxtex);
            kart3  = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Kart.obj"), shader, ykartex, skyboxtex);
            yoshi  = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Yoshi/Yoshi.obj"), shader, yostex, skyboxtex);
            wheel3 = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Wheels.obj"), shader, wheeltex, skyboxtex);
            floor2 = new EntitySkyReflect(new Mesh("../../assets/floor.obj"), shader, nultex, skyboxtex);
            floor  = new EntityFur(new Mesh("../../assets/floor.obj"), shader_fur, furtex);
            map    = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Maps/KPBeach/KoopaTroopaBeach.obj"), shader, maptex1, skyboxtex);
            star   = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Star/Star.obj"), shader, startex, skyboxtex);

            //Move and scale entities
            map.Move(new Vector3(0, -2, -1));
            floor.Move(new Vector3(0, 0, -4));
            kart1.Rotate(new Vector3(1.57f, 0.0f, 1.57f));
            kart1.Move(new Vector3(0, -2, -3));
            kart2.Rotate(new Vector3(1.57f, 0.0f, 3.14f));
            kart2.Move(new Vector3(3, -2, 0));
            kart3.Rotate(new Vector3(1.57f, 0.0f, 4.71f));
            kart3.Move(new Vector3(0, -2, 3));
            star.Scale(new Vector3(.5f, .5f, .5f));
            star.Move(new Vector3(0, -1, 0));

            //Add them to scenegraph
            scenegraph = new SceneGraph();
            scenegraph.AddRootEntity(map);
            scenegraph.AddRootEntity(floor);
            scenegraph.AddEntity(floor2, floor);
            scenegraph.AddEntity(kart1, floor2);
            scenegraph.AddEntity(mario, kart1);
            scenegraph.AddEntity(wheel1, kart1);
            scenegraph.AddEntity(kart2, floor2);
            scenegraph.AddEntity(peach, kart2);
            scenegraph.AddEntity(wheel2, kart2);
            scenegraph.AddEntity(kart3, floor2);
            scenegraph.AddEntity(yoshi, kart3);
            scenegraph.AddEntity(wheel3, kart3);
            scenegraph.AddEntity(star, floor2);

            //Load skybox
            skyboxmesh = new Mesh("../../assets/cube1.obj");

            lights = new List <EntityLight>();
            lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(20, 0, 0)));
            lights[0].SetPostition(new Vector3(5, 5, -3));

            lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(0, 0, 20)));
            lights[1].SetPostition(new Vector3(5, 1, -5));

            lights.Add(new EntityLight(null, null, null, new Vector3(20, 20, 20)));
            lights[2].SetPostition(new Vector3(0, 2, -4));

            for (int i = 0; i < lights.Count - 1; i++)
            {
                scenegraph.AddRootEntity(lights[i]);
            }
        }
Exemplo n.º 2
0
        protected override void LoadScene()
        {
            //load textures
            List <String> a = new List <string>();

            a.Add("ft.png");
            a.Add("bk.png");
            a.Add("up.png");
            a.Add("dn.png");
            a.Add("rt.png");
            a.Add("lf.png");

            skyboxtex = new Texture("../../assets/sky/darkskies_", a);
            woodtex   = new Texture("../../assets/wood.png");
            furtex    = new Texture("../../assets/fur2.png");

            // create shaders
            shader       = new Shader("../../shaders/vs.glsl", "../../shaders/fs.glsl");
            shader_light = new Shader("../../shaders/vs.glsl", "../../shaders/fs_light.glsl");
            shader_sky   = new Shader("../../shaders/vs_sky.glsl", "../../shaders/fs_sky.glsl");
            postproc     = new Shader("../../shaders/vs_post.glsl", "../../shaders/fs_post.glsl");
            shader_fur   = new Shader("../../shaders/vs_fur.glsl", "../../shaders/fs_fur.glsl");

            // load entities
            pot      = new EntitySkyReflect(new Mesh("../../assets/teapot.obj", 0.3f, 0.3f, 0.3f), shader, woodtex, skyboxtex);
            floor    = new EntityFur(new Mesh("../../assets/floor.obj"), shader_fur, furtex);
            floor2   = new EntitySkyReflect(new Mesh("../../assets/floor.obj"), shader, woodtex, skyboxtex);
            penguin  = new EntitySkyReflect(new Mesh("../../assets/pin.obj"), shader, woodtex, skyboxtex);
            penguin2 = new EntitySkyReflect(new Mesh("../../assets/pin.obj"), shader, woodtex, skyboxtex);

            //Move and scale entities
            penguin.Move(new Vector3(20.0f, 1.0f, 1.0f));
            penguin2.Move(new Vector3(5.0f, 1.0f, 5.0f));
            floor2.Scale(new Vector3(10.0f, 10.0f, 10.0f));
            floor2.Move(new Vector3(0, 0.0f, 0));

            //Add them to scenegraph
            scenegraph = new SceneGraph();
            scenegraph.AddRootEntity(floor);
            scenegraph.AddEntity(pot, floor);
            scenegraph.AddEntity(penguin, pot);
            scenegraph.AddRootEntity(penguin2);
            scenegraph.AddRootEntity(floor2);

            //Load skybox
            skyboxmesh = new Mesh("../../assets/cube1.obj");

            lights = new List <EntityLight>();
            lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(200, 0, 0)));
            lights[0].SetPostition(new Vector3(5, 1, 5));

            lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(0, 250, 0)));
            lights[1].SetPostition(new Vector3(-5, 1, 5));

            lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(0, 0, 200)));
            lights[2].SetPostition(new Vector3(5, 1, -5));

            lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(100, 100, 100)));
            lights[3].SetPostition(new Vector3(-5, 1, -5));

            for (int i = 0; i < lights.Count; i++)
            {
                scenegraph.AddRootEntity(lights[i]);
            }
        }