Start fixes for the gasket example
CI / cargo fmt (push) Successful in 25s
CI / cargo test (push) Successful in 13m26s
CI / cargo test (GPU) (push) Successful in 12m50s

The image is inverted for reasons I don't entirely understand yet
This commit is contained in:
2026-07-04 12:23:57 -04:00
parent d79ff7be21
commit 6a7ce14137
2 changed files with 35 additions and 18 deletions
+11 -6
View File
@@ -5,8 +5,8 @@ use enkou_shaders::camera::entry::main_image_render;
use enkou_shaders::chaos_game::entry::main_chaos_game;
use enkou_shaders::transform::Transform;
use enkou_shaders::variation::Variation;
use glam::{Affine2, UVec2, Vec2, Vec4, uvec2, vec2};
use image::{Rgba, Rgba32FImage};
use glam::{Affine2, UVec2, Vec2, Vec2Swizzles, Vec4, uvec2, vec2};
use image::{Rgba, RgbaImage};
use std::mem;
use std::process::Command;
use tempfile::NamedTempFile;
@@ -65,7 +65,7 @@ pub fn main() -> Result<()> {
let palette = &[Vec4::ONE; 2];
let mut output_points_pixel = Vec::new();
output_points_pixel.resize(ITERATIONS as usize, Vec4::ZERO);
output_points_pixel.resize(IMAGE_DIMENSION.xy().element_product() as usize, Vec4::ZERO);
main_image_render(
&camera,
@@ -74,11 +74,16 @@ pub fn main() -> Result<()> {
&mut output_points_pixel,
);
let mut image = Rgba32FImage::new(IMAGE_DIMENSION.x, IMAGE_DIMENSION.y);
for x in 0..image.dimensions().0 {
for y in 0..image.dimensions().1 {
let mut image = RgbaImage::new(IMAGE_DIMENSION.x, IMAGE_DIMENSION.y);
for y in 0..image.dimensions().1 {
for x in 0..image.dimensions().0 {
let pixel_index = y * IMAGE_DIMENSION.x + x;
let pixel = output_points_pixel[pixel_index as usize];
let pixel = pixel.to_array().map(|channel| {
let channel = if channel.is_nan() { 0.0 } else { channel };
let channel = channel * u8::MAX as f32;
channel as u8
});
image.put_pixel(x, y, Rgba(pixel.into()));
}
}