Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 2
trim_trailing_whitespace = true
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Set line endings.
* text eol=lf

# Explicitly mark binary files.
*.png binary
*.jpg binary
*.ico binary
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI/CD

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-node:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18.x, 20.x, 22.x]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Run Tests
run: npm run test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
.idea
.rvmrc
.DS_Store
node_modules
npm-debug.log
dist
docs
f64
/.dts
/.vscode
/coverage
/dist
/docs
/html
/node_modules
10 changes: 0 additions & 10 deletions .npmignore

This file was deleted.

29 changes: 29 additions & 0 deletions README-CDN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[![NPM Version](https://img.shields.io/npm/v/gl-matrix.svg)](https://www.npmjs.com/package/gl-matrix)
[![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg?style=flat)](https://github.com/typhonjs-svelte/trie-search/blob/main/LICENSE)
[![Build Status](https://github.com/toji/gl-matrix/workflows/CI/CD/badge.svg)](#)
[![Coverage](https://img.shields.io/codecov/c/github/toji/gl-matrix.svg)](https://codecov.io/github/toji/gl-matrix)
[![API Docs](https://img.shields.io/badge/API%20Documentation-476ff0)](https://glmatrix.net/docs/v4/)

`gl-matrix` is a versatile and high-performance JavaScript / TypeScript library for vector and matrix operations,
optimized for real-time 3D graphics APIs such as WebGL and WebGPU.

This documentation resource separates the CDN / pre-built distribution resources from the main Node distribution API
documentation. Additional, information regarding using `gl-matrix` with modern ESM CDNs and capabilities such as
[import maps](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) and enabling type
declarations when developing web apps with the CDN resources is forthcoming, so stay tuned as these docs will be updated
in the next beta release.

---

There are multiple distribution methods to utilize `gl-matrix` from legacy module systems like
[RequireJS](https://requirejs.org/) to modern ES Module (ESM) oriented CDNs. If you are not using Node / NPM and
bundling `gl-matrix` directly into your project / product various pre-built versions are available on most CDNs that
automatically make NPM package available for consumption online in a web application deployment.

Pre-built ESM and ES5 / UMD bundles are available in the `/dist-cdn` directory checked into the `gl-matrix` repo.
The `gl-matrix/cdn` and `gl-matrix/cdn/f64` exports are linked to the types and pre-built all-inclusive CDN ESM
bundles. `gl-matrix/types/cdn/umd` and `gl-matrix/types/cdn/umd/64` provide type declarations for the UMD bundles when
used as an `IIFE`.



50 changes: 24 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
## Fast, flexible vector and matrix math for JavaScript

[![NPM Version](https://img.shields.io/npm/v/gl-matrix.svg)](https://www.npmjs.com/package/gl-matrix)
[![Build Status](https://travis-ci.org/toji/gl-matrix.svg)](https://travis-ci.org/toji/gl-matrix)

glMatrix is a high performance, very flexible library for vector and matrix operations in JavaScript/TypeScript, designed for the needs of realtime 3D graphics APIs like WebGL and WebGPU.

## Docs

Documentation is available at [https://glmatrix.net/docs/v4/](https://glmatrix.net/docs/v4/)

## Using Float64Array

If your use case requires additional precision beyond the default 32-bit floats used by default, you can instead use a 64-bit verions of the library by importing from the `f64/` directory of your chosen build type. For example:

```js
import { Vec3 } from './gl-matrix/dist/esm/f64/vec3.js';
```

If you have a need to mix and match the 64 bit and 32 bit versions, you can do so by importing them as different names:

```js
import { Vec3 as Vec3F32 } from './gl-matrix/dist/esm/vec3.js';
import { Vec3 as Vec3F64 } from './gl-matrix/dist/esm/f64/vec3.js';
```

All API calls are identical between the two versions, the only difference is the type of TypedArray which the classes extend.
[![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg?style=flat)](https://github.com/typhonjs-svelte/trie-search/blob/main/LICENSE)
[![Build Status](https://github.com/toji/gl-matrix/workflows/CI/CD/badge.svg)](#)
[![Coverage](https://img.shields.io/codecov/c/github/toji/gl-matrix.svg)](https://codecov.io/github/toji/gl-matrix)
[![API Docs](https://img.shields.io/badge/API%20Documentation-476ff0)](https://glmatrix.net/docs/v4/)

`gl-matrix` is a versatile and high-performance JavaScript / TypeScript library for vector and matrix operations,
optimized for real-time 3D graphics APIs such as WebGL and WebGPU.

Javascript has evolved into a language capable of handling realtime 3D graphics and computationally intensive tasks such
as physics simulations. These types of applications demand high performance vector and matrix math which is something
that Javascript doesn't provide by default. `gl-matrix` to the rescue!

`gl-matrix` is designed to perform vector and matrix operations stupidly fast! By hand-tuning each function for maximum
performance and encouraging efficient usage patterns through API conventions `gl-matrix` will help you get the most out
of your Javascript engine in the browser or preferred Javascript runtime.

## What's new in 4.0?
`gl-matrix` 4.0 is the result of a lot of excellent feedback from the community, and features:

- Revamped and consistent API (not backward compatible with 3.x, see: Classic API)
- Even more optimizations!
- Written in Typescript.
- A cleaner code base, broken up by type.
- A more complete unit testing suite.
Binary file added assets/docs/favicon.ico
Binary file not shown.
Binary file added assets/icon/gl-matrix-icon-512.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/gl-matrix-icon-64.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/gl-matrix-icon-mono-64.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading