/// <summary> /// Create an IRenderPackage object provided an IGraphicItem /// </summary> /// <param name="gItem">An IGraphicItem object to tessellate.</param> /// <returns>An IRenderPackage object.</returns> public IRenderPackage CreateRenderPackageFromGraphicItem(IGraphicItem gItem) { var renderPackage = renderPackageFactory.CreateRenderPackage(); gItem.Tessellate(renderPackage, renderPackageFactory.TessellationParameters); return(renderPackage); }
/// <summary> /// Create an IRenderPackage object provided an IGraphicItem /// </summary> /// <param name="gItem">An IGraphicItem object to tessellate.</param> /// <returns>An IRenderPackage object.</returns> public IRenderPackage CreateRenderPackageFromGraphicItem(IGraphicItem gItem) { var renderPackage = renderPackageFactory.CreateRenderPackage(); gItem.Tessellate(renderPackage, -1.0, renderPackageFactory.MaxTessellationDivisions); return(renderPackage); }
private IRenderPackage CreateRenderPackageFromGraphicItem(IGraphicItem gItem) { var factory = new HelixRenderPackageFactory(); var renderPackage = factory.CreateRenderPackage(); gItem.Tessellate(renderPackage, factory.TessellationParameters); return(renderPackage); }
private RenderPackage PackageRenderData(IGraphicItem gItem) { var renderPackage = new RenderPackage(); gItem.Tessellate(renderPackage, -1.0, this.watch3dModel.ViewModel.VisualizationManager.MaxTesselationDivisions); renderPackage.ItemsCount++; return(renderPackage); }
internal override bool TessellateCore(IRenderPackage package) { IGraphicItem graphics = mPersistent as IGraphicItem; if (null != graphics) { graphics.Tessellate(package); return(true); } return(false); }
internal void Tessellate(IRenderPackage package) { IGraphicItem graphics = mEntity as IGraphicItem; if (null != graphics) { graphics.Tessellate(package); } else { this.TessellateCore(package); } }
private void PushGraphicItemIntoPackage(IGraphicItem graphicItem, IRenderPackage package, string tag, double size) { try { graphicItem.Tessellate(package, -1.0, dynSettings.Controller.VisualizationManager.MaxTesselationDivisions); package.Tag = tag; } catch (Exception e) { System.Diagnostics.Debug.WriteLine("PushGraphicItemIntoPackage: " + e); } }
private static void PushGraphicItemIntoPackage(IGraphicItem graphicItem, IRenderPackage package, string tag, double size) { graphicItem.Tessellate(package, -1.0, 32); package.Tag = tag; }
/// <summary> /// Create an IRenderPackage object provided an IGraphicItem /// </summary> /// <param name="gItem">An IGraphicItem object to tessellate.</param> /// <returns>An IRenderPackage object.</returns> public IRenderPackage CreateRenderPackageFromGraphicItem(IGraphicItem gItem) { var renderPackage = renderPackageFactory.CreateRenderPackage(); gItem.Tessellate(renderPackage, renderPackageFactory.TessellationParameters); return renderPackage; }
private void PushGraphicItemIntoPackage(IGraphicItem graphicItem, IRenderPackage package, string tag, double size, int maxTesselationDivisions ) { try { graphicItem.Tessellate(package, -1.0, maxTesselationDivisions); package.Tag = tag; } catch (Exception e) { System.Diagnostics.Debug.WriteLine("PushGraphicItemIntoPackage: " + e); } }
private void GetTessellationDataFromGraphicItem(Guid outputPortId, IGraphicItem graphicItem, string labelKey, ref IRenderPackage package) { var packageWithTransform = package as ITransformable; try { var previousPointVertexCount = package.PointVertexCount; var previousLineVertexCount = package.LineVertexCount; var previousMeshVertexCount = package.MeshVertexCount; //Todo Plane tessellation needs to be handled here vs in LibG currently if (graphicItem is Plane plane) { CreatePlaneTessellation(package, plane); } else { try { graphicItem.Tessellate(package, factory.TessellationParameters); } catch (LegacyRenderPackageMethodException) { //At this point we have detected an implementation of Tessellate which is using legacy color methods //We roll back the primary renderPackage to it previous state before calling tessellation again. package = RollBackPackage(package, previousPointVertexCount, previousLineVertexCount, previousMeshVertexCount); //Now we create a renderPackage object that will allow legacy color methods var legacyPackage = factory.CreateRenderPackage(); legacyPackage.DisplayLabels = displayLabels; legacyPackage.Description = labelKey; legacyPackage.IsSelected = isNodeSelected; //Use it to get fill the tessellation data and add it to the render cache. GetTessellationDataFromGraphicItem(outputPortId, graphicItem, labelKey, ref legacyPackage); if (legacyPackage.MeshVertexColors.Any()) { legacyPackage.RequiresPerVertexColoration = true; } renderPackageCache.Add(legacyPackage, outputPortId); return; } //Now we validate that tessellation call has added colors for each new vertex. //If any vertex colors previously existed, this will ensure the vertex color and vertex counts stays in sync. EnsureColorExistsPerVertex(package, previousPointVertexCount, previousLineVertexCount, previousMeshVertexCount); if (factory.TessellationParameters.ShowEdges) { if (graphicItem is Topology topology) { if (graphicItem is Surface surf) { foreach (var curve in surf.PerimeterCurves()) { curve.Tessellate(package, factory.TessellationParameters); curve.Dispose(); } } else { var edges = topology.Edges; foreach (var geom in edges.Select(edge => edge.CurveGeometry)) { geom.Tessellate(package, factory.TessellationParameters); geom.Dispose(); } edges.ForEach(x => x.Dispose()); } } } } //If the package has a transform that is not the identity matrix //then set requiresCustomTransform to true. if (packageWithTransform != null && !packageWithTransform.RequiresCustomTransform && packageWithTransform.Transform.SequenceEqual( new double[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }) == false) { (packageWithTransform).RequiresCustomTransform = true; } //Do not add replication labels if the tessellation call set DisplayLabels to true; if (package is IRenderLabels packageLabels && packageLabels.AutoGenerateLabels) { if (package.MeshVertexCount > previousMeshVertexCount) { packageLabels.AddLabel(labelKey, VertexType.Mesh, package.MeshVertexCount); } else if (package.LineVertexCount > previousLineVertexCount) { packageLabels.AddLabel(labelKey, VertexType.Line, package.LineVertexCount); } else if (package.PointVertexCount > previousPointVertexCount) { packageLabels.AddLabel(labelKey, VertexType.Point, package.PointVertexCount); } } } catch (Exception e) { Debug.WriteLine( "PushGraphicItemIntoPackage: " + e); } }
private static RenderPackage PackageRenderData(IGraphicItem gItem) { var renderPackage = new RenderPackage(); gItem.Tessellate(renderPackage, -1.0, dynSettings.Controller.VisualizationManager.MaxTesselationDivisions); renderPackage.ItemsCount++; return renderPackage; }
private RenderPackage PackageRenderData(IGraphicItem gItem) { var renderPackage = new RenderPackage(); gItem.Tessellate(renderPackage, -1.0, this.DynamoViewModel.VisualizationManager.MaxTesselationDivisions); renderPackage.ItemsCount++; return renderPackage; }