shader-data-layout

Shader Data Layout

Central tracking document for all data stored in GPU shader passes and bit allocation for each field.

Purpose

This document tracks all fields that need to be stored in GPU textures for physics, reactions, and rendering systems. Once all requirements are gathered, bit allocations will be determined to optimize texture memory usage.

Object Data Fields

Position

  • Hex cell coordinates (q, r)
  • Sub-grid offset (x, y) - fixed-point

Velocity

  • Velocity vector (x, y) - fixed-point

Type and Properties

  • Object type ID
  • Mass (may be computed from type instead of stored)
  • Layer (Ground/Object/Air)

Timer System

  • Timer type (number of bits TBD - depends on number of timer types)
  • Timer value (number of bits TBD - count-up timer, max duration TBD)

Flags

  • Object exists flag
  • (Additional flags TBD)

Bit Allocation

⚠️ TODO: Determine bit counts for each field once all requirements are gathered.

Total Storage Requirements

⚠️ TODO: Calculate total bits per object and optimize packing strategy.

  • Physics: Position, velocity, mass - see cross-referenceMovement System
  • Reactions: Timer type, timer value, type transformations - see cross-referenceReaction System
  • Rendering: All data for visual representation - see cross-referenceRendering