Merge upstream/main into the plane store branch (#3301)

# Conflicts:
#	Cargo.toml
This commit is contained in:
vangel76 committed 2026-11-17 11:10:07 +01:00
commit fc4eddf2d5
38 files changed
+1996 -1656

No files matched your search

+2
View File
@@ -228,6 +228,8 @@ pub(crate) fn sprite_layer(e: &mut Enc, src: &GpuImage, plan: &SpritePlan) -> Op
Shape::Square => (6.0, 0.0, 0.0),
Shape::Tri => (7.0, 0.0, 0.0),
Shape::Line { dx, dy } => (8.0, dx, dy),
// The strength rides in the (otherwise unused) first segment slot.
Shape::Ball { shade } => (9.0, shade, 0.0),
};
let mut rec = [kind, s.x, s.y, s.r, s.c[0], s.c[1], s.c[2], s.c[3], s.rot, dx, dy, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];
match plan.tints.get(i).copied().unwrap_or(Tint::Fixed) {
+21
View File
@@ -145,6 +145,27 @@ fn fxm_sprite(at: u32, x: f32, y: f32) -> FxmShade {
}
cov = fxm_aa(m);
}
// sim::Shape::Ball (CC Ball Action's Shading): the sphere's light and shine scaled by
// |shade| (data[at + 9]), lit from the lower right when shade < 0.
case 9u: {
let d = sqrt(dx * dx + dy * dy);
let cv = fxm_aa(r - d);
if (cv <= 0.0) {
return fxm_none();
}
let shade = data[at + 9u];
let nx = dx / r;
let ny = dy / r;
let nz = sqrt(max(1.0 - nx * nx - ny * ny, 0.0));
let m = select(1.0, -1.0, shade < 0.0);
let diff = max(nx * (-0.48 * m) + ny * (-0.58 * m) + nz * 0.66, 0.0);
let rz = 2.0 * diff * nz - 0.66;
let st = abs(shade);
let spec = powz(max(rz, 0.0), 20.0) * 0.6 * st;
let k = max(1.0 - st * 0.8 * (1.0 - diff), 0.0);
rgb = rgb * k + spec;
cov = cv;
}
default: {
let lx = data[at + 9u];
let ly = data[at + 10u];
+16 -1
View File
@@ -141,7 +141,22 @@ fn ball_action_pixel_polly_scatterize() {
0.0,
0.0,
);
case("ec.sim.ccballaction", &[("gridSpacing", n(2.0)), ("ballSize", n(80.0)), ("instabilityState", n(45.0)), ("twistProperty", e(2))], 0.0, 0.0);
case("ec.sim.ccballaction", &[("gridSpacing", n(2.0)), ("ballSize", n(80.0)), ("scatterMotion", n(45.0)), ("twistProperty", e(2))], 0.0, 0.0);
// #3197: Shading (flat, weaker, stronger, lit from the other side), Coloring, Displace.
for shading in [0.0, -30.0, -100.0, 60.0, 1e45] {
case("ec.sim.ccballaction", &[("ballSize", n(80.0)), ("shading", n(shading))], 0.0, 0.0);
}
for coloring in [0, 2] {
case("ec.sim.ccballaction", &[("ballSize", n(80.0)), ("coloring", e(coloring))], 0.0, 0.0);
}
for prop in [3, 6, 8] {
case(
"ec.sim.ccballaction",
&[("ballSize", n(80.0)), ("rotationAxis", e(1)), ("rotation", n(30.0)), ("displace", n(40.0)), ("displaceProperty", e(prop))],
0.0,
0.0,
);
}
for object in 0..4 {
case("ec.sim.ccpixelpolly", &[("object", e(object)), ("gridSpacing", n(6.0))], 0.6, 0.0);
}