#bindings #automatic #built #linked #statically #glutin #horde3-d

sys horde3d-sys

FFI 绑定用于 Horde3D v1.0,Horde3D 自动构建并静态链接

2 个版本

使用旧的 Rust 2015

0.1.1 2017年11月28日
0.1.0 2017年11月21日

#54 in 渲染引擎

EPL-1.0 许可证

7MB
47K SLoC

C++ 39K SLoC // 0.2% comments C# 3.5K SLoC // 0.4% comments ShaderLab 2.5K SLoC // 0.1% comments Rust 1K SLoC .NET Resource 561 SLoC // 0.5% comments GLSL 508 SLoC // 0.3% comments JavaScript 112 SLoC // 0.2% comments Batch 22 SLoC Lua 16 SLoC // 0.3% comments

用于 Rust 的低级 Horde3D 绑定

crates.io

此包公开了原始的 Horde3D API,因此适用 Horde3D 手册

要求

  • 构建基本工具(gcc 等)

示例

extern crate glutin;
extern crate horde3d_sys;

use glutin::GlContext;

fn main() {
    let mut events_loop = glutin::EventsLoop::new();
    let window = glutin::WindowBuilder::new()
        .with_title("Dungeon")
        .with_dimensions(1024, 768);
    let context = glutin::ContextBuilder::new()
        .with_vsync(true)
        .with_gl(glutin::GlRequest::Latest)
        .with_gl_profile(glutin::GlProfile::Core);
    let gl_window = glutin::GlWindow::new(window, context, &events_loop).unwrap();

    unsafe {
        gl_window.context().make_current().unwrap();
        eprintln!("{:?}", horde3d_sys::h3dInit(horde3d_sys::H3DRenderDevice::OpenGL4));
    }

    let mut running = true;
    while running {
        events_loop.poll_events(|event| {
            match event {
                glutin::Event::WindowEvent{ event, .. } => match event {
                    glutin::WindowEvent::Closed => running = false,
                    glutin::WindowEvent::Resized(w, h) => gl_window.resize(w, h),
                    _ => ()
                },
                _ => ()
            }
        });

        gl_window.swap_buffers().unwrap();
    }

    unsafe {
        horde3d_sys::h3dRelease();
    }
}

无运行时依赖