Skip to content

Commit

Permalink
Deploying to gh-pages from @ 63ea092 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed May 30, 2024
1 parent f4a6b21 commit e673182
Show file tree
Hide file tree
Showing 12 changed files with 255 additions and 85 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,29 @@ There is also the minified version
import {
vec3,
mat4,
} from 'https://wgpu-matrix.org/dist/2.x/wgpu-matrix.module.js';
} from 'https://wgpu-matrix.org/dist/2.x/wgpu-matrix.module.min.js';

// ... etc ...
```

and a UMD version

```html
<script src="https://wgpu-matrix.org/dist/2.x/wgpu-matrix.js"></script>
<script>
const { mat4, vec3 } = wgpuMatrix;
const m = mat4.identity();
...
</script>
```

or UDM min version

```html
<script src="https://wgpu-matrix.org/dist/2.x/wgpu-matrix.min.js"></script>
...
```

or via npm

```sh
Expand Down
2 changes: 1 addition & 1 deletion dist/2.x/wgpu-matrix.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 2 additions & 72 deletions dist/2.x/wgpu-matrix.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/2.x/wgpu-matrix.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/2.x/wgpu-matrix.module.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dist/2.x/wgpu-matrix.module.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/2.x/wgpu-matrix.module.min.js.map

Large diffs are not rendered by default.

39 changes: 37 additions & 2 deletions docs/assets/highlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@
--dark-hl-7: #CE9178;
--light-hl-8: #098658;
--dark-hl-8: #B5CEA8;
--light-hl-9: #000000;
--dark-hl-9: #C8C8C8;
--light-hl-9: #800000;
--dark-hl-9: #808080;
--light-hl-10: #800000;
--dark-hl-10: #569CD6;
--light-hl-11: #000000FF;
--dark-hl-11: #D4D4D4;
--light-hl-12: #E50000;
--dark-hl-12: #9CDCFE;
--light-hl-13: #0000FF;
--dark-hl-13: #CE9178;
--light-hl-14: #000000;
--dark-hl-14: #C8C8C8;
--light-code-background: #FFFFFF;
--dark-code-background: #1E1E1E;
}
Expand All @@ -34,6 +44,11 @@
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--hl-11: var(--light-hl-11);
--hl-12: var(--light-hl-12);
--hl-13: var(--light-hl-13);
--hl-14: var(--light-hl-14);
--code-background: var(--light-code-background);
} }

Expand All @@ -48,6 +63,11 @@
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--hl-11: var(--dark-hl-11);
--hl-12: var(--dark-hl-12);
--hl-13: var(--dark-hl-13);
--hl-14: var(--dark-hl-14);
--code-background: var(--dark-code-background);
} }

Expand All @@ -62,6 +82,11 @@
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--hl-11: var(--light-hl-11);
--hl-12: var(--light-hl-12);
--hl-13: var(--light-hl-13);
--hl-14: var(--light-hl-14);
--code-background: var(--light-code-background);
}

Expand All @@ -76,6 +101,11 @@
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--hl-11: var(--dark-hl-11);
--hl-12: var(--dark-hl-12);
--hl-13: var(--dark-hl-13);
--hl-14: var(--dark-hl-14);
--code-background: var(--dark-code-background);
}

Expand All @@ -89,4 +119,9 @@
.hl-7 { color: var(--hl-7); }
.hl-8 { color: var(--hl-8); }
.hl-9 { color: var(--hl-9); }
.hl-10 { color: var(--hl-10); }
.hl-11 { color: var(--hl-11); }
.hl-12 { color: var(--hl-12); }
.hl-13 { color: var(--hl-13); }
.hl-14 { color: var(--hl-14); }
pre, code { background: var(--code-background); }
10 changes: 8 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@
<pre><code class="language-js"><span class="hl-1">const</span><span class="hl-2"> </span><span class="hl-3">m</span><span class="hl-2"> = </span><span class="hl-4">mat4</span><span class="hl-2">.</span><span class="hl-5">create</span><span class="hl-2">(); </span><span class="hl-0">// m = new mat4</span><br/><span class="hl-4">mat4</span><span class="hl-2">.</span><span class="hl-5">identity</span><span class="hl-2">(</span><span class="hl-4">m</span><span class="hl-2">); </span><span class="hl-0">// m = identity</span><br/><span class="hl-4">mat4</span><span class="hl-2">.</span><span class="hl-5">translate</span><span class="hl-2">(</span><span class="hl-4">m</span><span class="hl-2">, [</span><span class="hl-8">1</span><span class="hl-2">, </span><span class="hl-8">2</span><span class="hl-2">, </span><span class="hl-8">3</span><span class="hl-2">], </span><span class="hl-4">m</span><span class="hl-2">); </span><span class="hl-0">// m *= translation([1, 2, 3])</span><br/><span class="hl-4">mat4</span><span class="hl-2">.</span><span class="hl-5">rotateX</span><span class="hl-2">(</span><span class="hl-4">m</span><span class="hl-2">, </span><span class="hl-4">Math</span><span class="hl-2">.</span><span class="hl-3">PI</span><span class="hl-2"> * </span><span class="hl-8">0.5</span><span class="hl-2">, </span><span class="hl-4">m</span><span class="hl-2">); </span><span class="hl-0">// m *= rotationX(Math.PI * 0.5)</span><br/><span class="hl-4">mat4</span><span class="hl-2">.</span><span class="hl-5">scale</span><span class="hl-2">(</span><span class="hl-4">m</span><span class="hl-2">, [</span><span class="hl-8">1</span><span class="hl-2">, </span><span class="hl-8">2</span><span class="hl-2">, </span><span class="hl-8">3</span><span class="hl-2">], </span><span class="hl-4">m</span><span class="hl-2">); </span><span class="hl-0">// m *= scaling([1, 2, 3])</span>
</code><button>Copy</button></pre>
<p>There is also the minified version</p>
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">vec3</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">mat4</span><span class="hl-2">,</span><br/><span class="hl-2">} </span><span class="hl-6">from</span><span class="hl-2"> </span><span class="hl-7">&#39;https://wgpu-matrix.org/dist/2.x/wgpu-matrix.module.js&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-0">// ... etc ...</span>
<pre><code class="language-js"><span class="hl-6">import</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">vec3</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">mat4</span><span class="hl-2">,</span><br/><span class="hl-2">} </span><span class="hl-6">from</span><span class="hl-2"> </span><span class="hl-7">&#39;https://wgpu-matrix.org/dist/2.x/wgpu-matrix.module.min.js&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-0">// ... etc ...</span>
</code><button>Copy</button></pre>
<p>and a UMD version</p>
<pre><code class="language-html"><span class="hl-9">&lt;</span><span class="hl-10">script</span><span class="hl-11"> </span><span class="hl-12">src</span><span class="hl-11">=</span><span class="hl-13">&quot;https://wgpu-matrix.org/dist/2.x/wgpu-matrix.js&quot;</span><span class="hl-9">&gt;&lt;/</span><span class="hl-10">script</span><span class="hl-9">&gt;</span><br/><span class="hl-9">&lt;</span><span class="hl-10">script</span><span class="hl-9">&gt;</span><br/><span class="hl-1">const</span><span class="hl-11"> { </span><span class="hl-3">mat4</span><span class="hl-11">, </span><span class="hl-3">vec3</span><span class="hl-11"> } </span><span class="hl-2">=</span><span class="hl-11"> </span><span class="hl-4">wgpuMatrix</span><span class="hl-11">;</span><br/><span class="hl-1">const</span><span class="hl-11"> </span><span class="hl-3">m</span><span class="hl-11"> </span><span class="hl-2">=</span><span class="hl-11"> </span><span class="hl-4">mat4</span><span class="hl-11">.</span><span class="hl-5">identity</span><span class="hl-11">();</span><br/><span class="hl-2">...</span><br/><span class="hl-9">&lt;/</span><span class="hl-10">script</span><span class="hl-9">&gt;</span>
</code><button>Copy</button></pre>
<p>or UDM min version</p>
<pre><code class="language-html"><span class="hl-9">&lt;</span><span class="hl-10">script</span><span class="hl-11"> </span><span class="hl-12">src</span><span class="hl-11">=</span><span class="hl-13">&quot;https://wgpu-matrix.org/dist/2.x/wgpu-matrix.min.js&quot;</span><span class="hl-9">&gt;&lt;/</span><span class="hl-10">script</span><span class="hl-9">&gt;</span><br/><span class="hl-2">...</span>
</code><button>Copy</button></pre>
<p>or via npm</p>
<pre><code class="language-sh"><span class="hl-5">npm</span><span class="hl-2"> </span><span class="hl-7">install</span><span class="hl-2"> </span><span class="hl-1">--save</span><span class="hl-2"> </span><span class="hl-7">wgpu-matrix</span>
Expand Down Expand Up @@ -66,7 +72,7 @@
<p><code>vec3</code> in this library uses 3 floats per but be aware that an array of
<code>vec3</code> in a Uniform Block or other structure in WGSL, each vec3 is
padded to 4 floats! In other words, if you declare</p>
<pre><code><span class="hl-4">struct</span><span class="hl-2"> </span><span class="hl-4">Foo</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-9">bar</span><span class="hl-2">: </span><span class="hl-4">vec3</span><span class="hl-2">&lt;</span><span class="hl-4">f32</span><span class="hl-2">&gt;[</span><span class="hl-8">3</span><span class="hl-2">];</span><br/><span class="hl-2">};</span>
<pre><code><span class="hl-4">struct</span><span class="hl-2"> </span><span class="hl-4">Foo</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-14">bar</span><span class="hl-2">: </span><span class="hl-4">vec3</span><span class="hl-2">&lt;</span><span class="hl-4">f32</span><span class="hl-2">&gt;[</span><span class="hl-8">3</span><span class="hl-2">];</span><br/><span class="hl-2">};</span>
</code><button>Copy</button></pre>
<p>then bar[0] is at byte offset 0, bar[1] at byte offset 16, bar[2] at byte offset 32.</p>
<p>See <a href="https://www.w3.org/TR/WGSL/#alignment-and-size">the WGSL spec on alignment and size</a>.</p>
Expand Down
149 changes: 147 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wgpu-matrix",
"version": "2.9.0",
"version": "2.9.1",
"description": "fast matrix math library for WebGPU",
"main": "dist/2.x/wgpu-matrix.module.js",
"module": "dist/2.x/wgpu-matrix.module.js",
Expand All @@ -11,9 +11,7 @@
"test": "test"
},
"scripts": {
"build": "npm run build-min",
"build-normal": "rollup -c && tsc --emitDeclarationOnly --declaration",
"build-min": "npm run build-normal && google-closure-compiler --warning_level=VERBOSE --jscomp_off=globalThis --jscomp_off=checkTypes --externs build/externs.js --language_in=ECMASCRIPT_2019 --language_out=ECMASCRIPT_2019 --js dist/2.x/wgpu-matrix.js --js_output_file dist/2.x/wgpu-matrix.min.js && node ./build/tools/append-banner.js dist/2.x/wgpu-matrix.min.js",
"build": "rollup -c && tsc --emitDeclarationOnly --declaration",
"build-ci": "npm run pre-push && node build/tools/prep-for-deploy.js",
"check": "npm run lint",
"check-ci": "npm run pre-push",
Expand Down Expand Up @@ -48,6 +46,7 @@
},
"homepage": "https://github.com/greggman/wgpu-matrix#readme",
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@tsconfig/recommended": "^1.0.6",
"@typescript-eslint/eslint-plugin": "^5.62.0",
Expand Down
Loading

0 comments on commit e673182

Please sign in to comment.