Skip to content

Commit 8b207ab

Browse files
committed
Deploying to gh-pages from @ f81ccbc 🚀
1 parent 55d298c commit 8b207ab

61 files changed

Lines changed: 194 additions & 301 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎meshes/mesh.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const getMeshPosAtIndex = (mesh: Mesh, index: number) => {
7474
index * mesh.vertexStride + 0,
7575
3
7676
);
77-
return vec3.fromValues(arr[0], arr[1], arr[2]);
77+
return [arr[0], arr[1], arr[2]];
7878
};
7979

8080
export const getMeshNormalAtIndex = (mesh: Mesh, index: number) => {
@@ -83,7 +83,7 @@ export const getMeshNormalAtIndex = (mesh: Mesh, index: number) => {
8383
index * mesh.vertexStride + 3 * Float32Array.BYTES_PER_ELEMENT,
8484
3
8585
);
86-
return vec3.fromValues(arr[0], arr[1], arr[2]);
86+
return [arr[0], arr[1], arr[2]];
8787
};
8888

8989
export const getMeshUVAtIndex = (mesh: Mesh, index: number) => {

‎sample/a-buffer/main.js‎

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

‎sample/a-buffer/main.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.

‎sample/a-buffer/main.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,9 @@ const configure = () => {
514514
2000.0
515515
);
516516

517-
const upVector = vec3.fromValues(0, 1, 0);
518-
const origin = vec3.fromValues(0, 0, 0);
519-
const eyePosition = vec3.fromValues(0, 5, -100);
517+
const upVector = [0, 1, 0];
518+
const origin = [0, 0, 0];
519+
const eyePosition = [0, 5, -100];
520520

521521
const rad = Math.PI * (Date.now() / 5000);
522522
const rotation = mat4.rotateY(mat4.translation(origin), rad);

‎sample/cornell/common.ts‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mat4, vec3 } from 'wgpu-matrix';
1+
import { mat4 } from 'wgpu-matrix';
22
import commonWGSL from './common.wgsl';
33

44
/**
@@ -80,13 +80,9 @@ export default class Common {
8080
const viewRotation = params.rotateCamera ? this.frame / 1000 : 0;
8181

8282
const viewMatrix = mat4.lookAt(
83-
vec3.fromValues(
84-
Math.sin(viewRotation) * 15,
85-
5,
86-
Math.cos(viewRotation) * 15
87-
),
88-
vec3.fromValues(0, 5, 0),
89-
vec3.fromValues(0, 1, 0)
83+
[Math.sin(viewRotation) * 15, 5, Math.cos(viewRotation) * 15],
84+
[0, 5, 0],
85+
[0, 1, 0]
9086
);
9187
const mvp = mat4.multiply(projectionMatrix, viewMatrix);
9288
const invMVP = mat4.invert(mvp);

‎sample/cornell/main.js‎

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

‎sample/cornell/main.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.

‎sample/cubemap/main.js‎

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

‎sample/cubemap/main.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.

‎sample/cubemap/main.ts‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mat4, vec3 } from 'wgpu-matrix';
1+
import { mat4 } from 'wgpu-matrix';
22

33
import {
44
cubeVertexArray,
@@ -193,7 +193,7 @@ const renderPassDescriptor: GPURenderPassDescriptor = {
193193
const aspect = canvas.width / canvas.height;
194194
const projectionMatrix = mat4.perspective((2 * Math.PI) / 5, aspect, 1, 3000);
195195

196-
const modelMatrix = mat4.scaling(vec3.fromValues(1000, 1000, 1000));
196+
const modelMatrix = mat4.scaling([1000, 1000, 1000]);
197197
const modelViewProjectionMatrix = mat4.create();
198198
const viewMatrix = mat4.identity();
199199

@@ -204,13 +204,8 @@ const tmpMat4 = mat4.create();
204204
function updateTransformationMatrix() {
205205
const now = Date.now() / 800;
206206

207-
mat4.rotate(
208-
viewMatrix,
209-
vec3.fromValues(1, 0, 0),
210-
(Math.PI / 10) * Math.sin(now),
211-
tmpMat4
212-
);
213-
mat4.rotate(tmpMat4, vec3.fromValues(0, 1, 0), now * 0.2, tmpMat4);
207+
mat4.rotate(viewMatrix, [1, 0, 0], (Math.PI / 10) * Math.sin(now), tmpMat4);
208+
mat4.rotate(tmpMat4, [0, 1, 0], now * 0.2, tmpMat4);
214209

215210
mat4.multiply(tmpMat4, modelMatrix, modelViewProjectionMatrix);
216211
mat4.multiply(

0 commit comments

Comments
 (0)