Crate imagic

Crate imagic 

Source
Expand description

At the moment, Imagic only supports a few features:

  • Materials
    • PBR Material which only supports IBL (image based lighting) now.
    • Unlit Material.
    • Custom Material.

In fact, there is only one Material struct. PBR, Unlit or custom Materials are all implemented by this Material. The differences are the shaders. The Material will parse the shader source to know what uniforms (including their groups and bindings) are needed. So it is easy to custom shader or material.

  • HDR textures
  • Multi camera
  • Render textures, both 2D and Cube
  • Integrated UI framework powered by EGUI
  • Support gltf 2.0 partially
  • Perspective camera and orbit camera controller.

§Examples

There are some examples in folder engine\examples\ on GitHub.

For example, you can run cargo run --example gltf_demo to see the gltf_demo.rs example:

  • hold left mouse button down and move mouse to rotate camera.
  • hold right mouse button down and move mouse to zoom in and out.

Here are some tips:

§The basic boilerplate

fn main() {
    // 1. create the engine instance, which is the core API.
    let options = EngineOptions {
        window_size: WindowSize::new(800.0, 500.0),
        app_name: "lxy gltf demo",
    };
    let mut engine = Engine::new(options);
    // 2. add nodes to scene or add Behaviors, or anything else.
    load_model(&mut engine);
    create_camera(&mut engine);
    add_skybox(&mut engine);
     
    // 3. launch the engine.
    engine.run();
}

For more details, see the primitives_demo.rs, gltf_demo.rs, ibl_demo.rs, unlit_demo.rs or other examples.

Modules§

assets
behaviors
components
core
event
graphics
input
math
prelude
renderer
time
types
utils
window

Macros§

ORR_new
RRB_new
RR_new
impl_as_any
impl_component