Closed krupitskas closed 5 years ago
Thanks for github, found here how to do this properly https://github.com/expenses/isomagic/blob/7f84772085d3f980e5766e5a8f5a33c85f50f5af/src/main.rs
fn colour(&self, index: u8, subtract: u8) -> Rgba<u8> {
let colour = self.palette[index as usize - 1];
let r = (colour % 256) as u8;
let g = ((colour >> 8) % 256) as u8;
let b = ((colour >> 16) % 256) as u8;
let a = ((colour >> 24) % 256) as u8;
let r = r.saturating_sub(subtract);
let g = g.saturating_sub(subtract);
let b = b.saturating_sub(subtract);
Rgba {
data: [r, g, b, a]
}
}
hey! Im pretty newbie in rust. Just finished extracting voxel position and it's all works, but how to extract rgba data for each voxel? Thanks!