filter method

  1. @override
MeshGeometry filter (MeshGeometry mesh)
override

Returns a copy of the mesh with any filter transforms applied.

Implementation

@override
MeshGeometry filter(MeshGeometry mesh) {
  MeshGeometry output;
  if (mesh.getAttrib('COLOR') == null) {
    final List<VertexAttrib> attributes = <VertexAttrib>[]
      ..addAll(mesh.attribs)
      ..add(new VertexAttrib('COLOR', 4, 'float'));
    output = new MeshGeometry.resetAttribs(mesh, attributes);
  } else {
    output = new MeshGeometry.copy(mesh);
  }

  final VectorList<Vector> colors = output.getViewForAttrib('COLOR');
  if (colors is Vector4List) {
    for (int i = 0; i < colors.length; ++i) {
      colors[i] = color;
    }
    return output;
  } else {
    return null;
  }
}