Show / Hide Table of Contents

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.

Inheritance
object
NestedModifier
PlanarLazyGrid
PlanarLazyMeshGrid
JitteredSquareGrid
Implements
IGrid
Inherited Members
PlanarLazyGrid.Setup(Vector2, Vector2, Vector2, Vector2, bool, SquareBound, IEnumerable<ICellType>, ICachePolicy)
PlanarLazyGrid.GetAdjacentChunks(Cell)
PlanarLazyGrid.ChunkOffset(Cell)
PlanarLazyGrid.MeshTranslation(Cell)
PlanarLazyGrid.GetDual()
PlanarLazyGrid.GetDiagonalGrid()
PlanarLazyGrid.StrideX
PlanarLazyGrid.StrideY
PlanarLazyGrid.AabbBottomLeft
PlanarLazyGrid.AabbSize
NestedModifier.Setup(IGrid, IEnumerable<ICellType>, ICachePolicy)
NestedModifier.GetChildGridCached(Cell)
NestedModifier.Split(Cell)
NestedModifier.Combine(Cell, Cell)
NestedModifier.GetCellTypes()
NestedModifier.GetCompactGrid()
NestedModifier.Recenter(Cell)
NestedModifier.GetCells()
NestedModifier.GetCellType(Cell)
NestedModifier.IsCellInGrid(Cell)
NestedModifier.TryMoveByOffset(Cell, Vector3Int, Vector3Int, CellRotation, out Cell, out CellRotation)
NestedModifier.ParallelTransport(IGrid, Cell, Cell, Cell, CellRotation, out Cell, out CellRotation)
NestedModifier.GetCellDirs(Cell)
NestedModifier.GetCellCorners(Cell)
NestedModifier.FindBasicPath(Cell, Cell)
NestedModifier.GetIndex(Cell)
NestedModifier.GetCellByIndex(int)
NestedModifier.GetBound()
NestedModifier.GetBound(IEnumerable<Cell>)
NestedModifier.IntersectBounds(IBound, IBound)
NestedModifier.UnionBounds(IBound, IBound)
NestedModifier.GetCellsInBounds(IBound)
NestedModifier.IsCellInBound(Cell, IBound)
NestedModifier.GetBoundAabb(IBound)
NestedModifier.GetCellCenter(Cell)
NestedModifier.GetCellCorner(Cell, CellCorner)
NestedModifier.GetTRS(Cell)
NestedModifier.GetDeformation(Cell)
NestedModifier.GetPolygon(Cell, out Vector3[], out Matrix4x4)
NestedModifier.GetTriangleMesh(Cell)
NestedModifier.GetMeshData(Cell, out MeshData, out Matrix4x4)
NestedModifier.GetAabb(Cell)
NestedModifier.GetAabb(IEnumerable<Cell>)
NestedModifier.FindCell(Vector3, out Cell)
NestedModifier.FindCell(Matrix4x4, out Cell, out CellRotation)
NestedModifier.GetCellsIntersectsApprox(Vector3, Vector3)
NestedModifier.Raycast(Vector3, Vector3, float)
NestedModifier.FindGridSymmetry(ISet<Cell>, ISet<Cell>, Cell, CellRotation)
NestedModifier.TryApplySymmetry(GridSymmetry, IBound, out IBound)
NestedModifier.TryApplySymmetry(GridSymmetry, Cell, out Cell, out CellRotation)
NestedModifier.ChunkGrid
NestedModifier.CachePolicy
NestedModifier.Is2d
NestedModifier.Is3d
NestedModifier.IsPlanar
NestedModifier.IsRepeating
NestedModifier.IsOrientable
NestedModifier.IsFinite
NestedModifier.IsSingleCellType
NestedModifier.CoordinateDimension
NestedModifier.Unwrapped
NestedModifier.IndexCount
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
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, float, bool, 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 = 0, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
Type Name Description
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.

float margin

The output of getMeshData should be fit inside the shape of chunkGrid cell, expanded by margin.

bool translateMeshData
MeshGridOptions meshGridOptions

Options to use when converting meshes to the grid.

SquareBound bound

Bounds which chunks are generated.

IEnumerable<ICellType> cellTypes

What should the response of GetCellType

ICachePolicy cachePolicy

Configures how to store the cahced meshes.

PlanarLazyMeshGrid(Func<Cell, MeshData>, SquareGrid, float, bool, 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 = 0, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
Type Name Description
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.

float margin

The output of getMeshData should be fit inside the shape of chunkGrid cell, expanded by margin.

bool translateMeshData
MeshGridOptions meshGridOptions

Options to use when converting meshes to the grid.

SquareBound bound

Bounds which chunks are generated.

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, bool, 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
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))

bool translateMeshData
MeshGridOptions meshGridOptions

Options to use when converting meshes to the grid.

SquareBound bound

Bounds which chunks are generated.

IEnumerable<ICellType> cellTypes

What should the response of GetCellType

ICachePolicy cachePolicy

Configures how to store the cahced meshes.

Properties

Unbounded

Returns the grid with any bounds removed.

Declaration
public override IGrid Unbounded { get; }
Property Value
Type Description
IGrid
Overrides
NestedModifier.Unbounded

Methods

BoundBy(IBound)

Returns a new grid restricted to just the given bound. If the grid already has a bound, the new grid will have the intersection of both.

Declaration
public override IGrid BoundBy(IBound bound)
Parameters
Type Name Description
IBound bound
Returns
Type Description
IGrid
Overrides
NestedModifier.BoundBy(IBound)

GetChildGrid(Cell)

The grid associated with each chunk. This grid has extra requirements:

  • It should only use the x-coordinate of the cell. The other two should be zero, (to be offset by the chunk position)
  • The dest of moves is also offset by the chunk position. Moves may be off grid (illegal in a normal grid)

As building a grid with off-grid moves is difficult, you can also just override TryMove to whatever.

Declaration
protected override IGrid GetChildGrid(Cell chunkCell)
Parameters
Type Name Description
Cell chunkCell
Returns
Type Description
IGrid
Overrides
NestedModifier.GetChildGrid(Cell)

Setup(Func<Cell, MeshData>, HexGrid, float, bool, MeshGridOptions, SquareBound, IEnumerable<ICellType>, ICachePolicy)

Declaration
protected void Setup(Func<Cell, MeshData> getMeshData, HexGrid chunkGrid, float margin = 0, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
Type Name Description
Func<Cell, MeshData> getMeshData
HexGrid chunkGrid
float margin
bool translateMeshData
MeshGridOptions meshGridOptions
SquareBound bound
IEnumerable<ICellType> cellTypes
ICachePolicy cachePolicy

Setup(Func<Cell, MeshData>, SquareGrid, float, bool, MeshGridOptions, SquareBound, IEnumerable<ICellType>, ICachePolicy)

Declaration
protected void Setup(Func<Cell, MeshData> getMeshData, SquareGrid chunkGrid, float margin = 0, bool translateMeshData = false, MeshGridOptions meshGridOptions = null, SquareBound bound = null, IEnumerable<ICellType> cellTypes = null, ICachePolicy cachePolicy = null)
Parameters
Type Name Description
Func<Cell, MeshData> getMeshData
SquareGrid chunkGrid
float margin
bool translateMeshData
MeshGridOptions meshGridOptions
SquareBound bound
IEnumerable<ICellType> cellTypes
ICachePolicy cachePolicy

Setup(Func<Vector2Int, MeshData>, Vector2, Vector2, Vector2, Vector2, bool, 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
Func<Vector2Int, MeshData> getMeshData
Vector2 strideX
Vector2 strideY
Vector2 aabbBottomLeft
Vector2 aabbSize
bool translateMeshData
MeshGridOptions meshGridOptions
SquareBound bound
IEnumerable<ICellType> cellTypes
ICachePolicy cachePolicy

TryMove(Cell, CellDir, out Cell, out CellDir, out Connection)

Attempts to move from a cell in a given direction, and returns information about the move if successful.

Declaration
public override bool TryMove(Cell cell, CellDir dir, out Cell dest, out CellDir inverseDir, out Connection connection)
Parameters
Type Name Description
Cell cell

The cell to move from

CellDir dir

The direction to move in

Cell dest

The cell moved to

CellDir inverseDir

The direction leading back from dest to cell.

Connection connection

A descriptor of how cell-local space relates between cell and dest.

Returns
Type Description
bool
Overrides
NestedModifier.TryMove(Cell, CellDir, out Cell, out CellDir, out Connection)

Implements

IGrid

Extension Methods

GridExtensions.FindCell(IGrid, Vector3)
GridExtensions.GetCellsIntersectsApprox(IGrid, Aabb)
GridExtensions.GetMeshData(IGrid, Cell)
GridExtensions.GetNeighbours(IGrid, Cell)
GridExtensions.GetPolygon(IGrid, Cell)
GridExtensions.Masked(IGrid, ISet<Cell>)
GridExtensions.Masked(IGrid, Func<Cell, bool>, IEnumerable<Cell>)
GridExtensions.Move(IGrid, Cell, CellDir)
GridExtensions.ToMeshData(IGrid)
GridExtensions.ToMeshData(IGrid, IEnumerable<Cell>)
GridExtensions.Transformed(IGrid, Matrix4x4)
In this article
Back to top Generated by DocFX