Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow brush tips to have multiple outlines (e.g. for particle effects) #69

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Dec 2, 2024

Allow brush tips to have multiple outlines (e.g. for particle effects)

In StrokeShapeBuilder, this involves losing the assumption that the number of outlines is exactly equal to the number of brush tips, since particle brushes have more than one outline per tip. Without that assumption, it can also discard empty outlines a bit earlier.

In BrushTipExtruder this involves:

  • Keeping a vector of outlines instead of a single outline (since the usual case is just one, this uses absl::InlinedVector<StrokeOutline, 1>).

  • Keep track of the number of extrusion breaks in Geometry.

  • Add accessors to Geometry to get the number of break-points and the index counts at the lastest break-point. Use those in Restore to restore the saved state and in AppendNewIndices to get the start points in the latest outline.

  • Pull calls to AppendNewIndices and Geometry::UpdateMeshDerivatives into ExtrudeBreakPoint because the former computes the latest outline and the latter may update indices, so it needs to be called first.

  • Similarly, move forward the "first mutated" indices in Geometry::AddExtrusionBreak, since those track the first mutated vertices that haven't been recorded in the outline. These are renamed to first_mutated_{left,right}_index_offset_in_current_partition_, since these no longer track the same thing as first_mutated_left_index_ and first_mutated_right_index_ (which still considers a whole stroke update).

In InProgressStroke, GetIndexOutlines is renamed to GetCoatOutlines for clarity, since that makes it clear what the index is referring to.

@copybara-service copybara-service bot force-pushed the test_700337033 branch 10 times, most recently from cd1c1f0 to 0d157aa Compare December 5, 2024 19:03
In `StrokeShapeBuilder`, this involves losing the assumption that the number of outlines is exactly equal to the number of brush tips, since particle brushes have more than one outline per tip. Without that assumption, it can also discard empty outlines a bit earlier.

In `BrushTipExtruder` this involves:

* Keeping a vector of outlines instead of a single outline (since the usual case is just one, this uses `absl::InlinedVector<StrokeOutline, 1>`).

* Keep track of the number of extrusion breaks in `Geometry`.

* Add accessors to `Geometry` to get the number of break-points and the index counts at the lastest break-point. Use those in `Restore` to restore the saved state and in `AppendNewIndices` to get the start points in the latest outline.

* Pull calls to `AppendNewIndices` and `Geometry::UpdateMeshDerivatives` into `ExtrudeBreakPoint` because the former computes the latest outline and the latter may update indices, so it needs to be called first.

* Similarly, move forward the "first mutated" indices in `Geometry::AddExtrusionBreak`, since those track the first mutated vertices that haven't been recorded in the outline. These are renamed to `first_mutated_{left,right}_index_offset_in_current_partition_`, since these no longer track the same thing as `first_mutated_left_index_` and `first_mutated_right_index_` (which still considers a whole stroke update).

In `InProgressStroke`, `GetIndexOutlines` is renamed to `GetCoatOutlines` for clarity, since that makes it clear what the index is referring to.

PiperOrigin-RevId: 703187544
@copybara-service copybara-service bot merged commit ce4c535 into main Dec 5, 2024
@copybara-service copybara-service bot deleted the test_700337033 branch December 5, 2024 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant