attribsAreCompatible method Null safety

bool attribsAreCompatible(
  1. MeshGeometry mesh
)

Implementation

bool attribsAreCompatible(MeshGeometry mesh) {
  if (mesh.attribs.length != attribs.length) {
    return false;
  }

  for (var attrib in attribs) {
    final otherAttrib = mesh.getAttrib(attrib.name);
    if (otherAttrib == null) {
      return false;
    }
    if (attrib.type != otherAttrib.type ||
        attrib.size != otherAttrib.size ||
        attrib.stride != otherAttrib.stride ||
        attrib.offset != otherAttrib.offset) {
      return false;
    }
  }

  if ((indices == null && mesh.indices != null) ||
      (indices != null && mesh.indices == null)) {
    return false;
  }

  return true;
}