Add GLSL type aliases

This commit is contained in:
Brendan Zabarauskas 2012-11-05 12:39:58 +10:00
parent 59d4b33691
commit 9491c4d93f
3 changed files with 59 additions and 0 deletions

View file

@ -10,6 +10,35 @@ use ncast::*;
use quaternion::{Quat, ToQuat};
use vector::{Vec2, Vec3, Vec4};
// GLSL equivalent type aliases
type mat2 = Mat2<f32>; /// a 2×2 single-precision floating-point matrix
type mat3 = Mat3<f32>; /// a 3×3 single-precision floating-point matrix
type mat4 = Mat4<f32>; /// a 4×4 single-precision floating-point matrix
type mat2x2 = Mat2<f32>; /// same as a `mat2`
// type mat2x3 = /// a single-precision floating-point matrix with 2 columns and 3 rows
// type mat2x4 = /// a single-precision floating-point matrix with 2 columns and 4 rows
// type mat3x2 = /// a single-precision floating-point matrix with 3 columns and 2 rows
type mat3x3 = Mat3<f32>; /// same as a `mat3`
// type mat3x4 = /// a single-precision floating-point matrix with 3 columns and 4 rows
// type mat4x2 = /// a single-precision floating-point matrix with 4 columns and 2 rows
// type mat4x3 = /// a single-precision floating-point matrix with 4 columns and 3 rows
type mat4x4 = Mat4<f32>; /// same as a `mat4`
type dmat2 = Mat2<f64>; /// a 2×2 double-precision floating-point matrix
type dmat3 = Mat3<f64>; /// a 3×3 double-precision floating-point matrix
type dmat4 = Mat4<f64>; /// a 4×4 double-precision floating-point matrix
type dmat2x2 = Mat2<f64>; /// same as a `dmat2`
// type dmat2x3 = /// a double-precision floating-point matrix with 2 columns and 3 rows
// type dmat2x4 = /// a double-precision floating-point matrix with 2 columns and 4 rows
// type dmat3x2 = /// a double-precision floating-point matrix with 3 columns and 2 rows
type dmat3x3 = Mat3<f64>; /// same as a `dmat3`
// type dmat3x4 = /// a double-precision floating-point matrix with 3 columns and 4 rows
// type dmat4x2 = /// a double-precision floating-point matrix with 4 columns and 2 rows
// type dmat4x3 = /// a double-precision floating-point matrix with 4 columns and 3 rows
type dmat4x4 = Mat4<f64>; /// same as a `dmat4`
//
// NxN Matrix
//

View file

@ -9,6 +9,13 @@ use math::*;
use matrix::{Mat3, Mat4};
use vector::Vec3;
// These quaternion type aliases are not actually specified in the GLSL spec
// but they follow the same nomenclature
type quat4 = Quat<f32>; /// a single-precision floating-point quaternion
type dquat4 = Quat<f64>; /// a double-precision floating-point quaternion
//
// Quaternion
//

View file

@ -7,6 +7,29 @@ use std::cmp::FuzzyEq;
use math::*;
// GLSL equivalent type aliases
type vec2 = Vec2<f32>; /// a two-component single-precision floating-point vector
type vec3 = Vec3<f32>; /// a three-component single-precision floating-point vector
type vec4 = Vec4<f32>; /// a four-component single-precision floating-point vector
type dvec2 = Vec2<f64>; /// a two-component double-precision floating-point vector
type dvec3 = Vec3<f64>; /// a three-component double-precision floating-point vector
type dvec4 = Vec4<f64>; /// a four-component double-precision floating-point vector
type bvec2 = Vec2<bool>; /// a two-component Boolean vector
type bvec3 = Vec3<bool>; /// a three-component Boolean vector
type bvec4 = Vec4<bool>; /// a four-component Boolean vector
type ivec2 = Vec2<i32>; /// a two-component signed integer vector
type ivec3 = Vec3<i32>; /// a three-component signed integer vector
type ivec4 = Vec4<i32>; /// a four-component signed integer vector
type uvec2 = Vec2<u32>; /// a two-component unsigned integer vector
type uvec3 = Vec3<u32>; /// a three-component unsigned integer vector
type uvec4 = Vec4<u32>; /// a four-component unsigned integer vector
//
// N-dimensional Vector
//