Showing
20 changed files
with
169 additions
and
122 deletions
1 | module.exports = function (grunt) { | 1 | module.exports = function (grunt) { |
2 | "use strict"; | 2 | "use strict"; |
3 | 3 | ||
4 | + let shim = function(obj) { return `\nexport default ${obj};\n`; }; | ||
5 | + | ||
4 | // Project configuration. | 6 | // Project configuration. |
5 | grunt.initConfig({ | 7 | grunt.initConfig({ |
6 | pkg: grunt.file.readJSON('package.json'), | 8 | pkg: grunt.file.readJSON('package.json'), |
... | @@ -80,6 +82,37 @@ module.exports = function (grunt) { | ... | @@ -80,6 +82,37 @@ module.exports = function (grunt) { |
80 | } | 82 | } |
81 | 83 | ||
82 | }, | 84 | }, |
85 | + file_append: { | ||
86 | + default_options: { | ||
87 | + files: [ | ||
88 | + { | ||
89 | + append: shim('AR'), | ||
90 | + prepend: `import CV from '../cv/index.js';\n`, | ||
91 | + input: './deps/aruco/index.js' | ||
92 | + }, | ||
93 | + { | ||
94 | + append: shim('CV'), | ||
95 | + input: './deps/cv/index.js' | ||
96 | + } | ||
97 | + ] | ||
98 | + } | ||
99 | + }, | ||
100 | + 'string-replace': { | ||
101 | + dist: { | ||
102 | + files: { | ||
103 | + 'deps/objloader/objloader.js': 'deps/objloader/index.js', | ||
104 | + 'deps/mtlloader/mtlloader.js': 'deps/mtlloader/index.js', | ||
105 | + 'deps/ddsloader/ddsloader.js': 'deps/ddsloader/index.js' | ||
106 | + }, | ||
107 | + options: { | ||
108 | + replacements:[{ | ||
109 | + pattern: '../../../build/three.module.js', | ||
110 | + replacement: '../three.js/index.js' | ||
111 | + }] | ||
112 | + } | ||
113 | + | ||
114 | + } | ||
115 | + }, | ||
83 | concat: { | 116 | concat: { |
84 | dist: { | 117 | dist: { |
85 | src: [ | 118 | src: [ |
... | @@ -122,9 +155,13 @@ module.exports = function (grunt) { | ... | @@ -122,9 +155,13 @@ module.exports = function (grunt) { |
122 | grunt.loadNpmTasks('grunt-jslint'); | 155 | grunt.loadNpmTasks('grunt-jslint'); |
123 | grunt.loadNpmTasks('grunt-terser'); | 156 | grunt.loadNpmTasks('grunt-terser'); |
124 | grunt.loadNpmTasks('grunt-bower-task'); | 157 | grunt.loadNpmTasks('grunt-bower-task'); |
158 | + grunt.loadNpmTasks('grunt-file-append'); | ||
159 | + grunt.loadNpmTasks('grunt-string-replace'); | ||
125 | 160 | ||
126 | // Default task(s). | 161 | // Default task(s). |
127 | grunt.registerTask('default', ['concat','copy','terser']); | 162 | grunt.registerTask('default', ['concat','copy','terser']); |
128 | grunt.registerTask('lint', ['jslint']); | 163 | grunt.registerTask('lint', ['jslint']); |
129 | grunt.registerTask('doc', ['jsdoc']); | 164 | grunt.registerTask('doc', ['jsdoc']); |
165 | + grunt.registerTask('install-deps', ['bower', 'file_append', 'string-replace']); | ||
166 | + | ||
130 | }; | 167 | }; | ... | ... |
1 | { | 1 | { |
2 | "name": "ARCS", | 2 | "name": "ARCS", |
3 | - "version": "0.1.0", | 3 | + "version": "0.2.0", |
4 | "description": "Augmented Reality Component System in web browser and node environment", | 4 | "description": "Augmented Reality Component System in web browser and node environment", |
5 | "main": "build/arcs.js", | 5 | "main": "build/arcs.js", |
6 | "keywords": [ | 6 | "keywords": [ |
... | @@ -11,10 +11,10 @@ | ... | @@ -11,10 +11,10 @@ |
11 | "license": "GPL", | 11 | "license": "GPL", |
12 | "dependencies": { | 12 | "dependencies": { |
13 | "tracking.js": "*", | 13 | "tracking.js": "*", |
14 | - "three.js": "https://raw.githubusercontent.com/mrdoob/three.js/r68/build/three.min.js", | 14 | + "three.js": "https://raw.githubusercontent.com/mrdoob/three.js/r116/build/three.module.js", |
15 | - "objloader" : "https://raw.githubusercontent.com/mrdoob/three.js/r68/examples/js/loaders/OBJLoader.js", | 15 | + "objloader" : "https://raw.githubusercontent.com/mrdoob/three.js/r116/examples/jsm/loaders/OBJLoader.js", |
16 | - "mtlloader": "https://raw.githubusercontent.com/mrdoob/three.js/r68/examples/js/loaders/MTLLoader.js", | 16 | + "mtlloader" : "https://raw.githubusercontent.com/mrdoob/three.js/r116/examples/jsm/loaders/MTLLoader.js", |
17 | - "objmtlloader": "https://raw.githubusercontent.com/mrdoob/three.js/r68/examples/js/loaders/OBJMTLLoader.js", | 17 | + "ddsloader" : "https://raw.githubusercontent.com/mrdoob/three.js/r116/examples/jsm/loaders/DDSLoader.js", |
18 | "aruco": "https://raw.githubusercontent.com/jcmellado/js-aruco/master/src/aruco.js", | 18 | "aruco": "https://raw.githubusercontent.com/jcmellado/js-aruco/master/src/aruco.js", |
19 | "cv": "https://raw.githubusercontent.com/jcmellado/js-aruco/master/src/cv.js", | 19 | "cv": "https://raw.githubusercontent.com/jcmellado/js-aruco/master/src/cv.js", |
20 | "codemirror" : "*", | 20 | "codemirror" : "*", | ... | ... |
This diff is collapsed. Click to expand it.
1 | -arcs_module( | ||
2 | - function (ARCS) { | ||
3 | - var Animator; | ||
4 | 1 | ||
5 | - /** | 2 | +import ARCS from '../build/arcs.js'; |
3 | + | ||
4 | +var Animator; | ||
5 | + | ||
6 | +/** | ||
6 | * @class Animator | 7 | * @class Animator |
7 | * @classdesc A component that request new frames for animation. | 8 | * @classdesc A component that request new frames for animation. |
8 | * This component is useful when you want to create animations in the | 9 | * This component is useful when you want to create animations in the |
9 | * context of a web browser. | 10 | * context of a web browser. |
10 | */ | 11 | */ |
11 | - Animator = ARCS.Component.create( | 12 | +Animator = ARCS.Component.create( |
12 | function() { | 13 | function() { |
13 | var paused = false; | 14 | var paused = false; |
14 | var self=this; | 15 | var self=this; |
... | @@ -49,8 +50,6 @@ arcs_module( | ... | @@ -49,8 +50,6 @@ arcs_module( |
49 | }, | 50 | }, |
50 | ['start','stop'], | 51 | ['start','stop'], |
51 | 'onAnimationFrame' | 52 | 'onAnimationFrame' |
52 | - ); | ||
53 | - | ||
54 | - return {Animator: Animator}; | ||
55 | - } | ||
56 | ); | 53 | ); |
54 | + | ||
55 | +export default {Animator: Animator}; | ... | ... |
1 | -arcs_module( | 1 | +import ARCS from '../build/arcs.js'; |
2 | - function (ARCS, CV, AR) { | 2 | +import CV from '../deps/cv/index.js'; |
3 | - var ARUCODetector; | 3 | +import AR from '../deps/aruco/index.js'; |
4 | 4 | ||
5 | - /** | 5 | +var ARUCODetector; |
6 | + | ||
7 | +/** | ||
6 | * @class ARUCODetector | 8 | * @class ARUCODetector |
7 | * @classdesc Component that detects ARUCO markers in images | 9 | * @classdesc Component that detects ARUCO markers in images |
8 | * This component encapsulate the {@link https://github.com/jcmellado/js-aruco|js-aruco} library. | 10 | * This component encapsulate the {@link https://github.com/jcmellado/js-aruco|js-aruco} library. |
9 | */ | 11 | */ |
10 | - ARUCODetector = ARCS.Component.create( | 12 | +ARUCODetector = ARCS.Component.create( |
11 | function() { | 13 | function() { |
12 | var detector ; | 14 | var detector ; |
13 | 15 | ||
... | @@ -48,12 +50,6 @@ arcs_module( | ... | @@ -48,12 +50,6 @@ arcs_module( |
48 | }, | 50 | }, |
49 | 'detect', | 51 | 'detect', |
50 | ['onMarkers'] | 52 | ['onMarkers'] |
51 | - ); | ||
52 | - | ||
53 | - return {ARUCODetector: ARUCODetector}; | ||
54 | - }, | ||
55 | - [ | ||
56 | - {name:"deps/cv/index", exports:"CV"}, | ||
57 | - {name:"deps/aruco/index",exports:"AR"} | ||
58 | - ] | ||
59 | ); | 53 | ); |
54 | + | ||
55 | +export default {ARUCODetector: ARUCODetector}; | ... | ... |
1 | -arcs_module( | ||
2 | - function(ARCS, three) { | ||
3 | - var ARViewer; | ||
4 | 1 | ||
5 | - /** | 2 | +import ARCS from '../build/arcs.js'; |
3 | +import * as THREE from '../deps/three.js/index.js'; | ||
4 | +import FrustumCamera from '../deps/three.js/frustumcamera.js'; | ||
5 | + | ||
6 | +var ARViewer; | ||
7 | + | ||
8 | +/** | ||
6 | * @class ARViewer | 9 | * @class ARViewer |
7 | * @classdesc Simple compositing viewer for augmented reality | 10 | * @classdesc Simple compositing viewer for augmented reality |
8 | */ | 11 | */ |
9 | - ARViewer = ARCS.Component.create( | 12 | +ARViewer = ARCS.Component.create( |
10 | /** @lends ARViewer.prototype */ | 13 | /** @lends ARViewer.prototype */ |
11 | function () { | 14 | function () { |
12 | var container, sourceAspectRatio, sourceHeight; | 15 | var container, sourceAspectRatio, sourceHeight; |
... | @@ -282,7 +285,9 @@ arcs_module( | ... | @@ -282,7 +285,9 @@ arcs_module( |
282 | var box = new THREE.Box3(); | 285 | var box = new THREE.Box3(); |
283 | box.setFromObject(scene3d); | 286 | box.setFromObject(scene3d); |
284 | var center = box.center(); | 287 | var center = box.center(); |
285 | - var radius = box.getBoundingSphere().radius; | 288 | + var sphere = new THREE.Sphere(); |
289 | + box.getBoundingSphere(sphere); | ||
290 | + var radius = sphere.radius; | ||
286 | 291 | ||
287 | camera3d.position.x = center.x ; | 292 | camera3d.position.x = center.x ; |
288 | camera3d.position.y = center.y ; | 293 | camera3d.position.y = center.y ; |
... | @@ -311,8 +316,7 @@ arcs_module( | ... | @@ -311,8 +316,7 @@ arcs_module( |
311 | 316 | ||
312 | ], | 317 | ], |
313 | [] | 318 | [] |
314 | - ); | ||
315 | - return {ARViewer: ARViewer}; | ||
316 | - }, | ||
317 | - [ 'deps/three.js/index','deps/three.js/frustumcamera'] | ||
318 | ); | 319 | ); |
320 | + | ||
321 | +export default {ARViewer: ARViewer}; | ||
322 | + | ... | ... |
1 | +import ARCS from '../build/arcs.js'; | ||
2 | +import POS from '../deps/pose/square_pose.js'; | ||
1 | 3 | ||
4 | +var MarkerLocator; | ||
2 | 5 | ||
3 | -arcs_module( | ||
4 | - function (ARCS, POS) { | ||
5 | - var MarkerLocator; | ||
6 | 6 | ||
7 | - | 7 | +MarkerLocator = ARCS.Component.create( |
8 | - MarkerLocator = ARCS.Component.create( | ||
9 | function () { | 8 | function () { |
10 | var square_pose = new POS.SquareFiducial(); | 9 | var square_pose = new POS.SquareFiducial(); |
11 | 10 | ||
... | @@ -44,10 +43,7 @@ arcs_module( | ... | @@ -44,10 +43,7 @@ arcs_module( |
44 | }, | 43 | }, |
45 | ['locateMarkers','setFocalLength','setModelSize','setImageSource'], | 44 | ['locateMarkers','setFocalLength','setModelSize','setImageSource'], |
46 | ['onLocatedMarkers'] | 45 | ['onLocatedMarkers'] |
47 | - ); | 46 | +); |
48 | 47 | ||
49 | 48 | ||
50 | - return { MarkerLocator: MarkerLocator }; | ||
51 | - }, | ||
52 | - [ {name: "deps/pose/square_pose", exports: "POS"} ] | ||
53 | -); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
49 | +export default { MarkerLocator: MarkerLocator }; | ... | ... |
1 | -arcs_module( | 1 | +import ARCS from '../build/arcs.js'; |
2 | - function(ARCS,_three) { | 2 | +import * as THREE from '../deps/three.js/index.js'; |
3 | - var ObjectTransform ; | ||
4 | 3 | ||
5 | - /** | 4 | +var ObjectTransform ; |
5 | + | ||
6 | +/** | ||
6 | * @class ObjectTransform | 7 | * @class ObjectTransform |
7 | * @classdesc Apply transformations to objects | 8 | * @classdesc Apply transformations to objects |
8 | */ | 9 | */ |
9 | - ObjectTransform = ARCS.Component.create( | 10 | +ObjectTransform = ARCS.Component.create( |
10 | function() { | 11 | function() { |
11 | var objRoot; | 12 | var objRoot; |
12 | var refMat; | 13 | var refMat; |
... | @@ -115,11 +116,6 @@ arcs_module( | ... | @@ -115,11 +116,6 @@ arcs_module( |
115 | }, | 116 | }, |
116 | ['setObject', 'setTransform', 'setId'], | 117 | ['setObject', 'setTransform', 'setId'], |
117 | [] | 118 | [] |
118 | - ); | ||
119 | - | ||
120 | - | ||
121 | - | ||
122 | - return { ObjectTransform : ObjectTransform }; | ||
123 | - }, | ||
124 | - [ "deps/three.js/index" ] | ||
125 | ); | 119 | ); |
120 | + | ||
121 | +export default { ObjectTransform : ObjectTransform }; | ... | ... |
1 | -arcs_module( | 1 | +import ARCS from '../build/arcs.js'; |
2 | - function(ARCS, three, _objloader, _mtlloader, _objmtlloader) { | 2 | +import * as THREE from '../deps/three.js/index.js'; |
3 | - var OBJLoader; | 3 | +import { OBJLoader } from '../deps/objloader/objloader.js'; |
4 | +import { MTLLoader } from '../deps/mtlloader/mtlloader.js'; | ||
5 | +//import { DDSLoader } from '../deps/ddsloader/ddsloader.js'; | ||
4 | 6 | ||
5 | 7 | ||
6 | - OBJLoader = ARCS.Component.create( | 8 | +var internalOBJLoader; |
9 | + | ||
10 | + | ||
11 | +internalOBJLoader = ARCS.Component.create( | ||
7 | function() { | 12 | function() { |
8 | var self = this; | 13 | var self = this; |
9 | var innerObject; | 14 | var innerObject; |
... | @@ -34,23 +39,31 @@ arcs_module( | ... | @@ -34,23 +39,31 @@ arcs_module( |
34 | // we may use a string tokenizer to determine file types | 39 | // we may use a string tokenizer to determine file types |
35 | // then all would be in the same loading slot. | 40 | // then all would be in the same loading slot. |
36 | 41 | ||
42 | + //console.log("loading objects", objURL, mtlURL); | ||
43 | + var manager = new THREE.LoadingManager(); | ||
44 | + //manager.addHandler( /\.dds$/i, new DDSLoader() ); | ||
37 | 45 | ||
38 | - console.log("loading objects", objURL, mtlURL); | ||
39 | if (mtlURL === undefined) { | 46 | if (mtlURL === undefined) { |
40 | //console.log("using loader"); | 47 | //console.log("using loader"); |
41 | - loader = new THREE.OBJLoader(); | 48 | + loader = new OBJLoader(manager); |
42 | loader.load(objURL, onLoadWrapper, progress, error); | 49 | loader.load(objURL, onLoadWrapper, progress, error); |
43 | } else { | 50 | } else { |
44 | //console.log("using mtl loader"); | 51 | //console.log("using mtl loader"); |
45 | - loader = new THREE.OBJMTLLoader(); | 52 | + loader = new MTLLoader(manager); |
46 | - loader.load(objURL, mtlURL, onLoadWrapper, progress, error); | 53 | + loader.load(mtlURL, function(materials) { |
54 | + materials.preload(); | ||
55 | + console.log(materials); | ||
56 | + new OBJLoader(manager) | ||
57 | + .setMaterials(materials) | ||
58 | + .load(objURL, onLoadWrapper, progress, error); | ||
59 | + }, progress, error); | ||
47 | } | 60 | } |
48 | }; | 61 | }; |
49 | 62 | ||
50 | this.loadJSON = function(jsonURL) { | 63 | this.loadJSON = function(jsonURL) { |
51 | var loader; | 64 | var loader; |
52 | //console.log("loading objects", jsonURL); | 65 | //console.log("loading objects", jsonURL); |
53 | - loader = new THREE.JSONLoader(); | 66 | + loader = new THREE.ObjectLoader(); |
54 | loader.load(jsonURL, onLoadJSON); //, progress, error); | 67 | loader.load(jsonURL, onLoadJSON); //, progress, error); |
55 | 68 | ||
56 | 69 | ||
... | @@ -93,9 +106,6 @@ arcs_module( | ... | @@ -93,9 +106,6 @@ arcs_module( |
93 | }, | 106 | }, |
94 | ["load","unitize", "resize"], | 107 | ["load","unitize", "resize"], |
95 | ["onLoad"] | 108 | ["onLoad"] |
96 | - ); | ||
97 | - | ||
98 | - return { OBJLoader: OBJLoader}; | ||
99 | - }, | ||
100 | - [ 'deps/three.js/index', 'deps/objloader/index', 'deps/mtlloader/index','deps/objmtlloader/index' ] | ||
101 | ); | 109 | ); |
110 | + | ||
111 | +export default { OBJLoader: internalOBJLoader}; | ... | ... |
1 | -arcs_module(function(ARCS) { | 1 | +import ARCS from '../build/arcs.js'; |
2 | - var TokenSender; | ||
3 | 2 | ||
4 | - TokenSender = ARCS.Component.create( | 3 | +var TokenSender; |
4 | + | ||
5 | +TokenSender = ARCS.Component.create( | ||
5 | function( arr ) { | 6 | function( arr ) { |
6 | var i; | 7 | var i; |
7 | var self = this; | 8 | var self = this; |
... | @@ -20,7 +21,6 @@ arcs_module(function(ARCS) { | ... | @@ -20,7 +21,6 @@ arcs_module(function(ARCS) { |
20 | }, | 21 | }, |
21 | [], | 22 | [], |
22 | ['sendToken'] | 23 | ['sendToken'] |
23 | - ); | 24 | +); |
24 | 25 | ||
25 | - return { TokenSender : TokenSender }; | ||
26 | -}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
26 | +export default { TokenSender : TokenSender }; | ... | ... |
1 | -arcs_module(function(ARCS) { | 1 | +import ARCS from '../build/arcs.js'; |
2 | - var LiveSource, VideoSource; | 2 | + |
3 | - LiveSource = ARCS.Component.create( | 3 | +var LiveSource, VideoSource; |
4 | +LiveSource = ARCS.Component.create( | ||
4 | function () { | 5 | function () { |
5 | var context, canvas, video, imageData; | 6 | var context, canvas, video, imageData; |
6 | var defaultWidth = 320; | 7 | var defaultWidth = 320; |
... | @@ -8,15 +9,18 @@ arcs_module(function(ARCS) { | ... | @@ -8,15 +9,18 @@ arcs_module(function(ARCS) { |
8 | var self = this; | 9 | var self = this; |
9 | 10 | ||
10 | var handleMediaStream = function(stream) { | 11 | var handleMediaStream = function(stream) { |
12 | + console.log(video,stream); | ||
11 | if (window.webkitURL) { | 13 | if (window.webkitURL) { |
12 | video.src = window.webkitURL.createObjectURL(stream); | 14 | video.src = window.webkitURL.createObjectURL(stream); |
13 | } else if (video.mozSrcObject !== undefined) { | 15 | } else if (video.mozSrcObject !== undefined) { |
14 | video.mozSrcObject = stream; | 16 | video.mozSrcObject = stream; |
17 | + } else if (video.srcObject !== undefined) { | ||
18 | + video.srcObject = stream; | ||
15 | } else { | 19 | } else { |
16 | video.src = stream; | 20 | video.src = stream; |
17 | } | 21 | } |
18 | - video.videoWidth=defaultWidth; | 22 | + /*video.videoWidth=defaultWidth; |
19 | - video.videoHeight=defaultHeight; | 23 | + video.videoHeight=defaultHeight;*/ |
20 | self.emit("onReady"); | 24 | self.emit("onReady"); |
21 | }; | 25 | }; |
22 | 26 | ||
... | @@ -25,17 +29,14 @@ arcs_module(function(ARCS) { | ... | @@ -25,17 +29,14 @@ arcs_module(function(ARCS) { |
25 | }; | 29 | }; |
26 | 30 | ||
27 | var setUserMedia = function() { | 31 | var setUserMedia = function() { |
28 | - console.log("video test"); | ||
29 | if (navigator.mediaDevices !== undefined) { | 32 | if (navigator.mediaDevices !== undefined) { |
30 | - navigator.mediaDevices.getUserMedia({video:true}) | 33 | + navigator.mediaDevices.getUserMedia({video: {facingMode: "environment", width: defaultWidth, height: defaultHeight}}) |
31 | .then(handleMediaStream) | 34 | .then(handleMediaStream) |
32 | .catch(errorMediaStream); | 35 | .catch(errorMediaStream); |
33 | } else { | 36 | } else { |
34 | var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia; | 37 | var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia; |
35 | if (getUserMedia !== undefined) { | 38 | if (getUserMedia !== undefined) { |
36 | - getUserMedia({video:true}, handleMediaStream, | 39 | + getUserMedia({video:true}).then(handleMediaStream); |
37 | - errorMediaStream | ||
38 | - ); | ||
39 | } | 40 | } |
40 | } | 41 | } |
41 | }; | 42 | }; |
... | @@ -71,10 +72,10 @@ arcs_module(function(ARCS) { | ... | @@ -71,10 +72,10 @@ arcs_module(function(ARCS) { |
71 | }, | 72 | }, |
72 | ['grabFrame','setWidgets'], | 73 | ['grabFrame','setWidgets'], |
73 | ['onReady','onImage'] | 74 | ['onReady','onImage'] |
74 | - ); | 75 | +); |
75 | 76 | ||
76 | 77 | ||
77 | - VideoSource = ARCS.Component.create( | 78 | +VideoSource = ARCS.Component.create( |
78 | function() { | 79 | function() { |
79 | var context, canvas, video, imageData; | 80 | var context, canvas, video, imageData; |
80 | var defaultWidth=320; | 81 | var defaultWidth=320; |
... | @@ -120,8 +121,8 @@ arcs_module(function(ARCS) { | ... | @@ -120,8 +121,8 @@ arcs_module(function(ARCS) { |
120 | }, | 121 | }, |
121 | ['grabFrame', 'setWidgets'], | 122 | ['grabFrame', 'setWidgets'], |
122 | ['onReady', 'onImage'] | 123 | ['onReady', 'onImage'] |
123 | - ); | 124 | +); |
125 | + | ||
124 | 126 | ||
125 | 127 | ||
126 | - return {LiveSource: LiveSource, VideoSource: VideoSource}; | ||
127 | -}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
128 | +export default {LiveSource: LiveSource, VideoSource: VideoSource}; | ... | ... |
1 | -arcs_module( | 1 | +import ARCS from '../build/arcs.js'; |
2 | - function (ARCS) { | ||
3 | - var WindowEvent; | ||
4 | 2 | ||
5 | - WindowEvent = ARCS.Component.create( | 3 | +let WindowEvent; |
4 | + | ||
5 | +WindowEvent = ARCS.Component.create( | ||
6 | function () { | 6 | function () { |
7 | - var self= this; | 7 | + let self= this; |
8 | 8 | ||
9 | window.onresize = function() { | 9 | window.onresize = function() { |
10 | self.emit("onResize",window.innerWidth, window.innerHeight); | 10 | self.emit("onResize",window.innerWidth, window.innerHeight); |
... | @@ -12,8 +12,7 @@ arcs_module( | ... | @@ -12,8 +12,7 @@ arcs_module( |
12 | }, | 12 | }, |
13 | [], | 13 | [], |
14 | ["onResize"] | 14 | ["onResize"] |
15 | - ); | ||
16 | - | ||
17 | - return { WindowEvent: WindowEvent}; | ||
18 | - } | ||
19 | ); | 15 | ); |
16 | + | ||
17 | + | ||
18 | +export default { WindowEvent: WindowEvent}; | ... | ... |
... | @@ -493,3 +493,5 @@ Mat3.prototype.row = function(index){ | ... | @@ -493,3 +493,5 @@ Mat3.prototype.row = function(index){ |
493 | 493 | ||
494 | return new Vec3( m[index][0], m[index][1], m[index][2] ); | 494 | return new Vec3( m[index][0], m[index][1], m[index][2] ); |
495 | }; | 495 | }; |
496 | + | ||
497 | +export default POS; | ... | ... |
... | @@ -529,3 +529,5 @@ POS.Pose = function(error1, rotation1, translation1, error2, rotation2, translat | ... | @@ -529,3 +529,5 @@ POS.Pose = function(error1, rotation1, translation1, error2, rotation2, translat |
529 | this.alternativeRotation = rotation2; | 529 | this.alternativeRotation = rotation2; |
530 | this.alternativeTranslation = translation2; | 530 | this.alternativeTranslation = translation2; |
531 | }; | 531 | }; |
532 | + | ||
533 | +export default POS; | ... | ... |
... | @@ -281,3 +281,5 @@ SVD.pythag = function(a, b){ | ... | @@ -281,3 +281,5 @@ SVD.pythag = function(a, b){ |
281 | SVD.sign = function(a, b){ | 281 | SVD.sign = function(a, b){ |
282 | return b >= 0.0? Math.abs(a): -Math.abs(a); | 282 | return b >= 0.0? Math.abs(a): -Math.abs(a); |
283 | }; | 283 | }; |
284 | + | ||
285 | +export default SVD; | ... | ... |
1 | -arcs_module(function(ARCS) { | 1 | +import * as THREE from './index.js'; |
2 | -THREE.FrustumCamera = function ( left, right, bottom, top, near, far ) { | 2 | + |
3 | +let FrustumCamera = function ( left, right, bottom, top, near, far ) { | ||
3 | 4 | ||
4 | THREE.Camera.call( this ); | 5 | THREE.Camera.call( this ); |
5 | 6 | ||
... | @@ -17,22 +18,22 @@ THREE.FrustumCamera = function ( left, right, bottom, top, near, far ) { | ... | @@ -17,22 +18,22 @@ THREE.FrustumCamera = function ( left, right, bottom, top, near, far ) { |
17 | 18 | ||
18 | }; | 19 | }; |
19 | 20 | ||
20 | -THREE.FrustumCamera.prototype = Object.create( THREE.Camera.prototype ); | 21 | +FrustumCamera.prototype = Object.create( THREE.Camera.prototype ); |
21 | -THREE.FrustumCamera.prototype.constructor = THREE.FrustumCamera; | 22 | +FrustumCamera.prototype.constructor = FrustumCamera; |
22 | 23 | ||
23 | 24 | ||
24 | 25 | ||
25 | 26 | ||
26 | -THREE.FrustumCamera.prototype.updateProjectionMatrix = function () { | 27 | +FrustumCamera.prototype.updateProjectionMatrix = function () { |
27 | 28 | ||
28 | this.projectionMatrix.makeFrustum( | 29 | this.projectionMatrix.makeFrustum( |
29 | this.left, this.right, this.bottom, this.top, this.near, this.far | 30 | this.left, this.right, this.bottom, this.top, this.near, this.far |
30 | ); | 31 | ); |
31 | }; | 32 | }; |
32 | 33 | ||
33 | -THREE.FrustumCamera.prototype.clone = function () { | 34 | +FrustumCamera.prototype.clone = function () { |
34 | 35 | ||
35 | - var camera = new THREE.FrustumCamera(); | 36 | + var camera = new FrustumCamera(); |
36 | 37 | ||
37 | THREE.Camera.prototype.clone.call( this, camera ); | 38 | THREE.Camera.prototype.clone.call( this, camera ); |
38 | 39 | ||
... | @@ -51,6 +52,4 @@ THREE.FrustumCamera.prototype.clone = function () { | ... | @@ -51,6 +52,4 @@ THREE.FrustumCamera.prototype.clone = function () { |
51 | 52 | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | -return {}; | 55 | +export default FrustumCamera; |
55 | -}, ['deps/three.js/index'] | ||
56 | -); | ... | ... |
... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
11 | "Reality" | 11 | "Reality" |
12 | ], | 12 | ], |
13 | "author": "Jean-Yves Didier", | 13 | "author": "Jean-Yves Didier", |
14 | - "license": "GPL", | 14 | + "license": "GPL-3.0-or-later", |
15 | "devDependencies": { | 15 | "devDependencies": { |
16 | "bower": ">=1.3.9", | 16 | "bower": ">=1.3.9", |
17 | "grunt": ">=0.4.5", | 17 | "grunt": ">=0.4.5", |
... | @@ -20,6 +20,8 @@ | ... | @@ -20,6 +20,8 @@ |
20 | "grunt-jsdoc": ">=0.5.6", | 20 | "grunt-jsdoc": ">=0.5.6", |
21 | "grunt-bower-task": ">=0.4.0", | 21 | "grunt-bower-task": ">=0.4.0", |
22 | "grunt-contrib-concat": ">=0.5.0", | 22 | "grunt-contrib-concat": ">=0.5.0", |
23 | - "grunt-contrib-copy": ">=1.0.0" | 23 | + "grunt-contrib-copy": ">=1.0.0", |
24 | + "grunt-file-append": ">=0.0.7", | ||
25 | + "grunt-string-replace": ">=1.3.1" | ||
24 | } | 26 | } |
25 | } | 27 | } | ... | ... |
1 | { | 1 | { |
2 | "context": { | 2 | "context": { |
3 | "libraries": [ | 3 | "libraries": [ |
4 | - "components/arviewer","components/animator", | 4 | + "../components/arviewer.js","../components/animator.js", |
5 | - "components/objloader","components/video", | 5 | + "../components/objloader.js","../components/video.js", |
6 | - "components/arucodetector", "components/markerlocator", | 6 | + "../components/arucodetector.js", "../components/markerlocator.js", |
7 | - "components/windowevent", "components/tokensender", "components/objecttransform" | 7 | + "../components/windowevent.js", "../components/tokensender.js", "../components/objecttransform.js" |
8 | ], | 8 | ], |
9 | "components": { | 9 | "components": { |
10 | "viewer": { "type": "ARViewer"}, | 10 | "viewer": { "type": "ARViewer"}, | ... | ... |
... | @@ -2,15 +2,15 @@ | ... | @@ -2,15 +2,15 @@ |
2 | <head> | 2 | <head> |
3 | <title>ARCS: marker experiment</title> | 3 | <title>ARCS: marker experiment</title> |
4 | <link type="text/css" rel="stylesheet" href="arcs.css"> | 4 | <link type="text/css" rel="stylesheet" href="arcs.css"> |
5 | - <script data-main="../../build/arcs_browser" | 5 | + <script src="../../build/arcs_browser.js" |
6 | data-base-url="../.." | 6 | data-base-url="../.." |
7 | data-arcsapp="arcsapp.json" | 7 | data-arcsapp="arcsapp.json" |
8 | - src="../../deps/requirejs/require.js"> | 8 | + type="module"> |
9 | </script> | 9 | </script> |
10 | <meta charset="UTF-8"> | 10 | <meta charset="UTF-8"> |
11 | </head> | 11 | </head> |
12 | <body> | 12 | <body> |
13 | - <video id="video" width=320 height=240 autoplay="true" style="display: none;"></video> | 13 | + <video id="video" width=640 height=480 autoplay="true" style="display: none;"></video> |
14 | <canvas id="canvas"></canvas> | 14 | <canvas id="canvas"></canvas> |
15 | <div id="container" ></div> | 15 | <div id="container" ></div> |
16 | <div id="contents"> | 16 | <div id="contents"> | ... | ... |
-
Please register or login to post a comment