diff --git a/Apps/Sandcastle/gallery/Particle System Tails.html b/Apps/Sandcastle/gallery/Particle System Tails.html index 6bab8526808c..bcd66de1a3c8 100644 --- a/Apps/Sandcastle/gallery/Particle System Tails.html +++ b/Apps/Sandcastle/gallery/Particle System Tails.html @@ -34,10 +34,10 @@ var planePosition = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883, 800.0); var particlesOffset = new Cesium.Cartesian3(-8.950115473940969, 34.852766731753945, -30.235411095432937); var cameraLocation = Cesium.Cartesian3.add(planePosition, particlesOffset, new Cesium.Cartesian3()); -var recenterCamera = function() { - viewer.camera.lookAt(cameraLocation, new Cesium.Cartesian3(170, -170, 170)); +var resetCamera = function() { + viewer.camera.lookAt(cameraLocation, new Cesium.Cartesian3(-450, -300, 200)); }; -recenterCamera(); +resetCamera(); // Draw particle image to a canvas var particleCanvas; @@ -69,9 +69,9 @@ }); // creating particles model matrix -var transl = Cesium.Matrix4.fromTranslation(particlesOffset, new Cesium.Matrix4()); -var translPosition = Cesium.Matrix4.fromTranslation(planePosition, new Cesium.Matrix4()); -var particlesModelMatrix = Cesium.Matrix4.multiplyTransformation(translPosition, transl, new Cesium.Matrix4()); +var translationOffset = Cesium.Matrix4.fromTranslation(particlesOffset, new Cesium.Matrix4()); +var translationOfPlane = Cesium.Matrix4.fromTranslation(planePosition, new Cesium.Matrix4()); +var particlesModelMatrix = Cesium.Matrix4.multiplyTransformation(translationOfPlane, translationOffset, new Cesium.Matrix4()); // creating the particle systems var rocketOptions = { @@ -130,8 +130,7 @@ var scratchCartesian3 = new Cesium.Cartesian3(); var scratchCartographic = new Cesium.Cartographic(); var forceFunction = function(options, iteration) { - var iterationOffset = iteration; - var func = function(particle) { + return function(particle) { scratchCartesian3 = Cesium.Cartesian3.normalize(particle.position, new Cesium.Cartesian3()); scratchCartesian3 = Cesium.Cartesian3.multiplyByScalar(scratchCartesian3, -1.0, scratchCartesian3); @@ -139,14 +138,13 @@ scratchCartographic = Cesium.Cartographic.fromCartesian(particle.position, Cesium.Ellipsoid.WGS84, scratchCartographic); - var angle = Cesium.Math.PI * 2.0 * iterationOffset / options.numberOfSystems; - iterationOffset += options.iterationOffset; + var angle = Cesium.Math.PI * 2.0 * iteration / options.numberOfSystems; + iteration += options.iterationOffset; scratchCartographic.longitude += Math.cos(angle) * options.cartographicStep; scratchCartographic.latitude += Math.sin(angle) * options.cartographicStep; particle.position = Cesium.Cartographic.toCartesian(scratchCartographic); }; - return func; }; var matrix4Scratch = new Cesium.Matrix4(); @@ -173,7 +171,6 @@ imageSize : imageSize, emissionRate : 30.0, emitter : new Cesium.CircleEmitter(0.1), - bursts : [ ], lifetime : 0.1, updateCallback : force, modelMatrix : particlesModelMatrix, @@ -201,7 +198,7 @@ onselect : function() { showAll(rocketSystems, false); showAll(cometSystems, true); - recenterCamera(); + resetCamera(); } }, { @@ -209,7 +206,7 @@ onselect : function() { showAll(cometSystems, false); showAll(rocketSystems, true); - recenterCamera(); + resetCamera(); } }]; Sandcastle.addToolbarMenu(options); diff --git a/Apps/Sandcastle/gallery/Particle System Weather.html b/Apps/Sandcastle/gallery/Particle System Weather.html index 6864b9196a36..7035b4d507e1 100644 --- a/Apps/Sandcastle/gallery/Particle System Weather.html +++ b/Apps/Sandcastle/gallery/Particle System Weather.html @@ -35,7 +35,7 @@ }); var scene = viewer.scene; scene.globe.depthTestAgainstTerrain = true; -var recenterFunction = function() { +var resetCameraFunction = function() { scene.camera.setView({ destination : new Cesium.Cartesian3(277096.634865404, 5647834.481964232, 2985563.7039122293), orientation : { @@ -44,7 +44,7 @@ } }); }; -recenterFunction(); +resetCameraFunction(); // snow var snowParticleSize = scene.drawingBufferWidth / 100.0; @@ -60,7 +60,7 @@ particle.velocity = Cesium.Cartesian3.add(particle.velocity, snowGravityScratch, particle.velocity); var distance = Cesium.Cartesian3.distance(scene.camera.position, particle.position); - if (distance > (snowRadius)) { + if (distance > snowRadius) { particle.endColor.alpha = 0.0; } else { particle.endColor.alpha = snowSystem.endColor.alpha / (distance / snowRadius + 0.1); @@ -100,7 +100,7 @@ particle.position = Cesium.Cartesian3.add(particle.position, rainGravityScratch, particle.position); var distance = Cesium.Cartesian3.distance(scene.camera.position, particle.position); - if (distance > (rainRadius)) { + if (distance > rainRadius) { particle.endColor.alpha = 0.0; } else { particle.endColor.alpha = rainSystem.endColor.alpha / (distance / rainRadius + 0.1); @@ -124,7 +124,7 @@ scene.primitives.add(rainSystem); // button -Sandcastle.addToolbarButton("Recenter", recenterFunction); +Sandcastle.addToolbarButton("Reset Camera", resetCameraFunction); // drop down var options = [{ diff --git a/Apps/Sandcastle/gallery/Particle System.html b/Apps/Sandcastle/gallery/Particle System.html index 7eab28acbf21..ea86ed3e60f7 100644 --- a/Apps/Sandcastle/gallery/Particle System.html +++ b/Apps/Sandcastle/gallery/Particle System.html @@ -45,8 +45,8 @@