Pipelines cause Z-fighting (#1976)
Bug: You can see here that the two programs under tests/ are equivalent, just one uses pipelines and one always assigns to a new sketchgroup. However, the pipeline produces weird visual bugs. Jess did a git bisect to figure out this was the problem that Mike was experiencing, around weird visual artifacts with filleting. Ultimately the bug was that my rewritten `execute_pipe_body` function was executing the first expression of the pipeline body twice! In most unit tests this didn't matter, because the first expression in a pipeline was startSketchAt. No big deal to run that twice. However, in Mike's program, the first expression was `make_circle` or `pentagon`, user-defined functions that sent a lot of API calls. This meant the pipeline duplicated a lot of geometry, causing Z-fighting and weird artifacts.
This commit is contained in:
@ -111,16 +111,34 @@ const part002 = startSketchOn(part001, "here")
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face.png", &result, 0.999);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_riddle_small() {
|
||||
let code = include_str!("inputs/riddle_small.kcl");
|
||||
|
||||
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
|
||||
.await
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image("tests/executor/outputs/riddle_small.png", &result, 0.999);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_pentagon_fillet_desugar() {
|
||||
let code = include_str!("inputs/pentagon_fillet_desugar.kcl");
|
||||
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Cm)
|
||||
.await
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image("tests/executor/outputs/pentagon_fillet_desugar.png", &result, 0.999);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_pentagon_fillet_sugar() {
|
||||
let code = include_str!("inputs/pentagon_fillet_sugar.kcl");
|
||||
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Cm)
|
||||
.await
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image("tests/executor/outputs/pentagon_fillet_sugar.png", &result, 0.999);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_sketch_on_face_start() {
|
||||
let code = r#"fn cube = (pos, scale) => {
|
||||
@ -1898,12 +1916,12 @@ const plumbus0 = make_circle(p, 'a', [0, 0], 1.5)
|
||||
tags: ['arc-a', getOppositeEdge('arc-a', %)]
|
||||
}, %)
|
||||
|
||||
const plumbus1 = make_circle(p, 'b', [0, 0], 1.5)
|
||||
|> extrude(3, %)
|
||||
|> fillet({
|
||||
radius: 0.5,
|
||||
tags: ['arc-b', getOppositeEdge('arc-b', %)]
|
||||
}, %)
|
||||
// const plumbus1 = make_circle(p, 'b', [0, 0], 1.5)
|
||||
// |> extrude(3, %)
|
||||
// |> fillet({
|
||||
// radius: 0.5,
|
||||
// tags: ['arc-b', getOppositeEdge('arc-b', %)]
|
||||
// }, %)
|
||||
"#;
|
||||
|
||||
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
|
||||
|
Reference in New Issue
Block a user