Keep wipeout frames continuous

This commit is contained in:
ramox81 committed 2026-09-11 17:27:34 +03:00
1 parent 21a232ef8d
commit 61e5271055
6 files changed
+19 -10

No files matched your search

+2 -2
View File
@@ -344,7 +344,7 @@ impl CadCommand for WipeoutCommand {
WireModel::CYAN,
false,
);
wire.line_weight_px = 1.5;
wire.set_fixed_screen_width(2.0);
Some(wire)
}
WipeoutMode::Rectangular => {
@@ -367,7 +367,7 @@ impl CadCommand for WipeoutCommand {
WireModel::CYAN,
false,
);
wire.line_weight_px = 1.5;
wire.set_fixed_screen_width(2.0);
Some(wire)
}
WipeoutMode::Polyline | WipeoutMode::Frames | WipeoutMode::ErasePolyline => None,
+2
View File
@@ -2485,6 +2485,8 @@ fn emit_wire(
let sx = ((ax.x - o.x).powi(2) + (ax.y - o.y).powi(2) + (ax.z - o.z).powi(2)).sqrt();
let sy = ((ay.x - o.x).powi(2) + (ay.y - o.y).powi(2) + (ay.z - o.z).powi(2)).sqrt();
lw.world_width * ((sx + sy) * 0.5) as f32
} else if lw.world_width < 0.0 {
lw.world_width
} else {
0.0
};
+1 -1
View File
@@ -1282,7 +1282,7 @@ fn tessellate_entity_inner(
}
if matches!(e, EntityType::Wipeout(_)) {
b.depth_override = Some(0.5);
b.line_weight_px = b.line_weight_px.max(1.5);
b.set_fixed_screen_width(2.0);
}
}
+10 -5
View File
@@ -407,11 +407,10 @@ pub struct WireModel {
pub pattern: [f32; 8],
/// Rendered line width in screen pixels (half-width = line_weight_px / 2).
pub line_weight_px: f32,
/// World-space band width (drawing units). `0.0` = a normal wire whose
/// width comes from `line_weight_px` (screen pixels). Non-zero = a wide
/// polyline: the shader expands this centre-line to `world_width` world
/// units (scaling with zoom) so the band IS the wire — the linetype dash
/// pattern then applies to the band instead of a separate hatch fill.
/// World-space band width (drawing units). Positive values create a wide
/// polyline band that scales with zoom. Zero uses `line_weight_px` and the
/// drawing's lineweight display setting. A negative value encodes a fixed
/// screen-pixel width whose absolute value bypasses that display setting.
pub world_width: f32,
/// Per-point full band width (drawing units), aligned index-for-index with
/// [`points`], for a polyline whose width VARIES (a taper). Empty = a
@@ -553,6 +552,12 @@ impl WireModel {
w
}
pub fn set_fixed_screen_width(&mut self, width_px: f32) {
let width_px = width_px.max(1.0);
self.line_weight_px = width_px;
self.world_width = -width_px;
}
/// Create a solid wire (no dash pattern, 1px weight).
pub fn solid(name: String, points: Vec<[f32; 3]>, color: [f32; 4], selected: bool) -> Self {
Self {
+2 -1
View File
@@ -104,6 +104,7 @@ struct VertexOut {
fn resolve_hw(taper: f32, world_hw: f32, px_hw: f32) -> f32 {
if taper >= 0.0 { return max(taper / u.world_per_pixel, 0.5); }
if world_hw > 0.0 { return max(world_hw / u.world_per_pixel, 0.5); }
if world_hw < 0.0 { return max(-world_hw, 0.5); }
var display_hw = max(px_hw * u.lineweight_scale, 0.5);
if u.lineweight_scale < 0.0 {
let scale = -u.lineweight_scale;
@@ -227,7 +228,7 @@ fn marker_relative(position_high: vec3<f32>, position_low: vec3<f32>, instance:
let clip_pos = mix(clip_a, clip_b, which_end);
let hw = resolve_hw(0.0, 0.0, in.dists.z);
let hw = resolve_hw(-1.0, in.misc.w, in.dists.z);
let ext = which_end * 2.0 - 1.0;
let offset_px = perp * hw * side + dir * hw * ext;
let ndc_offset = offset_px / (u.viewport_size * 0.5);
+2 -1
View File
@@ -83,6 +83,7 @@ fn resolve_hw(taper_ratio: f32, world_hw: f32, px_hw: f32) -> f32 {
return max((taper_ratio * world_hw) / u.world_per_pixel, 0.5);
}
if world_hw > 0.0 { return max(world_hw / u.world_per_pixel, 0.5); }
if world_hw < 0.0 { return max(-world_hw, 0.5); }
var display_hw = max(px_hw * u.lineweight_scale, 0.5);
if u.lineweight_scale < 0.0 {
let scale = -u.lineweight_scale;
@@ -200,7 +201,7 @@ fn marker_relative(position_high: vec3<f32>, position_low: vec3<f32>, c: WireCon
let clip_pos = mix(clip_a, clip_b, which_end);
let hw = resolve_hw(0.0, 0.0, c.half_width);
let hw = resolve_hw(0.0, c.world_half_width, c.half_width);
let ext = which_end * 2.0 - 1.0;
let offset_px = perp * hw * side + dir * hw * ext;
let ndc_offset = offset_px / (u.viewport_size * 0.5);