glm

Native Haxe version of the fantastic GLM library.
https://github.com/FuzzyWuzzie/haxe-glm

To install, run:

haxelib install glm 2.1.0 

See using Haxelib in Haxelib documentation for more information.

README.md

haxe-glm

GitHub license Build Status

Native Haxe version of the fantastic GLM library (https://github.com/g-truc/glm). For those unaware of the GLM library, it is basically a toolset for using 2, 3, and 4 dimensional vectors and matrices, as well as quaternions. This tends to be rather useful when working with OpenGL, which is largely all about rasterizing primitives using vectors and matrices.

Contributing

Issues, forks, and pull requests are gladly welcomed! This library is meant for you, so help make it into what you want it to be!

Documentation

Manual

This library provides several classes (actually, abstracts over floating point arrays) which enable vector, matrix, and quaternion mathematical operations (Vec2, Vec3, Vec4, Mat2, Mat4, and Quat). The library also includes static utilities for generating transformation and projection matrices (GLM).

The library includes static extensions and gives you the flexibility to instantiate or reuse objects as desired using destination arguments.

Motivation

I decided to create this library for Haxe after seeing project after project write their own code for dealing with vectors, matrices, and quaternions. This has resulted in a lot of duplicated effort by developers who all seem to write their own classes to deal with this.

Hopefully the creation of this [fully cross-target and cross-platform] library, some of this duplicated effort can be minimized in the future.

API

API documentation is available here: http://fuzzywuzzie.github.io/haxe-glm/

Samples

// create a new perspective projection matrix
var P:Mat4 = GLM.perspective(
    45 * Math.PI / 180, // field of view (radians)
    640 / 480, // aspect ratio
    0.1, 100, // near, far
    new Mat4() // where to store the result
);
// transform components
var pos:Vec3 = new Vec3(0, 0, 1.5);
var rot:Quat = Quat.identity(new Quat());
var sca:Vec3 = new Vec3(1, 1, 1);
var modelMatrix:Mat4 = new Mat4();

// ...

// update the model matrix
GLM.transform(pos, rot, sca, modelMatrix);
Contributors
FuzzyWuzzie
Version
2.1.0
Published
7 months ago
License
Apache

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github