compress platform module

This commit is contained in:
2021-11-21 23:38:01 +01:00
parent f6d0bdfa8f
commit 88bc4fe364
10 changed files with 67 additions and 24 deletions

View File

@@ -30,13 +30,13 @@ fn ftoi(v: f32) -> i32 {
#[no_mangle]
pub fn tic(time: i32) {
for i in 0..320 * 256 {
for i in 0..320 * 240 {
let t = time as f32 / 10 as f32;
let x = (i % 320 - 160) as f32;
let y = (i / 320 - 128) as f32;
let d = 20000 as f32 / sqrt(x * x + y * y + 1 as f32);
let y = (i / 320 - 120) as f32;
let d = 40000 as f32 / sqrt(x * x + y * y + 1 as f32);
let u = atan2(x, y) * 512f32 / 3.141;
let c = (ftoi(d + t) ^ ftoi(u + t)) as u8;
let c = (ftoi(d + t * 2 as f32) ^ ftoi(u + t)) as u8;
unsafe {
*((120 + i) as *mut u8) = c;
}