2 releases
0.1.1 | Aug 22, 2019 |
---|---|
0.1.0 | Aug 22, 2019 |
#460 in Graphics APIs
10KB
216 lines
transform-matrix
Create transformation matrices for OpenGL in the Rust programming language.
Documentation
Example
A simple example to create a transformation matrix that moves and projects the view:
use transform_matrix::*;
fn main() {
let _t = Transform::new()
.translate(4.0, 5.0, 0.0)
.orthographic(480.0, 360.0, 100.0);
// Use the matrix _t in OpenGL
}
lib.rs
:
Utility for transformation matrix creation
This crate allows the user to create transformation matrices, mostly for the use in OpenGL applications.
Quick Start
You can start by creating a new
Transform
object, then adding
some transformations, and finalizing the transformation
with the
orthographic()
projection.
use transform_matrix::*;
let t = Transform::new()
.translate(2.0, 0.0, 0.0)
.scale(3.0, 0.0, 0.0)
.orthographic(10.0, 10.0, 1.0);
assert_eq!(t, [
[0.6, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0],
[0.20000005, 1.0, -1.0, 1.0]
]);