public void GenerateGraph() { if (profiler != null) { profiler.AddLog("start thread", Color.green); profiler.StartThreadStuff(); } if (stop) { if (profiler != null) { profiler.Abort(); } return; } //VolumeContainer volumes = new VolumeContainer(this); ////collecting terrain //if (profiler != null) profiler.AddLog("start collecting volumes", Color.green); //if (_terrainCollector.collectedCount > 0) { // if (profiler != null) profiler.AddLogFormat("collecting terrains. Count: {0}", Color.green, _terrainCollector.collectedCount); // _terrainCollector.Collect(volumes); // if (profiler != null) profiler.AddLog("terrain collected"); //} //else { // if (profiler != null) profiler.AddLog("No terrain to collect", Color.green); //} //if (stop) { // if (profiler != null) profiler.Abort(); // return; //} //switch (PathFinder.colliderCollectorType) { // case ColliderCollectorType.CPU: // shapeCollectorCPU.Collect(volumes); // break; // case ColliderCollectorType.ComputeShader: // //collecting primitives // if (_primitivesCollector.collectedCount > 0) { // if (profiler != null) profiler.AddLogFormat("collecting primitives. Count: {0}", Color.green, _primitivesCollector.collectedCount); // _primitivesCollector.profiler = profiler; // _primitivesCollector.Collect(volumes); // if (profiler != null) profiler.AddLog("primitives collected"); // } // else { // if (profiler != null) profiler.AddLog("No primitives to collect", Color.green); // } // break; //} colliderCollector.Collect(); //also apply modifyers VolumeContainerNew volume = new VolumeContainerNew(this); volume.AddGenericColliders(colliderCollector.shapeCollectorResult); volume.DoStuff(); GraphGeneratorNew generator = new GraphGeneratorNew(volume, this); graph = generator.MakeGraph(); //GraphGenerator generator = new GraphGenerator(volumes, this); //graph = generator.MakeGraph(); //if (stop) { // if (profiler != null) profiler.Abort(); // return; //} ////process collected volumes. remove intersections, reduce volume count, generate connections, flags, etc ////best place to modify information about world or add flags //if (profiler != null) profiler.AddLog("volumes container start doing stuff"); //volumes.DoStuff(); //if (profiler != null) profiler.AddLog("volumes container end doing stuff"); //if (stop) { // if (profiler != null) profiler.Abort(); // return; //} //if (profiler != null) profiler.AddLog("graph generator start doing stuff", Color.green); //GraphGenerator generator = new GraphGenerator(volumes, this); //graph = generator.MakeGraph(); //if (profiler != null) profiler.AddLog("graph generator end making graph"); //if (stop) { // if (profiler != null) profiler.Abort(); // return; //} //if (profiler != null) profiler.AddLog("Return all remaining volumes to object pool"); //volumes.ReturnAllVolumesToObjectPool(); //graph = new Graph(); if (profiler != null) { profiler.AddLog("end thread", Color.green); profiler.EndThreadStuff(); profiler.EndProfile(); profiler.DebugLog(ProfilderLogMode.log); } //Graph graph = new Graph(chunk, properties); if (callbackAfterGraphGeneration != null) { callbackAfterGraphGeneration.Invoke(this); } }
//all this awesome pipeline //threaded public override void Work() { if (profiler != null) { profiler.AddLog("start thread", Color.green); profiler.StartThreadStuff(); } if (stop) { if (profiler != null) { profiler.Abort(); } return; } VolumeContainer volumes = new VolumeContainer(this); if (profiler != null) { profiler.AddLog("start collecting volumes", Color.green); } _terrainCollector.Collect(volumes); if (profiler != null) { profiler.AddLog("terrain collected"); } _primitivesCollector.Collect(volumes); if (profiler != null) { profiler.AddLog("collected"); } hashData = PathFinder.CloneHashData(); if (stop) { if (profiler != null) { profiler.Abort(); } return; } if (profiler != null) { profiler.AddLog("volumes container start doing stuff"); } volumes.DoStuff(); if (profiler != null) { profiler.AddLog("volumes container end doing stuff"); } if (stop) { if (profiler != null) { profiler.Abort(); } return; } if (profiler != null) { profiler.AddLog("graph generator start doing stuff", Color.green); } GraphGenerator generator = new GraphGenerator(volumes, this); Graph graph = generator.MakeGraph(); if (profiler != null) { profiler.AddLog("graph generator end making graph"); } if (stop) { if (profiler != null) { profiler.Abort(); } return; } if (profiler != null) { profiler.AddLog("end thread", Color.green); profiler.EndThreadStuff(); profiler.EndProfile(); profiler.DebugLog(ProfilderLogMode.log); } GC.Collect(); //Graph graph = new Graph(chunk, properties); if (onEndCallBack != null) { onEndCallBack.Invoke(graph); } }