Crates.io | gl_matrix |
lib.rs | gl_matrix |
version | 0.0.2 |
source | src |
created_at | 2020-05-02 19:31:21.571363 |
updated_at | 2020-05-03 20:03:40.291808 |
description | A Rust implementation of glMatrix |
homepage | https://crates.io/crates/gl_matrix |
repository | https://github.com/sognefej/gl-matrix |
max_upload_size | |
id | 236762 |
size | 304,271 |
A Rust implementation of glMatrix
gl_matrix provides utilities or all glMatrix functions in Rust.
Getting started should be easy if you are already familiar with glMatrix and Rust. All functions have been re-named to be idiomatic Rust.
use gl_matrix::common::*;
use gl_matrix::{vec3, mat4};
let canvas_w = 800_f32;
let canvas_h = 600_f32;
let mut world_matrix: Mat4 = [0.; 16];
let mut view_matrix: Mat4 = [0.; 16];
let mut proj_matrix: Mat4 = [0.; 16];
let eye = vec3::from_values(0., 0., -8.);
let center = vec3::from_values(0., 0., 0.);
let up = vec3::from_values(0., 1., 0.);
mat4::identity(&mut world_matrix);
mat4::look_at(&mut view_matrix, &eye, ¢er, &up);
mat4::perspective(&mut proj_matrix, to_radian(45.), canvas_w / canvas_h, 0.1, Some(100.0));
Add this to your Cargo.toml
:
[dependencies]
gl_matrix = 0.0
See CONTRIBUTING.md
gl-matrix is under the terms of the MIT license.