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

Particle Systems #5212

Merged
merged 116 commits into from
Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from 96 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
6103848
Work on resurrecting the particle branch
jasonbeverage Mar 2, 2017
dccaaeb
Changed the way particle lifetime works so there is a separate age an…
jasonbeverage Mar 2, 2017
b69ecc6
Added particle system sandcastle and PointEmitter
jasonbeverage Mar 2, 2017
58c41ca
Making sure dt is sensible in ParticleSystem
jasonbeverage Mar 2, 2017
994fe50
Animated entity in sandcastle example
jasonbeverage Mar 2, 2017
1c07d77
Tweaking particle system demo
jasonbeverage Mar 3, 2017
0245f40
Added ability to create a class based force
jasonbeverage Mar 3, 2017
9644b85
Reworked the way the emitter works so it can use a constant rate
jasonbeverage Mar 3, 2017
eaf1cbd
Added a burst option to the emitter
jasonbeverage Mar 3, 2017
8184286
Playing with the concept of a placer
jasonbeverage Mar 3, 2017
adc2cc7
Added BoxPlacer and SpherePlacer
jasonbeverage Mar 3, 2017
0d5b5b6
Corrected SpherePlacer to be centered around the position correctly
jasonbeverage Mar 7, 2017
867c69c
Playing with fire!
jasonbeverage Mar 7, 2017
2297924
Making sure normalizedAge is always 0.0 for particles with infinite life
jasonbeverage Mar 7, 2017
1876ad6
Color interpolation
jasonbeverage Mar 7, 2017
4555cfb
Fire on the engine
jasonbeverage Mar 7, 2017
1840d19
Adjusting scale based on age. New startScale, endScale attributes
jasonbeverage Mar 7, 2017
917c78a
Missing files
jasonbeverage Mar 7, 2017
80ad97a
Simplifying the point emitter to not require the initialDirection to …
jasonbeverage Mar 7, 2017
fb4affd
Added a lifetime option to the PointEmitter
jasonbeverage Mar 7, 2017
7b475ac
Added complete event to PointEmitter
jasonbeverage Mar 7, 2017
a2ec79b
Made it so particle systems can have multiple emitters
jasonbeverage Mar 7, 2017
2f11ce0
Simplify particle system emitter/modelmatrix relation
jasonbeverage Mar 7, 2017
ddb464f
Exploding plane and changed properties around
jasonbeverage Mar 7, 2017
f6baa2a
Changing around the way you set the speed to not use a variance but i…
jasonbeverage Mar 8, 2017
00406de
Changed the way life is initialized
jasonbeverage Mar 8, 2017
034a4f3
Added ConePlacer and changed around the PointEmitter to correctly pos…
jasonbeverage Mar 9, 2017
d165f45
Moving back to a single emitter per system.
jasonbeverage Mar 9, 2017
2ecfa59
Reworking properties
jasonbeverage Mar 9, 2017
617c317
Moved mass to ParticleSystem
jasonbeverage Mar 9, 2017
f64422f
More reorganization
jasonbeverage Mar 9, 2017
d2959ba
Moved logic into ParticleSystem
jasonbeverage Mar 9, 2017
64be343
Removed unused code
jasonbeverage Mar 9, 2017
fbc3ffc
Reworked Placers to be Emitters
jasonbeverage Mar 9, 2017
6720615
Made emitters return a Particle instead of taking one as an input
jasonbeverage Mar 9, 2017
98b1601
Added looping to particle system
jasonbeverage Mar 9, 2017
e52c608
Sprucing up particle demo
jasonbeverage Mar 9, 2017
de432ab
Made it so emitters have their own model matrix that can be manipulat…
jasonbeverage Mar 10, 2017
fc0493d
Removed local positions in favor of using the emitterModelMatrix
jasonbeverage Mar 10, 2017
c2996a2
Spinning emitter = more awesome
jasonbeverage Mar 10, 2017
431ef2d
Changing particle size
jasonbeverage Mar 10, 2017
982fd09
Fixed velocity of Box and Sphere emitters
jasonbeverage Mar 10, 2017
4f5279b
Choosing emitter type in sandcastle example
jasonbeverage Mar 10, 2017
72d8a5c
Added option to make the model fly in particle system demo
jasonbeverage Mar 10, 2017
f34760f
Increased radius of box and sphere emitters
jasonbeverage Mar 10, 2017
64f782f
Updated particle system screen shot
jasonbeverage Mar 10, 2017
72bb6d7
Merge branch 'master' into particles
jasonbeverage Apr 13, 2017
2185bb4
Work on integrating particle system with entity framework
jasonbeverage Apr 14, 2017
4bd4cc4
Made it so particle system demo uses entity framework
jasonbeverage Apr 14, 2017
54962e8
Merge branch 'master' into particles
jasonbeverage Apr 14, 2017
7a6b1d4
Revert bad commit
jasonbeverage Apr 14, 2017
8de7a3b
docs
jasonbeverage Apr 14, 2017
ebc1427
Work on being able to toggle show on a particle system
jasonbeverage Apr 17, 2017
c05f581
Added force support to the particle system in the entity framework
jasonbeverage Apr 17, 2017
1a33efb
Fix width and height properties in example
jasonbeverage Apr 17, 2017
251bb1c
Formatting ParticleSystem sandcastle example
jasonbeverage May 9, 2017
f76b890
min to minimum and max to maximum in particle systems
jasonbeverage May 9, 2017
e5e0998
Floating point values in particle system example instead of int
jasonbeverage May 9, 2017
dcacd47
null to undefined in particle system example
jasonbeverage May 9, 2017
a475545
Typo
jasonbeverage May 9, 2017
3fc0e0b
Describing units in ParticleSystemGraphics
jasonbeverage May 9, 2017
c980b70
Units
jasonbeverage May 9, 2017
9821d5e
Particle system docs
jasonbeverage May 9, 2017
e372fa0
Simplified return of Particle.update
jasonbeverage May 9, 2017
acd31e7
Removed unnecessary use of defaultValue in ParticleSystem constructor
jasonbeverage May 9, 2017
388f2d3
Using Cesium.lerp instead of manual lerping
jasonbeverage May 9, 2017
879e610
Commenting ParticleSystem and made some functions local functions ins…
jasonbeverage May 9, 2017
223ec9c
Recording bursts.length outside of the loop
jasonbeverage May 9, 2017
d16ab77
Remove unnecessary semicolon
jasonbeverage May 9, 2017
001d92c
Formatting
jasonbeverage May 10, 2017
2fb8637
Not calling defaultValue for options.image in Particle
jasonbeverage May 10, 2017
ac6d4e0
Scratch var in Particle.update
jasonbeverage May 10, 2017
5a46750
Fixed comment in ParticleSystemGraphics
jasonbeverage May 10, 2017
0a36b48
Fixed emitter constructors
jasonbeverage May 10, 2017
bbb128d
Added new randomBetween function to CesiumMath and using it in partic…
jasonbeverage May 10, 2017
8a8626c
Scratch variables in ParticleSystem
jasonbeverage May 10, 2017
7e2a965
Recording burstLength outside of loop when resetting bursts
jasonbeverage May 10, 2017
788d422
unnecessary semicolons
jasonbeverage May 10, 2017
47c7a6d
Changed signature of particle emitter to take an existing particle in…
jasonbeverage May 10, 2017
76d6ccf
Added ParticleEmitter interface class
jasonbeverage May 10, 2017
5b95fa2
Documenting particle emitters
jasonbeverage May 10, 2017
f2b0a7b
Not cloning colors in particle constructors
jasonbeverage May 10, 2017
319b9ce
Added a particlePool to the ParticleSystem class to limit allocations…
jasonbeverage May 10, 2017
de1dbcf
Checking for undefined bursts variable
jasonbeverage Jun 1, 2017
b49f8cd
Checking for undefined forces
jasonbeverage Jun 1, 2017
ae54804
Fixed looping
jasonbeverage Jun 1, 2017
5be6977
Fixed typo for forcesSubscription
jasonbeverage Jun 6, 2017
d0d71b6
Add/update doc, minor cleanup for ParticleSystem.
bagnell Jun 15, 2017
501abf5
Merge remote-tracking branch 'upstream/master' into particlesystem
bagnell Jun 15, 2017
8abd935
Add doc to Particle and make some properties private.
bagnell Jun 15, 2017
4789ff1
Add type for particle bursts.
bagnell Jun 15, 2017
5fd4e4d
Reduce garbage generated from emitters and more doc updates.
bagnell Jun 15, 2017
fda2fdb
Move some emitter properties to getter/setters and check for errors.
bagnell Jun 15, 2017
b4806bb
Fixes after last commit.
bagnell Jun 15, 2017
4eeb893
More doc updates.
bagnell Jun 15, 2017
e91de94
Fix missing require.
bagnell Jun 15, 2017
985498e
Merge remote-tracking branch 'upstream/master' into particlesystem
bagnell Jun 19, 2017
5d4d333
Change to fire image created by @rahwang.
bagnell Jun 19, 2017
d37d322
Add particle system tests.
bagnell Jun 20, 2017
def17e1
Remove particle datasource support for now. See particles-datasource …
bagnell Jun 20, 2017
e3af3ea
Fix eslint errors.
bagnell Jun 20, 2017
b17adcf
More eslint fixes.
bagnell Jun 20, 2017
08bd544
Check for invalid values when setting properties and update tests.
bagnell Jun 20, 2017
baddc32
Free particles from the pool.
bagnell Jun 20, 2017
ec341c6
Update CHANGES.md.
bagnell Jun 20, 2017
cd4ffd8
Add new particle system demo.
bagnell Jun 20, 2017
41390b9
Fix issue with increased clock speed or when scrubbing the timeline.
bagnell Jun 21, 2017
116d515
Add new Sandcastle example.
bagnell Jun 21, 2017
ce18cf8
Better fire from @rahwang.
bagnell Jun 21, 2017
f8de4ea
Update colors in Sandcastle example.
bagnell Jun 21, 2017
129772f
Give each system its own pool of particles.
bagnell Jun 21, 2017
95fc96f
Add better memory management.
bagnell Jun 21, 2017
0e44fbd
Merge remote-tracking branch 'upstream/master' into particlesystem
bagnell Jun 21, 2017
70c191e
Tweak CHANGES.md
pjcozzi Jun 21, 2017
ec59d9f
Resize fire image.
bagnell Jun 21, 2017
2e5e510
Fix Sandcastle show option.
bagnell Jun 22, 2017
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
Binary file added Apps/SampleData/fire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
418 changes: 418 additions & 0 deletions Apps/Sandcastle/gallery/ParticleSystem.html

Large diffs are not rendered by default.

Binary file added Apps/Sandcastle/gallery/ParticleSystem.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion Source/Core/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ define([
};

/**
* Generates a random number in the range of [0.0, 1.0)
* Generates a random floating point number in the range of [0.0, 1.0)
* using a Mersenne twister.
*
* @returns {Number} A random number in the range of [0.0, 1.0).
Expand All @@ -752,6 +752,18 @@ define([
return randomNumberGenerator.random();
};


/**
* Generates a random number between two numbers.
*
* @param {Number} min The minimum value.
* @param {Number} max The maximum value.
* @returns {Number} A random number between the min and max.
*/
CesiumMath.randomBetween = function(min, max) {
return CesiumMath.nextRandomNumber() * (max - min) + min;
};

/**
* Computes <code>Math.acos(value)</acode>, but first clamps <code>value</code> to the range [-1.0, 1.0]
* so that the function will never return NaN.
Expand Down
5 changes: 4 additions & 1 deletion Source/DataSources/DataSourceDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ define([
'./GeometryVisualizer',
'./LabelVisualizer',
'./ModelVisualizer',
'./ParticleSystemVisualizer',
'./PathVisualizer',
'./PointVisualizer',
'./PolygonGeometryUpdater',
Expand Down Expand Up @@ -48,6 +49,7 @@ define([
GeometryVisualizer,
LabelVisualizer,
ModelVisualizer,
ParticleSystemVisualizer,
PathVisualizer,
PointVisualizer,
PolygonGeometryUpdater,
Expand Down Expand Up @@ -123,7 +125,8 @@ define([
new LabelVisualizer(entityCluster, entities),
new ModelVisualizer(scene, entities),
new PointVisualizer(entityCluster, entities),
new PathVisualizer(scene, entities)];
new PathVisualizer(scene, entities),
new ParticleSystemVisualizer(scene, entities)];
};

defineProperties(DataSourceDisplay.prototype, {
Expand Down
13 changes: 12 additions & 1 deletion Source/DataSources/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ define([
'./EllipsoidGraphics',
'./LabelGraphics',
'./ModelGraphics',
'./ParticleSystemGraphics',
'./PathGraphics',
'./PointGraphics',
'./PolygonGraphics',
Expand Down Expand Up @@ -54,6 +55,7 @@ define([
EllipsoidGraphics,
LabelGraphics,
ModelGraphics,
ParticleSystemGraphics,
PathGraphics,
PointGraphics,
PolygonGraphics,
Expand Down Expand Up @@ -107,6 +109,7 @@ define([
* @param {EllipsoidGraphics} [options.ellipsoid] A ellipsoid to associate with this entity.
* @param {LabelGraphics} [options.label] A options.label to associate with this entity.
* @param {ModelGraphics} [options.model] A model to associate with this entity.
* @param {ParticleSystemGraphics} [options.particleSystem] A particle system to associate with this entity.
* @param {PathGraphics} [options.path] A path to associate with this entity.
* @param {PointGraphics} [options.point] A point to associate with this entity.
* @param {PolygonGraphics} [options.polygon] A polygon to associate with this entity.
Expand All @@ -133,7 +136,7 @@ define([
this._show = defaultValue(options.show, true);
this._parent = undefined;
this._propertyNames = ['billboard', 'box', 'corridor', 'cylinder', 'description', 'ellipse', //
'ellipsoid', 'label', 'model', 'orientation', 'path', 'point', 'polygon', //
'ellipsoid', 'label', 'model', 'orientation', 'particleSystem', 'path', 'point', 'polygon', //
'polyline', 'polylineVolume', 'position', 'properties', 'rectangle', 'viewFrom', 'wall'];

this._billboard = undefined;
Expand All @@ -156,6 +159,8 @@ define([
this._modelSubscription = undefined;
this._orientation = undefined;
this._orientationSubscription = undefined;
this._particleSystem = undefined;
this._particleSystemSubscription = undefined;
this._path = undefined;
this._pathSubscription = undefined;
this._point = undefined;
Expand Down Expand Up @@ -391,6 +396,12 @@ define([
* @type {Property}
*/
orientation : createPropertyDescriptor('orientation'),
/**
* Gets or sets the particle system.
* @memberof Entity.prototype
* @type {ParticleSystemGraphics}
*/
particleSystem : createPropertyTypeDescriptor('particleSystem', ParticleSystemGraphics),
/**
* Gets or sets the path.
* @memberof Entity.prototype
Expand Down
Loading