private void CreateObjects()
        {
            try
            {
                #region Mesh3Ds

                Bridge = new Mesh3D(device3d, "Bridge.x", new Vector3(1f, 1f, 0.5f),
                    CustomVertex.PositionColoredTextured.Format);

                hall_interior = new Mesh3D(device3d, "hall-interior.x", new Vector3(0.07f, 0.09f, 0.07f),
                    CustomVertex.PositionColoredTextured.Format);

                STUT_C_L = new Mesh3D(device3d, "STUT_C_L.x", new Vector3(0.07f, 0.09f, 0.07f),
                    CustomVertex.PositionColoredTextured.Format);

                Miz = new Mesh3D(device3d, "Miz2.x", new Vector3(0.4f, 0.4f, 0.3f),
                    CustomVertex.PositionColoredTextured.Format);

                ERZHER_H = new Mesh3D(device3d, "ERZHER_H.x", new Vector3(0.2f, 0.2f, 0.2f),
                    CustomVertex.PositionColoredTextured.Format);

                Urn = new Mesh3D(device3d, "urn.x", new Vector3(1f, 1f, 1f),
                    CustomVertex.PositionColoredTextured.Format);

                Urn2 = new Mesh3D(device3d, "urn2.x", new Vector3(1f, 1f, 1f),
                    CustomVertex.PositionColoredTextured.Format);

                Pottry = new Mesh3D(device3d, "POTTRY2.x", new Vector3(1f, 1f, 1f),
                    CustomVertex.PositionColoredTextured.Format);

                Vase = new Mesh3D(device3d, "Vase.x", new Vector3(1f, 1f, 1f),
                    CustomVertex.PositionColoredTextured.Format);

                Vase2 = new Mesh3D(device3d, "vase2.x", new Vector3(0.03f, 0.03f, 0.03f),
                    CustomVertex.PositionColoredTextured.Format);

                CANOPES = new Mesh3D(device3d, "CANOPES_.x", new Vector3(0.00035f, 0.00035f, 0.00035f),
                    CustomVertex.PositionColoredTextured.Format);

                CANNON1 = new Mesh3D(device3d, "CANNON1.x", new Vector3(0.02f, 0.02f, 0.02f),
                    CustomVertex.PositionColoredTextured.Format);

                #endregion
                #region SplashScreen objects
                //
                // SplashScreen
                //
                btnStart = new SplashButton[1];
                btnStart[0] = new SplashButton((Form)device3d.CreationParameters.FocusWindow, device3d, new Point((width / 2) - 125, height - 300), new Size(250, 100),
                         @"SplashScreen\START_Normal.png", @"SplashScreen\START_MouseOver.png",
                         @"SplashScreen\START_MouseDown.png", @"SplashScreen\START_Disable.png");
                sps = new SplashScreen(device3d, @"SplashScreen\SplashScreen.png", btnStart);
                #endregion
                #region SoundBox
                //
                // sounds
                //
                walk_Sound = new SoundBox((System.Windows.Forms.Form)device3d.CreationParameters.FocusWindow,
                                    @"mySounds\walk.wav");
                background_Music = new SoundBox((System.Windows.Forms.Form)device3d.CreationParameters.FocusWindow);
                background_Music.SetBackMusic(@"mySounds\backMusic.mp3");
                background_Music.backMusicVolume = -700;
                #endregion
                //
                //
                //
                device3d.SamplerState[0].MinFilter = TextureFilter.Anisotropic;
                device3d.SamplerState[0].MagFilter = TextureFilter.Anisotropic;
                device3d.SamplerState[0].AddressU = TextureAddress.Mirror;
                device3d.SamplerState[0].AddressV = TextureAddress.Mirror;
                //
                //
                //
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "Textures or Mesh3Ds are not OK.");
                System.Environment.Exit(0);
            }
        }
Esempio n. 2
0
        private void createObjects()
        {
            try
            {
                #region textures
                //
                // Define Array for 6 face of a Cube (my Room)
                // tW[0] = Floor
                // tW[1] = Front Wall
                // tW[2] = Front Wall
                // tW[3] = Front Wall
                // _door = Door
                // tW[4] = Right Wall
                // tW[5] = Left Wall
                // tW[6] = Back Wall
                // tW[7] = Top
                // tW[8] = Carpet
                // tW[9] = right Tableau
                // tW[10] = left Tableau
                // tW[11] = window Frame
                // _window = window
                tW = new textureWall[12];
                //
                // Floor
                tW[0] = new textureWall(device3d, false, new threeAxisRectangle(new Vector3(0, 0, 0),
                    (trainWidth * drawStep), 0, (trainDepth * drawStep)), drawStep, 0, drawStep,
                    @"myTextures/ConcreteFloor.jpg");
                //
                // Front Wall
                tW[1] = new textureWall(device3d, false, new threeAxisRectangle(new Vector3(150, 0, (trainDepth * drawStep)),
                    (2 * 75), (4 * 75), 0), 75, 75, 0,
                    @"myTextures/TilesOrnate_Front.jpg");
                tW[2] = new textureWall(device3d, false, new threeAxisRectangle(new Vector3(0, 0, (trainDepth * drawStep)),
                    (1 * 75), (4 * 75), 0), 75, 75, 75,
                    @"myTextures/TilesOrnate_Front.jpg");
                tW[3] = new textureWall(device3d, false, new threeAxisRectangle(new Vector3(75, 225, (trainDepth * drawStep)),
                    (1 * 75), (1 * 75), 0), 75, 75, 75,
                    @"myTextures/TilesOrnate_Front.jpg");
                //
                // Door
                _door = new Door(device3d, true,
                    new threeAxisRectangle(new Vector3(74, 0, (trainDepth * drawStep)), 77, 226, 0),
                    77, 226, 0, @"myTextures/door.jpg", 1.8f);
                _door.speed = 0.04f;
                //
                // Right Wall
                tW[4] = new textureWall(device3d, false, new threeAxisRectangle(new Vector3(0, 0, 0),
                    0, (trainHeight * drawStep), (trainDepth * drawStep)), drawStep, drawStep, drawStep,
                    @"myTextures/TilesOrnate.jpg");
                //
                // Left Wall
                tW[5] = new textureWall(device3d, false, new threeAxisRectangle(new Vector3((trainWidth * drawStep), 0, 0),
                    0, (trainHeight * drawStep), (trainDepth * drawStep)), drawStep, drawStep, drawStep,
                    @"myTextures/TilesOrnate.jpg");
                //
                // Back Wall
                tW[6] = new textureWall(device3d, false, new threeAxisRectangle(new Vector3(0, 0, 0),
                    (trainWidth * drawStep), (trainHeight * drawStep), 0), drawStep, drawStep, drawStep,
                    @"myTextures/TilesOrnate.jpg");
                //
                // Top
                tW[7] = new textureWall(device3d, true, new threeAxisRectangle(new Vector3(0, (trainHeight * drawStep), 0),
                    300, 0, 300), 300, 0, 300,
                    @"myTextures/OrnamentsRound.jpg");
                //
                // Carpet
                tW[8] = new textureWall(device3d, true,
                    new threeAxisRectangle(new Vector3(25, 0.1f, 50), 250, 0, 150),
                    250, 0, 150, @"myTextures/PersianCarpets.jpg");
                //
                // right Tableau
                tW[9] = new textureWall(device3d, true,
                    new threeAxisRectangle(new Vector3(1, (trainHeight / 2) * drawStep, (trainDepth / 3) * drawStep), 0, 90, 100),
                    0, 90, 100, @"myTextures/rightTableau.jpg");
                //
                // left Tableau
                tW[10] = new textureWall(device3d, true,
                    new threeAxisRectangle(new Vector3((trainWidth * drawStep) - 1, ((trainHeight / 2) * drawStep) - 20, (trainDepth / 3) * drawStep),
                    0, 100, 75), 0, 100, 75, @"myTextures/leftTableau.jpg");
                //
                // window Frame
                tW[11] = new textureWall(device3d, true,
                    new threeAxisRectangle(new Vector3(((trainWidth / 2) * drawStep), ((trainHeight / 2) * drawStep) - 20, 0.1f),
                    100, 75, 0), 100, 75, 0, @"myTextures/view_out_our_window.png");
                //
                // window
                _window = new window(device3d, true, openTranslationVector.Right, 40f,
                    new threeAxisRectangle(new Vector3(((trainWidth / 2) * drawStep) + 50.8f, ((trainHeight / 2) * drawStep) - 15, 0.2f),
                    46, 67, 0), 46, 67, 0, @"myTextures/window.png", true);

                #region road Textures
                roadTextures = new textureWall[3];
                roadTextures[0] = new textureWall(device3d, false,
                    new threeAxisRectangle(new Vector3(50, 1, 305), 150, 0, 900),
                    150, 0, 150, @"myTextures/FloorHerringbone.jpg");
                roadTextures[1] = new textureWall(device3d, false,
                    new threeAxisRectangle(new Vector3(200, 1, 500), 600, 0, 150),
                    150, 0, 150, @"myTextures/FloorHerringbone.jpg");
                roadTextures[2] = new textureWall(device3d, false,
                   new threeAxisRectangle(new Vector3(-550, 1, 500), 600, 0, 150),
                   150, 0, 150, @"myTextures/FloorHerringbone.jpg");
                #endregion
                #endregion
                #region Mesh3Ds
                //
                // Mesh3Ds
                chairMesh3d = new Mesh3D(device3d, "MALLETCH.x", new Vector3(0.025f, 0.025f, 0.025f),
                    CustomVertex.PositionTextured.Format);
                dinerTableMesh3d = new Mesh3D(device3d, "DinerTable.x", new Vector3(1.2f, 1.2f, 1.2f),
                    CustomVertex.PositionTextured.Format);
                pottryMesh3d = new Mesh3D(device3d, "POTTRY2.x", new Vector3(3f, 3f, 3f),
                    CustomVertex.PositionTextured.Format);
                Sky = new SkyBox(device3d, "skybox.x", new Vector3(300.5f, 200.5f, 300f),
                    CustomVertex.PositionTextured.Format);
                extLump = new Mesh3D(device3d, "Lump1.x", new Vector3(3f, 2.5f, 3f),
                    CustomVertex.PositionTextured.Format);
                roadBarriers = new Mesh3D(device3d, "Barriers.x", new Vector3(1f, 1f, 1f),
                    CustomVertex.PositionTextured.Format);
                #endregion
                #region SplashScreen objects
                //
                // SplashScreen
                //
                btnStart = new SplashButton[1];
                btnStart[0] = new SplashButton((Form)device3d.CreationParameters.FocusWindow, device3d, new Point((width / 2) - 125, height - 300), new Size(250, 100),
                         @"SplashScreen\START_Normal.png", @"SplashScreen\START_MouseOver.png",
                         @"SplashScreen\START_MouseDown.png", @"SplashScreen\START_Disable.png");
                sps = new SplashScreen(device3d, @"SplashScreen\SplashScreen.png", btnStart);
                #endregion
                #region SoundBox
                //
                // sounds
                //
                doorOpen_Sound = new SoundBox((System.Windows.Forms.Form)device3d.CreationParameters.FocusWindow,
                                    @"mySounds\door_open.wav");
                doorClose_Sound = new SoundBox((System.Windows.Forms.Form)device3d.CreationParameters.FocusWindow,
                                    @"mySounds\door_close.wav");
                windowOpen_Sound = new SoundBox((System.Windows.Forms.Form)device3d.CreationParameters.FocusWindow,
                                    @"mySounds\folding-door-open.wav");
                windowClose_Sound = new SoundBox((System.Windows.Forms.Form)device3d.CreationParameters.FocusWindow,
                                    @"mySounds\folding-door-close.wav");
                walk_Sound = new SoundBox((System.Windows.Forms.Form)device3d.CreationParameters.FocusWindow,
                                    @"mySounds\walk.wav");
                background_Music = new SoundBox((System.Windows.Forms.Form)device3d.CreationParameters.FocusWindow);
                background_Music.SetBackMusic(@"mySounds\backMusic.mp3");
                background_Music.backMusicVolume = -700;
                #endregion
                //
                //
                //
                device3d.SamplerState[0].MinFilter = TextureFilter.Anisotropic;
                device3d.SamplerState[0].MagFilter = TextureFilter.Anisotropic;
                device3d.SamplerState[0].AddressU = TextureAddress.Mirror;
                device3d.SamplerState[0].AddressV = TextureAddress.Mirror;
                //
                //
                //
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "Textures or Mesh3Ds are not OK.");
                System.Environment.Exit(0);
            }
        }