MarchingCubesPlugin
A class in Root.Township, Alta.Caves.
Cave generator plugin that turns a density layer into a mesh with marching cubes, one mesh per map chunk. Uses a pregenerated mesh instead when one exists for the same seed.
- Listed in World generation
- Inherits or implements
Plugin - Derived types
MarchingCubesPlugin.Create - Nested types
Create,GeneratedMesh
Constructors
| Member | What it is |
|---|---|
MarchingCubesPlugin() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private Plugin generatorLayer | The plugin layer whose values are meshed. |
private static Logger logger | NLog logger for this class. |
private Dictionary<MapChunk, MarchingCubesPlugin.GeneratedMesh> meshes | Meshes built for each chunk, waiting to be collected with GetMesh. |
private float threshold | Density value where the surface is placed (default 0.5). |
Methods
| Member | What it is |
|---|---|
MarchingCubesPlugin.GeneratedMesh GetMesh(MapChunk chunk) | Returns and removes the mesh built for the chunk. Throws if none was built. |
override void Modify(MapChunk chunk, IPartInstance[] parts) | Builds the chunk's mesh from generatorLayer at threshold (or takes the pregenerated one) and stores it for GetMesh. |
1 private and internal method
Used in
Members of other types that take, return or hold a MarchingCubesPlugin: