Did stuff
This commit is contained in:
parent
edffd21eb7
commit
8fac6f9f9d
|
@ -89,7 +89,8 @@ Coin.prototype.update = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (this.ready && this.rotating)
|
if (this.ready && this.rotating)
|
||||||
this.mesh.rotation.y += 0.1;
|
this.mesh.rotation.y += 0.1;
|
||||||
else if (this.got) {
|
|
||||||
|
if (this.got) {
|
||||||
if (this.mesh.material.opacity > 0.02) {
|
if (this.mesh.material.opacity > 0.02) {
|
||||||
|
|
||||||
// First update
|
// First update
|
||||||
|
@ -115,12 +116,9 @@ Coin.prototype.get = function() {
|
||||||
if (this.callback)
|
if (this.callback)
|
||||||
this.callback();
|
this.callback();
|
||||||
|
|
||||||
if (this.mesh) {
|
this.mesh.material = this.mesh.material.clone();
|
||||||
this.mesh.material = this.mesh.material.clone();
|
this.mesh.material.transparent = true;
|
||||||
this.mesh.material.transparent = true;
|
this.mesh.material.opacity = 1;
|
||||||
this.mesh.material.opacity = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Coin.total ++;
|
Coin.total ++;
|
||||||
Coin.nextSound.play();
|
Coin.nextSound.play();
|
||||||
|
|
|
@ -68,12 +68,14 @@ function init() {
|
||||||
stats.domElement.style.cssFloat = "top-left";
|
stats.domElement.style.cssFloat = "top-left";
|
||||||
|
|
||||||
// Add elements to page
|
// Add elements to page
|
||||||
|
container.appendChild(Coin.domElement);
|
||||||
container.appendChild( stats.domElement );
|
container.appendChild( stats.domElement );
|
||||||
container.appendChild(renderer.domElement);
|
container.appendChild(renderer.domElement);
|
||||||
|
|
||||||
// Initialize pointer camera
|
// Initialize pointer camera
|
||||||
camera1 = new L3D.ReplayCamera(50, container_size.width() / container_size.height(), 0.01, 100000, coins);
|
camera1 = new L3D.ReplayCamera(50, container_size.width() / container_size.height(), 0.01, 100000, coins);
|
||||||
cameras = initMainScene(camera1, scene, coins);
|
cameras = initMainScene(camera1, scene, coins);
|
||||||
|
camera1.cameras = cameras;
|
||||||
|
|
||||||
// Add listeners
|
// Add listeners
|
||||||
initListeners();
|
initListeners();
|
||||||
|
|
|
@ -148,7 +148,7 @@ TutorialSteps.prototype.nextStep = function() {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
var cam = L3D.createPeachCameras(this.container_size.width(), this.container_size.height())[2];
|
var cam = L3D.createPeachRecommendations(this.container_size.width(), this.container_size.height())[2];
|
||||||
this.cameras.push(cam);
|
this.cameras.push(cam);
|
||||||
cam.addToScene(this.scene);
|
cam.addToScene(this.scene);
|
||||||
this.camera.move({
|
this.camera.move({
|
||||||
|
@ -157,7 +157,7 @@ TutorialSteps.prototype.nextStep = function() {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
var cams = L3D.createPeachCameras(this.container_size.width(), this.container_size.height());
|
var cams = L3D.createPeachRecommendations(this.container_size.width(), this.container_size.height());
|
||||||
for (var i = 0; i < cams.length; i == 1 ? i+=2 : i++) {
|
for (var i = 0; i < cams.length; i == 1 ? i+=2 : i++) {
|
||||||
this.cameras.push(cams[i]);
|
this.cameras.push(cams[i]);
|
||||||
cams[i].addToScene(this.scene);
|
cams[i].addToScene(this.scene);
|
||||||
|
|
|
@ -81,7 +81,7 @@ L3D.ReplayCamera.prototype.cameraMotion = function(time) {
|
||||||
|
|
||||||
L3D.ReplayCamera.prototype.hermiteMotion = function(time) {
|
L3D.ReplayCamera.prototype.hermiteMotion = function(time) {
|
||||||
var e = this.hermitePosition.eval(this.t);
|
var e = this.hermitePosition.eval(this.t);
|
||||||
this.position.copy(tmp);
|
this.position.copy(e);
|
||||||
|
|
||||||
this.target = L3D.Tools.sum(this.position, this.hermiteAngles.eval(this.t));
|
this.target = L3D.Tools.sum(this.position, this.hermiteAngles.eval(this.t));
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ L3D.ReplayCamera.prototype.nextEvent = function() {
|
||||||
},500);
|
},500);
|
||||||
})(this);
|
})(this);
|
||||||
} else if (this.event.type == 'arrow') {
|
} else if (this.event.type == 'arrow') {
|
||||||
this.moveHermite(this.cameras.cameras[this.event.id]);
|
this.moveHermite(this.cameras[this.event.id]);
|
||||||
} else if (this.event.type == 'reset') {
|
} else if (this.event.type == 'reset') {
|
||||||
this.reset();
|
this.reset();
|
||||||
(function (self) {
|
(function (self) {
|
||||||
|
@ -164,7 +164,10 @@ L3D.ReplayCamera.prototype.anglesFromVectors = function() {
|
||||||
this.theta = Math.atan2(forward.x, forward.z);
|
this.theta = Math.atan2(forward.x, forward.z);
|
||||||
};
|
};
|
||||||
|
|
||||||
L3D.ReplayCamera.prototype.move = function(otherCamera) {
|
L3D.ReplayCamera.prototype.move = function(recommendation) {
|
||||||
|
|
||||||
|
var otherCamera = recommendation.camera || recommendation;
|
||||||
|
|
||||||
this.moving = true;
|
this.moving = true;
|
||||||
this.old_target = this.target.clone();
|
this.old_target = this.target.clone();
|
||||||
this.old_position = this.position.clone();
|
this.old_position = this.position.clone();
|
||||||
|
@ -174,7 +177,10 @@ L3D.ReplayCamera.prototype.move = function(otherCamera) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
L3D.ReplayCamera.prototype.moveHermite = function(otherCamera) {
|
L3D.ReplayCamera.prototype.moveHermite = function(recommendation) {
|
||||||
|
|
||||||
|
var otherCamera = recommendation.camera || recommendation;
|
||||||
|
|
||||||
this.movingHermite = true;
|
this.movingHermite = true;
|
||||||
this.t = 0;
|
this.t = 0;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ L3D.initPeach = function(recommendation, scene, coins) {
|
||||||
|
|
||||||
Coin.init(0.001);
|
Coin.init(0.001);
|
||||||
var recommendations = [];
|
var recommendations = [];
|
||||||
var recommendations = recommendations;
|
|
||||||
|
|
||||||
return recommendations;
|
return recommendations;
|
||||||
};
|
};
|
||||||
|
@ -286,7 +285,6 @@ L3D.initBobomb = function(recommendation, scene, coins) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var recommendations = L3D.createBobombRecommendations(container_size.width(), container_size.height());
|
var recommendations = L3D.createBobombRecommendations(container_size.width(), container_size.height());
|
||||||
var recommendations = recommendations;
|
|
||||||
|
|
||||||
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
||||||
|
|
||||||
|
@ -458,7 +456,6 @@ L3D.initWhomp = function(recommendation, scene, coins) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var recommendations = L3D.createWhompRecommendations(container_size.width(), container_size.height());
|
var recommendations = L3D.createWhompRecommendations(container_size.width(), container_size.height());
|
||||||
var recommendations = recommendations;
|
|
||||||
|
|
||||||
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
||||||
|
|
||||||
|
@ -610,7 +607,6 @@ L3D.initMountain = function(recommendation, scene, coins) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var recommendations = L3D.createMountainRecommendations(container_size.width(), container_size.height());
|
var recommendations = L3D.createMountainRecommendations(container_size.width(), container_size.height());
|
||||||
var recommendations = recommendations;
|
|
||||||
|
|
||||||
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
||||||
|
|
||||||
|
@ -725,7 +721,6 @@ L3D.initSponza = function(recommendation, scene, coins) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var recommendations = L3D.createSponzaRecommendations(container_size.width(), container_size.height());
|
var recommendations = L3D.createSponzaRecommendations(container_size.width(), container_size.height());
|
||||||
var recommendations = recommendations;
|
|
||||||
|
|
||||||
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ L3D.CameraSelecter.prototype.pointedCamera = function() {
|
||||||
|
|
||||||
// Looking for cameras
|
// Looking for cameras
|
||||||
for (var i in intersects) {
|
for (var i in intersects) {
|
||||||
if (intersects[i].object.raycastable && !(intersects[i].object instanceof THREE.Line)) {
|
if (intersects[i].object.raycastable) {
|
||||||
if ((intersects[i].distance > 0.5 && minDistance === undefined) || (intersects[i].distance < minDistance )) {
|
if ( minDistance === undefined || intersects[i].distance < minDistance ) {
|
||||||
if (!(intersects[i].object instanceof THREE.Mesh && intersects[i].object.material.opacity < 0.1)) {
|
if (intersects[i].object instanceof THREE.Mesh) {
|
||||||
minDistance = intersects[i].distance;
|
minDistance = intersects[i].distance;
|
||||||
bestIndex = i;
|
bestIndex = i;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue