public Cube(Wall leftWall, Wall rightWall, Wall frontWall, Wall backWall, Wall ceiling, Wall floor) { this.frontWall = frontWall; this.backWall = backWall; this.rightWall = rightWall; this.leftWall = leftWall; this.ceiling = ceiling; this.floor = floor; }
float Z = 0.0f; // Translate screen to z direction (zoom in or out) #endregion Fields #region Constructors public cOGL(Control pb) { panel = pb; Width = panel.Width; Height = panel.Height; frontWallCoordForShadow = new float[3, 3]; backWallCoordForShadow = new float[3, 3]; leftWallCoordForShadow = new float[3, 3]; rightWallCoordForShadow = new float[3, 3]; ceilingCoordForShadow = new float[3, 3]; floorCoordForShadow = new float[3, 3]; frontWallCoordForShadow[0, 0] = 19.99f; frontWallCoordForShadow[0, 1] = -1; frontWallCoordForShadow[0, 2] = 1; frontWallCoordForShadow[1, 0] = 19.99f; frontWallCoordForShadow[1, 1] = 0; frontWallCoordForShadow[1, 2] = 1; frontWallCoordForShadow[2, 0] = 19.99f; frontWallCoordForShadow[2, 1] = 1; frontWallCoordForShadow[2, 2] = 0; backWallCoordForShadow[0, 0] = -19.99f; backWallCoordForShadow[0, 1] = 1; backWallCoordForShadow[0, 2] = 1; backWallCoordForShadow[1, 0] = -19.99f; backWallCoordForShadow[1, 1] = 0; backWallCoordForShadow[1, 2] = 1; backWallCoordForShadow[2, 0] = -19.99f; backWallCoordForShadow[2, 1] = 1; backWallCoordForShadow[2, 2] = 0; //////////////// leftWallCoordForShadow[0, 0] = 1; leftWallCoordForShadow[0, 1] = 1; leftWallCoordForShadow[0, 2] = 19.99f; leftWallCoordForShadow[1, 0] = 0; leftWallCoordForShadow[1, 1] = -1; leftWallCoordForShadow[1, 2] = 19.99f; leftWallCoordForShadow[2, 0] = -1; leftWallCoordForShadow[2, 1] = 0; leftWallCoordForShadow[2, 2] = 19.99f; rightWallCoordForShadow[0, 0] = 1; rightWallCoordForShadow[0, 1] = 1; rightWallCoordForShadow[0, 2] = -19.99f; rightWallCoordForShadow[1, 0] = 0; rightWallCoordForShadow[1, 1] = 1; rightWallCoordForShadow[1, 2] = -19.99f; rightWallCoordForShadow[2, 0] = 1; rightWallCoordForShadow[2, 1] = 0; rightWallCoordForShadow[2, 2] = -19.99f; ceilingCoordForShadow[0, 0] = -1; ceilingCoordForShadow[0, 1] = 6.99f; ceilingCoordForShadow[0, 2] = 0; ceilingCoordForShadow[1, 0] = 1; ceilingCoordForShadow[1, 1] = 6.99f; ceilingCoordForShadow[1, 2] = 0; ceilingCoordForShadow[2, 0] = 1; ceilingCoordForShadow[2, 1] = 6.99f; ceilingCoordForShadow[2, 2] = 1; floorCoordForShadow[0, 0] = 1; floorCoordForShadow[0, 1] = -6.99f; floorCoordForShadow[0, 2] = 0; floorCoordForShadow[1, 0] = -1; floorCoordForShadow[1, 1] = -6.99f; floorCoordForShadow[1, 2] = 0; floorCoordForShadow[2, 0] = -1; floorCoordForShadow[2, 1] = -6.99f; floorCoordForShadow[2, 2] = 1; InitializeGL(); Wall frontWall = new Wall(frontWallCoordForShadow, Textures[2], new Vertex(-1.0f, -1.0f, 1.0f), new Vertex(1.0f, -1.0f, 1.0f), new Vertex(1.0f, 1.0f, 1.0f), new Vertex(-1.0f, 1.0f, 1.0f)); Wall backWall = new Wall(backWallCoordForShadow, Textures[3], new Vertex(1.0f, -1.0f, -1.0f), new Vertex(-1.0f, -1.0f, -1.0f), new Vertex(-1.0f, 1.0f, -1.0f), new Vertex(1.0f, 1.0f, -1.0f)); Wall leftWall = new Wall(leftWallCoordForShadow, Textures[4], new Vertex(-1.0f, -1.0f, -1.0f), new Vertex(-1.0f, -1.0f, 1.0f), new Vertex(-1.0f, 1.0f, 1.0f), new Vertex(-1.0f, 1.0f, -1.0f)); Wall rightWall = new Wall(rightWallCoordForShadow, Textures[5], new Vertex(1.0f, -1.0f, 1.0f), new Vertex(1.0f, -1.0f, -1.0f), new Vertex(1.0f, 1.0f, -1.0f), new Vertex(1.0f, 1.0f, 1.0f)); Wall ceiling = new Wall(ceilingCoordForShadow, Textures[6], new Vertex(-1.0f, 1.0f, 1.0f), new Vertex(1.0f, 1.0f, 1.0f), new Vertex(1.0f, 1.0f, -1.0f), new Vertex(-1.0f, 1.0f, -1.0f)); Wall floor = new Wall(floorCoordForShadow, Textures[7], new Vertex(1.0f, -1.0f, -1.0f), new Vertex(1.0f, -1.0f, 1.0f), new Vertex(-1.0f, -1.0f, 1.0f), new Vertex(-1.0f, -1.0f, -1.0f)); cube = new Cube(leftWall, rightWall, frontWall, backWall, ceiling, floor); //prepare Robot, car and shadows lists Robot = new Robot(Textures[8]); Robot.WeaponIndex = 1; Weaponchanged = true; Robot.PrepareAndDraw(); Robot.PrepareAndDrawShadow(); car = new Car(); car.PrepareAndDraw(); car.PrepareAndDrawShadow(); }