Namespace CarbideFunction.Wildtile
Classes
ArrayLookup
Extension methods for looking up elements in 3D C# arrays using Unity int-vectors.
DetailedVectorString
This class contains extension methods to print full precision vectors.
Unity's ToString()
will format vector components to 2 decimal places.
These methods format the vector components to their maximum available precision, which is useful when debugging.
DualGridVoxelMeshBackupTiles
Holds a single tile module mesh for each marching cube configuration
This is used by the GridPlacer when the tile has not been collapsed or if the slot is wild.
DualGridVoxelMeshPlaceholderTiles
Holds a single tile game object for each marching cube configuration.
This is intended to be used by user-code when creating level editors.
FaceDataSerialization
This class contains information for iterating through the faces of a cube.
FlatArrayIndex
This extension class contains methods for interacting with a flat array as though it were a three dimensional array.
Unity-serializable arrays can only be 1 dimensional - this class allows the user to interact with them in a 3D context.
GridBuilderVisitor
This class can build SlotGrids from any IVoxelGrid.
This follows the double-dispatch pattern and decouples SlotGrid construction from the classes implementing IVoxelGrid. The IVoxelGrid implementors can focus on implementing IVoxelGrid.
GridPlacer
This Unity component manages the grid placing during edit time and runtime.
It will automatically generate a mesh when the world starts, both in editor and in the game. It can also generate the mesh later by calling GenerateNow(Boolean).
Hash
This static class contains functions for calculating hashes from different Unity types.
All functions are deterministic and are well spread across the output range. This is not secure for cryptography.
Vectors are quantized before hashing - for each component of the vector, work out the closest fraction the number is and use that to seed the hashing algorithm. The size of the fraction is controlled by the quantizationResolution
parameter.
IrregularVoxelGrid
A 3D grid of voxels that can be either "filled" or "empty".
Not necessarily square, this can take any form.
IVoxelGrid.Voxel
IVoxelGridExtensions
LayerAttribute
Attribute to select a single layer in the Unity inspector.
MenuConstants
Contains constants for adding Wildtile specific options to Unity's different menus.
Designed for use with CreateAssetMenuAttribute, AddComponentMenu, and MenuItem.
Module
A module is a tile and meta-data associated with the tile, such as how it connects to other tiles and its selection weight. The tile itself is stored as a prefab, and can be accessed through the prefab field.
ModuleMesh
Contains CPU-side information that describes a mesh. This isn't as comprehensive as a Unity Mesh, e.g. this only supports triangle topology.
All vertex info is stored in struct-of-array form to make it easier to upload to the GPU through Unity.
ModuleMesh.SubMesh
Information about which triangles from triangles map to which material.
ModuleMesh.UvChannel
Contains data and meta-data for uploading a UV channel to a Unity Mesh.
ModuleMeshInstantiator
Contains methods for creating Unity Meshes from ModuleMeshes.
NormalWarperExtensions
PositiveModuloLibrary
This extension class contains a function that returns the positive only modulo of a value.
PropagationReporting
Delegates for reporting information from the propagation part of the wave function collapse algorithm.
QuantizedVector
Contains methods for converting a Unity float vector (e.g. Vector3) into an in vector (e.g. Vector3Int).
Slot
A slot is a cube that should be filled by a TransformedModule.
At the start of a collapse, a Slot might have the choice of many TransformedModules. Collapsing the map will attempt to remove modules from slots until one is left in every slot.
If the collapse is successful, each Slot will have one TransformedModule in CarbideFunction.Wildtile.Slot.availableModules.
If the collapse is unsuccessful then some Slots will become wildcards. Wildcards can connect to any TransformedModule in neighbouring slots.
You can also set a slot to be a wildcard before starting a collapse.
SlotGrid
Contains a map that is processable by the Wildtile wave function collapse algorithm.
Before collapse, the slots in the map may contain multiple TransformedModules. After collapse, all slots will either contain exactly one TransformedModule or be marked as a wildcard.
Tileset
A processed tileset stored in a Unity asset, ready for use in the Wildtile implementation of the wave function collapse algorithm.
Warning
This asset is not designed to be directly modified by users of Wildtile. Instead, use a TilesetImporterAsset and TilesetImporter to populate the Tileset asset. Take special care if editing it directly.
TilesetImporterAsset
This asset stores the import settings for a model so that the model can be reliably reimported to as a Tileset asset.
TilesetToWaveFunctionCollapser
Tileset extension methods to create a WaveFunctionCollapser.
TransformedModule
This class is the actual module in terms of WFC. It reads from Wildtile aaaaaaa Modules and transforms the referenced module's faces for easy access, while maintaining a single source of data.
VoxelGrid
A 3D grid of voxels that can be either "filled" or "empty".
VoxelGridAsset
VoxelGridInstantiatorVisitor
VoxelMesher
This class manages a naive mesh for a voxel grid.
It can generate the naive mesh and can map any face index on the generated mesh to a voxel face. This is used by the tile map editor to select which voxel to fill/clear when clicking on the voxel grid. It can also be used at runtime to test for mouse clicks in a live level editor.
The generated meshes contain faces for each of the filled-to-unfilled surfaces in the grid, as well as walls surrounding the whole grid.
WaveFunctionCollapser
This object manages a run of the wave function collapse algorithm applied to 3D autotiling.
WildtileMesh
Tag component that signifies that this object contains a mesh that should be extracted to CPU memory and warped and welded by Wildtile.
On import, the Wildtile tileset importer will destroy this component and sibling mesh renderers and mesh filters.
Structs
FaceData<ContainedData>
A generic struct that contains an instance of the specified type for each of the 6 faces on a cube.
FaceDataSerialization.SerializationFace
A detailed description for a single face of a cube, indicated by the Face enum.
FaceLayoutIndex
Contains an index into the tileset's list of faces, uniquely referencing a face layout (the positions, normals, edges, and materials for all vertices touching the face of the tile cube).
Because this is an index, you can use it to access face data by array offset, an O(1) operation.
This array index works for all arrays of face data, both tileset (e.g. finding the matching face) and slot data (e.g. reading and updating the number of faces left for a face)
IVoxelGrid.VoxelFace
This struct contains information about the quads that compose this voxel.
Module.FaceIndices
The face indices uniquely identify the tile's face layouts when the tile is not rotated. TransformedModule will map the layouts and select the correct default or flipped indices, so you should access the Module's
NormalWarper
Warps the normals from within a (-0.5 - 0.5) cube.
Intended to be constructed by Wildtile and then used by Postprocessors (including user-built ones) by accessing it through
NormalWarper.WarpPoint
Captured warp at a point within the cube. This can be used to calculate the actual warped normal.
Slot.SourceVoxels
Stores the voxel indices that define this slot's corner contents.
VertexWarper
Warps positional points from the (-.5, -.5, -.5) to (.5, .5, .5) cube to the cube defined in the constructor.
VoxelMesher.FaceData
This struct describes the voxel coordinates for a voxel face.
VoxelMesher.GeneratedMesh
Contains the output of a call to CreateAndGenerateMesh(IVoxelGrid, Vector3).
VoxelMesher.Vertex
Interfaces
IVoxelGrid
Access to a voxel grid. Intended to be implemented by VoxelGrid and IrregularVoxelGrid only.
IVoxelGridVisitor
Enums
CoroutineStatus
The process for building the map runs through distinct stages. This enum is used to indicate which stage the coroutine is in this process.
Face
Each value of this enum represents a face of a cube, named by the direction from the center of the cube to that face.
GridPlacer.GenerateOnStartUp
Setting for whether a GridPlacer component should place modules when the component starts up (e.g. when Unity opens a scene containing a GridPlacer)
PropagationResult
State of whether the propagation succeeded.
WaveFunctionCollapser.CollapseResult
If the algorithm successfully collapses it will report a Success value. If it exhausts all options over the SlotGrid and Tileset, the algorithm will report a UnrecoverableContradiction value.
Delegates
GridPlacer.OnCollapseEvent
Called during collapse to report information to the calling code at different points in the collapse, for example onPerfectCollapseSucceeded or onPerfectCollapseFailed.
GridPlacer.OnGenerationComplete
This delegate is called when GenerateOverTime(GridPlacer.OnGenerationComplete) completes generation.
PropagationReporting.ReportContradictionSlot
Whenever propagation removes the final available module from a slot, this delegate will be called with that slot.
PropagationReporting.ReportPropagationResult
Reports whether the propagation was successful or ran into a contradiction.
TilesetImporterAsset.OnTilesetChanged
The receiver signature for when a tileset importer asset is reimported.
WaveFunctionCollapser.ReportCollapseResult
This delegate is used to report the final state of a collapse request.
The collapse request cannot directly return the value because coroutines yield-return many values and it is impossible to know if any given yield-return is the last one until after the coroutine completes. The collapser uses a delegate to make handling the result clear and readable.