-
-
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.
Merge pull request #241 from webarkit/dev
0.12.1 version
Showing
18 changed files
with
396 additions
and
260 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<!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> | ||
|
||
<body> | ||
<a href="https://raw.githubusercontent.com/artoolkitx/artoolkit5/master/doc/Marker%20images/pinball.jpg" class="ui marker" target="_blank"> | ||
🖼 Marker Image | ||
</a> | ||
|
||
<script src="js/third_party/three.js/three.min.js"></script> | ||
<script src="js/ARnftThreejs.js"></script> | ||
<script src="../dist/ARnft.js"></script> | ||
|
||
<script> | ||
ARnft.ARnft.initWithConfig({ | ||
width: 640, | ||
height: 480, | ||
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 = window.clientWidth / window.clientHeight; | ||
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 ARnftThreejs.SceneRendererTJS(config, canvas, nft.uuid, true); | ||
sceneThreejs.initRenderer(); | ||
|
||
let nftAddTJS = new ARnftThreejs.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; | ||
window.requestAnimationFrame(tick); | ||
sceneThreejs.draw(); | ||
if (elapsed > fpsInterval) { | ||
then = now - (elapsed % fpsInterval); | ||
nft.update(); | ||
} | ||
}; | ||
tick(); | ||
}); | ||
}) | ||
.catch((error) => { | ||
console.log(error); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
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
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
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
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
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