-
-
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 #143 from webarkit/feature-extends-threejsrenderer
Extending parameters and methods for ThreejsRenderer
- Loading branch information
Showing
7 changed files
with
124 additions
and
9 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
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,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>ARnft example with a gltf model</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="../dist/ARnft.js"></script> | ||
|
||
<script> | ||
ARnft.ARnft.init(640, 480, "examples/DataNFT/pinball", 'config_brave_robot.json', true, true) | ||
.then((nft) => { | ||
document.addEventListener('onInitThreejsRendering', (ev) => { | ||
console.log(ev.detail); | ||
const renderer = ev.detail.renderer; | ||
console.log(renderer); | ||
const scene = ev.detail.scene; | ||
console.log(scene); | ||
const camera = ev.detail.camera; | ||
console.log(camera); | ||
renderer.outputEncoding = THREE.sRGBEncoding; | ||
renderer.physicallyCorrectLights = true; | ||
let directionalLight = new THREE.DirectionalLight('#fff', 0.4); | ||
directionalLight.position.set(0.5, 0, 0.866); | ||
scene.add(directionalLight) | ||
}) | ||
document.addEventListener('onAfterInitThreejsRendering', (ev) => { | ||
// set here extra rendering settings after onInitThreejsRendering | ||
console.log('onAfterInitThreejsRendering is emitted after onInitThreejsRendering!'); | ||
}) | ||
nft.addModel('./Data/models/brave_robot/gLTF/brave_robot.glb', 40, 80, 80, 80); | ||
}).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"addPath": "", | ||
"cameraPara": "examples/Data/camera_para.dat", | ||
"videoSettings": { | ||
"width": { | ||
"min": 640, | ||
"max": 800 | ||
}, | ||
"height": { | ||
"min": 480, | ||
"max": 600 | ||
}, | ||
"facingMode": "environment" | ||
}, | ||
"loading": { | ||
"logo": { | ||
"src": "Data/arNFT-logo.gif", | ||
"alt": "arNFT.js logo" | ||
}, | ||
"loadingMessage": "Loading, please wait..." | ||
}, | ||
"renderer": { | ||
"type": "three", | ||
"alpha": true, | ||
"antialias": true, | ||
"context": null, | ||
"precision": "mediump", | ||
"premultipliedAlpha": true, | ||
"stencil": true, | ||
"depth": true, | ||
"logarithmicDepthBuffer": true | ||
}, | ||
"camera": { | ||
"fov": "0.8 * 180 / Math.PI", | ||
"ratio": "window.clientWidth / window.clientHeight", | ||
"near": 0.01, | ||
"far": 1000 | ||
} | ||
} | ||
|
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