Kiss3d - Keep it simple, stupid 3d graphics engine for Rust.

Related tags

Graphics kiss3d
Overview

Kiss3d

Keep It Simple, Stupid 3d graphics engine.

This library is born from the frustration that today’s 3D graphics library are either:

  • Too low level: you have to write your own shaders and opening a window takes 8 hours, 300 lines of code and 10L of coffee.
  • High level, but too hard to understand/use: these libraries are made to create beautiful photoreal (or close to it) animations or games. They have many features; too many, in fact, if you just want to draw a few objects on the screen with as little friction as possible.

kiss3d is not designed to be feature-complete or fast. It is designed to let you draw simple geometric figures and play with them with as little friction as possible.

An online version of this documentation is available here.

Features

  • WASM compatible.
  • Out of the box, open a window with a default arc-ball camera and a point light.
  • First-person camera available as well, and user-defined cameras are possible.
  • Render boxes, spheres, cones, cylinders, quads and lines simply
  • Change an object's color or texture.
  • Change an object's transform (we use nalgebra to do that).
  • Create basic post-processing effects.

As an example, creating a scene with a red, rotating cube with a light attached to the camera is as simple as (NOTE: this will not compile when targeting WASM):

extern crate kiss3d;
extern crate nalgebra as na;

use na::{Vector3, UnitQuaternion};
use kiss3d::window::Window;
use kiss3d::light::Light;

fn main() {
    let mut window = Window::new("Kiss3d: cube");
    let mut c      = window.add_cube(1.0, 1.0, 1.0);

    c.set_color(1.0, 0.0, 0.0);

    window.set_light(Light::StickToCamera);

    let rot = UnitQuaternion::from_axis_angle(&Vector3::y_axis(), 0.014);

    while window.render() {
        c.prepend_to_local_rotation(&rot);
    }
}

Making the same example compatible with both WASM and native platforms is slightly more complicated because kiss3d must control the render loop:

extern crate kiss3d;
extern crate nalgebra as na;

use kiss3d::light::Light;
use kiss3d::scene::SceneNode;
use kiss3d::window::{State, Window};
use na::{UnitQuaternion, Vector3};

struct AppState {
    c: SceneNode,
    rot: UnitQuaternion<f32>,
}

impl State for AppState {
    fn step(&mut self, _: &mut Window) {
        self.c.prepend_to_local_rotation(&self.rot)
    }
}

fn main() {
    let mut window = Window::new("Kiss3d: wasm example");
    let mut c = window.add_cube(1.0, 1.0, 1.0);

    c.set_color(1.0, 0.0, 0.0);

    window.set_light(Light::StickToCamera);

    let rot = UnitQuaternion::from_axis_angle(&Vector3::y_axis(), 0.014);
    let state = AppState { c, rot };

    window.render_loop(state)
}

Some controls are handled by default by the engine (they can be overridden by the user):

  • scroll: zoom in / zoom out.
  • left click + drag: look around.
  • right click + drag: translate the view point.
  • enter: look at the origin (0.0, 0.0, 0.0).

Compilation

You will need the last stable build of the rust compiler and the official package manager: cargo.

Simply add the following to your Cargo.toml file:

[dependencies]
kiss3d = "0.29"

Contributions

I’d love to see people improving this library for their own needs. However, keep in mind that kiss3d is KISS. One-liner features (from the user point of view) are preferred.

Acknowledgements

Thanks to all the Rustaceans for their help, and their OpenGL bindings.

Comments
  • Can't build with rust 0.10

    Can't build with rust 0.10

    Hi, I'm using the last stable rust release and getting this error after make:

    > make
    mkdir -p lib
    rustc src/lib.rs --opt-level 3 --out-dir lib -Llib/glfw-rs/lib -Llib/gl-rs -Llib/nalgebra/lib -Llib/rust-stb-image/ -Llib/rust-freetype/
    src/lib.rs:103:1: 103:19 error: can't find crate for `libc`
    src/lib.rs:103 extern crate libc;
                   ^~~~~~~~~~~~~~~~~~
    error: aborting due to previous error
    make: *** [all] Error 101
    
    > rustc -v
    rustc 0.10 (46867cc 2014-04-02 16:59:39 -0700)
    host: i686-apple-darwin
    
    opened by shirokoff 12
  • Bump nalgebra to a safe version

    Bump nalgebra to a safe version

    Hey,

    This bumps version of nalgebra to new version which should be safe from https://github.com/dimforge/nalgebra/issues/883

    I noticed issue mentioning that you don't have time to actively maintain this crate anymore so I figured I might save you some by just creating this PR myself even when it's a simple one.

    I also saw that https://github.com/sebcrozet/kiss3d/pull/280 exists but it seems that it missed updating the dev-dependencies

    Testing

    Since this crate doesn't have many tests I tested it by running the examples to make sure they work. I did this on a linux machine but I think it's pretty safe to assume that it doesn't break anything on other platforms.

    opened by dmweis 11
  • Improve webgl_canvas mouse event handling and fix mouse coordinates

    Improve webgl_canvas mouse event handling and fix mouse coordinates

    A previous version of this PR narrowed the event listeners target, introduced the use of pointer events to enable pointer capturing via setPointerCapture and added some cleanup code. Following the comments, part of this PR was split into another PR #219. The current PR focuses on improving the mouse event handling without using pointer event.

    opened by alvinhochun 8
  • 0.28.0 broken on macOS

    0.28.0 broken on macOS

       Compiling kiss3d v0.28.0
    error[E0432]: unresolved import `glutin::platform::unix`
      --> /Users/moritz/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.28.0/src/window/gl_canvas.rs:40:35
       |
    40 |             use glutin::platform::unix::EventLoopExtUnix;
       |                                   ^^^^ could not find `unix` in `platform`
    
    error[E0599]: no function or associated item named `new_any_thread` found for struct `EventLoop<_>` in the current scope
      --> /Users/moritz/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.28.0/src/window/gl_canvas.rs:41:24
       |
    41 |             EventLoop::new_any_thread()
       |                        ^^^^^^^^^^^^^^ function or associated item not found in `EventLoop<_>`
    
    error[E0308]: mismatched types
      --> /Users/moritz/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.28.0/src/window/gl_canvas.rs:79:13
       |
    79 |             events,
       |             ^^^^^^ expected struct `EventLoop`, found struct `EventLoopWindowTarget`
       |
       = note: expected struct `EventLoop<()>`
                  found struct `EventLoopWindowTarget<_>`
    
    error: aborting due to 3 previous errors
    
    opened by virtualritz 7
  • Switch to web-sys instead of stdweb.

    Switch to web-sys instead of stdweb.

    It appears that stdweb is mostly dead so I would like to switch to web-sys/wasm-bindgen instead. This is a breaking change because:

    • This completely removes the stdweb dependency in favor of web-sys.
    • This uses glow instead of our generated webgl/opengl bindings.
    opened by sebcrozet 7
  • Proof-of-concept of splitting Conrod UI into separate crate

    Proof-of-concept of splitting Conrod UI into separate crate

    I tried adding hooks for GUI support and splitting the Conrod UI integration code into a separate crate. The idea is that it might allow integration with other UI libraries to be written and that they can be conveniently plugged in. Here is a proof-of-concept.

    • I added a trait window::UiContext which replaces the existing ConrodContext struct inside kiss3d.
    • The actual Conrod code (including the ConrodContext struct and conrod_renderer) are moved to a separate crate kiss3d_conrod
      • This has the same name as the previously-vendored conrod_core crate. I figured that since it is no longer needed, perhaps the name can be reused?
    • In the non-generic version the UI as a field in Window has the type Option<Rc<RefCell<dyn UiContext>>>. ~~I have tried to make it the UiContext a generic parameter of Window (with a dummy context as default), but the generic parameter would leak into window::State~~ This is what it would look like if a generic parameter is used and I am not sure if it is really a good idea. What is your opinion @sebcrozet?

    Run cargo run -p kiss3d_conrod --example ui to run the example.

    (I might want to try implementing a UI integration with iced using this as a basis.)

    opened by alvinhochun 7
  • window.rs:327:38: 327:67 error: mismatched types: expected `*const std::os::raw::c_void`, found `*const libc::c_void`

    window.rs:327:38: 327:67 error: mismatched types: expected `*const std::os::raw::c_void`, found `*const libc::c_void`

    When attempting to build the readme sample (and installing opengl freeglut3-dev, and randr xorg-dev libglu1-mesa-dev) I'm getting this:

    Executing: cargo build 
       Compiling kiss3d v0.1.4 (https://github.com/sebcrozet/kiss3d#98f00870)
    ~/.cargo/git/checkouts/kiss3d-fdfcc5cc23d2dd9f/master/src/window/window.rs:327:38: 327:67 error: mismatched types:
     expected `*const std::os::raw::c_void`,
        found `*const libc::c_void`
    (expected enum `std::os::raw::c_void`,
        found enum `libc::c_void`) [E0308]
    ~/.cargo/git/checkouts/kiss3d-fdfcc5cc23d2dd9f/master/src/window/window.rs:327         verify!(gl::load_with(|name| window.get_proc_address(name)));
                                                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~/.cargo/git/checkouts/kiss3d-fdfcc5cc23d2dd9f/master/src/window/window.rs:327:9: 327:70 note: in this expansion of verify! (defined in ~/.cargo/git/checkouts/kiss3d-fdfcc5cc23d2dd9f/master/src/error.rs)
    ~/.cargo/git/checkouts/kiss3d-fdfcc5cc23d2dd9f/master/src/window/window.rs:327:38: 327:67 help: run `rustc --explain E0308` to see a detailed explanation
    error: aborting due to previous error
    Could not compile `kiss3d`.
    

    The readme says that the latest nightlies of rust are required, but that was edited a long time ago so is that still necessary?

    opened by MrAndMrsK 7
  • Changing rotation (i.e. up-vector) of camera?

    Changing rotation (i.e. up-vector) of camera?

    I cannot for the life of me figure out how to change the rotation of the camera. By rotation I mean rotation with respect to the direction the camera is pointing, i.e. changing the up vector, or, I think, the "roll" of the camera. Am I simply looking in the wrong places?

    opened by Andlon 6
  • Linker error on OS X

    Linker error on OS X

    dev ➤ git clone --recursive git://github.com/sebcrozet/kiss3d.git
    Cloning into 'kiss3d'...
    remote: Reusing existing pack: 3137, done.
    remote: Counting objects: 261, done.
    remote: Compressing objects: 100% (256/256), done.
    remote: Total 3398 (delta 160), reused 0 (delta 0)
    Receiving objects: 100% (3398/3398), 2.45 MiB | 857.00 KiB/s, done.
    Resolving deltas: 100% (2306/2306), done.
    Checking connectivity... done.
    Submodule 'lib/gl-rs' (git://github.com/sebcrozet/gl-rs.git) registered for path 'lib/gl-rs'
    Submodule 'lib/glfw-rs' (https://github.com/sebcrozet/glfw-rs.git) registered for path 'lib/glfw-rs'
    Submodule 'lib/nalgebra' (https://github.com/sebcrozet/nalgebra.git) registered for path 'lib/nalgebra'
    Submodule 'lib/ncollide' (git://github.com/sebcrozet/ncollide.git) registered for path 'lib/ncollide'
    Submodule 'lib/rust-ffmpeg' (git://github.com/sebcrozet/rust-ffmpeg.git) registered for path 'lib/rust-ffmpeg'
    Submodule 'lib/rust-freetype' (git://github.com/sebcrozet/rust-freetype.git) registered for path 'lib/rust-freetype'
    Submodule 'lib/rust-stb-image' (https://github.com/sebcrozet/rust-stb-image.git) registered for path 'lib/rust-stb-image'
    Cloning into 'lib/gl-rs'...
    remote: Reusing existing pack: 938, done.
    remote: Counting objects: 55, done.
    remote: Compressing objects: 100% (41/41), done.
    remote: Total 993 (delta 18), reused 31 (delta 7)
    Receiving objects: 100% (993/993), 1.88 MiB | 876.00 KiB/s, done.
    Resolving deltas: 100% (429/429), done.
    Checking connectivity... done.
    Submodule path 'lib/gl-rs': checked out '708ba0dc29738e7dd95fb93a40a0f5ed4e3a91c9'
    Submodule 'deps/glfw-rs' (https://github.com/bjz/glfw-rs.git) registered for path 'deps/glfw-rs'
    Submodule 'deps/khronos-api' (https://github.com/bjz/khronos-api.git) registered for path 'deps/khronos-api'
    Submodule 'deps/sax-rs' (https://github.com/bjz/sax-rs.git) registered for path 'deps/sax-rs'
    Cloning into 'deps/glfw-rs'...
    remote: Reusing existing pack: 3266, done.
    remote: Counting objects: 17, done.
    remote: Compressing objects: 100% (17/17), done.
    remote: Total 3283 (delta 1), reused 0 (delta 0)
    Receiving objects: 100% (3283/3283), 906.46 KiB | 819.00 KiB/s, done.
    Resolving deltas: 100% (1683/1683), done.
    Checking connectivity... done.
    Submodule path 'lib/gl-rs/deps/glfw-rs': checked out '61518cbd524d33411622c86352e9b4343b4fee90'
    Cloning into 'deps/khronos-api'...
    remote: Reusing existing pack: 1272, done.
    remote: Total 1272 (delta 0), reused 0 (delta 0)
    Receiving objects: 100% (1272/1272), 2.17 MiB | 1004.00 KiB/s, done.
    Resolving deltas: 100% (1116/1116), done.
    Checking connectivity... done.
    Submodule path 'lib/gl-rs/deps/khronos-api': checked out '95c43bdb7dd4e69145fa0025d142cec7cae89349'
    Cloning into 'deps/sax-rs'...
    remote: Reusing existing pack: 391, done.
    remote: Counting objects: 8, done.
    remote: Compressing objects: 100% (8/8), done.
    remote: Total 399 (delta 0), reused 0 (delta 0)
    Receiving objects: 100% (399/399), 84.00 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (197/197), done.
    Checking connectivity... done.
    Submodule path 'lib/gl-rs/deps/sax-rs': checked out 'a5ae75fa386534226c8c3082c607b696c2c30382'
    Cloning into 'lib/glfw-rs'...
    remote: Counting objects: 3326, done.
    remote: Compressing objects: 100% (1441/1441), done.
    remote: Total 3326 (delta 1703), reused 3307 (delta 1695)
    Receiving objects: 100% (3326/3326), 909.69 KiB | 860.00 KiB/s, done.
    Resolving deltas: 100% (1703/1703), done.
    Checking connectivity... done.
    Submodule path 'lib/glfw-rs': checked out '61518cbd524d33411622c86352e9b4343b4fee90'
    Cloning into 'lib/nalgebra'...
    remote: Reusing existing pack: 3452, done.
    remote: Total 3452 (delta 0), reused 0 (delta 0)
    Receiving objects: 100% (3452/3452), 1.76 MiB | 1.20 MiB/s, done.
    Resolving deltas: 100% (2182/2182), done.
    Checking connectivity... done.
    Submodule path 'lib/nalgebra': checked out '997cd4f888f86c2f566c8c7343be14528ce344b2'
    Cloning into 'lib/ncollide'...
    remote: Reusing existing pack: 11168, done.
    remote: Counting objects: 52, done.
    remote: Compressing objects: 100% (52/52), done.
    remote: Total 11220 (delta 10), reused 0 (delta 0)
    Receiving objects: 100% (11220/11220), 3.36 MiB | 1.37 MiB/s, done.
    Resolving deltas: 100% (8631/8631), done.
    Checking connectivity... done.
    Submodule path 'lib/ncollide': checked out '7e58377b421eae4b298c8e53dc4d6085efaececb'
    Submodule 'nalgebra' (git://github.com/sebcrozet/nalgebra) registered for path 'nalgebra'
    Cloning into 'nalgebra'...
    remote: Reusing existing pack: 3452, done.
    remote: Total 3452 (delta 0), reused 0 (delta 0)
    Receiving objects: 100% (3452/3452), 1.76 MiB | 1.16 MiB/s, done.
    Resolving deltas: 100% (2182/2182), done.
    Checking connectivity... done.
    Submodule path 'lib/ncollide/nalgebra': checked out '997cd4f888f86c2f566c8c7343be14528ce344b2'
    Cloning into 'lib/rust-ffmpeg'...
    remote: Reusing existing pack: 352, done.
    remote: Counting objects: 32, done.
    remote: Compressing objects: 100% (16/16), done.
    remote: Total 384 (delta 8), reused 19 (delta 5)
    Receiving objects: 100% (384/384), 199.94 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (167/167), done.
    Checking connectivity... done.
    Submodule path 'lib/rust-ffmpeg': checked out 'af16cd0f5f217d25615793f8f86a0be33b10b8a4'
    Cloning into 'lib/rust-freetype'...
    remote: Reusing existing pack: 233, done.
    remote: Counting objects: 17, done.
    remote: Compressing objects: 100% (17/17), done.
    remote: Total 250 (delta 7), reused 4 (delta 0)
    Receiving objects: 100% (250/250), 60.29 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (133/133), done.
    Checking connectivity... done.
    Submodule path 'lib/rust-freetype': checked out 'b4f6f7a4a0b99eeccd14c45ba6436debb2fd90a2'
    Cloning into 'lib/rust-stb-image'...
    remote: Counting objects: 318, done.
    remote: Compressing objects: 100% (145/145), done.
    remote: Total 318 (delta 171), reused 318 (delta 171)
    Receiving objects: 100% (318/318), 98.52 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (171/171), done.
    Checking connectivity... done.
    Submodule path 'lib/rust-stb-image': checked out 'b91a0d0f4143cd950b59625fc91173025932703d'
    dev ➤ cd kiss3d
    kiss3d ➤ make deps                                                                                                                                git:master
    make lib -C lib/glfw-rs
    sh etc/link-rs.sh "-lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo " > src/link.rs
    mkdir -p lib
    rustc  --out-dir=lib -O src/glfw.rs
    make -C lib/nalgebra
    mkdir -p lib
    rustc src/lib.rs --out-dir lib --opt-level 3
    rustc src/lib.rs --out-dir lib --crate-type dylib --opt-level 3
    make deps -C lib/ncollide
    make -C nalgebra
    mkdir -p lib
    rustc src/lib.rs --out-dir lib --opt-level 3
    rustc src/lib.rs --out-dir lib --crate-type dylib --opt-level 3
    make 3df32 -C lib/ncollide
    mkdir -p lib
    rustc src/ncollide3df32.rs -L./nalgebra/lib --out-dir lib --opt-level 3 --cfg dim3
    src/narrow/bezier_surface_bezier_surface.rs:55:26: 55:28 warning: unused variable: `ma`, #[warn(unused_variable)] on by default
    src/narrow/bezier_surface_bezier_surface.rs:55     fn update(&mut self, ma: &Matrix, a: &BezierSurface, mb: &Matrix, b: &BezierSurface) {
                                                                            ^~
    src/narrow/bezier_surface_bezier_surface.rs:55:39: 55:40 warning: unused variable: `a`, #[warn(unused_variable)] on by default
    src/narrow/bezier_surface_bezier_surface.rs:55     fn update(&mut self, ma: &Matrix, a: &BezierSurface, mb: &Matrix, b: &BezierSurface) {
                                                                                         ^
    src/narrow/bezier_surface_bezier_surface.rs:55:58: 55:60 warning: unused variable: `mb`, #[warn(unused_variable)] on by default
    src/narrow/bezier_surface_bezier_surface.rs:55     fn update(&mut self, ma: &Matrix, a: &BezierSurface, mb: &Matrix, b: &BezierSurface) {
                                                                                                            ^~
    src/narrow/bezier_surface_bezier_surface.rs:55:71: 55:72 warning: unused variable: `b`, #[warn(unused_variable)] on by default
    src/narrow/bezier_surface_bezier_surface.rs:55     fn update(&mut self, ma: &Matrix, a: &BezierSurface, mb: &Matrix, b: &BezierSurface) {
                                                                                                                         ^
    src/partitioning/dbvt.rs:155:23: 155:42 warning: private type in exported type signature, #[warn(visible_private_types)] on by default
    src/partitioning/dbvt.rs:155     RightChildOf(*mut DBVTInternal<B, BV>),
                                                       ^~~~~~~~~~~~~~~~~~~
    src/partitioning/dbvt.rs:157:22: 157:41 warning: private type in exported type signature, #[warn(visible_private_types)] on by default
    src/partitioning/dbvt.rs:157     LeftChildOf(*mut DBVTInternal<B, BV>),
                                                      ^~~~~~~~~~~~~~~~~~~
    make -C lib/gl-rs
    make lib -C deps/sax-rs
    mkdir -p lib
    rustc --out-dir=lib -O src/sax/lib.rs
    rustc -L deps/sax-rs/lib src/gen/main.rs -o bin/glrsgen
    src/gen/main.rs:65:42: 65:56 warning: use of deprecated item: use `Show` (`{}` format specifier), #[warn(deprecated)] on by default
    src/gen/main.rs:65         Err(x) => fail!("Error: {}\n{}", x.to_err_msg(), usage("glrsgen", opts)),
                                                                ^~~~~~~~~~~~~~
    note: in expansion of format_args!
    <std macros>:24:9: 25:6 note: expansion site
    <std macros>:1:1: 26:2 note: in expansion of fail!
    src/gen/main.rs:65:19: 65:82 note: expansion site
    bin/glrsgen --namespace gl --api gl --profile core --version 4.3 --xml deps/khronos-api/gl.xml   > src/gl.rs
    rustc src/gl.rs -O --out-dir=lib
    mkdir -p examples
    make lib -C deps/glfw-rs
    sh etc/link-rs.sh "-lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo " > src/link.rs
    mkdir -p lib
    rustc  --out-dir=lib -O src/glfw.rs
    rustc -L deps/glfw-rs/lib -L lib --out-dir=examples src/examples/basic.rs
    rustc -L deps/glfw-rs/lib -L lib --out-dir=examples src/examples/triangle.rs
    rustdoc -o doc src/gl.rs
    cd lib/rust-stb-image; ./configure
    make clean -C lib/rust-stb-image
    rm -f *.o *.a *.so *.dylib *.rlib *.dll *.dummy *-test
    make -C lib/rust-stb-image
    cc stb_image.c -o stb_image.o -c -fPIC
    ar rcs libstb-image.a stb_image.o
    rustc  lib.rs --out-dir .
    stb_image.rs:28:5: 28:14 warning: code is never used: `read`, #[warn(dead_code)] on by default
    stb_image.rs:28     read: *u8,
                        ^~~~~~~~~
    stb_image.rs:29:5: 29:14 warning: code is never used: `skip`, #[warn(dead_code)] on by default
    stb_image.rs:29     skip: *u8,
                        ^~~~~~~~~
    stb_image.rs:30:5: 30:13 warning: code is never used: `eof`, #[warn(dead_code)] on by default
    stb_image.rs:30     eof: *u8,
                        ^~~~~~~~
    touch libstb-image.dummy
    cd lib/rust-freetype; ./configure
    make clean -C lib/rust-freetype
    rm -f *.o *.a *.so *.dylib *.rlib *.dll *.dummy *-test
    make -C lib/rust-freetype
    rustc  freetype.rc --out-dir .
    touch librustfreetype.dummy
    kiss3d ➤ make                                                                                                                                     git:master
    mkdir -p lib
    rustc src/lib.rs --opt-level 3 --out-dir lib -Llib/glfw-rs/lib -Llib/gl-rs/lib -Llib/nalgebra/lib -Llib/rust-stb-image/ -Llib/rust-freetype/ -Llib/rust-ffmpeg/lib -Llib/ncollide/lib
    cd lib/rust-ffmpeg; ./build.sh
    Building src/avutil52 ...
    error: linking with `cc` failed: exit code: 1
    note: cc '-m64' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-o' 'lib/libavutil52-27cdbde1-0.0.dylib' 'lib/avutil52.o' '-Wl,-force_load,/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a' 'lib/avutil52.metadata.o' '-nodefaultlibs' '-Wl,-dead_strip' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lstd-59beb4f7-0.11.0-pre' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lsync-305341d2-0.11.0-pre' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lrustrt-d8560cb2-0.11.0-pre' '-L' 'lib' '-L' '/Users/bzabarauskas/dev/kiss3d/lib/rust-ffmpeg/.rust' '-L' '/Users/bzabarauskas/dev/kiss3d/lib/rust-ffmpeg' '-lavutil' '-lSystem' '-lpthread' '-lc' '-lm' '-dynamiclib' '-Wl,-dylib' '-Wl,-install_name,@rpath/libavutil52-27cdbde1-0.0.dylib' '-Wl,-rpath,@loader_path/../../../../../../../usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-Wl,-rpath,/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lcompiler-rt'
    note: ld: warning: directory not found for option '-L/Users/bzabarauskas/dev/kiss3d/lib/rust-ffmpeg/.rust'
    ld: library not found for -lavutil
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    error: aborting due to previous error
    make: *** [deps_recording] Error 1
    
    opened by brendanzab 6
  • canvas: Force correct drop order when render_loop ends

    canvas: Force correct drop order when render_loop ends

    First time contributing to this repo, lemme know if this PR is stylistically okay.


    After switching my application to use the State-based setup (see examples/persistent_point_cloud.rs for an example), I would get errors when closing the window:

    thread 'main' panicked at 'assertion failed: `(left == right)`
      left: `1282`,
     right: `0`', C:\Users\Henry\.cargo\registry\src\github.com-1ecc6299db9ec823\kiss3d-0.31.0\src\resource\effect.rs:93:12
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    thread 'main' panicked at 'assertion failed: `(left == right)`
      left: `1282`,
     right: `0`', C:\Users\Henry\.cargo\registry\src\github.com-1ecc6299db9ec823\kiss3d-0.31.0\src\resource\effect.rs:93:12
    stack backtrace:
       0:     0x7ff64cfe157e - std::backtrace_rs::backtrace::dbghelp::trace
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
       1:     0x7ff64cfe157e - std::backtrace_rs::backtrace::trace_unsynchronized
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
       2:     0x7ff64cfe157e - std::sys_common::backtrace::_print_fmt
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:67
       3:     0x7ff64cfe157e - std::sys_common::backtrace::_print::{{impl}}::fmt
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:46
       4:     0x7ff64cff626c - core::fmt::write
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\core\src\fmt\mod.rs:1092
       5:     0x7ff64cfdf068 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\io\mod.rs:1572
       6:     0x7ff64cfe402d - std::sys_common::backtrace::_print
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:49
       7:     0x7ff64cfe402d - std::sys_common::backtrace::print
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:36
       8:     0x7ff64cfe402d - std::panicking::default_hook::{{closure}}
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:208
       9:     0x7ff64cfe3af9 - std::panicking::default_hook
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:225
      10:     0x7ff64cfe46d3 - std::panicking::rust_panic_with_hook
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:591
      11:     0x7ff64cfe4281 - std::panicking::begin_panic_handler::{{closure}}
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:497
      12:     0x7ff64cfe1e9f - std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!>
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:141
      13:     0x7ff64cfe41d9 - std::panicking::begin_panic_handler
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:493
      14:     0x7ff64cffdbe0 - core::panicking::panic_fmt
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\core\src\panicking.rs:92
      15:     0x7ff64cff407a - core::fmt::Arguments::new_v1
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\core\src\fmt\mod.rs:314
      16:     0x7ff64cff407a - core::panicking::assert_failed::inner
                                   at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\core\src\panicking.rs:135
      17:     0x7ff64ceb84dd - core::panicking::assert_failed<u32,u32>
                                   at C:\Users\Henry\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panicking.rs:143
      18:     0x7ff64cdf8782 - kiss3d::resource::effect::{{impl}}::drop
                                   at C:\Users\Henry\.cargo\registry\src\github.com-1ecc6299db9ec823\kiss3d-0.31.0\src\resource\effect.rs:93
      19:     0x7ff64cd9ce4e - core::ptr::drop_in_place<kiss3d::resource::effect::Effect>
                                   at C:\Users\Henry\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs:187
      20:     0x7ff64cd9d743 - core::ptr::drop_in_place<kiss3d::renderer::line_renderer::LineRenderer>
    

    After enabling the logging in the glow crate, I found that the program for the LineRenderer object in my state was suddenly becoming invalid before I could call IsProgram and DeleteProgram on it. (Those are from the Drop impl for Effect.)

    The issued turned out to be that we were dropping the window before the state, and since the window holds the OpenGL context, when we tried to drop the state, we got errors.

    This diff introduces a new struct that enforces the proper drop order, and hides it behind a trait.

    bug 
    opened by HenrySwanson 5
  • Add basic cubemap support.

    Add basic cubemap support.

    While working on a game prototype using kiss3d, I realized one thing that was missing in the base library was cubemap/skybox support. I think adding support for this is generally useful for 3D prototyping, and if it's possible with a one liner, all the better.

    Still TODO:

    • [ ] WASM support
    • [x] Make typesafe
    • [x] Internalize skybox material
    • [x] Benchmark startup time (not sure where this is coming from)
    • [x] Add skybox texture to demo (cat pictures are cute, but it really ought to demo how different sides can be shown)
    • [x] Docs
    opened by charles-l 5
  • `Key::Return` event not getting through on Linux/KDE

    `Key::Return` event not getting through on Linux/KDE

    I am running my code that works fine on macOS/Windows on a Kubuntu 22.04 under KDE and the Key::Return arm of my match never executes. All other key events in that code work as expected on that platform.

    Is this a known issue?

    bug 
    opened by virtualritz 0
  • Always enable optimizations on image loader

    Always enable optimizations on image loader

    The examples that involve textures show a noticeable delay at start in dev mode; the delay is not there in release mode. I tracked this down to the image library. This commit changes the profile for the image library and the jpg and png decoding libraries to use optimizations and disable debug assertions.

    opened by RaduBerinde 3
  • NormalsMaterial / UvsMaterial not working

    NormalsMaterial / UvsMaterial not working

    I tried switching to NormalsMaterial or UvsMaterial and neither seems to be working (the shapes I apply the material to don't show up). I tried comparing the code to ObjectsMaterial and couldn't find anything materially different in the use of underlying APIs, so I don't know what's not working. Tried messing around with the shaders (eg to always show white) but still nothing shows up. I can create my own material (starting from ObjectsMaterial) and I can make it show normals or UVs and that works fine.

    In any case, I think it would be worth it to have an example with all materials just so the code doesn't rot.

    bug help wanted 
    opened by RaduBerinde 0
  • Document planar coordinate system

    Document planar coordinate system

    It's not very clear what coordinate system that planar coordinates use - i.e. what coordinates represent the corners of the window.

    FixedView does not have any configuration parameters while Sidescroll only has a multiplier for zoom.

    opened by ColonelThirtyTwo 1
Owner
Sébastien Crozet
Sébastien Crozet
A little cross-platform graphics engine written in rust.

Bismuth This is a version of my C++ graphics engine named Bismuth re-written with Rust. My goal is to learn more about the Rust language and make my g

Admiral サイタマ 1 Nov 1, 2021
A vector graphics renderer using OpenGL with a Rust & C API.

bufro A vector graphics renderer using OpenGL with a Rust & C API. A Rust example can be found in examples/quickstart.rs (using glutin). A C example c

Aspect 9 Dec 15, 2022
Rust bindings to bgfx, a cross-platform, graphics API agnostic

Rust bindings to bgfx, a cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

Daniel Collin 65 Dec 24, 2022
Generic framebuffer implementation in Rust for use with embedded-graphics library

Fraramebuffer implementation for Rust's Embedded-graphics Framebuffer approach helps to deal with display flickering when you update multiple parts of

Bernard Kobos 9 Nov 29, 2022
A 2D vector graphics library optimized for GUIs, written in Rust and wgpu

RootVG A 2D vector graphics library optimized for GUIs, written in Rust and wgpu How it Works Unlike other 2D vector graphics libraries which have a s

Meadowlark 14 Jul 10, 2024
wgpugd: A WebGPU Graphics Device for R

wgpugd: A WebGPU Graphics Device for R Overview What is WebGPU? WebGPU is an API that exposes the capabilities of GPU hardware. What is wgpu? As the n

Hiroaki Yutani 42 Dec 11, 2022
Graphite is a digital content creation software package for 2D graphics

Powerful 2D vector and raster editing. Procedural and nondestructive. Graphite is a digital content creation software package for 2D graphics, merging

Graphite 2.1k Jan 9, 2023
Baryon is a compact 3D engine focused on fast prototyping in code.

baryon Baryon is a compact 3D engine focused on fast prototyping in code. No big dependencies, no fancy run-times, GUI editors, or other magic. Depend

Dzmitry Malyshau 63 Jan 1, 2023
Simple but powerful graph library for Rust

Graphlib Graphlib is a simple and powerful Rust graph library. This library attempts to provide a generic api for building, mutating and iterating ove

Purple Protocol 177 Nov 22, 2022
A simple and elegant, pipewire graph editor

pw-viz A simple and elegant, pipewire graph editor This is still a WIP, node layouting is kinda jank at the moment. Installation A compiled binary is

null 180 Dec 27, 2022
Simple, performant graph generator for Feynman diagrams* ⚛️

Feynman diagram generator ⚛️ A simple generator of "Feynman diagram" permutations (as defined by problem 781). Incrementally builds isomorphically uni

eugene huang 3 Jan 1, 2023
A toy ray tracer in Rust

tray_rust - A Toy Ray Tracer in Rust tray_rust is a toy physically based ray tracer built off of the techniques discussed in Physically Based Renderin

Will Usher 492 Dec 19, 2022
A low-overhead Vulkan-like GPU API for Rust.

Getting Started | Documentation | Blog gfx-rs gfx-rs is a low-level, cross-platform graphics and compute abstraction library in Rust. It consists of t

Rust Graphics Mages 5.2k Jan 8, 2023
A complete harfbuzz's shaping algorithm port to Rust

rustybuzz rustybuzz is a complete harfbuzz's shaping algorithm port to Rust. Matches harfbuzz v2.7.0 Why? Because you can add rustybuzz = "*" to your

Evgeniy Reizner 310 Dec 22, 2022
An OpenGL function pointer loader for Rust

gl-rs Overview This repository contains the necessary building blocks for OpenGL wrapper libraries. For more information on each crate, see their resp

Brendan Zabarauskas 621 Dec 17, 2022
Safe OpenGL wrapper for the Rust language.

glium Note to current and future Glium users: Glium is no longer actively developed by its original author. That said, PRs are still welcome and maint

null 3.1k Jan 1, 2023
GLFW3 bindings and idiomatic wrapper for Rust.

glfw-rs GLFW bindings and wrapper for The Rust Programming Language. Example extern crate glfw; use glfw::{Action, Context, Key}; fn main() { le

PistonDevelopers 546 Jan 3, 2023
Safe and rich Rust wrapper around the Vulkan API

Vulkano See also vulkano.rs. Vulkano is a Rust wrapper around the Vulkan graphics API. It follows the Rust philosophy, which is that as long as you do

null 3.6k Jan 3, 2023
Graph data structure library for Rust.

petgraph Graph data structure library. Supports Rust 1.41 and later. Please read the API documentation here Crate feature flags: graphmap (default) en

null 2k Jan 9, 2023