Skip to content

Commit ec16fed

Browse files
Publishing samples for Entities 0.13
1 parent f1c9ca9 commit ec16fed

File tree

276 files changed

+9015
-1896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+9015
-1896
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
**/Library/
2+
**/UserSettings/
23
**/Temp/
34
**/obj/
45

ECSSamples/Assets/Advanced/BlobAsset/MeshBBComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ public MeshBBComponent(BlobAssetReference<MeshBBBlobAsset> blob)
1818
{
1919
BlobData = blob;
2020
}
21-
}
21+
}

ECSSamples/Assets/Advanced/BlobAsset/MeshBBConversionSystem.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected override void OnUpdate()
3434
int curPointIndex = 0;
3535
var vertices = new List<Vector3>(4096);
3636
var processBlobAssets = new NativeList<Hash128>(32, Allocator.Temp);
37-
37+
3838
Profiler.BeginSample("Conv_BuildHashAndPush");
3939

4040
using (var context = new BlobAssetComputationContext<MeshBBFactorySettings, MeshBBBlobAsset>(BlobAssetStore, 128, Allocator.Temp))
@@ -56,7 +56,7 @@ protected override void OnUpdate()
5656

5757
float xp = float.MinValue, yp = float.MinValue, zp = float.MinValue;
5858
float xn = float.MaxValue, yn = float.MaxValue, zn = float.MaxValue;
59-
59+
6060
// Copy the mesh vertices into the point array
6161
if (hasMesh)
6262
{
@@ -120,7 +120,7 @@ protected override void OnUpdate()
120120
var entity = GetPrimaryEntity(auth);
121121

122122
DstEntityManager.AddComponentData(entity, new MeshBBComponent(blob));
123-
DstEntityManager.AddComponentData(entity,new Translation{Value=auth.transform.position});
123+
DstEntityManager.AddComponentData(entity, new Translation {Value = auth.transform.position});
124124
});
125125

126126
Profiler.EndSample();
@@ -156,13 +156,13 @@ public void Execute(int index)
156156
root.MeshScale = s;
157157
root.MinBoundingBox = settings.MinBoundingBox * s;
158158
root.MaxBoundingBox = settings.MaxBoundingBox * s;
159-
159+
160160
for (int i = 0; i < array.Length; i++)
161161
{
162162
var v1 = Vertices[settings.PointStartIndex + i];
163163
array[i] = new float3(v1.x * s, v1.y * s, v1.z * s);
164164
}
165-
165+
166166
BlobAssets[index] = builder.CreateBlobAssetReference<MeshBBBlobAsset>(Allocator.Persistent);
167167
builder.Dispose();
168168
}

ECSSamples/Assets/Advanced/BlobAsset/MeshBBRenderSystem.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ protected override void OnUpdate()
1313
{
1414
var min = dmc.BlobData.Value.MinBoundingBox;
1515
var max = dmc.BlobData.Value.MaxBoundingBox;
16-
16+
1717
// Draw a bounding box
1818
Debug.DrawLine(t.Value + new float3(min.x, min.y, min.z), t.Value + new float3(max.x, min.y, min.z));
1919
Debug.DrawLine(t.Value + new float3(min.x, max.y, min.z), t.Value + new float3(max.x, max.y, min.z));
2020
Debug.DrawLine(t.Value + new float3(min.x, min.y, min.z), t.Value + new float3(min.x, max.y, min.z));
2121
Debug.DrawLine(t.Value + new float3(max.x, min.y, min.z), t.Value + new float3(max.x, max.y, min.z));
22-
22+
2323
Debug.DrawLine(t.Value + new float3(min.x, min.y, max.z), t.Value + new float3(max.x, min.y, max.z));
2424
Debug.DrawLine(t.Value + new float3(min.x, max.y, max.z), t.Value + new float3(max.x, max.y, max.z));
2525
Debug.DrawLine(t.Value + new float3(min.x, min.y, max.z), t.Value + new float3(min.x, max.y, max.z));
2626
Debug.DrawLine(t.Value + new float3(max.x, min.y, max.z), t.Value + new float3(max.x, max.y, max.z));
27-
27+
2828
Debug.DrawLine(t.Value + new float3(min.x, min.y, min.z), t.Value + new float3(min.x, min.y, max.z));
2929
Debug.DrawLine(t.Value + new float3(max.x, min.y, min.z), t.Value + new float3(max.x, min.y, max.z));
3030
Debug.DrawLine(t.Value + new float3(min.x, max.y, min.z), t.Value + new float3(min.x, max.y, max.z));
3131
Debug.DrawLine(t.Value + new float3(max.x, max.y, min.z), t.Value + new float3(max.x, max.y, max.z));
3232
});
3333
}
34-
}
34+
}

ECSSamples/Assets/Advanced/BlobAsset/MeshToBoundingBoxAuthoring.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using UnityEngine;
33
using UnityObject = UnityEngine.Object;
44

ECSSamples/Assets/Advanced/BlobAsset/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# BlobAsset Conversion Sample
1+
# BlobAsset Conversion Sample
22

33
This sample demonstrates how to convert a information from a GameObject containing a Unity Authoring component to a BlobAsset using the `BlobAssetStore` and `BlobAssetComputationContext` types.
44

55
## What does it show
66

7-
The sample contains a SubScene with 512 GameObjects. Each GameObject has a "MeshToBoundingBoxAuthoring" component that defines the information we want to store in a blob asset. (The GameObjects are stored as a nested prefab to save disk space).
7+
The sample contains a SubScene with 512 GameObjects. Each GameObject has a "MeshToBoundingBoxAuthoring" component that defines the information we want to store in a blob asset. (The GameObjects are stored as a nested prefab to save disk space).
88

99
After conversion, the `MeshBBRenderSystem` uses the blob asset to draw a bounding box for each of the 512 converted entities. (The renderer uses the Unity `Debug.Draw()` function, so the bounding box only appears in the Scene view.)
1010

@@ -17,9 +17,9 @@ After conversion, the `MeshBBRenderSystem` uses the blob asset to draw a boundin
1717
* **M16** — a square made up of four M4 lines.
1818
* **M64** — a cube made up of four M16 squares.
1919
* **M512** — a cube made up of eight M64 cubes .
20-
* **MeshToBoundingBoxsAuthoring** — defines the mesh and scale from which to compute the bounding boxes. Although each component in the sample starts out the same, you can assign different values to each component.
20+
* **MeshToBoundingBoxsAuthoring** — defines the mesh and scale from which to compute the bounding boxes. Although each component in the sample starts out the same, you can assign different values to each component.
2121
* **MeshBBComponent** —defines the structure of the blob asset used to store the computed bounding boxes and also the IComponentData struct used to assign a BlobAssetReference to an individual entity.
22-
* **MeshBBConversionSystem** — Converts each unique combination of the values of Mesh and Scale encountered in the MeshToBoundingBoxsAuthoring components to a unique blob asset.
22+
* **MeshBBConversionSystem** — Converts each unique combination of the values of Mesh and Scale encountered in the MeshToBoundingBoxsAuthoring components to a unique blob asset.
2323
* **MeshBBRenderSystem** — draws the bounding boxes in the Unity Scene view.
2424

2525
## What it does
@@ -43,11 +43,11 @@ The `MeshBBConversionSystem` is a ` GameObjectConversionSystem` that does most o
4343

4444
`MeshBBConversionSystem` performs its conversion task in three steps:
4545

46-
1. For all changed `MeshToBoundingBoxAuthoring` authoring components, the system determines if a BlobAsset must be computed and pushes the values needed to compute the asset onto the `BlobAssetComputationContext` computation stack.
46+
1. For all changed `MeshToBoundingBoxAuthoring` authoring components, the system determines if a BlobAsset must be computed and pushes the values needed to compute the asset onto the `BlobAssetComputationContext` computation stack.
4747
2. Schedules a job to compute the blob assets using the values created in step 1.
4848
3. Creates a MeshBBComponent, assigns the corresponding `BlobAssetReference` for the blob asset created in step 2, and adds the component to the entity.
4949

50-
A `GameObjectConversionSystem` is a `ComponentSystem`, so it normally performs its work on the main thread. However, as this sample illustrates, you can use the C# Job System to move some parts of a conversion to worker threads. The `BlobAssetComputationContext` provides the `AddBlobAssetToCompute()` function to help optimize blob asset creation.
50+
A `GameObjectConversionSystem` is a `ComponentSystem`, so it normally performs its work on the main thread. However, as this sample illustrates, you can use the C# Job System to move some parts of a conversion to worker threads. The `BlobAssetComputationContext` provides the `AddBlobAssetToCompute()` function to help optimize blob asset creation.
5151

5252
Using the `AddBlobAssetToCompute()` function, you can add a *settings* struct containing the values you need in order to create the blob asset to the *context*, associating a set of values with a hash. The hash value is used to determine whether a given authoring component represents a new blob asset or if it should share one already added for a different authoring component. You also use the hash to retrieve a reference to the blob asset after it is created.
5353

ECSSamples/Assets/Advanced/Boids/PostProcessing/Editor/Models/BloomModelEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void DrawRect(float x1, float y1, float x2, float y2, float fill, float line)
119119
m_RectVertices,
120120
fill < 0 ? Color.clear : Color.white * fill,
121121
line < 0 ? Color.clear : Color.white * line
122-
);
122+
);
123123
}
124124

125125
// Update internal state with a given bloom instance
@@ -163,7 +163,7 @@ public void DrawGraph()
163163
Handles.Label(
164164
PointInRect(0, m_RangeY) + Vector3.right,
165165
"Brightness Response (linear)", EditorStyles.miniLabel
166-
);
166+
);
167167

168168
// Threshold line
169169
DrawLine(m_GraphThreshold, 0, m_GraphThreshold, m_RangeY, 0.6f);

ECSSamples/Assets/Advanced/Boids/PostProcessing/Editor/Models/MotionBlurModelEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ void DrawDisc(Vector2 center, float radius, Color fill)
137137
void DrawArc(Vector2 center, float radius, float angle, Color fill)
138138
{
139139
var start = new Vector2(
140-
-Mathf.Cos(Mathf.Deg2Rad * angle / 2f),
141-
Mathf.Sin(Mathf.Deg2Rad * angle / 2f)
142-
);
140+
-Mathf.Cos(Mathf.Deg2Rad * angle / 2f),
141+
Mathf.Sin(Mathf.Deg2Rad * angle / 2f)
142+
);
143143

144144
Handles.color = fill;
145145
Handles.DrawSolidArc(center, Vector3.forward, start, angle, radius);

ECSSamples/Assets/Advanced/Boids/PostProcessing/Editor/Monitors/HistogramMonitor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ public override void OnMonitorGUI(Rect r)
8080
: r.height;
8181

8282
m_MonitorAreaRect = new Rect(
83-
Mathf.Floor(r.x + r.width / 2f - width / 2f),
84-
Mathf.Floor(r.y + r.height / 2f - height / 2f - 5f),
85-
width, height
86-
);
83+
Mathf.Floor(r.x + r.width / 2f - width / 2f),
84+
Mathf.Floor(r.y + r.height / 2f - height / 2f - 5f),
85+
width, height
86+
);
8787

8888
if (m_HistogramTexture != null)
8989
{

ECSSamples/Assets/Advanced/Boids/PostProcessing/Editor/Monitors/ParadeMonitor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public override void OnMonitorGUI(Rect r)
7878
: r.height;
7979

8080
m_MonitorAreaRect = new Rect(
81-
Mathf.Floor(r.x + r.width / 2f - width / 2f),
82-
Mathf.Floor(r.y + r.height / 2f - height / 2f - 5f),
83-
width, height
84-
);
81+
Mathf.Floor(r.x + r.width / 2f - width / 2f),
82+
Mathf.Floor(r.y + r.height / 2f - height / 2f - 5f),
83+
width, height
84+
);
8585

8686
if (m_WaveformTexture != null)
8787
{

0 commit comments

Comments
 (0)