Game.Rendering.ZoneProperty
Assembly: Assembly-CSharp
Namespace: Game.Rendering
Type: enum
Base: System.Enum (underlying type: int)
Summary:
ZoneProperty is an enumeration used by the rendering subsystem to identify per-zone (cell) instance properties that are uploaded to the GPU. Each enum value is annotated with an InstanceProperty attribute that maps the enum entry to a shader instance property name (for example "colossal_CellType0") and specifies the property type (float4x4), the BatchFlags slot used to store the instance data, and additional metadata. The enum provides indexed access to up to four different cell-type transform matrices used by zone rendering. The final member Count
represents the number of defined zone property entries.
Fields
-
CellType0
InstanceProperty: ("colossal_CellType0", typeof(float4x4), (BatchFlags)0, 0, false)
Maps to shader instance property "colossal_CellType0". Uses type float4x4 (Unity.Mathematics.float4x4). Stored in the default batch slot (BatchFlags = 0). Underlying int value: 0. -
CellType1
InstanceProperty: ("colossal_CellType1", typeof(float4x4), BatchFlags.Extended1, 0, false)
Maps to shader instance property "colossal_CellType1". Uses type float4x4. Stored in the Extended1 batch slot (BatchFlags.Extended1). Underlying int value: 1. -
CellType2
InstanceProperty: ("colossal_CellType2", typeof(float4x4), BatchFlags.Extended2, 0, false)
Maps to shader instance property "colossal_CellType2". Uses type float4x4. Stored in the Extended2 batch slot. Underlying int value: 2. -
CellType3
InstanceProperty: ("colossal_CellType3", typeof(float4x4), BatchFlags.Extended3, 0, false)
Maps to shader instance property "colossal_CellType3". Uses type float4x4. Stored in the Extended3 batch slot. Underlying int value: 3. -
Count
Represents the number of entries in the enum (typically 4 in this definition). Underlying int value: 4.
Properties
- This enum does not define any properties.
Constructors
- Enums do not define constructors in this type. Values are the standard enum integer values.
Methods
- This enum does not define any methods.
Usage Example
// Example: retrieve the InstanceProperty attribute for a ZoneProperty enum value
using System.Reflection;
using Unity.Mathematics;
public void SetZoneMatrices(MaterialPropertyBlock mpb, ZoneProperty prop, float4x4[] matrices)
{
// Get MemberInfo for the enum value
var member = typeof(ZoneProperty).GetMember(prop.ToString());
if (member.Length == 0) return;
// Try to get the custom InstanceProperty attribute (game-specific attribute)
var attr = member[0].GetCustomAttribute<InstancePropertyAttribute>();
if (attr == null) return;
// attr is expected to expose the shader property name and type; use the name to set matrices
string shaderPropertyName = attr.PropertyName; // e.g. "colossal_CellType0"
// Example: push matrix array into a material property block or other renderer API
// Note: actual API to set float4x4 arrays depends on the rendering wrapper used by the game.
mpb.SetMatrixArray(shaderPropertyName, matrices);
}
// Using Count to allocate arrays sized to the number of zone properties:
var count = (int)ZoneProperty.Count;
var allMatrices = new float4x4[count][];