forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCartesianGridOnCube.cs
More file actions
52 lines (43 loc) · 1.43 KB
/
Copy pathCartesianGridOnCube.cs
File metadata and controls
52 lines (43 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
public struct CartesianGridOnCube : IComponentData
{
public BlobAssetReference<CartesianGridOnCubeBlob> Blob;
}
public struct CartesianGridOnCubeBlob
{
public ushort RowCount;
// Offset vector for trailing edge of unit-size object.
// Pre-added to grid center.
// [0] = ( cx + 0.0f, cz + -0.5f ); // North
// [1] = ( cx + 0.0f, cz + 0.5f ); // South
// [2] = ( cx + 0.5f, cz + 0.0f ); // West
// [3] = ( cx + -0.5f, cz + 0.0f ); // East
public BlobArray<float2> TrailingOffsets;
// [4bit x rowCount x colCount] of walls.
// 0x01 = North
// 0x02 = South
// 0x04 = West
// 0x08 = East
public BlobArray<byte> Walls;
// For each face[6], local to world transform. (Order as in CubeFace)
public BlobArray<float4x4> FaceLocalToWorld;
// For each face[6], world to local transform. (Order as in CubeFace)
public BlobArray<float4x4> FaceWorldToLocal;
// For each face by each face [6*6], local to local transform. (Order as in CubeFace)
public BlobArray<float4x4> FaceLocalToLocal;
}
// Which face of the Cube
// 0 = X+
// 1 = X-
// 2 = Y+
// 3 = Y-
// 4 = Z+
// 5 = Z-
[WriteGroup((typeof(LocalToWorld)))]
[WriteGroup((typeof(CartesianGridCoordinates)))]
public struct CartesianGridOnCubeFace : IComponentData
{
public byte Value;
}