Coins appear after scene loaded, and button is now blinking

This commit is contained in:
Thomas FORGIONE
2015-10-02 14:44:38 +02:00
parent 2982b9804b
commit 0e3eae5ff1
5 changed files with 56 additions and 4 deletions

View File

@@ -91,6 +91,8 @@ Coin.update = function() {
}
document.getElementById('next').style.background = instantToColor(Coin.colorInstant);
// Coin.domElement.width = Coin.domElement.width;
// Coin.ctx.drawImage(Coin.image, x + 75,25,30,30);
@@ -289,6 +291,7 @@ Coin.init = function(scale) {
function(object) {
object.traverse(function (mesh) {
if (mesh instanceof THREE.Mesh) {
mesh.visible = false;
mesh.scale.set(scale,scale,scale);
mesh.material.color.setHex(0xff0000);
mesh.geometry.computeVertexNormals();

View File

@@ -1,6 +1,18 @@
// Let's be sure we avoid using global variables
var onWindowResize = (function() {
L3D.ProgressiveLoader.onFinished = function() {
if (coins.length === 0 || coins[0].mesh == undefined) {
setTimeout(L3D.ProgressiveLoader.onFinished, 500);
return;
}
for (var i = 0; i < coins.length; i++) {
coins[i].mesh.visible = true;
}
}
// Disable scrolling
window.onscroll = function () { window.scrollTo(0, 0); };

View File

@@ -130,6 +130,7 @@ TutorialSteps.prototype.setCameras = function(cameras) {
TutorialSteps.prototype.addCoin = function(coin) {
this.coins.push(coin);
coin.mesh.visible = true;
coin.addToScene(this.scene);
this.clickableObjects.push(coin);
};

View File

@@ -382,6 +382,11 @@ ProgressiveLoader.prototype.initIOCallbacks = function() {
if (typeof self.log === 'function')
self.log(self.numberOfFacesReceived, self.numberOfFaces);
self.finished = true;
if (typeof L3D.ProgressiveLoader.onFinished === 'function') {
L3D.ProgressiveLoader.onFinished();
}
});
};