Skip to content

Commit 15cc7fa

Browse files
committed
typos
1 parent 62c0468 commit 15cc7fa

File tree

10 files changed

+296
-150
lines changed

10 files changed

+296
-150
lines changed

Packages/NativeTrees/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ There are two samples included that show how to use the octree and quadtree.
7474
The extension classes provide readymade solutions for AABB only checking. For more complicated
7575
shapes you must provide your own ray/overlap/distance calculations.
7676

77+
NOTE: If you've imported the package via the Unity Package Manager, you need to copy the
78+
sample scenes to your Assets folder to open them.
79+
[See this thread](https://forum.unity.com/threads/it-is-not-allowed-to-open-a-scene-in-a-read-only-package-why.1148036/)
80+
7781
### Insertion
7882
The objects can be of any unmanaged type, when inserting, an AABB must be provided:
7983

@@ -92,7 +96,6 @@ If you know your objects are points, you can insert them faster by using:
9296
// Insert entities that are 'points'
9397
for (int i = 0; i < entities.Length; i++)
9498
{
95-
var entity = entities[i];
9699
octree.InsertPoint(entities[i], positions[i]);
97100
}
98101

@@ -200,7 +203,8 @@ Feel free to raise an issue or contact me for any questions.
200203
The code is free to use in your project(s).
201204
If this was helpful to you, consider buying me a coffee ;)
202205

203-
https://ko-fi.com/bartofzo
206+
<a href='https://ko-fi.com/bartofzo' target='_blank'><img height='35' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' />
207+
204208

205209
Thank you!
206210

Packages/NativeTrees/Runtime/Quadtree/IQuadtreeNearestVisitor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ namespace NativeTrees
33
public interface IQuadtreeNearestVisitor<T>
44
{
55
/// <summary>
6+
/// <para>
67
/// Gets called for every object as a result of a nearest neighbour query.
78
/// This is called in order, so the first call is the nearest object to the point. The second is the second nearest and so on.
89
/// Note that if the objects are not points, it is possible for an object to be visited multiple times.
9-
/// So if for example you need the 3rd nearest object, you should use a hashset to count unique occurances, or use some (external) mailboxing
10-
/// mechanism.
10+
/// </para>
1111
/// </summary>
1212
/// <param name="obj">The object in question</param>
1313
/// <returns>Return true to keep iterating, false to stop. So for example if you only need to know the one nearest neighbour, return false

Packages/NativeTrees/Runtime/Quadtree/NativeQuadtree.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void Insert(T obj, AABB2D bounds)
119119
{
120120
// Root node id = 1
121121
// we always start at depth one (assume one split)
122-
// our root node has a non zero id so that octants with bits 000 never get confused with the root node
122+
// our root node has a non zero id so that quads with bits 000 never get confused with the root node
123123
// since we have 32 bits of room and our max depth is 10 (30 bits) we have room for that one root node bit
124124
// at position 31
125125
var objWrapper = new ObjWrapper(obj, bounds);
@@ -141,9 +141,9 @@ public void InsertPoint(T obj, float2 point)
141141
while (depth <= maxDepth)
142142
{
143143
// We can get the one quad the point is in with one operation
144-
int octantIndex = PointToQuadIndex(point, extents.nodeCenter);
145-
extents = QuarterSizeBounds.GetQuad(extents, octantIndex);
146-
nodeId = GetQuadId(nodeId, octantIndex);
144+
int quadIndex = PointToQuadIndex(point, extents.nodeCenter);
145+
extents = QuarterSizeBounds.GetQuad(extents, quadIndex);
146+
nodeId = GetQuadId(nodeId, quadIndex);
147147

148148
if (TryInsert(nodeId, extents, objWrapper, depth))
149149
return;
@@ -159,15 +159,15 @@ void InsertNext(uint nodeid, in QuarterSizeBounds quarterSizeBounds, in ObjWrapp
159159

160160
for (int i = 0; i < 4; i++)
161161
{
162-
int octantMask = QuadMasks[i];
163-
if ((objMask & octantMask) != octantMask)
162+
int quadMask = QuadMasks[i];
163+
if ((objMask & quadMask) != quadMask)
164164
continue;
165165

166166
uint ocantId = GetQuadId(nodeid, i);
167-
var octantCenterQuarterSize = QuarterSizeBounds.GetQuad(quarterSizeBounds, i);
167+
var quadCenterQuarterSize = QuarterSizeBounds.GetQuad(quarterSizeBounds, i);
168168

169-
if (!TryInsert(ocantId, octantCenterQuarterSize, objWrapper, parentDepth))
170-
InsertNext(ocantId, octantCenterQuarterSize, objWrapper, parentDepth);
169+
if (!TryInsert(ocantId, quadCenterQuarterSize, objWrapper, parentDepth))
170+
InsertNext(ocantId, quadCenterQuarterSize, objWrapper, parentDepth);
171171
}
172172
}
173173

@@ -215,8 +215,8 @@ void Subdivide(uint nodeId, in QuarterSizeBounds quarterSizeBounds, int depth)
215215

216216
for (int j = 0; j < 4; j++)
217217
{
218-
int octantMask = QuadMasks[j];
219-
if ((aabbMask & octantMask) == octantMask)
218+
int quadMask = QuadMasks[j];
219+
if ((aabbMask & quadMask) == quadMask)
220220
{
221221
objects.Add(GetQuadId(nodeId, j), moveObject);
222222
countPerQuad[j] = countPerQuad[j] + 1; // ++ ?
@@ -233,12 +233,12 @@ void Subdivide(uint nodeId, in QuarterSizeBounds quarterSizeBounds, int depth)
233233
int count = countPerQuad[i];
234234
if (count > 0)
235235
{
236-
uint octantId = GetQuadId(nodeId, i);
237-
nodes[octantId] = count; // mark our node as being used
236+
uint quadId = GetQuadId(nodeId, i);
237+
nodes[quadId] = count; // mark our node as being used
238238

239239
// could be that we need to subdivide again if all of the objects went to the same quad
240240
if (count > objectsPerNode && depth < maxDepth) // todo: maxDepth check can be hoisted
241-
Subdivide(octantId, QuarterSizeBounds.GetQuad(quarterSizeBounds, i), depth);
241+
Subdivide(quadId, QuarterSizeBounds.GetQuad(quarterSizeBounds, i), depth);
242242
}
243243
}
244244
}
@@ -268,7 +268,7 @@ private static int PointToQuadIndex(float2 point, float2 nodeCenter) =>
268268
/// For each level we go down, we shift these bits 2 spaces to the left
269269
/// </summary>
270270
[MethodImpl(MethodImplOptions.AggressiveInlining)]
271-
public static uint GetQuadId(uint parent, int octantIndex) => (parent << 2) | (uint)octantIndex;
271+
public static uint GetQuadId(uint parent, int quadIndex) => (parent << 2) | (uint)quadIndex;
272272

273273
/*
274274
* AABB2D - quad overlap technique explanation:
@@ -370,8 +370,8 @@ public ExtentsBounds(float2 nodeCenter, float2 nodeExtents)
370370
[MethodImpl(MethodImplOptions.AggressiveInlining)]
371371
public static ExtentsBounds GetQuad(in ExtentsBounds parent, int index)
372372
{
373-
float2 octantExtents = .5f * parent.nodeExtents;
374-
return new ExtentsBounds(parent.nodeCenter + QuadCenterOffsets[index] * octantExtents, octantExtents);
373+
float2 quadExtents = .5f * parent.nodeExtents;
374+
return new ExtentsBounds(parent.nodeCenter + QuadCenterOffsets[index] * quadExtents, quadExtents);
375375
}
376376

377377
[MethodImpl(MethodImplOptions.AggressiveInlining)]

Packages/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"dependencies": {
33
"com.unity.burst": "1.6.6",
4-
"com.unity.collections": "1.4.0"
4+
"com.unity.collections": "1.4.0",
5+
"com.unity.ide.rider": "3.0.16"
56
}
67
}

Packages/packages-lock.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,20 @@
3131
},
3232
"com.unity.ext.nunit": {
3333
"version": "1.0.6",
34-
"depth": 2,
34+
"depth": 1,
3535
"source": "registry",
3636
"dependencies": {},
3737
"url": "https://packages.unity.com"
3838
},
39+
"com.unity.ide.rider": {
40+
"version": "3.0.16",
41+
"depth": 0,
42+
"source": "registry",
43+
"dependencies": {
44+
"com.unity.ext.nunit": "1.0.6"
45+
},
46+
"url": "https://packages.unity.com"
47+
},
3948
"com.unity.mathematics": {
4049
"version": "1.2.6",
4150
"depth": 1,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"MonoBehaviour": {
3+
"Version": 4,
4+
"EnableBurstCompilation": true,
5+
"EnableOptimisations": true,
6+
"EnableSafetyChecks": false,
7+
"EnableDebugInAllBuilds": false,
8+
"UsePlatformSDKLinker": false,
9+
"CpuMinTargetX32": 0,
10+
"CpuMaxTargetX32": 0,
11+
"CpuMinTargetX64": 0,
12+
"CpuMaxTargetX64": 0,
13+
"CpuTargetsX64": 72,
14+
"OptimizeFor": 0
15+
}
16+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"MonoBehaviour": {
3+
"Version": 4,
4+
"DisabledWarnings": ""
5+
}
6+
}

ProjectSettings/ProjectSettings.asset

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ PlayerSettings:
154154
resetResolutionOnWindowResize: 0
155155
androidSupportedAspectRatio: 1
156156
androidMaxAspectRatio: 2.1
157-
applicationIdentifier: {}
157+
applicationIdentifier:
158+
Standalone: com.DefaultCompany.NativeOctree
158159
buildNumber:
159160
Standalone: 0
160161
iPhone: 0

ProjectSettings/QualitySettings.asset

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ QualitySettings:
1818
shadowCascade2Split: 0.33333334
1919
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
2020
shadowmaskMode: 0
21-
blendWeights: 1
21+
skinWeights: 1
2222
textureQuality: 1
2323
anisotropicTextures: 0
2424
antiAliasing: 0
@@ -40,6 +40,7 @@ QualitySettings:
4040
asyncUploadBufferSize: 16
4141
asyncUploadPersistentBuffer: 1
4242
resolutionScalingFixedDPIFactor: 1
43+
customRenderPipeline: {fileID: 0}
4344
excludedTargetPlatforms: []
4445
- serializedVersion: 2
4546
name: Low
@@ -53,7 +54,7 @@ QualitySettings:
5354
shadowCascade2Split: 0.33333334
5455
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
5556
shadowmaskMode: 0
56-
blendWeights: 2
57+
skinWeights: 2
5758
textureQuality: 0
5859
anisotropicTextures: 0
5960
antiAliasing: 0
@@ -75,6 +76,7 @@ QualitySettings:
7576
asyncUploadBufferSize: 16
7677
asyncUploadPersistentBuffer: 1
7778
resolutionScalingFixedDPIFactor: 1
79+
customRenderPipeline: {fileID: 0}
7880
excludedTargetPlatforms: []
7981
- serializedVersion: 2
8082
name: Medium
@@ -88,7 +90,7 @@ QualitySettings:
8890
shadowCascade2Split: 0.33333334
8991
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
9092
shadowmaskMode: 0
91-
blendWeights: 2
93+
skinWeights: 2
9294
textureQuality: 0
9395
anisotropicTextures: 1
9496
antiAliasing: 0
@@ -110,6 +112,7 @@ QualitySettings:
110112
asyncUploadBufferSize: 16
111113
asyncUploadPersistentBuffer: 1
112114
resolutionScalingFixedDPIFactor: 1
115+
customRenderPipeline: {fileID: 0}
113116
excludedTargetPlatforms: []
114117
- serializedVersion: 2
115118
name: High
@@ -123,7 +126,7 @@ QualitySettings:
123126
shadowCascade2Split: 0.33333334
124127
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
125128
shadowmaskMode: 1
126-
blendWeights: 2
129+
skinWeights: 2
127130
textureQuality: 0
128131
anisotropicTextures: 1
129132
antiAliasing: 0
@@ -145,6 +148,7 @@ QualitySettings:
145148
asyncUploadBufferSize: 16
146149
asyncUploadPersistentBuffer: 1
147150
resolutionScalingFixedDPIFactor: 1
151+
customRenderPipeline: {fileID: 0}
148152
excludedTargetPlatforms: []
149153
- serializedVersion: 2
150154
name: Very High
@@ -158,7 +162,7 @@ QualitySettings:
158162
shadowCascade2Split: 0.33333334
159163
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
160164
shadowmaskMode: 1
161-
blendWeights: 4
165+
skinWeights: 4
162166
textureQuality: 0
163167
anisotropicTextures: 2
164168
antiAliasing: 2
@@ -180,6 +184,7 @@ QualitySettings:
180184
asyncUploadBufferSize: 16
181185
asyncUploadPersistentBuffer: 1
182186
resolutionScalingFixedDPIFactor: 1
187+
customRenderPipeline: {fileID: 0}
183188
excludedTargetPlatforms: []
184189
- serializedVersion: 2
185190
name: Ultra
@@ -193,7 +198,7 @@ QualitySettings:
193198
shadowCascade2Split: 0.33333334
194199
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
195200
shadowmaskMode: 1
196-
blendWeights: 4
201+
skinWeights: 4
197202
textureQuality: 0
198203
anisotropicTextures: 2
199204
antiAliasing: 2
@@ -215,16 +220,18 @@ QualitySettings:
215220
asyncUploadBufferSize: 16
216221
asyncUploadPersistentBuffer: 1
217222
resolutionScalingFixedDPIFactor: 1
223+
customRenderPipeline: {fileID: 0}
218224
excludedTargetPlatforms: []
219225
m_PerPlatformDefaultQuality:
220226
Android: 2
221-
Lumin: 5
222227
GameCoreScarlett: 5
223228
GameCoreXboxOne: 5
229+
Lumin: 5
224230
Nintendo 3DS: 5
225231
Nintendo Switch: 5
226232
PS4: 5
227233
PS5: 5
234+
Server: 0
228235
Stadia: 5
229236
Standalone: 5
230237
WebGL: 3

0 commit comments

Comments
 (0)