GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — libprocessing/examples/gltf_load.rs at python-api · processing/libprocessing Expand file tree/ Copy pathgltf_load.rsMore file actions 71 lines (55 loc) · 2 KB / Copy pathgltf_load.rsFile metadata and controls71 lines (55 loc) · 2 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 use processing_glfw::GlfwContext; use bevy::math::Vec3; use processing::prelude::*; use processing_render::render::command::DrawCommand; use processing_render::shader_value::ShaderValue; 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 width = 800; let height = 600; let mut glfw_ctx = GlfwContext::new(width, height, false)?; init(Config::default())?; let surface = glfw_ctx.create_surface(width, height, false)?; let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?; let gltf = gltf_load(graphics, "gltf/Duck.glb")?; let duck = gltf_geometry(gltf, "LOD3spShape")?; let duck_mat = gltf_material(gltf, "blinn3-fx")?; graphics_mode_3d(graphics)?; gltf_camera(gltf, 0)?; let light = gltf_light(gltf, 0)?; let mut frame: u64 = 0; while glfw_ctx.poll_events() { let t = frame as f32 * 0.02; let radius = 1.5; let lx = t.cos() * radius; let ly = 1.5; let lz = t.sin() * radius; transform_set_position(light, Vec3::new(lx, ly, lz))?; transform_look_at(light, Vec3::new(0.0, 0.8, 0.0))?; let r = (t * 8.0).sin() * 0.5 + 0.5; let g = (t * 8.0 + 2.0).sin() * 0.5 + 0.5; let b = (t * 8.0 + 4.0).sin() * 0.5 + 0.5; material_set(duck_mat, "base_color", ShaderValue::Float4([r, g, b, 1.0]))?; graphics_begin_draw(graphics)?; graphics_record_command( graphics, DrawCommand::BackgroundColor(bevy::color::Color::srgb(0.1, 0.1, 0.12)), )?; graphics_record_command(graphics, DrawCommand::Material(duck_mat))?; graphics_record_command(graphics, DrawCommand::Geometry(duck))?; graphics_end_draw(graphics)?; frame += 1; } Ok(()) } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |