isKtx2File function

bool isKtx2File(
  1. Uint8List bytes
)

True when bytes begins with the KTX2 identifier.

Cheap enough to call before committing to a decoder — the same role isF3dFile plays for .f3d.

Implementation

bool isKtx2File(Uint8List bytes) {
  if (bytes.lengthInBytes < kKtx2Identifier.length) return false;
  for (var i = 0; i < kKtx2Identifier.length; i++) {
    if (bytes[i] != kKtx2Identifier[i]) return false;
  }
  return true;
}