Skip to main content

MarchingCubesTest

A class in Root.Township, the global namespace.

Test component that builds a marching cubes mesh from random spheres when enabled.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private float isoLevelDensity level the surface is built at.
private float maximumRadiusLargest sphere radius.
private Mesh meshThe generated mesh.
private float minimumRadiusSmallest sphere radius.
private int sizeGrid size on each axis.
private int spheresNumber of random spheres.

Methods​

2 private and internal methods
MemberWhat it is
private void OnDisable()Cleans up the generated mesh.
private void OnEnable()Fills a density grid with random spheres, meshes it with MarchingCubes and puts the result on the MeshFilter.