Class LineGraphPopulator
Utility to populate LineGraph using Unity's Job system. This can be useful if you have frequent updates and want
this process to be as fast as possible and/or on another thread.
Inheritance
LineGraphPopulator
Assembly: AnyPath.dll
Syntax
public static class LineGraphPopulator
Methods
SchedulePopulate(LineGraph, NativeArray<float3>, NativeArray<Edge>, NativeArray<Edge>, JobHandle)
Schedules a job that populates the LineGraph with undirected edges and directed edges
Declaration
public static JobHandle SchedulePopulate(this LineGraph graph, NativeArray<float3> vertices, NativeArray<LineGraph.Edge> undirectedEdges, NativeArray<LineGraph.Edge> directedEdges, JobHandle dependsOn = default)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
Examples
// Example on how to weld vertices and populate the LineGraph using Unity's Job system
// these NativeLists and arrays will be modified in place
var weldHandle = LineGraphhWelder.ScheduleWeld(vertices, directedEdges, undirectedEdges);
// Schedule the populate job with a dependency on the weld job handle
// Pass in the welded verts as a deffered array
var populateHandle =
LineGraphPopulator.SchedulePopulate(graph, vertices.AsDeferredJobArray(), undirectedEdges, directedEdges, weldHandle);
// complete the job, or wait for the result somewhere else
populateHandle.Complete();
SchedulePopulate(LineGraph, NativeArray<float3>, NativeArray<Edge>, JobHandle)
Schedules a job that populates the LineGraph with only undirected edges
Declaration
public static JobHandle SchedulePopulate(this LineGraph graph, NativeArray<float3> vertices, NativeArray<LineGraph.Edge> undirectedEdges, JobHandle dependsOn = default)
Parameters
| Type |
Name |
Description |
| LineGraph |
graph |
|
| NativeArray<float3> |
vertices |
|
| NativeArray<LineGraph.Edge> |
undirectedEdges |
|
| JobHandle |
dependsOn |
|
Returns
| Type |
Description |
| JobHandle |
|
Examples
// Example on how to weld vertices and populate the LineGraph using Unity's Job system
// these NativeLists and arrays will be modified in place
var weldHandle = LineGraphWelder.ScheduleWeld(vertices, directedEdges);
// Schedule the populate job with a dependency on the weld job handle
// Pass in the welded verts as a deffered array
var populateHandle =
LineGraphPopulator.SchedulePopulate(graph, vertices.AsDeferredJobArray(), undirectedEdges, weldHandle);
// complete the job, or wait for the result somewhere else
populateHandle.Complete();