Skip to main content

class MeshBuilderAsync

(Niantic.Lightship.Maps.Builders.Performance.MeshBuilderAsync)

Overview

class MeshBuilderAsync:
Niantic.Lightship.Maps.Builders.MeshBuilderBase,
Niantic.Lightship.Maps.Builders.Performance.IMeshBuilderAsync {
public:
// methods

virtual bool PreBuild(
IReadOnlyList<MeshTile> tiles,
out IReadOnlyList<MeshTile> tilesToBuild
);

virtual abstract void Build(IReadOnlyList<MeshTile> tiles) = 0;

protected:
// methods

IReadOnlyList<MeshTile> GetValidTilesAndClearInvalidTiles(
IReadOnlyList<MeshTile> tiles,
int minLOD,
int maxLOD
);

IReadOnlyList<IReadOnlyList<T>> GetFeaturesByTile< T >(IReadOnlyList<MeshTile> mapTiles);
IReadOnlyList<T> GetFeaturesForTile< T >(MeshTile tile);

bool ApplyMeshInternal(
Mesh.MeshDataArray meshDataToApply,
CancellationToken token,
out Mesh outputMesh
);
};

// direct descendants

class AreaFeatureBuilderAsync;
class GroundBuilderAsync;
class LinearFeatureBuilderAsync;
class StructureFeatureBuilderAsync;

Inherited Members

public:
// fields

int MinLOD => _minLOD;
int MaxLOD => _maxLOD;

// properties

Guid Id;
int MinLOD;
int MaxLOD;
Guid Id;

// methods

virtual void Initialize(ILightshipMapView lightshipMapView);
MeshFilter CreateMeshComponents(IMapTileObject mapTileObject);
void Release(MeshFilter meshFilter);
MeshFilter CreateMeshComponents(IMapTileObject mapTileObject);
virtual void Release(MeshFilter meshFilter);

bool PreBuild(
IReadOnlyList<MeshTile> tiles,
out IReadOnlyList<MeshTile> tilesToBuild
);

void Build(IReadOnlyList<MeshTile> tiles);

```cs
protected:
// fields

string BuilderName => _builderName.NullIfEmptyOrWhitespace() ?? name;
LayerKind Layer => _mapLayer;
List<FeatureKind> Features => _features;
Material[] _materials;

// properties

Vector3 ZOffset;

// methods

static void SetMeshForFilter(Mesh mesh, MeshFilter meshFilter);

Detailed Documentation

Methods

PreBuild

virtual bool PreBuild(
IReadOnlyList<MeshTile> tiles,
out IReadOnlyList<MeshTile> tilesToBuild
)

Processes tiles before building

Build

virtual abstract void Build(IReadOnlyList<MeshTile> tiles) = 0

Called when one or more maptiles are added to the scene. This method generates meshes for a specific set of maptile features.

GetValidTilesAndClearInvalidTiles

IReadOnlyList<MeshTile> GetValidTilesAndClearInvalidTiles(
IReadOnlyList<MeshTile> tiles,
int minLOD,
int maxLOD
)

Filters out and clears MeshTiles that are not currently valid for a given IFeatureBuilder.

    Parameters:

    tiles - A IReadOnlyList<T> of MeshTiles

    minLOD - The minimum LOD for which the IMapTiles must be valid

    maxLOD - The maximum LOD for which the IMapTiles must be valid

    Returns:

    A Task<T> of IReadOnlyList<T> of the MeshTiles that are currently valid for the given IFeatureBuilder

GetFeaturesByTile< T >

IReadOnlyList<IReadOnlyList<T>> GetFeaturesByTile< T >(IReadOnlyList<MeshTile> mapTiles)

Gets a list of IMapTileFeatures per MeshTile.

    Parameters:

    mapTiles - A IReadOnlyList<T> of all MeshTiles queued to be built by this MeshBuilderAsync

    T - A feature type derived from IMapTileFeature that specifies which features to return.

    Returns:

    A list of lists of features per maptile.

GetFeaturesForTile< T >

IReadOnlyList<T> GetFeaturesForTile< T >(MeshTile tile)

Gets a list of IMapTileFeatures for a specific MeshTile.

.

    Parameters:

    tile - The MeshTile whose features of type T to retrieve

    T - A feature type derived from IMapTileFeature that specifies which features to return.

    Returns:

    A list of features of the MeshTile at the specified index of the input IReadOnlyList<T>

ApplyMeshInternal

bool ApplyMeshInternal(
Mesh.MeshDataArray meshDataToApply,
CancellationToken token,
out Mesh outputMesh
)

Outputs the Mesh populated from meshDataToApply

    Parameters:

    meshDataToApply - The Mesh.MeshDataArray whose first element contains the data needed to populate the outputMesh

    token - Used to cancel the mesh assignment

    outputMesh - The Mesh which will be populated with the data from meshDataToApply

    Returns:

    Whether or not the Mesh was successfully applied