public IEnumerable <Pos3Norm3VertexSDX> GetVertices(D2DGeometry geometry, float height = 1f) { List <Pos3Norm3VertexSDX> vertices = new List <Pos3Norm3VertexSDX>(); //Empty mesh if (geometry == null) { Pos3Norm3VertexSDX zero = new Pos3Norm3VertexSDX(); vertices.Add(zero); vertices.Add(zero); vertices.Add(zero); return(vertices); } if (height > 0) { D2DGeometry flattenedGeometry = this.FlattenGeometry(geometry, sc_flatteningTolerance); D2DGeometry outlinedGeometry = this.OutlineGeometry(flattenedGeometry); //Add snap here var sink = new ExtrudingSink(vertices, height); outlinedGeometry.Simplify(GeometrySimplificationOption.Lines, sink); var bounds = flattenedGeometry.GetBounds(); var scaling = Math.Min(1 / Math.Abs(bounds.Bottom - bounds.Top), 1); outlinedGeometry.Tessellate(sink); outlinedGeometry.Dispose(); flattenedGeometry.Dispose(); sink.Dispose(); return(vertices.Select(v => v.Scale(scaling).AssignTexCd()).Reverse()); } else { D2DGeometry flattenedGeometry = this.FlattenGeometry(geometry, sc_flatteningTolerance); //Add snap here var sink = new FlatSink(vertices); var bounds = flattenedGeometry.GetBounds(); var scaling = Math.Min(1 / Math.Abs(bounds.Bottom - bounds.Top), 1); flattenedGeometry.Tessellate(sink); flattenedGeometry.Dispose(); sink.Dispose(); return(vertices.Select(v => v.Scale(scaling).AssignTexCd()).Reverse()); } }
public void Dispose() { _geometry?.Dispose(); _target.PopLayer(); }