Delete js
Browse files- js/app.js +0 -89
- js/lib/aframe-ar.js +0 -0
- js/lib/aframe.min.js +0 -0
js/app.js
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
const unityInstance = UnityLoader.instantiate("unityContainer", "%UNITY_WEBGL_BUILD_URL%");
|
2 |
-
let isCameraReady = false;
|
3 |
-
let isDetectionManagerReady = false;
|
4 |
-
let gl = null;
|
5 |
-
|
6 |
-
function cameraReady(){
|
7 |
-
isCameraReady = true;
|
8 |
-
gl = unityInstance.Module.ctx;
|
9 |
-
}
|
10 |
-
|
11 |
-
function detectionManagerReady(){
|
12 |
-
isDetectionManagerReady = true;
|
13 |
-
}
|
14 |
-
|
15 |
-
function createUnityMatrix(el){
|
16 |
-
const m = el.matrix.clone();
|
17 |
-
const zFlipped = new THREE.Matrix4().makeScale(1, 1, -1).multiply(m);
|
18 |
-
const rotated = zFlipped.multiply(new THREE.Matrix4().makeRotationX(-Math.PI/2));
|
19 |
-
return rotated;
|
20 |
-
}
|
21 |
-
|
22 |
-
AFRAME.registerComponent('markercontroller', {
|
23 |
-
schema: {
|
24 |
-
name : {type: 'string'}
|
25 |
-
},
|
26 |
-
tock: function(time, timeDelta){
|
27 |
-
|
28 |
-
let position = new THREE.Vector3();
|
29 |
-
let rotation = new THREE.Quaternion();
|
30 |
-
let scale = new THREE.Vector3();
|
31 |
-
|
32 |
-
createUnityMatrix(this.el.object3D).decompose(position, rotation, scale);
|
33 |
-
|
34 |
-
const serializedInfos = `${this.data.name},${this.el.object3D.visible},${position.toArray()},${rotation.toArray()},${scale.toArray()}`;
|
35 |
-
|
36 |
-
if(isDetectionManagerReady){
|
37 |
-
unityInstance.SendMessage("DetectionManager", "markerInfos", serializedInfos);
|
38 |
-
}
|
39 |
-
}
|
40 |
-
});
|
41 |
-
|
42 |
-
AFRAME.registerComponent('cameratransform', {
|
43 |
-
tock: function(time, timeDelta){
|
44 |
-
|
45 |
-
let camtr = new THREE.Vector3();
|
46 |
-
let camro = new THREE.Quaternion();
|
47 |
-
let camsc = new THREE.Vector3();
|
48 |
-
|
49 |
-
this.el.object3D.matrix.clone().decompose(camtr, camro, camsc);
|
50 |
-
|
51 |
-
const projection = this.el.components.camera.camera.projectionMatrix.clone();
|
52 |
-
const serializedProj = `${[...projection.elements]}`
|
53 |
-
|
54 |
-
const posCam = `${[...camtr.toArray()]}`
|
55 |
-
const rotCam = `${[...camro.toArray()]}`
|
56 |
-
|
57 |
-
if(isCameraReady){
|
58 |
-
unityInstance.SendMessage("Main Camera", "setProjection", serializedProj);
|
59 |
-
unityInstance.SendMessage("Main Camera", "setPosition", posCam);
|
60 |
-
unityInstance.SendMessage("Main Camera", "setRotation", rotCam);
|
61 |
-
|
62 |
-
let w = window.innerWidth;
|
63 |
-
let h = window.innerHeight;
|
64 |
-
|
65 |
-
const unityCanvas = document.getElementsByTagName('canvas')[0];
|
66 |
-
|
67 |
-
const ratio = unityCanvas.height / h;
|
68 |
-
|
69 |
-
w *= ratio
|
70 |
-
h *= ratio
|
71 |
-
|
72 |
-
const size = `${w},${h}`
|
73 |
-
|
74 |
-
unityInstance.SendMessage("Canvas", "setSize", size);
|
75 |
-
}
|
76 |
-
|
77 |
-
if(gl != null){
|
78 |
-
gl.dontClearOnFrameStart = true;
|
79 |
-
}
|
80 |
-
}
|
81 |
-
});
|
82 |
-
|
83 |
-
AFRAME.registerComponent('copycanvas', {
|
84 |
-
tick: function(time, timeDelta){
|
85 |
-
const unityCanvas = document.getElementsByTagName('canvas')[0];
|
86 |
-
unityCanvas.width = this.el.canvas.width
|
87 |
-
unityCanvas.height = this.el.canvas.height
|
88 |
-
}
|
89 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/lib/aframe-ar.js
DELETED
The diff for this file is too large to render.
See raw diff
|
|
js/lib/aframe.min.js
DELETED
The diff for this file is too large to render.
See raw diff
|
|