From fcfd157c702d5ca6cabb30c0239af2d7308f3eb4 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 4 Apr 2018 17:56:01 -0700 Subject: [PATCH] Remove `F32ArrayToMat4` in favor of `glmatrix.mat4.clone()` --- demo/client/src/3d-demo.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/demo/client/src/3d-demo.ts b/demo/client/src/3d-demo.ts index 7d34be20..684c72f0 100644 --- a/demo/client/src/3d-demo.ts +++ b/demo/client/src/3d-demo.ts @@ -124,15 +124,6 @@ interface MeshDescriptor { positions: glmatrix.vec2[]; } -function F32ArrayToMat4(array: Float32Array): mat4 { - const mat = glmatrix.mat4.create(); - glmatrix.mat4.set(mat, array[0], array[1], array[2], array[3], - array[4], array[5], array[6], array[7], - array[8], array[9], array[10], array[11], - array[12], array[13], array[14], array[15]); - return mat; -} - class ThreeDController extends DemoAppController { font!: PathfinderFont; textFrames!: TextFrame[]; @@ -573,11 +564,11 @@ class ThreeDRenderer extends Renderer { this.clearDestFramebuffer(true); this.vrProjectionMatrix = frame.leftProjectionMatrix; this.vrRightEye = false; - this.camera.setView(F32ArrayToMat4(frame.leftViewMatrix), frame.pose); + this.camera.setView((glmatrix.mat4.clone as any)(frame.leftViewMatrix), frame.pose); this.redraw(); this.vrRightEye = true; this.vrProjectionMatrix = frame.rightProjectionMatrix; - this.camera.setView(F32ArrayToMat4(frame.rightViewMatrix), frame.pose); + this.camera.setView((glmatrix.mat4.clone as any)(frame.rightViewMatrix), frame.pose); this.redraw(); } @@ -938,9 +929,9 @@ class ThreeDRenderer extends Renderer { } private calculateProjectionTransform(): glmatrix.mat4 { - if (this.vrProjectionMatrix != null) { - return F32ArrayToMat4(this.vrProjectionMatrix); - } + if (this.vrProjectionMatrix != null) + return (glmatrix.mat4.clone as any)(this.vrProjectionMatrix); + const canvas = this.renderContext.canvas; const projection = glmatrix.mat4.create(); glmatrix.mat4.perspective(projection,