Пример #1
0
            public StageBuilder(Model3DGroup Container, CollisionResponser Responser, Setup Settings)
            {
                this.Terrain3D   = new MeshGeometry3D();
                this.MeshBuilder = new BasicBuilder(Container, Responser, Settings);
                this.Responser   = Responser;
                this.Container   = Container;
                this.Settings    = Settings;

                var GeometryModel = new GeometryModel3D();

                GeometryModel.Geometry = Terrain3D;
                GeometryModel.Material = new DiffuseMaterial(LoadTexture());
                //GeometryModel.BackMaterial = new DiffuseMaterial(Brushes.Black);

                lastTP           = new TerrainPoint();
                lastTP.point3d.X = 0;
                lastTP.point3d.Y = -1;
                lastTP.point3d.Z = 0;

                BoundBox = new Rect3D(0, 0, 0, 0, 0, 0);

                TerrainPoints = new List <TerrainPoint>(100);
                TerrainPoints.Add(lastTP);
                RandomTerrainPoints(100);

                //Container.Children.Add(GeometryModel);
            }
Пример #2
0
        static public void GetSphere(Model3DGroup Container, Point3D Center, double R = 1)
        {
            var BasicBuild = new BasicBuilder(Container, null, null);

            BasicBuild.Sphere(Center, R);
            BasicBuild.AddGeometryToContainer();
        }
Пример #3
0
            public void getNext()
            {
                /* Point3D point;
                 * //Int32Collection col = new Int32Collection();
                 * PointCollection TexturePoints = new PointCollection(TerrainPoints.Count * 16);
                 * points = new Point3DCollection(TerrainPoints.Count * 2);
                 * int point_per_one = 4;
                 *
                 * double ly = 10;
                 * double ry = 10;
                 *
                 *
                 * Point3D BridgeStart = TerrainPoints[3].point3d;
                 * BridgeStart.X += 5;
                 *
                 * var Bridge = new BridgeBuilder(Container, Responser, Settings);
                 * Bridge.Build(new Rect3D(BridgeStart, new Size3D { X = 25, Y = 4, Z = 3 }));
                 */
                /*var Sphere = new BasicBuilder(Container, Responser, Settings);
                 * Sphere.Sphere(new Point3D { X = 0, Y = 0.5, Z = 2 }, 2.4);
                 * Sphere.AddGeometryToContainer();*/

                var Sun = new BasicBuilder(Container, Responser, Settings);

                Sun.Sphere(new Point3D {
                    X = 0, Y = 100, Z = 200
                }, 5);
                Sun.AddGeometryToContainer();

                var Sea = new SeaBuilder(Container, Responser, Settings, -4);


                int start = Terrain3D.Positions.Count;

                //int start = 0;

                /*for (int i = 0; i < TerrainPoints.Count; i++)
                 * {
                 *
                 *  RoadArc tmp = CalculateHelperPoints(TerrainPoints[i]);
                 *
                 *  if (i > 5)
                 *  {
                 *      ly += Settings.Random() - 0.5; ly = Math.Min(30, Math.Max(ly, -30));
                 *      ry += Settings.Random() - 0.5; ry = Math.Min(30, Math.Max(ry, -30));
                 *  }
                 *
                 *  // droga
                 *  point = new Point3D(tmp.left_x, TerrainPoints[i].point3d.Y, tmp.left_z);
                 *  addPointAndExtendBox(point);
                 *
                 *  TexturePoints.Add(new Point(0.16, i));
                 *  point = new Point3D(tmp.right_x, TerrainPoints[i].point3d.Y, tmp.right_z);
                 *  addPointAndExtendBox(point);
                 *  TexturePoints.Add(new Point(0.84, i));
                 *
                 *
                 *  // lewa ściana
                 *  point = new Point3D(tmp.left_x2, TerrainPoints[i].point3d.Y + ly, tmp.left_z2);
                 *  addPointAndExtendBox(point);
                 *  TexturePoints.Add(new Point(0, i));
                 *
                 *  // prawa
                 *  point = new Point3D(tmp.right_x2, TerrainPoints[i].point3d.Y - ry, tmp.right_z2);
                 *  addPointAndExtendBox(point);
                 *  TexturePoints.Add(new Point(1, i));
                 * }
                 *
                 * for (int i = 0; i < TerrainPoints.Count; i++)
                 * {
                 *
                 *  if (i < TerrainPoints.Count - 1)
                 *  {
                 *
                 *
                 *      CreateTriangleFromPointsNumber(
                 *          i * point_per_one + point_per_one,
                 *          i * point_per_one,
                 *          i * point_per_one + point_per_one + 1,
                 *          start
                 *          );
                 *
                 *      CreateTriangleFromPointsNumber(
                 *          i * point_per_one,
                 *          i * point_per_one + 1,
                 *          i * point_per_one + point_per_one + 1,
                 *          start
                 *          );
                 *
                 *      CreateTriangleFromPointsNumber(
                 *          i * point_per_one + 2,
                 *          i * point_per_one,
                 *          i * point_per_one + point_per_one,
                 *          start
                 *          );
                 *
                 *      CreateTriangleFromPointsNumber(
                 *          i * point_per_one + point_per_one,
                 *          i * point_per_one + point_per_one + 2,
                 *          i * point_per_one + 2,
                 *          start
                 *          );
                 *
                 *      CreateTriangleFromPointsNumber(
                 *          i * point_per_one + 1,
                 *          i * point_per_one + 3,
                 *          i * point_per_one + point_per_one + 3,
                 *          start
                 *          );
                 *
                 *      CreateTriangleFromPointsNumber(
                 *          i * point_per_one + point_per_one + 3,
                 *          i * point_per_one + point_per_one + 1,
                 *          i * point_per_one + 1,
                 *          start
                 *          );
                 *  }
                 * }*/

                AddPositions(points);
                //Terrain3D.TextureCoordinates = TexturePoints;
            }