Commit Graph

34 Commits

Author SHA1 Message Date
jerome.fayot 2ca3ae7aac feat: added TrackingReferenceFrame.ENU 2024-11-21 08:25:21 +01:00
jerome.fayot e69487a58b fix: fixed prettier 2024-11-09 18:06:01 +01:00
jerome.fayot 78cc807101 fix: created dedicated TrackingReferenceFrame constants not to be confused with ReferenceFrame ones 2024-11-09 18:06:01 +01:00
jerome.fayot 76cd99ce0e feat: added Entity.trackingReferenceFrame to allow tracking entities in their own inertial reference frame 2024-11-09 18:05:45 +01:00
jjspace 09a719b8fb
run prettier v3 2024-09-20 11:24:24 -04:00
Gabby Getz 48529bf0cd Update terrain async Sandcastles 2023-02-14 13:18:05 -05:00
Gabby Getz 3f6608f66e Use top level await in Sandcastle 2023-02-03 11:38:55 -05:00
Gabby Getz e175431d74 Sandcastle tweaks 2023-01-20 10:08:56 -05:00
Gabby Getz f956e6eb60 Cleanup async terrain handling 2023-01-19 16:14:11 -05:00
Gabby Getz 7bd1fc268b Deprecate ready and readyPromise for terrainProviders 2023-01-11 13:55:48 -05:00
Sanjeet Suhag a4a3b783d8 Sets the Sandcastle startup function as a property to the window 2022-05-23 15:14:50 -04:00
Gabby Getz 8143df4436 var -> const/let 2022-01-21 11:26:25 -05:00
Matthew Amato 2fd0e8f7e4 Format all code with prettier 2020-04-16 20:31:36 -04:00
Sean Lilley 5cf09c5c7b Change scene light source 2019-11-25 13:07:45 -05:00
hpinkos aded37764f reduce sample data size 2019-10-21 10:55:19 -04:00
Matthew Amato aabd27a760 Migrate Cesium to ES6 Modules
See https://github.com/AnalyticalGraphicsInc/cesium/pull/8224 for details.

eslint
There are a handful of new .eslintrc.json files, mostly to identify the files that are still AMD modules (Sandcastle/Workers). These are needed because you can't change the parser type with a comment directive (since the parser is the thing reading the file). We can finally detect unusued modules! So those have all been cleaned up as well.

requirejs -> rollup & clean-css
requirejs, almond, and karma-requirejs have all been removed. We now use rollup for building and minifying (via uglify) JS code and clean-css for css. These changes are fairly straight-forward and just involve calling rollup instead of requirejs in the build process.

Overall build time is significantly faster. CI is ~11 minutes compared to ~17 in master. Running makeZipFile on my machine takes 69 seconds compared to 112 seconds in master. There's probably plenty of room for additional optimization here too.

We wrote an published a small npm module, rollup-plugin-strip-pragma, for stripping the requirejs pragmas we use out of the release builds. This is maintained in the Tools/rollup-plugin-strip-pragma directory.

As for what we produce. The built version of Cesium is now a UMD module. So it should work anywhere that hasn't made the jump to ES6 yet. For users that were already using the "legacy" combined/minified approach, nothing changes.

One awesome thing about roll-up is that it compiles all of the workers at once and automatically detects shared codes and generates separate bundles under the hood. This means the size of our worker modules shrink dramatically and Cesium itself will load them much faster. The total minified/gzipped size of all workers in master is 2.6 MB compared to 225 KB in this branch! This should be most noticeable on demos like Geometry & Appearances which load lots of workers for the various geometry typs.

roll-up is also used to build Cesium Viewer, which is now an ES6 app.

We use clean-css via gulp and it is also a straightforward change from requirejs that requires no special mention.

Workers
While the spec allows for ES6 Web Workers, no browser actually supports them yet. That means we needed a way to get our workers into non-ES6 form. Thankfully, roll-up can generate AMD modules, which means we now have a build step to compile our Worker source code back into AMD and use the existing TaskProcessor to load and execute them. This build step is part of the standard build task and is called createWorkers. During development, these "built" workers are un-optimized so you can still debug them and read the code.

Since there is a build step, that means if you are changing code that affects a worker, you need to re-run build, or you can use the build-watch task to do it automatically.

The ES6 versions of Worker code has moved into Source/WorkersES6 and we build the workers into their "old home" of Source/Workers. cesiumWorkerBootstrapper and transferTypedArrayTest which were already non-AMD ES5 scripts remain living in the Workers directory.

Surprisingly little was changed about TaskProcessor or the worker system in general, especially considering that I thought this would be one of the major hurdles.

ThirdParty
A lot of our ThirdParty either already had a hand-written wrapper for AMD (which I updated to ES6) or had UMD which created problems when importing the same code in both Node and the browser. I basically had to update the wrapper of every third-party library to fix these problems. In some cases I updated the library version itself (Autolinker, topojson). Nothing to be too concerned about, but future clean-up would be using npm versions of these libraries and auto-generating the wrappers as needed so we don't hand-edit things.

Sandcastle
Sandcastle is eternal and manages to live another day in it's ancient requirejs/dojo 1.x form. Sandcastle now automatically uses the ES6 version of Cesium if it is available and fallsback to the ES5 unminified version if it is now. The built version of Sandcastle always uses CesiumUnminified, just like master. This means Sandcastle still works in IE11 if you run the combine step first (or use the relase zip)

Removed Cesium usage from Sandcastle proper, since it wasn't really needed
Generate a VERSION propertyin the gallery index since Cesium is no longer being included.
Remove requirejs from Sandcastle bucket
Update bucket to use the built version of Cesium if it is available by fallbackto the ES6 version during development.
Standalone.html was also updated
There's a bit of room for further clean-up here, but I think this gets us into master. I did not rename bucket-requirejs.html because I'm pretty sure it would break previously shared demos. We can put in some backwards compatible code later on if we want. (But I'd rather just see a full Sandcastle rewrite).

Specs
Specs are now all ES6, except for TestWorkers, which remain standard JS worker modules. This means you can no longer run the unbuilt unit tests in IE11. No changes for Chrome and Firefox.

Since the specs use ES6 modules and built Cesium is an ES5 UMD, I added a build-specs build step which generates a combined ES5 version of the specs which rely on Cesium as a global variable. We then inject these files into jasmine instead of the standard specs and everything works exactly as it did before. SpecRunner.html has been updated to inject the correct version of the script depending on the build/release query parameters.

The Specs must always use Cesium by importing Source/Cesium.js, this is so we can replace it with the built Cesium as describe above.

There's a bunch of room for clean-up here, such as unifying our two copies of jasmine into a single helper file, but I didn't want to start doing that clean-up as part of this already overly big PR. The important thing is that we can still test the built version and still test on IE/Edge as needed.

I also found and fixed two bugs that were causing failing unit tests, one in BingMapsImageryProviderSpec.js (which was overwriting createImage andnot setting it back) and ShadowVolumeAppearance.js (which had a module level caching bug). I think these may have been the cause of random CI failures in master as well, but only time will tell.

For coverage, we had to switch to karma-coverage-istanbul-instrumenter for native ES6 support, but that's it.

Finally, I updated appveryor to build Cesium and run the built tests under IE. We still don't fail the build for IE, but we should probably fix that if we want to keep it going.

NodeJS
When NODE_ENV is production, we now require in the minified CesiumJS directly, which works great because it's now a UMD module. Otherwise, we use the excellant esmpackage to load individual modules, it was a fairly straightforward swap from our old requirejs usage. We could probably drop esm too if we don't care about debugging or if we provie source maps at some point.
2019-10-03 11:51:23 -04:00
Matthew Amato 6e0911e110 Remove all double quote usage from JS code
99% of this PR was automatically fixed with eslint, I simply removed the
`"quotes": "off"` from Sandcastle and Specs which was ignoring the
standard rule of using single quotes.

Also added some Sandcastle generated files to .eslintignore.
2018-07-24 13:28:31 -04:00
Matthew Amato 7844a5f0c3 STK World Terrain -> Cesium World Terrain
1. Remove all `STK World Terrain` usage/references and replace them with
`Cesium World Terrain`.
2. Add new `createWorldTerrain` helper function for creating the world
terrain. Same defaults for extensions as CesiumTerrainProvider(no normals
or water).
3. Replace all World Terrain examples and doc with `createWorldTerrain`.
We were needlessly setting `requestWaterMask` and `requestVertexNormals`
to true in most examples, so I just changed it to use the default behavior
to simplify the code.
4. Add a deprecation warning and deprecation Credit when `assets.agi.com`
is detected. Note that this includes ArcticDEM and PAMap, which are still
being used in this PR but will be replaced in a follow-up PR after this
is merged.
2018-02-26 15:05:04 -05:00
Matthew Amato 5101f5a961 Allow Viewer imageryProvider or terrainProvider with BaseLayerPicker
We've had a check in Viewer forever to see if the baseLayer picker was
being used when a terrainProvider or imageryProvider was specified.  This
lead to a tone of code where we create the viewer and then just specify
viewer.terrainProvider anyway. Basically, this check was pointless and
just made the code more verbose.  The check also prevented devs from
specifing a terrainProvider but still using BaseLayerPicker for imagery
(and vice versa). Now we just let the user do what they want, which was
probably the right call from the beginning.
2018-02-22 21:47:01 -05:00
ggetz e8ef9c7e6c Added viewer option for shouldAnimate 2018-01-25 12:11:21 -05:00
ggetz 7d197e61df clockViewModel.shouldAnimate -> clock.shouldAnimate 2018-01-24 16:56:45 -05:00
ggetz b540746a6f Clock does not animate by default 2018-01-24 16:06:45 -05:00
Rachel Hwang 96f8601a49 mend 2017-05-01 12:01:40 -04:00
Rachel Hwang c33d75ede3 fixing example descriptions 2017-04-25 09:26:08 -04:00
Thomas Pedbereznak 682b15066c Used https and updated changes 2016-03-15 15:17:38 -04:00
Sanuj 04216d0204 Replace "use strict" by 'use strict' 2016-02-09 11:07:51 +05:30
Matthew Amato 77d22e0c62 Update AMD loaders
Update `requirejs` from 2.1.9 to 2.1.20.
Update `almond` from 0.2.6 to 0.3.1.
2015-10-22 17:07:26 -04:00
Matthew Amato 72dcba6670 Remove remnants of Chrome Frame
Fixes #3065
2015-10-13 19:58:09 -04:00
Matthew Amato 8b294709c4 Remove usage of //cesiumjs.org/stk-terrain/world
//cesiumjs.org/stk-terrain/world is an old url that has not been in the
official documentation for some time, but we never officially deprecated
it.  The new cesiumjs.org server is no longer colocated with assets.agi.com,
so the redirect we now provide will have reduced performance.
2015-06-24 09:22:36 -04:00
Ed Mackey 94b6587938 Tweaked colors & settings in the Interpolation demo. 2015-03-30 16:52:38 -04:00
Dan Bagnell a7d3350d32 Handle velocities that are parallel with the geodetic normal at the current positions. 2015-03-27 19:36:23 -04:00
Matthew Amato ff1321ccd8 Changes after review
1. Bump model in Interpolation demo to minimumPixelSize of 64
2. Factor out rotation code from `VelocityOrientationProperty` into `Transforms.rotationMatrixFromPositionVelocity`
2015-03-26 11:04:24 -04:00
Matthew Amato 238bc6f513 OrientDirectionOfTravelProperty -> VelocityOrientationProperty 2015-03-26 00:12:58 -04:00
Matthew Amato 4e162e50b0 Add property for easy entity orientation.
1. Add `OrientDirectionOfTravelProperty`, which takes a position property
and generates a `Quaternion` along the direction of travel. Thanks to
@bagnell for providing me the code to actually computes the orientation.
2. Added a new Sandcastle example, which is a copy of the tie-figter demo
that now uses the Cesium aircraft and the new orientation property.
3. Added ability to pass an initial array of intervals to TimeIntervalCollection,
which makes constructing entities with availability easier.

I'm up for better naming suggestions if anyone has one, but I don't want to
start arguing over it, let me know if you really hate the current name and
have an objectively better one.

Also, while test coverage for the new class is 100%, I have no idea how to
test the actual results because I don't know of any situations that would
provide "nice" numbers.  I admit for the current numbers part I just copied
values from the results. Does anyone have any ideas here?
2015-03-25 18:23:16 -04:00