SplatData constructor

SplatData({
  1. required int count,
  2. required Float32List positions,
  3. required Float32List scales,
  4. required Float32List rotations,
  5. required Float32List colors,
  6. required Float32List opacities,
  7. Float32List? sh,
  8. int shDegree = 0,
})

Wraps existing arrays without copying. Every array's length must match count times its per-splat stride.

Implementation

SplatData({
  required this.count,
  required this.positions,
  required this.scales,
  required this.rotations,
  required this.colors,
  required this.opacities,
  this.sh,
  this.shDegree = 0,
}) : assert(positions.length == count * 3),
     assert(scales.length == count * 3),
     assert(rotations.length == count * 4),
     assert(colors.length == count * 3),
     assert(opacities.length == count),
     assert(shDegree >= 0 && shDegree <= 2),
     assert(
       (shDegree == 0) == (sh == null),
       'sh must be provided exactly when shDegree > 0',
     ),
     assert(
       sh == null || sh.length == count * shRestCoeffCount(shDegree) * 3,
     );