Class PlanarLazyMeshGrid
An infinite planar grid. It is evaluated lazily by splitting the plane into overlapping period rectangles which then each has a mesh associated. The meshes are converted to cells like a MeshGrid, then stitched together.
Implements
Inherited Members
Namespace: Sylves
Assembly: Sylves.dll
Syntax
public class PlanarLazyMeshGrid : PlanarLazyGrid, IGrid
Constructors
PlanarLazyMeshGrid()
Declaration
protected PlanarLazyMeshGrid()
PlanarLazyMeshGrid(PlanarLazyMeshGrid, SquareBound)
Declaration
protected PlanarLazyMeshGrid(PlanarLazyMeshGrid original, SquareBound bound)
Parameters
| Type | Name | Description |
|---|---|---|
| PlanarLazyMeshGrid | original | |
| SquareBound | bound |
PlanarLazyMeshGrid(Func<Cell, MeshData>, HexGrid, Single, Boolean, MeshGridOptions, SquareBound, IEnumerable<ICellType>, ICachePolicy)
Constructs a planar lazy grid that calls getMeshData to fill a hex grid with a mesh per cell.
Declaration
public PlanarLazyMeshGrid(Func<Cell, MeshData> getMeshData, HexGrid chunkGrid, float margin = 0F, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<Cell, MeshData> | getMeshData | The function supplying the mesh per cell of chunkGrid |
| HexGrid | chunkGrid | Each cell of this grid becomes a chunk of the PlanarLazyMeshGrid. |
| System.Single | margin | The output of getMeshData should be fit inside the shape of chunkGrid cell, expanded by margin. |
| System.Boolean | translateMeshData | |
| MeshGridOptions | meshGridOptions | Options to use when converting meshes to the grid. |
| SquareBound | bound | Bounds which chunks are generated. |
| System.Collections.Generic.IEnumerable<ICellType> | cellTypes | What should the response of GetCellType |
| ICachePolicy | cachePolicy | Configures how to store the cahced meshes. |
PlanarLazyMeshGrid(Func<Cell, MeshData>, SquareGrid, Single, Boolean, MeshGridOptions, SquareBound, IEnumerable<ICellType>, ICachePolicy)
Constructs a planar lazy grid that calls getMeshData to fill a square grid with a mesh per cell.
Declaration
public PlanarLazyMeshGrid(Func<Cell, MeshData> getMeshData, SquareGrid chunkGrid, float margin = 0F, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<Cell, MeshData> | getMeshData | The function supplying the mesh per cell of chunkGrid |
| SquareGrid | chunkGrid | Each cell of this grid becomes a chunk of the PlanarLazyMeshGrid. |
| System.Single | margin | The output of getMeshData should be fit inside the shape of chunkGrid cell, expanded by margin. |
| System.Boolean | translateMeshData | |
| MeshGridOptions | meshGridOptions | Options to use when converting meshes to the grid. |
| SquareBound | bound | Bounds which chunks are generated. |
| System.Collections.Generic.IEnumerable<ICellType> | cellTypes | What should the response of GetCellType |
| ICachePolicy | cachePolicy | Configures how to store the cahced meshes. |
PlanarLazyMeshGrid(Func<Vector2Int, MeshData>, Vector2, Vector2, Vector2, Vector2, Boolean, MeshGridOptions, SquareBound, IEnumerable<ICellType>, ICachePolicy)
Constructs a planar lazy grid that calls getMeshData to fill a chunked plane with a mesh per chunk.
Declaration
public PlanarLazyMeshGrid(Func<Vector2Int, MeshData> getMeshData, Vector2 strideX, Vector2 strideY, Vector2 aabbBottomLeft, Vector2 aabbSize, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<Vector2Int, MeshData> | getMeshData | The function supplying the meshes per chunk. |
| Vector2 | strideX | The step from one chunk to the next. |
| Vector2 | strideY | The step from one chunk to the next. |
| Vector2 | aabbBottomLeft | The bottom left point of the central chunk. This should bound getMeshData(new Vector2(0, 0)) |
| Vector2 | aabbSize | The size of each chunk. This should bound getMeshData(new Vector2(0, 0)) |
| System.Boolean | translateMeshData | |
| MeshGridOptions | meshGridOptions | Options to use when converting meshes to the grid. |
| SquareBound | bound | Bounds which chunks are generated. |
| System.Collections.Generic.IEnumerable<ICellType> | cellTypes | What should the response of GetCellType |
| ICachePolicy | cachePolicy | Configures how to store the cahced meshes. |
Properties
Unbounded
Declaration
public override IGrid Unbounded { get; }
Property Value
| Type | Description |
|---|---|
| IGrid |
Overrides
Methods
BoundBy(IBound)
Declaration
public override IGrid BoundBy(IBound bound)
Parameters
| Type | Name | Description |
|---|---|---|
| IBound | bound |
Returns
| Type | Description |
|---|---|
| IGrid |
Overrides
GetChildGrid(Cell)
Declaration
protected override IGrid GetChildGrid(Cell chunkCell)
Parameters
| Type | Name | Description |
|---|---|---|
| Cell | chunkCell |
Returns
| Type | Description |
|---|---|
| IGrid |
Overrides
Setup(Func<Cell, MeshData>, HexGrid, Single, Boolean, MeshGridOptions, SquareBound, IEnumerable<ICellType>, ICachePolicy)
Declaration
protected void Setup(Func<Cell, MeshData> getMeshData, HexGrid chunkGrid, float margin = 0F, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<Cell, MeshData> | getMeshData | |
| HexGrid | chunkGrid | |
| System.Single | margin | |
| System.Boolean | translateMeshData | |
| MeshGridOptions | meshGridOptions | |
| SquareBound | bound | |
| System.Collections.Generic.IEnumerable<ICellType> | cellTypes | |
| ICachePolicy | cachePolicy |
Setup(Func<Cell, MeshData>, SquareGrid, Single, Boolean, MeshGridOptions, SquareBound, IEnumerable<ICellType>, ICachePolicy)
Declaration
protected void Setup(Func<Cell, MeshData> getMeshData, SquareGrid chunkGrid, float margin = 0F, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<Cell, MeshData> | getMeshData | |
| SquareGrid | chunkGrid | |
| System.Single | margin | |
| System.Boolean | translateMeshData | |
| MeshGridOptions | meshGridOptions | |
| SquareBound | bound | |
| System.Collections.Generic.IEnumerable<ICellType> | cellTypes | |
| ICachePolicy | cachePolicy |
Setup(Func<Vector2Int, MeshData>, Vector2, Vector2, Vector2, Vector2, Boolean, MeshGridOptions, SquareBound, IEnumerable<ICellType>, ICachePolicy)
Declaration
protected void Setup(Func<Vector2Int, MeshData> getMeshData, Vector2 strideX, Vector2 strideY, Vector2 aabbBottomLeft, Vector2 aabbSize, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<Vector2Int, MeshData> | getMeshData | |
| Vector2 | strideX | |
| Vector2 | strideY | |
| Vector2 | aabbBottomLeft | |
| Vector2 | aabbSize | |
| System.Boolean | translateMeshData | |
| MeshGridOptions | meshGridOptions | |
| SquareBound | bound | |
| System.Collections.Generic.IEnumerable<ICellType> | cellTypes | |
| ICachePolicy | cachePolicy |
TryMove(Cell, CellDir, out Cell, out CellDir, out Connection)
Declaration
public override bool TryMove(Cell cell, CellDir dir, out Cell dest, out CellDir inverseDir, out Connection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| Cell | cell | |
| CellDir | dir | |
| Cell | dest | |
| CellDir | inverseDir | |
| Connection | connection |
Returns
| Type | Description |
|---|---|
| System.Boolean |