From 39dc50de1ebfd14c5b8635e086dbd7f66578b95d Mon Sep 17 00:00:00 2001 From: Faheem Abbas Date: Wed, 10 Jun 2026 11:53:21 +0500 Subject: [PATCH 1/2] Document vector_math geometry filters --- .../filters/barycentric_filter.dart | 5 +---- .../vector_math_geometry/filters/color_filter.dart | 8 ++++---- .../filters/flat_shade_filter.dart | 5 +---- .../vector_math_geometry/filters/geometry_filter.dart | 11 +++++++---- .../vector_math_geometry/filters/invert_filter.dart | 5 +---- .../filters/transform_filter.dart | 8 ++++---- 6 files changed, 18 insertions(+), 24 deletions(-) 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..f8b191d9 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,24 @@ // 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 mutates an input mesh before returning it. 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 applies its transformation directly to a mesh copy. 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 From 8ab9aa841497311f2a6c18ffff6116880625d6c8 Mon Sep 17 00:00:00 2001 From: Faheem Abbas Date: Wed, 10 Jun 2026 12:00:50 +0500 Subject: [PATCH 2/2] Refine geometry filter API docs --- .../vector_math_geometry/filters/geometry_filter.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 f8b191d9..7c8aaf18 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 @@ -6,20 +6,21 @@ part of '../../../vector_math_geometry.dart'; /// A filter that produces a transformed copy of a [MeshGeometry]. abstract class GeometryFilter { - /// Whether this filter mutates an input mesh before returning it. + /// 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 => []; + List get requires => const []; /// Vertex attributes that this filter guarantees on the output mesh. - List get generates => []; + List get generates => const []; /// Returns a copy of the mesh with any filter transforms applied. MeshGeometry filter(MeshGeometry mesh); } -/// A [GeometryFilter] that applies its transformation directly to a mesh copy. +/// A [GeometryFilter] that can apply its transformation directly to a mesh +/// in-place. abstract class InplaceGeometryFilter extends GeometryFilter { @override bool get inplace => true;