Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Particle and Particle System for the 1.46 Release #6510

Merged
merged 6 commits into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Change Log
==========

### 1.46 - 2018-06-01

##### Breaking Changes :mega:
* `ParticleSystem` no longer uses `forces`. [#]()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should link to this PR

* `Particle` no longer uses `size`, `rate`, `lifeTime`, `life`, `minimumLife`, `maximumLife`, `minimumWidth`, `minimumHeight`, `maximumWidth`, and `maximumHeight`. [#]()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this link.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol woops i should hv caught that


### 1.45 - 2018-05-01

##### Major Announcements :loudspeaker:
Expand Down
70 changes: 36 additions & 34 deletions Source/Scene/Particle.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
define([
'../Core/Cartesian2',
'../Core/Cartesian3',
'../Core/Check',
'../Core/Color',
'../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
'../Core/deprecationWarning'
'../Core/defineProperties'
], function(
Cartesian2,
Cartesian3,
Check,
Color,
defaultValue,
defined,
defineProperties,
deprecationWarning) {
defineProperties) {
'use strict';

var defaultSize = new Cartesian2(1.0, 1.0);
Expand All @@ -34,7 +34,6 @@ define([
* @param {Color} [options.endColor=Color.WHITE] The color of a particle when it dies.
* @param {Number} [options.startScale=1.0] The scale of the particle when it is born.
* @param {Number} [options.endScale=1.0] The scale of the particle when it dies.
* @param {Cartesian2} [options.size=new Cartesian2(1.0, 1.0)] The dimensions of particles in pixels. This has been deprecated. Use imageSize instead.
* @param {Cartesian2} [options.imageSize=new Cartesian2(1.0, 1.0)] The dimensions, width by height, to scale the particle image in pixels.
*/
function Particle(options) {
Expand Down Expand Up @@ -100,10 +99,6 @@ define([
* @default new Cartesian(1.0, 1.0)
*/
this.imageSize = Cartesian2.clone(defaultValue(options.imageSize, defaultSize));
if (defined(options.size)) {
deprecationWarning('size', 'size was deprecated in Cesium 1.45. It will be removed in 1.46. Use imageSize instead.');
this.imageSize = Cartesian2.clone(defaultValue(options.size, defaultSize));
}

this._age = 0.0;
this._normalizedAge = 0.0;
Expand Down Expand Up @@ -134,20 +129,38 @@ define([
}
},
/**
* The dimensions of the particle in pixels. This has been deprecated. Use {@link Particle#imageSize} instead.
* @type {Cartesian2}
* @default new Cartesian(1.0, 1.0)
* @deprecated
* Gets and sets the width of {@link Particle#imageSize}
* @memberof Particle.prototype
* @type {Number}
*/
size : {
get : function() {
deprecationWarning('size', 'size was deprecated in Cesium 1.45. It will be removed in 1.46. Use imageSize instead.');
return this.imageSize;
},
set : function(value) {
deprecationWarning('size', 'size was deprecated in Cesium 1.45. It will be removed in 1.46. Use imageSize instead.');
this.imageSize = value;
}
width : {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggetz do you think we should remove these width and height properties? They don't seem particularly useful since users can just access this.imageSize directly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that, we'll just need to make sure it's updated in the tutorial if it was used there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They shouldn't be since they were added for the first time in the PR, but I'll double check

get : function() {
return this.imageSize.x;
},
set : function(value) {
//>>includeStart('debug', pragmas.debug);
Check.defined('value', value);
Check.typeOf.number.greaterThanOrEquals('value', value, 0.0);
//>>includeEnd('debug');
this.imageSize.x = value;
}
},
/**
* Gets and sets the height of {@link Particle#imageSize}
* @memberof Particle.prototype
* @type {Number}
*/
height : {
get : function() {
return this.imageSize.y;
},
set : function(value) {
//>>includeStart('debug', pragmas.debug);
Check.defined('value', value);
Check.typeOf.number.greaterThanOrEquals('value', value, 0.0);
//>>includeEnd('debug');
this.imageSize.y = value;
}
}
});

Expand All @@ -163,18 +176,7 @@ define([

// Update any forces.
if (defined(particleUpdateFunction)) {
if (typeof particleUpdateFunction === 'function') {
particleUpdateFunction(this, dt);
} else if (particleUpdateFunction instanceof Array) {
var length = particleUpdateFunction.length;
for (var i = 0; i < length; ++i) {
var force = particleUpdateFunction[i];
if (typeof force === 'function') {
// Force is just a simple callback function.
force(this, dt);
}
}
}
particleUpdateFunction(this, dt);
}

// Age the particle
Expand Down
Loading