Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onitake/glam
GLSL Style C++ Linear Algebra Math Library
https://github.com/onitake/glam
Last synced: 8 days ago
JSON representation
GLSL Style C++ Linear Algebra Math Library
- Host: GitHub
- URL: https://github.com/onitake/glam
- Owner: onitake
- License: other
- Created: 2014-05-22T16:17:29.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-22T18:46:22.000Z (over 8 years ago)
- Last Synced: 2024-06-08T00:05:39.898Z (7 months ago)
- Language: C++
- Homepage:
- Size: 17 MB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
GLAM - GLSL Linear Algebra Math Library
=======================================GLAM is a linear algebra math library for C++11 programs.
The API mimics GLSL ES 3.0, enabling source code to be shared
between the CPU and the GPU with minimal changes.The code is Copyright © 2012-2014 by Gregor Riepl
and released under the terms of a permissive open-source
license. See the separate LICENSE file for details.This library was originally developed as part of a larger
3D engine project. As it grew significantly over time,
the developer decided to release it as a separate library
so others may benefit from the effort.Aside from the GLSL API, it also supports operations on
arbitrary data types, thanks to the versatility of C++
templates. Certain features were written using C++11
features, so a modern compiler is required.
The original compatibility code may be made available at
a later point of time.All code is contained in the glam namespace. If you
want to use GLSL code in your C++ program directly,
you may import the whole namespace with ausing namespace glam;
directive.
It is recommended to limit the namespace import to single
files or containing namespaces, however.All the GLSL vector and matrix types are supported,
in addition to the base types that GLSL and C++ share.
You may also create custom types, matrices of arbitrary
size and composite element types. An example for the C++
complex type is provided in test/dft.cpp.All operations are inlined, possibly causing the compiler to
generate large amounts of machine code for higher-dimensional
matrices. For example, if you need to use the matrix inversion
in several places in your code, you should declare the
template function as extern and place the actual defition in
a single, separate source code file.To do this, place the following line in a common header file:
extern template mat4 mat4::inv() const;
and the following in a separate source file:
template mat4 mat4::inv() const;
The code is completely machine independent, relying only on
the C/C++ standard math library and builtin operations.