Skip to content

Game.Rendering.BatchRenderFlags

Assembly: Assembly-CSharp (typical for Cities: Skylines 2 modding)
Namespace: Game.Rendering

Type: public enum

Base: System.Enum (underlying type: byte)

Summary:
BatchRenderFlags is a byte-backed flags enum used to describe rendering-related options for a render batch. Each named value represents a single bit (or combination) that can be combined using bitwise operations to enable/disable behaviors such as motion vector generation, shadow casting/receiving, and whether the batch is enabled. The All member is defined as byte.MaxValue and effectively sets all bits in the underlying byte.


Fields

  • MotionVectors = 1
    Enables generation of motion vectors for the batch (bit 0).

  • ReceiveShadows = 2
    Marks the batch as able to receive shadows (bit 1).

  • CastShadows = 4
    Marks the batch as able to cast shadows (bit 2).

  • IsEnabled = 8
    Indicates the batch is enabled (bit 3). This can be used as a quick on/off flag for the batch.

  • All = byte.MaxValue
    All bits set (0xFF). Useful for rapid testing or clearing/setting all possible flag bits, but may include bits not explicitly defined by the enum.

Properties

  • This enum defines no properties. It is a value type used for bitwise flag operations.

Constructors

  • Enums do not expose user-callable constructors. Values are assigned implicitly by the compiler from the defined named constants.

Methods

  • The enum declares no methods. Standard System.Enum methods are available (e.g., ToString(), HasFlag(Enum), GetValues(typeof(BatchRenderFlags)), etc.). For performance-critical code, prefer bitwise operations over Enum.HasFlag.

Usage Example

// Combine flags
BatchRenderFlags flags = BatchRenderFlags.MotionVectors | BatchRenderFlags.CastShadows;

// Test a flag (recommended: bitwise check for performance)
bool casts = (flags & BatchRenderFlags.CastShadows) != 0;

// Enable a flag
flags |= BatchRenderFlags.IsEnabled;

// Disable a flag
flags &= ~BatchRenderFlags.MotionVectors;

// Toggle a flag
flags ^= BatchRenderFlags.ReceiveShadows;

// Store or transmit as a byte
byte packed = (byte)flags;
flags = (BatchRenderFlags)packed;

{{ Additional notes: - Because the underlying type is byte, the enum occupies 1 byte when stored (useful for compact serialization). - Be careful when using All (byte.MaxValue): if future flags are added, All will include them; conversely, All may also include bits not explicitly defined—treat it as "all bits set" rather than "all defined flags". - For readability and maintainability prefer named combinations or helper methods when the same flag combinations are used frequently. }}