mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-28 12:07:48 -06:00
G2: improve editing reliability and Windows rendering fidelity
This commit is contained in:
@@ -236,7 +236,7 @@ fn mix_into(
|
||||
continue;
|
||||
}
|
||||
let buf = env.layer_audio(l, s0 + a as i64, b - a);
|
||||
for (i, f) in buf.chunks_exact(2).enumerate() {
|
||||
for (i, f) in buf.as_chunks::<2>().0.iter().enumerate() {
|
||||
out[(a + i) * 2] += f[0] * ll;
|
||||
out[(a + i) * 2 + 1] += f[1] * lr;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ pub fn peak_summary(samples: &[f32], bin: usize) -> Vec<[f32; 4]> {
|
||||
.chunks(bin * 2)
|
||||
.map(|c| {
|
||||
let mut s = [f32::MAX, f32::MIN, f32::MAX, f32::MIN];
|
||||
for f in c.chunks_exact(2) {
|
||||
for f in c.as_chunks::<2>().0 {
|
||||
s[0] = s[0].min(f[0]);
|
||||
s[1] = s[1].max(f[0]);
|
||||
s[2] = s[2].min(f[1]);
|
||||
|
||||
@@ -46,15 +46,15 @@ fn scene(collapse: bool, flatten: bool) -> (Project, ItemId) {
|
||||
set(l, "transform/scale", Value::Vec3([150.0, 150.0, 100.0]));
|
||||
set(l, "transform/rotation", Value::Scalar(20.0));
|
||||
};
|
||||
let cid;
|
||||
if flatten {
|
||||
|
||||
let cid = if flatten {
|
||||
let mut null = build::layer(&mut p, &outer, "Null", LayerSource::Null, (100, 100), None);
|
||||
xf(&mut null);
|
||||
a.parent = Some(null.id);
|
||||
b.parent = Some(null.id);
|
||||
let mut c = outer.clone();
|
||||
c.layers = vec![null, b, a, bg];
|
||||
cid = p.add_item("Outer", Label::Sandstone, None, ItemKind::Comp(c.into()));
|
||||
p.add_item("Outer", Label::Sandstone, None, ItemKind::Comp(c.into()))
|
||||
} else {
|
||||
let mut inner = inner;
|
||||
inner.layers = vec![b, a];
|
||||
@@ -64,8 +64,8 @@ fn scene(collapse: bool, flatten: bool) -> (Project, ItemId) {
|
||||
pre.switches.collapse = collapse;
|
||||
let mut c = outer.clone();
|
||||
c.layers = vec![pre, bg];
|
||||
cid = p.add_item("Outer", Label::Sandstone, None, ItemKind::Comp(c.into()));
|
||||
}
|
||||
p.add_item("Outer", Label::Sandstone, None, ItemKind::Comp(c.into()))
|
||||
};
|
||||
(p, cid)
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ impl Builder {
|
||||
}
|
||||
// Mirroring transforms reverse the winding.
|
||||
let flip = flip_count * 2 > p.positions.len();
|
||||
for t in p.indices.chunks_exact(3) {
|
||||
for t in p.indices.as_chunks::<3>().0 {
|
||||
let (a, b, c) = (t[0] + base, t[1] + base, t[2] + base);
|
||||
if flip {
|
||||
self.s.indices.extend([a, c, b])
|
||||
@@ -340,7 +340,7 @@ impl Builder {
|
||||
|
||||
/// Opaque triangles first, then transparent ones back to front.
|
||||
fn sort_triangles(&mut self) {
|
||||
let tris: Vec<[u32; 3]> = self.s.indices.chunks_exact(3).map(|t| [t[0], t[1], t[2]]).collect();
|
||||
let tris: Vec<[u32; 3]> = self.s.indices.as_chunks::<3>().0.iter().map(|t| [t[0], t[1], t[2]]).collect();
|
||||
let mut order: Vec<usize> = (0..tris.len()).collect();
|
||||
order.sort_by(|&a, &b| {
|
||||
let (ta, za) = self.tri_depth[a];
|
||||
|
||||
Reference in New Issue
Block a user