gl_matrix

Crates.iogl_matrix
lib.rsgl_matrix
version0.0.2
sourcesrc
created_at2020-05-02 19:31:21.571363
updated_at2020-05-03 20:03:40.291808
descriptionA Rust implementation of glMatrix
homepagehttps://crates.io/crates/gl_matrix
repositoryhttps://github.com/sognefej/gl-matrix
max_upload_size
id236762
size304,271
Eric Sognefest (sognefej)

documentation

https://docs.rs/gl_matrix/

README

gl-matrix

Build Status Coverage Status Crate API

A Rust implementation of glMatrix

gl_matrix provides utilities or all glMatrix functions in Rust.

Quick Start

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, &center, &up);
mat4::perspective(&mut proj_matrix, to_radian(45.), canvas_w / canvas_h, 0.1, Some(100.0));

Features

  • No std
  • Compiles to wasm
  • Familar syntax

Future work

  • Add support for f64 (Currently only f32)
  • Add support for forEach

Examples

Learning Rust WebGL

Usage

Add this to your Cargo.toml:

[dependencies]
gl_matrix = 0.0

Contributing

See CONTRIBUTING.md

License

gl-matrix is under the terms of the MIT license.

LICENSE

Commit count: 69

cargo fmt