use processing_glfw::GlfwContext; use bevy::math::Vec3; use processing::prelude::*; use processing_render::render::command::DrawCommand; fn main() { match sketch() { Ok(_) => { eprintln!("Sketch completed successfully"); exit(0).unwrap(); } Err(e) => { eprintln!("Sketch error: {:?}", e); exit(1).unwrap(); } }; } fn sketch() -> error::Result<()> { let mut glfw_ctx = GlfwContext::new(400, 400, false)?; init(Config::default())?; let width = 400; let height = 400; let surface = glfw_ctx.create_surface(width, height, false)?; let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?; let box_geo = geometry_box(100.0, 100.0, 100.0)?; graphics_mode_3d(graphics)?; transform_set_position(graphics, Vec3::new(100.0, 100.0, 300.0))?; transform_look_at(graphics, Vec3::new(0.0, 0.0, 0.0))?; let mut angle: f32 = 0.0; while glfw_ctx.poll_events() { graphics_begin_draw(graphics)?; graphics_record_command( graphics, DrawCommand::BackgroundColor(bevy::color::Color::srgb(0.1, 0.1, 0.15)), )?; graphics_record_command(graphics, DrawCommand::PushMatrix)?; graphics_record_command( graphics, DrawCommand::Rotate { angle, axis: Vec3::Z, }, )?; graphics_record_command(graphics, DrawCommand::Geometry(box_geo))?; graphics_record_command(graphics, DrawCommand::PopMatrix)?; graphics_end_draw(graphics)?; angle += 0.02; } Ok(()) }