Crate glm [] [src]

GLSL mathematics for Rust programming language.

glm-rs is yet another Rust math library for graphics applications. Inspired by the great GLM library for C++, the goal is to provide a familiar math API to programmers who know GLSL as well.

Differences to GLSL specification

Like GLM, following GLSL conventions is a strict policy of glm-rs too. glm crate implements all GLSL data types, operators and built-in functions. However, Rust is not a C-like language, and the syntax/semantics distances from Rust to GLSL is way longer than from C++ to GLSL. This is the major reason of following feature and syntax differences to GLSL specification,

Re-exports

pub use builtin::*;

Modules

builtin

Built-in funcions defined in GLSL specification chapter 8.

ext

Functions that extend the functionalities of GLSL data types.

Macros

assert_approx_eq
assert_close_to

Structs

Matrix2
Matrix3
Matrix4
Matrix2x3
Matrix2x4
Matrix3x2
Matrix3x4
Matrix4x2
Matrix4x3
Vector2
Vector3
Vector4

Traits

ApproxEq

Trait for comparing types that are derived from float numbers.

BaseFloat

Trait for primitive float number type.

BaseInt

Marker trait for primitive integer number type.

BaseNum

Trait for primitive number type.

GenBVec

Generic boolean vector type.

GenFloat

Generic float number type.

GenFloatVec

Generic type of vectors of float number.

GenInt

Generic interger type.

GenMat

Generic Matrix type.

GenNum

Generic numeric type.

GenNumVec

Trait of all vector types that are GenNum.

GenSquareMat

Generic type of square matrix.

GenVec

Generic vector type.

PrimCast

This trait provides parameterized function from.

Primitive

Marker trait for primitive types.

SignedNum

Trait for numerical types that have negative values.

Functions

boolean
bvec2
bvec3
bvec4
dmat2
dmat3
dmat4
dmat2x3
dmat2x4
dmat3x2
dmat3x4
dmat4x2
dmat4x3
double
dvec2
dvec3
dvec4
float
int
is_approx_eq

Returns the result of x.is_approx_eq(y).

is_close_to

Returns the result of x.is_close_to(y, max_diff).

ivec2
ivec3
ivec4
mat2
mat3
mat4
mat2x3
mat2x4
mat3x2
mat3x4
mat4x2
mat4x3
to_bvec2
to_bvec3
to_bvec4
to_dvec2
to_dvec3
to_dvec4
to_ivec2
to_ivec3
to_ivec4
to_uvec2
to_uvec3
to_uvec4
to_vec2
to_vec3
to_vec4
uint
uvec2
uvec3
uvec4
vec2
vec3
vec4

Type Definitions

BVec2
BVec3
BVec4
DMat2
DMat3
DMat4
DMat2x3
DMat2x4
DMat3x2
DMat3x4
DMat4x2
DMat4x3
DVec2
DVec3
DVec4
IVec2
IVec3
IVec4
Mat2
Mat3
Mat4
Mat2x3
Mat2x4
Mat3x2
Mat3x4
Mat4x2
Mat4x3
UVec2
UVec3
UVec4
Vec2
Vec3
Vec4