diff --git a/packages/vector_math/CHANGELOG.md b/packages/vector_math/CHANGELOG.md index eda3e703..a232ed01 100644 --- a/packages/vector_math/CHANGELOG.md +++ b/packages/vector_math/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.4.2 + +* Documents the public geometry filter APIs. + ## 2.4.1 * Documents the public `Plane` API. diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/barycentric_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/barycentric_filter.dart index 688d24b2..1dd9bdd7 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/barycentric_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/barycentric_filter.dart @@ -2,12 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(stuartmorgan): Remove this and fix violations. See -// https://github.com/flutter/flutter/issues/186827 -// ignore_for_file: public_member_api_docs - part of '../../../vector_math_geometry.dart'; +/// Adds barycentric coordinates for each triangle vertex in a mesh. class BarycentricFilter extends GeometryFilter { @override List get generates => [VertexAttrib('BARYCENTRIC', 3, 'float')]; diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/color_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/color_filter.dart index c72363cf..4d4bf855 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/color_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/color_filter.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(stuartmorgan): Remove this and fix violations. See -// https://github.com/flutter/flutter/issues/186827 -// ignore_for_file: public_member_api_docs - part of '../../../vector_math_geometry.dart'; +/// Assigns a single color to every vertex in a mesh. class ColorFilter extends GeometryFilter { + /// Creates a filter that writes [color] into the mesh `COLOR` attribute. ColorFilter(this.color); + + /// The color written to each output vertex. Vector4 color; @override diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/flat_shade_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/flat_shade_filter.dart index 5c7b5daf..276eb5ec 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/flat_shade_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/flat_shade_filter.dart @@ -2,12 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(stuartmorgan): Remove this and fix violations. See -// https://github.com/flutter/flutter/issues/186827 -// ignore_for_file: public_member_api_docs - part of '../../../vector_math_geometry.dart'; +/// Expands a mesh to triangle vertices and generates flat-shaded normals. class FlatShadeFilter extends GeometryFilter { @override List get requires => [VertexAttrib('POSITION', 3, 'float')]; diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/geometry_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/geometry_filter.dart index b9a6030e..34669649 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/geometry_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/geometry_filter.dart @@ -2,21 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(stuartmorgan): Remove this and fix violations. See -// https://github.com/flutter/flutter/issues/186827 -// ignore_for_file: public_member_api_docs - part of '../../../vector_math_geometry.dart'; +/// A filter that produces a transformed copy of a [MeshGeometry]. abstract class GeometryFilter { + /// Whether this filter supports in-place modification of a mesh. bool get inplace => false; + + /// Vertex attributes that must be present on the input mesh. List get requires => []; + + /// Vertex attributes that this filter guarantees on the output mesh. List get generates => []; /// Returns a copy of the mesh with any filter transforms applied. MeshGeometry filter(MeshGeometry mesh); } +/// A [GeometryFilter] that can apply its transformation directly to a mesh +/// in-place. abstract class InplaceGeometryFilter extends GeometryFilter { @override bool get inplace => true; diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/invert_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/invert_filter.dart index 8237fbf0..8f0f5da5 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/invert_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/invert_filter.dart @@ -2,12 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(stuartmorgan): Remove this and fix violations. See -// https://github.com/flutter/flutter/issues/186827 -// ignore_for_file: public_member_api_docs - part of '../../../vector_math_geometry.dart'; +/// Reverses triangle winding and flips normals for a mesh. class InvertFilter extends InplaceGeometryFilter { @override void filterInplace(MeshGeometry mesh) { diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/transform_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/transform_filter.dart index 6cdeb5bd..d0d5d431 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/transform_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/transform_filter.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(stuartmorgan): Remove this and fix violations. See -// https://github.com/flutter/flutter/issues/186827 -// ignore_for_file: public_member_api_docs - part of '../../../vector_math_geometry.dart'; +/// Applies a matrix transform to each mesh position in-place. class TransformFilter extends InplaceGeometryFilter { + /// Creates a filter that transforms positions using [transform]. TransformFilter(this.transform); + + /// The transform applied to each position in the mesh. Matrix4 transform; @override diff --git a/packages/vector_math/pubspec.yaml b/packages/vector_math/pubspec.yaml index 1b3ec265..89b201e2 100644 --- a/packages/vector_math/pubspec.yaml +++ b/packages/vector_math/pubspec.yaml @@ -5,7 +5,7 @@ name: vector_math description: A vector math library for 2D and 3D applications, supporting 2D, 3D, and 4D matrices. repository: https://github.com/flutter/core-packages/tree/main/packages/vector_math issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+vector_math%22 -version: 2.4.1 +version: 2.4.2 environment: sdk: ^3.10.0