Skip to content

Commit

Permalink
job-assist version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebukam committed Dec 2, 2021
1 parent f1ced03 commit f5ef506
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 47 deletions.
8 changes: 3 additions & 5 deletions Runtime/Jobs/AgentKDTreeProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SOFTWARE.

using Nebukam.JobAssist;
using static Nebukam.JobAssist.CollectionsUtils;
using Unity.Collections;

namespace Nebukam.ORCA
Expand Down Expand Up @@ -51,11 +52,8 @@ protected override void Prepare(ref AgentKDTreeJob job, float delta)
}

int agentCount = 2 * m_agentProvider.outputAgents.Length;
if (m_outputTree.Length != agentCount)
{
m_outputTree.Dispose();
m_outputTree = new NativeArray<AgentTreeNode>(agentCount, Allocator.Persistent);
}

MakeLength(ref m_outputTree, agentCount);

job.m_inputAgents = m_agentProvider.outputAgents;
job.m_outputTree = m_outputTree;
Expand Down
7 changes: 2 additions & 5 deletions Runtime/Jobs/AgentProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SOFTWARE.

using Nebukam.JobAssist;
using static Nebukam.JobAssist.CollectionsUtils;
using System.Collections.Generic;
using Unity.Collections;
using Unity.Mathematics;
Expand Down Expand Up @@ -73,11 +74,7 @@ protected override void Prepare(ref Unemployed job, float delta)

int agentCount = m_lockedAgents.Count;

if (m_outputAgents.Length != agentCount)
{
m_outputAgents.Dispose();
m_outputAgents = new NativeArray<AgentData>(agentCount, Allocator.Persistent);
}
MakeLength(ref m_outputAgents, agentCount);

m_maxRadius = 0f;

Expand Down
8 changes: 3 additions & 5 deletions Runtime/Jobs/ORCALinesProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SOFTWARE.

using Nebukam.JobAssist;
using static Nebukam.JobAssist.CollectionsUtils;
using Unity.Collections;

namespace Nebukam.ORCA
Expand Down Expand Up @@ -88,11 +89,8 @@ protected override int Prepare(ref ORCALinesJob job, float delta)
}

int agentCount = m_agentProvider.outputAgents.Length;
if (m_results.Length != agentCount)
{
m_results.Dispose();
m_results = new NativeArray<AgentDataResult>(agentCount, Allocator.Persistent);
}

MakeLength(ref m_results, agentCount);

//Agent data
job.m_inputAgents = m_agentProvider.outputAgents;
Expand Down
7 changes: 2 additions & 5 deletions Runtime/Jobs/ObstacleKDTreeProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SOFTWARE.

using Nebukam.JobAssist;
using static Nebukam.JobAssist.CollectionsUtils;
using Unity.Collections;

namespace Nebukam.ORCA
Expand Down Expand Up @@ -66,12 +67,8 @@ protected override void Prepare(ref ObstacleKDTreeJob job, float delta)
job.m_recompute = true;

int obsCount = 2 * m_obstaclesProvider.referenceObstacles.Length;
if (m_outputTree.Length != obsCount)
{
m_outputTree.Dispose();
m_outputTree = new NativeArray<ObstacleTreeNode>(obsCount, Allocator.Persistent);
}

MakeLength(ref m_outputTree, obsCount);
}
else
{
Expand Down
19 changes: 4 additions & 15 deletions Runtime/Jobs/ObstacleProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SOFTWARE.

using Nebukam.JobAssist;
using static Nebukam.JobAssist.CollectionsUtils;
using Unity.Collections;

namespace Nebukam.ORCA
Expand Down Expand Up @@ -75,13 +76,7 @@ protected override void Prepare(ref Unemployed job, float delta)
int obsCount = m_obstacles == null ? 0 : m_obstacles.Count,
refCount = m_referenceObstacles.Length, vCount = 0;

if (m_outputObstacleInfos.Length != obsCount)
{
m_outputObstacleInfos.Dispose();
m_outputObstacleInfos = new NativeArray<ObstacleInfos>(obsCount, Allocator.Persistent);

m_recompute = true;
}
m_recompute = !MakeLength(ref m_outputObstacleInfos, obsCount);

Obstacle o;
ObstacleInfos infos;
Expand Down Expand Up @@ -111,14 +106,8 @@ protected override void Prepare(ref Unemployed job, float delta)
}
}

if (refCount != vCount)
{
m_referenceObstacles.Dispose();
m_referenceObstacles = new NativeArray<ObstacleVertexData>(vCount, Allocator.Persistent);

m_outputObstacles.Dispose();
m_outputObstacles = new NativeArray<ObstacleVertexData>(vCount, Allocator.Persistent);
}
MakeLength(ref m_referenceObstacles, vCount);
MakeLength(ref m_outputObstacles, vCount);

ObstacleVertexData oData;
int gIndex = 0, index = 0, vCountMinusOne, firstIndex, lastIndex;
Expand Down
7 changes: 2 additions & 5 deletions Runtime/Jobs/RaycastProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SOFTWARE.

using Nebukam.JobAssist;
using static Nebukam.JobAssist.CollectionsUtils;
using System.Collections.Generic;
using Unity.Collections;
using Unity.Mathematics;
Expand Down Expand Up @@ -71,11 +72,7 @@ protected override void Prepare(ref Unemployed job, float delta)

int raycastCount = m_lockedRaycasts.Count;

if (m_outputRaycast.Length != raycastCount)
{
m_outputRaycast.Dispose();
m_outputRaycast = new NativeArray<RaycastData>(raycastCount, Allocator.Persistent);
}
MakeLength(ref m_outputRaycast, raycastCount);

Raycast r;
float3 pos, dir;
Expand Down
8 changes: 3 additions & 5 deletions Runtime/Jobs/RaycastsProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SOFTWARE.

using Nebukam.JobAssist;
using static Nebukam.JobAssist.CollectionsUtils;
using System.Collections.Generic;
using Unity.Collections;
using static Unity.Mathematics.math;
Expand Down Expand Up @@ -86,11 +87,8 @@ protected override int Prepare(ref RaycastsJob job, float delta)
}

int rayCount = m_raycastProvider.outputRaycasts.Length;
if (m_results.Length != rayCount)
{
m_results.Dispose();
m_results = new NativeArray<RaycastResult>(rayCount, Allocator.Persistent);
}

MakeLength(ref m_results, rayCount);

job.m_plane = plane;

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.nebukam.orca",
"version": "1.0.3",
"version": "1.0.4",
"displayName": "N:ORCA",
"description": "Optimal Reciprocal Collision Avoidance",
"unity": "2019.4",
Expand Down Expand Up @@ -28,7 +28,7 @@
},
"gitDependencies": {
"com.nebukam.common": "https://github.com/Nebukam/com.nebukam.common.git#0.0.1",
"com.nebukam.job-assist": "https://github.com/Nebukam/com.nebukam.job-assist.git#1.0.1"
"com.nebukam.job-assist": "https://github.com/Nebukam/com.nebukam.job-assist.git#1.0.5"
},
"samples": [
{
Expand Down

0 comments on commit f5ef506

Please sign in to comment.