Nativer 2D-Viewport: Schraffuren wie im Browser
toRenderScene emittiert jetzt die aufs Polygon geclippten Musterlinien (glPlanHatch: buildHatchRuns + applyDashRuns) als Polylinien — Daemmung/Diagonal/Kreuz erscheinen im nativen wgpu-Grundriss identisch zum WebGL-Pfad. 'none'/'solid' brauchen keine Linien (solid deckt die Fuellung farbig ab).
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
// mit Point = [x,y] (Meter) und Rgba = [r,g,b,a] (0..1).
|
// mit Point = [x,y] (Meter) und Rgba = [r,g,b,a] (0..1).
|
||||||
|
|
||||||
import type { Plan, Primitive } from "./generatePlan";
|
import type { Plan, Primitive } from "./generatePlan";
|
||||||
|
import { applyDashRuns, buildHatchRuns } from "./glPlan/glPlanHatch";
|
||||||
|
|
||||||
type LinePrim = Extract<Primitive, { kind: "line" }>;
|
type LinePrim = Extract<Primitive, { kind: "line" }>;
|
||||||
|
|
||||||
@@ -177,6 +178,20 @@ export function planToRenderScene(plan: Plan): RScene {
|
|||||||
const fillCol = toRgba(p.fill, 1);
|
const fillCol = toRgba(p.fill, 1);
|
||||||
if (fillCol && pts.length >= 3) fills.push({ pts, color: fillCol });
|
if (fillCol && pts.length >= 3) fills.push({ pts, color: fillCol });
|
||||||
|
|
||||||
|
// Schraffur: die aufs Polygon geclippten Musterlinien wie im Browser
|
||||||
|
// (glPlanHatch — identische Geometrie), als Polylinien. "none"/"solid"
|
||||||
|
// brauchen keine Linien (solid deckt die Füllung farbig ab).
|
||||||
|
if (p.hatch && p.hatch.pattern !== "none" && p.hatch.pattern !== "solid") {
|
||||||
|
const hatchCol = toRgba(p.hatch.color, 1) ?? [0.1, 0.1, 0.1, 1];
|
||||||
|
const hatchMm = p.hatch.lineWeight > 0 ? p.hatch.lineWeight : 0.13;
|
||||||
|
const runs = applyDashRuns(buildHatchRuns(p.pts, p.hatch), p.hatch.dash);
|
||||||
|
for (const run of runs) {
|
||||||
|
if (run.length >= 2) {
|
||||||
|
polylines.push({ pts: run.map((v) => [v.x, v.y]), color: hatchCol, widthMm: hatchMm });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Umriss
|
// Umriss
|
||||||
const strokeCol = toRgba(p.stroke, 1);
|
const strokeCol = toRgba(p.stroke, 1);
|
||||||
if (strokeCol && p.strokeWidthMm > 0) {
|
if (strokeCol && p.strokeWidthMm > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user