Crate deuxfleurs

Source
Expand description

§Deuxfleurs

Documentation

pres

Viewer for geometry processing / meshes / 3d related stuff heavily inspired by polyscope (which is very nice, check it out!).

Can be used in webpages thanks to wasm, so web-based slides can include demos, or simply for making code demo easily accessible on the web. An example can be found here.

§How to use

Here’s a quick example that loads a mesh and uses a button to show/hide it:

use deuxfleurs::load_mesh;
// Init the app
let mut handle = deuxfleurs::init();
// Load the mesh and register it:
let (v, f) = load_mesh("bunny.obj").await.unwrap();
handle.register_surface("bunny", v, f);

// Toggle between shown or not on button pressed
let handle = handle.with_callback(|ui, state| {
    if ui
        .add(egui::Button::new("Toggle shown"))
        .clicked()
    {
        let mut surface = state.get_surface_mut("bunny").unwrap();
        let shown = surface.shown();
        surface.show(!shown);
    }
});

// Run the app
handle.run(
    1080,
    720,
    Some("deuxfleurs-demo"),
);

More examples are available in the corresponding folder.

§Controls

Currently touch constrols are only barely working.

  • Left click: rotate shape
  • Right click: pan shape
  • Mouse wheel: zoom/dezoom
  • Ctrl++: zoom UI
  • Ctrl+-: dezoom UI
  • Ctrl+C: save current camera state to clipboard
  • Ctrl+V: load camera state from clipboard

Re-exports§

pub use egui;

Modules§

attachment
Data associated to a shape which have their own renderer. Wether they are shown or not does not affect other data.
data
Data rendered directly onto the associated shape. Only one can be displayed at a time on the corresponding shape.
internal
Re exported types for visibility
picker
Picked element types
point_cloud
Point clouds structs and associated data/settings
segment
Segment lists structs and associated data/settings
surface
Triangular surfaces structs and associated data/settings
types
General types for genericity in functions parameters.
ui
Custom Ui components for mesh loading

Structs§

Color
RGBA double precision color.
Settings
Global rendering settings

Functions§

init
First initialization of the app. The resulting InitialState can then be used to register geometries and data. It then has to be ran to be displayed.
load_mesh
Helper to load a mesh from an obj file
load_mesh_blocking
Helper to load a mesh from an obj file

Type Aliases§

InitialState
Starting point to build the app.
RunningState
Holds the application state. Starting point to add visualization datas.