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

3DTiles streaming optimizations #7774

Merged
merged 409 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
409 commits
Select commit Hold shift + click to select a range
9086f4e
adding dest camera
loshjawrence Jan 28, 2019
f966f5d
adding prefetchCamera member to camera
loshjawrence Jan 28, 2019
f3d4dd0
fixing comment
loshjawrence Jan 28, 2019
41e8e4d
adding spec (doesn't work yet)
loshjawrence Jan 28, 2019
a1c3dfe
removing old stuff, fixing bug
loshjawrence Jan 28, 2019
b536a03
remove
loshjawrence Jan 28, 2019
0a3ec00
moving function
loshjawrence Jan 28, 2019
77c65b4
Defer loading of foveated tiles
Jan 28, 2019
fa96ba2
Change foveated SSE into a factor
Jan 28, 2019
d557282
updating spec
loshjawrence Jan 29, 2019
b2c6465
reverting
loshjawrence Jan 29, 2019
068cf0d
trying to add way to keep prefetches in cache
loshjawrence Jan 30, 2019
808236f
adding debug stuff
loshjawrence Jan 30, 2019
c077b82
hacked but working version
loshjawrence Jan 30, 2019
f8fa749
more working
loshjawrence Jan 30, 2019
52443b6
working with new dot product calc
loshjawrence Jan 30, 2019
86f1b8a
defers fog as well
loshjawrence Jan 31, 2019
0338538
removing reset, adding the old updateTileVisibilty call back
loshjawrence Jan 31, 2019
675acad
removing stuff
loshjawrence Jan 31, 2019
d07686e
moving
loshjawrence Jan 31, 2019
7a55b7a
adding code for simple approach
loshjawrence Feb 1, 2019
e142f8c
some clean up
loshjawrence Feb 1, 2019
119b577
some cleanup
loshjawrence Feb 1, 2019
4b6204b
some cleanup
loshjawrence Feb 1, 2019
174c2b1
some cleanup
loshjawrence Feb 1, 2019
90521b8
adding specs
loshjawrence Feb 1, 2019
9da6f75
some cleanup
loshjawrence Feb 1, 2019
af2c7c9
exposing the param
loshjawrence Feb 2, 2019
96fc625
default
loshjawrence Feb 2, 2019
d396ce3
some cleanup
loshjawrence Feb 2, 2019
a83a06c
reseting some settings
loshjawrence Feb 2, 2019
2defeb0
checkpoint
loshjawrence Feb 2, 2019
3c4938e
removing fog sse stuff
loshjawrence Feb 2, 2019
b26a594
setting to 0
loshjawrence Feb 2, 2019
e5d7cf3
off by default
loshjawrence Feb 2, 2019
d105e9c
some clean up
loshjawrence Feb 3, 2019
3cd50c2
updating with the outer fovea sse interp
loshjawrence Feb 4, 2019
30eeb3c
Merge branch 'open-source' into staging-3dtiles-streaming-optimizations
loshjawrence Feb 4, 2019
da09462
Merge branch 'staging-3dtiles-streaming-optimizations' into sse-foveated
loshjawrence Feb 4, 2019
ead8c92
updating priority spec
loshjawrence Feb 4, 2019
49cbce7
adding tileset spec for checking request deferring
loshjawrence Feb 4, 2019
8a7925e
fixing bug, trying to get spec working
loshjawrence Feb 4, 2019
035c0ee
spec working
loshjawrence Feb 4, 2019
2a420d8
setting back to 60
loshjawrence Feb 4, 2019
0cb99c4
Merge branch 'staging-3dtiles-streaming-optimizations' into raise-sse…
loshjawrence Feb 4, 2019
71f6190
number param
loshjawrence Feb 5, 2019
d923a0b
fixing tileset spec
loshjawrence Feb 5, 2019
f19ed63
lint
loshjawrence Feb 5, 2019
238b03c
adding options on batched3dmodel3dtilecontentspec
loshjawrence Feb 5, 2019
27faa35
adding spec fix
loshjawrence Feb 5, 2019
f91bc8b
adding options to specs
loshjawrence Feb 5, 2019
23e6322
adding spec fixes
loshjawrence Feb 5, 2019
1cfb90e
fixing comment and swapping boolean args to prevent needless calculation
loshjawrence Feb 6, 2019
412e405
making the description more concise"
loshjawrence Feb 6, 2019
25db8b7
amazing teamwork
loshjawrence Feb 7, 2019
b37f3cc
removing large sse from test
loshjawrence Feb 7, 2019
91cd6b9
Code cleanup
Feb 7, 2019
21ca3e1
Use correct foveated factor
Feb 7, 2019
321c9b1
some comment and doc changes
loshjawrence Feb 8, 2019
c520aae
adding getters setters
loshjawrence Feb 8, 2019
cf746d1
fix
loshjawrence Feb 8, 2019
0b2fb66
some fixes
loshjawrence Feb 8, 2019
2e2065f
removing doc type
loshjawrence Feb 8, 2019
7542625
adding cullrequestswhilemoving default to loadTileset in tilestester
loshjawrence Feb 8, 2019
2fab6ed
fix contentclassification
loshjawrence Feb 8, 2019
6775718
fixing batched3dmodel3dtilecontent
loshjawrence Feb 8, 2019
c16577e
fixing cesium3dtilebatchtable
loshjawrence Feb 8, 2019
eafd939
fixing composite3dtilecontent
loshjawrence Feb 8, 2019
1fb095f
fixing instanced3dmodel3dtilecontent
loshjawrence Feb 8, 2019
a4b74f7
fixing pointcloudseyedomelighting
loshjawrence Feb 8, 2019
748a02f
fixing tileset3dtilecontent
loshjawrence Feb 8, 2019
04708b9
example fix in vector3dtilecontent spec
loshjawrence Feb 8, 2019
a6c46d6
fixing vector3dtilescontent spec
loshjawrence Feb 8, 2019
e36ebf6
fixing pointcloud3dtilecontent
loshjawrence Feb 8, 2019
cd1f232
fixing geometry3dtilecontent
loshjawrence Feb 8, 2019
0d0f340
partial fix on tilesetspec
loshjawrence Feb 8, 2019
1fbb225
format
loshjawrence Feb 8, 2019
1ba3aa4
fixing camera spec
loshjawrence Feb 8, 2019
6784d2e
adding adjustment for leaf tiles
loshjawrence Feb 8, 2019
96c6957
adding buggy but sort of working non-skipLOD foveated
loshjawrence Feb 11, 2019
563385d
updating param name, disabling when nonskiplod
loshjawrence Feb 11, 2019
e8bbcbc
updating docs
loshjawrence Feb 11, 2019
4b90c25
on by default
loshjawrence Feb 11, 2019
4903632
fixing docs
loshjawrence Feb 11, 2019
4a54048
fixing docs
loshjawrence Feb 11, 2019
742e8e6
using a saved camera var instead of scratch var
loshjawrence Feb 11, 2019
4e3cde3
fixing lint
loshjawrence Feb 11, 2019
e78ab95
removing @private doc on oldpositionwc, grouping with other positions
loshjawrence Feb 11, 2019
6c0b3bc
Merge pull request #542 from AnalyticalGraphicsInc/raise-sse-while-mo…
lilleyse Feb 12, 2019
7e9580e
Merge branch 'staging-3dtiles-streaming-optimizations' into sse-foveated
lilleyse Feb 12, 2019
b8b2800
Merge pull request #539 from AnalyticalGraphicsInc/sse-foveated
lilleyse Feb 12, 2019
0613691
Merge branch 'open-source' into staging-merge
loshjawrence Feb 13, 2019
443558d
Time gate foveated deferral system
Feb 14, 2019
682ee7a
Add back priority deferral and docs
Feb 15, 2019
b9c8426
Update tests
Feb 15, 2019
60c4c5b
Add performance testing Sandcastle
Feb 15, 2019
c887ee8
Adding concept of 3D Tiles passes
lilleyse Feb 18, 2019
7e1d7b0
Comment out travis deploy steps
lilleyse Feb 18, 2019
9d606a1
Merge branch 'viewshed-prefetch' into 3d-tiles-passes
lilleyse Feb 18, 2019
83b197f
Remove unused code
lilleyse Feb 18, 2019
addc8bf
Fix command list reset
lilleyse Feb 18, 2019
9a35bd4
Replace pass with isRender
lilleyse Feb 18, 2019
2708ea8
Move pass options into a LUT
lilleyse Feb 18, 2019
897710f
Require pass state and pass
lilleyse Feb 18, 2019
cb886c0
Added tests
lilleyse Feb 18, 2019
fc7b2e1
Merge pull request #550 from AnalyticalGraphicsInc/3d-tiles-passes
loshjawrence Feb 19, 2019
b00a12f
merging with viewshed-prefetch
loshjawrence Feb 19, 2019
38a8865
merging staging
loshjawrence Feb 19, 2019
1d74e2b
just noting the items that need to be extracted from tileset.update w…
loshjawrence Feb 19, 2019
fdfc47e
prefetch working with new passes concept
loshjawrence Feb 19, 2019
844c17d
Merge branch 'staging-3dtiles-streaming-optimizations' into time-gate…
Feb 20, 2019
46e47d5
Cleanup performance testing Sandcastle
Feb 20, 2019
8fb3562
Change foveatedTimeDelay default and clean up
Feb 20, 2019
6548265
Early return in loadTile
Feb 20, 2019
638b3c3
Fix loadTile
Feb 20, 2019
bfc9c77
fixing camera specs, fixing priority spec
loshjawrence Feb 20, 2019
fce75c7
fixing bunch of tests
loshjawrence Feb 20, 2019
d013059
hacking spec to pass
loshjawrence Feb 21, 2019
810b78d
pr clean up
loshjawrence Feb 21, 2019
e45242b
pr clean up
loshjawrence Feb 21, 2019
9ebf35a
allow mixing of screen center vs distance to camera
loshjawrence Mar 5, 2019
de0e3d2
removing uninteded edit
loshjawrence Mar 5, 2019
6bb8a96
changing default
loshjawrence Mar 5, 2019
d805374
updating default settins settings 0.9 screenCenterPriority and 0.1 fo…
loshjawrence Mar 8, 2019
af6692e
adding spec for updatePriorityDistance
loshjawrence Mar 8, 2019
f47a4e1
fixing comment
loshjawrence Mar 8, 2019
c172951
updating foveated doc default
loshjawrence Mar 8, 2019
cdb424d
forgot to promote prefetches
loshjawrence Mar 13, 2019
75dd866
updating spec
loshjawrence Mar 13, 2019
486414d
Merge branch 'open-source' into staging-3dtiles-streaming-optimizations
loshjawrence Mar 18, 2019
2b19dc4
migrating code
loshjawrence Mar 18, 2019
dc4c9d4
adding option
loshjawrence Mar 18, 2019
e8abe95
adding option
loshjawrence Mar 18, 2019
4c4427b
adding progressive resoultion for tile.js
loshjawrence Mar 18, 2019
4d25fb6
adding progressive resolution digit
loshjawrence Mar 18, 2019
130946b
clean up
loshjawrence Mar 18, 2019
d92deb8
updating spec
loshjawrence Mar 19, 2019
5f8db1d
some tweaks
loshjawrence Mar 19, 2019
1d357bf
Preloading
lilleyse Mar 19, 2019
96a0a8d
since preloadWhenHidden piggy backing off prefetch pass but doesn't n…
loshjawrence Mar 20, 2019
3fdb7bb
lint
loshjawrence Mar 20, 2019
18895c2
Merge pull request #586 from AnalyticalGraphicsInc/preload
loshjawrence Mar 20, 2019
8f24e4a
prefetch -> preload
loshjawrence Mar 20, 2019
1791ec9
adding separate pass for preload and preload_flight
loshjawrence Mar 20, 2019
0b797d7
adding hasCurrentFlight() to camera and _pass to tileset
loshjawrence Mar 20, 2019
559bba3
adding preframeupdate function to tileset
loshjawrence Mar 21, 2019
ff38cfd
adding preFrameUpdate, changing canceloutofviewrequets to use last fr…
loshjawrence Mar 21, 2019
4989a73
lint
loshjawrence Mar 21, 2019
cb861ed
adding prepassesupdate and postpassessupdate for pass invariant code
loshjawrence Mar 21, 2019
2b32479
adding comments, removing commented code
loshjawrence Mar 21, 2019
46c066f
adding comment
loshjawrence Mar 21, 2019
502c48e
fixing camera spec
loshjawrence Mar 21, 2019
5c921f6
refining check
loshjawrence Mar 22, 2019
01bc704
adding check back
loshjawrence Mar 22, 2019
13e7f40
somewhere close to what it should be
loshjawrence Mar 25, 2019
757520d
break the priority dependency chain if not less or equal to
loshjawrence Mar 25, 2019
7adb487
undoing change
loshjawrence Mar 25, 2019
31f95f6
better
loshjawrence Mar 25, 2019
8c5567e
updating spec, removing members
loshjawrence Mar 25, 2019
2090ad8
Merge branch 'staging-3dtiles-streaming-optimizations' into screen-ce…
loshjawrence Mar 25, 2019
9271d29
Merge branch 'staging-3dtiles-streaming-optimizations' into time-gate…
loshjawrence Mar 25, 2019
2480e8e
moving isPriorityDeferred back to tile.js, needed for updateAndPushCh…
loshjawrence Mar 25, 2019
e51bae7
moving call back to old location
loshjawrence Mar 25, 2019
4ba7edd
removing comment
loshjawrence Mar 25, 2019
f147b0f
pr fixes
loshjawrence Mar 28, 2019
7431e42
re-arraging scene code so that passes are separated from pre and post…
loshjawrence Mar 28, 2019
264af4c
moving creditDisplay update
loshjawrence Mar 28, 2019
be13448
fixing spec
loshjawrence Mar 28, 2019
4ef3034
updating comments
loshjawrence Mar 28, 2019
20e2250
mofing callafterrenderfunctions outside of trycatch
loshjawrence Mar 28, 2019
447a3b8
updating comments
loshjawrence Mar 28, 2019
fcd7e8b
flatter function with block comment sections
loshjawrence Mar 28, 2019
9084001
moving other invariant code out that was mentioned yestarday
loshjawrence Mar 29, 2019
61dad6b
no events fired in trycatch
loshjawrence Mar 29, 2019
43b29a4
Change event order so not to have breaking changes
lilleyse Mar 29, 2019
aaa8332
resolving rebase
loshjawrence Mar 29, 2019
d49e2f6
tileset instead of that
lilleyse Mar 29, 2019
2a08825
Merge pull request #552 from AnalyticalGraphicsInc/prefetch-scenepasses
lilleyse Mar 29, 2019
a007246
Merge branch 'open-source' into staging-3dtiles-streaming-optimizations
loshjawrence Apr 4, 2019
da827f6
fixing priority code for merge
loshjawrence Apr 4, 2019
1e78f2a
Small tweak
lilleyse Apr 4, 2019
9c319a5
merge with staging
loshjawrence Apr 4, 2019
e956ac0
Merge pull request #589 from AnalyticalGraphicsInc/screen-center-prio…
lilleyse Apr 4, 2019
bd53644
merging
loshjawrence Apr 4, 2019
0c96f56
adding var back
loshjawrence Apr 4, 2019
e23a36f
fixing tile spec
loshjawrence Apr 4, 2019
6196173
moved state to camera
loshjawrence Apr 4, 2019
89d81c8
Merge pull request #548 from AnalyticalGraphicsInc/time-gate-foveated
lilleyse Apr 4, 2019
57dea26
open-source merge
loshjawrence Apr 5, 2019
ff09550
merging
loshjawrence Apr 5, 2019
ab09b14
fixing merge issue
loshjawrence Apr 5, 2019
831209c
updating comment
loshjawrence Apr 5, 2019
66e69e4
merge open-source
loshjawrence Apr 5, 2019
004051d
fixing merge issue
loshjawrence Apr 5, 2019
92ce279
Merge branch 'staging-3dtiles-streaming-optimizations' into progressi…
lilleyse Apr 5, 2019
46aa8e2
adding changes
loshjawrence Apr 5, 2019
a9905dd
fix
loshjawrence Apr 5, 2019
ead874e
fix
loshjawrence Apr 5, 2019
521f5b3
adding needed member
loshjawrence Apr 5, 2019
522f793
lint
loshjawrence Apr 5, 2019
58928a3
Merge pull request #585 from AnalyticalGraphicsInc/progressive-resolu…
lilleyse Apr 5, 2019
2b6aff5
testing
loshjawrence Apr 10, 2019
e25ab1d
adding screen space error
loshjawrence Apr 10, 2019
8491b11
reversing sse map
loshjawrence Apr 10, 2019
87f3a62
temp
loshjawrence Apr 10, 2019
8626cb5
something that works
loshjawrence Apr 10, 2019
7f1b9d5
adding some testing code, remvoing commented code
loshjawrence Apr 10, 2019
a1e2041
removing preferLeaves
loshjawrence Apr 10, 2019
a3d12ac
lint, rename
loshjawrence Apr 10, 2019
d766e2e
rename
loshjawrence Apr 10, 2019
df15417
spelling, adding flag for point clouds (preferLeaves) that tries to l…
loshjawrence Apr 12, 2019
95bc8d7
adding
loshjawrence Apr 12, 2019
6369ba9
fixing spec
loshjawrence Apr 12, 2019
d7dd949
Typos
lilleyse Apr 15, 2019
b16e565
removing the progressive resolution ignore when prefering leaves
loshjawrence Apr 15, 2019
6d0dedb
Merge pull request #609 from AnalyticalGraphicsInc/sse-priority-flag
lilleyse Apr 15, 2019
48997b9
removing defer prevention and no-effect code
loshjawrence Apr 19, 2019
e83609b
adding back
loshjawrence Apr 19, 2019
4661af6
adding replace qualifer
loshjawrence Apr 19, 2019
bbfeb1e
adding comment, adding skiplod qualifier
loshjawrence Apr 19, 2019
77b7b6d
spelled out var
loshjawrence Apr 19, 2019
d6d4dd9
Merge pull request #615 from AnalyticalGraphicsInc/simplify
lilleyse Apr 22, 2019
ad99747
Merge branch 'open-source' into staging-3dtiles-streaming-optimizations
loshjawrence Apr 23, 2019
22db23a
dont defer flight destination tiles
loshjawrence Apr 24, 2019
b9356f8
undo some unnecessary changes. update CHANGES.md
loshjawrence Apr 25, 2019
0feb7e6
max/min --> maximum/minimum
loshjawrence Apr 25, 2019
39e3447
spell out name
loshjawrence Apr 25, 2019
7449673
name change
loshjawrence Apr 25, 2019
ed0a807
name change
loshjawrence Apr 25, 2019
d6f640a
update spec, spell out name
loshjawrence Apr 25, 2019
e01b9a4
name change
loshjawrence Apr 25, 2019
95b4302
inteface, but still have to check type
loshjawrence Apr 25, 2019
c176a30
moving priority update at the end of traversal, add comment
loshjawrence Apr 25, 2019
e6b213b
name change
loshjawrence Apr 25, 2019
7093e6b
moving priority update at the end of traversal, add comment
loshjawrence Apr 25, 2019
8a3ef4b
Merge remote-tracking branch 'josh/staging-3dtiles-streaming-optimiza…
lilleyse Apr 25, 2019
94b25b1
Merge remote-tracking branch 'josh/staging-3dtiles-streaming-optimiza…
lilleyse Apr 25, 2019
7040a40
Remove =undefined
lilleyse Apr 25, 2019
fd7e7b3
Merge branch 'master' into staging-3dtiles-streaming-optimizations
loshjawrence Apr 25, 2019
ac8ce2e
adding the right check
loshjawrence Apr 26, 2019
e13db5f
removing statistics from changesmd
loshjawrence Apr 26, 2019
d2f04c9
adding another preload check
loshjawrence Apr 26, 2019
617dfe2
adding doc
loshjawrence Apr 26, 2019
16b57a8
update changesms
loshjawrence Apr 26, 2019
5c7e09e
merge master
loshjawrence Apr 26, 2019
486ffa3
updating the performance sandcastle
loshjawrence Apr 26, 2019
48f1362
Make heatmap look better
lilleyse Apr 26, 2019
80fd68f
Updated CHANGES.md
lilleyse Apr 26, 2019
52e7b20
Handle primitive collections in most detailed picks
lilleyse Apr 26, 2019
7e6c20f
Fix test
lilleyse Apr 26, 2019
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ script:

- npm --silent run buildApps

- npm --silent run deploy-s3 -- -b cesium-dev -d cesium/$TRAVIS_BRANCH --confirm -c 'no-cache'
- npm --silent run deploy-status -- --status success --message Deployed
#- npm --silent run deploy-s3 -- -b cesium-dev -d cesium/$TRAVIS_BRANCH --confirm -c 'no-cache'
loshjawrence marked this conversation as resolved.
Show resolved Hide resolved
#- npm --silent run deploy-status -- --status success --message Deployed

- npm --silent run test -- --browsers FirefoxHeadless --failTaskOnError --webgl-stub --release --suppressPassed

Expand Down
188 changes: 188 additions & 0 deletions Apps/Sandcastle/gallery/development/Performance Testing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<!DOCTYPE html>
loshjawrence marked this conversation as resolved.
Show resolved Hide resolved
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Measure 3D Tiles streaming and rendering performance.">
<meta name="cesium-sandcastle-labels" content="Development">
<title>Streaming Performance Testing</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
if(typeof require === "function") {
require.config({
baseUrl : '../../../Source',
waitSeconds : 120
});
}
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var camera = scene.camera;
var globe = scene.globe;
var statistics = Cesium.RequestScheduler.statistics;

var startTime;
var flightComplete;
var monitor;
var minFrameRate = 1000;
var maxFrameRate = 0;
var sumFrameRate = 0.0;
var frameRateSamples = 0;
var doAlert = false;
var tileset;

viewer.scene.debugShowFramesPerSecond = true;
/*
This Sandcastle makes it easy to test streaming performance for 3D Tiles & terrain. `startTest()` will begin a
counter, and end once both the globe and the tileset finish resolving. If a tileset is not defined, it will
only check the globe, and vice versa.

Set `doAlert = true` above to make it report the timings in an alert window instead of the console.

To test flythroughs do:

- Set the camera's position
- startTest()
- start flythrough

To test how long just teleporting to a particular view takes:

- startTest()
- Set the camera's position
*/

function startTest() {
flightComplete = false;
minFrameRate = 1000;
maxFrameRate = 0;
sumFrameRate = 0.0;
frameRateSamples = 0;
statistics.numberOfActiveRequestsEver = 0;
monitor = new Cesium.FrameRateMonitor({
scene: scene,
samplingWindow: 1.0,
quietPeriod: 0.0,
warmupPeriod: 0.0,
minimumFrameRateDuringWarmup: 0,
minimumFrameRateAfterWarmup: 0
});
scene.preUpdate.addEventListener(measureFrameRate);
startTime = window.performance.now();
window.setTimeout(function() {
scene.postRender.addEventListener(viewReady);
}, 500);
}

function measureFrameRate() {
var frameRate = monitor.lastFramesPerSecond;
if (frameRate === undefined || frameRate !== frameRate) {
return;
}

++frameRateSamples;
sumFrameRate += frameRate;
minFrameRate = Math.min(minFrameRate, frameRate);
maxFrameRate = Math.max(maxFrameRate, frameRate);
}

function viewReady(scene, time) {
var globeReady = true;
var tilesetReady = true;
if (globe !== undefined) {
globeReady = globe._surface.tileProvider.ready && globe._surface._tileLoadQueueHigh.length === 0 && globe._surface._tileLoadQueueMedium.length === 0 && globe._surface._tileLoadQueueLow.length === 0 && globe._surface._debug.tilesWaitingForChildren === 0;
}
if (tileset !== undefined) {
tilesetReady = tileset.tilesLoaded;
}

if (flightComplete && globeReady && tilesetReady) {
var endTime = window.performance.now();
var duration = endTime - startTime;
var message = '';
if (isNaN(sumFrameRate / frameRateSamples)) {
// We should really just be computing a running average of FPS instead of "samples".
message = (duration / 1000).toFixed(2) + ' seconds ' + statistics.numberOfActiveRequestsEver + ' requests. Not enough time for FPS average';
if (doAlert) {
alert(message);
} else {
console.log(message);
}

} else {
message = (duration / 1000).toFixed(2) + ' seconds ' + statistics.numberOfActiveRequestsEver + ' requests, min/max/avg frame FPS ' + minFrameRate.toFixed(0) + '/' + maxFrameRate.toFixed(0) + '/' + (sumFrameRate / frameRateSamples).toFixed(0);
if (doAlert) {
alert(message);
} else {
console.log(message);
}

}

scene.postRender.removeEventListener(viewReady);
scene.preUpdate.removeEventListener(measureFrameRate);
}
}

Sandcastle.addToolbarButton('View NYC', function() {
// Start counting. This will automatically finish once the scene resolves.
startTest();
// Set the camera's positon
camera.position = new Cesium.Cartesian3(1333659.545421253, -4655803.231585404, 4137013.427090627);
camera.direction = new Cesium.Cartesian3(0.0016392394248821367, 0.8493471478486977, 0.5278321090416825);
camera.right = new Cesium.Cartesian3(0.9758518210834544, 0.11393464773820028, -0.18636555296748974);
camera.up = new Cesium.Cartesian3(0.2184274162787582, -0.5153914225965105, 0.8286501947937569);
flightComplete = true;

});

Sandcastle.addToolbarButton('Print flyto', function() {
var position = camera.position;
var direction = camera.direction;
var up = camera.up;

var cameraString = 'camera.flyTo({\n\
destination : new Cesium.Cartesian3(' + position.x + ', ' + position.y + ', ' + position.z + '),\n\
orientation : {\n\
direction : new Cesium.Cartesian3(' + direction.x + ', ' + direction.y + ', ' + direction.z + '),\n\
up : new Cesium.Cartesian3(' + up.x + ', ' + up.y + ', ' + up.z + '),\n\
},\n\
duration : 1,\n\
complete : function() {\n\
flightComplete = true;\n\
}\n\
});';
console.log(cameraString);
});

Sandcastle.addToolbarButton('Print view', function() {
var cameraString = 'camera.position = new Cesium.Cartesian3(' + camera.positionWC.x + ', ' + camera.positionWC.y + ', ' + camera.positionWC.z + ');\n'+
'camera.direction = new Cesium.Cartesian3(' + camera.directionWC.x + ', ' + camera.directionWC.y + ', ' + camera.directionWC.z + ');\n'+
'camera.right = new Cesium.Cartesian3(' + camera.rightWC.x + ', ' + camera.rightWC.y + ', ' + camera.rightWC.z + ');\n'+
'camera.up = new Cesium.Cartesian3(' + camera.upWC.x + ', ' + camera.upWC.y + ', ' + camera.upWC.z + ');\n' +
'flightComplete = true;\n';
console.log(cameraString);
});//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>
</html>
14 changes: 13 additions & 1 deletion Source/Core/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ define([

/**
* Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0].
* @param {Number} value SNORM value in the range [0, 255]
* @param {Number} value SNORM value in the range [0, rangeMax]
* @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default.
* @returns {Number} Scalar in the range [-1.0, 1.0].
*
Expand All @@ -252,6 +252,18 @@ define([
return CesiumMath.clamp(value, 0.0, rangeMax) / rangeMax * 2.0 - 1.0;
};

/**
* Converts a scalar value in the range [rangeMin, rangeMax] to a scalar in the range [0.0, 1.0]
* @param {Number} value The scalar value in the range [rangeMin, rangeMax]
* @param {Number} rangeMin The minimum value in the mapped range.
* @param {Number} rangeMax The maximum value in the mapped range.
* @returns {Number} A scalar value, where rangeMin maps to 0.0 and rangeMax maps to 1.0.
*/
CesiumMath.normalize = function(value, rangeMin, rangeMax) {
loshjawrence marked this conversation as resolved.
Show resolved Hide resolved
loshjawrence marked this conversation as resolved.
Show resolved Hide resolved
rangeMax = Math.max(rangeMax - rangeMin, 0);
return rangeMax === 0.0 ? 0.0 : CesiumMath.clamp((value - rangeMin) / rangeMax, 0.0, 1.0);
};

/**
* Returns the hyperbolic sine of a number.
* The hyperbolic sine of <em>value</em> is defined to be
Expand Down
46 changes: 24 additions & 22 deletions Source/Core/RequestScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ define([
numberOfCancelledRequests : 0,
numberOfCancelledActiveRequests : 0,
numberOfFailedRequests : 0,
numberOfActiveRequestsEver : 0
numberOfActiveRequestsEver : 0,
lastNumberOfActiveRequests : 0
};

var priorityHeapLength = 20;
Expand Down Expand Up @@ -373,34 +374,34 @@ define([
return issueRequest(request);
};

function clearStatistics() {
statistics.numberOfAttemptedRequests = 0;
statistics.numberOfCancelledRequests = 0;
statistics.numberOfCancelledActiveRequests = 0;
}

function updateStatistics() {
if (!RequestScheduler.debugShowStatistics) {
return;
}

if (statistics.numberOfAttemptedRequests > 0) {
console.log('Number of attempted requests: ' + statistics.numberOfAttemptedRequests);
}
if (statistics.numberOfActiveRequests > 0) {
console.log('Number of active requests: ' + statistics.numberOfActiveRequests);
}
if (statistics.numberOfCancelledRequests > 0) {
console.log('Number of cancelled requests: ' + statistics.numberOfCancelledRequests);
}
if (statistics.numberOfCancelledActiveRequests > 0) {
console.log('Number of cancelled active requests: ' + statistics.numberOfCancelledActiveRequests);
}
if (statistics.numberOfFailedRequests > 0) {
console.log('Number of failed requests: ' + statistics.numberOfFailedRequests);
if (statistics.numberOfActiveRequests === 0 && statistics.lastNumberOfActiveRequests > 0) {
if (statistics.numberOfAttemptedRequests > 0) {
console.log('Number of attempted requests: ' + statistics.numberOfAttemptedRequests);
statistics.numberOfAttemptedRequests = 0;
}

if (statistics.numberOfCancelledRequests > 0) {
console.log('Number of cancelled requests: ' + statistics.numberOfCancelledRequests);
statistics.numberOfCancelledRequests = 0;
}

if (statistics.numberOfCancelledActiveRequests > 0) {
console.log('Number of cancelled active requests: ' + statistics.numberOfCancelledActiveRequests);
statistics.numberOfCancelledActiveRequests = 0;
}

if (statistics.numberOfFailedRequests > 0) {
console.log('Number of failed requests: ' + statistics.numberOfFailedRequests);
statistics.numberOfFailedRequests = 0;
}
}

clearStatistics();
statistics.lastNumberOfActiveRequests = statistics.numberOfActiveRequests;
}

/**
Expand All @@ -427,6 +428,7 @@ define([
statistics.numberOfCancelledActiveRequests = 0;
statistics.numberOfFailedRequests = 0;
statistics.numberOfActiveRequestsEver = 0;
statistics.lastNumberOfActiveRequests = 0;
};

/**
Expand Down
Loading