forked from 1b-agent/opencadstudio-upstream
feat(lwpolyline): render the wide-polyline band via the wire shader
A wide polyline's flat band was drawn by the hatch pipeline: a solid fill with only draw-order depth. It ignored the entity linetype (the width "crushed" the dash pattern) and showed through 3-D geometry in a tilted view. Draw the band from the polyline's own centre-line wire instead. A new `WireModel.world_width` (drawing units) makes the wire vertex shader expand the quad by `world_half_width / world_per_pixel` (clamped to a hairline), so the band is sized in world units and tracks zoom. Because it is now a wire: - the GPU dash shader dashes the band by arc-length — the linetype applies; - it is depth-tested at the polyline elevation — no draw-order see-through; - no CPU band triangles or per-dash geometry are generated. `world_half_width` rides in `WireConst` (native, replacing a pad) and the web `WireInstance` (loc 14); both wire shaders branch on it. The tessellator sets `world_width` from the LwPolyline width on the Contour / SegmentedLines arms, and the model-space fill loop no longer emits a hatch band for any LwPolyline. Pick still uses the band polygon (`pick_tris`). Blocks keep the hatch band: `LocalWire` carries no `world_width` (finalize zeroes it), so a scaled insert still scales its band correctly. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
3d37e1f8d8
commit
bd1a5affd7
44 files changed
+158
-17
No files matched your search
@@ -186,6 +186,7 @@ impl CadCommand for AlignedDimensionCommand {
|
||||
let p1 = p1.as_vec3();
|
||||
let p2 = p2.as_vec3();
|
||||
Some(WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
@@ -237,6 +238,7 @@ fn preview_aligned(p1: DVec3, p2: DVec3, dim_pt: DVec3) -> WireModel {
|
||||
let d1 = d1.as_vec3();
|
||||
let d2 = d2.as_vec3();
|
||||
WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -130,6 +130,7 @@ fn v3(pt: DVec3) -> Vector3 {
|
||||
|
||||
fn preview_wire(points: Vec<Vec3>) -> WireModel {
|
||||
WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -180,6 +180,7 @@ fn v3(p: DVec3) -> Vector3 {
|
||||
|
||||
fn preview_line(a: Vec3, b: Vec3) -> WireModel {
|
||||
WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -179,6 +179,7 @@ impl CadCommand for DimBaselineCommand {
|
||||
let dim_line_pt2 = dim_line_pt2.as_vec3();
|
||||
let pt = pt.as_vec3();
|
||||
Some(WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -159,6 +159,7 @@ impl CadCommand for DimContinueCommand {
|
||||
let dim_line_pt = p1 + perp * (dim_line_perp - p1.dot(perp));
|
||||
let dim_line_pt2 = pt + perp * (dim_line_perp - pt.dot(perp));
|
||||
Some(WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -85,6 +85,7 @@ impl CadCommand for DimJogLineCommand {
|
||||
}
|
||||
let d = 0.3_f32;
|
||||
Some(WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -100,6 +100,7 @@ impl CadCommand for DimTeditCommand {
|
||||
}
|
||||
let d = 0.2_f32;
|
||||
Some(WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -163,6 +163,7 @@ fn preview_wire(pts: &[Vec3]) -> WireModel {
|
||||
points.push([w2.x, w2.y, w2.z]);
|
||||
}
|
||||
WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -218,6 +218,7 @@ fn v3(pt: DVec3) -> Vector3 {
|
||||
|
||||
fn preview_wire(points: Vec<DVec3>) -> WireModel {
|
||||
WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -150,6 +150,7 @@ fn preview_wire(pts: &[Vec3]) -> WireModel {
|
||||
points.push([w2.x, w2.y, w2.z]);
|
||||
}
|
||||
WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -458,6 +458,7 @@ impl CadCommand for MLeaderCollectCommand {
|
||||
|
||||
fn preview_wire(pts: &[Vec3]) -> WireModel {
|
||||
WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -121,6 +121,7 @@ fn ordinate_elbow(feature: DVec3, leader: DVec3, is_x: bool) -> DVec3 {
|
||||
|
||||
fn preview_wire(points: Vec<Vec3>) -> WireModel {
|
||||
WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -90,6 +90,7 @@ impl CadCommand for QdimCommand {
|
||||
}
|
||||
let d = 0.5_f32;
|
||||
Some(WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -185,6 +185,7 @@ fn v3(pt: DVec3) -> Vector3 {
|
||||
|
||||
fn preview_wire(points: Vec<Vec3>) -> WireModel {
|
||||
WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -139,6 +139,7 @@ impl CadCommand for TableCommand {
|
||||
let y = pt.y;
|
||||
let z = pt.z;
|
||||
Some(WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
@@ -84,6 +84,7 @@ impl CadCommand for ToleranceCommand {
|
||||
}
|
||||
let d = 0.15_f32;
|
||||
Some(WireModel {
|
||||
world_width: 0.0,
|
||||
fill_is_3d: false,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
|
||||
Reference in new issue
Block a user