A* Pathfinding Project  3.8.5
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
RecastMeshGatherer Class Reference

Classes

class  CapsuleCache
 

Public Member Functions

 RecastMeshGatherer (Bounds bounds, int terrainSampleSize, LayerMask mask, List< string > tagMask, float colliderRasterizeDetail)
 
void CollectColliderMeshes (List< RasterizationMesh > result)
 
void CollectRecastMeshObjs (List< RasterizationMesh > buffer)
 Find all relevant RecastMeshObj components and create ExtraMeshes for them.
 
void CollectSceneMeshes (List< RasterizationMesh > meshes)
 
void CollectTerrainMeshes (bool rasterizeTrees, float desiredChunkSize, List< RasterizationMesh > result)
 

Private Member Functions

void CollectTreeMeshes (Terrain terrain, List< RasterizationMesh > result)
 
RasterizationMesh GenerateHeightmapChunk (float[,] heights, Vector3 sampleSize, Vector3 offset, int x0, int z0, int width, int depth, int stride)
 Generates a terrain chunk mesh.
 
void GenerateTerrainChunks (Terrain terrain, Bounds bounds, float desiredChunkSize, List< RasterizationMesh > result)
 
RasterizationMesh RasterizeBoxCollider (BoxCollider collider, Matrix4x4 localToWorldMatrix)
 
RasterizationMesh RasterizeCapsuleCollider (float radius, float height, Bounds bounds, Matrix4x4 localToWorldMatrix)
 
RasterizationMesh RasterizeCollider (Collider col)
 Rasterizes a collider to a mesh.
 
RasterizationMesh RasterizeCollider (Collider col, Matrix4x4 localToWorldMatrix)
 Rasterizes a collider to a mesh assuming it's vertices should be multiplied with the matrix.
 

Static Private Member Functions

static int CeilDivision (int lhs, int rhs)
 Returns ceil(lhs/rhs), i.e lhs/rhs rounded up.
 
static List< MeshFilter > FilterMeshes (MeshFilter[] meshFilters, List< string > tagMask, LayerMask layerMask)
 

Private Attributes

readonly Bounds bounds
 
List< CapsuleCachecapsuleCache = new List<CapsuleCache>()
 Holds meshes for capsules to avoid generating duplicate capsule meshes for identical capsules.
 
readonly float colliderRasterizeDetail
 
readonly LayerMask mask
 
readonly List< string > tagMask
 
readonly int terrainSampleSize
 

Static Private Attributes

static readonly int[] BoxColliderTris
 Box Collider triangle indices can be reused for multiple instances.
 
static readonly Vector3[] BoxColliderVerts
 Box Collider vertices can be reused for multiple instances.
 

Constructor & Destructor Documentation

RecastMeshGatherer ( Bounds  bounds,
int  terrainSampleSize,
LayerMask  mask,
List< string >  tagMask,
float  colliderRasterizeDetail 
)

Member Function Documentation

static int CeilDivision ( int  lhs,
int  rhs 
)
staticprivate

Returns ceil(lhs/rhs), i.e lhs/rhs rounded up.

void CollectColliderMeshes ( List< RasterizationMesh result)
void CollectRecastMeshObjs ( List< RasterizationMesh buffer)

Find all relevant RecastMeshObj components and create ExtraMeshes for them.

void CollectSceneMeshes ( List< RasterizationMesh meshes)
void CollectTerrainMeshes ( bool  rasterizeTrees,
float  desiredChunkSize,
List< RasterizationMesh result 
)
void CollectTreeMeshes ( Terrain  terrain,
List< RasterizationMesh result 
)
private
static List<MeshFilter> FilterMeshes ( MeshFilter[]  meshFilters,
List< string >  tagMask,
LayerMask  layerMask 
)
staticprivate
RasterizationMesh GenerateHeightmapChunk ( float  heights[,],
Vector3  sampleSize,
Vector3  offset,
int  x0,
int  z0,
int  width,
int  depth,
int  stride 
)
private

Generates a terrain chunk mesh.

void GenerateTerrainChunks ( Terrain  terrain,
Bounds  bounds,
float  desiredChunkSize,
List< RasterizationMesh result 
)
private
RasterizationMesh RasterizeBoxCollider ( BoxCollider  collider,
Matrix4x4  localToWorldMatrix 
)
private
RasterizationMesh RasterizeCapsuleCollider ( float  radius,
float  height,
Bounds  bounds,
Matrix4x4  localToWorldMatrix 
)
private
RasterizationMesh RasterizeCollider ( Collider  col)
private

Rasterizes a collider to a mesh.

This will pass the col.transform.localToWorldMatrix to the other overload of this function.

RasterizationMesh RasterizeCollider ( Collider  col,
Matrix4x4  localToWorldMatrix 
)
private

Rasterizes a collider to a mesh assuming it's vertices should be multiplied with the matrix.

Note that the bounds of the returned ExtraMesh is based on collider.bounds. So you might want to call myExtraMesh.RecalculateBounds on the returned mesh to recalculate it if the collider.bounds would not give the correct value.

Member Data Documentation

readonly Bounds bounds
private
readonly int [] BoxColliderTris
staticprivate
Initial value:
= {
0, 1, 2,
0, 2, 3,
6, 5, 4,
7, 6, 4,
0, 5, 1,
0, 4, 5,
1, 6, 2,
1, 5, 6,
2, 7, 3,
2, 6, 7,
3, 4, 0,
3, 7, 4
}

Box Collider triangle indices can be reused for multiple instances.

Warning
This array should never be changed
readonly Vector3 [] BoxColliderVerts
staticprivate
Initial value:
= {
new Vector3(-1, -1, -1),
new Vector3(1, -1, -1),
new Vector3(1, -1, 1),
new Vector3(-1, -1, 1),
new Vector3(-1, 1, -1),
new Vector3(1, 1, -1),
new Vector3(1, 1, 1),
new Vector3(-1, 1, 1),
}

Box Collider vertices can be reused for multiple instances.

Warning
This array should never be changed
List<CapsuleCache> capsuleCache = new List<CapsuleCache>()
private

Holds meshes for capsules to avoid generating duplicate capsule meshes for identical capsules.

readonly float colliderRasterizeDetail
private
readonly LayerMask mask
private
readonly List<string> tagMask
private
readonly int terrainSampleSize
private

The documentation for this class was generated from the following file: