Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing nft version in the build libs #407

Merged
merged 20 commits into from
Mar 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI
on:
- push
- pull_request

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

tests:
strategy:
matrix:
node:
- 14.x

runs-on: ubuntu-20.04
name: Node.js ${{ matrix.node }}
steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Npm update
run: npm update
- name: Npm install
run: npm install
- name: Tests
run: npm run format-check
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
7 changes: 7 additions & 0 deletions .prettierc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"printWidth": 120,
"semi": true,
"singleQuote": false
}
16 changes: 16 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.github/workflows/CI.yml
data/**
node_modules/**
test/**
aframe/examples/**
aframe/build/*.js
aframe/src/component-anchor.js
aframe/src/component-anchor-nft.js
aframe/src/system-arjs.js
aframe/src/system-arjs-nft.js
aframe/src/location-based/stylesheets/*.css
three.js/examples/**
three.js/build/*.js
three.js/src/location-based/README.md
*.md
webpack.config.js
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# AR.js - Augmented Reality on the Web


[![Build Status](https://travis-ci.org/jeromeetienne/AR.js.svg?branch=master)](https://travis-ci.org/jeromeetienne/AR.js)
[![CI](https://github.com/AR-js-org/AR.js/actions/workflows/CI.yml/badge.svg)](https://github.com/AR-js-org/AR.js/actions/workflows/CI.yml)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![Gitter chat](https://badges.gitter.im/AR-js/Lobby.png)](https://gitter.im/AR-js/Lobby)
[![Twitter Follow](https://img.shields.io/twitter/follow/nicolocarp.svg?style=plastic&label=nicolocarpignoli-twitter&style=plastic)](https://twitter.com/nicolocarp)
[![Twitter Follow](https://img.shields.io/twitter/follow/jerome_etienne.svg?style=plastic&label=jeromeetienne-twitter&style=plastic)](https://twitter.com/jerome_etienne)
Expand Down Expand Up @@ -32,21 +33,30 @@ If you want to give a first look at AR.js potential, you can continue with this
-----


⚡️ AR.js is coming in two, different builds. They are both maintained. They are exclusive.
⚡️ AR.js is coming in different builds. They are both maintained. They are exclusive.

Please import the one you need for your project, not both:

- **AR.js with Image Tracking + Location Based AR:**
- **AR.js with Image Tracking + Location Based AR (AFRAME):**

- AFRAME version: https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js
- https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js

- three.js version: https://raw.githack.com/AR-js-org/AR.js/master/three.js/build/ar-nft.js
- **AR.js with Marker Tracking + Location Based AR (AFRAME):**

- **AR.js with Marker Tracking + Location Based AR:**
- https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js

- AFRAME version: https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js

- three.js version: https://raw.githack.com/AR-js-org/AR.js/master/three.js/build/ar.js
- **AR.js with Image Tracking + Marker Tracking (Threejs):**

- https://raw.githack.com/AR-js-org/AR.js/master/three.js/build/ar-threex.js

if you need the ARjs namespace import ar.js:

- https://raw.githack.com/AR-js-org/AR.js/master/three.js/build/ar.js

- **AR.js with Location Based AR (Threejs):**

- https://raw.githack.com/AR-js-org/AR.js/master/three.js/build/ar-threex-location-only.js


You can also import a specific version replacing `master` keyword with version tag:
Expand Down
2,130 changes: 2,129 additions & 1 deletion aframe/build/aframe-ar-location-only.js

Large diffs are not rendered by default.

6,139 changes: 6,138 additions & 1 deletion aframe/build/aframe-ar-nft.js

Large diffs are not rendered by default.

6,137 changes: 6,136 additions & 1 deletion aframe/build/aframe-ar.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion aframe/examples/image-tracking/nft-video/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@1c2407b26c61958baa93967b5412487cd94b290b/dist/aframe-master.min.js"></script>

<script src='https://raw.githack.com/AR-js-org/AR.js/ES6/aframe/build/aframe-ar-nft.js'></script>
<!--<script src='https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js'></script>-->
<script src='../../../../aframe/build/aframe-ar-nft.js'></script>

<script>
window.onload = function() {
Expand Down
4 changes: 3 additions & 1 deletion aframe/examples/image-tracking/nft/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
</style>

<!-- rawgithack development URL -->
<script src='https://raw.githack.com/AR-js-org/AR.js/ES6/aframe/build/aframe-ar-nft.js'></script>
<!--<script src='https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js'></script>-->
<script src='../../../../aframe/build/aframe-ar-nft.js'></script>


<body style='margin : 0px; overflow: hidden;'>
<!-- minimal loader shown until image descriptors are loaded -->
Expand Down
2 changes: 1 addition & 1 deletion aframe/src/component-anchor-nft.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as AFRAME from 'aframe';
import Anchor from '../../three.js/src/new-api/arjs-anchor';
import { AnchorDebugUI } from '../../three.js/src/new-api/arjs-debugui';
import ArToolkitContext from '../../three.js/src/threex/arjs-context-nft';
import ArToolkitContext from '../../three.js/src/threex/arjs-context';

////////////////////////////////////////////////////////////////////////////////
// arjs-anchor
Expand Down
6 changes: 3 additions & 3 deletions aframe/src/component-anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Anchor from '../../three.js/src/new-api/arjs-anchor';
import { AnchorDebugUI } from '../../three.js/src/new-api/arjs-debugui';
import ArToolkitContext from '../../three.js/src/threex/arjs-context';

// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// arjs-anchor
//////////////////////////////////////////////////////////////////////////////
AFRAME.registerComponent('arjs-anchor', {
Expand Down Expand Up @@ -119,7 +119,7 @@ AFRAME.registerComponent('arjs-anchor', {
markerParameters.patternUrl = _this.data.patternUrl;
markerParameters.markersAreaEnabled = false
}

markerParameters.minConfidence = _this.data.minConfidence;
markerParameters.smooth = _this.data.smooth;
markerParameters.smoothCount = _this.data.smoothCount;
Expand Down Expand Up @@ -234,7 +234,7 @@ AFRAME.registerPrimitive('a-camera-static', AFRAME.utils.extendDeep({}, AFRAME.p
//////////////////////////////////////////////////////////////////////////////
// backward compatibility
//////////////////////////////////////////////////////////////////////////////
// FIXME

AFRAME.registerPrimitive('a-marker', AFRAME.utils.extendDeep({}, AFRAME.primitives.getMeshMixin(), {
defaultComponents: {
'arjs-anchor': {},
Expand Down
124 changes: 64 additions & 60 deletions aframe/src/component-hit-testing.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,78 @@
import * as AFRAME from 'aframe';
import HitTesting from '../../three.js/src/new-api/arjs-hittesting';
import * as AFRAME from "aframe";
import HitTesting from "../../three.js/src/new-api/arjs-hittesting";

// //////////////////////////////////////////////////////////////////////////////
// arjs-hit-testing
//////////////////////////////////////////////////////////////////////////////
AFRAME.registerComponent('arjs-hit-testing', {
dependencies: ['arjs', 'artoolkit'],
schema: {
enabled : {
type: 'boolean',
default: false,
},
renderDebug : {
type: 'boolean',
default: false,
},
},
init: function () {
var _this = this
var arjsSystem = this.el.sceneEl.systems.arjs || this.el.sceneEl.systems.artoolkit
AFRAME.registerComponent("arjs-hit-testing", {
dependencies: ["arjs", "artoolkit"],
schema: {
enabled: {
type: "boolean",
default: false,
},
renderDebug: {
type: "boolean",
default: false,
},
},
init: function () {
var _this = this;
var arjsSystem =
this.el.sceneEl.systems.arjs || this.el.sceneEl.systems.artoolkit;

// TODO make it work on cameraTransformMatrix too
//
_this.isReady = false
_this._arAnchor = null
_this._arHitTesting = null
// TODO make it work on cameraTransformMatrix too
//
_this.isReady = false;
_this._arAnchor = null;
_this._arHitTesting = null;

// trick to wait until arjsSystem is isReady
var startedAt = Date.now()
var timerId = setInterval(function(){
var anchorEl = _this.el
var anchorComponent = anchorEl.components['arjs-anchor']
// wait until anchorComponent is isReady
if( anchorComponent === undefined || anchorComponent.isReady === false ) return
// trick to wait until arjsSystem is isReady
var startedAt = Date.now();
var timerId = setInterval(function () {
var anchorEl = _this.el;
var anchorComponent = anchorEl.components["arjs-anchor"];
// wait until anchorComponent is isReady
if (anchorComponent === undefined || anchorComponent.isReady === false)
return;

clearInterval(timerId)
clearInterval(timerId);

//////////////////////////////////////////////////////////////////////////////
// create arAnchor
//////////////////////////////////////////////////////////////////////////////
var arAnchor = anchorComponent._arAnchor
var arSession = arjsSystem._arSession
var renderer = arSession.parameters.renderer
//////////////////////////////////////////////////////////////////////////////
// create arAnchor
//////////////////////////////////////////////////////////////////////////////
var arAnchor = anchorComponent._arAnchor;
var arSession = arjsSystem._arSession;
var renderer = arSession.parameters.renderer;

var hitTesting = _this._arHitTesting = new HitTesting(arSession)
hitTesting.enabled = _this.data.enabled
var hitTesting = (_this._arHitTesting = new HitTesting(arSession));
hitTesting.enabled = _this.data.enabled;

_this.isReady = true
}, 1000/60)
},
remove : function(){
},
update: function () {
},
tick: function(){
var _this = this
// if not yet isReady, do nothing
if( this.isReady === false ) return
_this.isReady = true;
}, 1000 / 60);
},
remove: function () {},
update: function () {},
tick: function () {
var _this = this;
// if not yet isReady, do nothing
if (this.isReady === false) return;

var arjsSystem = this.el.sceneEl.systems.arjs || this.el.sceneEl.systems.artoolkit
var arSession = arjsSystem._arSession
var arjsSystem =
this.el.sceneEl.systems.arjs || this.el.sceneEl.systems.artoolkit;
var arSession = arjsSystem._arSession;

var anchorEl = _this.el
var anchorComponent = anchorEl.components['arjs-anchor']
var arAnchor = anchorComponent._arAnchor
var anchorEl = _this.el;
var anchorComponent = anchorEl.components["arjs-anchor"];
var arAnchor = anchorComponent._arAnchor;


var hitTesting = this._arHitTesting
var camera = arSession.parameters.camera
// console.log(camera.position)
hitTesting.update(camera, arAnchor.object3d, arAnchor.parameters.changeMatrixMode)
}
var hitTesting = this._arHitTesting;
var camera = arSession.parameters.camera;
// console.log(camera.position)
hitTesting.update(
camera,
arAnchor.object3d,
arAnchor.parameters.changeMatrixMode
);
},
});
20 changes: 10 additions & 10 deletions aframe/src/index-nft.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Components
import './component-anchor-nft';
import './component-hit-testing';
import "./component-anchor-nft";
import "./component-hit-testing";

// Location-based components
import './location-based/arjs-look-controls'
import './location-based/arjs-webcam-texture'
import './location-based/ArjsDeviceOrientationControls'
import './location-based/gps-camera'
import './location-based/gps-entity-place'
import './location-based/gps-projected-camera'
import './location-based/gps-projected-entity-place'
import "./location-based/arjs-look-controls";
import "./location-based/arjs-webcam-texture";
import "./location-based/ArjsDeviceOrientationControls";
import "./location-based/gps-camera";
import "./location-based/gps-entity-place";
import "./location-based/gps-projected-camera";
import "./location-based/gps-projected-entity-place";

// System
import './system-arjs';
import "./system-arjs-nft";
20 changes: 10 additions & 10 deletions aframe/src/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Components
import './component-anchor';
import './component-hit-testing';
import "./component-anchor";
import "./component-hit-testing";

// Location-based components
import './location-based/arjs-look-controls'
import './location-based/arjs-webcam-texture'
import './location-based/ArjsDeviceOrientationControls'
import './location-based/gps-camera'
import './location-based/gps-entity-place'
import './location-based/gps-projected-camera'
import './location-based/gps-projected-entity-place'
import "./location-based/arjs-look-controls";
import "./location-based/arjs-webcam-texture";
import "./location-based/ArjsDeviceOrientationControls";
import "./location-based/gps-camera";
import "./location-based/gps-entity-place";
import "./location-based/gps-projected-camera";
import "./location-based/gps-projected-entity-place";

// System
import './system-arjs';
import "./system-arjs";
Loading