attribsAreCompatible method

bool attribsAreCompatible (MeshGeometry mesh)

Implementation

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

  for (VertexAttrib attrib in attribs) {
    final VertexAttrib 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;
}