-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
formatting examples and fix for badges
- Loading branch information
Showing
16 changed files
with
1,248 additions
and
1,258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,7 @@ | |
dist | ||
docs | ||
node_modules | ||
examples | ||
types | ||
*.html | ||
*.json | ||
*.js | ||
*.lock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,107 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>ARnft example showing a simple red cube</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.5, maximum-scale=1" /> | ||
<link rel="stylesheet" href="css/nft-style.css" /> | ||
</head> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>ARnft example showing a simple red cube</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.5, maximum-scale=1" /> | ||
<link rel="stylesheet" href="css/nft-style.css" /> | ||
</head> | ||
|
||
<body> | ||
<a href="https://raw.githubusercontent.com/artoolkitx/artoolkit5/master/doc/Marker%20images/pinball.jpg" class="ui marker" target="_blank"> | ||
🖼 Marker Image | ||
</a> | ||
<body> | ||
<a | ||
href="https://raw.githubusercontent.com/artoolkitx/artoolkit5/master/doc/Marker%20images/pinball.jpg" | ||
class="ui marker" | ||
target="_blank" | ||
> | ||
🖼 Marker Image | ||
</a> | ||
|
||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"three": "./js/third_party/three.js/three.module.min.js", | ||
"arnft-threejs": "./js/ARnftThreejs.module.js", | ||
"arnft": "./../dist/ARnft.module.js" | ||
} | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"three": "./js/third_party/three.js/three.module.min.js", | ||
"arnft-threejs": "./js/ARnftThreejs.module.js", | ||
"arnft": "./../dist/ARnft.module.js" | ||
} | ||
} | ||
</script> | ||
</script> | ||
|
||
<script type="module"> | ||
import * as THREE from 'three' | ||
import arnft from 'arnft' | ||
const { ARnft } = arnft | ||
import ARnftThreejs from 'arnft-threejs' | ||
const { SceneRendererTJS, NFTaddTJS } = ARnftThreejs; | ||
<script type="module"> | ||
import * as THREE from "three"; | ||
import arnft from "arnft"; | ||
const { ARnft } = arnft; | ||
import ARnftThreejs from "arnft-threejs"; | ||
const { SceneRendererTJS, NFTaddTJS } = ARnftThreejs; | ||
|
||
let width = 640; | ||
let width = 640; | ||
let height = 480; | ||
ARnft.initWithConfig({ | ||
width: width, | ||
height: height, | ||
markerUrls: [["examples/DataNFT/pinball"]], | ||
names: [["pinball"]], | ||
configUrl: "config.json", | ||
stats: true, | ||
autoUpdate: false, | ||
}) | ||
.then((nft) => { | ||
let mat = new THREE.MeshLambertMaterial({ | ||
color: 0xff0000, | ||
}); | ||
let boxGeom = new THREE.BoxGeometry(1, 1, 1); | ||
let cube = new THREE.Mesh(boxGeom, mat); | ||
cube.position.z = 90; | ||
cube.scale.set(180, 180, 180); | ||
ARnft.initWithConfig({ | ||
width: width, | ||
height: height, | ||
markerUrls: [["examples/DataNFT/pinball"]], | ||
names: [["pinball"]], | ||
configUrl: "config.json", | ||
stats: true, | ||
autoUpdate: false, | ||
}) | ||
.then((nft) => { | ||
let mat = new THREE.MeshLambertMaterial({ | ||
color: 0xff0000, | ||
}); | ||
let boxGeom = new THREE.BoxGeometry(1, 1, 1); | ||
let cube = new THREE.Mesh(boxGeom, mat); | ||
cube.position.z = 90; | ||
cube.scale.set(180, 180, 180); | ||
|
||
document.addEventListener("containerEvent", function (ev) { | ||
let canvas = document.getElementById("canvas"); | ||
let fov = (0.8 * 180) / Math.PI; | ||
let ratio = width / height; | ||
let config = { | ||
renderer: { | ||
alpha: true, | ||
antialias: true, | ||
context: null, | ||
precision: "mediump", | ||
premultipliedAlpha: true, | ||
stencil: true, | ||
depth: true, | ||
logarithmicDepthBuffer: true, | ||
}, | ||
camera: { | ||
fov: fov, | ||
ratio: ratio, | ||
near: 0.01, | ||
far: 1000, | ||
}, | ||
}; | ||
document.addEventListener("containerEvent", function (ev) { | ||
let canvas = document.getElementById("canvas"); | ||
let fov = (0.8 * 180) / Math.PI; | ||
let ratio = width / height; | ||
let config = { | ||
renderer: { | ||
alpha: true, | ||
antialias: true, | ||
context: null, | ||
precision: "mediump", | ||
premultipliedAlpha: true, | ||
stencil: true, | ||
depth: true, | ||
logarithmicDepthBuffer: true, | ||
}, | ||
camera: { | ||
fov: fov, | ||
ratio: ratio, | ||
near: 0.01, | ||
far: 1000, | ||
}, | ||
}; | ||
|
||
let sceneThreejs = new SceneRendererTJS(config, canvas, nft.uuid, true); | ||
sceneThreejs.initRenderer(); | ||
let sceneThreejs = new SceneRendererTJS(config, canvas, nft.uuid, true); | ||
sceneThreejs.initRenderer(); | ||
|
||
let nftAddTJS = new NFTaddTJS(nft.uuid); | ||
nftAddTJS.add(cube, "pinball", false); | ||
let nftAddTJS = new NFTaddTJS(nft.uuid); | ||
nftAddTJS.add(cube, "pinball", false); | ||
|
||
const fpsInterval = 1000 / 30; | ||
let now = Date.now(), elapsed = 0, then = now; | ||
const tick = () => { | ||
now = Date.now(); | ||
elapsed = now - then; | ||
sceneThreejs.draw(); | ||
if (elapsed > fpsInterval) { | ||
then = now - (elapsed % fpsInterval); | ||
nft.update(); | ||
} | ||
window.requestAnimationFrame(tick); | ||
}; | ||
tick(); | ||
}); | ||
}) | ||
.catch((error) => { | ||
console.log(error); | ||
}); | ||
</script> | ||
</body> | ||
const fpsInterval = 1000 / 30; | ||
let now = Date.now(), | ||
elapsed = 0, | ||
then = now; | ||
const tick = () => { | ||
now = Date.now(); | ||
elapsed = now - then; | ||
sceneThreejs.draw(); | ||
if (elapsed > fpsInterval) { | ||
then = now - (elapsed % fpsInterval); | ||
nft.update(); | ||
} | ||
window.requestAnimationFrame(tick); | ||
}; | ||
tick(); | ||
}); | ||
}) | ||
.catch((error) => { | ||
console.log(error); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.