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 @@ Rate - - + + @@ -61,16 +61,16 @@ Min Life - - + + Max Life - - + + @@ -161,10 +161,10 @@ viewer.timeline.zoomTo(start, stop); var viewModel = { - rate : 5.0, + emissionRate : 5.0, gravity : 0.0, - minimumLife : 1.0, - maximumLife : 1.0, + minimumParticleLife : 1.0, + maximumParticleLife : 1.0, minimumSpeed : 1.0, maximumSpeed : 4.0, startScale : 1.0, @@ -263,8 +263,8 @@ startScale : viewModel.startScale, endScale : viewModel.endScale, - minimumParticleLife : viewModel.minimumLife, - maximumParticleLife : viewModel.maximumLife, + minimumParticleLife : viewModel.minimumParticleLife, + maximumParticleLife : viewModel.maximumParticleLife, minimumSpeed : viewModel.minimumSpeed, maximumSpeed : viewModel.maximumSpeed, @@ -272,7 +272,7 @@ imageSize : new Cesium.Cartesian2(viewModel.particleSize, viewModel.particleSize), // Particles per second. - emissionRate : viewModel.rate, + emissionRate : viewModel.emissionRate, bursts : [ // these burst will occasionally sync to create a multicolored effect @@ -316,31 +316,29 @@ } }); -Cesium.knockout.getObservable(viewModel, 'rate').subscribe( +Cesium.knockout.getObservable(viewModel, 'emissionRate').subscribe( function(newValue) { - particleSystem.rate = parseFloat(newValue); + particleSystem.emissionRate = parseFloat(newValue); } ); Cesium.knockout.getObservable(viewModel, 'particleSize').subscribe( function(newValue) { var particleSize = parseFloat(newValue); - particleSystem.minimumWidth = particleSize; - particleSystem.maximumWidth = particleSize; - particleSystem.minimumHeight = particleSize; - particleSystem.maximumHeight = particleSize; + particleSystem.imageSize.x = particleSize; + particleSystem.imageSize.y = particleSize; } ); -Cesium.knockout.getObservable(viewModel, 'minimumLife').subscribe( +Cesium.knockout.getObservable(viewModel, 'minimumParticleLife').subscribe( function(newValue) { - particleSystem.minimumLife = parseFloat(newValue); + particleSystem.minimumParticleLife = parseFloat(newValue); } ); -Cesium.knockout.getObservable(viewModel, 'maximumLife').subscribe( +Cesium.knockout.getObservable(viewModel, 'maximumParticleLife').subscribe( function(newValue) { - particleSystem.maximumLife = parseFloat(newValue); + particleSystem.maximumParticleLife = parseFloat(newValue); } ); diff --git a/CHANGES.md b/CHANGES.md index bfa6b348e2cf..2ac1613b0b99 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ Change Log * Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) * Added ability to invoke `sampleTerrain` from node.js to enable offline terrain sampling * Added more ParticleSystem Sandcastle examples for rocket and comet tails and weather. [#6375](https://github.com/AnalyticalGraphicsInc/cesium/pull/6375) +* Added ability to invoke `sampleTerrain` from node.js to enable offline terrain sampling * Added color and scale attributes to the `ParticleSystem` class constructor. When defined the variables override startColor and endColor and startScale and endScale. [#6429](https://github.com/AnalyticalGraphicsInc/cesium/pull/6429) ##### Fixes :wrench: