A class in Root.Township, Alta.Caves.Displays.
Debug cave chunk display that draws one Y slice of its layer as a greyscale texture on a flat quad.
Constructors
| Member | What it is |
|---|
PixelMapChunkDisplay() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|
private MeshFilter filter | The MeshFilter showing the quad. |
private static Queue<Texture2D> pool | Shared pool of reusable textures. |
private static Mesh quad | Shared quad mesh used by every instance. |
private MeshRenderer quadRenderer | The renderer whose material shows the texture. |
private Texture2D texture | This chunk's texture. |
private int yIndex | Which Y slice of the layer to draw. |
Methods
| Member | What it is |
|---|
override void Initialize() | Builds the shared quad mesh if needed, assigns a pooled texture and scales the quad to the chunk size. |
override IEnumerator Render() (iterator) | Writes the layer values at yIndex into the texture as black to white pixels. |
2 private and internal methods
| Member | What it is |
|---|
private Texture2D GetTexture() | Takes a texture from the shared pool, filling the pool with 100 new chunk-sized textures when empty. |
private void OnDestroy() | Returns the texture to the pool. |