public new void Tessellate(IRenderPackage package, TessellationParameters parameters) { //Ensure that the object is still alive if (!IsAlive) { return; } //Location Point DB.LocationPoint locPoint = InternalElement.Location as DB.LocationPoint; GeometryPrimitiveConverter.ToPoint(InternalTransform.OfPoint(locPoint.Point)).Tessellate(package, parameters); package.ApplyPointVertexColors(CreateColorByteArrayOfSize(package.LineVertexCount, 255, 0, 0, 0)); //Boundaries foreach (DB.BoundarySegment segment in InternalBoundarySegments) { Curve crv = RevitToProtoCurve.ToProtoType(segment.GetCurve().CreateTransformed(InternalTransform)); crv.Tessellate(package, parameters); if (package.LineVertexCount > 0) { package.ApplyLineVertexColors(CreateColorByteArrayOfSize(package.LineVertexCount, 255, 0, 0, 0)); } } }
private void CreateGeometryRenderData(Color color, IRenderPackage package, TessellationParameters parameters) { package.RequiresPerVertexColoration = true; // As you add more data to the render package, you need // to keep track of the index where this coloration will // start from. geometry.Tessellate(package, parameters); TessellateEdges(package, parameters); if (package.LineVertexCount > 0) { package.ApplyLineVertexColors(CreateColorByteArrayOfSize(package.LineVertexCount, color.Red, color.Green, color.Blue, color.Alpha)); } if (package.PointVertexCount > 0) { package.ApplyPointVertexColors(CreateColorByteArrayOfSize(package.PointVertexCount, color.Red, color.Green, color.Blue, color.Alpha)); } if (package.MeshVertexCount > 0) { package.ApplyMeshVertexColors(CreateColorByteArrayOfSize(package.MeshVertexCount, color.Red, color.Green, color.Blue, color.Alpha)); } }
public void Tessellate(IRenderPackage package, double tol = -1, int maxGridLines = 512) { package.RequiresPerVertexColoration = true; // As you add more data to the render package, you need // to keep track of the index where this coloration will // start from. geometry.Tessellate(package, tol, maxGridLines); if (renderEdges) { var surf = geometry as Surface; if (surf != null) { foreach (var curve in surf.PerimeterCurves()) { curve.Tessellate(package, tol, maxGridLines); curve.Dispose(); } } var solid = geometry as Solid; if (solid != null) { foreach (var geom in solid.Edges.Select(edge => edge.CurveGeometry)) { geom.Tessellate(package, tol, maxGridLines); geom.Dispose(); } } } if (package.LineVertexCount > 0) { package.ApplyLineVertexColors(CreateColorByteArrayOfSize(package.LineVertexCount, color.Red, color.Green, color.Blue, color.Alpha)); } if (package.PointVertexCount > 0) { package.ApplyPointVertexColors(CreateColorByteArrayOfSize(package.PointVertexCount, color.Red, color.Green, color.Blue, color.Alpha)); } if (package.MeshVertexCount > 0) { package.ApplyMeshVertexColors(CreateColorByteArrayOfSize(package.MeshVertexCount, color.Red, color.Green, color.Blue, color.Alpha)); } //var existingVerts = package.TriangleVertices; //var existingNormals = package.TriangleNormals; //var newVerts = new List<double>(); //for (var i = 0; i < existingVerts.Count; i += 3) //{ // newVerts.AddRange(NudgeVertexAlongVector(existingVerts, existingNormals, i, 0.001)); //} //package.TriangleVertices = newVerts; }
public void Tessellate(IRenderPackage package, TessellationParameters parameters) { package.RequiresPerVertexColoration = true; // As you add more data to the render package, you need // to keep track of the index where this coloration will // start from. geometry.Tessellate(package, parameters); if (parameters.ShowEdges) { var surf = geometry as Surface; if (surf != null) { foreach (var curve in surf.PerimeterCurves()) { curve.Tessellate(package, parameters); curve.Dispose(); } } var solid = geometry as Solid; if (solid != null) { foreach (var geom in solid.Edges.Select(edge => edge.CurveGeometry)) { geom.Tessellate(package, parameters); geom.Dispose(); } } } if (package.LineVertexCount > 0) { package.ApplyLineVertexColors(CreateColorByteArrayOfSize(package.LineVertexCount, color.Red, color.Green, color.Blue, color.Alpha)); } if (package.PointVertexCount > 0) { package.ApplyPointVertexColors(CreateColorByteArrayOfSize(package.PointVertexCount, color.Red, color.Green, color.Blue, color.Alpha)); } if (package.MeshVertexCount > 0) { package.ApplyMeshVertexColors(CreateColorByteArrayOfSize(package.MeshVertexCount, color.Red, color.Green, color.Blue, color.Alpha)); } }
public new void Tessellate(IRenderPackage package, TessellationParameters parameters) { //Ensure that the object is still alive if (!IsAlive) return; //Location Point DB.LocationPoint locPoint = InternalElement.Location as DB.LocationPoint; GeometryPrimitiveConverter.ToPoint(InternalTransform.OfPoint(locPoint.Point)).Tessellate(package, parameters); package.ApplyPointVertexColors(CreateColorByteArrayOfSize(package.PointVertexCount, 255, 0, 0, 0)); //Boundaries foreach (DB.BoundarySegment segment in InternalBoundarySegments) { Curve crv = RevitToProtoCurve.ToProtoType(segment.GetCurve().CreateTransformed(InternalTransform)); crv.Tessellate(package, parameters); if (package.LineVertexCount > 0) { package.ApplyLineVertexColors(CreateColorByteArrayOfSize(package.LineVertexCount, 255, 0, 0, 0)); } } }