forked from 1b-agent/opencadstudio-upstream
fix(hatch): radial gradients and correct gradient stop colours
A gradient hatch was drawn linear from the entity colour to its second stop, so a red->yellow spherical fill came out as a pale linear wash. Two fixes: - Colour: start from the gradient's first stop, not the entity colour. hatch_model_from_dxf already baked stop-0 in; stop synced_hatch_models from clobbering it with the entity's resolved colour for gradient fills. - Shape: spherical / hemispherical / curved gradient names now render as a radial fill (new shader mode 3, centred on the boundary with radius to the farthest vertex) instead of linear. Native and web shaders both updated. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
69354eca07
commit
fc29139056
8 files changed
+93
-23
No files matched your search
@@ -274,6 +274,11 @@ fn check_family(
|
||||
let proj = v.xz.x * inst.grad_cos + v.xz.y * inst.grad_sin;
|
||||
let t = clamp((proj - inst.grad_min) / inst.grad_range, 0.0, 1.0);
|
||||
return mix(inst.color, inst.color2, t);
|
||||
} else if inst.mode == 3u {
|
||||
// Radial gradient: centre is (grad_cos, grad_sin), radius is grad_range.
|
||||
let d = length(v.xz - vec2<f32>(inst.grad_cos, inst.grad_sin));
|
||||
let t = clamp(d / inst.grad_range, 0.0, 1.0);
|
||||
return mix(inst.color, inst.color2, t);
|
||||
}
|
||||
|
||||
// 3. Pattern LOD: when the densest family's spacing projects below
|
||||
|
||||
@@ -228,6 +228,11 @@ fn check_family(
|
||||
let proj = v.xz.x * h.grad_cos + v.xz.y * h.grad_sin;
|
||||
let t = clamp((proj - h.grad_min) / h.grad_range, 0.0, 1.0);
|
||||
return mix(h.color, h.color2, t);
|
||||
} else if h.mode == 3u {
|
||||
// Radial gradient: centre is (grad_cos, grad_sin), radius is grad_range.
|
||||
let d = length(v.xz - vec2<f32>(h.grad_cos, h.grad_sin));
|
||||
let t = clamp(d / h.grad_range, 0.0, 1.0);
|
||||
return mix(h.color, h.color2, t);
|
||||
}
|
||||
|
||||
// Pattern LOD: when the densest family projects below 2 px, lines blur into
|
||||
|
||||
Reference in new issue
Block a user