-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Changes from 2 commits
038a1cb
a2d2e4b
dea2d4d
31fbb4f
f1b8465
87a1fcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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); | ||
|
@@ -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) { | ||
|
@@ -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; | ||
|
@@ -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 : { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
} | ||
} | ||
}); | ||
|
||
|
@@ -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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this link.
There was a problem hiding this comment.
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