CullingPortal
A class in Root.Township, the global namespace.
A portal between two chunks (mostly cave layers) that can hide or show the static renderers in a box on either side. Registers itself with both chunks' connections.
- Listed in Global namespace: C to D
- Inherits or implements
MonoBehaviour - Nested types
CullingSide
Constructors
| Member | What it is |
|---|---|
CullingPortal() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
11 private and internal fields
| Member | What it is |
|---|---|
private Bounds backBounds | Local-space box; static renderers of the back streamer inside it are culled with the back side. |
private LocationChunk backChunk | The location chunk behind the portal. Backing field for BackChunk. |
private CullingPortal.CullingSide backCulling | Handles enabling and disabling the back side's renderers. |
private CaveLayerStreamer backStreamer | Cave layer streamer of the back chunk, the source of its static renderers. |
private Transform cachedTransform | The portal's transform, cached. |
private Vector3? center | Cached world position; refreshed when the transform changes. |
private Vector3? direction | Cached world up vector of the portal (the facing direction); refreshed when the transform changes. |
private Bounds frontBounds | Local-space box; static renderers of the front streamer inside it are culled with the front side. |
private LocationChunk frontChunk | The location chunk in front of the portal. Backing field for FrontChunk. |
private CullingPortal.CullingSide frontCulling | Handles enabling and disabling the front side's renderers. |
private CaveLayerStreamer frontStreamer | Cave layer streamer of the front chunk, the source of its static renderers. |
Properties
| Member | What it is |
|---|---|
LocationChunk BackChunk { get; set; } | Chunk on the back side, or null if it's missing or disabled (not checked on Android). |
Vector3 Center { get; } | World position of the portal. |
Vector3 Direction { get; } | World direction the portal faces (its local up). |
LocationChunk FrontChunk { get; set; } | Chunk on the front side, or null if it's missing or disabled (not checked on Android). |
Methods
6 private and internal methods
| Member | What it is |
|---|---|
private void OnDisable() | Removes the portal from both chunks' portal lists. |
private void OnDrawGizmos() | Draws the front and back bounds as wire cubes in the portal's space. |
private void OnEnable() | Adds the portal to both chunks' portal lists and creates the front and back culling sides. |
private void RemoveChunkReference(LocationChunk chunk) | Removes this portal from a chunk's portal list. |
private void SetChunk(LocationChunk newChunk, ref LocationChunk chunk, ref CaveLayerStreamer streamer) | Swaps the front or back chunk, moving the portal registration and picking up the new chunk's cave streamer. |
private void SetupChunkReference(LocationChunk chunk, out CaveLayerStreamer streamer) | Adds this portal to a chunk's portal list and gets its CaveLayerStreamer. |
Used in
Members of other types that take, return or hold a CullingPortal: