forked from 1b-agent/opencadstudio-upstream
Keep wipeout frames continuous
This commit is contained in:
1 parent
21a232ef8d
commit
61e5271055
6 files changed
+19
-10
No files matched your search
Vendored
+2
@@ -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
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user