예제 #1
0
 private static void ChangeCubeMap(ref ICubeMap cubeMap, string cubeNameType)
 {
     cubeMap = CubeMapFactory.Create(2500, false, new Vector3(0, 0, 0),
                                     Utils.Utils.GetImageResource <ICubeMap>(string.Format("EnvironmentMap.Textures.{0}.{0}_front.jpg", cubeNameType)),
                                     Utils.Utils.GetImageResource <ICubeMap>(string.Format("EnvironmentMap.Textures.{0}.{0}_back.jpg", cubeNameType)),
                                     Utils.Utils.GetImageResource <ICubeMap>(string.Format("EnvironmentMap.Textures.{0}.{0}_back.jpg", cubeNameType)),
                                     Utils.Utils.GetImageResource <ICubeMap>(string.Format("EnvironmentMap.Textures.{0}.{0}_top.jpg", cubeNameType)),
                                     Utils.Utils.GetImageResource <ICubeMap>(string.Format("EnvironmentMap.Textures.{0}.{0}_left.jpg", cubeNameType)),
                                     Utils.Utils.GetImageResource <ICubeMap>(string.Format("EnvironmentMap.Textures.{0}.{0}_right.jpg", cubeNameType))
                                     );
     cubeMap.Load();
 }
예제 #2
0
        public void CubeMap_OK()
        {
            //Act
            ICubeMap cubeMap = CubeMapFactory.Create(100, false, new Vector3(0, 0, 0),
                                                     Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Front.bmp"),
                                                     Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Left.bmp"),
                                                     Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Front.bmp"),
                                                     Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Top.bmp"),
                                                     Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Back.bmp"),
                                                     Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Right.bmp"));

            //Assert
            Assert.AreEqual(new Vector3(0, 0, 0), cubeMap.Center, "CubeMap center");
            Assert.AreEqual(100, cubeMap.Width);
            Assert.AreEqual(typeof(Plane), cubeMap.FrontPlane.GetType(), "PlaneType");
        }
예제 #3
0
        static void Main(string[] args)
        {
            var gameWindow = new GameWindow(WindowWidth, WindowHeight, new GraphicsMode(32, 24, 0, 8), "Ocean sim (Grestner waves) and terrain", GameWindowFlags.Default, DisplayDevice.AvailableDisplays.Last());

            gameWindow.MakeCurrent();
            gameWindow.Context.LoadAll();

            Utils.Utils.GLRenderProperties(WindowWidth, WindowHeight);

            _camera = Factory <Camera.Camera> .Create(_cameraPosition0, LookAt0, new Vector3(0, 1, 0));


            _light = LightFactory.Create(new Vector3(-350.0f, 300.0f, 0.0f), new Color4(255, 255, 255, 1), new Color4(255, 255, 255, 1), new Color4(252, 252, 252, 1), LightName.Light0);
            _light.Load();



            _terrain = Terrainfactory.Create(Utils.Utils.GetImageResource <ITerrain>("Landscape.Terrains.TOPOMAP1.GIF"),
                                             Utils.Utils.GetImageResource <ITerrain>("Landscape.Terrains.Dirt.jpg"),
                                             Utils.Utils.GetImageResource <ITerrain>("Landscape.Terrains.sand.jpg"),
                                             Utils.Utils.GetImageResource <ITerrain>("Landscape.Terrains.Grass.png"),
                                             Utils.Utils.GetImageResource <ITerrain>("Landscape.Terrains.Rock.png"));
            _terrain.Load();


            _cubeMap = CubeMapFactory.Create(2500, false, new Vector3(256, 0, 256),
                                             Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Desert.Desert_front.jpg"),
                                             Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Desert.Desert_back.jpg"),
                                             Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Desert.Desert_front.jpg"),
                                             Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Desert.Desert_top.jpg"),
                                             Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Desert.Desert_left.jpg"),
                                             Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.Desert.Desert_right.jpg")
                                             );
            _cubeMap.Load();

            _woodenChest = CubeMapFactory.Create(100, true, new Vector3(256, 150, 256), Utils.Utils.GetImageResource <ICubeMap>("EnvironmentMap.Textures.plank.jpg"));
            _woodenChest.Load();

            _water = new Water(WaterWidth, WaterHeight);
            _water.Load();

            _seaBed = PlaneFactory.Create(true, new Vbo()
            {
                Position = new Vector3(0, -70, 0), Normal = new Vector3(0, 1, 0), TexCoord = new Vector2(0, 0)
            },
                                          new Vbo()
            {
                Position = new Vector3(0, -70, WaterHeight), Normal = new Vector3(0, 1, 0), TexCoord = new Vector2(0, 1)
            },
                                          new Vbo()
            {
                Position = new Vector3(WaterWidth, -70, WaterHeight), Normal = new Vector3(0, 1, 0), TexCoord = new Vector2(1, 1)
            },
                                          new Vbo()
            {
                Position = new Vector3(WaterWidth, -70, 0), Normal = new Vector3(0, 1, 0), TexCoord = new Vector2(1, 0)
            },
                                          Utils.Utils.GetImageResource <ITerrain>("Landscape.Terrains.seabed.jpg"), TextureWrapMode.ClampToEdge);
            _seaBed.Load();

            _birdTexture = FramBufferOBjectFactory.Create(512, 512);
            _birdTexture.Load();

            gameWindow.RenderFrame += gameWindow_RenderFrame;
            gameWindow.UpdateFrame += gameWindow_UpdateFrame;

            gameWindow.Keyboard.KeyDown += Keyboard_KeyDown;
            gameWindow.Run(60.0, 30.0);
        }