Beispiel #1
0
        private void MaterializeMesh(Mesh <IVertexBuilder, IHalfEdgeBuilder, IFaceBuilder> mesh)
        {
            Contract.Requires(mesh != null);

            //Generate default footpath data
            HierarchicalParameters.RoadSidewalkHeight(Random);
            HierarchicalParameters.RoadSidewalkWidth(Random);
            HierarchicalParameters.RoadLaneWidth(Random);
            HierarchicalParameters.RoadSidewalkMaterial(Random);

            //Generate default building data
            HierarchicalParameters.MaximumBuildingHeight(Random);

            //Attach builders to each part of the topological mesh
            foreach (var vertex in mesh.Vertices.Where(v => v.Tag == null))
            {
                vertex.Tag = CreateVertexBuilder(vertex);
            }
            foreach (var halfEdge in mesh.HalfEdges.Where(e => e.IsPrimaryEdge && e.Tag == null))
            {
                halfEdge.Tag = CreateHalfEdgeBuilder(halfEdge, RoadLanes(halfEdge));
            }
            foreach (var face in mesh.Faces.Where(f => f.Tag == null))
            {
                face.Tag = CreateFaceBuilder(face);
            }

            //Create junctions (appropriate shape for different widths of road)
            foreach (var vertex in mesh.Vertices)
            {
                CreateJunction(Bounds.Height, vertex);
            }

            //Create roads (with appropriate widths)
            foreach (var edge in mesh.HalfEdges.Where(e => e.IsPrimaryEdge))
            {
                CreateRoad(Bounds.Height, edge);
            }

            //Create blocks (with appropriate shapes for different road widths)
            foreach (var face in mesh.Faces)
            {
                CreateBlock(Bounds.Height, face);
            }
        }
        public override void Subdivide(Prism bounds, ISubdivisionGeometry geometry, INamedDataCollection hierarchicalParameters)
        {
            this.CreateFlatPlane(geometry, "tarmac", bounds.Footprint, 1, -1);

            CreateFootpaths(bounds, geometry, hierarchicalParameters, hierarchicalParameters.RoadSidewalkMaterial(Random), HierarchicalParameters.RoadSidewalkHeight(Random));
        }