From 9f00a6bf52965d68370ea0c061e7430870317437 Mon Sep 17 00:00:00 2001 From: Unboring SL Date: Thu, 22 Feb 2018 10:00:35 +0100 Subject: [PATCH] Change var name from modelMatrix to transform --- examples/light/index.html | 2 +- examples/reticle/index.html | 2 +- polyfill/platform/ARKitWrapper.js | 16 ++++++++-------- polyfill/reality/CameraReality.js | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/light/index.html b/examples/light/index.html index 19632f3..5527d9a 100644 --- a/examples/light/index.html +++ b/examples/light/index.html @@ -102,7 +102,7 @@ var tempScale = new THREE.Vector3(); if (hit && hit.length > 0) { this.reticle.visible = true - model.fromArray(hit[0].modelMatrix); + model.fromArray(hit[0].transform); model.decompose(tempPos, tempQuat, tempScale); this.reticle.position.copy(tempPos); this.reticle.quaternion.copy(tempQuat); diff --git a/examples/reticle/index.html b/examples/reticle/index.html index 601c7b8..3e94cef 100644 --- a/examples/reticle/index.html +++ b/examples/reticle/index.html @@ -98,7 +98,7 @@ var tempScale = new THREE.Vector3(); if (hit && hit.length > 0) { this.reticle.visible = true - model.fromArray(hit[0].modelMatrix); + model.fromArray(hit[0].transform); model.decompose(tempPos, tempQuat, tempScale); this.reticle.position.copy(tempPos); this.reticle.quaternion.copy(tempQuat); diff --git a/polyfill/platform/ARKitWrapper.js b/polyfill/platform/ARKitWrapper.js index 8c732c5..7377dec 100644 --- a/polyfill/platform/ARKitWrapper.js +++ b/polyfill/platform/ARKitWrapper.js @@ -97,12 +97,12 @@ export default class ARKitWrapper extends EventHandlerBase { } /** * The result of a raycast into the AR world encoded as a transform matrix. - * This structure has a single property - modelMatrix - which encodes the + * This structure has a single property - transform - which encodes the * translation of the intersection of the hit in the form of a 4x4 matrix. * @constructor */ function VRHit() { - this.modelMatrix = new Float32Array(16); + this.transform = new Float32Array(16); return this; }; @@ -205,7 +205,7 @@ export default class ARKitWrapper extends EventHandlerBase { */ var sortFunction = function(a, b) { // Get the matrix of hit a. - setMat4FromArray(hitVars.planeMatrix, a.modelMatrix); + setMat4FromArray(hitVars.planeMatrix, a.transform); // Get the translation component of a's matrix. mat4.getTranslation(hitVars.planeIntersection, hitVars.planeMatrix); // Get the distance from the intersection point to the camera. @@ -215,7 +215,7 @@ export default class ARKitWrapper extends EventHandlerBase { ); // Get the matrix of hit b. - setMat4FromArray(hitVars.planeMatrix, b.modelMatrix); + setMat4FromArray(hitVars.planeMatrix, b.transform); // Get the translation component of b's matrix. mat4.getTranslation(hitVars.planeIntersection, hitVars.planeMatrix); // Get the distance from the intersection point to the camera. @@ -285,7 +285,7 @@ export default class ARKitWrapper extends EventHandlerBase { for (var i = 0; i < planes.length; i++) { var plane = planes[i]; // Get the anchor transform. - setMat4FromArray(hitVars.planeMatrix, plane.modelMatrix); + setMat4FromArray(hitVars.planeMatrix, plane.transform); // Get the position of the anchor in world-space. vec3.set( @@ -380,7 +380,7 @@ export default class ARKitWrapper extends EventHandlerBase { mat4.fromTranslation(hitVars.planeHit, hitVars.planeIntersection); var hit = new VRHit(); for (var j = 0; j < 16; j++) { - hit.modelMatrix[j] = hitVars.planeHit[j]; + hit.transform[j] = hitVars.planeHit[j]; } hit.i = i; hits.push(hit); @@ -695,12 +695,12 @@ export default class ARKitWrapper extends EventHandlerBase { id: element.uuid, center: element.h_plane_center, extent: [element.h_plane_extent.x, element.h_plane_extent.z], - modelMatrix: element.transform + transform: element.transform }); }else{ this.anchors_.set(element.uuid, { id: element.uuid, - modelMatrix: element.transform + transform: element.transform }); } } diff --git a/polyfill/reality/CameraReality.js b/polyfill/reality/CameraReality.js index 32e6543..6d113e3 100644 --- a/polyfill/reality/CameraReality.js +++ b/polyfill/reality/CameraReality.js @@ -243,7 +243,7 @@ export default class CameraReality extends Reality { let anchor = this._getAnchor(hits[0].uuid) if(anchor === null){ let coordinateSystem = new XRCoordinateSystem(display, XRCoordinateSystem.TRACKER) - coordinateSystem._relativeMatrix = hits[0].modelMatrix + coordinateSystem._relativeMatrix = hits[0].transform coordinateSystem._relativeMatrix[13] += XRViewPose.SITTING_EYE_HEIGHT anchor = new XRAnchor(coordinateSystem) this._anchors.set(anchor.uid, anchor) @@ -303,7 +303,7 @@ export default class CameraReality extends Reality { // Perform a hit test using the ARKit integration let hits = this._arKitWrapper.hitTestNoAnchor(normalizedScreenX, normalizedScreenY); for (let i = 0; i < hits.length; i++) { - hits[i].modelMatrix[13] += XRViewPose.SITTING_EYE_HEIGHT + hits[i].transform[13] += XRViewPose.SITTING_EYE_HEIGHT } if(hits.length == 0){ return null; @@ -313,7 +313,7 @@ export default class CameraReality extends Reality { // Perform a hit test using the ARCore data let hits = this._vrDisplay.hitTest(normalizedScreenX, normalizedScreenY) for (let i = 0; i < hits.length; i++) { - hits[i].modelMatrix[13] += XRViewPose.SITTING_EYE_HEIGHT + hits[i].transform[13] += XRViewPose.SITTING_EYE_HEIGHT } if(hits.length == 0){ return null;