Initial commit
This commit is contained in:
59
js/main.js
Normal file
59
js/main.js
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Main js entry for template ATON web-app
|
||||
|
||||
===============================================*/
|
||||
// Realize our app
|
||||
let APP = ATON.App.realize();
|
||||
|
||||
const materialProperties = {
|
||||
color: "#8993a4",
|
||||
//transparent: true,
|
||||
//opacity: 0.8,
|
||||
flatShading: false,
|
||||
//wireframe: true,
|
||||
};
|
||||
|
||||
function showEdges (object) {
|
||||
if (object.isMesh) {
|
||||
let edges = new THREE.EdgesGeometry(child.geometry, 45);
|
||||
let line = new THREE.LineSegments(edges, edgeMaterial);
|
||||
child.add(line);
|
||||
}
|
||||
}
|
||||
|
||||
// You can require here flares (plugins) if needed by the app
|
||||
//APP.requireFlares(["myFlare","anotherFlare"]);
|
||||
|
||||
// APP.setup() is required for web-app initialization
|
||||
// You can place here UI setup (HTML), events handling, etc.
|
||||
APP.setup = ()=>{
|
||||
|
||||
// Realize base ATON and add base UI events
|
||||
ATON.realize();
|
||||
ATON.UI.addBasicEvents();
|
||||
|
||||
let lightProbe = new ATON.LightProbe();
|
||||
lightProbe.setPosition(2, 6, 2);
|
||||
|
||||
// Load 3D model
|
||||
let mainNode = ATON.createSceneNode("teatro").load("nicolo/models/teatro_san_salvador.glb");
|
||||
mainNode.setMaterial(new THREE.MeshPhongMaterial(materialProperties));
|
||||
|
||||
//showEdges(mainNode.children[0]);
|
||||
mainNode.attachToRoot();
|
||||
lightProbe.update();
|
||||
|
||||
//ATON.addLightProbe(lightProbe);
|
||||
|
||||
// If our app required ore or more flares (plugins), we can also wait for them to be ready for specific setups
|
||||
ATON.on("AllFlaresReady",()=>{
|
||||
// Do stuff
|
||||
console.log("All flares ready");
|
||||
});
|
||||
};
|
||||
|
||||
/* If you plan to use an update routine (executed continuously), you can place its logic here.
|
||||
APP.update = ()=>{
|
||||
|
||||
};
|
||||
*/
|
||||
Reference in New Issue
Block a user