SaturnRingLibrary 0.9.1
SGL wrapper
 
Loading...
Searching...
No Matches

◆ MAX_DEPTH

size_t SRL::Math::Types::MatrixStack::MAX_DEPTH = 16
staticconstexpr

Maximum depth of the matrix stack.

Defines the maximum number of matrices that can be pushed onto the stack. This value is chosen to be sufficient for typical game scene hierarchies while avoiding excessive memory usage.

The value of 16 is selected based on the following considerations:

  • Most game scene hierarchies rarely exceed 10-12 levels of nesting
  • Each matrix consumes memory (typically 48-64 bytes for a 4x3 or 4x4 matrix)
  • Embedded systems and performance-critical applications benefit from predictable, fixed memory usage

If a push operation would exceed this depth, it is silently ignored to prevent stack overflow, which is preferable to undefined behavior in a real-time system.

Note
If your application requires deeper hierarchies, this constant can be adjusted, but be aware of the increased memory footprint.