Repository navigation
Revolve: overlapping faces draw in the order of their depths where they overlap - #7502
Merged
bflatastic merged 1 commit intoNov 14, 2026
Merged
Conversation
…ey overlap Revolve sorted its faces by the depth of each face's middle only, so a tilted profile with long edges, or a profile of several contours, could draw a nearer face under a farther one where the two overlap. - A revolved face carries its view-space plane (none when its corners lie off one plane or reach the eye), and Revolve (Classic)'s facets keep it. - Revolve and Revolve (Classic) put each surface's faces through the local depth order Extrude & Bevel uses for its fill and strokes: when two overlapping faces are drawn the wrong way round, every pair of overlapping faces goes in the order of their depths at the middle of the overlap, within the same 4,000,000-comparison limit. A surface already in the right order keeps it. - A group's members, sorted together by depth, go through the same order across members. Docs: docs/revolve.md, docs/effects-parity.md, docs/target-app-parity.md.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 51 seconds. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Member
|
Merged, thanks @dotCooCoo! It passed its CI checks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Revolve turns a profile into a 3D shape: the help page says it "Spins the object around an axis to create a circular 3D shape" (3D and Materials panel options), and the Classic help says "Revolving sweeps a path around the global Y axis to create a 3D object" (Create 3D objects). Revolve sorted its faces by the depth of each face's middle only, so a tilted profile with long edges, or a profile of several contours such as the outline of a dashed stroke, could draw a nearer face under a farther one where the two overlap. Extrude & Bevel and Inflate already order a shape's overlapping fill and stroke faces by their depths where they overlap when a stroke leaves gaps, such as a dashed stroke (#7154); this change runs that ordering over every pair of overlapping Revolve faces. Ordering faces by their depths at the overlap is VectorCraft's own rule; the help pages do not describe a drawing order.
project_face(crates/three-d/src/lib.rs) gives each revolvedFaceits view-space plane, with the same 0.001 pt flatness and near-eye checks Extrude & Bevel's facets use; a face with a corner off its plane or at the eye has none.Facet::of_face(crates/three-d/src/solid.rs) keeps the plane, so Revolve (Classic)'s facets carry it too.solids::surface_order(crates/effects/src/solids.rs) runs Extrude & Bevel'slocal_orderover one Revolve surface: when two overlapping faces are drawn the wrong way round, every pair of overlapping faces with a convex polygon and a plane goes in the order of its depths at the middle of the overlap, within the existing 4,000,000-comparison limit and its cycle handling. A surface already in the right order keeps it.revolve::surface(crates/effects/src/revolve.rs) puts the faces of Revolve and the facets of Revolve (Classic) in that order before graphics, visibility trimming and art. A group's members, sorted together by depth ingroup_art, go through the same order across members. In a group, faces already trimmed to their visible parts carry no plane and take no part in that comparison.docs/revolve.md,docs/effects-parity.mdanddocs/target-app-parity.mddescribe the order.This changes the order Revolve draws a surface's faces in only when the old order drew a nearer face under a farther one. On such a surface the faces are reordered as a whole, so a face without a plane or with a non-convex polygon can also move.
How it was tested
New tests, each failing without the change:
solids::tests_revolve_order::a_revolved_surface_draws_the_nearer_of_two_overlapping_faces_last(vectorcraft-effects): a vase profile of straight edges, turned 270° with a 12 pt offset and tilted 30° about X, has a face drawn before a farther face it overlaps. With the change no pair is drawn the wrong way round, on the object and as a member of a revolved group.solids::tests_revolve_order::a_revolved_groups_members_draw_the_nearer_of_two_overlapping_faces_last: five 14 × 20 pt rectangles as group members, revolved together, draw no pair of faces of one member or of two the wrong way round.solids::tests_revolve_order::a_classic_revolved_surface_draws_the_nearer_of_two_overlapping_facets_last: the same rectangles as one compound path under Revolve (Classic), tilted 60° in perspective.solids::tests_revolve_order::surface_order_puts_the_nearer_face_where_they_overlap_last: synthetic planes; the face nearer the viewer at the overlap goes last, a face without a plane or without an overlap keeps its place, and equal depths keep their order.tests::a_revolved_face_measures_its_depth_on_its_plane(vectorcraft-three-d): a revolved face's plane gives each corner's view-space depth, with and without perspective, and a twisted face or one with a corner past the eye has no plane.solids::tests_revolve_order::a_surface_already_in_order_keeps_itchecks that a vase seen straight on keeps its order by depth; it passes with and without the change.Focused checks on the final tree, on Linux, on
mainate56d1c7(the branch merges cleanly with it):cargo fmt --all -- --checkcargo clippy -p vectorcraft-three-d -p vectorcraft-effects --all-targets -- -D warningscargo check --workspace --testscargo test -p vectorcraft-effects --lib tests_revolve_order: 5 passedcargo test -p vectorcraft-three-d --lib a_revolved_face_measures_its_depth_on_its_plane: 1 passedcargo test -p vectorcraft-effects --lib revolve: 60 passedcargo xtask brands,cargo xtask layers(30 crates) andcargo xtask assets(337 files)cargo xtask ciruns in this pull request's CI.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md.