Skip to content

Commit 804ff5e

Browse files
committed
small update
1 parent c497329 commit 804ff5e

File tree

10 files changed

+153
-83
lines changed

10 files changed

+153
-83
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ Yet another gl-matrix but smaller (without SIMD) and faster (use Hidden class in
66

77
## Why?
88

9-
- Bug fixes compare to gl-matrix.
10-
- More math methods compare to gl-matrix.
11-
- Use row-major matrix for all calculation.
12-
- Use hidden class compare to Float32Array for fast data access and fast create.
9+
- Hidden classes + inline caching is much faster than Array/Float32Array.
1310
- Remove SIMD for smaller footprint.
11+
- Make sure using the column-major matrix for all calculation.
1412

1513
## Install
1614

dist/vmath.dev.js

Lines changed: 48 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vmath.dev.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vmath.js

Lines changed: 48 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vmath.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vmath.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vmath.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/mat3.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
import { EPSILON } from './utils';
22

3-
// NOTE: we use row-major matrix
4-
// Where:
5-
6-
// m00, m01, m02
7-
// m10, m11, m12
8-
// m20, m21, m22
9-
10-
// The floats are laid out:
11-
// x | m0 | m1 | m2
12-
// y | m3 | m4 | m5
13-
// z | m6 | m7 | m8
3+
/**
4+
* NOTE: we use column-major matrix for all matrix calculation.
5+
*
6+
* This may lead to some confusion when referencing OpenGL documentation,
7+
* however, which represents out all matricies in column-major format.
8+
* This means that while in code a matrix may be typed out as:
9+
*
10+
* [1, 0, 0, 0,
11+
* 0, 1, 0, 0,
12+
* 0, 0, 1, 0,
13+
* x, y, z, 0]
14+
*
15+
* The same matrix in the [OpenGL documentation](https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTranslate.xml)
16+
* is written as:
17+
*
18+
* 1 0 0 x
19+
* 0 1 0 y
20+
* 0 0 1 z
21+
* 0 0 0 0
22+
*
23+
* Please rest assured, however, that they are the same thing!
24+
* This is not unique to glMatrix, either, as OpenGL developers have long been confused by the
25+
* apparent lack of consistency between the memory layout and the documentation.
26+
*/
1427

1528
class _mat3 {
1629
constructor(m00, m01, m02, m03, m04, m05, m06, m07, m08) {

lib/mat4.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
import { EPSILON } from './utils';
22

3-
// NOTE: we use row-major matrix
4-
// Where:
5-
6-
// m00, m01, m02, m03
7-
// m10, m11, m12, m13
8-
// m20, m21, m22, m23
9-
// m30, m31, m32, m33
10-
11-
// The floats are laid out:
12-
// x | m0 | m1 | m2 | m3
13-
// y | m4 | m5 | m6 | m7
14-
// z | m8 | m9 | m10 | m11
15-
// T | m12 | m13 | m15 | m15
3+
/**
4+
* NOTE: we use column-major matrix
5+
*
6+
* This may lead to some confusion when referencing OpenGL documentation,
7+
* however, which represents out all matricies in column-major format.
8+
* This means that while in code a matrix may be typed out as:
9+
*
10+
* [1, 0, 0, 0,
11+
* 0, 1, 0, 0,
12+
* 0, 0, 1, 0,
13+
* x, y, z, 0]
14+
*
15+
* The same matrix in the [OpenGL documentation](https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTranslate.xml)
16+
* is written as:
17+
*
18+
* 1 0 0 x
19+
* 0 1 0 y
20+
* 0 0 1 z
21+
* 0 0 0 0
22+
*
23+
* Please rest assured, however, that they are the same thing!
24+
* This is not unique to glMatrix, either, as OpenGL developers have long been confused by the
25+
* apparent lack of consistency between the memory layout and the documentation.
26+
*/
1627

1728
class _mat4 {
1829
constructor(

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "vmath",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Yet another gl-matrix: faster and smaller",
55
"main": "dist/vmath.js",
66
"scripts": {
77
"build": "rollup --config ./script/rollup.config.js",
8-
"min": "uglifyjs ./dist/vmath.dev.js --source-map ./dist/vmath.min.js.map -o ./dist/vmath.min.js",
8+
"min": "uglifyjs ./dist/vmath.dev.js --mangle --source-map ./dist/vmath.min.js.map -o ./dist/vmath.min.js",
99
"release": "npm run build && npm run min",
1010
"test": "npm run build && tap test/*.spec.js"
1111
},

0 commit comments

Comments
 (0)