Skip to main content

MarchingCubesChunkDisplay

A class in Root.Township, Alta.Caves.

Cave chunk display that shows the marching cubes mesh for its chunk and sets it as the collider. Both sides; only clients assign the visible mesh.

Constructors​

MemberWhat it is
MarchingCubesChunkDisplay()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private float chunkHeightHeight of a chunk, used to find edge vertices when smoothing normals.
private MeshCollider colliderThe MeshCollider that gets the mesh.
private MeshFilter filterThe MeshFilter that shows the mesh on clients.
private bool isSmoothedDownWhether the bottom edge normals have been smoothed.
private bool isSmoothedUpWhether the top edge normals have been smoothed.
private static Logger loggerNLog logger for this class.
private Mesh meshThe chunk's mesh.
private MeshRenderer rendererThe renderer registered as a terrain renderer with the layer streamer.

Methods​

MemberWhat it is
override void Initialize()Cleans up a previous runtime-only mesh.
override IEnumerator Render() (iterator)Gets the mesh, recalculates bounds and normals if new, shows it on clients, sets the collider and updates the streamer bounds.
3 private and internal methods
MemberWhat it is
private void GetMesh(MarchingCubesPlugin plugin, MapChunk chunk, out bool wasGenerated)Gets or builds this chunk's mesh from the marching cubes plugin.
private void OnDestroy()Cleans up the mesh if it was created at runtime.
private IEnumerator SmoothNormals(MarchingCubesChunkDisplay below, MarchingCubesChunkDisplay above) (iterator)Blends normals where this chunk's mesh meets the layer above; not called in the decompiled code.