#mint #std140 #type #convert #converted

mint-std140

Convert mint types to std140 types

2 releases

0.1.1 Apr 13, 2021
0.1.0 Apr 13, 2021

#3 in #converted

36 downloads per month

MIT/Apache

8KB
99 lines

This library contains a single trait [AsStd140] which is implemented for [mint] types that can be converted to [std140] types.

Examples

use mint_std140::AsStd140;

let mint_vector = mint::Vector2 { x: 0.0f32, y: 0.0f32 };
let std140_vector = mint_vector.as_std140();
assert_eq!(mint_vector.x, std140_vector[0]);
assert_eq!(mint_vector.y, std140_vector[1]);

let mint_matrix = mint::ColumnMatrix2 {
    x: mint::Vector2 { x: 0.0f32, y: 1.0f32 },
    y: mint::Vector2 { x: 2.0f32, y: 3.0f32 },
};
let std140_matrix = mint_matrix.as_std140();

lib.rs:

This library contains a single trait [AsStd140] which is implemented for [mint] types that can be converted to [std140] types.

Examples

use mint_std140::AsStd140;

let mint_vector = mint::Vector2 { x: 0.0f32, y: 0.0f32 };
let std140_vector = mint_vector.as_std140();
assert_eq!(mint_vector.x, std140_vector[0]);
assert_eq!(mint_vector.y, std140_vector[1]);

let mint_matrix = mint::ColumnMatrix2 {
    x: mint::Vector2 { x: 0.0f32, y: 1.0f32 },
    y: mint::Vector2 { x: 2.0f32, y: 3.0f32 },
};
let std140_matrix = mint_matrix.as_std140();

Dependencies

~1.5MB
~35K SLoC