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 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-18 22:01:22 +03:00
commit fc29139056
8 changed files with 93 additions and 23 deletions

View file

@ -36,8 +36,14 @@ pub enum HatchPattern {
Solid,
/// One or more line families (PAT format).
Pattern(Vec<PatFamily>),
/// Linear gradient from `color` to `color2` along `angle_deg`.
Gradient { angle_deg: f32, color2: [f32; 4] },
/// Two-stop gradient from `color` to `color2`. Linear along `angle_deg`
/// unless `radial`, in which case it runs from the boundary centre outward
/// (spherical / hemispherical / curved fills).
Gradient {
angle_deg: f32,
color2: [f32; 4],
radial: bool,
},
}
/// A hatched region defined by a closed polygon boundary.