mirror of
https://github.com/exoticorn/curlywas.git
synced 2026-01-20 11:46:43 +01:00
add sweetie palette
This commit is contained in:
@@ -24,25 +24,61 @@ fn col(f: f32, c: f32) -> i32 {
|
||||
fcol((a + b - a * b) * 255 as f32)
|
||||
}
|
||||
|
||||
fn make_gradient(r: f32, g: f32, b: f32, base: i32) {
|
||||
fn make_gradient(r: f32, g: f32, b: f32, base: i32) -> i32 {
|
||||
let i: i32;
|
||||
loop colors {
|
||||
let f = (i + 1) as f32 / 16 as f32;
|
||||
((base + i) * 4)!(120+320*240) =
|
||||
let f = (i + 4) as f32 / 64 as f32;
|
||||
(base + i)!(120+320*240) =
|
||||
col(f, r) +
|
||||
(col(f, g) << 8) +
|
||||
(col(f, b) << 16);
|
||||
|
||||
branch_if (i := i + 1) < 16: colors;
|
||||
branch_if (i := i + 4) < 64: colors;
|
||||
}
|
||||
base + 1
|
||||
}
|
||||
|
||||
start fn gen_palette() {
|
||||
let i: i32;
|
||||
loop hsv {
|
||||
let a = i as f32 * (3.141 / 6.0);
|
||||
make_gradient(sin(a) * 0.707 - cos(a) * 0.804, cos(a) * 0.816, cos(a) * 0.804 + sin(a) * 0.707, i * 16);
|
||||
make_gradient(sin(a) * 0.707 - cos(a) * 0.804, cos(a) * 0.816, cos(a) * 0.804 + sin(a) * 0.707, i * 64);
|
||||
branch_if (i := i + 1) < 11: hsv;
|
||||
}
|
||||
make_gradient(0 as f32, 0 as f32, 0 as f32, 11*16);
|
||||
make_gradient(0 as f32, 0 as f32, 0 as f32, 11*16*4);
|
||||
|
||||
i = 255;
|
||||
loop expand_sweetie {
|
||||
let lazy channel = i & 3;
|
||||
let lazy index = i >> 2;
|
||||
let lazy first_step = index >= 32;
|
||||
let inline src1 = select(first_step, index % 32 / 2, index * 2);
|
||||
let inline src2 = select(first_step, (index + 1) % 32 / 2, index * 2 + 1);
|
||||
let inline c1 = (src1 * 4 + channel)?(120+320*240+192*4);
|
||||
let inline c2 = (src2 * 4 + channel)?(120+320*240+192*4);
|
||||
i?(120+320*240+192*4) = (c1 + c2) * (3 + first_step) / 8;
|
||||
|
||||
branch_if (i := i - 1) >= 0: expand_sweetie;
|
||||
}
|
||||
}
|
||||
|
||||
data 120+320*240+192*4 {
|
||||
i32(
|
||||
0x2c1c1a,
|
||||
0x5d275d,
|
||||
0x533eb1,
|
||||
0x577def,
|
||||
0x75cdff,
|
||||
0x70f0a7,
|
||||
0x64b738,
|
||||
0x797125,
|
||||
0x6f3629,
|
||||
0xc95d3b,
|
||||
0xf6a641,
|
||||
0xf7ef73,
|
||||
0xf4f4f4,
|
||||
0xc2b094,
|
||||
0x866c56,
|
||||
0x573c33
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user