Exemplo n.º 1
0
        public void T11_MakingSurePlaneWorksProperly()
        {
            // Given
            int initialFuel = 100;
            int fuelBurn    = 1;
            int fuelGain    = 3;

            PassingTime time  = new PassingTime();
            Plane       plane = PlaneFactory.Create(location: PlaneLocation.InAir, fuel: initialFuel, passingTime: time);

            time.AddTurn();
            time.AddTurn();
            time.AddTurn();
            time.AddTurn();

            Runway runway = new Runway("runway 01", RunwayStatus.Empty);

            plane.TryLandOn(runway);

            // When
            time.AddTurn();

            // Then
            Assert.IsTrue(plane.Fuel == initialFuel - 4 * fuelBurn + 1 * fuelGain);
        }
Exemplo n.º 2
0
 public Plane(PlaneFactory factory, CrewBuilder crewBuilder, int id)
 {
     Id    = id;
     Crew  = new Academy().ReturnCrew(crewBuilder);
     Type  = factory.CreateType();
     Model = factory.CreateModel();
 }
Exemplo n.º 3
0
        public void T16_PlaneGetsRepairedAfter10TurnsOnRunway()
        {
            // Given
            int initialFuel = 100;
            int maxFuel     = 100;

            PassingTime time  = new PassingTime();
            Plane       plane = PlaneFactory.Create(location: PlaneLocation.InAir, damage: PlaneDamage.Damaged,
                                                    fuel: initialFuel, maxFuel: maxFuel, passingTime: time);
            Runway runway = new Runway("runway 01", RunwayStatus.Empty);

            runway.AcceptPlane(plane);

            for (int i = 0; i < 9; i++) // 9 turns have passed
            {
                time.AddTurn();
            }

            Assert.IsTrue(plane.Damage == PlaneDamage.Damaged);

            // When
            time.AddTurn();

            // Then
            Assert.IsTrue(plane.Damage == PlaneDamage.None);
        }
Exemplo n.º 4
0
        public void T18_GoToRunwayAfter3TurnsOnHangar()
        {
            // Given
            int initialFuel = 100;
            int maxFuel     = 100;

            PassingTime time  = new PassingTime();
            Plane       plane = PlaneFactory.Create(location: PlaneLocation.OnRunway, damage: PlaneDamage.None,
                                                    fuel: initialFuel, maxFuel: maxFuel, passingTime: time);
            Plane plane2 = PlaneFactory.Create(location: PlaneLocation.OnRunway, damage: PlaneDamage.None,
                                               fuel: initialFuel, maxFuel: maxFuel, passingTime: time);

            Hangar.AddPlaneToHangar(plane);
            Hangar.AddPlaneToHangar(plane2);

            Runway runway = new Runway("runway 01", RunwayStatus.Empty);

            ControlTower tower = new ControlTower(new Runway[] { runway });

            runway.AcceptPlane(plane);

            for (int i = 0; i < 3; i++) // 9 turns have passed
            {
                time.AddTurn();
            }

            // When
            time.AddTurn();
            // Then
            Assert.IsTrue(plane.Location == PlaneLocation.OnRunway);
            Assert.IsTrue(plane2.Location == PlaneLocation.OnRunway);
        }
 public void Setup(Vector2 position, PlaneFactory planeFactory)
 {
     gameObject.SetActive(false);
     transform.position = position;
     _initialPosition   = position;
     _planeFactory      = planeFactory;
 }
Exemplo n.º 6
0
        public void Plane_OK()
        {
            Image image = Utils.Utils.GetImageResource <Terrain>("Landscape.Terrains.Grass.png");


            IPlane plane = PlaneFactory.Create(false,
                                               new Vbo()
            {
                Position = new Vector3(-1, 0, -1), Normal = new Vector3(0, 1, 0), TexCoord = new Vector2(0, 0)
            },
                                               new Vbo()
            {
                Position = new Vector3(-1, 0, 1), Normal = new Vector3(0, 1, 0), TexCoord = new Vector2(0, 1)
            },
                                               new Vbo()
            {
                Position = new Vector3(1, 0, 1), Normal = new Vector3(0, 1, 0), TexCoord = new Vector2(0, 1)
            },
                                               new Vbo()
            {
                Position = new Vector3(1, 0, -1), Normal = new Vector3(0, 1, 0), TexCoord = new Vector2(0, 1)
            }, image, OpenTK.Graphics.OpenGL.TextureWrapMode.Clamp);

            Assert.AreEqual(2, plane.Width, "Plane Width");
            Assert.AreEqual(0, plane.Height, "Plane Height");
            Assert.AreEqual(2, plane.Depth, "Plane Depth");
        }
Exemplo n.º 7
0
        private void ViewObliqueProjection(object sender, EventArgs e)
        {
            currentPlane = PlaneFactory.CreateXY(DefaultPoint);
            projection   = ProjectionsFactory.CreateFrontalProjection();
            var transformation = ProjectionsFactory.CreateObliqueProjection(
                (double)-angleAlpha.Value,
                (double)lengthOblique.Value);

            ApplyTransformation(transformation);
        }
Exemplo n.º 8
0
        private void ViewAxonometricProjection(object sender, EventArgs e)
        {
            projection   = ProjectionsFactory.CreateFrontalProjection();
            currentPlane = PlaneFactory.CreateXY(DefaultPoint);
            var transformation = ProjectionsFactory.CreateAxonometricProjection(
                (double)anglePsi.Value,
                (double)angleFi.Value);

            ApplyTransformation(transformation);
        }
Exemplo n.º 9
0
        public void T02_RunwayDoesNotAcceptAPlaneIfPlaneOnRunwayAndRunwayEmpty()
        {
            // Given
            Plane  plane  = PlaneFactory.Create(location: PlaneLocation.OnRunway);
            Runway runway = new Runway("runway 01", RunwayStatus.Empty);

            // When
            runway.AcceptPlane(plane);

            // Then
            Assert.IsTrue(runway.Status == RunwayStatus.Empty);
        }
Exemplo n.º 10
0
        public void T01_RunwayAcceptsAPlaneIfPlaneInAirAndRunwayEmpty()
        {
            // Given
            Plane  plane  = PlaneFactory.Create(PlaneLocation.InAir);
            Runway runway = new Runway("runway 01", RunwayStatus.Empty);

            // When
            runway.AcceptPlane(plane);

            // Then
            Assert.IsTrue(runway.Status == RunwayStatus.Full);
        }
Exemplo n.º 11
0
 public Plane(PlaneFactory _Factory, PlaneSettings _Settings)
 {
     Factory  = _Factory;
     Settings = _Settings;
     HP       = Settings.HP;
     Speed    = Settings.Speed;
     Armor    = Settings.Armor;
     Entity   = GameObject.Instantiate <GameObject>(Game.PlanePrefab);
     Entity.GetComponent <PlaneScript>().Speed = Speed;
     Entity.GetComponent <TextMesh>().text     = Settings.Shape;
     Entity.GetComponent <TextMesh>().color    = Settings.Color;
 }
Exemplo n.º 12
0
        public object GetObject(int type)
        {
            /**auscep1 taisyta 2019-10-30**/
            PlaneFactory f      = new PlaneFactory();
            var          facade = f.GetUnit(1, Owner, Battle, x, endx, y, endy, isHorizontal, type);

            System.Diagnostics.Debug.WriteLine("PlaneAdapter: Returning created plane");
            return(facade);

            //Factory.PlaneFactory facade = new Factory.PlaneFactory(Owner, Battle, x, endx, y, endy, isHorizontal);
            //System.Diagnostics.Debug.WriteLine("PlaneAdapter: Returning created plane");
            //return facade.GetUnit();
        }
Exemplo n.º 13
0
        /// <summary>
        /// Returns new Plane
        /// </summary>
        /// <returns>Plane</returns>
        public Unit GetPlane(int type)
        {
            PlaneFactory f     = new PlaneFactory();
            var          plane = f.GetUnit(1, Owner, Battle, x, endx, y, endy, isHorizontal, type);

            return(plane);
            /**auscep1 uzkomentinta 20191030**/
            //PlaneFactory factory = new PlaneFactory(Owner, Battle, x, endx, y, endy, isHorizontal);
            //factory.Base();
            //factory.Coordinates();
            //factory.Size();
            //return factory.GetUnit();
        }
Exemplo n.º 14
0
        public override void Begin()
        {
            Plane = new List <Plane>();
            Fac   = Game.Fac[PlaneKind];
            Seed  = new System.Random();

            Plane.Add(Fac.Create());
            Plane[0].Entity.transform.localPosition = GetRandomPosition();
            if (!Unbeatable)
            {
                Game.Planes.Add(Plane[0]);
            }
        }
Exemplo n.º 15
0
        public void T04_SinglePlaneCanLandOnSingleEmptyRunway()
        {
            // Given
            Plane  plane  = PlaneFactory.Create(location: PlaneLocation.InAir);
            Runway runway = new Runway("runway 01", RunwayStatus.Empty);

            // When
            LandingStatus result = plane.TryLandOn(runway);

            // Then
            Assert.IsTrue(result == LandingStatus.Success);
            Assert.IsTrue(plane.Location == PlaneLocation.OnRunway);
            Assert.IsTrue(runway.Status == RunwayStatus.Full);
        }
Exemplo n.º 16
0
        public void ChangePlane(PlaneType planeType)
        {
            Debug.WriteLine(string.Format("Zmieniam samolot na: {0}", planeType));
            IPlane plane = PlaneFactory.CreatePlane(planeType);

            plane.Startup();
            Device[] devices = Devices;
            for (int i = 0; i < devices.Length; i++)
            {
                devices[i].SetPlane(plane);
            }
            CurrentPlane.Close();
            CurrentPlane = plane;
        }
Exemplo n.º 17
0
        public void T07_SinglePlaneCannotLandOnNullRunway()
        {
            // Given
            Plane  plane  = PlaneFactory.Create(location: PlaneLocation.InAir);
            Runway runway = null;

            // When
            LandingStatus result = plane.TryLandOn(runway);

            // Then
            Assert.IsTrue(runway == null);
            Assert.IsTrue(result == LandingStatus.Failure);
            Assert.IsTrue(plane.Location == PlaneLocation.InAir);
        }
Exemplo n.º 18
0
        public void T10_PlaneRefuelsOnGround()
        {
            // Given
            int initialFuel = 100;
            int fuelGain    = 3;

            PassingTime time  = new PassingTime();
            Plane       plane = PlaneFactory.Create(location: PlaneLocation.OnRunway, fuel: initialFuel, passingTime: time);

            // When
            time.AddTurn();

            // Then
            Assert.IsTrue(plane.Fuel == initialFuel + fuelGain);
        }
Exemplo n.º 19
0
        public void T09_PlaneLosesFuelInAir()
        {
            // Given
            int initialFuel = 100;
            int fuelBurn    = 1;

            PassingTime time  = new PassingTime();
            Plane       plane = PlaneFactory.Create(location: PlaneLocation.InAir, fuel: initialFuel, passingTime: time);

            // When
            time.AddTurn();

            // Then
            Assert.IsTrue(plane.Fuel == initialFuel - fuelBurn);
        }
Exemplo n.º 20
0
        public void T12_PlaneHasMaxFuel()
        {
            // Given
            int initialFuel = 100;
            int maxFuel     = 100;

            PassingTime time  = new PassingTime();
            Plane       plane = PlaneFactory.Create(location: PlaneLocation.OnRunway,
                                                    fuel: initialFuel, maxFuel: maxFuel, passingTime: time);

            // When
            time.AddTurn();

            // Then
            Assert.IsTrue(plane.Fuel == initialFuel);
        }
Exemplo n.º 21
0
        private void ViewViewTransformationProjection(object sender, EventArgs e)
        {
            projection             = ProjectionsFactory.CreatePerspectiveProjection((double)d.Value);
            currentPlane           = PlaneFactory.CreateXY(DefaultPoint);
            currentPlane.ViewPoint = MathExtensions.CreatePolarPoint(
                (double)anglePhiView.Value,
                (double)angleTheta.Value,
                (double)rho.Value);
            var viewTransformation = TransformationsFactory.CreateViewTransformation(
                (double)anglePhiView.Value,
                (double)angleTheta.Value,
                (double)rho.Value,
                (double)d.Value);

            projection = viewTransformation;
            RedrawFigures();
        }
Exemplo n.º 22
0
        static void Main(string[] args)
        {
            var planeList = new List <Planes.Plane>();
            var fact      = new PlaneFactory();

            planeList.Add(fact.CreateOneEnginePlane());
            planeList.Add(fact.CreatePaperPlane());
            planeList.Add(fact.CreateToyPlane());
            planeList.Add(fact.CreateSeaPlane());

            foreach (var p in planeList)
            {
                Console.WriteLine(p.Printable());
            }

            Console.ReadLine();
        }
Exemplo n.º 23
0
        private void Create(object sender, EventArgs e)
        {
            DddObjects.Point lightPoint = new DddObjects.Point(0, 0, 5000);
            currentPlane = PlaneFactory.CreateXY(DefaultPoint);
            var l      = (int)length.Value;
            var w      = (int)width.Value;
            var h      = (int)height.Value;
            var r      = (int)radius.Value;
            var n      = (int)interpolationN.Value;
            var figure = DddFigureFactory.Create(new DddObjects.Point(0, 0, 0), l, w, h, r, n);
            var cone   = DddFigureFactory.CreateCone(new DddObjects.Point(0, 0, 0), l, w, h, r, n);

            projection = ProjectionsFactory.CreateFrontalProjection();

            figures = new List <DddObjects.Figure> {
                cone, figure
            };
            RedrawFigures();
        }
Exemplo n.º 24
0
        public void T14_PlaneCannotStartIfHasLessThanHalfMaxFuel()
        {
            // Given
            int initialFuel = 10;
            int maxFuel     = 100;

            PassingTime time  = new PassingTime();
            Plane       plane = PlaneFactory.Create(name: "Omega Flight", location: PlaneLocation.InAir,
                                                    fuel: initialFuel, maxFuel: maxFuel, passingTime: time);
            Runway runway = new Runway("runway 01", RunwayStatus.Empty);

            runway.AcceptPlane(plane);
            time.AddTurn();

            // When
            Plane launched = runway.LaunchPlane();

            // Then
            Assert.IsTrue(launched == null);
            Assert.IsTrue(runway.Status == RunwayStatus.Full);
        }
Exemplo n.º 25
0
        public void T15_PlaneCannotStartIfIsDamaged()
        {
            // Given
            int initialFuel = 100;
            int maxFuel     = 100;

            PassingTime time  = new PassingTime();
            Plane       plane = PlaneFactory.Create(location: PlaneLocation.InAir, damage: PlaneDamage.Damaged,
                                                    fuel: initialFuel, maxFuel: maxFuel, passingTime: time);
            Runway runway = new Runway("runway 01", RunwayStatus.Empty);

            runway.AcceptPlane(plane);
            time.AddTurn();

            // When
            Plane launched = runway.LaunchPlane();

            // Then
            Assert.IsTrue(launched == null);
            Assert.IsTrue(runway.Status == RunwayStatus.Full);
        }
Exemplo n.º 26
0
        public void T17_PlaneAddToHangarAfter25TurnsOnRunway()
        {
            // Given
            int initialFuel = 100;
            int maxFuel     = 100;

            PassingTime time  = new PassingTime();
            Plane       plane = PlaneFactory.Create(location: PlaneLocation.OnRunway, damage: PlaneDamage.None,
                                                    fuel: initialFuel, maxFuel: maxFuel, passingTime: time);
            Runway       runway = new Runway("runway 01", RunwayStatus.Empty);
            ControlTower tower  = new ControlTower(new Runway[] { runway });

            runway.AcceptPlane(plane);

            for (int i = 0; i < 24; i++) // 9 turns have passed
            {
                time.AddTurn();
            }

            // When
            time.AddTurn();
            // Then
            Assert.IsTrue(Hangar.Planes.Contains(plane));
        }
Exemplo n.º 27
0
 private Globals()
 {
     CurrentPlane = PlaneFactory.CreatePlane(PlaneType.Test);
 }
Exemplo n.º 28
0
 private void ViewFrontalProjection(object sender, EventArgs e)
 {
     currentPlane = PlaneFactory.CreateXY(DefaultPoint);
     projection   = ProjectionsFactory.CreateFrontalProjection();
     RedrawFigures();
 }
Exemplo n.º 29
0
        public CubeMap(float width, bool invertAllFaces, Vector3 centeredAt, Image frontTextureImage, Image backTextureImage, Image bottomTextureImage, Image topTextureImage, Image leftTextureImage, Image rightTextureImage)
        {
            Planes = new List <IPlane>();
            Width  = width;
            Center = new Vector3(0, 0, 0);

            MyProgramHandler   = new int[5];
            CubeCenterPosition = new Vector3(Width / 2 + centeredAt.X, Width / 2 + centeredAt.Y, Width / 2 + centeredAt.Z);
            IPlane backPlane = PlaneFactory.Create(invertAllFaces,
                                                   new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, 0, 1),
                TexCoord = new Vector2(1, 1)
            },

                                                   new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, 0, 1),
                TexCoord = new Vector2(1, 0)
            },

                                                   new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, 0, 1),
                TexCoord = new Vector2(0, 0)
            },

                                                   new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, 0, 1),
                TexCoord = new Vector2(0, 1)
            }, backTextureImage, OpenTK.Graphics.OpenGL.TextureWrapMode.ClampToEdge);

            IPlane frontPlane = PlaneFactory.Create(invertAllFaces,
                                                    new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, 0, 1),
                TexCoord = new Vector2(1, 1)
            },

                                                    new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, 0, 1),
                TexCoord = new Vector2(1, 0)
            },

                                                    new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, 0, 1),
                TexCoord = new Vector2(0, 0)
            },

                                                    new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, 0, 1),
                TexCoord = new Vector2(0, 1)
            }, frontTextureImage, OpenTK.Graphics.OpenGL.TextureWrapMode.ClampToEdge);
            IPlane topPlane = PlaneFactory.Create(invertAllFaces,
                                                  new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, -1, 0),
                TexCoord = new Vector2(0, 0)
            },
                                                  new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, -1, 0),
                TexCoord = new Vector2(0, 1)
            },

                                                  new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, -1, 0),
                TexCoord = new Vector2(1, 1)
            },

                                                  new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, -1, 0),
                TexCoord = new Vector2(1, 0)
            }, topTextureImage, OpenTK.Graphics.OpenGL.TextureWrapMode.ClampToEdge);

            IPlane leftPlane = PlaneFactory.Create(invertAllFaces, new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(-1, 0, 0),
                TexCoord = new Vector2(1, 1)
            },

                                                   new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(1, 0, 0),
                TexCoord = new Vector2(1, 0)
            },

                                                   new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(1, 0, 0),
                TexCoord = new Vector2(0, 0)
            },

                                                   new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(1, 0, 0),
                TexCoord = new Vector2(0, 1)
            }, leftTextureImage, OpenTK.Graphics.OpenGL.TextureWrapMode.ClampToEdge);


            IPlane rightPlane = PlaneFactory.Create(invertAllFaces,
                                                    new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(1, 0, 0),
                TexCoord = new Vector2(1, 1)
            },

                                                    new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(1, 0, 0),
                TexCoord = new Vector2(1, 0)
            },

                                                    new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(1, 0, 0),
                TexCoord = new Vector2(0, 0)
            },

                                                    new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(1, 0, 0),
                TexCoord = new Vector2(0, 1)
            }, rightTextureImage, OpenTK.Graphics.OpenGL.TextureWrapMode.ClampToEdge);

            IPlane bottomPlane = PlaneFactory.Create(invertAllFaces,
                                                     new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, -1, 0),
                TexCoord = new Vector2(0, 0)
            },

                                                     new Vbo()
            {
                Position = new Vector3(-Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, -1, 0),
                TexCoord = new Vector2(0, 1)
            },

                                                     new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, -Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, -1, 0),
                TexCoord = new Vector2(1, 1)
            },

                                                     new Vbo()
            {
                Position = new Vector3(Width / 2.0f + centeredAt.X, -Width / 2.0f + centeredAt.Y, Width / 2.0f + centeredAt.Z),
                Normal   = new Vector3(0, -1, 0),
                TexCoord = new Vector2(1, 0)
            }, topTextureImage, OpenTK.Graphics.OpenGL.TextureWrapMode.ClampToEdge);

            TopPlane    = topPlane;
            BackPlane   = backPlane;
            FrontPlane  = frontPlane;
            LeftPlane   = leftPlane;
            RightPlane  = rightPlane;
            BottomPlane = bottomPlane;


            Planes.AddRange(new List <IPlane> {
                topPlane, backPlane, frontPlane, leftPlane, rightPlane, bottomPlane
            });
        }
Exemplo n.º 30
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);
        }