diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc371a66888c9c268cd96dd6ddd6747a30c250d8..a1906ec8b0b440f778e6bec2a7027fb4486d6358 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,8 +5,9 @@
- fixed perspective in artoolkit portrait #212 (thanks @pikilipita)
- fixed barcode in a-frame #260 (thanks @basbase)
- created portableAR.js - a simple way to port ar.js to a non-three.js framework
- - it is in contribs/portableAR.js
- - ported babylon.js to portableAR.js
+ - it is in /three.js/contribs/portableAR.js
+ - in [examples/]() you can find babylon.js using portableAR.js
+
## Tests
- Made tests to report failure - yeah i know it is silly but before it reported
diff --git a/TODO2.md b/TODO2.md
index 0462aa04f7e7eca0860645507773bccd2cb66144..d26da7849be631fbba849db8846fb310b0c1ad82 100644
--- a/TODO2.md
+++ b/TODO2.md
@@ -1,8 +1,19 @@
# reorganize the repo
-- remove any tango support
+- rename EasyARjs into PortableARjs
- remove webvr-polyfill
-- fix the testing, seems to have projection issue on image read, works on webcam tho
-- import the new babylon.js port
-- clean up data
-- remove all the examples which are only demos.
+- merge to master
+---
+- remove all the examples which are only demos
+ - aframe/demos three.js/demos instead of examples
- maybe put them in a arjs-demos repository ?
+ - currently move them in this repo, in their own directory
+ - demos/three.js demos/aframe
+ - make them as standalone as possible, aka copy dependancy in their
+ - when it is ready
+- remove three.js dependancy
+- remove any tango support
+- clean up data
+
+
+- DONE fix the testing, seems to have projection issue on image read, works on webcam tho
+- DONE import the new babylon.js port
diff --git a/contribs/portableAR.js/Makefile b/contribs/portableAR.js/Makefile
deleted file mode 100644
index de61e6143f05014ff06216b8e3d3e68e53df4590..0000000000000000000000000000000000000000
--- a/contribs/portableAR.js/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-watch: build
- fswatch -0 src/*.js ../../three.js/src/*/*.js | xargs -0 -n 1 -I {} make build
-
-.PHONY: build
-build:
- (cd ../../three.js/ && make build)
- cat \
- ../../three.js/examples/vendor/three.js/build/three.js \
- ../../three.js/build/ar.js \
- src/portable-ar.js \
- > build/portable-ar.js
-
-minify: build
- uglifyjs build/portable-ar.js > build/portable-ar.min.js
diff --git a/contribs/portableAR.js/src/TODO.md b/contribs/portableAR.js/src/TODO.md
deleted file mode 100644
index 59d29f1826053525414b66beb6379a783a57832f..0000000000000000000000000000000000000000
--- a/contribs/portableAR.js/src/TODO.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# easy-ar.js
-- provide cameraProjection matrix
-
-- whenever tracking is happening, notified thru event
- - tracking-started
- - tracking-stopped
-
-- https://github.com/jeromeetienne/microevent.js/blob/master/microevent.js#L12-31
-
-
-```js
-var ezAR = new ezAR()
-
-ezAR.addEventListener('ready', function(){
- // ezAR.cameraProjectionMatrix = array(16)
-})
-
-ezAR.addEventListener('tracking-updated', function(cameraTransform){
-
-})
-
-ezAR.addEventListener('tracking-stopped', function(){
-
-})
-ezAR.addEventListener('tracking-started', function(){
-
-})
-```
diff --git a/test/screenshots/reference/learns an markers-area and play it-chrome.png b/test/screenshots/reference/learns an markers-area and play it-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..e3680a07bb4ff77e96021adfb3de000fb7aa5565
Binary files /dev/null and b/test/screenshots/reference/learns an markers-area and play it-chrome.png differ
diff --git a/test/screenshots/reference/rendering-three.js-artookit-640x480-chrome.png b/test/screenshots/reference/rendering-three.js-artookit-640x480-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..1b484f70871643191fbc4578bc4c0ed5ebcad4bf
Binary files /dev/null and b/test/screenshots/reference/rendering-three.js-artookit-640x480-chrome.png differ
diff --git a/test/screenshots/reference/rendering-three.js-aruco-640x480-chrome.png b/test/screenshots/reference/rendering-three.js-aruco-640x480-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..39e9ee598c8a86f8f3f537759ec4b7ea269fe8e2
Binary files /dev/null and b/test/screenshots/reference/rendering-three.js-aruco-640x480-chrome.png differ
diff --git a/test/screenshots/reference/resets the markers-area and enable marker-helpers-chrome.png b/test/screenshots/reference/resets the markers-area and enable marker-helpers-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..b679d841e510032faa16c8aa18b1290478ea0efc
Binary files /dev/null and b/test/screenshots/reference/resets the markers-area and enable marker-helpers-chrome.png differ
diff --git a/test/screenshots/reference/test hit testing-chrome.png b/test/screenshots/reference/test hit testing-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..c187688c47c0856ee350344c981bea5ab98782e6
Binary files /dev/null and b/test/screenshots/reference/test hit testing-chrome.png differ
diff --git a/test/screenshots/reference/uses a markers-area and enabled markers-helpers-chrome.png b/test/screenshots/reference/uses a markers-area and enabled markers-helpers-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..0727159fb0f869945796a214698dfdf7a1a1427e
Binary files /dev/null and b/test/screenshots/reference/uses a markers-area and enabled markers-helpers-chrome.png differ
diff --git a/test/screenshots/screen/learns an markers-area and play it-chrome.png b/test/screenshots/screen/learns an markers-area and play it-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..e3680a07bb4ff77e96021adfb3de000fb7aa5565
Binary files /dev/null and b/test/screenshots/screen/learns an markers-area and play it-chrome.png differ
diff --git a/test/screenshots/screen/rendering-three.js-artookit-640x480-chrome.png b/test/screenshots/screen/rendering-three.js-artookit-640x480-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..1b484f70871643191fbc4578bc4c0ed5ebcad4bf
Binary files /dev/null and b/test/screenshots/screen/rendering-three.js-artookit-640x480-chrome.png differ
diff --git a/test/screenshots/screen/rendering-three.js-aruco-640x480-chrome.png b/test/screenshots/screen/rendering-three.js-aruco-640x480-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..39e9ee598c8a86f8f3f537759ec4b7ea269fe8e2
Binary files /dev/null and b/test/screenshots/screen/rendering-three.js-aruco-640x480-chrome.png differ
diff --git a/test/screenshots/screen/resets the markers-area and enable marker-helpers-chrome.png b/test/screenshots/screen/resets the markers-area and enable marker-helpers-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..b679d841e510032faa16c8aa18b1290478ea0efc
Binary files /dev/null and b/test/screenshots/screen/resets the markers-area and enable marker-helpers-chrome.png differ
diff --git a/test/screenshots/screen/test hit testing-chrome.png b/test/screenshots/screen/test hit testing-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..c187688c47c0856ee350344c981bea5ab98782e6
Binary files /dev/null and b/test/screenshots/screen/test hit testing-chrome.png differ
diff --git a/test/screenshots/screen/uses a markers-area and enabled markers-helpers-chrome.png b/test/screenshots/screen/uses a markers-area and enabled markers-helpers-chrome.png
new file mode 100644
index 0000000000000000000000000000000000000000..0727159fb0f869945796a214698dfdf7a1a1427e
Binary files /dev/null and b/test/screenshots/screen/uses a markers-area and enabled markers-helpers-chrome.png differ
diff --git a/three.js/build/ar.js b/three.js/build/ar.js
index 52c7e9d5f84bb84b04b89d021fdf272fb964157b..e7625a25dc7920aed156e149585ce08be1999d90 100644
--- a/three.js/build/ar.js
+++ b/three.js/build/ar.js
@@ -1029,15 +1029,13 @@ var Qb=[Ik,Zh,_h,Qj,Qi,Pi,Ri,Ag,sg,qg,rg,yg,kh,jh,Oi,Mj];var Rb=[Jk,ki,ji,gi];va
image = this.image;
}
- if (image.videoWidth > image.videoHeight)
- {
- //landscape
+ if( (image.nodeName === 'IMG' && image.width > image.height ) ||
+ (image.nodeName === 'VIDEO' && image.videoWidth > image.videoHeight) ){
+ // if landscape
this.ctx.drawImage(image, 0, 0, this.canvas.width, this.canvas.height); // draw video
- }
- else {
-
+ }else{
+ // if portrait
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
- //portrait
var scale = this.canvas.height / this.canvas.width;
var scaledHeight = this.canvas.width*scale;
var scaledWidth = this.canvas.height*scale;
diff --git a/three.js/contribs/portableAR.js/Makefile b/three.js/contribs/portableAR.js/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..c3698a849653e188ba52295c4873005f50a8e584
--- /dev/null
+++ b/three.js/contribs/portableAR.js/Makefile
@@ -0,0 +1,14 @@
+watch: build
+ fswatch -0 src/*.js ../../src/*/*.js | xargs -0 -n 1 -I {} make build
+
+.PHONY: build
+build:
+ (cd ../../ && make build)
+ cat \
+ ../../examples/vendor/three.js/build/three.js \
+ ../../build/ar.js \
+ src/portable-ar.js \
+ > build/portable-ar.js
+
+minify: build
+ uglifyjs build/portable-ar.js > build/portable-ar.min.js
diff --git a/contribs/portableAR.js/README.md b/three.js/contribs/portableAR.js/README.md
similarity index 100%
rename from contribs/portableAR.js/README.md
rename to three.js/contribs/portableAR.js/README.md
diff --git a/contribs/portableAR.js/TODO.md b/three.js/contribs/portableAR.js/TODO.md
similarity index 100%
rename from contribs/portableAR.js/TODO.md
rename to three.js/contribs/portableAR.js/TODO.md
diff --git a/contribs/portableAR.js/build/portable-ar.js b/three.js/contribs/portableAR.js/build/portable-ar.js
similarity index 99%
rename from contribs/portableAR.js/build/portable-ar.js
rename to three.js/contribs/portableAR.js/build/portable-ar.js
index 4f5227996a31e5b450e2d000758b1cf193fdb6db..5e81113423d538a885f052b73ec0b5288564ee9e 100644
--- a/contribs/portableAR.js/build/portable-ar.js
+++ b/three.js/contribs/portableAR.js/build/portable-ar.js
@@ -45139,15 +45139,13 @@ var Qb=[Ik,Zh,_h,Qj,Qi,Pi,Ri,Ag,sg,qg,rg,yg,kh,jh,Oi,Mj];var Rb=[Jk,ki,ji,gi];va
image = this.image;
}
- if (image.videoWidth > image.videoHeight)
- {
- //landscape
+ if( (image.nodeName === 'IMG' && image.width > image.height ) ||
+ (image.nodeName === 'VIDEO' && image.videoWidth > image.videoHeight) ){
+ // if landscape
this.ctx.drawImage(image, 0, 0, this.canvas.width, this.canvas.height); // draw video
- }
- else {
-
+ }else{
+ // if portrait
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
- //portrait
var scale = this.canvas.height / this.canvas.width;
var scaledHeight = this.canvas.width*scale;
var scaledWidth = this.canvas.height*scale;
@@ -52304,7 +52302,7 @@ ARjs.MarkersAreaUtils.buildMarkersAreaFileFromResolution = function(trackingBack
parameters.barcodeValue = layout2Barcode[layout]
}
}
-var EasyARjs = function(canvasEl, options){
+var PortableARjs = function(canvasEl, options){
// handle default options
options = options || {}
options.debugUI = options.debugUI !== undefined ? options.debugUI : false
@@ -52410,7 +52408,7 @@ var EasyARjs = function(canvasEl, options){
// Code Separator
//////////////////////////////////////////////////////////////////////////////
-EasyARjs.prototype._initOptionsDebugUI = function(arjsSession, arjsAnchor){
+PortableARjs.prototype._initOptionsDebugUI = function(arjsSession, arjsAnchor){
// create arjsDebugUIContainer if needed
if( document.querySelector('#arjsDebugUIContainer') === null ){
var domElement = document.createElement('div')
@@ -52432,7 +52430,7 @@ EasyARjs.prototype._initOptionsDebugUI = function(arjsSession, arjsAnchor){
//////////////////////////////////////////////////////////////////////////////
// function initRenderThreejs
-EasyARjs.prototype._initOptionRenderThreejs = function(renderer, scene, camera, arjsAnchor){
+PortableARjs.prototype._initOptionRenderThreejs = function(renderer, scene, camera, arjsAnchor){
// array of functions for the rendering loop
var onRenderFcts= [];
diff --git a/contribs/portableAR.js/build/portable-ar.min.js b/three.js/contribs/portableAR.js/build/portable-ar.min.js
similarity index 100%
rename from contribs/portableAR.js/build/portable-ar.min.js
rename to three.js/contribs/portableAR.js/build/portable-ar.min.js
diff --git a/contribs/babylon.js/README.md b/three.js/contribs/portableAR.js/examples/babylon.js/README.md
similarity index 100%
rename from contribs/babylon.js/README.md
rename to three.js/contribs/portableAR.js/examples/babylon.js/README.md
diff --git a/contribs/babylon.js/babylon-boilerplate.html b/three.js/contribs/portableAR.js/examples/babylon.js/babylon-boilerplate.html
similarity index 100%
rename from contribs/babylon.js/babylon-boilerplate.html
rename to three.js/contribs/portableAR.js/examples/babylon.js/babylon-boilerplate.html
diff --git a/contribs/babylon.js/basic.html b/three.js/contribs/portableAR.js/examples/babylon.js/basic.html
similarity index 84%
rename from contribs/babylon.js/basic.html
rename to three.js/contribs/portableAR.js/examples/babylon.js/basic.html
index 99c69c9b3854e23ffb9e1c8bdc0a3539291449c0..ded320c8dd8e823b315a2c9fdcda1815321a9c1b 100644
--- a/contribs/babylon.js/basic.html
+++ b/three.js/contribs/portableAR.js/examples/babylon.js/basic.html
@@ -9,8 +9,8 @@
-
-
+
+