diff --git a/.gitignore b/.gitignore index c4ef272a1e2c..240b38f501bf 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ Thumbs.db /Apps/Sandcastle/templates/bucket.css /Source/Cesium.js +/Source/Cesium.d.ts /Specs/SpecList.js /Source/Shaders/**/*.js diff --git a/.prettierignore b/.prettierignore index 92c8679798e7..c4fbdbbe4e0c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -13,9 +13,11 @@ !Tools/**/ !**/*.js +!**/*.cjs !**/*.css !**/*.html !**/*.md +!**/*.ts # Re-ignore a few things caught above **/*.min.js diff --git a/.travis.yml b/.travis.yml index 2460cac0b634..0011687bc9b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ script: - npm --silent run prettier-check - npm --silent run build + - npm --silent run build-ts - npm --silent run coverage -- --browsers FirefoxHeadless --webgl-stub --failTaskOnError --suppressPassed - travis_wait 20 npm --silent run makeZipFile -- --concurrency 1 diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 4befb021f0ca..000000000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "0.1.0", - "command": "gulp", - "isShellCommand": true, - "args": [ - "--no-color" - ], - "tasks": [ - { - "taskName": "build", - "args": [], - "isBuildCommand": true, - "isBackground": false, - "problemMatcher": [ - "$lessCompile", - "$tsc", - "$jshint" - ] - }, - { - "taskName": "test", - "args": [], - "isTestCommand": true - }, - { - "taskName": "build-watch", - "isBackground": true - } - ] -} diff --git a/Apps/SampleData/models/CesiumMilkTruck/CesiumMilkTruck.dae b/Apps/SampleData/models/CesiumMilkTruck/CesiumMilkTruck.dae new file mode 100644 index 000000000000..0d6676bc12c3 --- /dev/null +++ b/Apps/SampleData/models/CesiumMilkTruck/CesiumMilkTruck.dae @@ -0,0 +1,412 @@ + + + + + modo 901 [Build 79473], Microsoft Windows 7 Service Pack 1 (6.1.7601 Service Pack 1) + Plug-in: [Build 79473]; Use Absolute Path: No; Merge Reference Items: No; Save Hidden Items: No; Save Cameras: No; Save Lights: Yes; Save Locators: Yes; Save Triangles as Triangles: Yes; Order Vertex Maps Alphabetically: Yes; Bake Matrices: No; Save Vertex Normals: Yes; Save UV Texture Coordinates: Yes; Save Vertex Colors: No; Save Vertex Weights: No; Save Animation: Yes; Sample Animation: No; Sample Animation Start: 0; Sample Animation End: 120; Save modo Profile: No; Save Maya Profile: No; Save 3ds Max Profile: No; Formatted Arrays: No; + file:///C:/Users/bcoker/Creative%20Cloud%20Files/Cesium%20Milk%20Truck/Cesium%20Milk%20Truck.lxo + + 2015-02-09T13:13:10Z + 2015-02-09T13:13:10Z + Y_UP + + + + + 0 0.0416667 0.0833333 0.125 0.166667 0.208333 0.25 0.291667 0.333333 0.375 0.416667 0.458333 0.5 0.541667 0.583333 0.625 0.666667 0.708333 0.75 0.791667 0.833333 0.875 0.916667 0.958333 1 1.04167 1.08333 1.125 1.16667 1.20833 1.25 + + + + + + + + 349.847 338.186 326.524 314.863 303.201 291.539 279.878 268.216 256.555 244.893 233.232 221.57 209.908 198.247 186.585 174.924 163.262 151.6 139.939 128.277 116.616 104.954 93.2926 81.631 69.9695 58.3079 46.6463 34.9847 23.3232 11.6616 0 + + + + + + + + -0.0138889 349.847 0.0277778 342.073 0.0694444 330.411 0.111111 318.75 0.152778 307.088 0.194444 295.427 0.236111 283.765 0.277778 272.103 0.319444 260.442 0.361111 248.78 0.402778 237.119 0.444444 225.457 0.486111 213.796 0.527778 202.134 0.569444 190.472 0.611111 178.811 0.652778 167.149 0.694444 155.488 0.736111 143.826 0.777778 132.165 0.819444 120.503 0.861111 108.841 0.902778 97.1798 0.944444 85.5182 0.986111 73.8566 1.02778 62.1951 1.06944 50.5335 1.11111 38.8719 1.15278 27.2103 1.19444 15.5488 1.23611 0 + + + + + + + + + 0.0138889 349.847 0.0555556 334.298 0.0972222 322.637 0.138889 310.975 0.180556 299.314 0.222222 287.652 0.263889 275.991 0.305556 264.329 0.347222 252.667 0.388889 241.006 0.430556 229.344 0.472222 217.683 0.513889 206.021 0.555556 194.36 0.597222 182.698 0.638889 171.036 0.680556 159.375 0.722222 147.713 0.763889 136.052 0.805556 124.39 0.847222 112.729 0.888889 101.067 0.930556 89.4054 0.972222 77.7438 1.01389 66.0823 1.05556 54.4207 1.09722 42.7591 1.13889 31.0975 1.18056 19.436 1.22222 7.77438 1.26389 0 + + + + + + + + + BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER + + + + + + + + + + + + + + + + + + 0 0.0416667 0.0833333 0.125 0.166667 0.208333 0.25 0.291667 0.333333 0.375 0.416667 0.458333 0.5 0.541667 0.583333 0.625 0.666667 0.708333 0.75 0.791667 0.833333 0.875 0.916667 0.958333 1 1.04167 1.08333 1.125 1.16667 1.20833 1.25 + + + + + + + + 349.847 338.186 326.524 314.863 303.201 291.539 279.878 268.216 256.555 244.893 233.232 221.57 209.908 198.247 186.585 174.924 163.262 151.6 139.939 128.277 116.616 104.954 93.2926 81.631 69.9695 58.3079 46.6463 34.9847 23.3232 11.6616 0 + + + + + + + + -0.0138889 349.847 0.0277778 342.073 0.0694444 330.411 0.111111 318.75 0.152778 307.088 0.194444 295.427 0.236111 283.765 0.277778 272.103 0.319444 260.442 0.361111 248.78 0.402778 237.119 0.444444 225.457 0.486111 213.796 0.527778 202.134 0.569444 190.472 0.611111 178.811 0.652778 167.149 0.694444 155.488 0.736111 143.826 0.777778 132.165 0.819444 120.503 0.861111 108.841 0.902778 97.1798 0.944444 85.5182 0.986111 73.8566 1.02778 62.1951 1.06944 50.5335 1.11111 38.8719 1.15278 27.2103 1.19444 15.5488 1.23611 0 + + + + + + + + + 0.0138889 349.847 0.0555556 334.298 0.0972222 322.637 0.138889 310.975 0.180556 299.314 0.222222 287.652 0.263889 275.991 0.305556 264.329 0.347222 252.667 0.388889 241.006 0.430556 229.344 0.472222 217.683 0.513889 206.021 0.555556 194.36 0.597222 182.698 0.638889 171.036 0.680556 159.375 0.722222 147.713 0.763889 136.052 0.805556 124.39 0.847222 112.729 0.888889 101.067 0.930556 89.4054 0.972222 77.7438 1.01389 66.0823 1.05556 54.4207 1.09722 42.7591 1.13889 31.0975 1.18056 19.436 1.22222 7.77438 1.26389 0 + + + + + + + + + BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER + + + + + + + + + + + + + + + + + + + CesiumMilkTruck.jpg + + + + + + + + + + + + + + + + + + + + + + + 0 0.0405063 0.0212407 1 + + + 0.65 0.65 0.65 1 + + + 256 + + + + + + + + + + Image0001 + A8R8G8B8 + + + + + Image0001-surface + LINEAR_MIPMAP_LINEAR + LINEAR + + + + + + + + + 0.04 0.04 0.04 1 + + + 256 + + + + + + + + + + Image0001 + A8R8G8B8 + + + + + Image0001-surface + LINEAR_MIPMAP_LINEAR + LINEAR + + + + + + + + + 0.04 0.04 0.04 1 + + + 256 + + + + + + + + + + + 0.064 0.064 0.064 1 + + + 0.04 0.04 0.04 1 + + + 256 + + + + + + + + + + + 1.95888 0.414 1.09 1.95888 0.414 -1.1 0.857956 0.414 1.09 0.857956 0.414 -1.1 1.56425 0.964964 -1.1 1.42614 0.9844 -1.1 1.69294 0.907981 -1.1 1.80345 0.817334 -1.1 1.88825 0.6992 -1.1 1.94156 0.56163 -1.1 1.0562 0.822 -1.1 1.15996 0.911218 -1.1 1.28804 0.964964 -1.1 1.56425 0.964964 1.09 1.42614 0.9844 1.09 1.69294 0.907981 1.09 1.80345 0.817334 1.09 1.88825 0.6992 1.09 1.94156 0.56163 1.09 1.0562 0.822 1.09 1.15996 0.911218 1.09 1.28804 0.964964 1.09 -0.850175 0.414 -1.1 -0.850175 0.414 1.09 -1.85152 0.414 1.09 -1.85152 0.414 -1.1 -1.17947 0.8556 -1.1 -1.51855 0.8556 -1.1 -1.01076 0.69 -1.1 -1.0236 0.753372 -1.1 -1.06017 0.807097 -1.1 -1.11491 0.842994 -1.1 -1.70125 0.69 -1.1 -1.58847 0.842994 -1.1 -1.64774 0.807097 -1.1 -1.68734 0.753372 -1.1 -1.17947 0.8556 1.09 -1.51855 0.8556 1.09 -1.01076 0.69 1.09 -1.0236 0.753372 1.09 -1.06017 0.807097 1.09 -1.11491 0.842994 1.09 -1.70125 0.69 1.09 -1.58847 0.842994 1.09 -1.64774 0.807097 1.09 -1.68734 0.753372 1.09 1.0028 1.6192 -1.1 1.0028 2.34048 -1.1 0.138 1.6192 -1.1 0.138 2.34048 -1.1 0.19872 2.4012 -1.1 0.94208 2.4012 -1.1 0.965317 2.39658 -1.1 0.985016 2.38342 -1.1 0.998178 2.36372 -1.1 0.175483 2.39658 -1.1 0.155784 2.38342 -1.1 0.142622 2.36372 -1.1 1.0028 1.6192 1.09 1.0028 2.34048 1.09 0.138 1.6192 1.09 0.138 2.34048 1.09 0.19872 2.4012 1.09 0.94208 2.4012 1.09 0.965317 2.39658 1.09 0.985016 2.38342 1.09 0.998178 2.36372 1.09 0.175483 2.39658 1.09 0.155784 2.38342 1.09 0.142622 2.36372 1.09 0.138 1.2696 -1.1 0.138 1.2696 1.09 0.7912 0.4784 -1.1 1.0028 0.8924 -1.1 0.138 0.4784 -1.1 0.7912 0.4784 1.09 1.0028 0.8924 1.09 0.138 0.4784 1.09 0.138 0.4784 1.055 1.0028 0.8924 1.055 0.7912 0.4784 1.055 0.19872 2.4012 1.055 0.138 2.34048 1.055 1.0028 2.34048 1.055 0.94208 2.4012 1.055 0.142622 2.36372 1.055 0.155784 2.38342 1.055 0.175483 2.39658 1.055 0.998178 2.36372 1.055 0.985015 2.38342 1.055 0.965316 2.39658 1.055 0.9062 1.68268 -1.055 0.9062 2.22272 -1.055 0.81972 2.3092 -1.055 0.27968 2.3092 -1.055 0.1932 2.22272 -1.055 0.1932 1.68268 -1.055 0.27968 1.5962 -1.055 0.81972 1.5962 -1.055 0.9062 1.68268 1.055 0.9062 2.22272 1.055 0.81972 2.3092 1.055 0.27968 2.3092 1.055 0.1932 2.22272 1.055 0.1932 1.68268 1.055 0.27968 1.5962 1.055 0.81972 1.5962 1.055 0.87055 1.70968 -1.055 0.87055 2.19572 -1.055 0.792718 2.27355 -1.055 0.306682 2.27355 -1.055 0.22885 2.19572 -1.055 0.22885 1.70968 -1.055 0.306682 1.63185 -1.055 0.792718 1.63185 -1.055 0.87055 1.70968 1.055 0.87055 2.19572 1.055 0.792718 2.27355 1.055 0.306682 2.27355 1.055 0.22885 2.19572 1.055 0.22885 1.70968 1.055 0.306682 1.63185 1.055 0.792718 1.63185 1.055 0.9062 1.68268 -1.065 0.9062 2.22272 -1.065 0.81972 2.3092 -1.065 0.27968 2.3092 -1.065 0.1932 2.22272 -1.065 0.1932 1.68268 -1.065 0.27968 1.5962 -1.065 0.81972 1.5962 -1.065 0.9062 1.68268 1.065 0.9062 2.22272 1.065 0.81972 2.3092 1.065 0.27968 2.3092 1.065 0.1932 2.22272 1.065 0.1932 1.68268 1.065 0.27968 1.5962 1.065 0.81972 1.5962 1.065 0.87055 1.70968 -1.065 0.87055 2.19572 -1.065 0.792718 2.27355 -1.065 0.306682 2.27355 -1.065 0.22885 2.19572 -1.065 0.22885 1.70968 -1.065 0.306682 1.63185 -1.065 0.792718 1.63185 -1.065 0.87055 1.70968 1.065 0.87055 2.19572 1.065 0.792718 2.27355 1.065 0.306682 2.27355 1.065 0.22885 2.19572 1.065 0.22885 1.70968 1.065 0.306682 1.63185 1.065 0.792718 1.63185 1.065 1.0442 1.6767 -1.1 1.0442 2.3483 -1.1 1.0879 2.392 -1.1 1.2489 2.392 -1.1 1.30664 2.35062 -1.1 1.53021 1.6919 -1.1 1.46502 1.633 -1.1 1.0879 1.633 -1.1 1.0442 1.6767 1.09 1.0442 2.3483 1.09 1.0879 2.392 1.09 1.2489 2.392 1.09 1.30664 2.35062 1.09 1.53021 1.6919 1.09 1.46502 1.633 1.09 1.0879 1.633 1.09 1.08229 1.69248 -1.1 1.08229 2.33252 -1.1 1.10368 2.35391 -1.1 1.23666 2.35391 -1.1 1.27451 2.32679 -1.1 1.48609 1.70338 -1.1 1.45036 1.67109 -1.1 1.10368 1.67109 -1.1 1.08229 1.69248 1.09 1.08229 2.33252 1.09 1.10368 2.35391 1.09 1.23666 2.35391 1.09 1.27451 2.32679 1.09 1.48609 1.70338 1.09 1.45036 1.67109 1.09 1.10368 1.67109 1.09 1.0442 1.6767 -1.11 1.0442 2.3483 -1.11 1.0879 2.392 -1.11 1.2489 2.392 -1.11 1.30664 2.35062 -1.11 1.53021 1.6919 -1.11 1.46502 1.633 -1.11 1.0879 1.633 -1.11 1.0442 1.6767 1.1 1.0442 2.3483 1.1 1.0879 2.392 1.1 1.2489 2.392 1.1 1.30664 2.35062 1.1 1.53021 1.6919 1.1 1.46502 1.633 1.1 1.0879 1.633 1.1 1.08229 1.69248 -1.11 1.08229 2.33252 -1.11 1.10368 2.35391 -1.11 1.23666 2.35391 -1.11 1.27451 2.32679 -1.11 1.48609 1.70338 -1.11 1.45036 1.67109 -1.11 1.10368 1.67109 -1.11 1.08229 1.69248 1.1 1.08229 2.33252 1.1 1.10368 2.35391 1.1 1.23666 2.35391 1.1 1.27451 2.32679 1.1 1.48609 1.70338 1.1 1.45036 1.67109 1.1 1.10368 1.67109 1.1 1.0028 1.242 -1.1 1.0028 1.2972 -1.1 1.0028 1.2972 1.09 1.0028 1.242 1.09 1.0028 1.2696 -1.1 1.0028 1.2696 1.09 2.29264 0.414 -1.062 -2.28344 0.414 -1.062 2.29264 0.414 1.052 -2.28344 0.414 1.052 1.95888 0.414 1.052 1.95888 0.414 -1.062 0.857956 0.414 1.052 0.857956 0.414 -1.062 1.56425 0.964964 -1.062 1.42614 0.9844 -1.062 1.69294 0.907981 -1.062 1.80345 0.817334 -1.062 1.88825 0.6992 -1.062 1.94156 0.56163 -1.062 1.0562 0.822 -1.062 1.15996 0.911218 -1.062 1.28804 0.964964 -1.062 1.56425 0.964964 1.052 1.42614 0.9844 1.052 1.69294 0.907981 1.052 1.80345 0.817334 1.052 1.88825 0.6992 1.052 1.94156 0.56163 1.052 1.0562 0.822 1.052 1.15996 0.911218 1.052 1.28804 0.964964 1.052 -0.850175 0.414 -1.062 -0.850175 0.414 1.052 -1.85152 0.414 1.052 -1.85152 0.414 -1.062 -1.17947 0.8556 -1.062 -1.51855 0.8556 -1.062 -1.01076 0.69 -1.062 -1.0236 0.753372 -1.062 -1.06017 0.807097 -1.062 -1.11491 0.842994 -1.062 -1.70125 0.69 -1.062 -1.58847 0.842994 -1.062 -1.64774 0.807097 -1.062 -1.68734 0.753372 -1.062 -1.17947 0.8556 1.052 -1.51855 0.8556 1.052 -1.01076 0.69 1.052 -1.0236 0.753372 1.052 -1.06017 0.807097 1.052 -1.11491 0.842994 1.052 -1.70125 0.69 1.052 -1.58847 0.842994 1.052 -1.64774 0.807097 1.052 -1.68734 0.753372 1.052 2.25032 0.4692 -0.55094 -2.24112 0.4692 -0.55094 2.25032 0.4692 0.54094 -2.24112 0.4692 0.54094 1.99191 0.4692 0.54094 1.99191 0.4692 -0.55094 0.824928 0.4692 0.54094 0.824928 0.4692 -0.55094 1.5736 1.02016 -0.55094 1.42721 1.0396 -0.55094 1.71001 0.963181 -0.55094 1.82716 0.872534 -0.55094 1.91704 0.7544 -0.55094 1.97355 0.61683 -0.55094 1.03507 0.8772 -0.55094 1.14505 0.966418 -0.55094 1.28081 1.02016 -0.55094 1.5736 1.02016 0.54094 1.42721 1.0396 0.54094 1.71001 0.963181 0.54094 1.82716 0.872534 0.54094 1.91704 0.7544 0.54094 1.97355 0.61683 0.54094 1.03507 0.8772 0.54094 1.14505 0.966418 0.54094 1.28081 1.02016 0.54094 -0.830148 0.4692 -0.55094 -0.830148 0.4692 0.54094 -1.87155 0.4692 0.54094 -1.87155 0.4692 -0.55094 -1.17262 0.9108 -0.55094 -1.52526 0.9108 -0.55094 -0.997156 0.7452 -0.55094 -1.01051 0.808572 -0.55094 -1.04855 0.862297 -0.55094 -1.10547 0.898194 -0.55094 -1.71527 0.7452 -0.55094 -1.59797 0.898194 -0.55094 -1.65961 0.862297 -0.55094 -1.7008 0.808572 -0.55094 -1.17262 0.9108 0.54094 -1.52526 0.9108 0.54094 -0.997156 0.7452 0.54094 -1.01051 0.808572 0.54094 -1.04855 0.862297 0.54094 -1.10547 0.898194 0.54094 -1.71527 0.7452 0.54094 -1.59797 0.898194 0.54094 -1.65961 0.862297 0.54094 -1.7008 0.808572 0.54094 2.29264 0.4692 -1.062 -2.28344 0.4692 -1.062 2.29264 0.4692 1.052 -2.28344 0.4692 1.052 1.99191 0.4692 1.052 1.99191 0.4692 -1.062 0.824928 0.4692 1.052 0.824928 0.4692 -1.062 1.5736 1.02016 -1.062 1.42721 1.0396 -1.062 1.71001 0.963181 -1.062 1.82716 0.872534 -1.062 1.91704 0.7544 -1.062 1.97355 0.61683 -1.062 1.03507 0.8772 -1.062 1.14505 0.966418 -1.062 1.28081 1.02016 -1.062 1.5736 1.02016 1.052 1.42721 1.0396 1.052 1.71001 0.963181 1.052 1.82716 0.872534 1.052 1.91704 0.7544 1.052 1.97355 0.61683 1.052 1.03507 0.8772 1.052 1.14505 0.966418 1.052 1.28081 1.02016 1.052 -0.830148 0.4692 -1.062 -0.830148 0.4692 1.052 -1.87155 0.4692 1.052 -1.87155 0.4692 -1.062 -1.17262 0.9108 -1.062 -1.52526 0.9108 -1.062 -0.997156 0.7452 -1.062 -1.01051 0.808572 -1.062 -1.04855 0.862297 -1.062 -1.10547 0.898194 -1.062 -1.71527 0.7452 -1.062 -1.59797 0.898194 -1.062 -1.65961 0.862297 -1.062 -1.7008 0.808572 -1.062 -1.17262 0.9108 1.052 -1.52526 0.9108 1.052 -0.997156 0.7452 1.052 -1.01051 0.808572 1.052 -1.04855 0.862297 1.052 -1.10547 0.898194 1.052 -1.71527 0.7452 1.052 -1.59797 0.898194 1.052 -1.65961 0.862297 1.052 -1.7008 0.808572 1.052 -2.18289 0.38864 -1.12699 -2.20303 0.3634 -1.1054 -2.43091 0.38864 -1.12699 -2.41077 0.3634 -1.1054 -2.43091 0.49916 -1.12699 -2.41077 0.5244 -1.1054 -2.18289 0.49916 -1.12699 -2.20303 0.5244 -1.1054 -2.18289 0.38864 1.12699 -2.20303 0.3634 1.1054 -2.43091 0.38864 1.12699 -2.41077 0.3634 1.1054 -2.43091 0.49916 1.12699 -2.41077 0.5244 1.1054 -2.18289 0.49916 1.12699 -2.20303 0.5244 1.1054 -2.42748 0.516542 1.12347 -2.42748 0.516542 -1.12347 -2.42748 0.371258 1.12347 -2.42748 0.371258 -1.12347 -2.18632 0.516542 -1.12347 -2.18632 0.371258 -1.12347 -2.18632 0.371258 1.12347 -2.18632 0.516542 1.12347 -2.18944 0.475849 -1.1196 -2.19088 0.465213 -1.11797 -2.42292 0.465213 -1.11797 -2.42436 0.475849 -1.1196 -2.19088 0.422587 -1.11797 -2.18944 0.41195 -1.1196 -2.42436 0.41195 -1.1196 -2.42292 0.422587 -1.11797 -2.42292 0.465213 1.11797 -2.42436 0.475849 1.1196 -2.42436 0.41195 1.1196 -2.42292 0.422587 1.11797 -2.18944 0.475849 1.1196 -2.19088 0.465213 1.11797 -2.19088 0.422587 1.11797 -2.18944 0.41195 1.1196 -2.42329 0.417169 -1.11838 -2.42329 0.417169 1.11838 -2.19051 0.470631 -1.11838 -2.42329 0.470631 -1.11838 -2.19051 0.417169 -1.11838 -2.19051 0.417169 1.11838 -2.42329 0.470631 1.11838 -2.19051 0.470631 1.11838 2.20202 0.3864 -1.1115 2.18408 0.40434 -1.1115 2.20202 0.40434 -1.131 2.20202 0.66838 -1.131 2.18408 0.66838 -1.1115 2.20202 0.68632 -1.1115 2.42006 0.66838 -1.131 2.42006 0.68632 -1.1115 2.438 0.66838 -1.1115 2.40833 0.494263 -1.131 2.42006 0.52578 -1.131 2.438 0.52578 -1.1115 2.42627 0.494263 -1.1115 2.32565 0.402713 -1.131 2.34485 0.399977 -1.1115 2.31518 0.3864 -1.1115 2.20202 0.40434 1.131 2.18408 0.40434 1.1115 2.20202 0.3864 1.1115 2.18408 0.66838 1.1115 2.20202 0.66838 1.131 2.20202 0.68632 1.1115 2.42006 0.68632 1.1115 2.42006 0.66838 1.131 2.438 0.66838 1.1115 2.438 0.52578 1.1115 2.42006 0.52578 1.131 2.40833 0.494263 1.131 2.42627 0.494263 1.1115 2.34485 0.399977 1.1115 2.32565 0.402713 1.131 2.31518 0.3864 1.1115 2.18408 0.52578 -1.1115 2.20202 0.52578 -1.131 2.20202 0.4899 -1.131 2.18408 0.4899 -1.1115 2.18408 0.4899 1.1115 2.20202 0.4899 1.131 2.20202 0.52578 1.131 2.18408 0.52578 1.1115 2.42006 0.681065 -1.12529 2.20202 0.681065 -1.12529 2.41703 0.508966 1.131 2.20202 0.50784 1.131 2.43275 0.52578 -1.12529 2.43275 0.66838 -1.12529 2.18933 0.66838 1.12529 2.18933 0.52578 1.12529 2.18933 0.4899 1.12529 2.18933 0.40434 1.12529 2.18408 0.50784 1.1115 2.18408 0.50784 -1.1115 2.18933 0.681065 -1.1115 2.18933 0.681065 1.1115 2.18933 0.391655 1.1115 2.18933 0.391655 -1.1115 2.43497 0.508966 1.1115 2.43497 0.508966 -1.1115 2.43275 0.681065 1.1115 2.43275 0.681065 -1.1115 2.18933 0.4899 -1.12529 2.18933 0.40434 -1.12529 2.20202 0.391655 -1.12529 2.31799 0.391744 -1.12529 2.42102 0.494263 1.12529 2.33897 0.401345 1.12529 2.18933 0.66838 -1.12529 2.18933 0.52578 -1.12529 2.43275 0.66838 1.12529 2.43275 0.52578 1.12529 2.20202 0.50784 -1.131 2.41703 0.508966 -1.131 2.33897 0.401345 -1.12529 2.42102 0.494263 -1.12529 2.31799 0.391744 1.12529 2.20202 0.391655 1.12529 2.20202 0.681065 1.12529 2.42006 0.681065 1.12529 2.33149 0.389956 1.1115 2.33149 0.389956 -1.1115 2.19109 0.393406 -1.12338 2.19109 0.679314 -1.12338 2.43099 0.679314 -1.12338 2.42972 0.508966 -1.12529 2.33066 0.391774 -1.12382 2.19109 0.393406 1.12338 2.19109 0.679314 1.12338 2.43099 0.679314 1.12338 2.42972 0.508966 1.12529 2.33066 0.391774 1.12382 2.18933 0.50784 -1.12529 2.18933 0.50784 1.12529 2.3276 1.1914 0.92 2.3276 1.1914 0.645 2.3276 0.7682 0.645 2.3276 0.7682 0.92 2.3276 0.7682 -0.645 2.3276 1.1914 -0.645 2.3276 1.1914 -0.92 2.3276 0.7682 -0.92 2.3276 0.7406 0.505 2.3276 0.897 0.505 2.3276 0.897 -0.505 2.3276 0.7406 -0.505 2.3276 0.9936 0.505 2.3276 1.15 0.505 2.3276 1.15 -0.505 2.3276 0.9936 -0.505 2.27884 0.7406 0.505 2.27884 0.897 0.505 2.27884 0.897 -0.505 2.27884 0.7406 -0.505 2.27884 0.9936 0.505 2.27884 1.15 0.505 2.27884 1.15 -0.505 2.27884 0.9936 -0.505 2.31564 1.1914 0.92 2.31564 1.1914 0.645 2.31564 0.7682 0.645 2.31564 0.7682 0.92 2.31564 0.7682 -0.645 2.31564 1.1914 -0.645 2.31564 1.1914 -0.92 2.31564 0.7682 -0.92 1.3271 0.3358 -0.8625 1.3271 0.4646 -0.8625 1.3271 0.4646 0.8625 1.3271 0.3358 0.8625 1.5341 0.3358 -0.8625 1.5341 0.3358 0.8625 1.5341 0.4646 0.8625 1.5341 0.4646 -0.8625 1.36074 0.2668 -0.8625 1.36074 0.2668 0.8625 1.50046 0.2668 -0.8625 1.50046 0.2668 0.8625 1.3271 0.4646 -0.408501 1.3271 0.4646 -0.166501 1.5341 0.4646 -0.166501 1.5341 0.4646 -0.408501 1.3271 0.4646 0.166501 1.3271 0.4646 0.408501 1.5341 0.4646 0.408501 1.5341 0.4646 0.166501 1.3271 0.3358 -0.408501 1.3271 0.3358 -0.166501 1.3271 0.3358 0.166501 1.3271 0.3358 0.408501 1.5341 0.3358 -0.166501 1.5341 0.3358 -0.408501 1.5341 0.3358 0.408501 1.5341 0.3358 0.166501 1.50046 0.2668 -0.166501 1.50046 0.2668 -0.408501 1.50046 0.2668 0.408501 1.50046 0.2668 0.166501 1.36074 0.2668 -0.408501 1.36074 0.2668 -0.166501 1.36074 0.2668 0.166501 1.36074 0.2668 0.408501 1.3271 0.375469 0.253456 1.3271 0.375469 0.321545 1.3271 0.504269 0.253456 1.3271 0.504269 0.321545 1.5341 0.504269 -0.321545 1.5341 0.504269 -0.253456 1.5341 0.375469 -0.321545 1.5341 0.375469 -0.253456 1.50046 0.306469 0.253456 1.50046 0.306469 0.321545 1.36074 0.306469 0.253456 1.36074 0.306469 0.321545 1.5341 0.504269 0.253456 1.5341 0.504269 0.321545 1.5341 0.375469 0.253456 1.5341 0.375469 0.321545 1.3271 0.504269 -0.321545 1.3271 0.504269 -0.253456 1.50046 0.306469 -0.321545 1.50046 0.306469 -0.253456 1.36074 0.306469 -0.321545 1.36074 0.306469 -0.253456 1.3271 0.375469 -0.321545 1.3271 0.375469 -0.253456 1.3271 0.382808 0.287501 1.36074 0.313808 0.287501 1.50046 0.313808 0.287501 1.5341 0.382808 0.287501 1.3271 0.382808 -0.287501 1.36074 0.313808 -0.287501 1.50046 0.313808 -0.287501 1.3271 0.511608 -0.287501 1.5341 0.382808 -0.287501 1.5341 0.511608 -0.287501 1.3271 0.511608 0.287501 1.5341 0.511608 0.287501 -1.4559 0.3358 -0.8625 -1.4559 0.4646 -0.8625 -1.4559 0.4646 0.8625 -1.4559 0.3358 0.8625 -1.2489 0.3358 -0.8625 -1.2489 0.3358 0.8625 -1.2489 0.4646 0.8625 -1.2489 0.4646 -0.8625 -1.42226 0.2668 -0.8625 -1.42226 0.2668 0.8625 -1.28254 0.2668 -0.8625 -1.28254 0.2668 0.8625 -1.4559 0.4646 -0.4085 -1.4559 0.4646 -0.1665 -1.2489 0.4646 -0.1665 -1.2489 0.4646 -0.4085 -1.4559 0.4646 0.166501 -1.4559 0.4646 0.408501 -1.2489 0.4646 0.408501 -1.2489 0.4646 0.166501 -1.4559 0.3358 -0.4085 -1.4559 0.3358 -0.1665 -1.4559 0.3358 0.166501 -1.4559 0.3358 0.408501 -1.2489 0.3358 -0.1665 -1.2489 0.3358 -0.4085 -1.2489 0.3358 0.408501 -1.2489 0.3358 0.166501 -1.28254 0.2668 -0.1665 -1.28254 0.2668 -0.4085 -1.28254 0.2668 0.408501 -1.28254 0.2668 0.166501 -1.42226 0.2668 -0.4085 -1.42226 0.2668 -0.1665 -1.42226 0.2668 0.166501 -1.42226 0.2668 0.408501 -1.4559 0.375469 0.253456 -1.4559 0.375469 0.321545 -1.4559 0.504269 0.253456 -1.4559 0.504269 0.321545 -1.2489 0.504269 -0.321545 -1.2489 0.504269 -0.253456 -1.2489 0.375469 -0.321545 -1.2489 0.375469 -0.253456 -1.28254 0.306469 0.253456 -1.28254 0.306469 0.321545 -1.42226 0.306469 0.253456 -1.42226 0.306469 0.321545 -1.2489 0.504269 0.253456 -1.2489 0.504269 0.321545 -1.2489 0.375469 0.253456 -1.2489 0.375469 0.321545 -1.4559 0.504269 -0.321545 -1.4559 0.504269 -0.253456 -1.28254 0.306469 -0.321545 -1.28254 0.306469 -0.253456 -1.42226 0.306469 -0.321545 -1.42226 0.306469 -0.253456 -1.4559 0.375469 -0.321545 -1.4559 0.375469 -0.253456 -1.4559 0.382808 0.287501 -1.42226 0.313808 0.287501 -1.28254 0.313808 0.287501 -1.2489 0.382808 0.287501 -1.4559 0.382808 -0.287501 -1.42226 0.313808 -0.287501 -1.28254 0.313808 -0.287501 -1.4559 0.511608 -0.287501 -1.2489 0.382808 -0.287501 -1.2489 0.511608 -0.287501 -1.4559 0.511608 0.287501 -1.2489 0.511608 0.287501 -2.3184 2.4104 -0.6075 -2.3184 2.4104 0.6075 -2.3184 1.6192 0.6075 -2.3184 1.6192 -0.6075 -2.3184 1.2696 0.6075 -2.3184 1.2696 -0.6075 -2.2954 2.4104 -0.6075 -2.2954 2.4104 0.6075 -2.2954 1.6192 0.6075 -2.2954 1.6192 -0.6075 -2.2954 1.2696 0.6075 -2.2954 1.2696 -0.6075 -2.2954 0.7176 0.6075 -2.2954 0.7176 -0.6075 -2.3184 0.5244 -0.6075 -2.3184 0.5244 0.6075 -2.34692 0.5244 -0.6075 -2.34692 0.7176 -0.6075 -2.34692 0.7176 0.6075 -2.34692 0.5244 0.6075 -2.3184 0.7176 -0.3146 -2.3184 0.5244 -0.3146 -2.3184 0.7176 0.3146 -2.3184 0.5244 0.3146 -2.34692 0.7176 -0.3146 -2.34692 0.7176 0.3146 -2.34692 0.5244 -0.3146 -2.34692 0.5244 0.3146 -2.33266 0.5244 -0.6075 -2.33266 0.7176 -0.6075 -2.33266 0.7176 0.6075 -2.33266 0.5244 0.6075 -2.33266 0.7176 -0.3146 -2.33266 0.7176 0.3146 -2.33266 0.5244 -0.3146 -2.33266 0.5244 0.3146 0.138 1.6192 1.055 0.138 1.2696 1.055 1.0028 1.6192 1.055 1.0028 1.2972 1.055 1.0028 1.2696 1.055 1.0028 1.242 1.055 0.138 0.4784 -1.055 1.0028 0.8924 -1.055 0.7912 0.4784 -1.055 0.19872 2.4012 -1.055 0.138 2.34048 -1.055 1.0028 2.34048 -1.055 0.94208 2.4012 -1.055 0.142622 2.36372 -1.055 0.155784 2.38342 -1.055 0.175483 2.39658 -1.055 0.998178 2.36372 -1.055 0.985015 2.38342 -1.055 0.965316 2.39658 -1.055 0.138 1.6192 -1.055 0.138 1.2696 -1.055 1.0028 1.6192 -1.055 1.0028 1.2972 -1.055 1.0028 1.2696 -1.055 1.0028 1.242 -1.055 1.5226 1.633 -1.217 1.5226 1.65232 -1.196 1.5226 1.88048 -1.196 1.5226 1.8998 -1.217 1.5226 1.8998 -1.375 1.5226 1.88048 -1.396 1.5226 1.65232 -1.396 1.5226 1.633 -1.375 1.5226 1.63866 -1.38985 1.5226 1.63866 -1.20215 1.5226 1.89414 -1.38985 1.5226 1.89414 -1.20215 1.56725 1.7664 -1.296 1.54249 1.64056 -1.22148 1.53226 1.633 -1.217 1.53226 1.65232 -1.196 1.54254 1.65902 -1.20187 1.54254 1.87378 -1.20187 1.53226 1.88048 -1.196 1.53226 1.8998 -1.217 1.54249 1.89224 -1.22148 1.54249 1.89224 -1.37052 1.53226 1.8998 -1.375 1.53226 1.88048 -1.396 1.54254 1.87378 -1.39013 1.53226 1.633 -1.375 1.54249 1.64056 -1.37052 1.54254 1.65902 -1.39013 1.53226 1.65232 -1.396 1.53226 1.63866 -1.38985 1.54247 1.6458 -1.3846 1.54247 1.6458 -1.2074 1.53226 1.63866 -1.20215 1.53226 1.89414 -1.38985 1.54247 1.887 -1.3846 1.53226 1.89414 -1.20215 1.54247 1.887 -1.2074 1.53896 1.87858 -1.39434 1.53896 1.65421 -1.39434 1.53894 1.64068 -1.38836 1.53895 1.63514 -1.37373 1.53896 1.65421 -1.19766 1.53896 1.87858 -1.19766 1.53894 1.89212 -1.20364 1.53895 1.89766 -1.21827 1.53895 1.63514 -1.21827 1.53895 1.89766 -1.37373 1.53894 1.64068 -1.20364 1.53894 1.89212 -1.38836 1.55986 1.79032 -1.308 1.55986 1.79032 -1.2754 1.55986 1.57504 -1.09 1.58746 1.57504 -1.09 1.58746 1.60503 -1.09 1.55986 1.60503 -1.09 1.58746 1.57504 -1.285 1.58746 1.5962 -1.308 1.55986 1.5962 -1.308 1.55986 1.57504 -1.285 1.58746 1.60503 -1.2524 1.58746 1.62619 -1.2754 1.55986 1.62619 -1.2754 1.55986 1.60503 -1.2524 1.58746 1.58124 -1.30126 1.55986 1.58124 -1.30126 1.58746 1.61123 -1.26866 1.55986 1.61123 -1.26866 1.58746 1.77707 -1.308 1.57421 1.79032 -1.308 1.58746 1.77707 -1.2754 1.57421 1.79032 -1.2754 1.58358 1.78644 -1.2754 1.58358 1.78644 -1.308 2.3276 0.414 1.044 2.28528 0.414 1.09 2.3276 1.242 1.044 2.28528 1.242 1.09 2.32089 1.2654 1.044 2.27857 1.26554 1.09 2.30279 1.28169 1.044 2.26047 1.28219 1.09 1.56768 1.6192 1.09 1.61 1.6192 1.044 2.30849 1.26544 1.07653 2.29039 1.28184 1.07653 1.5976 1.6192 1.07653 2.3152 0.414 1.07653 2.3152 1.242 1.07653 2.28528 0.414 -1.1 2.3276 0.414 -1.054 2.28528 1.242 -1.1 2.3276 1.242 -1.054 2.27857 1.26554 -1.1 2.32089 1.2654 -1.054 2.26047 1.28219 -1.1 2.30279 1.28169 -1.054 1.56768 1.6192 -1.1 1.61 1.6192 -1.054 2.29039 1.28184 -1.08653 1.5976 1.6192 -1.08653 2.3152 0.414 -1.08653 2.3152 1.242 -1.08653 2.30849 1.26544 -1.08653 -2.27608 0.414 1.09 -2.3184 0.414 1.044 -2.27608 1.2696 1.09 -2.3184 1.2696 1.044 -2.27608 1.6192 1.09 -2.3184 1.6192 1.044 -2.27608 1.6192 -1.1 -2.3184 1.6192 -1.054 -2.27608 1.2696 -1.1 -2.3184 1.2696 -1.054 -2.3184 0.414 -1.054 -2.27608 0.414 -1.1 -2.306 1.2696 -1.08653 -2.306 0.414 -1.08653 -2.306 1.6192 1.07653 -2.306 1.2696 1.07653 -2.306 0.414 1.07653 -2.306 1.6192 -1.08653 -2.27608 2.53519 1.09 -2.3184 2.53519 1.044 -2.3184 2.53519 -1.054 -2.27608 2.53519 -1.1 -2.306 2.53519 1.07653 -2.306 2.53519 -1.08653 -2.3184 0.7176 -0.6075 -2.3184 0.7176 0.6075 1.29565 2.55597 1.08541 1.32979 2.55597 1.0482 1.31979 2.55597 1.07451 1.29565 2.55597 -1.09541 1.32979 2.55597 -1.0582 1.31979 2.55597 -1.08451 -2.28005 2.55597 1.08541 -2.31419 2.55597 1.0482 -2.31419 2.55597 -1.0582 -2.28005 2.55597 -1.09541 -2.30419 2.55597 1.07451 -2.30419 2.55597 -1.08451 1.29337 2.57293 1.0729 1.31831 2.57293 1.04572 1.31101 2.57293 1.06494 1.29337 2.57293 -1.0829 1.31831 2.57293 -1.05572 1.31101 2.57293 -1.07494 -2.27777 2.57293 1.0729 -2.30271 2.57293 1.04572 -2.30271 2.57293 -1.05572 -2.27777 2.57293 -1.0829 -2.29541 2.57293 1.06494 -2.29541 2.57293 -1.07494 1.28998 2.58437 1.05435 1.30129 2.58437 1.04203 1.29798 2.58437 1.05074 1.28998 2.58437 -1.06435 1.30129 2.58437 -1.05203 1.29798 2.58437 -1.06074 -2.27438 2.58437 1.05435 -2.28569 2.58437 1.04203 -2.28569 2.58437 -1.05203 -2.27438 2.58437 -1.06435 -2.28238 2.58437 1.05074 -2.28238 2.58437 -1.06074 -2.27396 2.58437 1.04157 -2.27396 2.58437 -1.05157 1.28956 2.58437 1.04157 1.28956 2.58437 -1.05157 1.29168 2.53519 1.09 1.3216 2.53519 1.07653 1.334 2.53519 1.044 1.334 2.53519 -1.054 1.3216 2.53519 -1.08653 1.29168 2.53519 -1.1 1.6026 1.69365 -1.035 1.62267 1.62811 -0.9605 1.39173 2.38251 -0.9605 1.41179 2.31697 -1.035 1.41179 2.31697 -0.00500002 1.39173 2.38251 -0.0795 1.62267 1.62811 -0.0795 1.6026 1.69365 -0.00499998 1.59948 1.70385 -1.007 1.61513 1.65274 -0.948902 1.39927 2.35788 -0.948902 1.41491 2.30677 -1.007 1.41491 2.30677 -0.033 1.39927 2.35788 -0.091098 1.61513 1.65274 -0.091098 1.59948 1.70385 -0.033 1.6026 1.69365 1.035 1.62267 1.62811 0.9605 1.39173 2.38251 0.9605 1.41179 2.31697 1.035 1.41179 2.31697 0.00500002 1.39173 2.38251 0.0795 1.62267 1.62811 0.0795 1.6026 1.69365 0.00499998 1.59948 1.70385 1.007 1.61513 1.65274 0.948902 1.39927 2.35788 0.948902 1.41491 2.30677 1.007 1.41491 2.30677 0.033 1.39927 2.35788 0.091098 1.61513 1.65274 0.091098 1.59948 1.70385 0.033 1.60861 1.6238 -0.9605 1.60861 1.6238 -0.0795 1.58887 1.68934 -0.005 1.3813 2.3782 -0.0795 1.3813 2.3782 -0.9605 1.40105 2.31266 -1.035 1.58887 1.68934 -1.035 1.3813 2.3782 0.9605 1.3813 2.3782 0.0795 1.58887 1.68934 0.005 1.60861 1.6238 0.0795 1.60861 1.6238 0.9605 1.40105 2.31266 1.035 1.40105 2.31266 -0.005 1.40105 2.31266 0.005 1.58887 1.68934 1.035 1.58576 1.69965 -1.007 1.60118 1.64847 -0.948902 1.60118 1.64847 -0.091098 1.58576 1.69965 -0.033 1.60118 1.64847 0.091098 1.58576 1.69965 0.033 1.58576 1.69965 1.007 1.60118 1.64847 0.948902 1.38843 2.35454 -0.948902 1.40385 2.30337 -1.007 1.40385 2.30337 -0.033 1.38843 2.35454 -0.091098 1.40385 2.30337 0.033 1.38843 2.35454 0.091098 1.38843 2.35454 0.948902 1.40385 2.30337 1.007 1.5226 1.633 1.217 1.5226 1.65232 1.196 1.5226 1.88048 1.196 1.5226 1.8998 1.217 1.5226 1.8998 1.375 1.5226 1.88048 1.396 1.5226 1.65232 1.396 1.5226 1.633 1.375 1.5226 1.63866 1.38985 1.5226 1.63866 1.20215 1.5226 1.89414 1.38985 1.5226 1.89414 1.20215 1.56725 1.7664 1.296 1.54249 1.64056 1.22148 1.53226 1.633 1.217 1.53226 1.65232 1.196 1.54254 1.65902 1.20187 1.54254 1.87378 1.20187 1.53226 1.88048 1.196 1.53226 1.8998 1.217 1.54249 1.89224 1.22148 1.54249 1.89224 1.37052 1.53226 1.8998 1.375 1.53226 1.88048 1.396 1.54254 1.87378 1.39013 1.53226 1.633 1.375 1.54249 1.64056 1.37052 1.54254 1.65902 1.39013 1.53226 1.65232 1.396 1.53226 1.63866 1.38985 1.54247 1.6458 1.3846 1.54247 1.6458 1.2074 1.53226 1.63866 1.20215 1.53226 1.89414 1.38985 1.54247 1.887 1.3846 1.53226 1.89414 1.20215 1.54247 1.887 1.2074 1.53896 1.87858 1.39434 1.53896 1.65421 1.39434 1.53894 1.64068 1.38836 1.53895 1.63514 1.37373 1.53896 1.65421 1.19766 1.53896 1.87858 1.19766 1.53894 1.89212 1.20364 1.53895 1.89766 1.21827 1.53895 1.63514 1.21827 1.53895 1.89766 1.37373 1.53894 1.64068 1.20364 1.53894 1.89212 1.38836 1.55986 1.79032 1.308 1.55986 1.79032 1.2754 1.55986 1.57504 1.09 1.58746 1.57504 1.09 1.58746 1.60503 1.09 1.55986 1.60503 1.09 1.58746 1.57504 1.285 1.58746 1.5962 1.308 1.55986 1.5962 1.308 1.55986 1.57504 1.285 1.58746 1.60503 1.2524 1.58746 1.62619 1.2754 1.55986 1.62619 1.2754 1.55986 1.60503 1.2524 1.58746 1.58124 1.30126 1.55986 1.58124 1.30126 1.58746 1.61123 1.26866 1.55986 1.61123 1.26866 1.58746 1.77707 1.308 1.57421 1.79032 1.308 1.58746 1.77707 1.2754 1.57421 1.79032 1.2754 1.58358 1.78644 1.2754 1.58358 1.78644 1.308 + + + + + + + + + + 0.924164 -0.272968 0.267226 1 -1.4561e-007 0 0.913785 -0.0729492 0.399595 0.889292 0.0584811 0.453585 0.924164 0.272967 0.267227 0.935842 0.347328 0.0596965 0.919752 0.38958 -0.0477789 0.924164 0.272967 -0.267227 0.913785 0.0729492 -0.399595 0.889292 -0.0584811 -0.453585 0.924164 -0.272968 -0.267226 0.935841 -0.347329 -0.0596954 0.919752 -0.389581 0.047778 0.913785 -0.0729492 -0.399595 0.889292 0.0584811 -0.453585 0.935842 0.347328 -0.0596965 0.919752 0.38958 0.0477789 0.913785 0.0729492 0.399595 0.889292 -0.0584811 0.453585 0.935841 -0.347329 0.0596954 0.919752 -0.389581 -0.047778 0.862101 0.506737 0 0.405568 0.914065 0 0.735226 0.677822 0 0.202784 0.979224 0 0 -1 0 0.707103 0.707111 0 0 0 1 0.624228 -0.781242 0 0.87929 -0.476286 0 0.721503 -0.692411 0 0.937701 -0.347443 0 -0.893422 -0.449218 0 -0.952787 -0.303641 0 -0.945478 -0.325686 0 -0.913747 -0.406284 0 -0.959499 -0.281712 0 -0.993189 -0.116512 0 -0.979892 -0.199528 0 -0.864345 -0.502899 0 -1 0 0 0 0 -1 -0.954954 -0.296755 0 -0.992357 -0.123398 0 -0.97758 -0.210565 0 0.460116 -0.887859 0 0.730132 -0.683306 0 0.548312 -0.836274 0 0.818147 -0.575009 0 0.871843 -0.489785 0 0.94891 -0.315546 0 0.933543 -0.358466 0 0.913662 -0.406475 0 -0.30562 -0.952154 0 -0.638528 -0.769599 0 -0.423782 -0.905764 0 -0.734409 -0.678707 0 0.221397 -0.969648 -0.10376 0.147514 -0.949614 -0.276537 0.295028 -0.945431 0.138268 0.0881926 -0.982287 0.16533 -0.999006 0.0445724 0 -0.987589 0.157062 0 -0.993707 0.112013 0 -0.999752 0.0222862 0 0.999006 0.0445724 0 0.987589 0.157062 0 0.993707 0.112013 0 0.999752 0.0222862 0 0.999207 0.039826 0 0.992934 -0.118672 0 0.968845 -0.247669 0 0.974419 -0.224739 0 -0.166166 -0.260691 0.951015 -0.239826 0 0.970816 -0.356143 -0.147246 0.922757 -0.410534 0 0.911845 -0.962054 -0.232838 -0.142263 -0.978378 0 -0.206823 -0.941205 -0.138479 -0.308152 -0.934454 0 -0.356083 0.584335 -0.600641 -0.545695 0.691599 -0.54436 -0.474725 0.68288 -0.704184 -0.194421 0.81201 -0.568842 -0.130607 0.751151 -0.578836 -0.317366 -0.975332 0.128045 -0.179809 -0.934564 0.332271 -0.127227 -0.938907 0.184676 -0.290428 -0.968009 0.184657 -0.169885 -0.196275 -0.3357 0.921293 -0.198948 -0.198953 0.959603 0.922075 -0.345578 0.174223 0.863312 -0.382713 0.328973 0.808054 -0.560034 0.182787 0.751151 -0.578836 0.317366 0.0848338 -0.973727 0.211326 -0.194002 -0.973813 0.118537 0.091692 -0.984269 -0.151023 -0.192406 -0.965026 -0.178059 0 1 0 0 0.97719 0.212368 -0.898877 -0.438201 0 -0.954275 -0.298929 0 -0.896939 -0.437256 -0.0656262 -0.972515 -0.222888 -0.0673432 0 -0.949185 -0.314719 0 -0.997428 -0.0716727 0 -0.997428 0.0716735 0 0.949185 -0.314718 0 0.997428 -0.0716727 0 0.997428 0.0716734 0 0.97719 -0.212368 0 0.949185 -0.314719 -0.952418 -0.297306 0.0671509 0 -0.97719 0.212369 0 -0.97719 -0.212369 -0.97252 -0.223308 0.0658702 -0.988835 -0.149017 5.47167e-008 0.97252 -0.223308 0.06587 1 0 0 0.988835 -0.149017 -5.47167e-008 0.97252 -0.223308 0.0658702 0.88697 -0.432397 0.162226 0.972515 -0.222888 0.0673432 0.896939 -0.437256 0.0656262 0 -0.949185 0.314719 0.0653088 -0.997865 -1.1122e-007 0.32072 -0.947174 -5.46182e-007 0.130618 -0.991433 -2.2244e-007 0.442966 -0.896539 -7.54364e-007 -1 0 -2.64909e-006 -0.442967 -0.896538 -1.17346e-006 -0.320721 -0.947174 -7.61988e-007 -0.130618 -0.991433 -2.59513e-007 -0.0653089 -0.997865 -8.65046e-008 0.585875 0.145583 0.797217 0.669861 -0.143487 0.72849 0.741459 0.56494 -0.362052 0.765131 0.618373 -0.179414 0.860873 0.495047 -0.117582 0 0.139609 0.990207 0.150289 0.273993 0.949916 0 0.41054 0.911843 0.1575 0.405416 0.900462 0.19509 0.980785 0 0.369012 0.758016 -0.537812 0.436471 0.896012 -0.0815846 0.475858 0.816598 -0.326691 0.593431 0.797297 -0.110256 0.834153 0.526617 0.1639 0.988479 0.0921435 0.12008 0.881712 0.442661 -0.163206 0.993681 0.0681303 -0.0892019 -0.983476 0 0.181038 -0.987895 0 0.155122 -0.209948 0 0.977713 -0.113958 0.0313055 0.992992 -0.410538 0 0.911843 -0.409473 0.0818412 0.908644 -0.685223 0.715904 0.133976 -0.436959 0.766999 0.469871 -0.237632 0.969582 0.0586683 -0.256909 0.93681 0.237454 -0.321212 0.945184 -0.0587289 -0.730925 0.6692 -0.133867 0.956314 0.288149 0.0493336 0.957737 0.255543 0.132052 0.899475 0.271023 0.342769 0.921274 0.168012 0.35075 0.9562 0.292714 8.27963e-007 0.9562 0.292715 -8.32654e-007 0.9562 0.292715 -2.39203e-007 0.956199 0.292717 -1.23299e-006 0.9562 0.292715 5.04e-007 0.9562 0.292714 5.95027e-007 0.9562 0.292714 2.93252e-007 0.9562 0.292714 -1.84548e-007 -1.5175e-006 -4.57242e-007 -1 1.74263e-007 9.36015e-008 -1 1.86603e-006 6.44445e-007 -1 1.49139e-006 4.49373e-007 -1 -1.67253e-007 -9.18595e-008 -1 -1.82589e-006 -6.33092e-007 -1 0.115091 0.928237 -0.353738 0.190541 0.97007 -0.150529 0.342559 0.878245 -0.333674 0.681053 0.724099 -0.108847 0.546264 0.78303 -0.297422 0.104852 0.408277 0.906816 0.164368 0.174482 0.970845 0.51823 0.34829 0.781109 0.669861 0.143487 0.72849 0.16985 -0.956644 -0.236607 0.190541 -0.97007 0.150526 0 -0.992717 -0.120467 0 -0.970541 0.240934 -0.707106 0.707107 0 0.670445 -0.741959 0 0.946948 0.321388 0 -0.670444 0.74196 0 0.0593545 -0.998237 0 0.295353 -0.955388 0 0.118709 -0.992929 0 0.410599 -0.911816 0 -0.315808 -0.948823 0 -0.652288 -0.757971 0 -0.436751 -0.899582 0 -0.746637 -0.665232 0 -0.698876 -0.715243 0 -0.858487 -0.512835 0 -0.758722 -0.651414 0 -0.898797 -0.438365 0 0.748257 -0.663409 0 0.899446 -0.437031 0 0.8323 -0.554325 0 -0.678421 -0.734673 0 -0.845256 -0.534362 0 -0.740169 -0.672421 0 -0.888646 -0.458594 0 -0.0442123 -0.999022 0 0.21185 -0.977302 0 0.0442122 -0.999022 0 0.291207 -0.95666 0 0.285621 -0.958343 0 0.610265 -0.792198 0 0.398003 -0.917384 0 0.708707 -0.705503 0 0.114248 -0.993452 0 -0.0617387 -0.998092 0 0.0571242 -0.998367 0 -0.123477 -0.992347 0 0.295027 0.945432 -0.138268 -0.147515 0.949614 -0.276536 0.0881923 0.982287 -0.165329 -0.221399 0.969648 -0.10376 -0.2214 -0.969647 0.10376 -0.0881937 -0.982287 -0.16533 0.987589 -0.157063 0 0.993707 -0.112013 0 -0.999206 0.0398318 0 -0.992933 -0.118674 0 -0.968843 -0.247675 0 -0.974418 -0.224742 0 -0.167802 0 0.985821 -0.208433 0.137178 0.968369 -0.335686 0.196383 0.921275 0.332278 0.934561 -0.127227 0.153735 0.96424 -0.215885 0.194004 0.973813 0.118536 0.313824 0.934194 0.169696 -0.209946 0 -0.977713 0.194873 -0.153271 -0.968779 0.206941 -0.09355 -0.973871 -0.210318 -0.21769 -0.953088 -0.196275 -0.3357 -0.921293 -0.335686 -0.196384 -0.921275 -0.198948 -0.198953 -0.959603 0.440918 -0.886632 -0.139555 0.617149 -0.64919 -0.444612 0.735738 -0.661057 -0.147285 0.673853 -0.68486 -0.277288 0.206941 -0.09355 0.973871 0.407149 -0.128195 0.904321 0.239634 -0.0215382 0.970624 0.410262 -0.0368727 0.911222 -0.209946 0 0.977713 -0.894506 -0.43607 0.0984929 -0.952418 -0.297306 0.0671509 -0.898877 -0.438201 0 -0.988767 -0.149464 0 -0.88697 -0.432397 -0.162226 -0.97252 -0.223308 -0.06587 -0.898877 -0.438201 1.60901e-007 -0.97252 -0.223308 0.06587 -0.988835 -0.149017 -5.47167e-008 0.97252 -0.223309 0.0658702 0.972515 -0.222888 0.0673434 -0.442967 -0.896538 1.50873e-006 -0.130618 -0.991433 3.3366e-007 -0.320721 -0.947174 9.79699e-007 -0.0653089 -0.997865 1.1122e-007 -1 0 -2.64909e-006 0.442966 -0.896539 5.86728e-007 0.32072 -0.947174 4.24808e-007 0.130618 -0.991433 1.73009e-007 0.0653088 -0.997865 8.65045e-008 0.727366 -0.212062 -0.652663 0.6402 -0.398846 -0.656557 0.741459 -0.564942 0.362049 0.765131 -0.618374 0.179411 0.860873 -0.495049 0.11758 0 0.992717 -0.120469 0.16985 0.956643 -0.236612 0 0.934446 -0.356104 0.172931 0.920368 -0.350739 0.965732 0.259542 0 0.991544 0.129771 0 0.0977657 0.106221 0.989525 0.201542 0.163362 0.965761 0.103724 0.0312533 -0.994115 0.0977657 0.106221 -0.989525 -0.93445 0 -0.356094 -0.93445 0 -0.356094 -0.978377 0 -0.206829 -0.987895 0 -0.155122 -0.0648771 0.951784 0.29983 -0.11332 0.714766 0.690121 0.151591 0.741218 0.653924 0.0648149 0.972991 0.221556 -0.937035 0.30341 -0.17294 -0.913809 0.367214 0.173517 -0.748552 0.489335 -0.447461 -0.436959 0.766999 -0.469871 0.359723 0.491727 0.792971 0.407673 0.122662 0.904852 0.130817 0.103217 0.986019 0.0829834 0.0688243 0.994172 0.9562 0.292715 3.36e-007 0.9562 0.292714 2.25174e-007 0.9562 0.292714 3.91003e-007 0.9562 0.292714 4.82625e-007 0.9562 0.292714 1.47111e-006 0.956199 0.292716 -6.24492e-007 0.9562 0.292715 -3.22717e-007 0.956199 0.292717 -1.84949e-006 0.293133 -0.956072 0 -0.292755 0.956188 0 0.293974 -0.955814 0 0.293974 -0.955814 0 0.1575 0.405416 -0.900462 0.51823 0.34829 -0.781109 0.150289 0.273993 -0.949916 0.585875 0.145583 -0.797217 0.104852 -0.408277 -0.906816 0.164368 -0.174482 -0.970845 0.51823 -0.34829 -0.781109 0.669861 -0.143487 -0.72849 0.16985 0.956643 0.236612 0 0.992717 0.120469 0 0.97054 -0.240939 0 -0.992718 0.120466 0 -0.970542 0.240931 0.707107 -0.707107 0 0 -0.139295 -0.990251 0 0.0326285 -0.999468 0 0.198746 -0.980051 0 0.198746 -0.980051 0.221396 0.969648 0.10376 -0.0881934 0.982287 0.165329 0.999006 -0.0445721 0 0.999752 -0.0222861 0 -0.999218 0.0395457 0 -0.971699 0.236224 0 -0.971699 0.236224 0 -0.934454 0 0.356083 -0.941205 0.138478 0.308152 -0.983477 0 0.181033 -0.962054 0.232837 0.142263 0.973813 0.194004 -0.118536 0.934191 0.313828 -0.1697 0.93456 0.332282 0.12723 0.96424 0.153735 0.215885 0.209692 -0.0251407 -0.977444 -0.137176 0.208436 -0.968368 -0.356144 0.147245 -0.922757 -0.196379 0.335692 -0.921274 -0.198949 0.198952 -0.959603 0.0854144 -0.891376 -0.445144 0.0194109 -0.988902 -0.147299 0.074675 -0.957689 -0.27795 0.194873 -0.153271 0.968779 0.395134 -0.271327 0.877639 -0.894506 -0.43607 0.0984929 -0.88697 -0.432397 0.162226 -0.97252 -0.223308 -0.0658702 0.952418 -0.297307 -0.0671511 0.97252 -0.223309 -0.0658704 0 0.949185 0.314719 0 0.949185 0.314718 0.1575 -0.405416 -0.900462 0.150289 -0.273993 -0.949916 0.585875 -0.145583 -0.797217 0.172931 -0.92037 0.350733 0.16985 -0.956644 0.236607 0.342559 -0.878248 0.333668 0.570072 -0.814287 0.109339 0.546263 -0.783032 0.297417 0 0.41054 -0.911843 0.104852 0.408277 -0.906816 0 0.279218 -0.960228 0.164368 0.174482 -0.970845 0 0.167804 0.98582 0 0.209948 0.977713 0.995929 0 0.0901381 0.994668 0 -0.10313 -0.089308 0 0.996004 -0.93445 0 0.356094 -0.932959 0.0580001 0.355279 -0.98887 0.0872156 0.120539 -0.845719 0.425992 0.321387 0.321209 0.945185 0.0587289 0.719191 0.687499 0.10054 0.662855 0.741984 -0.10042 0.237629 0.969583 -0.0586683 0.200969 0.391214 0.898089 0.368332 0.445792 0.815844 0.215859 -0.704038 -0.676562 0.218049 -0.703127 -0.676807 0.220238 -0.702212 -0.677048 -0.21545 0.703695 -0.677049 -0.215472 0.703684 -0.677052 -0.215495 0.703674 -0.677056 0.216255 -0.70345 -0.677046 0.2163 -0.703432 -0.677051 0.216344 -0.703413 -0.677056 0.782824 0.605677 -0.142622 0.85628 0.508919 -0.0882341 0.640199 0.398845 0.656557 0.150289 -0.273993 0.949916 0 -0.139609 0.990207 0 0.279218 0.960228 -0.707107 -0.707107 0 0.707107 -0.707107 0 -0.707106 0.707108 0 -0.405566 -0.914066 0 -0.202783 -0.979224 0 0.046859 -0.998901 0 -0.229817 -0.973234 0 -0.0468589 -0.998902 0 -0.319079 -0.947728 0 0.223535 -0.974696 0 0.306679 -0.951813 0 -0.217902 -0.975971 0 -0.303169 -0.952937 0 -0.540615 -0.84127 0 -0.464516 -0.885565 0 -0.295031 0.94543 0.138268 0.981097 0.193515 0 0.981097 0.193515 0 0 0.264657 0.964343 0 0.176594 0.984284 0 0.126077 0.99202 0 0.0502738 0.998735 0 0.0251369 0.999684 0 -0.0251368 0.999684 0 -0.0502735 0.998735 -0.934195 -0.31382 -0.169696 -0.934563 -0.332272 0.127227 -0.975332 -0.128045 0.179809 -0.410534 0 -0.911845 0.382828 -0.913218 0.139555 0.973694 -0.0699582 -0.216853 0.941694 -0.288031 -0.173926 0.928684 -0.110926 -0.353895 0.863312 -0.382713 -0.328973 0.164671 0.25021 0.954085 0.356149 0.147245 0.922755 0.196383 0.335692 0.921273 0.198953 0.198953 0.959602 -0.983477 0 -0.181033 -0.934454 0 -0.356083 0.132149 -0.293381 0.946818 0.896939 -0.437258 0.0656264 0.954275 -0.29893 0 0.898876 -0.438202 0 0.988835 -0.149017 -5.59892e-008 0.898876 -0.438202 -1.64642e-007 0.88697 -0.432398 0.162226 0.988835 -0.149017 5.59892e-008 0.97252 -0.223309 -0.0658702 0.88697 -0.432398 -0.162226 0.894506 -0.436072 -0.0984932 0.988767 -0.149464 0 0.898877 -0.438201 0 0.952418 -0.297306 -0.0671509 0.894506 -0.43607 -0.0984929 0 -0.997428 0.0716727 0 -0.997428 -0.0716735 0 -0.949185 -0.314719 0 0.997428 -0.0716734 0 0.997428 0.0716727 -0.88697 -0.432397 -0.162226 -0.995185 -0.0980162 3.38957e-006 -0.947174 -0.320721 3.22605e-006 -0.896538 -0.442967 3.05358e-006 0.997865 -0.0653095 9.91288e-007 0.991433 -0.130619 1.09362e-006 0.947174 -0.320721 1.14444e-006 0.896538 -0.442966 1.18751e-006 0.410733 -0.100421 -0.906209 0.551736 0.101199 -0.827856 0.190541 -0.97007 -0.150526 0.472082 -0.877191 0.0876065 0.619672 -0.779835 -0.0886748 0 -0.934449 -0.356098 0.11509 -0.928239 -0.353732 0 -0.970541 -0.240934 0 -0.410538 -0.911843 0 -0.279217 -0.960228 0 -0.139608 -0.990207 0.923884 0.382672 0 0.410226 0.0389825 0.91115 0.401142 0.217971 0.889704 0.0959263 0.018238 0.995221 0.18098 0.306193 -0.934608 0.360201 0.496883 -0.789533 0.201542 0.163362 -0.965761 0.401142 0.217971 -0.889704 -0.410538 0 0.911843 -0.22162 0.365979 0.903849 -0.991283 0.0534436 -0.120421 -0.104476 0.0470358 -0.993414 -0.409473 0.0818412 -0.908644 -0.221751 0.422759 -0.878693 -0.382702 0.367395 -0.847679 0.256907 0.936811 0.237454 0.0922245 0.0520886 -0.994375 0.407673 0.122662 -0.904852 0.130817 0.103217 -0.986019 0.359723 0.491727 -0.792971 0.9562 0.292714 -2.25174e-007 0.9562 0.292714 -4.82625e-007 0.9562 0.292714 -8.27963e-007 0.9562 0.292715 2.39203e-007 -1.5175e-006 -4.57242e-007 1 1.74263e-007 9.36015e-008 1 1.86603e-006 6.44445e-007 1 0.95748 0.288501 2.03387e-007 0.95748 0.288501 -4.77108e-008 0.95748 0.288501 1.01693e-007 0.95748 0.2885 -1.36508e-007 0.95748 0.288501 2.41707e-007 0.95748 0.288501 3.94062e-007 0.95748 0.288501 7.88125e-007 -0.21545 0.703695 0.677049 -0.215472 0.703684 0.677052 -0.215495 0.703674 0.677056 0.741459 0.56494 0.362052 0.765131 0.618373 0.179414 0.860873 0.495047 0.117582 0 0.139609 -0.990207 0.707107 0.707107 0 0.707103 -0.707111 0 -0.0641391 -0.997941 0 -0.128278 -0.991738 0 -0.485236 -0.874383 0 -0.562301 -0.826933 0 0.480504 -0.876993 0 0.569809 -0.821777 0 -0.147516 -0.949614 0.276537 -0.295032 -0.94543 -0.138268 0 -0.277288 0.960787 0 -0.251982 0.967732 0 -0.176594 0.984284 0 -0.126077 0.99202 0 -0.277288 -0.960787 0 -0.251982 -0.967732 0.941201 0.138482 -0.308162 0.988828 -0.088319 0.120076 0.931208 -0.0832264 0.354858 0.938903 0.18468 0.290437 -0.332273 -0.934563 -0.127226 -0.138305 -0.940787 -0.309501 -0.184635 -0.968016 -0.169868 0.968009 0.184657 0.169885 -0.983477 0 0.181033 -0.934454 0 0.356083 0.25021 0.164671 -0.954085 0 -0.949185 0.314719 -0.88697 -0.432397 0.162226 -0.752339 -0.658776 2.56245e-006 -0.658776 -0.752339 2.24377e-006 -0.890435 0.455111 1.5164e-006 -0.890435 0.455111 2.2746e-006 -0.950385 0.311076 2.71874e-006 -0.98783 0.155538 3.36452e-006 0.75234 -0.658775 9.96508e-007 0.658776 -0.752339 8.72578e-007 0.741459 -0.564942 -0.362049 0.782824 -0.605679 -0.14262 0.85628 -0.50892 -0.0882325 0.632732 0.76459 -0.122688 0.719587 0.683736 0.121242 0.164368 -0.174482 0.970845 0 -0.279218 0.960228 0.104852 -0.408277 0.906816 0 -0.41054 0.911843 0 0.410538 0.911843 0.382682 0.92388 0 0.758528 0.584784 0.287514 0.920262 0.173812 0.350581 0.119177 0.0169757 -0.992728 0.11332 0.714767 -0.690121 0.221621 0.36598 -0.903849 -0.113184 0.76687 -0.631743 -0.382702 0.367395 0.847679 -0.0648156 0.972991 -0.221556 -0.256909 0.93681 -0.237454 0.382703 0.367395 -0.847678 0.9562 0.292715 8.32654e-007 0.956199 0.292717 1.23299e-006 -0.274696 0.684662 0.675115 -0.27819 0.683103 0.675263 -0.281679 0.681534 0.675402 1.49139e-006 4.49373e-007 1 -1.67253e-007 -9.18595e-008 1 -1.82589e-006 -6.33092e-007 1 0.172931 0.920368 0.350739 0.342559 0.878245 0.333674 0.570073 0.814286 0.109341 0.546264 0.78303 0.297422 0.707107 0.707107 0 -0.8621 -0.506738 0 -0.735225 -0.677823 0 -0.981095 0.193528 0 0.147514 0.949615 0.276536 -0.313819 -0.934196 0.169696 -0.989471 0 -0.144728 0.685474 -0.714719 0.138928 0.410417 -0.02458 -0.911567 0.407149 -0.128195 -0.904321 0.138478 0.941202 0.308159 0.184642 0.968014 0.169871 0.988767 -0.149465 0 0.97252 -0.223309 0.0658704 -1 0 3.40597e-006 -1 0 3.40597e-006 1 0 -1.27724e-006 1 0 -1.27724e-006 1 0 9.93409e-007 1 0 9.93409e-007 0.669861 0.143487 -0.72849 0.632732 -0.764591 0.122686 0.719587 -0.683736 -0.12124 0 -0.139609 -0.990207 0 -0.41054 -0.911843 0 -0.992718 -0.120466 0 -0.93445 -0.356094 0 -0.970542 -0.240931 0 0.992718 0.120466 0 0.970542 0.240931 0.369012 0.758016 0.537812 0.475858 0.816598 0.326691 0.435321 0.893684 0.108739 0.554961 0.824521 0.110376 0.758528 0.584784 -0.287514 0.503301 0.764121 0.403493 0.546502 0.461157 -0.699049 0.485754 0.748445 -0.451523 0.9562 0.292715 -3.36e-007 0.9562 0.292714 -3.91003e-007 0.215859 -0.704038 0.676562 0.218049 -0.703127 0.676807 0.220238 -0.702212 0.677048 0.95748 0.288501 -2.03387e-007 0.95748 0.288501 1.71322e-007 0.95748 0.288501 2.56983e-007 0.95748 0.288501 2.39117e-007 0.95748 0.288501 4.34759e-008 0.95748 0.288501 -2.19232e-007 0.95748 0.288501 -3.28849e-007 0.95748 0.288501 -7.88125e-007 0.1575 -0.405416 0.900462 0.51823 -0.34829 0.781109 0.585875 -0.145583 0.797217 0.172931 -0.92037 -0.350733 0.342559 -0.878248 -0.333668 0.570072 -0.814287 -0.109339 0.546263 -0.783032 -0.297417 0 0.209948 -0.977713 0.952353 -0.304997 0 0.878258 -0.478187 0 0.919227 -0.393728 0 -0.886628 -0.462483 0 -0.949426 -0.31399 0 -0.941757 -0.336293 0 -0.907925 -0.419132 0 0 -0.176594 -0.984284 0 -0.126077 -0.99202 -0.987589 -0.157063 0 -0.993707 -0.112013 0 0 0.0326285 0.999468 0 -0.139295 0.990251 -0.138305 -0.940787 0.309501 0.0854144 -0.891376 0.445144 0.147245 0.356149 -0.922755 0.335692 0.196383 -0.921273 0.198953 0.198953 -0.959602 -0.184635 -0.968016 0.169868 0.0637547 -0.695909 0.715294 0.213313 -0.466081 0.858642 0.494941 -0.519801 0.696305 0.88697 -0.432398 0.162226 0.954275 -0.298929 0 -0.898877 -0.438201 -1.60901e-007 0.88697 -0.432397 -0.162226 0.898877 -0.438201 1.60901e-007 0.97252 -0.223308 -0.06587 0.988835 -0.149017 5.47167e-008 0.658776 -0.752339 -1.12189e-006 0.896538 -0.442966 -1.52679e-006 0.75234 -0.658775 -1.28122e-006 0.947174 -0.320721 -1.47142e-006 -0.972223 0.234057 -2.57551e-006 -0.890435 0.455111 -1.76913e-006 -0.972223 0.234057 -2.27223e-006 -0.890435 0.455111 -1.17942e-006 -0.658776 -0.752339 -1.74516e-006 -0.752339 -0.658776 -1.99301e-006 -0.896538 -0.442967 -2.37501e-006 -0.947174 -0.320721 -2.50915e-006 0.6402 -0.398846 0.656557 0.926487 0.130484 -0.35298 0.93445 0 -0.356094 -0.167804 0 -0.98582 -0.410538 0 -0.911843 0.64292 0.50458 0.57624 0.918994 0.344359 0.192007 0.256907 0.936811 -0.237454 0.896915 0.398295 -0.192107 0.961562 0.253526 -0.105467 0.9562 0.292714 -1.47111e-006 0.9562 0.292715 3.22717e-007 0.956199 0.292716 6.24492e-007 0.956199 0.292717 1.84949e-006 -0.274698 0.684662 -0.675114 -0.278191 0.683103 -0.675263 -0.28168 0.681535 -0.675401 -0.381964 0.924177 0 0.472082 -0.877191 -0.0876065 0.619672 -0.779835 0.0886748 0 -0.934449 0.356098 0.11509 -0.928239 0.353732 0 -0.410538 0.911843 0 -0.279217 0.960228 0 -0.104374 0.994538 -0.946948 -0.321388 0 -0.981095 -0.193528 0 0 0.0535322 0.998566 0 -0.198746 0.980051 0 0.0535322 -0.998566 0 0.264657 -0.964343 -0.968009 -0.184657 -0.169884 0.494941 -0.519801 -0.696305 0.213313 -0.466081 -0.858642 0.132149 -0.293381 -0.946818 0.0637547 -0.695909 -0.715294 0.97252 -0.223308 -0.0658702 0.681052 -0.7241 -0.108845 0.190541 0.97007 0.150529 0.472082 0.877191 -0.0876082 0 -0.992717 0.120467 0 0.93445 0.356094 -0.089308 0 -0.996004 0.0648764 0.951784 -0.29983 0.49282 0.497968 0.713551 0.9562 0.292715 -5.04e-007 0.9562 0.292714 -2.93252e-007 -0.274698 0.684662 0.675114 -0.278191 0.683103 0.675263 -0.28168 0.681535 0.675401 -0.215449 0.703695 0.677049 -0.215473 0.703684 0.677052 -0.215496 0.703674 0.677056 0.216254 -0.703451 0.677046 0.216299 -0.703432 0.677051 0.216345 -0.703413 0.677056 0.640199 0.398845 -0.656557 0 -0.279218 -0.960228 -0.707107 -0.707107 0 -0.707106 -0.707108 0 0.870177 -0.492739 0 0.889014 -0.45788 0 0 0.198746 0.980051 0 0.198746 0.980051 0 0.176594 -0.984284 0 0.126077 -0.99202 -0.999752 -0.0222861 0 -0.999006 -0.0445721 0 -0.934195 0.313819 0.169696 0.352571 -0.355694 0.865549 0.494108 -0.375334 0.784208 0.458948 -0.440018 0.771849 -0.147242 0.356149 0.922755 0.395134 -0.271327 -0.877639 -0.153732 0.964241 0.215886 -0.332273 0.934563 0.127227 -0.184672 0.938906 0.290433 -0.184638 0.968015 0.169871 0.898876 -0.438202 1.64642e-007 0.898877 -0.438201 0 0.898877 -0.438201 -1.60901e-007 0.88697 -0.432397 0.162226 0.88697 -0.432397 -0.162226 0.115091 0.928237 0.353738 0.33958 0.574522 0.744721 0.40013 0.627629 0.667816 0.464763 0.713509 0.52431 0.409835 0.0584849 -0.910283 -0.620011 0.499814 0.604791 0.215859 -0.704038 0.676561 0.218049 -0.703127 0.676806 0.220239 -0.702212 0.677048 -0.215449 0.703695 -0.677049 -0.215473 0.703684 -0.677052 -0.215496 0.703674 -0.677056 0.765131 -0.618374 -0.179411 0.860873 -0.495049 -0.11758 0 0.934446 0.356104 -0.707107 0.707107 0 0 0.0502738 -0.998735 0 0.0251369 -0.999684 0 -0.0251368 -0.999684 0 -0.0502735 -0.998735 -0.194001 0.973813 -0.118536 -0.138475 0.941203 -0.308159 0.184675 0.938906 -0.290433 -0.313818 0.934196 -0.169696 0.584335 -0.600641 0.545695 0.691599 -0.54436 0.474725 0.968009 0.184657 -0.169885 -0.198949 0.198952 0.959603 0.88697 -0.432398 -0.162226 0.995185 -0.0980171 -1.27109e-006 0.995185 -0.0980172 -1.37599e-006 -0.991433 -0.130618 -2.6264e-006 -0.997865 -0.0653089 -2.64344e-006 0.737343 0.16868 -0.65412 0.93445 0 0.356094 -0.279217 0 -0.960228 0.139608 0 -0.990207 -0.748552 0.489335 0.447461 -0.932959 0.0580001 -0.355279 -0.845719 0.425992 -0.321387 0.921274 0.168012 -0.35075 0.875567 0.350238 -0.332739 0.9562 0.292714 -5.95027e-007 0.9562 0.292714 1.84548e-007 0.215859 -0.704038 -0.676561 0.218049 -0.703127 -0.676806 0.220239 -0.702212 -0.677048 0.681052 -0.7241 0.108845 0.472082 0.877191 0.0876082 0.619673 0.779835 -0.0886765 0 0.93445 -0.356094 0 0.970542 -0.240931 0 0.992718 -0.120466 -0.855562 -0.517701 0 0 -0.198746 -0.980051 0.0315185 -0.462003 -0.886318 0.0315185 -0.462003 0.886318 0.184642 0.968014 -0.169871 -0.968009 0.184657 0.169885 0.0194109 -0.988902 0.147299 0.074675 -0.957689 0.27795 0 0.97054 0.240939 0.209948 0 0.977713 0.410538 0 0.911843 0.410538 0 -0.911843 -0.995929 0 -0.0901381 -0.620011 0.499814 -0.604791 0.734771 0.458436 -0.499948 0.955889 0.288021 -0.0576147 0.899475 0.271023 -0.342769 0.95748 0.2885 2.21632e-008 0.95748 0.288501 2.32699e-006 0.95748 0.2885 0 0.95748 0.2885 0 0.95748 0.2885 0 0.95748 0.2885 0 0.95748 0.288501 0 0.95748 0.288501 0 0.95748 0.2885 0 0.95748 0.2885 0 0.95748 0.288501 -1.342e-006 0.95748 0.2885 4.41488e-007 0.95748 0.2885 -4.25255e-007 0.95748 0.288501 3.54971e-007 0.95748 0.288501 -1.11168e-006 0.95748 0.2885 -1.99183e-008 0.216255 -0.70345 0.677046 0.2163 -0.703432 0.677051 0.216344 -0.703413 0.677056 0.782824 -0.605679 0.14262 0.85628 -0.50892 0.0882325 0.632732 0.76459 0.122688 0.719587 0.683736 -0.121242 0 0.410538 -0.911843 0.981097 -0.193515 0 0.999218 0.0395475 0 0.999218 0.0395475 0 0.981097 -0.193515 0 0.9717 0.23622 0 -0.938907 -0.184676 0.290428 0.352571 -0.355694 -0.865549 0.494108 -0.375334 -0.784208 0.458948 -0.440018 -0.771849 -0.184638 0.968015 -0.169871 -0.968009 -0.184657 0.169884 0.617149 -0.64919 0.444612 0.735738 -0.661057 0.147285 0.673853 -0.68486 0.277288 0.570073 0.814286 -0.109341 0.360201 0.496883 0.789533 0.18098 0.306193 0.934608 0.39056 0.308159 -0.867468 0.40013 0.627629 -0.667816 0.33958 0.574522 -0.744721 0.464763 0.713509 -0.52431 0.875567 0.350238 0.332739 -0.274696 0.684662 -0.675115 -0.27819 0.683103 -0.675263 -0.281679 0.681534 -0.675402 0.216254 -0.703451 -0.677046 0.216299 -0.703432 -0.677051 0.216345 -0.703413 -0.677056 0.632732 -0.764591 -0.122686 0.719587 -0.683736 0.12124 0 -0.93445 0.356094 + + + + + + + + + + 0.888832 0.43171 0.867977 0.397389 0.890194 0.428129 0.890887 0.367159 0.889581 0.363569 0.886299 0.362105 0.85042 0.361652 0.847127 0.363061 0.845765 0.366642 0.845065 0.427619 0.846371 0.431211 0.849653 0.432675 0.885539 0.433121 0.652343 0.526656 0.645853 0.531257 0.342628 0.19345 0.385127 0.19345 0.62953 0.451111 0.627126 0.453489 0.627757 0.446876 0.622846 0.451735 0.320286 0.355058 0.315835 0.349086 0.623078 0.0953997 0.621631 0.0883357 0.288925 0.0740266 0.286974 0.0575705 0.409928 0.311357 0.391879 0.34204 0.247005 0.709895 0.246849 0.572222 0.250423 0.710201 0.250266 0.571892 0.412179 0.317493 0.598201 0.317493 0.601913 0.311357 0.248836 0.317493 0.295131 0.317493 0.248836 0.311357 0.297382 0.311357 0.620098 0.0944887 0.621603 0.101553 0.784937 0.0779967 0.784937 0.0612169 0.829911 0.0777785 0.829911 0.0609987 0.673366 0.0477318 0.657392 0.0477316 0.673148 0.00275482 0.657174 0.00275482 0.28875 0.0477289 0.281418 0.0477288 0.288531 0.00275482 0.281199 0.00275482 0.784937 0.507805 0.784937 0.500215 0.829914 0.507587 0.829914 0.499996 0.55379 0.676965 0.478049 0.677022 0.553766 0.605055 0.478047 0.605021 0.0266158 0.953332 0.0247274 0.955156 0.025049 0.732798 0.0269321 0.734627 0.0552485 0.954742 0.0546903 0.954775 0.0550086 0.733286 0.0555666 0.73332 0.0196358 0.733337 0.0201942 0.733297 0.0198733 0.954638 0.0193153 0.954597 0.0113421 0.955476 0.0116674 0.732432 0.0138281 0.954748 0.0141511 0.733168 0.166663 0.71356 0.157427 0.710113 0.16736 0.712073 0.157832 0.708622 0.179135 0.953923 0.187897 0.953889 0.178854 0.955437 0.187802 0.955361 0.161509 0.955671 0.148823 0.954682 0.161355 0.953876 0.14867 0.953384 0.206235 0.953929 0.207638 0.953975 0.206467 0.955202 0.20764 0.955192 0.168131 0.713918 0.168609 0.712525 0.146558 0.731986 0.146753 0.730821 0.148291 0.731972 0.148435 0.730686 0.164391 0.73157 0.175959 0.731649 0.164763 0.953926 0.176335 0.953931 0.159382 0.637361 0.159377 0.654655 0.200924 0.651616 0.173393 0.651608 0.558831 0.936818 0.537591 0.936273 0.559826 0.892343 0.538318 0.891444 0.50215 0.935771 0.494221 0.93544 0.503576 0.891489 0.496091 0.890759 0.519094 0.824653 0.50289 0.824477 0.519335 0.821082 0.502598 0.820997 0.539932 0.875941 0.560635 0.875723 0.540238 0.879135 0.560641 0.879254 0.560241 0.807984 0.560905 0.817391 0.538738 0.808649 0.540234 0.817875 0.560099 0.86635 0.538499 0.866685 0.496584 0.866298 0.483608 0.866434 0.496753 0.83339 0.483847 0.833056 0.517827 0.865942 0.50409 0.865974 0.517919 0.8338 0.504159 0.833903 0.493962 0.817801 0.493342 0.821166 0.480353 0.818126 0.479663 0.821358 0.527437 0.875479 0.527897 0.879023 0.527727 0.817493 0.51908 0.81755 0.525491 0.808471 0.517938 0.808073 0.504121 0.808334 0.502835 0.817473 0.378624 0.747548 0.314396 0.747548 0.378624 0.769043 0.314396 0.769043 0.527818 0.53228 0.525206 0.531766 0.394717 0.152943 0.394717 0.152943 0.394717 0.149866 0.394717 0.149866 0.398941 0.278565 0.40156 0.27908 0.892234 0.365748 0.891505 0.429566 0.846111 0.361541 0.849565 0.359857 0.896458 0.365016 0.893984 0.365111 0.893498 0.358894 0.891709 0.360663 0.853352 0.101309 0.849499 0.103051 0.845628 0.0928827 0.841774 0.0946244 0.847903 0.157401 0.840179 0.157401 0.847903 0.153369 0.840179 0.153369 0.327687 0.191912 0.32629 0.191912 0.249614 0.154307 0.248217 0.15429 0.213355 0.596641 0.213354 0.599229 0.00331832 0.596575 0.00331755 0.599163 0.453081 0.830457 0.453081 0.869352 0.408523 0.830457 0.408523 0.869352 0.249664 0.445342 0.249664 0.547176 0.2463 0.445342 0.2463 0.547176 0.408523 0.769043 0.24667 0.551372 0.247491 0.551372 0.248583 0.552643 0.248956 0.552643 0.239121 0.976734 0.238744 0.975462 0.453256 0.975462 0.452879 0.976734 0.239168 0.976734 0.452832 0.976734 0.686439 0.445342 0.655418 0.547176 0.685045 0.445342 0.654024 0.547176 0.00527087 0.43139 0.0127316 0.423813 0.00807369 0.43257 0.0138918 0.426662 0.116822 0.511086 0.109366 0.503504 0.117984 0.508237 0.11217 0.502325 0.109366 0.503522 0.109388 0.431536 0.109388 0.431422 0.105562 0.50233 0.105584 0.432608 0.105562 0.502323 0.105584 0.432601 0.842479 0.0817143 0.845985 0.0832026 0.841052 0.0781828 0.841561 0.0194097 0.883419 0.0835243 0.843049 0.0159033 0.88695 0.0820967 0.846581 0.0144757 0.888439 0.0785903 0.884016 0.0147973 0.888948 0.0198165 0.887522 0.0162854 0.887656 0.358401 0.890603 0.362056 0.887181 0.360335 0.844998 0.360149 0.84272 0.364531 0.844453 0.365204 0.88684 0.43686 0.848296 0.43638 0.886976 0.439553 0.848057 0.439083 0.891833 0.101309 0.891833 0.0928827 0.527198 0.512437 0.536918 0.522052 0.536918 0.442785 0.597615 0.442785 0.476208 0.268825 0.415349 0.268825 0.473165 0.264851 0.418392 0.264851 0.405603 0.259185 0.405603 0.198988 0.409621 0.256175 0.409621 0.201998 0.670144 0.446876 0.67747 0.453425 0.360476 0.273442 0.335282 0.200016 0.672512 0.4547 0.668496 0.451111 0.627757 0.531257 0.622846 0.526399 0.62953 0.527022 0.627126 0.524645 0.334806 0.36045 0.326948 0.359049 0.633368 0.10539 0.6272 0.101388 0.304489 0.102529 0.294933 0.0893613 0.624194 0.356715 0.283252 0.0637235 0.28532 0.0801796 0.621819 0.362852 0.635856 0.366634 0.634181 0.37277 0.314272 0.34204 0.312696 0.348177 0.314322 0.355222 0.632305 0.111543 0.62589 0.107541 0.784937 0.111515 0.784937 0.0947717 0.829912 0.111297 0.829912 0.0945533 0.706492 0.0477321 0.689835 0.0477319 0.706275 0.00275482 0.689618 0.00275482 0.304432 0.047729 0.296386 0.0477289 0.304212 0.00275482 0.296166 0.00275482 0.784937 0.555286 0.784937 0.515511 0.829914 0.555068 0.829914 0.515293 0.357286 0.605038 0.35728 0.676984 0.0901731 0.955209 0.0650558 0.955169 0.0882876 0.953383 0.0669457 0.953346 0.0482547 0.734683 0.0479312 0.95335 0.0143752 0.954629 0.014698 0.733289 0.0635496 0.732641 0.0632365 0.95544 0.0610516 0.733215 0.0607336 0.954868 0.1534 0.708532 0.137682 0.7029 0.153836 0.707175 0.137955 0.701423 0.129223 0.953643 0.127819 0.953653 0.12748 0.731444 0.128883 0.731469 0.15774 0.975745 0.155698 0.976513 0.149436 0.955823 0.147621 0.955627 0.167108 0.972573 0.168591 0.972251 0.167807 0.974119 0.169073 0.973703 0.163059 0.953907 0.163049 0.955572 0.147224 0.729731 0.145384 0.72943 0.145069 0.730705 0.155834 0.707898 0.15541 0.709303 0.0582626 0.654623 0.0582679 0.637329 0.0167167 0.651558 0.016731 0.604762 0.55971 0.763565 0.538526 0.76374 0.496586 0.808896 0.502984 0.764022 0.49509 0.764319 0.494016 0.824513 0.493715 0.875075 0.493009 0.878414 0.480115 0.874883 0.479325 0.878087 0.525285 0.866436 0.483592 0.809589 0.284497 0.747548 0.284497 0.769043 0.613979 0.531766 0.611368 0.53228 0.394717 0.191912 0.394717 0.191912 0.394717 0.156019 0.394717 0.156019 0.48795 0.278565 0.485331 0.27908 0.843718 0.429031 0.84535 0.432724 0.889848 0.43323 0.886394 0.434914 0.848985 0.355219 0.84912 0.357912 0.843422 0.358166 0.847904 0.205534 0.8495 0.209744 0.840178 0.213965 0.841772 0.21817 0.847903 0.1631 0.840179 0.163099 0.618192 0.409545 0.618192 0.406476 0.759548 0.407876 0.761582 0.406025 0.331059 0.191912 0.252986 0.154346 0.767596 0.191912 0.767596 0.152943 0.768993 0.191912 0.768993 0.152943 0.238103 0.735266 0.453897 0.735266 0.238919 0.735266 0.453081 0.735266 0.408523 0.747548 0.249854 0.552643 0.249474 0.551372 0.650851 0.551372 0.65047 0.552643 0.23849 0.973574 0.45351 0.973574 0.768519 0.296332 0.767226 0.298223 0.767392 0.296332 0.766402 0.298223 0.681682 0.445342 0.650661 0.547176 0.012705 0.511053 0.00524889 0.503472 0.013867 0.508205 0.00805243 0.502293 0.116849 0.423846 0.112191 0.432603 0.118009 0.426695 0.205022 0.511121 0.116822 0.511093 0.205022 0.511113 0.013867 0.508212 0.0997442 0.508239 0.0997442 0.508232 0.203886 0.426722 0.118009 0.426702 0.203886 0.426729 0.890962 0.434621 0.893238 0.430239 0.887896 0.355699 0.848733 0.230142 0.841625 0.230146 0.848757 0.280535 0.84165 0.280539 0.59458 0.518088 0.539952 0.518088 0.539952 0.446749 0.527198 0.4524 0.531205 0.455401 0.481936 0.256175 0.249361 0.0637235 0.249361 0.0575705 0.580626 0.676958 0.580599 0.605047 0.0631066 0.980748 0.0649437 0.980413 0.0885853 0.734777 0.0672549 0.734742 0.0149333 0.954589 0.0152556 0.73333 0.0519633 0.732597 0.0544595 0.733188 0.0516361 0.955444 0.0541409 0.954871 0.191174 0.730366 0.2061 0.730602 0.191209 0.731812 0.205873 0.731876 0.130628 0.953623 0.130286 0.731505 0.15366 0.97724 0.145785 0.955906 0.137711 0.982428 0.137974 0.983912 0.136355 0.982974 0.136707 0.984328 0.164381 0.95556 0.149042 0.729564 0.189297 0.730336 0.189367 0.731796 0.044262 0.604771 0.560236 0.834029 0.538746 0.833394 0.479986 0.881322 0.493598 0.881782 0.525026 0.891498 0.527368 0.882551 0.53994 0.882345 0.480423 0.824571 0.481883 0.764888 0.517403 0.763706 0.560516 0.882757 0.560852 0.824439 0.540292 0.824276 0.844243 0.434117 0.841967 0.429668 0.84024 0.364329 0.853352 0.211493 0.845624 0.219913 0.860852 0.232013 0.863268 0.23093 0.859845 0.234642 0.859728 0.277048 0.866965 0.230942 0.866837 0.277065 0.618192 0.445342 0.0582764 0.609353 0.0582711 0.626647 0.159385 0.626679 0.15939 0.609385 0.173408 0.604811 0.0442477 0.651567 0.200939 0.60482 0.213326 0.690787 0.00328964 0.690721 0.520993 0.445342 0.520993 0.406476 0.249664 0.406476 0.244907 0.445342 0.244907 0.547176 0.24538 0.549486 0.246504 0.549486 0.213229 0.398983 0.21359 0.401254 0.00320285 0.401188 0.00356856 0.398917 0.651108 0.549486 0.653821 0.549486 0.209701 0.432641 0.209701 0.432634 0.839493 0.429762 0.89182 0.21153 0.891812 0.219957 0.603328 0.509435 0.607335 0.4524 0.481936 0.201998 0.368362 0.273809 0.364097 0.270785 0.383349 0.273809 0.385759 0.271425 0.340253 0.201295 0.385759 0.20008 0.34428 0.197696 0.383349 0.197696 0.390052 0.273183 0.385127 0.278054 0.648731 0.524007 0.686735 0.10539 0.678856 0.106795 0.347009 0.121152 0.331446 0.118985 0.665774 0.37477 0.650251 0.372609 0.301818 0.108682 0.316943 0.112634 0.315019 0.118787 0.665893 0.380906 0.682347 0.378746 0.681296 0.372609 0.334052 0.366587 0.32588 0.365186 0.679612 0.112948 0.687806 0.111543 0.784937 0.161554 0.784937 0.144897 0.829912 0.161335 0.829912 0.144679 0.756532 0.0477325 0.739825 0.0477323 0.756314 0.00275482 0.739607 0.00275482 0.360237 0.0477294 0.352531 0.0477294 0.360018 0.00275482 0.352312 0.00275482 0.784937 0.579292 0.784937 0.571656 0.829915 0.579074 0.829915 0.571438 0.784937 0.19468 0.784937 0.178211 0.829912 0.194461 0.829912 0.177992 0.0653704 0.732915 0.00985034 0.732778 0.00952579 0.955124 0.0546716 0.707986 0.0552079 0.708117 0.0557536 0.708166 0.0599445 0.733339 0.0600377 0.708183 0.177735 0.95393 0.177359 0.73166 0.178759 0.731677 0.154085 0.978623 0.162688 0.731577 0.1452 0.953339 0.146935 0.953352 0.145458 0.954621 0.147141 0.954525 0.130673 0.728414 0.130393 0.729946 0.129187 0.728442 0.128819 0.729785 0.189738 0.953883 0.189678 0.955345 0.161669 0.728213 0.537286 0.950028 0.55852 0.950563 0.525322 0.763692 0.519019 0.878991 0.518814 0.87545 0.540564 0.821064 0.528224 0.82103 0.52773 0.824554 0.52547 0.833486 0.518727 0.882566 0.517418 0.89173 0.559654 0.749825 0.53842 0.749973 0.55616 0.74248 0.541824 0.742578 0.524428 0.936125 0.516553 0.936067 0.50228 0.878555 0.502498 0.882039 0.560946 0.820931 0.408523 0.957379 0.284497 0.957379 0.284497 0.869352 0.618192 0.525529 0.617673 0.528112 0.520993 0.318516 0.59441 0.318516 0.492174 0.272312 0.491653 0.274902 0.848771 0.434446 0.842454 0.435886 0.848758 0.285089 0.848756 0.289642 0.84165 0.285089 0.841649 0.28964 0.840179 0.16025 0.847903 0.160251 0.7657 0.403408 0.764945 0.406014 0.762336 0.403408 0.250947 0.15249 0.247575 0.152479 0.2463 0.406476 0.244637 0.572435 0.244793 0.709697 0.249217 0.549486 0.453081 0.971263 0.238919 0.971263 0.764224 0.294016 0.767596 0.294016 0.764672 0.296332 0.650423 0.552643 0.651741 0.552643 0.651369 0.552643 0.362162 0.294016 0.35879 0.294016 0.212483 0.503537 0.20968 0.502356 0.212505 0.431455 0.108365 0.503522 0.108365 0.503504 0.108387 0.431536 0.108387 0.431422 0.20968 0.502363 0.203862 0.508272 0.112191 0.43261 0.117984 0.508245 0.11217 0.502333 0.415349 0.189348 0.644477 0.527022 0.366983 0.278054 0.640644 0.106795 0.291688 0.0955143 0.64944 0.378746 0.318951 0.361195 0.639871 0.112948 0.784937 0.128222 0.829912 0.128003 0.723149 0.0477322 0.722932 0.00275482 0.312756 0.047729 0.312536 0.00275482 0.784937 0.56361 0.829914 0.563392 0.0501426 0.732862 0.0498139 0.955176 0.0611245 0.70802 0.0605844 0.70814 0.0605024 0.733308 0.0606563 0.979994 0.130729 0.955176 0.144826 0.731981 0.176509 0.955457 0.177682 0.955447 0.187526 0.731777 0.187419 0.730307 0.131001 0.956705 0.540568 0.957483 0.554905 0.957841 0.502595 0.875044 0.284497 0.830457 0.616194 0.530302 0.616193 0.530302 0.618192 0.364542 0.49017 0.277098 0.895718 0.430441 0.892538 0.436604 0.866833 0.281607 0.859725 0.281608 0.766338 0.40601 0.767093 0.403408 0.25019 0.149866 0.244907 0.406476 0.249664 0.311357 0.361972 0.298223 0.361714 0.296332 0.764415 0.298223 0.764033 0.299498 0.764934 0.299498 0.520993 0.525529 0.521513 0.528112 0.522992 0.530302 0.358994 0.296332 0.205048 0.423874 0.100931 0.423964 0.100931 0.423841 0.00805243 0.5023 0.00807369 0.432577 0.840178 0.0988286 0.847903 0.107255 0.531205 0.509435 0.476208 0.189348 0.607335 0.512437 0.597615 0.522052 0.390052 0.198321 0.693414 0.101388 0.362573 0.118985 0.330392 0.125138 0.695761 0.366274 0.697679 0.372411 0.373687 0.366587 0.372917 0.36045 0.694753 0.107541 0.346889 0.127305 0.363387 0.125138 0.773275 0.0477326 0.773058 0.00275482 0.367828 0.0477295 0.367609 0.00275482 0.784937 0.586624 0.829915 0.586406 0.784937 0.210654 0.829912 0.210435 0.0904742 0.732954 0.191579 0.95388 0.191554 0.955329 0.160986 0.731596 0.127647 0.729803 0.156112 0.977958 0.158139 0.977293 0.492174 0.191912 0.859856 0.328151 0.859732 0.286168 0.866965 0.328127 0.86684 0.286149 0.762911 0.407836 0.764304 0.40782 0.246178 0.152475 0.2463 0.311357 0.244907 0.311357 0.25019 0.0575705 0.21351 0.00316012 0.213189 0.397685 0.0036889 0.00300418 0.00361069 0.397619 0.653655 0.551372 0.652833 0.551372 0.359984 0.298223 0.763986 0.299498 0.765307 0.299498 0.203862 0.508265 0.100904 0.511088 0.100904 0.511081 0.0138918 0.426669 0.0997691 0.426696 0.59458 0.446749 0.603328 0.455401 0.418392 0.193322 0.473165 0.193322 0.603534 0.0575705 0.41104 0.0575705 0.723704 0.327769 0.717713 0.343063 0.390436 0.349086 0.386325 0.355058 0.72565 0.311357 0.729363 0.317493 0.7273 0.333906 0.393408 0.348177 0.391907 0.355222 0.765053 0.0637235 0.765053 0.0575705 0.718636 0.0637235 0.71638 0.0575705 0.601278 0.0637235 0.414762 0.0637235 0.253477 0.67677 0.253396 0.605317 0.605627 0.0477313 0.418944 0.0477299 0.605409 0.00275482 0.418726 0.00275482 0.583683 0.57137 0.553788 0.571363 0.784937 0.49279 0.784937 0.485485 0.829914 0.492572 0.829914 0.485267 0.542487 0.585301 0.490317 0.585228 0.538494 0.576912 0.541465 0.580767 0.491324 0.58068 0.494112 0.576838 0.498257 0.574271 0.503134 0.573377 0.528746 0.573421 0.534023 0.574334 0.0601844 0.954773 0.0601208 0.979867 0.0636465 0.707317 0.176117 0.730128 0.163978 0.729936 0.129502 0.956641 0.12915 0.955287 0.17729 0.730147 0.163188 0.728331 0.162644 0.729915 0.161118 0.729836 0.618192 0.403408 0.394717 0.110897 0.418563 0.0647491 0.394717 0.110897 0.396721 0.277098 0.395238 0.274902 0.245421 0.149866 0.245421 0.0575705 0.246818 0.149866 0.246818 0.0575705 0.213381 0.511655 0.213356 0.59484 0.00334425 0.511589 0.00331889 0.594774 0.238919 0.830457 0.238919 0.869352 0.764224 0.191912 0.654945 0.549486 0.359161 0.298223 0.361079 0.299498 0.361452 0.299498 0.249902 0.552643 0.00295639 0.403456 0.213836 0.403522 0.00337652 0.405803 0.213413 0.405869 0.0997691 0.426689 0.00527084 0.431503 0.0127316 0.423937 0.116849 0.423969 0.205048 0.423997 0.485953 0.259185 0.27225 0.605173 0.272308 0.67688 0.0521586 0.707252 0.0503203 0.707582 0.0517686 0.980748 0.0542203 0.979994 0.162075 0.957335 0.163597 0.957223 0.492174 0.0647491 0.492174 0.152943 0.485953 0.198988 0.394717 0.272312 0.842622 0.343134 0.841625 0.340501 0.845034 0.344227 0.848731 0.344232 0.764224 0.152943 0.764224 0.0575705 0.362353 0.299498 0.212504 0.431568 0.697877 0.0953997 0.377006 0.112994 0.708182 0.356196 0.710846 0.362333 0.380173 0.359049 0.381234 0.365186 0.699394 0.101553 0.378686 0.119147 0.79005 0.0477327 0.789833 0.00275482 0.375253 0.0477295 0.375034 0.00275482 0.784937 0.622399 0.829915 0.622181 0.784937 0.262418 0.829913 0.2622 0.490324 0.696805 0.542518 0.696731 0.541489 0.701266 0.538517 0.705122 0.494119 0.705196 0.491332 0.701353 0.503151 0.708656 0.498266 0.707762 0.53405 0.707699 0.52877 0.708612 0.0654571 0.707679 0.0547589 0.979868 0.0596264 0.954741 0.207276 0.731838 0.136339 0.702314 0.105075 0.731439 0.103676 0.731385 0.104846 0.730149 0.103674 0.730167 0.483133 0.889889 0.762336 0.311357 0.763164 0.311357 0.767093 0.311357 0.7657 0.311357 0.394717 0.272312 0.012705 0.511061 0.212483 0.503555 0.699445 0.0883357 0.388699 0.10305 0.720949 0.3492 0.387632 0.361195 0.701024 0.0944887 0.391081 0.109203 0.80683 0.0477328 0.806613 0.00275482 0.382558 0.0477296 0.382339 0.00275482 0.583723 0.710636 0.55382 0.710654 0.784937 0.449099 0.829914 0.448881 0.34192 0.70618 0.273668 0.687465 0.33392 0.712564 0.277793 0.697327 0.32405 0.716406 0.284336 0.705797 0.31341 0.717789 0.292855 0.712297 0.302772 0.716387 0.0553034 0.979823 0.0595762 0.979823 0.105402 0.953469 0.105177 0.954759 0.127977 0.955261 0.104003 0.953516 0.136707 0.700971 0.767596 0.0575705 0.768993 0.294016 0.357393 0.294016 0.357867 0.296332 0.00524889 0.503489 0.272071 0.571688 0.453897 0.741407 0.238103 0.741407 0.401729 0.741407 0.290271 0.741407 0.341898 0.575852 0.333894 0.56947 0.273618 0.594586 0.324019 0.565632 0.277748 0.584724 0.313375 0.564251 0.284294 0.576253 0.302733 0.565656 0.292815 0.56975 0.049956 0.980402 0.207274 0.73062 0.480987 0.934778 0.768993 0.0575705 0.362401 0.299498 0.763164 0.317493 0.272222 0.710362 0.245643 0.0477285 0.245423 0.00275482 0.0229076 0.955499 0.02323 0.732448 0.020742 0.733178 0.0204208 0.954759 0.178463 0.730165 0.104005 0.954733 + + + + + + + + + + + + + + +

783 0 0 764 1 1 768 2 2 768 2 2 764 1 1 769 3 3 769 3 3 764 1 1 788 4 4 788 4 4 764 1 1 772 5 5 772 5 5 764 1 1 773 6 6 773 6 6 764 1 1 786 7 7 786 7 7 764 1 1 776 8 8 776 8 8 764 1 1 779 9 9 779 9 9 764 1 1 782 10 10 782 10 10 764 1 1 778 11 11 778 11 11 764 1 1 765 12 12 765 12 12 764 1 1 783 0 0 1022 10 0 1007 13 2 1003 1 1 1007 13 2 1008 14 3 1003 1 1 1008 14 3 1027 7 4 1003 1 1 1027 7 4 1011 15 5 1003 1 1 1011 15 5 1012 16 6 1003 1 1 1012 16 6 1025 4 7 1003 1 1 1025 4 7 1015 17 8 1003 1 1 1015 17 8 1018 18 9 1003 1 1 1018 18 9 1021 0 10 1003 1 1 1021 0 10 1017 19 11 1003 1 1 1017 19 11 1004 20 12 1003 1 1 1004 20 12 1022 10 0 1003 1 1 44 28 21 45 29 22 273 30 21 274 31 22 273 30 21 45 29 22 29 32 23 28 33 24 258 34 23 257 35 24 258 34 23 28 33 24 9 36 25 1 37 26 238 38 25 230 37 26 238 38 25 1 37 26 23 39 27 38 35 28 252 39 27 267 33 28 252 39 27 38 35 28 225 40 29 227 40 30 325 40 31 327 40 32 325 40 31 227 40 30 352 41 33 331 41 34 252 41 27 231 41 35 252 41 27 331 41 34 328 41 36 353 41 37 228 41 38 253 41 39 228 41 38 353 41 37 257 27 24 357 27 40 258 27 23 358 27 41 258 27 23 357 27 40 338 42 42 330 43 43 288 44 44 280 43 45 288 44 44 330 43 43 349 45 46 348 46 47 299 47 48 298 48 49 299 47 48 348 46 47 374 49 50 371 50 51 324 51 52 321 52 53 324 51 52 371 50 51 360 53 54 359 54 55 310 55 56 309 56 57 310 55 56 359 54 55 304 25 58 301 25 59 303 25 60 302 25 61 303 25 60 301 25 59 376 57 62 396 58 63 397 59 64 397 59 64 384 60 65 376 57 62 406 61 66 415 62 67 416 63 68 416 63 68 410 64 69 406 61 66 413 65 70 420 66 71 419 67 72 419 67 72 403 68 73 413 65 70 381 69 74 389 70 75 399 71 76 411 72 77 399 71 76 389 70 75 439 73 78 460 74 79 472 75 80 471 76 81 472 75 80 460 74 79 424 77 82 458 78 83 484 79 84 483 80 85 484 79 84 458 78 83 495 81 86 496 82 87 437 83 88 435 84 89 437 83 88 496 85 87 427 86 90 475 87 91 489 88 92 504 89 93 489 88 92 475 87 91 439 73 78 472 75 80 498 90 94 508 91 95 498 90 94 472 75 80 479 92 96 511 93 97 451 94 98 487 95 99 451 94 98 511 93 97 454 96 100 441 97 101 438 98 102 423 99 103 438 98 102 441 97 101 524 41 104 523 41 105 532 41 104 531 41 105 532 41 104 523 41 105 518 100 106 517 100 107 542 100 106 541 100 107 542 100 106 517 100 107 549 100 108 553 100 109 564 101 110 565 101 111 564 101 110 553 100 109 556 102 112 550 103 113 582 104 114 570 105 115 582 104 114 550 103 113 602 106 116 604 106 117 613 107 118 612 108 119 613 107 118 604 106 117 595 109 120 585 109 121 618 110 122 617 111 123 618 110 122 585 109 121 559 112 124 599 113 125 562 112 126 587 113 127 562 112 126 599 113 125 563 112 128 585 109 121 566 112 129 595 109 120 566 112 129 585 109 121 641 114 130 635 40 131 640 105 132 632 40 133 640 105 132 635 40 131 650 115 134 653 115 135 647 116 136 652 116 137 647 116 136 653 115 135 677 117 138 683 118 139 671 40 140 686 40 141 671 40 140 683 118 139 669 119 142 667 120 120 682 121 143 690 120 122 682 121 143 667 120 120 661 122 144 673 123 145 644 124 146 648 125 147 644 124 146 673 123 145 648 115 147 673 126 145 651 115 148 675 126 149 651 115 148 673 126 145 714 120 150 712 120 151 713 120 152 711 120 153 713 120 152 712 120 151 725 40 151 726 40 150 723 40 153 724 40 152 723 40 153 726 40 150 62 127 154 67 128 155 81 129 154 87 130 155 81 129 154 67 128 155 750 131 156 223 131 157 751 131 158 219 131 159 751 131 158 223 131 157 52 132 160 745 133 160 51 134 161 739 135 161 51 134 161 745 133 160 794 136 162 793 137 163 769 3 3 768 2 2 769 3 3 793 137 163 800 138 164 798 139 165 786 7 7 773 6 6 786 7 7 798 140 165 754 141 166 770 142 167 763 143 168 787 144 169 763 143 168 770 142 167 814 40 170 818 40 171 810 40 172 816 40 173 810 40 172 818 40 171 822 145 174 820 145 175 802 100 176 801 100 177 802 100 176 820 145 175 851 146 178 849 147 179 850 148 180 847 149 181 850 148 180 849 147 179 829 150 182 827 151 183 845 152 184 843 153 185 845 152 184 827 151 183 858 154 186 860 155 187 695 40 188 693 40 189 695 40 188 860 155 187 859 156 190 873 157 191 869 158 192 877 159 193 869 158 192 873 157 191 713 100 152 724 100 152 880 100 194 721 100 194 880 100 194 724 100 152 900 160 195 903 161 196 912 162 197 915 163 198 912 162 197 903 161 196 913 164 199 901 165 200 900 160 201 900 160 201 912 162 202 913 164 199 918 100 203 913 164 199 912 162 202 912 162 202 917 100 204 918 100 203 834 166 205 923 167 206 837 168 207 922 169 208 837 168 207 923 167 206 1026 184 169 1010 185 236 1034 186 237 1035 187 238 1034 188 237 1010 185 236 1024 189 239 1014 190 240 1039 191 164 1028 192 241 1039 191 164 1014 190 240 1005 193 242 1016 194 243 991 195 244 998 196 245 991 195 244 1016 194 243 1045 40 246 1042 40 247 1053 40 170 1049 40 172 1053 40 170 1042 40 247 37 201 270 43 202 271 266 203 270 272 204 271 266 203 270 43 202 271 31 205 272 30 206 273 260 207 272 259 208 273 260 207 272 30 206 273 7 209 274 8 210 275 236 211 274 237 212 275 236 211 274 8 210 275 19 213 276 2 214 35 248 215 276 231 214 35 248 215 276 2 214 35 230 27 26 330 27 277 238 27 25 338 27 278 238 27 25 330 27 277 248 41 276 348 41 279 249 41 280 349 41 281 249 41 280 348 41 279 271 41 282 371 41 283 274 41 22 374 41 284 274 41 22 371 41 283 360 27 285 260 27 272 359 27 286 259 27 273 359 27 286 260 27 272 336 216 287 337 217 288 286 218 289 287 219 290 286 218 289 337 217 288 343 220 291 350 221 292 293 222 293 300 223 294 293 222 293 350 221 292 372 224 295 373 225 296 322 226 297 323 227 298 322 226 297 373 225 296 356 228 299 355 229 300 306 230 301 305 231 302 306 230 301 355 229 300 281 25 303 302 25 61 282 25 304 301 25 59 282 25 304 302 25 61 395 232 305 392 233 306 382 234 307 380 235 308 382 234 307 392 233 306 386 236 309 378 237 310 384 60 65 376 57 62 384 60 65 378 237 310 417 238 311 399 71 76 411 72 77 411 72 77 422 239 312 417 238 311 387 240 313 379 241 314 408 242 315 402 243 316 408 242 315 379 241 314 461 244 317 443 245 318 470 76 319 469 246 320 470 76 319 443 245 318 482 247 321 430 248 322 445 249 323 445 249 323 481 250 324 482 247 321 457 251 325 493 251 326 432 252 327 494 253 328 432 252 327 493 251 326 425 254 329 485 255 330 484 256 331 503 257 332 484 256 331 485 255 330 437 83 88 502 258 333 495 259 86 507 260 334 495 261 86 502 258 333 465 262 335 511 263 97 449 264 336 492 265 337 449 264 336 511 263 97 514 76 338 466 266 339 470 76 319 461 244 317 470 76 319 466 266 339 526 27 340 525 27 341 534 27 340 533 27 341 534 27 340 525 27 341 522 27 342 521 27 343 546 27 342 545 27 343 546 27 342 521 27 343 559 112 124 562 112 126 548 100 344 554 100 345 548 100 344 562 112 126 579 267 148 567 268 346 555 269 347 547 270 348 555 269 347 567 268 346 604 271 117 606 272 349 612 273 119 611 118 139 612 273 119 606 272 349 583 274 350 607 275 351 585 40 352 617 40 353 585 40 352 607 275 351 595 120 120 597 276 142 566 120 129 574 277 354 566 120 129 597 276 142 567 268 346 605 117 138 559 40 355 599 40 140 559 40 355 605 117 138 621 100 108 625 100 109 636 101 110 637 101 111 636 101 110 625 100 109 628 102 112 622 103 113 654 104 114 642 105 115 654 104 114 622 103 113 674 106 116 676 106 117 685 107 118 684 108 119 685 107 118 676 106 117 667 109 120 657 109 121 690 110 122 689 111 123 690 110 122 657 109 121 631 112 124 671 113 125 634 112 126 659 113 127 634 112 126 671 113 125 635 112 128 657 109 121 638 112 129 667 109 120 638 112 129 657 109 121 707 40 356 717 40 151 708 40 357 715 40 153 708 40 357 717 40 151 711 100 153 723 100 153 713 100 152 724 100 152 713 100 152 723 100 153 64 278 358 63 279 359 90 280 358 84 281 359 90 280 358 63 279 359 748 282 360 46 282 361 749 282 362 220 131 363 749 282 362 46 282 361 742 283 364 55 284 364 736 285 365 50 286 365 736 285 365 55 284 364 779 9 9 782 10 10 790 287 366 791 288 367 790 287 366 782 10 10 799 289 368 797 290 369 783 0 0 765 12 12 783 0 0 797 291 369 756 292 370 774 293 371 762 294 372 785 295 239 762 294 372 774 293 371 812 120 373 817 120 374 808 120 375 815 120 376 808 120 375 817 120 374 821 296 377 812 120 373 819 297 378 808 120 375 819 297 378 812 120 373 221 27 379 224 27 380 832 298 381 830 299 382 832 298 381 224 27 380 46 41 361 848 300 383 220 41 363 846 301 384 220 41 363 848 300 383 872 302 385 867 303 386 862 304 387 864 305 388 862 304 387 867 303 386 226 25 389 228 25 390 865 25 391 856 25 392 865 25 391 228 25 390 880 27 194 721 27 194 706 27 393 722 27 393 706 27 393 721 27 194 911 306 394 899 307 395 893 308 396 893 308 396 905 309 397 911 306 394 901 165 200 889 310 398 888 311 399 888 311 399 900 160 201 901 165 200 889 310 400 901 165 401 892 312 402 904 313 403 892 312 402 901 165 401 837 314 207 922 315 208 833 316 404 921 317 405 833 316 404 922 315 208 1026 330 169 1034 331 237 1009 332 167 1033 333 162 1009 332 167 1034 331 237 1023 334 422 1006 335 423 1038 336 368 1032 337 163 1038 336 368 1006 335 423 1013 338 371 1010 185 236 995 339 370 994 340 424 995 339 370 1010 185 236 1042 25 425 1043 25 426 1049 341 427 1046 342 428 1049 341 427 1043 25 426 43 202 271 44 28 21 272 204 271 273 30 21 272 204 271 44 28 21 30 206 273 29 32 23 259 208 273 258 34 23 259 208 273 29 32 23 8 210 275 9 36 25 237 212 275 238 38 25 237 212 275 9 36 25 2 25 35 23 25 27 231 25 35 252 25 27 231 25 35 23 25 27 325 27 435 330 27 277 225 27 436 230 27 26 225 27 436 330 27 277 231 41 35 331 41 34 248 41 276 348 41 279 248 41 276 331 41 34 253 41 39 353 41 37 271 41 282 371 41 283 271 41 282 353 41 37 359 27 286 259 27 273 358 27 41 258 27 23 358 27 41 259 27 273 337 217 288 338 42 42 287 219 290 288 44 44 287 219 290 338 42 42 350 221 292 349 45 46 300 223 294 299 47 48 300 223 294 349 45 46 373 225 296 374 49 50 323 227 298 324 51 52 323 227 298 374 49 50 355 229 300 360 53 54 305 231 302 310 55 56 305 231 302 360 53 54 276 25 437 304 25 58 278 25 438 303 25 60 278 25 438 304 25 58 381 344 439 379 345 314 395 346 440 392 347 306 395 346 440 379 345 314 390 348 441 382 234 307 388 349 442 380 235 308 388 349 442 382 234 307 400 350 443 417 238 311 422 239 312 422 239 312 412 351 444 400 350 443 385 352 445 409 353 446 377 352 447 405 354 448 377 352 447 409 353 446 470 355 449 469 356 450 462 357 451 442 358 452 462 357 451 469 356 450 431 359 453 482 360 321 481 361 324 481 361 324 447 362 454 431 359 453 493 251 326 456 251 455 494 253 328 433 363 456 494 253 328 456 251 455 426 364 457 489 365 458 464 366 459 504 367 460 464 366 459 489 365 458 438 98 102 486 368 461 502 258 333 507 369 334 502 258 333 486 370 461 450 371 462 487 372 99 465 262 335 511 263 97 465 262 335 487 372 99 514 355 463 470 355 449 473 357 464 462 357 451 473 357 464 470 355 449 525 25 341 524 25 104 533 25 341 532 25 104 533 25 341 524 25 104 521 25 343 520 25 465 545 25 343 544 25 465 545 25 343 520 25 465 563 112 128 566 112 129 560 101 466 561 101 467 560 101 466 566 112 129 581 373 135 569 114 130 580 104 137 568 105 132 580 104 137 569 114 130 611 118 139 605 117 138 612 273 119 603 374 149 612 273 119 605 117 138 617 40 353 607 275 351 586 40 468 584 375 469 586 40 468 607 275 351 573 376 470 598 377 471 565 120 111 596 120 472 565 120 111 598 377 471 568 105 132 560 40 133 606 272 349 600 40 473 606 272 349 560 40 133 639 268 346 631 40 355 619 270 348 620 40 474 619 270 348 631 40 355 648 115 147 651 115 148 629 25 475 627 25 347 629 25 475 651 115 148 685 107 118 684 108 119 673 126 145 675 126 149 673 126 145 684 108 119 690 110 122 689 111 123 668 378 472 658 378 476 668 378 472 689 111 123 672 379 477 632 101 466 660 379 478 633 101 467 660 379 478 632 101 466 658 378 476 636 101 110 668 378 472 637 101 111 668 378 472 636 101 110 718 40 150 710 40 393 716 40 152 709 40 194 716 40 152 710 40 393 726 41 150 718 41 150 724 41 152 716 41 152 724 41 152 718 41 150 63 279 359 62 127 154 84 281 359 81 129 154 84 281 359 62 127 154 749 282 362 220 131 363 750 131 156 223 131 157 750 131 156 220 131 363 51 134 161 739 135 161 50 286 365 736 285 365 50 286 365 739 135 161 781 380 479 780 381 480 791 336 367 790 382 366 791 336 367 780 381 480 784 383 422 766 384 242 799 385 368 797 386 369 799 387 368 766 384 242 762 388 372 785 389 239 757 390 481 775 391 240 757 390 481 785 389 239 811 120 482 807 120 483 817 120 374 815 120 376 817 120 374 807 120 483 823 27 484 822 27 485 821 27 486 812 392 487 821 27 486 822 27 485 822 27 485 802 27 488 812 392 487 813 393 489 812 392 487 802 27 488 58 27 490 221 27 379 833 316 404 832 298 381 833 316 404 221 27 379 520 120 465 529 120 491 530 120 492 527 120 493 528 120 494 516 120 495 519 120 496 520 120 465 530 120 492 527 120 493 516 120 495 517 120 107 518 120 106 515 120 497 827 151 183 524 120 104 527 120 493 517 120 107 523 120 105 524 120 104 517 120 107 518 120 106 827 151 183 825 394 498 517 120 107 518 120 106 825 394 498 517 120 107 825 394 498 841 395 499 530 120 492 527 120 493 524 120 104 530 120 492 524 120 104 525 120 341 519 120 496 530 120 492 525 120 341 519 120 496 525 120 341 526 120 340 827 151 183 515 120 497 516 120 495 522 120 342 519 120 496 526 120 340 516 120 495 528 120 494 529 120 491 516 120 495 529 120 491 520 120 465 843 153 185 827 151 183 516 120 495 843 153 185 516 120 495 520 120 465 843 153 185 520 120 465 521 120 343 843 153 185 521 120 343 522 120 342 841 395 499 843 153 185 522 120 342 841 395 499 522 120 342 526 120 340 841 395 499 526 120 340 523 120 105 841 395 499 523 120 105 517 120 107 60 27 500 859 156 190 71 27 501 857 396 502 71 27 501 859 156 190 869 397 192 877 398 193 860 155 503 874 399 504 860 155 503 877 398 193 879 100 357 720 100 357 711 100 153 723 100 153 711 100 153 720 100 357 899 307 395 911 306 394 903 161 196 915 163 198 903 161 196 911 306 394 874 399 504 877 398 193 888 311 505 891 400 506 888 311 505 877 398 193 906 401 507 894 402 508 897 403 509 897 403 509 909 404 510 906 401 507 921 317 405 922 315 208 881 405 511 883 406 512 881 405 511 922 315 208 1034 138 237 1035 416 238 1027 7 4 1011 15 5 1027 7 4 1035 417 238 1015 17 8 1025 4 7 1028 192 241 1039 418 164 1028 192 241 1025 4 7 1019 419 480 1014 190 240 997 420 515 996 421 481 997 420 515 1014 190 240 1044 120 516 1050 120 482 1043 120 517 1046 120 483 1043 120 517 1050 120 482 33 204 532 27 203 533 262 202 532 256 201 533 262 202 532 27 203 533 5 427 534 4 428 535 234 429 534 233 430 535 234 429 534 4 428 535 14 429 536 21 431 537 243 427 536 250 432 537 243 427 536 21 431 537 236 27 274 336 27 538 235 27 539 335 27 540 235 27 539 336 27 538 343 41 541 342 41 542 243 41 536 242 41 543 243 41 536 342 41 542 366 41 544 266 41 270 372 41 545 272 41 271 372 41 545 266 41 270 356 27 546 362 27 547 256 27 533 262 27 532 256 27 533 362 27 547 334 222 548 333 433 549 284 220 550 283 434 551 284 220 550 333 433 549 345 218 552 344 435 553 295 216 554 294 436 555 295 216 554 344 435 553 370 55 556 365 231 557 320 53 558 315 229 559 320 53 558 365 231 557 364 51 560 363 227 561 314 49 562 313 225 563 314 49 562 363 227 561 340 47 564 341 223 565 290 45 566 291 221 567 290 45 566 341 223 565 380 235 308 392 233 306 391 437 568 391 437 568 388 349 442 380 235 308 398 438 569 389 70 75 381 69 74 381 69 74 395 439 570 398 438 569 409 440 446 414 440 571 416 441 68 420 442 572 416 441 68 414 440 571 410 443 69 413 444 573 407 445 574 412 446 575 407 445 574 413 444 573 466 266 339 465 262 335 461 244 317 449 264 336 461 244 317 465 262 335 424 77 82 478 447 576 477 448 577 477 448 577 440 449 578 424 77 82 490 450 579 489 365 458 456 251 455 426 364 457 456 251 455 489 365 458 438 98 102 502 258 333 501 451 580 501 451 580 454 96 100 438 98 102 434 452 581 480 453 582 467 454 583 506 455 584 467 454 583 480 453 582 446 456 585 491 457 586 500 458 587 510 459 588 500 458 587 491 457 586 474 460 589 513 461 590 458 78 83 483 80 85 458 78 83 513 461 590 439 73 78 453 462 591 460 74 79 450 371 462 460 74 79 453 462 591 536 120 494 535 120 493 537 120 491 538 120 492 537 120 491 535 120 493 552 27 592 553 27 109 550 27 593 549 27 108 550 27 593 553 27 109 572 277 146 576 463 147 551 464 594 557 465 475 551 464 594 576 463 147 610 466 143 609 467 595 597 276 142 591 468 596 597 276 142 609 467 595 616 120 597 588 120 478 615 469 598 590 470 599 615 469 598 588 120 478 571 376 600 590 470 599 561 120 467 588 120 478 561 120 467 590 470 599 598 377 471 573 376 470 592 471 601 577 472 602 592 471 601 573 376 470 619 41 603 623 41 604 627 41 605 629 41 606 627 41 605 623 41 604 624 473 607 630 474 608 645 475 470 649 476 602 645 475 470 630 474 608 680 477 609 681 478 595 666 479 610 664 479 601 666 479 610 681 478 595 688 480 597 686 481 611 660 379 478 672 379 477 660 379 478 686 481 611 664 479 601 649 116 602 666 479 610 654 116 114 666 479 610 649 116 602 654 104 114 642 105 115 666 482 610 656 375 469 666 482 610 642 105 115 698 40 612 697 40 613 699 40 189 700 40 614 699 40 189 697 40 613 706 25 393 722 25 393 714 25 150 726 25 150 714 25 150 722 25 393 59 483 615 66 484 616 83 483 615 88 485 616 83 483 615 66 484 616 78 100 617 77 100 617 80 100 618 75 100 618 80 100 618 77 100 617 737 486 619 49 487 619 740 488 620 57 489 620 740 488 620 49 487 619 780 381 480 775 391 240 790 490 366 789 491 241 790 490 366 775 391 240 766 384 242 777 492 243 797 493 369 792 494 621 797 493 369 777 492 243 760 495 622 781 496 479 759 497 245 777 492 243 759 497 245 781 496 479 816 498 623 809 499 624 815 498 625 808 500 626 815 498 625 809 499 624 819 297 378 824 501 627 821 296 377 823 501 628 821 296 377 824 501 627 839 502 629 835 503 630 828 504 631 830 299 382 828 504 631 835 503 630 846 505 384 850 506 180 844 507 632 854 508 633 844 507 632 850 506 180 857 396 502 859 156 190 870 509 634 869 158 192 870 509 634 859 156 190 227 25 30 225 25 29 825 25 635 841 25 636 825 25 635 225 25 29 879 120 357 711 120 153 705 120 356 712 120 151 705 120 356 711 120 153 899 307 395 887 510 637 881 405 511 881 405 511 893 308 396 899 307 395 888 311 399 889 310 398 874 399 638 875 511 639 874 399 638 889 310 398 876 512 640 878 513 641 890 514 642 892 515 402 890 514 642 878 513 641 919 100 643 905 309 397 906 401 644 907 516 645 906 401 644 905 309 397 926 517 646 925 518 647 848 519 383 851 520 178 848 519 383 925 518 647 1033 333 162 1008 14 3 1032 337 163 1007 13 2 1032 337 163 1008 14 3 1039 538 164 1025 4 7 1037 539 165 1012 16 6 1037 540 165 1025 4 7 993 541 166 1002 388 168 1009 332 167 1026 330 169 1009 332 167 1002 388 168 1053 40 170 1049 40 172 1057 40 171 1055 40 173 1057 40 171 1049 40 172 1061 145 174 1041 100 176 1059 145 175 1040 100 177 1059 145 175 1041 100 176 27 203 533 26 544 663 256 201 533 255 545 663 256 201 533 26 544 663 4 428 535 6 546 539 233 430 535 235 547 539 233 430 535 6 546 539 21 431 537 20 548 280 250 432 537 249 549 280 250 432 537 20 548 280 237 27 275 337 27 664 236 27 274 336 27 538 236 27 274 337 27 664 343 41 541 243 41 536 350 41 665 250 41 537 350 41 665 243 41 536 372 41 545 272 41 271 373 41 666 273 41 21 373 41 666 272 41 271 355 27 667 356 27 546 255 27 663 256 27 533 255 27 663 356 27 546 333 433 549 335 436 668 283 434 551 285 435 669 283 434 551 335 436 668 344 435 553 342 434 670 294 436 555 292 433 671 294 436 555 342 434 670 365 231 557 366 230 672 315 229 559 316 228 673 315 229 559 366 230 672 363 227 561 362 226 674 313 225 563 312 224 675 313 225 563 362 226 674 341 223 565 334 222 548 291 221 567 284 220 550 291 221 567 334 222 548 386 236 309 393 550 676 394 551 677 394 551 677 378 237 310 386 236 309 397 59 64 393 550 676 384 60 65 386 236 309 384 60 65 393 550 676 411 552 678 408 553 315 422 554 679 421 555 680 422 554 679 408 553 315 379 345 314 381 344 439 402 556 316 399 557 681 402 556 316 381 344 439 431 359 453 434 452 581 468 558 682 467 454 583 468 558 682 434 452 581 480 453 582 434 452 581 448 559 683 448 559 683 479 92 96 480 453 582 448 559 683 447 362 454 492 560 337 491 561 586 492 560 337 447 362 454 423 99 103 478 562 576 485 563 684 503 564 685 485 563 684 478 562 576 496 85 87 506 455 584 435 84 89 480 453 582 435 84 89 506 455 584 447 362 454 481 361 324 491 561 586 510 565 588 491 561 586 481 361 324 473 357 464 459 566 686 514 355 463 471 567 687 514 355 463 459 566 686 429 568 688 433 363 456 426 364 457 456 251 455 426 364 457 433 363 456 520 41 465 519 41 496 544 41 465 543 41 496 544 41 465 519 41 496 552 27 592 550 27 593 558 27 689 556 27 690 558 27 689 550 27 593 574 277 354 578 463 134 571 376 600 575 472 136 571 376 600 578 463 134 593 569 691 591 569 596 608 477 609 609 478 595 608 477 609 591 569 596 587 113 127 599 113 125 616 480 597 614 481 611 616 480 597 599 113 125 578 115 134 591 569 596 581 115 135 593 569 691 581 115 135 591 569 596 581 373 135 593 570 691 569 114 130 583 274 350 569 114 130 593 570 691 631 112 124 634 112 126 620 100 344 626 100 345 620 100 344 634 112 126 651 267 148 639 268 346 627 269 347 619 270 348 627 269 347 639 268 346 676 271 117 678 272 349 684 273 119 683 118 139 684 273 119 678 272 349 655 274 350 679 275 351 657 40 352 689 40 353 657 40 352 679 275 351 667 120 120 669 119 142 638 120 129 646 124 354 638 120 129 669 119 142 639 268 346 677 117 138 631 40 355 671 40 140 631 40 355 677 117 138 699 40 189 700 40 614 701 40 188 702 40 692 701 40 188 700 40 614 722 25 393 710 25 393 726 25 150 718 25 150 726 25 150 710 25 393 66 484 616 65 571 693 88 485 616 89 572 694 88 485 616 65 571 693 80 573 618 75 574 618 79 575 695 76 576 695 79 575 695 75 574 618 740 488 620 57 489 620 741 577 696 56 578 696 741 577 696 57 489 620 791 579 367 782 10 10 792 580 621 778 11 11 792 581 621 782 10 10 798 582 165 796 583 238 773 6 6 772 5 5 773 6 6 796 583 238 767 584 423 753 585 697 784 586 422 761 587 698 784 586 422 753 585 697 813 393 489 818 588 699 812 392 487 817 588 700 812 392 487 818 588 699 824 589 627 820 145 175 823 589 628 822 145 174 823 589 628 820 145 175 835 590 630 839 591 629 829 150 701 827 151 702 829 150 701 839 591 629 223 41 157 844 507 632 219 41 159 842 592 703 219 41 159 844 507 632 870 397 634 869 397 192 858 154 704 860 155 503 858 154 704 869 397 192 24 25 39 855 25 705 253 25 39 228 25 38 253 25 39 855 25 705 713 120 152 880 120 194 714 120 150 706 120 393 714 120 150 880 120 194 896 593 706 884 594 707 890 514 642 890 514 642 902 595 708 896 593 706 873 157 191 887 510 637 877 159 193 891 596 506 877 159 193 887 510 637 902 595 708 904 313 403 914 597 709 916 598 710 914 597 709 904 313 403 66 27 616 59 27 615 164 27 267 873 157 191 859 156 190 60 27 500 66 27 616 164 27 267 165 27 266 873 157 191 60 27 500 61 27 711 65 27 693 66 27 616 165 27 266 64 27 358 65 27 693 165 27 266 163 27 20 164 27 267 59 27 615 163 27 20 59 27 615 58 27 490 170 27 19 163 27 20 58 27 490 170 27 19 58 27 490 833 316 404 169 27 260 170 27 19 833 316 404 168 27 261 169 27 260 833 316 404 63 27 359 64 27 358 165 27 266 63 27 359 165 27 266 166 27 14 168 27 261 833 316 404 921 317 405 167 27 13 168 27 261 921 317 405 166 27 14 167 27 13 921 317 405 63 27 359 166 27 14 921 317 405 62 27 154 63 27 359 921 317 405 62 27 154 921 317 405 873 157 191 873 157 191 61 27 711 69 27 712 873 157 191 69 27 712 68 27 713 873 157 191 68 27 713 67 27 155 873 157 191 67 27 155 62 27 154 926 517 646 884 594 707 925 518 647 886 599 714 925 518 647 884 594 707 1009 332 167 1033 333 162 1006 335 423 1032 337 163 1006 335 423 1033 333 162 1024 608 239 1039 609 164 1013 338 371 1037 610 165 1013 338 371 1039 611 164 1002 294 168 994 340 424 1026 184 169 1010 185 236 1026 184 169 994 340 424 1055 40 173 1048 40 720 1057 40 171 1052 40 721 1057 40 171 1048 40 720 34 30 727 33 204 532 263 28 727 262 202 532 263 28 727 33 204 532 12 432 728 5 427 534 241 431 728 234 429 534 241 431 728 5 427 534 13 430 543 14 429 536 242 428 543 243 427 536 242 428 543 14 429 536 235 27 539 335 27 540 233 27 535 333 27 729 233 27 535 335 27 540 244 41 730 242 41 543 344 41 731 342 41 542 344 41 731 242 41 543 366 41 544 365 41 732 266 41 270 265 41 733 266 41 270 365 41 732 263 27 727 262 27 532 363 27 734 362 27 547 363 27 734 262 27 532 334 27 735 341 27 736 234 27 534 241 27 728 234 27 534 341 27 736 346 219 737 345 218 552 296 217 738 295 216 554 296 217 738 345 218 552 369 56 739 370 55 556 319 54 740 320 53 558 319 54 740 370 55 556 361 52 741 364 51 560 311 50 742 314 49 562 311 50 742 364 51 560 339 48 743 340 47 564 289 46 744 290 45 566 289 46 744 340 47 564 392 615 306 379 241 314 387 240 313 387 240 313 391 615 568 392 615 306 390 348 441 398 616 745 395 232 305 395 232 305 382 234 307 390 348 441 416 441 68 420 442 572 410 443 69 413 444 573 410 443 69 420 442 572 413 65 70 403 68 73 412 351 444 400 350 443 412 351 444 403 68 73 460 74 79 450 371 462 466 266 339 465 262 335 466 266 339 450 371 462 478 562 576 423 99 103 441 97 101 441 97 101 477 617 577 478 562 576 455 618 746 427 86 90 490 461 747 489 88 92 490 461 747 427 86 90 502 258 333 437 83 88 452 619 748 452 619 748 501 451 580 502 258 333 467 620 583 506 621 584 433 363 456 494 253 328 433 363 456 506 621 584 445 249 323 500 622 749 481 250 324 510 623 588 481 250 324 500 622 749 493 251 326 457 251 325 513 450 750 483 450 751 513 450 750 457 251 325 461 244 317 449 264 336 443 245 318 446 456 585 443 245 318 449 264 336 532 120 104 531 120 105 533 120 341 534 120 340 533 120 341 531 120 105 554 41 345 551 41 604 548 41 344 547 41 603 548 41 344 551 41 604 553 120 109 552 624 607 565 120 111 573 376 470 565 120 111 552 624 607 592 471 601 609 467 595 598 377 471 610 466 143 598 377 471 609 467 595 589 625 144 587 120 127 615 469 598 616 120 597 615 469 598 587 120 127 587 120 127 589 625 144 562 120 126 572 277 146 562 120 126 589 625 144 597 276 142 591 468 596 574 277 354 578 463 134 574 277 354 591 468 596 624 27 592 622 27 593 630 27 689 628 27 690 630 27 689 622 27 593 646 124 354 650 125 134 643 475 600 647 476 136 643 475 600 650 125 134 665 569 691 663 569 596 680 477 609 681 478 595 680 477 609 663 569 596 659 113 127 671 113 125 688 480 597 686 481 611 688 480 597 671 113 125 650 115 134 663 569 596 653 115 135 665 569 691 653 115 135 663 569 596 653 373 135 665 570 691 641 114 130 655 274 350 641 114 130 665 570 691 694 27 614 696 27 692 700 27 614 702 27 692 700 27 614 696 27 692 725 25 151 717 25 151 719 25 356 707 25 356 719 25 356 717 25 151 729 626 490 58 627 490 83 483 615 59 483 615 83 483 615 58 627 490 728 628 501 71 629 501 78 629 617 77 629 617 78 629 617 71 629 501 746 630 752 48 631 752 737 486 619 49 487 619 737 486 619 48 631 752 790 382 366 789 632 241 779 9 9 776 8 8 779 9 9 789 632 241 797 633 369 792 634 621 765 12 12 778 11 11 765 12 12 792 634 621 758 635 515 780 381 480 760 636 622 781 380 479 760 636 622 780 381 480 810 637 427 816 638 623 807 639 428 815 638 625 807 639 428 816 638 623 805 100 753 811 640 754 806 100 755 814 641 756 806 100 755 811 640 754 837 642 207 836 643 757 834 644 205 831 645 758 834 644 205 836 643 757 845 152 759 854 646 633 847 149 181 850 148 180 847 149 181 854 646 633 871 397 760 870 397 634 856 154 761 858 154 704 856 154 761 870 397 634 1 25 26 840 25 762 230 25 26 225 25 436 230 25 26 840 25 762 880 41 194 695 41 188 703 41 194 701 41 188 703 41 194 695 41 188 917 100 763 919 100 764 918 100 765 920 100 766 918 100 765 919 100 764 894 402 767 906 401 644 895 647 768 907 516 645 895 647 768 906 401 644 886 648 714 884 594 707 898 649 769 896 593 706 898 649 769 884 594 707 918 100 770 914 597 709 913 164 771 916 598 710 913 164 771 914 597 709 876 512 640 890 514 642 884 594 707 884 594 707 926 517 646 876 512 640 1020 663 479 1030 664 367 1019 419 480 1029 665 366 1019 419 480 1030 664 367 1023 666 422 1038 667 368 1005 193 242 1036 668 369 1005 193 242 1038 669 368 1001 143 372 996 421 481 1024 189 239 1014 190 240 1024 189 239 996 421 481 1054 120 376 1046 120 483 1056 120 374 1050 120 482 1056 120 374 1046 120 483 1062 41 484 1060 41 486 1061 41 485 1041 41 488 1061 41 485 1060 41 486 1060 41 486 1051 670 487 1041 41 488 1052 670 489 1041 41 488 1051 670 487 42 671 282 24 672 39 271 673 282 253 672 39 271 673 282 24 672 39 22 25 781 3 25 782 251 25 781 232 25 782 251 25 781 3 25 782 18 38 783 17 212 784 247 36 783 246 210 784 247 36 783 17 212 784 39 34 785 40 208 786 268 32 785 269 206 786 268 32 785 40 208 786 229 41 787 247 41 783 329 41 788 347 41 789 329 41 788 247 41 783 267 41 28 268 41 785 367 41 790 368 41 791 367 41 790 268 41 785 326 27 792 226 27 793 354 27 794 254 27 795 354 27 794 226 27 793 351 27 796 251 27 781 332 27 797 232 27 782 332 27 797 251 27 781 325 25 31 327 25 32 275 25 798 277 25 799 275 25 798 327 25 32 331 25 800 352 25 801 281 25 802 302 25 803 281 25 802 352 25 801 328 25 804 278 25 438 353 25 805 303 25 60 353 25 805 278 25 438 358 674 806 357 675 807 308 676 808 307 677 809 308 676 808 357 675 807 321 27 810 303 27 60 302 27 61 321 27 810 302 27 61 317 27 811 323 27 812 324 27 813 321 27 810 323 27 812 321 27 810 317 27 811 317 27 811 318 27 814 319 27 815 323 27 812 317 27 811 319 27 815 319 27 815 320 27 816 315 27 817 316 27 818 322 27 819 323 27 812 323 27 812 319 27 815 315 27 817 315 27 817 316 27 818 323 27 812 394 551 677 396 58 63 378 237 310 376 57 62 378 237 310 396 58 63 402 556 316 399 557 681 418 678 820 417 679 821 418 678 820 399 557 681 421 680 680 408 242 315 402 243 316 402 243 316 418 681 820 421 680 680 389 682 822 387 683 313 411 552 678 408 553 315 411 552 678 387 683 313 474 460 589 458 78 83 459 566 686 459 566 686 473 357 464 474 460 589 423 99 103 485 563 684 438 98 102 486 368 461 438 98 102 485 563 684 441 97 101 454 96 100 498 684 823 497 685 824 498 684 823 454 96 100 429 568 688 463 686 825 468 687 682 505 688 826 468 687 682 463 686 825 441 97 101 498 684 823 477 617 577 508 689 827 477 617 577 498 684 823 497 690 828 512 691 829 453 462 591 488 692 830 453 462 591 512 691 829 447 362 454 448 559 683 431 359 453 434 452 581 431 359 453 448 559 683 530 27 492 529 27 491 538 27 492 537 27 491 538 27 492 529 27 491 516 25 495 515 25 497 540 25 495 539 25 497 540 25 495 515 25 497 569 114 130 563 40 131 568 105 132 560 40 133 568 105 132 563 40 131 578 115 134 581 115 135 575 116 136 580 116 137 575 116 136 581 115 135 605 117 138 611 118 139 599 40 140 614 40 141 599 40 140 611 118 139 597 276 142 595 120 120 610 466 143 618 120 122 610 466 143 595 120 120 589 625 144 601 693 145 572 277 146 576 463 147 572 277 146 601 693 145 576 115 147 601 126 145 579 115 148 603 126 149 579 115 148 601 126 145 634 120 126 644 124 146 626 120 345 623 694 594 626 120 345 644 124 146 666 482 610 656 375 469 680 695 609 679 275 351 680 695 609 656 375 469 674 696 116 685 697 118 662 698 599 687 699 598 662 698 599 685 697 118 641 114 130 655 274 350 635 40 131 657 40 352 635 40 131 655 274 350 651 267 148 675 374 149 639 268 346 677 117 138 639 268 346 675 374 149 695 41 188 693 41 189 701 41 188 699 41 189 701 41 188 693 41 189 721 27 194 709 27 194 722 27 393 710 27 393 722 27 393 709 27 194 79 575 695 76 576 695 732 627 831 222 626 831 732 627 831 76 576 695 68 700 713 69 701 712 86 702 713 85 703 712 86 702 713 69 701 712 73 704 832 72 705 833 734 706 834 735 707 833 734 706 834 72 705 833 744 708 835 53 709 835 743 710 836 54 711 836 743 710 836 53 709 835 769 3 3 788 4 4 794 136 162 795 418 237 794 136 162 788 4 4 768 2 2 793 137 163 783 0 0 799 712 368 783 0 0 793 137 163 770 142 167 754 141 166 767 584 423 753 585 697 767 584 423 754 141 166 802 40 176 801 40 177 813 40 721 809 40 720 813 40 721 801 40 177 829 150 701 831 645 758 835 590 630 836 643 757 835 590 630 831 645 758 843 153 837 841 395 838 853 713 839 852 714 840 853 713 839 841 395 838 834 644 841 831 645 842 849 147 843 847 149 844 849 147 843 831 645 842 696 40 692 694 40 614 864 305 845 862 304 846 864 305 845 694 40 614 861 715 847 872 716 385 876 512 640 878 513 641 876 512 640 872 716 385 855 25 705 871 25 760 228 25 38 856 25 761 228 25 38 871 25 760 883 717 512 882 718 848 895 647 768 894 402 767 895 647 768 882 718 848 897 403 849 898 649 769 909 404 850 910 719 851 909 404 850 898 649 769 917 100 852 912 162 197 911 306 394 915 163 198 911 306 394 912 162 197 885 720 853 882 718 854 924 721 855 923 167 856 924 721 855 882 718 854 1019 419 480 1029 665 366 1014 190 240 1028 192 241 1014 190 240 1029 665 366 1005 193 242 1036 730 369 1016 194 243 1031 731 621 1016 194 243 1036 730 369 999 732 622 998 196 245 1020 733 479 1016 194 243 1020 733 479 998 196 245 1055 734 623 1054 734 625 1048 735 624 1047 736 626 1048 735 624 1054 734 625 1058 297 378 1060 296 377 1063 501 627 1062 501 628 1063 501 627 1060 296 377 36 545 733 37 201 270 265 544 733 266 203 270 265 544 733 37 201 270 26 544 663 31 205 272 255 545 663 260 207 272 255 545 663 31 205 272 6 546 539 7 209 274 235 547 539 236 211 274 235 547 539 7 209 274 20 548 280 19 213 276 249 549 280 248 215 276 249 549 280 19 213 276 238 27 25 338 27 278 237 27 275 337 27 664 237 27 275 338 27 278 249 41 280 349 41 281 250 41 537 350 41 665 250 41 537 349 41 281 373 41 666 273 41 21 374 41 284 274 41 22 374 41 284 273 41 21 355 27 667 255 27 663 360 27 285 260 27 272 360 27 285 255 27 663 335 436 668 336 216 287 285 435 669 286 218 289 285 435 669 336 216 287 342 434 670 343 220 291 292 433 671 293 222 293 292 433 671 343 220 291 366 230 672 372 224 295 316 228 673 322 226 297 316 228 673 372 224 295 362 226 674 356 228 299 312 224 675 306 230 301 312 224 675 356 228 299 277 25 799 279 25 863 275 25 798 280 25 864 275 25 798 279 25 863 393 738 676 385 352 445 377 352 447 377 352 447 394 738 677 393 738 676 383 739 865 385 739 445 397 740 866 393 740 676 397 740 866 385 739 445 422 554 679 421 555 680 412 446 575 407 445 574 412 446 575 421 555 680 377 741 447 405 742 448 375 741 867 404 742 868 375 741 867 405 742 448 468 687 682 467 620 583 429 568 688 433 363 456 429 568 688 467 620 583 435 84 89 480 453 582 479 92 96 479 92 96 451 94 98 435 84 89 492 265 337 491 457 586 449 264 336 446 456 585 449 264 336 491 457 586 424 77 82 484 79 84 478 447 576 503 743 685 478 447 576 484 79 84 495 744 86 507 745 334 436 746 869 486 747 870 436 746 869 507 745 334 448 559 683 492 560 337 479 92 96 511 93 97 479 92 96 492 560 337 466 266 339 514 76 338 460 74 79 471 76 81 460 74 79 514 76 338 425 254 329 457 251 325 436 746 869 432 252 327 436 746 869 457 251 325 519 100 496 522 100 342 543 100 496 546 100 342 543 100 496 522 100 342 547 41 603 551 41 604 555 41 605 557 41 606 555 41 605 551 41 604 552 624 607 558 465 608 573 376 470 577 472 602 573 376 470 558 465 608 608 477 609 609 478 595 594 479 610 592 479 601 594 479 610 609 478 595 616 480 597 614 481 611 588 379 478 600 379 477 588 379 478 614 481 611 592 479 601 577 116 602 594 479 610 582 116 114 594 479 610 577 116 602 582 104 114 570 105 115 594 482 610 584 375 469 594 482 610 570 105 115 635 112 128 638 112 129 632 101 466 633 101 467 632 101 466 638 112 129 653 373 135 641 114 130 652 104 137 640 105 132 652 104 137 641 114 130 683 118 139 677 117 138 684 273 119 675 374 149 684 273 119 677 117 138 689 40 353 679 275 351 658 40 468 656 375 469 658 40 468 679 275 351 645 475 470 670 748 471 637 120 111 668 120 472 637 120 111 670 748 471 640 105 132 632 40 133 678 272 349 672 40 473 678 272 349 632 40 133 701 40 188 702 40 692 703 40 194 704 40 357 703 40 194 702 40 692 714 25 150 726 25 150 712 25 151 725 25 151 712 25 151 726 25 150 65 571 693 64 278 358 89 572 694 90 280 358 89 572 694 64 278 358 735 41 833 733 41 871 747 41 872 736 41 365 94 41 252 95 41 862 734 41 834 735 41 833 747 41 872 751 41 158 734 41 834 747 41 872 751 41 158 747 41 872 746 41 752 742 41 364 736 41 365 95 41 862 93 41 253 94 41 252 736 41 365 93 41 253 736 41 365 739 41 161 92 41 256 93 41 253 739 41 161 92 41 256 739 41 161 745 41 160 92 41 256 745 41 160 744 41 835 741 41 696 742 41 364 95 41 862 92 41 256 744 41 835 743 41 836 91 41 257 92 41 256 743 41 836 740 41 620 741 41 696 95 41 862 737 41 619 740 41 620 95 41 862 746 41 752 737 41 619 95 41 862 746 41 752 95 41 862 96 41 873 746 41 752 96 41 873 97 41 723 751 41 158 746 41 752 97 41 723 751 41 158 97 41 723 98 41 660 751 41 158 98 41 660 91 41 257 751 41 158 91 41 257 743 41 836 743 41 836 738 41 874 748 41 360 743 41 836 748 41 360 749 41 362 743 41 836 749 41 362 750 41 156 743 41 836 750 41 156 751 41 158 741 577 696 56 578 696 742 283 364 55 284 364 742 283 364 56 578 696 781 496 479 791 667 367 777 492 243 792 749 621 777 492 243 791 669 367 774 293 371 771 750 236 798 751 165 796 583 238 798 751 165 771 750 236 784 383 422 761 732 698 766 384 242 752 752 244 766 384 242 761 732 698 818 753 699 814 641 756 817 753 700 811 640 754 817 753 700 814 641 756 824 41 875 819 41 876 820 41 877 801 41 878 820 41 877 819 41 876 819 41 876 808 500 626 801 41 878 809 499 624 801 41 878 808 500 626 224 27 380 222 27 831 830 299 382 828 504 631 830 299 382 222 27 831 220 41 363 846 301 384 223 41 157 844 507 632 223 41 157 846 301 384 861 715 847 863 754 879 872 716 385 867 716 386 872 716 385 863 754 879 25 25 795 254 25 795 866 25 880 226 25 793 866 25 880 254 25 795 705 41 356 719 41 356 879 41 357 720 41 357 879 41 357 719 41 356 908 755 881 896 593 706 902 595 708 902 595 708 914 597 709 908 755 881 896 593 706 908 755 881 898 649 769 910 719 851 898 649 769 908 755 881 881 405 511 883 756 512 893 308 396 895 647 768 893 308 396 883 756 512 921 317 405 881 405 511 887 510 637 887 510 637 873 157 191 921 317 405 1008 14 3 1033 333 162 1027 7 4 1034 768 237 1027 7 4 1033 333 162 1007 13 2 1022 10 0 1032 337 163 1038 288 368 1032 337 163 1022 10 0 1009 332 167 1006 335 423 993 541 166 992 769 697 993 541 166 1006 335 423 1041 40 176 1052 40 721 1040 40 177 1048 40 720 1040 40 177 1052 40 721 35 31 883 34 30 727 264 29 883 263 28 727 264 29 883 34 30 727 11 549 884 12 432 728 240 548 884 241 431 728 240 548 884 12 432 728 15 547 730 13 430 543 244 546 730 242 428 543 244 546 730 13 430 543 334 27 735 234 27 534 333 27 729 233 27 535 333 27 729 234 27 534 245 41 885 244 41 730 345 41 886 344 41 731 345 41 886 244 41 730 270 41 887 265 41 733 370 41 888 365 41 732 370 41 888 265 41 733 264 27 883 263 27 727 364 27 889 363 27 734 364 27 889 263 27 727 240 27 884 241 27 728 340 27 890 341 27 736 340 27 890 241 27 728 347 44 891 346 219 737 297 42 892 296 217 738 297 42 892 346 219 737 368 676 893 369 56 739 318 674 894 319 54 740 318 674 894 369 56 739 354 772 895 361 52 741 304 772 896 311 50 742 304 772 896 361 52 741 332 773 897 339 48 743 282 773 898 289 46 744 282 773 898 339 48 743 307 41 899 301 41 59 304 41 58 307 41 899 304 41 58 311 41 900 311 41 900 314 41 901 313 41 902 307 41 899 311 41 900 313 41 902 309 41 903 308 41 904 307 41 899 309 41 903 307 41 899 313 41 902 305 41 905 310 41 906 309 41 903 313 41 902 312 41 907 306 41 908 309 41 903 313 41 902 306 41 908 306 41 908 305 41 905 309 41 903 387 683 313 389 682 822 391 774 568 398 775 909 391 774 568 389 682 822 404 742 868 405 742 448 419 776 910 415 777 67 419 776 910 405 742 448 406 61 66 410 64 69 401 778 911 407 779 574 401 778 911 410 64 69 464 366 459 463 686 825 426 364 457 429 568 688 426 364 457 463 686 825 442 358 452 476 780 912 475 87 91 475 87 91 427 86 90 442 358 452 453 462 591 488 781 830 450 371 462 487 782 99 450 371 462 488 783 830 500 458 587 499 784 913 446 456 585 443 245 318 446 456 585 499 784 913 432 252 327 494 253 328 496 785 87 506 621 584 496 785 87 494 253 328 444 786 914 476 787 915 499 788 916 509 789 917 499 788 916 476 787 915 513 450 750 490 450 579 493 251 326 456 251 455 493 251 326 490 450 579 424 77 82 440 449 578 458 78 83 459 566 686 458 78 83 440 449 578 527 100 493 530 100 492 535 100 493 538 100 492 535 100 493 530 100 492 544 120 465 543 120 496 545 120 343 546 120 342 545 120 343 543 120 496 566 120 129 574 277 354 561 120 467 571 376 600 561 120 467 574 277 354 607 275 351 583 274 350 608 695 609 593 570 691 608 695 609 583 274 350 615 469 598 613 790 118 589 625 144 601 693 145 589 625 144 613 790 118 570 105 115 564 40 918 584 375 469 586 40 468 584 375 469 564 40 918 580 104 137 568 105 132 604 271 117 606 272 349 604 271 117 568 105 132 624 27 592 625 27 109 622 27 593 621 27 108 622 27 593 625 27 109 644 124 146 648 125 147 623 694 594 629 791 475 623 694 594 648 125 147 682 121 143 681 792 595 669 119 142 663 793 596 669 119 142 681 792 595 688 120 597 660 120 478 687 699 598 662 698 599 687 699 598 660 120 478 643 475 600 662 698 599 633 120 467 660 120 478 633 120 467 662 698 599 670 748 471 645 475 470 664 794 601 649 476 602 664 794 601 645 475 470 691 27 613 694 27 614 697 27 613 700 27 614 697 27 613 694 27 614 712 25 151 725 25 151 705 25 356 719 25 356 705 25 356 725 25 151 730 627 379 221 626 379 729 626 490 58 627 490 729 626 490 221 626 379 727 628 500 60 628 500 728 628 501 71 629 501 728 628 501 60 628 500 747 630 872 70 630 872 746 630 752 48 631 752 746 630 752 70 630 872 787 795 169 795 609 237 771 750 236 796 583 238 771 750 236 795 611 237 785 389 239 800 331 164 775 391 240 789 632 241 775 391 240 800 331 164 766 384 242 752 752 244 777 492 243 759 497 245 777 492 243 752 752 244 806 40 246 814 40 170 803 40 247 810 40 172 803 40 247 814 40 170 833 316 404 832 796 381 837 797 207 836 798 757 837 797 207 832 796 381 844 507 632 854 508 633 842 592 703 853 799 839 842 592 703 854 508 633 855 156 705 857 396 502 871 509 760 870 509 634 871 509 760 857 396 502 0 25 787 229 25 787 826 25 919 227 25 920 826 25 919 229 25 787 879 100 357 880 100 194 704 100 357 703 100 194 704 100 357 880 100 194 825 25 921 838 25 922 227 25 920 826 25 919 227 25 920 838 25 922 893 308 396 895 647 768 905 309 397 907 516 645 905 309 397 895 647 768 891 800 506 887 510 637 903 161 196 899 307 395 903 161 196 887 510 637 917 100 852 911 306 394 905 309 397 905 309 397 919 100 643 917 100 852 156 41 529 47 41 923 54 41 836 48 41 752 861 715 847 876 512 640 157 41 530 156 41 529 54 41 836 49 41 619 48 41 752 876 512 640 157 41 530 54 41 836 53 41 835 157 41 530 53 41 835 52 41 160 47 41 923 156 41 529 155 41 726 46 41 361 47 41 923 155 41 726 46 41 361 155 41 726 162 41 16 848 300 383 46 41 361 162 41 16 848 300 383 162 41 16 161 41 15 848 300 383 161 41 15 160 41 263 157 41 530 52 41 160 51 41 161 158 41 662 157 41 530 51 41 161 926 517 646 848 300 383 160 41 263 926 517 646 160 41 263 159 41 262 926 517 646 159 41 262 158 41 662 926 517 646 158 41 662 51 41 161 926 517 646 51 41 161 50 41 365 876 512 640 926 517 646 50 41 365 57 41 620 49 41 619 876 512 640 56 41 696 57 41 620 876 512 640 55 41 364 56 41 696 876 512 640 876 512 640 50 41 365 55 41 364 1018 18 9 1029 665 366 1021 0 10 1030 712 367 1021 0 10 1029 665 366 1038 579 368 1022 10 0 1036 807 369 1004 20 12 1036 808 369 1022 10 0 995 339 370 1001 809 372 1013 338 371 1024 608 239 1013 338 371 1001 809 372 1051 120 373 1047 120 375 1056 120 374 1054 120 376 1056 120 374 1047 120 375 1060 296 377 1058 297 378 1051 120 373 1047 120 375 1051 120 373 1058 297 378 32 673 926 35 31 883 261 671 926 264 29 883 261 671 926 35 31 883 10 215 927 11 549 884 239 213 927 240 548 884 239 213 927 11 549 884 16 211 885 15 547 730 245 209 885 244 546 730 245 209 885 15 547 730 41 207 887 36 545 733 270 205 887 265 544 733 270 205 887 36 545 733 246 41 784 245 41 885 346 41 928 345 41 886 346 41 928 245 41 885 269 41 786 270 41 887 369 41 929 370 41 888 369 41 929 270 41 887 261 27 926 264 27 883 361 27 930 364 27 889 361 27 930 264 27 883 239 27 927 240 27 884 339 27 931 340 27 890 339 27 931 240 27 884 329 43 932 347 44 891 279 43 933 297 42 892 279 43 933 347 44 891 367 677 934 368 676 893 317 675 935 318 674 894 317 675 935 368 676 893 326 25 936 354 25 937 276 25 437 304 25 58 276 25 437 354 25 937 351 25 938 332 25 897 301 25 939 282 25 898 301 25 939 332 25 897 282 41 304 289 41 940 280 41 864 288 41 941 280 41 864 289 41 940 289 41 940 290 41 942 288 41 941 287 41 943 288 41 941 290 41 942 290 41 942 291 41 944 287 41 943 286 41 945 287 41 943 291 41 944 291 41 944 284 41 946 286 41 945 285 41 947 286 41 945 284 41 946 284 41 946 283 41 948 285 41 947 391 437 568 398 616 745 388 349 442 390 348 441 388 349 442 398 616 745 419 776 910 415 777 67 403 811 949 406 812 66 403 811 949 415 777 67 403 811 949 406 812 66 400 813 950 401 814 911 400 813 950 406 812 66 428 815 951 430 248 322 464 816 952 463 817 953 464 816 952 430 248 322 476 787 915 444 786 914 428 815 951 428 815 951 475 818 954 476 787 915 488 819 830 452 619 748 487 820 99 451 94 98 487 95 99 452 619 748 445 249 323 444 786 914 500 622 749 499 788 916 500 622 749 444 786 914 431 359 453 468 558 682 482 360 321 505 821 826 482 360 321 468 558 682 443 245 318 499 784 913 469 246 320 509 822 955 469 246 320 499 784 913 513 461 590 474 460 589 490 461 747 455 618 746 490 461 747 474 460 589 442 358 452 427 86 90 462 357 451 455 618 746 462 357 451 427 86 90 528 41 494 527 41 493 536 41 494 535 41 493 536 41 494 527 41 493 540 120 495 539 120 497 541 120 107 542 120 106 541 120 107 539 120 497 562 120 126 572 277 146 554 120 345 551 464 594 554 120 345 572 277 146 594 482 610 584 375 469 608 695 609 607 275 351 608 695 609 584 375 469 602 823 116 613 790 118 590 470 599 615 469 598 590 470 599 613 790 118 569 114 130 583 274 350 563 40 131 585 40 352 563 40 131 583 274 350 579 267 148 603 374 149 567 268 346 605 117 138 567 268 346 603 374 149 626 41 345 623 41 604 620 41 344 619 41 603 620 41 344 623 41 604 625 120 109 624 473 607 637 120 111 645 475 470 637 120 111 624 473 607 664 794 601 681 792 595 670 748 471 682 121 143 670 748 471 681 792 595 661 122 144 659 120 127 687 699 598 688 120 597 687 699 598 659 120 127 659 120 127 661 122 144 634 120 126 644 124 146 634 120 126 661 122 144 669 119 142 663 793 596 646 124 354 650 125 134 646 124 354 663 793 596 692 25 612 691 25 613 698 25 612 697 25 613 698 25 612 691 25 613 724 100 152 716 100 152 721 100 194 709 100 194 721 100 194 716 100 152 731 626 380 224 627 380 730 627 379 221 626 379 730 627 379 224 627 380 82 824 711 61 825 711 727 628 500 60 628 500 727 628 500 61 825 711 733 630 871 74 630 871 747 630 872 70 630 872 747 630 872 74 630 871 738 826 874 47 827 923 748 282 360 46 282 361 748 282 360 47 827 923 795 538 237 788 4 4 796 583 238 772 5 5 796 583 238 788 4 4 776 8 8 789 828 241 786 7 7 800 768 164 786 7 7 789 828 241 780 381 480 758 635 515 775 391 240 757 390 481 775 391 240 758 635 515 805 120 516 804 120 517 811 120 482 807 120 483 811 120 482 804 120 517 839 591 629 838 829 922 827 151 702 825 394 921 827 151 702 838 829 922 854 646 633 845 152 759 853 713 839 843 153 837 853 713 839 845 152 759 868 716 956 867 716 386 866 830 880 863 754 879 866 830 880 867 716 386 25 41 795 866 830 880 863 754 879 840 831 762 1 41 26 9 41 25 842 592 703 840 831 762 9 41 25 863 754 879 70 41 872 74 41 871 32 41 926 25 41 795 863 754 879 73 41 832 219 41 159 842 592 703 842 592 703 9 41 25 8 41 275 842 592 703 8 41 275 7 41 274 842 592 703 7 41 274 6 41 539 842 592 703 6 41 539 4 41 535 35 41 883 32 41 926 863 754 879 34 41 727 35 41 883 863 754 879 33 41 532 34 41 727 863 754 879 842 592 703 4 41 535 5 41 534 27 41 533 33 41 532 863 754 879 26 41 663 27 41 533 863 754 879 22 41 781 28 41 24 29 41 23 842 592 703 5 41 534 12 41 728 31 41 272 26 41 663 863 754 879 31 41 272 863 754 879 74 41 871 30 41 273 31 41 272 74 41 871 29 41 23 30 41 273 74 41 871 22 41 781 29 41 23 74 41 871 3 41 782 22 41 781 74 41 871 3 41 782 74 41 871 72 41 833 10 41 927 3 41 782 72 41 833 10 41 927 72 41 833 73 41 832 11 41 884 10 41 927 73 41 832 12 41 728 11 41 884 73 41 832 73 41 832 842 592 703 12 41 728 696 27 692 879 27 357 702 27 692 704 27 357 702 27 692 879 27 357 840 25 762 852 25 840 225 25 436 841 25 838 225 25 436 852 25 840 888 311 505 891 832 506 900 160 195 903 161 196 900 160 195 891 832 506 875 511 957 889 310 400 878 833 641 892 834 402 878 833 641 889 310 400 919 100 764 906 401 507 909 404 510 909 404 510 920 100 766 919 100 764 924 721 958 925 835 647 885 720 959 886 836 714 885 720 959 925 835 647 1020 733 479 1016 194 243 1030 385 367 1031 842 621 1030 387 367 1016 194 243 1013 338 371 1037 843 165 1010 185 236 1035 844 238 1010 185 236 1037 843 165 1023 666 422 1005 193 242 1000 495 698 991 195 244 1000 495 698 1005 193 242 1057 845 699 1056 845 700 1053 846 756 1050 847 754 1053 846 756 1056 845 700 1063 27 875 1059 27 877 1058 27 876 1047 736 626 1058 27 876 1059 27 877 1059 27 877 1040 27 878 1047 736 626 1048 735 624 1047 736 626 1040 27 878 25 672 795 32 673 926 254 672 795 261 671 926 254 672 795 32 673 926 3 214 782 10 215 927 232 214 782 239 213 927 232 214 782 10 215 927 17 212 784 16 211 885 246 210 784 245 209 885 246 210 784 16 211 885 40 208 786 41 207 887 269 206 786 270 205 887 269 206 786 41 207 887 247 41 783 246 41 784 347 41 789 346 41 928 347 41 789 246 41 784 268 41 785 269 41 786 368 41 791 369 41 929 368 41 791 269 41 786 254 27 795 261 27 926 354 27 794 361 27 930 354 27 794 261 27 926 232 27 782 239 27 927 332 27 797 339 27 931 332 27 797 239 27 927 327 25 32 329 25 961 277 25 799 279 25 863 277 25 799 329 25 961 352 848 801 367 677 934 302 848 803 317 675 935 302 848 803 367 677 934 328 25 962 326 25 963 278 25 964 276 25 965 278 25 964 326 25 963 357 675 807 351 848 938 307 677 809 301 848 939 307 677 809 351 848 938 281 27 303 279 27 863 298 27 966 299 27 967 298 27 966 279 27 863 279 27 863 297 27 968 299 27 967 300 27 969 299 27 967 297 27 968 297 27 968 296 27 970 300 27 969 293 27 971 300 27 969 296 27 970 296 27 970 295 27 972 293 27 971 292 27 973 293 27 971 295 27 972 295 27 972 294 27 974 292 27 973 377 741 447 375 741 867 394 849 677 396 849 975 394 849 677 375 741 867 418 678 820 417 679 821 401 814 911 400 813 950 401 814 911 417 679 821 407 779 574 421 680 680 418 681 820 418 681 820 401 778 911 407 779 574 383 739 865 414 440 571 385 739 445 409 440 446 385 739 445 414 440 571 455 618 746 474 460 589 473 357 464 473 357 464 462 357 451 455 618 746 485 255 330 425 254 329 486 850 870 436 746 869 486 850 870 425 254 329 498 90 94 497 851 828 439 73 78 453 462 591 439 73 78 497 851 828 430 248 322 482 247 321 463 817 953 505 852 826 463 817 953 482 247 321 442 358 452 469 356 450 476 780 912 509 853 976 476 780 912 469 356 450 454 96 100 501 451 580 497 685 824 512 854 829 497 855 824 501 451 580 444 786 914 445 249 323 428 815 951 430 248 322 428 815 951 445 249 323 529 25 491 528 25 494 537 25 491 536 25 494 537 25 491 528 25 494 515 41 497 518 41 106 539 41 497 542 41 106 539 41 497 518 41 106 550 103 113 549 40 977 570 105 115 564 40 918 570 105 115 549 40 977 558 25 608 556 25 112 577 116 602 582 116 114 577 116 602 556 25 112 614 40 141 611 118 139 600 40 473 606 272 349 600 40 473 611 118 139 618 120 122 596 120 472 610 466 143 598 377 471 610 466 143 596 120 472 590 470 599 571 376 600 602 823 116 575 472 136 602 823 116 571 376 600 602 106 116 575 116 136 604 106 117 580 116 137 604 106 117 575 116 136 638 120 129 646 124 354 633 120 467 643 475 600 633 120 467 646 124 354 679 275 351 655 274 350 680 695 609 665 570 691 680 695 609 655 274 350 687 699 598 685 697 118 661 122 144 673 123 145 661 122 144 685 697 118 642 105 115 636 40 918 656 375 469 658 40 468 656 375 469 636 40 918 652 104 137 640 105 132 676 271 117 678 272 349 676 271 117 640 105 132 693 41 189 692 41 612 699 41 189 698 41 612 699 41 189 692 41 612 720 100 357 708 100 357 723 100 153 715 100 153 723 100 153 708 100 357 732 627 831 222 626 831 731 626 380 224 627 380 731 626 380 222 626 831 69 701 712 61 825 711 85 703 712 82 824 711 85 703 712 61 825 711 733 100 871 735 100 833 74 100 871 72 100 833 74 100 871 735 100 833 743 710 836 54 711 836 738 826 874 47 827 923 738 826 874 54 711 836 787 144 169 770 142 167 795 191 237 794 136 162 795 191 237 770 142 167 784 586 422 799 664 368 767 584 423 793 137 163 767 584 423 799 664 368 774 293 371 756 292 370 771 750 236 755 856 424 771 750 236 756 292 370 803 25 425 810 637 427 804 25 426 807 639 428 804 25 426 810 637 427 828 504 631 826 857 919 839 502 629 838 858 922 839 502 629 826 857 919 853 799 839 852 859 840 842 592 703 840 831 762 842 592 703 852 859 840 865 860 978 864 305 388 868 302 956 867 303 386 868 302 956 864 305 388 857 396 502 855 156 705 24 27 39 18 27 783 0 27 787 826 857 919 18 27 783 826 857 919 828 504 631 77 27 617 71 27 501 857 396 502 857 396 502 24 27 39 42 27 282 828 504 631 222 27 831 76 27 695 17 27 784 18 27 783 828 504 631 16 27 885 17 27 784 828 504 631 15 27 730 16 27 885 828 504 631 13 27 543 15 27 730 828 504 631 857 396 502 42 27 282 45 27 22 857 396 502 45 27 22 44 27 21 857 396 502 44 27 21 43 27 271 14 27 536 13 27 543 828 504 631 857 396 502 43 27 271 37 27 270 857 396 502 37 27 270 36 27 733 39 27 785 38 27 28 23 27 27 21 27 537 14 27 536 828 504 631 857 396 502 36 27 733 41 27 887 77 27 617 857 396 502 41 27 887 77 27 617 41 27 887 40 27 786 77 27 617 40 27 786 39 27 785 77 27 617 39 27 785 23 27 27 77 27 617 23 27 27 2 27 35 75 27 618 77 27 617 2 27 35 75 27 618 2 27 35 19 27 276 76 27 695 75 27 618 19 27 276 76 27 695 19 27 276 20 27 280 76 27 695 20 27 280 21 27 537 21 27 537 828 504 631 76 27 695 872 302 385 862 304 387 878 833 641 875 511 957 878 833 641 862 304 387 865 25 978 868 25 956 226 25 793 866 25 880 226 25 793 868 25 956 892 861 402 904 313 403 890 514 642 902 595 708 890 514 642 904 313 403 886 862 714 898 649 769 885 720 959 897 403 849 885 720 959 898 649 769 920 100 979 909 404 850 908 755 881 910 719 851 908 755 881 909 404 850 849 863 179 851 864 178 924 721 958 925 835 647 924 721 958 851 864 178 970 865 413 974 866 925 834 166 841 967 867 860 973 868 218 972 869 653 967 867 860 972 869 653 962 870 716 961 871 651 972 869 653 973 868 218 961 871 651 973 868 218 968 872 217 960 873 773 961 871 651 968 872 217 960 873 773 968 872 217 969 874 414 834 166 841 974 866 925 971 875 882 923 167 856 834 166 841 971 875 882 923 167 856 971 875 882 966 876 861 923 167 856 966 876 861 967 867 860 924 721 855 923 167 856 967 867 860 924 721 855 967 867 860 962 870 716 924 721 855 962 870 716 963 877 859 924 721 855 963 877 859 964 878 858 849 863 843 924 721 855 964 878 858 849 863 843 964 878 858 965 879 960 849 863 843 965 879 960 959 880 924 969 874 414 970 865 413 834 166 841 849 863 843 959 880 924 960 873 773 834 166 841 849 863 843 960 873 773 960 873 773 969 874 414 834 166 841 1030 289 367 1031 884 621 1021 0 10 1017 19 11 1021 0 10 1031 885 621 1037 886 165 1012 16 6 1035 887 238 1011 15 5 1035 887 238 1012 16 6 1006 335 423 1023 334 422 992 769 697 1000 636 698 992 769 697 1023 334 422 1052 670 489 1051 670 487 1057 888 699 1056 888 700 1057 888 699 1051 670 487 1063 589 627 1062 589 628 1059 145 175 1061 145 174 1059 145 175 1062 589 628 728 27 501 78 27 617 80 27 618 103 27 248 102 27 249 81 27 154 728 27 501 80 27 618 79 27 695 728 27 501 79 27 695 732 27 831 727 27 500 728 27 501 732 27 831 103 27 248 81 27 154 87 27 155 81 27 154 102 27 249 101 27 725 84 27 359 81 27 154 101 27 725 84 27 359 101 27 725 100 27 724 90 27 358 84 27 359 100 27 724 89 27 694 90 27 358 100 27 724 103 27 248 87 27 155 86 27 713 88 27 616 89 27 694 100 27 724 88 27 616 100 27 724 99 27 519 103 27 248 86 27 713 85 27 712 103 27 248 85 27 712 82 27 711 103 27 248 82 27 711 727 27 500 104 27 432 103 27 248 727 27 500 105 27 250 104 27 432 727 27 500 105 27 250 727 27 500 732 27 831 106 27 251 105 27 250 732 27 831 99 27 519 106 27 251 732 27 831 88 27 616 99 27 519 732 27 831 729 27 490 83 27 615 88 27 616 730 27 379 729 27 490 88 27 616 731 27 380 730 27 379 88 27 616 732 27 831 731 27 380 88 27 616 45 29 22 42 671 282 274 31 22 271 673 282 274 31 22 42 671 282 28 33 24 22 39 781 257 35 24 251 39 781 257 35 24 22 39 781 0 37 787 18 38 783 229 37 787 247 36 783 229 37 787 18 38 783 38 35 28 39 34 785 267 33 28 268 32 785 267 33 28 39 34 785 327 41 980 227 41 920 329 41 788 229 41 787 329 41 788 227 41 920 252 41 27 267 41 28 352 41 33 367 41 790 352 41 33 267 41 28 228 120 390 226 120 389 328 120 962 326 120 963 328 120 962 226 120 389 251 27 781 351 27 796 257 27 24 357 27 40 257 27 24 351 27 796 325 25 31 275 25 798 330 25 981 280 25 864 330 25 981 275 25 798 348 46 47 331 773 800 298 48 49 281 773 802 298 48 49 331 773 800 371 50 51 353 772 982 321 52 53 303 772 983 321 52 53 353 772 982 359 54 55 358 674 806 309 56 57 308 676 808 309 56 57 358 674 806 282 25 304 280 25 864 281 25 303 279 25 863 281 25 303 280 25 864 396 889 63 375 890 984 383 891 985 383 891 985 397 892 64 396 889 63 415 62 67 405 354 448 409 353 446 409 353 446 416 63 68 415 62 67 420 66 71 414 893 986 404 893 987 404 893 987 419 67 72 420 66 71 375 890 984 404 893 987 383 891 985 414 893 986 383 891 985 404 893 987 472 894 988 471 567 687 440 449 578 459 566 686 440 449 578 471 567 687 484 256 331 483 450 751 425 254 329 457 251 325 425 254 329 483 450 751 436 746 869 432 252 327 495 895 86 496 896 87 495 897 86 432 252 327 428 815 951 464 816 952 475 818 954 504 898 989 475 818 954 464 816 952 440 449 578 477 448 577 472 894 988 508 899 827 472 894 988 477 448 577 452 619 748 488 900 830 501 451 580 512 901 829 501 451 580 488 902 830 451 94 98 452 619 748 435 84 89 437 83 88 435 84 89 452 619 748 523 100 105 526 100 340 531 100 105 534 100 340 531 100 105 526 100 340 517 27 107 516 27 495 541 27 107 540 27 495 541 27 107 516 27 495 567 268 346 559 40 355 547 270 348 548 40 474 547 270 348 559 40 355 576 115 147 579 115 148 557 25 475 555 25 347 557 25 475 579 115 148 613 107 118 612 108 119 601 126 145 603 126 149 601 126 145 612 108 119 618 110 122 617 111 123 596 378 472 586 378 476 596 378 472 617 111 123 600 379 477 560 101 466 588 379 478 561 101 467 588 379 478 560 101 466 586 378 476 564 101 110 596 378 472 565 101 111 596 378 472 564 101 110 622 103 113 621 40 977 642 105 115 636 40 918 642 105 115 621 40 977 630 25 608 628 25 112 649 116 602 654 116 114 649 116 602 628 25 112 686 40 141 683 118 139 672 40 473 678 272 349 672 40 473 683 118 139 690 120 122 668 120 472 682 121 143 670 748 471 682 121 143 668 120 472 662 698 599 643 475 600 674 696 116 647 476 136 674 696 116 643 475 600 674 106 116 647 116 136 676 106 117 652 116 137 676 106 117 647 116 136 719 41 356 707 41 356 720 41 357 708 41 357 720 41 357 707 41 356 717 27 151 725 27 151 715 27 153 723 27 153 715 27 153 725 27 151 67 128 155 68 700 713 87 130 155 86 702 713 87 130 155 68 700 713 751 131 158 219 131 159 734 706 834 73 704 832 734 706 834 219 131 159 745 133 160 52 132 160 744 708 835 53 709 835 744 708 835 52 132 160 770 142 167 767 584 423 794 136 162 793 137 163 794 136 162 767 584 423 785 295 239 774 293 371 800 186 164 798 903 165 800 188 164 774 293 371 763 809 168 787 795 169 755 856 424 771 750 236 755 856 424 787 795 169 813 40 721 809 40 720 818 40 171 816 40 173 818 40 171 809 40 720 835 503 630 836 904 757 830 299 382 832 905 381 830 299 382 836 904 757 848 906 383 851 907 178 846 908 384 850 909 180 846 908 384 851 907 178 831 645 842 829 150 182 847 149 844 845 152 184 847 149 844 829 150 182 48 41 752 70 41 872 861 715 847 863 754 879 861 715 847 70 41 872 862 304 846 694 40 614 691 40 613 875 511 639 862 304 846 691 40 613 692 40 612 693 40 189 860 155 187 692 40 612 860 155 187 874 399 638 692 40 612 874 399 638 875 511 639 875 511 639 691 40 613 692 40 612 879 40 357 696 40 692 864 305 845 879 40 357 864 305 845 865 860 391 858 154 186 695 40 188 880 40 194 856 154 392 858 154 186 880 40 194 865 860 391 856 154 392 880 40 194 880 40 194 879 40 357 865 860 391 901 165 401 913 164 771 904 313 403 916 598 710 904 313 403 913 164 771 894 402 508 882 718 854 885 720 853 885 720 853 897 403 509 894 402 508 920 100 979 908 755 881 914 597 709 914 597 709 918 100 770 920 100 979 923 167 206 882 718 848 922 169 208 883 910 512 922 169 208 882 718 848 1029 665 366 1018 18 9 1028 192 241 1015 17 8 1028 192 241 1018 18 9 1036 917 369 1004 20 12 1031 918 621 1017 19 11 1031 918 621 1004 20 12 997 420 515 999 587 622 1019 419 480 1020 663 479 1019 419 480 999 587 622 1049 341 427 1046 342 428 1055 919 623 1054 919 625 1055 919 623 1046 342 428 1044 100 753 1045 100 755 1050 847 754 1053 846 756 1050 847 754 1045 100 755

+
+ + + + +

1000 40 224 991 40 225 992 40 226 993 40 227 992 40 226 991 40 225 991 40 225 998 40 228 993 40 227 1002 40 229 993 40 227 998 40 228 998 40 228 999 40 230 1002 40 229 994 40 231 1002 40 229 999 40 230 999 40 230 997 40 232 994 40 231 995 40 233 994 40 231 997 40 232 997 40 232 996 40 234 995 40 233 1001 40 235 995 40 233 996 40 234 174 41 521 175 41 522 173 41 523 172 41 524 173 41 523 175 41 522 175 41 522 176 41 525 172 41 524 171 41 526 172 41 524 176 41 525 176 41 525 177 41 527 171 41 526 178 41 528 171 41 526 177 41 527 990 528 513 981 529 655 989 530 421 988 531 420 989 530 421 981 529 655 981 529 655 982 531 656 988 531 420 987 532 657 988 531 420 982 531 656 982 531 656 979 533 658 987 532 657 980 534 659 987 532 657 979 533 658 182 27 661 181 27 268 183 27 531 184 27 264 183 27 531 181 27 268 181 27 268 180 27 269 184 27 264 185 27 265 184 27 264 180 27 269 180 27 269 179 27 18 185 27 265 186 27 17 185 27 265 179 27 18 984 655 719 983 656 775 975 657 718 976 658 416 975 657 718 983 656 775 983 656 775 986 659 776 976 658 416 977 660 417 976 658 416 986 659 776 986 659 776 985 661 221 977 660 417 978 662 220 977 660 417 985 661 221 114 41 779 113 41 780 107 41 259 108 41 258 107 41 259 113 41 780 113 41 780 112 41 520 108 41 258 109 41 255 108 41 258 112 41 520 112 41 520 111 41 434 109 41 255 110 41 254 109 41 255 111 41 434 760 40 230 759 40 228 758 40 232 757 40 234 758 40 232 759 40 228 759 40 228 752 40 225 757 40 234 762 40 235 757 40 234 752 40 225 752 40 225 761 40 224 762 40 235 756 40 233 762 40 235 761 40 224 761 40 224 753 40 226 756 40 233 755 40 231 756 40 233 753 40 226 753 40 226 754 40 227 755 40 231 763 40 229 755 40 231 754 40 227 121 27 431 122 27 777 120 27 433 119 27 722 120 27 433 122 27 777 122 27 777 115 27 778 119 27 722 118 27 430 119 27 722 115 27 778 115 27 778 116 27 518 118 27 430 117 27 429 118 27 430 116 27 518

+
+ + + + +

167 21 13 166 22 14 199 23 13 198 24 14 199 23 13 166 22 14 161 25 15 162 25 16 193 25 15 194 25 16 193 25 15 162 25 16 186 26 17 179 26 18 218 26 17 211 26 18 218 26 17 179 26 18 202 27 19 218 27 17 195 27 20 211 27 18 195 27 20 218 27 17 930 170 209 929 171 210 938 172 211 937 173 212 938 172 211 929 171 210 949 174 213 950 175 214 957 176 215 958 177 216 957 176 215 950 175 214 968 178 217 973 179 218 950 179 214 947 180 219 950 179 214 973 179 218 978 181 220 985 182 221 942 182 222 939 183 223 942 182 222 985 182 221 135 197 248 134 197 249 103 197 248 102 197 249 103 197 248 134 197 249 105 25 250 106 25 251 137 25 250 138 25 251 137 25 250 106 25 251 126 41 252 125 41 253 142 41 254 141 41 255 142 41 254 125 41 253 124 41 256 123 41 257 140 41 258 139 41 259 140 41 258 123 41 257 169 198 260 168 198 261 201 198 260 200 198 261 201 198 260 168 198 261 159 23 262 160 199 263 191 21 262 192 199 263 191 21 262 160 199 263 184 200 264 185 200 265 216 200 264 217 200 265 216 200 264 185 200 265 197 27 266 196 27 267 213 27 268 212 27 269 213 27 268 196 27 267 928 318 406 927 319 407 936 320 408 935 321 409 936 320 408 927 319 407 947 322 219 948 323 410 955 324 411 956 325 412 955 324 411 948 323 410 970 326 413 969 326 414 944 326 415 949 326 213 944 326 415 969 326 414 976 327 416 977 327 417 936 327 408 941 327 418 936 327 408 977 327 417 956 328 412 953 329 419 988 329 420 989 329 421 988 329 420 953 329 419 149 25 429 150 25 430 117 25 429 118 25 430 117 25 429 150 25 430 137 27 250 153 27 431 136 27 432 152 27 433 136 27 432 153 27 431 143 343 434 142 343 254 111 343 434 110 343 254 111 343 434 142 343 254 123 120 257 124 120 256 91 120 257 92 120 256 91 120 257 124 120 256 168 199 261 167 21 13 200 199 261 199 23 13 200 199 261 167 21 13 160 198 263 161 198 15 192 198 263 193 198 15 192 198 263 161 198 15 185 100 265 186 100 17 217 100 265 218 100 17 217 100 265 186 100 17 196 27 267 195 27 20 212 27 269 211 27 18 212 27 269 195 27 20 927 319 407 930 170 209 935 321 409 938 172 211 935 321 409 930 170 209 947 322 219 955 324 411 950 175 214 958 177 216 950 175 214 955 324 411 969 407 414 968 408 217 949 408 213 950 409 214 949 408 213 968 408 217 977 410 417 978 411 220 941 411 418 942 412 222 941 411 418 978 411 220 990 413 513 989 414 421 954 414 514 953 415 419 954 414 514 989 414 421 148 422 518 149 422 429 116 422 518 117 422 429 116 422 518 149 422 429 131 423 519 138 423 251 99 423 519 106 423 251 99 423 519 138 423 251 94 100 252 93 100 253 126 100 252 125 100 253 126 100 252 93 100 253 111 120 434 112 120 520 143 120 434 144 120 520 143 120 434 112 120 520 156 424 529 157 424 530 188 424 529 189 424 530 188 424 529 157 424 530 174 425 521 173 25 523 206 426 521 205 25 523 206 426 521 173 25 523 215 27 531 216 27 264 199 27 13 200 27 261 199 27 13 216 27 264 193 41 15 209 41 527 192 41 263 208 41 525 192 41 263 209 41 527 943 521 648 951 522 649 946 523 650 954 524 514 946 523 650 951 522 649 961 525 651 934 526 652 972 526 653 931 527 654 972 526 653 934 526 652 979 535 658 957 536 215 980 536 659 958 537 216 980 536 659 957 536 215 152 542 433 153 542 431 120 542 433 121 542 431 120 542 433 153 542 431 141 422 255 140 422 258 109 422 255 108 422 258 109 422 255 140 422 258 130 423 660 123 423 257 98 423 660 91 423 257 98 423 660 123 423 257 157 100 530 158 24 662 189 100 530 190 22 662 189 100 530 158 24 662 173 543 523 172 543 524 205 543 523 204 543 524 205 543 523 172 543 524 198 27 14 214 27 661 199 27 13 215 27 531 199 27 13 214 27 661 193 41 15 194 41 16 209 41 527 210 41 528 209 41 527 194 41 16 946 523 650 954 524 514 945 600 715 953 601 419 945 600 715 954 524 514 972 602 653 931 603 654 962 603 716 932 604 717 962 603 716 931 603 654 975 27 718 935 27 409 984 27 719 938 27 211 984 27 719 935 27 409 980 605 659 958 606 216 987 606 657 955 607 411 987 606 657 958 606 216 136 40 432 135 40 248 104 40 432 103 40 248 104 40 432 135 40 248 120 120 433 119 120 722 152 120 433 151 120 722 152 120 433 119 120 722 142 25 254 141 25 255 110 25 254 109 25 255 110 25 254 141 25 255 129 25 723 130 25 660 97 25 723 98 25 660 97 25 723 130 25 660 100 612 724 101 612 725 132 612 724 133 612 725 132 612 724 101 612 725 155 40 726 156 40 529 187 40 726 188 40 529 187 40 726 156 40 529 175 613 522 174 425 521 207 614 522 206 426 521 207 614 522 174 425 521 201 27 260 200 27 261 217 27 265 216 27 264 217 27 265 200 27 261 207 41 522 191 41 262 208 41 525 192 41 263 208 41 525 191 41 262 944 650 415 952 651 772 943 521 648 951 522 649 943 521 648 952 651 772 960 652 773 933 653 774 961 653 651 934 654 652 961 653 651 933 653 774 982 327 656 952 327 772 979 327 658 957 327 215 979 327 658 952 327 772 153 100 431 154 100 777 121 100 431 122 100 777 121 100 431 154 100 777 131 27 519 132 27 724 147 27 778 148 27 518 147 27 778 132 27 724 146 100 779 145 100 780 114 100 779 113 100 780 114 100 779 145 100 780 165 424 266 164 424 267 197 424 266 196 424 267 197 424 266 164 424 267 171 26 526 178 26 528 203 26 526 210 26 528 203 26 526 178 26 528 180 543 269 181 543 268 212 543 269 213 543 268 212 543 269 181 543 268 187 41 726 188 41 529 203 41 526 204 41 524 203 41 526 188 41 529 931 722 654 939 723 223 932 724 717 940 725 857 932 724 717 939 723 223 964 726 858 963 727 859 930 727 209 929 728 210 930 727 209 963 727 859 967 729 860 966 729 861 948 729 410 945 729 715 948 729 410 966 729 861 937 328 212 940 329 857 983 329 775 986 329 776 983 329 775 940 329 857 133 27 725 134 27 249 149 27 429 150 27 430 149 27 429 134 27 249 132 120 724 131 120 519 100 120 724 99 120 519 100 120 724 131 120 519 95 197 862 94 197 252 127 197 862 126 197 252 127 197 862 94 197 252 130 41 660 129 41 723 146 41 779 145 41 780 146 41 779 129 41 723 170 25 19 169 25 260 202 25 19 201 25 260 202 25 19 169 25 260 158 24 662 159 23 262 190 22 662 191 21 262 190 22 662 159 23 262 183 614 531 184 737 264 215 613 531 216 737 264 215 613 531 184 737 264 198 27 14 197 27 266 214 27 661 213 27 268 214 27 661 197 27 266 933 757 774 928 318 406 941 758 418 936 320 408 941 758 418 928 318 406 945 600 715 953 601 419 948 323 410 956 325 412 948 323 410 953 601 419 971 759 882 946 760 650 966 760 861 945 761 715 966 760 861 946 760 650 976 762 416 936 763 408 975 763 718 935 764 409 975 763 718 936 763 408 987 765 657 955 766 411 988 766 420 956 767 412 988 766 420 955 766 411 150 343 430 151 343 722 118 343 430 119 343 722 118 343 430 151 343 722 135 27 248 136 27 432 151 27 722 152 27 433 151 27 722 136 27 432 125 41 253 124 41 256 141 41 255 140 41 258 141 41 255 124 41 256 128 770 873 129 770 723 96 770 873 97 770 723 96 770 873 129 770 723 93 612 253 92 612 256 125 612 253 124 612 256 125 612 253 92 612 256 162 771 16 155 771 726 194 771 16 187 771 726 194 771 16 155 771 726 176 737 525 175 613 522 208 737 525 207 614 522 208 737 525 175 613 522 202 27 19 201 27 260 218 27 17 217 27 265 218 27 17 201 27 260 190 41 662 191 41 262 206 41 521 207 41 522 206 41 521 191 41 262 949 174 213 957 176 215 944 650 415 952 651 772 944 650 415 957 176 215 959 326 924 928 326 406 960 326 773 933 326 774 960 326 773 928 326 406 970 801 413 944 802 415 974 802 925 943 803 648 974 802 925 944 802 415 982 804 656 981 805 655 952 805 772 951 806 649 952 805 772 981 805 655 137 770 250 136 770 432 105 770 250 104 770 432 105 770 250 136 770 432 138 27 251 131 27 519 154 27 777 147 27 778 154 27 777 131 27 519 145 542 780 144 542 520 113 542 780 112 542 520 113 542 780 144 542 520 114 810 779 107 810 259 146 810 779 139 810 259 146 810 779 107 810 259 163 771 20 170 771 19 195 771 20 202 771 19 195 771 20 170 771 19 177 200 527 176 200 525 209 200 527 208 200 525 209 200 527 176 200 525 182 426 661 183 614 531 214 425 661 215 613 531 214 425 661 183 614 531 189 41 530 190 41 662 205 41 523 206 41 521 205 41 523 190 41 662 933 757 774 941 758 418 934 837 652 942 838 222 934 837 652 941 758 418 959 839 924 965 840 960 928 840 406 927 841 407 928 840 406 965 840 960 974 27 925 943 27 648 971 27 882 946 27 650 971 27 882 943 27 648 981 41 655 990 41 513 951 41 649 954 41 514 951 41 649 990 41 513 135 27 248 151 27 722 134 27 249 150 27 430 134 27 249 151 27 722 115 810 778 122 810 777 147 810 778 154 810 777 147 810 778 122 810 777 140 40 258 139 40 259 108 40 258 107 40 259 108 40 258 139 40 259 128 41 873 127 41 862 144 41 520 143 41 434 144 41 520 127 41 862 164 40 267 163 40 20 196 40 267 195 40 20 196 40 267 163 40 20 178 100 528 177 100 527 210 100 528 209 100 527 210 100 528 177 100 527 181 25 268 182 426 661 213 25 268 214 425 661 213 25 268 182 426 661 189 41 530 205 41 523 188 41 529 204 41 524 188 41 529 205 41 523 931 722 654 934 837 652 939 723 223 942 838 222 939 723 223 934 837 652 965 41 960 964 41 858 927 41 407 930 41 209 927 41 407 964 41 858 984 881 719 938 882 211 983 882 775 937 883 212 983 882 775 938 882 211 133 27 725 149 27 429 132 27 724 148 27 518 132 27 724 149 27 429 147 40 778 148 40 518 115 40 778 116 40 518 115 40 778 148 40 518 127 41 862 126 41 252 143 41 434 142 41 254 143 41 434 126 41 252 129 41 723 128 41 873 145 41 780 144 41 520 145 41 780 128 41 873 166 22 14 165 100 266 198 24 14 197 100 266 198 24 14 165 100 266 172 120 524 171 120 526 204 120 524 203 120 526 204 120 524 171 120 526 179 120 18 180 120 269 211 120 18 212 120 269 211 120 18 180 120 269 194 41 16 187 41 726 210 41 528 203 41 526 210 41 528 187 41 726 929 171 210 932 724 717 937 173 212 940 725 857 937 173 212 932 724 717 962 729 716 932 729 717 963 729 859 929 729 210 963 729 859 932 729 717 973 911 218 967 912 860 947 912 219 948 913 410 947 912 219 967 912 860 985 914 221 986 915 776 939 915 223 940 916 857 939 915 223 986 915 776 134 100 249 133 100 725 102 100 249 101 100 725 102 100 249 133 100 725 137 27 250 138 27 251 153 27 431 154 27 777 153 27 431 138 27 251 127 40 862 128 40 873 95 40 862 96 40 873 95 40 862 128 40 873 130 41 660 146 41 779 123 41 257 139 41 259 123 41 257 146 41 779

+
+
+
+ + + + 2.60209e-018 -0.4278 0.8 0.110723 -0.413223 0.8 0.2139 -0.370486 0.8 0.3025 -0.3025 0.8 0.370486 -0.2139 0.8 0.413223 -0.110723 0.8 0.4278 -6.93889e-018 0.8 0.413223 0.110723 0.8 0.370486 0.2139 0.8 0.3025 0.3025 0.8 0.2139 0.370486 0.8 0.110723 0.413223 0.8 2.60209e-018 0.4278 0.8 -0.110723 0.413223 0.8 -0.2139 0.370486 0.8 -0.3025 0.3025 0.8 -0.370486 0.2139 0.8 -0.413223 0.110723 0.8 -0.4278 -6.93889e-018 0.8 -0.413223 -0.110723 0.8 -0.370486 -0.2139 0.8 -0.3025 -0.3025 0.8 -0.2139 -0.370486 0.8 -0.110723 -0.413223 0.8 2.60209e-018 -0.4278 0.988 2.60209e-018 -0.37996 1.04 0.110723 -0.413223 0.988 0.0983409 -0.367013 1.04 0.2139 -0.370486 0.988 0.18998 -0.329055 1.04 0.3025 -0.3025 0.988 0.268672 -0.268672 1.04 0.370486 -0.2139 0.988 0.329055 -0.18998 1.04 0.413223 -0.110723 0.988 0.367013 -0.0983409 1.04 0.4278 -6.93889e-018 0.988 0.37996 -6.93889e-018 1.04 0.413223 0.110723 0.988 0.367013 0.0983409 1.04 0.370486 0.2139 0.988 0.329055 0.18998 1.04 0.3025 0.3025 0.988 0.268672 0.268672 1.04 0.2139 0.370486 0.988 0.18998 0.329055 1.04 0.110723 0.413223 0.988 0.0983409 0.367013 1.04 2.60209e-018 0.4278 0.988 2.60209e-018 0.37996 1.04 -0.110723 0.413223 0.988 -0.0983409 0.367013 1.04 -0.2139 0.370486 0.988 -0.18998 0.329055 1.04 -0.3025 0.3025 0.988 -0.268672 0.268672 1.04 -0.370486 0.2139 0.988 -0.329055 0.18998 1.04 -0.413223 0.110723 0.988 -0.367013 0.0983409 1.04 -0.4278 -6.93889e-018 0.988 -0.37996 -6.93889e-018 1.04 -0.413223 -0.110723 0.988 -0.367013 -0.0983409 1.04 -0.370486 -0.2139 0.988 -0.329055 -0.18998 1.04 -0.3025 -0.3025 0.988 -0.268672 -0.268672 1.04 -0.2139 -0.370486 0.988 -0.18998 -0.329055 1.04 -0.110723 -0.413223 0.988 -0.0983409 -0.367013 1.04 0.358351 -0.206894 1.02477 0.292592 -0.292592 1.02477 -0.107096 -0.399689 1.02477 -0.206894 -0.358351 1.02477 0.206894 0.358351 1.02477 0.292592 0.292592 1.02477 -0.358351 0.206894 1.02477 -0.292592 0.292592 1.02477 0.206894 -0.358351 1.02477 -0.292592 -0.292592 1.02477 0.358351 0.206894 1.02477 -0.206894 0.358351 1.02477 0.107096 -0.399689 1.02477 -0.358351 -0.206894 1.02477 0.399689 0.107096 1.02477 -0.107096 0.399689 1.02477 2.60209e-018 -0.413788 1.02477 -0.399688 -0.107096 1.02477 0.413788 -6.93889e-018 1.02477 2.60209e-018 0.413788 1.02477 -0.413788 -6.93889e-018 1.02477 0.399689 -0.107096 1.02477 0.107096 0.399689 1.02477 -0.399688 0.107096 1.02477 2.60209e-018 -0.309437 1.058 0.080088 -0.298893 1.058 0.154718 -0.26798 1.058 0.218805 -0.218805 1.058 0.26798 -0.154718 1.058 0.298893 -0.080088 1.058 0.309437 -6.93889e-018 1.058 0.298893 0.0800881 1.058 0.26798 0.154718 1.058 0.218805 0.218805 1.058 0.154718 0.26798 1.058 0.080088 0.298893 1.058 2.60209e-018 0.309437 1.058 -0.080088 0.298893 1.058 -0.154718 0.26798 1.058 -0.218805 0.218805 1.058 -0.26798 0.154718 1.058 -0.298893 0.0800881 1.058 -0.309437 -6.93889e-018 1.058 -0.298893 -0.080088 1.058 -0.26798 -0.154718 1.058 -0.218805 -0.218805 1.058 -0.154718 -0.26798 1.058 -0.080088 -0.298893 1.058 2.60209e-018 -0.245966 1.058 0.0636605 -0.237585 1.058 0.122983 -0.213012 1.058 0.173924 -0.173924 1.058 0.213013 -0.122983 1.058 0.237585 -0.0636605 1.058 0.245966 -6.93889e-018 1.058 0.237585 0.0636607 1.058 0.213013 0.122983 1.058 0.173924 0.173924 1.058 0.122983 0.213013 1.058 0.0636605 0.237585 1.058 2.60209e-018 0.245966 1.058 -0.0636605 0.237585 1.058 -0.122983 0.213013 1.058 -0.173924 0.173924 1.058 -0.213013 0.122983 1.058 -0.237585 0.0636607 1.058 -0.245966 -6.93889e-018 1.058 -0.237585 -0.0636605 1.058 -0.213012 -0.122983 1.058 -0.173924 -0.173924 1.058 -0.122983 -0.213012 1.058 -0.0636605 -0.237585 1.058 2.60209e-018 -0.224809 1.018 0.0581847 -0.217149 1.018 0.112404 -0.19469 1.018 0.158964 -0.158964 1.018 0.19469 -0.112404 1.018 0.217149 -0.0581847 1.018 0.224809 -6.93889e-018 1.018 0.217149 0.0581849 1.018 0.19469 0.112404 1.018 0.158964 0.158964 1.018 0.112404 0.19469 1.018 0.0581847 0.217149 1.018 2.60209e-018 0.224809 1.018 -0.0581846 0.217149 1.018 -0.112404 0.19469 1.018 -0.158964 0.158964 1.018 -0.19469 0.112404 1.018 -0.217149 0.0581849 1.018 -0.224809 -6.93889e-018 1.018 -0.217149 -0.0581847 1.018 -0.19469 -0.112404 1.018 -0.158964 -0.158964 1.018 -0.112404 -0.19469 1.018 -0.0581846 -0.217149 1.018 2.60209e-018 -0.172102 1.018 0.0445431 -0.166238 1.018 0.0860509 -0.149045 1.018 0.121694 -0.121694 1.018 0.149045 -0.0860507 1.018 0.166238 -0.0445431 1.018 0.172102 -6.93889e-018 1.018 0.166238 0.0445433 1.018 0.149045 0.0860507 1.018 0.121694 0.121694 1.018 0.0860509 0.149045 1.018 0.0445431 0.166238 1.018 2.60209e-018 0.172102 1.018 -0.044543 0.166238 1.018 -0.0860509 0.149045 1.018 -0.121694 0.121694 1.018 -0.149045 0.0860508 1.018 -0.166238 0.0445433 1.018 -0.172102 -6.93889e-018 1.018 -0.166238 -0.0445431 1.018 -0.149045 -0.0860509 1.018 -0.121694 -0.121694 1.018 -0.0860509 -0.149045 1.018 -0.0445431 -0.166238 1.018 2.60209e-018 -6.93889e-018 1.018 2.60209e-018 -6.93889e-018 0.8 2.60209e-018 -0.4278 -0.8 0.110723 -0.413223 -0.8 0.2139 -0.370486 -0.8 0.3025 -0.3025 -0.8 0.370486 -0.2139 -0.8 0.413223 -0.110723 -0.8 0.4278 -6.93889e-018 -0.8 0.413223 0.110723 -0.8 0.370486 0.2139 -0.8 0.3025 0.3025 -0.8 0.2139 0.370486 -0.8 0.110723 0.413223 -0.8 2.60209e-018 0.4278 -0.8 -0.110723 0.413223 -0.8 -0.2139 0.370486 -0.8 -0.3025 0.3025 -0.8 -0.370486 0.2139 -0.8 -0.413223 0.110723 -0.8 -0.4278 -6.93889e-018 -0.8 -0.413223 -0.110723 -0.8 -0.370486 -0.2139 -0.8 -0.3025 -0.3025 -0.8 -0.2139 -0.370486 -0.8 -0.110723 -0.413223 -0.8 2.60209e-018 -0.4278 -0.988 2.60209e-018 -0.37996 -1.04 0.110723 -0.413223 -0.988 0.0983409 -0.367013 -1.04 0.2139 -0.370486 -0.988 0.18998 -0.329055 -1.04 0.3025 -0.3025 -0.988 0.268672 -0.268672 -1.04 0.370486 -0.2139 -0.988 0.329055 -0.18998 -1.04 0.413223 -0.110723 -0.988 0.367013 -0.0983409 -1.04 0.4278 -6.93889e-018 -0.988 0.37996 -6.93889e-018 -1.04 0.413223 0.110723 -0.988 0.367013 0.0983409 -1.04 0.370486 0.2139 -0.988 0.329055 0.18998 -1.04 0.3025 0.3025 -0.988 0.268672 0.268672 -1.04 0.2139 0.370486 -0.988 0.18998 0.329055 -1.04 0.110723 0.413223 -0.988 0.0983409 0.367013 -1.04 2.60209e-018 0.4278 -0.988 2.60209e-018 0.37996 -1.04 -0.110723 0.413223 -0.988 -0.0983409 0.367013 -1.04 -0.2139 0.370486 -0.988 -0.18998 0.329055 -1.04 -0.3025 0.3025 -0.988 -0.268672 0.268672 -1.04 -0.370486 0.2139 -0.988 -0.329055 0.18998 -1.04 -0.413223 0.110723 -0.988 -0.367013 0.0983409 -1.04 -0.4278 -6.93889e-018 -0.988 -0.37996 -6.93889e-018 -1.04 -0.413223 -0.110723 -0.988 -0.367013 -0.0983409 -1.04 -0.370486 -0.2139 -0.988 -0.329055 -0.18998 -1.04 -0.3025 -0.3025 -0.988 -0.268672 -0.268672 -1.04 -0.2139 -0.370486 -0.988 -0.18998 -0.329055 -1.04 -0.110723 -0.413223 -0.988 -0.0983409 -0.367013 -1.04 0.358351 -0.206894 -1.02477 0.292592 -0.292592 -1.02477 -0.107096 -0.399689 -1.02477 -0.206894 -0.358351 -1.02477 0.206894 0.358351 -1.02477 0.292592 0.292592 -1.02477 -0.358351 0.206894 -1.02477 -0.292592 0.292592 -1.02477 0.206894 -0.358351 -1.02477 -0.292592 -0.292592 -1.02477 0.358351 0.206894 -1.02477 -0.206894 0.358351 -1.02477 0.107096 -0.399689 -1.02477 -0.358351 -0.206894 -1.02477 0.399689 0.107096 -1.02477 -0.107096 0.399689 -1.02477 2.60209e-018 -0.413788 -1.02477 -0.399688 -0.107096 -1.02477 0.413788 -6.93889e-018 -1.02477 2.60209e-018 0.413788 -1.02477 -0.413788 -6.93889e-018 -1.02477 0.399689 -0.107096 -1.02477 0.107096 0.399689 -1.02477 -0.399688 0.107096 -1.02477 2.60209e-018 -0.309437 -1.058 0.080088 -0.298893 -1.058 0.154718 -0.26798 -1.058 0.218805 -0.218805 -1.058 0.26798 -0.154718 -1.058 0.298893 -0.080088 -1.058 0.309437 -6.93889e-018 -1.058 0.298893 0.0800881 -1.058 0.26798 0.154718 -1.058 0.218805 0.218805 -1.058 0.154718 0.26798 -1.058 0.080088 0.298893 -1.058 2.60209e-018 0.309437 -1.058 -0.080088 0.298893 -1.058 -0.154718 0.26798 -1.058 -0.218805 0.218805 -1.058 -0.26798 0.154718 -1.058 -0.298893 0.0800881 -1.058 -0.309437 -6.93889e-018 -1.058 -0.298893 -0.080088 -1.058 -0.26798 -0.154718 -1.058 -0.218805 -0.218805 -1.058 -0.154718 -0.26798 -1.058 -0.080088 -0.298893 -1.058 2.60209e-018 -0.245966 -1.058 0.0636605 -0.237585 -1.058 0.122983 -0.213012 -1.058 0.173924 -0.173924 -1.058 0.213013 -0.122983 -1.058 0.237585 -0.0636605 -1.058 0.245966 -6.93889e-018 -1.058 0.237585 0.0636607 -1.058 0.213013 0.122983 -1.058 0.173924 0.173924 -1.058 0.122983 0.213013 -1.058 0.0636605 0.237585 -1.058 2.60209e-018 0.245966 -1.058 -0.0636605 0.237585 -1.058 -0.122983 0.213013 -1.058 -0.173924 0.173924 -1.058 -0.213013 0.122983 -1.058 -0.237585 0.0636607 -1.058 -0.245966 -6.93889e-018 -1.058 -0.237585 -0.0636605 -1.058 -0.213012 -0.122983 -1.058 -0.173924 -0.173924 -1.058 -0.122983 -0.213012 -1.058 -0.0636605 -0.237585 -1.058 2.60209e-018 -0.224809 -1.018 0.0581847 -0.217149 -1.018 0.112404 -0.19469 -1.018 0.158964 -0.158964 -1.018 0.19469 -0.112404 -1.018 0.217149 -0.0581847 -1.018 0.224809 -6.93889e-018 -1.018 0.217149 0.0581849 -1.018 0.19469 0.112404 -1.018 0.158964 0.158964 -1.018 0.112404 0.19469 -1.018 0.0581847 0.217149 -1.018 2.60209e-018 0.224809 -1.018 -0.0581846 0.217149 -1.018 -0.112404 0.19469 -1.018 -0.158964 0.158964 -1.018 -0.19469 0.112404 -1.018 -0.217149 0.0581849 -1.018 -0.224809 -6.93889e-018 -1.018 -0.217149 -0.0581847 -1.018 -0.19469 -0.112404 -1.018 -0.158964 -0.158964 -1.018 -0.112404 -0.19469 -1.018 -0.0581846 -0.217149 -1.018 2.60209e-018 -0.172102 -1.018 0.0445431 -0.166238 -1.018 0.0860509 -0.149045 -1.018 0.121694 -0.121694 -1.018 0.149045 -0.0860507 -1.018 0.166238 -0.0445431 -1.018 0.172102 -6.93889e-018 -1.018 0.166238 0.0445433 -1.018 0.149045 0.0860507 -1.018 0.121694 0.121694 -1.018 0.0860509 0.149045 -1.018 0.0445431 0.166238 -1.018 2.60209e-018 0.172102 -1.018 -0.044543 0.166238 -1.018 -0.0860509 0.149045 -1.018 -0.121694 0.121694 -1.018 -0.149045 0.0860508 -1.018 -0.166238 0.0445433 -1.018 -0.172102 -6.93889e-018 -1.018 -0.166238 -0.0445431 -1.018 -0.149045 -0.0860509 -1.018 -0.121694 -0.121694 -1.018 -0.0860509 -0.149045 -1.018 -0.0445431 -0.166238 -1.018 2.60209e-018 -6.93889e-018 -1.018 2.60209e-018 -6.93889e-018 -0.8 + + + + + + + + + + 0 0 1 0 0 -1 -0.680498 -0.718305 0.144776 -0.490482 -0.852418 0.181137 -0.660755 -0.660755 0.356096 -0.431349 -0.829064 0.355797 -0.528613 0.829348 0.180969 -0.431349 0.829064 0.355798 -0.29595 0.937904 0.180969 -0.202074 0.912455 0.355797 0.950319 -0.253147 0.181138 0.978178 0.0191014 0.206889 0.912455 -0.202073 0.355797 0.934449 0 0.356096 -0.962319 0.230176 0.144778 -0.902608 0.241853 0.356097 -0.856678 0.472547 0.206889 -0.809257 0.467225 0.356095 -0.0431182 0.982543 0.180969 0.212652 0.960223 0.180969 0.0438421 0.999038 0 0.300919 0.95365 0 0.0267338 -0.989103 0.144777 -0.234721 -0.949791 0.206889 -0.0438421 -0.999038 0 -0.300919 -0.95365 0 -0.0854417 -0.318873 0.943938 -0.0322467 -0.120346 0.992208 -0.165061 -0.285893 0.943938 -0.0622959 -0.1079 0.992208 0.174943 0.293668 0.939763 0.0783423 0.292377 0.953089 0.05756 0.110632 0.992193 0.0214771 0.0801535 0.996551 0.883964 1.57518e-007 0.467554 0.883965 1.66894e-007 0.467553 0.853845 -0.228787 0.467552 0.853846 -0.228786 0.467551 -0.883301 -0.0387621 0.467201 -0.883301 0.0387628 0.467201 -0.853846 0.228787 0.467551 -0.853846 0.228786 0.467551 -0.680498 -0.718305 -0.144776 -0.660755 -0.660755 -0.356096 -0.490482 -0.852418 -0.181137 -0.431349 -0.829064 -0.355797 -0.528613 0.829348 -0.180969 -0.29595 0.937904 -0.180969 -0.431349 0.829064 -0.355798 -0.202074 0.912455 -0.355797 0.950319 -0.253147 -0.181138 0.912455 -0.202073 -0.355797 0.978178 0.0191014 -0.206889 0.934449 0 -0.356096 -0.962319 0.230176 -0.144778 -0.856678 0.472547 -0.206889 -0.902608 0.241853 -0.356097 -0.809257 0.467225 -0.356095 -0.0431182 0.982543 -0.180969 0.212652 0.960223 -0.180969 0.0267338 -0.989103 -0.144777 -0.234721 -0.949791 -0.206889 -0.0854419 -0.318874 -0.943938 -0.165061 -0.285894 -0.943938 -0.0322469 -0.120347 -0.992208 -0.0622963 -0.1079 -0.992208 0.174943 0.293669 -0.939762 0.0575604 0.110633 -0.992193 0.0783426 0.292378 -0.953088 0.0214772 0.0801541 -0.996551 0.883964 1.57518e-007 -0.467554 0.853845 -0.228787 -0.467552 0.883965 1.66894e-007 -0.467553 0.853846 -0.228786 -0.467551 -0.883301 -0.0387621 -0.467201 -0.853846 0.228787 -0.467551 -0.883301 0.0387628 -0.467201 -0.853846 0.228786 -0.467551 -0.20527 -0.355537 0.911843 -0.290295 -0.290295 0.911843 -0.233431 -0.233431 0.943938 -0.220837 0.346474 0.911695 -0.161952 0.287686 0.943932 -0.106256 0.396551 0.911843 -0.0783424 0.292377 0.953089 0.396551 -0.106255 0.911843 0.41054 0 0.911843 0.34511 -0.092472 0.933996 0.302691 -6.85825e-009 0.953089 -0.355538 0.20527 0.911843 -0.396551 0.106255 0.911843 -0.285894 0.165061 0.943938 -0.318873 0.0854416 0.943938 0.45393 0.872466 0.180969 0.537487 0.843272 0 -0.537488 -0.843272 0 0 -0.330122 0.943938 0 -0.124592 0.992208 0 0.357285 0.933996 0 0.165992 0.986127 0.853845 0.228787 0.467552 0.853846 0.228787 0.467551 -0.843171 -0.266058 0.467199 -0.863236 -0.191172 0.4672 -0.20527 -0.355537 -0.911843 -0.290295 -0.290295 -0.911843 -0.233432 -0.233432 -0.943938 -0.220837 0.346474 -0.911695 -0.106256 0.396551 -0.911843 -0.161953 0.287687 -0.943932 -0.0783426 0.292378 -0.953088 0.396551 -0.106255 -0.911843 0.345111 -0.0924721 -0.933995 0.41054 0 -0.911843 0.302692 -6.23477e-009 -0.953088 -0.355538 0.20527 -0.911843 -0.285894 0.165061 -0.943938 -0.396551 0.106255 -0.911843 -0.318874 0.0854418 -0.943938 0.45393 0.872466 -0.180969 0 -0.330122 -0.943938 0 -0.124593 -0.992208 0 0.357285 -0.933995 0 0.165993 -0.986127 0.853845 0.228787 -0.467552 0.853846 0.228787 -0.467551 -0.843171 -0.266058 -0.467199 -0.863236 -0.191172 -0.4672 -0.718305 0.680498 0.144777 -0.660755 0.660756 0.356097 -0.837576 -0.505632 0.206889 -0.809257 -0.467225 0.356096 0.0409732 0.933665 0.355797 0.869955 -0.4714 0.144777 0.809256 -0.467225 0.356097 0.843221 0.517704 0.144777 0.937904 0.29595 0.180969 0.887113 0.461552 0 0.976344 0.216221 0 -0.948481 -0.281822 0.144778 -0.887113 -0.461552 0 -0.976344 -0.216222 0 0.233431 -0.233431 0.943938 0.0880997 -0.0880997 0.992208 0.165061 -0.285893 0.943938 0.062296 -0.1079 0.992208 -0.237299 0.252635 0.938011 -0.117374 0.117374 0.986127 -0.05756 0.110632 0.992193 0.625059 0.625059 0.46755 0.47522 0.745581 0.467199 0.625059 0.625058 0.467551 0.408081 0.784343 0.4672 -0.408082 -0.784343 0.4672 -0.475221 -0.74558 0.467199 -0.597179 -0.651998 0.4672 -0.651998 -0.59718 0.4672 -0.718305 0.680498 -0.144777 -0.660755 0.660756 -0.356097 -0.837576 -0.505632 -0.206889 -0.809257 -0.467225 -0.356096 0.0409732 0.933665 -0.355797 0.869955 -0.4714 -0.144777 0.809256 -0.467225 -0.356097 0.843221 0.517704 -0.144777 0.937904 0.29595 -0.180969 -0.948481 -0.281822 -0.144778 0.233432 -0.233432 -0.943938 0.165061 -0.285894 -0.943938 0.0881002 -0.0881003 -0.992208 0.0622963 -0.1079 -0.992208 -0.237299 0.252635 -0.938011 -0.117375 0.117375 -0.986127 -0.0575604 0.110632 -0.992193 0.625059 0.625059 -0.46755 0.625059 0.625058 -0.467551 0.47522 0.745581 -0.467199 0.408081 0.784343 -0.4672 -0.408082 -0.784343 -0.4672 -0.597179 -0.651998 -0.4672 -0.475221 -0.74558 -0.467199 -0.651998 -0.59718 -0.4672 0.725252 -0.664274 0.180969 0.631229 -0.689173 0.355796 0.505632 -0.837576 0.206888 0.467225 -0.809257 0.356094 0.809256 0.467225 0.356097 0.912455 0.202073 0.355797 -0.902608 -0.241853 0.356097 -0.978178 -0.0191015 0.206889 -0.934449 0 0.356096 0.281227 0.891246 0.355797 0.502316 0.788091 0.355797 0.678169 0.705183 0.206889 0.737427 0.675426 0 -0.737428 -0.675426 0 0.0854417 -0.318873 0.943938 0.0322467 -0.120346 0.992208 -0.0214771 0.0801535 0.996551 0.745581 0.47522 0.4672 0.784343 0.408081 0.4672 -0.74558 -0.475222 0.467199 -0.784343 -0.408082 0.467199 0.725252 -0.664274 -0.180969 0.505632 -0.837576 -0.206888 0.631229 -0.689173 -0.355796 0.467225 -0.809257 -0.356094 0.809256 0.467225 -0.356097 0.912455 0.202073 -0.355797 -0.978178 -0.0191015 -0.206889 -0.902608 -0.241853 -0.356097 -0.934449 0 -0.356096 0.281227 0.891246 -0.355797 0.502316 0.788091 -0.355797 0.678169 0.705183 -0.206889 0.0854419 -0.318874 -0.943938 0.0322469 -0.120347 -0.992208 -0.0214773 0.080154 -0.996551 0.745581 0.47522 -0.4672 0.784343 0.408081 -0.4672 -0.74558 -0.475222 -0.467199 -0.784343 -0.408082 -0.467199 0.205269 -0.355537 0.911843 0.290296 -0.290295 0.911843 0.396551 0.106255 0.911843 0.364487 0.189637 0.911695 0.32894 0.0929748 0.939763 0.278621 0.177589 0.943839 -0.410538 0 0.911843 -0.396551 -0.106256 0.911843 -0.330122 -5.61452e-009 0.943938 -0.318873 -0.0854417 0.943938 0.20527 0.355537 0.911843 0.106256 0.396551 0.911843 0.205269 -0.355537 -0.911843 0.290296 -0.290295 -0.911843 0.396551 0.106255 -0.911843 0.328941 0.092975 -0.939762 0.364487 0.189637 -0.911695 0.278621 0.177589 -0.943839 -0.410538 0 -0.911843 -0.330122 -4.67877e-009 -0.943938 -0.396551 -0.106256 -0.911843 -0.318874 -0.0854419 -0.943938 0.20527 0.355537 -0.911843 0.106256 0.396551 -0.911843 -0.302985 0.277511 0.911695 -0.355538 -0.20527 0.911843 -0.285894 -0.165061 0.943938 0 0.41054 0.911843 0.364487 -0.189637 0.911695 0.271857 -0.1659 0.94793 0.999039 -0.0438416 0 -0.999038 0.0438419 0 0.0862879 -0.0498184 0.995024 -0.0718636 0.0414905 0.996551 0.266058 0.843171 0.4672 0.191173 0.863236 0.4672 -0.191174 -0.863236 0.4672 -0.266058 -0.843171 0.4672 -0.302985 0.277511 -0.911695 -0.355538 -0.20527 -0.911843 -0.285894 -0.165061 -0.943938 0 0.41054 -0.911843 0.364487 -0.189637 -0.911695 0.271857 -0.165901 -0.94793 0.0862884 -0.0498187 -0.995024 -0.0718641 0.0414908 -0.996551 0.266058 0.843171 -0.4672 0.191173 0.863236 -0.4672 -0.191174 -0.863236 -0.4672 -0.266058 -0.843171 -0.4672 0.660755 0.660755 0.356097 0.255928 -0.949574 0.181138 0.281227 -0.891246 0.355797 0.95365 -0.300918 0 -0.95365 0.300919 0 0.137522 -0.0368489 0.989813 -0.137522 0.0368489 0.989813 0.0387627 0.883301 0.467201 -0.0387629 0.883301 0.4672 0.0387632 -0.883301 0.4672 -0.0387629 -0.883301 0.4672 0.660755 0.660755 -0.356097 0.255928 -0.949574 -0.181138 0.281227 -0.891246 -0.355797 0.137523 -0.0368491 -0.989813 -0.137523 0.0368491 -0.989813 0.0387627 0.883301 -0.467201 -0.0387629 0.883301 -0.4672 0.0387632 -0.883301 -0.4672 -0.0387629 -0.883301 -0.4672 0.290295 0.290296 0.911843 0.233431 0.233431 0.943938 0.106255 -0.396551 0.911843 0.843271 -0.537488 0 -0.843272 0.537488 0 0.124592 -1.22056e-008 0.992208 -0.124592 -1.31444e-008 0.992208 -0.191173 0.863236 0.4672 -0.266057 0.843172 0.467199 0.266058 -0.843171 0.467201 0.191173 -0.863236 0.467201 0.290295 0.290296 -0.911843 0.233432 0.233432 -0.943938 0.106255 -0.396551 -0.911843 0.124593 -1.22056e-008 -0.992208 -0.124593 -1.22056e-008 -0.992208 -0.191173 0.863236 -0.4672 -0.266057 0.843172 -0.467199 0.266058 -0.843171 -0.467201 0.191173 -0.863236 -0.467201 -0.241853 -0.902609 0.356097 0 -0.934449 0.356097 0.675426 -0.737428 0 -0.675426 0.737428 0 0.104345 0.0231083 0.994273 -0.120346 -0.0322467 0.992208 -0.408081 0.784344 0.467199 -0.475221 0.745581 0.467199 0.441983 -0.765537 0.467552 0.441983 -0.765537 0.467552 -0.241853 -0.902609 -0.356097 0 -0.934449 -0.356097 0.104346 0.0231084 -0.994273 -0.120347 -0.0322469 -0.992208 -0.408081 0.784344 -0.467199 -0.475221 0.745581 -0.467199 0.441983 -0.765537 -0.467552 0.441983 -0.765537 -0.467552 -0.106255 -0.396551 0.911843 0 -0.410539 0.911843 0.461551 -0.887114 0 -0.461551 0.887114 0 0.110632 0.0575601 0.992193 -0.1079 -0.0622958 0.992208 -0.597179 0.651999 0.467199 -0.651998 0.597179 0.467199 0.597179 -0.651998 0.4672 0.651998 -0.597179 0.4672 -0.106255 -0.396551 -0.911843 0 -0.410539 -0.911843 0.110632 0.0575604 -0.992193 -0.1079 -0.0622962 -0.992208 -0.597179 0.651999 -0.467199 -0.651998 0.597179 -0.467199 0.597179 -0.651998 -0.4672 0.651998 -0.597179 -0.4672 0.216222 -0.976344 0 -0.216222 0.976344 0 0.117374 0.117374 0.986127 -0.0880997 -0.0880997 0.992208 -0.74558 0.475221 0.467199 -0.784343 0.408082 0.467199 0.74558 -0.475221 0.4672 0.784343 -0.408081 0.4672 0.117375 0.117375 -0.986127 -0.0881002 -0.0881002 -0.992208 -0.74558 0.475221 -0.467199 -0.784343 0.408082 -0.467199 0.74558 -0.475221 -0.4672 0.784343 -0.408081 -0.4672 + + + + + + + + + + 0.711914 0.879754 0.755219 0.840549 0.703284 0.867173 0.698147 0.852813 0.696978 0.837605 0.699712 0.822601 0.706295 0.808857 0.716206 0.797285 0.72872 0.788605 0.743053 0.783468 0.758223 0.782207 0.773197 0.784904 0.786932 0.791449 0.798514 0.801316 0.807147 0.813847 0.812248 0.828184 0.813474 0.843358 0.81073 0.858334 0.804197 0.872105 0.794375 0.883768 0.781842 0.89244 0.767511 0.897632 0.752302 0.89887 0.73728 0.896197 0.723511 0.889651 0.71878 0.545912 0.7 0.616 0.73628 0.553161 0.751308 0.564692 0.762839 0.57972 0.770088 0.59722 0.77256 0.616 0.770088 0.63478 0.762839 0.65228 0.751308 0.667308 0.73628 0.678839 0.71878 0.686088 0.7 0.68856 0.68122 0.686088 0.66372 0.678839 0.648692 0.667308 0.637161 0.65228 0.629912 0.63478 0.62744 0.616 0.629912 0.59722 0.637161 0.57972 0.648692 0.564692 0.66372 0.553161 0.68122 0.545912 0.7 0.54344 0.936453 0.129068 0.936453 0.0895202 0.924343 0.129068 0.924343 0.0895202 0.936453 0.405904 0.924343 0.405904 0.936453 0.445452 0.924343 0.445452 0.936453 0.761836 0.936453 0.722288 0.924343 0.761836 0.924343 0.722288 0.936453 0.28726 0.924343 0.28726 0.936453 0.326808 0.924343 0.326808 0.936453 0.485 0.936453 0.524548 0.993657 0.485 0.993657 0.524548 0.936453 0.0104244 0.936453 0.0499725 0.993657 0.0104244 0.993657 0.0499725 0.652913 0.932938 0.671683 0.916088 0.632496 0.903149 0.654953 0.891806 0.877571 0.777565 0.857187 0.748098 0.855215 0.789057 0.838555 0.76497 0.674417 0.881931 0.687888 0.901481 0.835835 0.799021 0.82243 0.779579 0.679266 0.791266 0.691342 0.799104 0.694559 0.773196 0.704319 0.784072 0.831469 0.889507 0.819151 0.881685 0.816116 0.907514 0.806491 0.897012 0.831317 0.844238 0.827747 0.863797 0.682642 0.817053 0.67923 0.836675 0.621059 0.908889 0.608038 0.871699 0.620586 0.869118 0.762886 0.690356 0.76225 0.70312 0.801414 0.697383 0.797492 0.70957 0.856522 0.951554 0.881756 0.921569 0.847864 0.942144 0.870986 0.914717 0.686991 0.706646 0.654746 0.728832 0.692792 0.718028 0.663272 0.738337 0.936453 0.564096 0.993657 0.564096 0.993657 0.0895202 0.680417 0.956429 0.694103 0.935228 0.829893 0.724875 0.816252 0.746002 0.705986 0.916835 0.80441 0.764335 0.6691 0.812627 0.841538 0.868086 0.829703 0.824426 0.680567 0.856555 0.936453 0.366356 0.924343 0.366356 0.936453 0.168616 0.924343 0.168616 0.924343 0.485 0.936453 0.801384 0.924343 0.801384 0.936453 0.643192 0.936453 0.68274 0.993657 0.643192 0.993657 0.68274 0.936453 0.208164 0.993657 0.168616 0.993657 0.208164 0.784611 0.975009 0.77911 0.950425 0.748695 0.978165 0.749789 0.95303 0.726541 0.706006 0.731791 0.730581 0.760978 0.728223 0.750776 0.931231 0.774408 0.929134 0.736351 0.751919 0.759873 0.749982 0.666601 0.859519 0.687427 0.875253 0.823052 0.805699 0.843754 0.821266 0.811788 0.789334 0.796646 0.776451 0.69859 0.891724 0.71377 0.904684 0.936453 0.840932 0.924343 0.840932 0.936453 0.88048 0.924343 0.88048 0.924343 0.643192 0.924343 0.68274 0.924343 0.208164 0.936453 0.247712 0.924343 0.247712 0.924343 0.524548 0.924343 0.564096 0.936453 0.603644 0.993657 0.603644 0.993657 0.129068 0.713147 0.971815 0.720784 0.947758 0.789777 0.733511 0.727447 0.92694 0.783081 0.754255 0.664676 0.835896 0.84572 0.844807 0.748174 0.99095 0.787427 0.987505 0.898397 0.886124 0.905341 0.847603 0.886211 0.882263 0.892587 0.847007 0.629295 0.75859 0.612357 0.79393 0.639976 0.765589 0.624503 0.797947 0.888941 0.771731 0.866675 0.739512 0.723865 0.693523 0.605093 0.832494 0.617848 0.833249 0.836821 0.714147 0.824367 0.97405 0.818425 0.962735 0.993657 0.722288 0.993657 0.247712 0.806791 0.940466 0.7042 0.740416 0.796743 0.921176 0.714067 0.759797 0.778709 0.76781 0.731794 0.913333 0.924343 0.603644 0.936453 0.920028 0.924343 0.920028 0.993657 0.761836 0.993657 0.28726 0.830845 0.92362 0.680043 0.75703 0.759102 0.764361 0.751455 0.916648 0.902121 0.808596 0.889642 0.811299 0.709276 0.98406 0.993657 0.801384 0.993657 0.326808 0.849832 0.901229 0.660996 0.779321 0.739278 0.766017 0.771332 0.915195 0.924343 0.0499725 0.924343 0.0104244 0.993657 0.840932 0.993657 0.366356 0.862256 0.874661 0.648407 0.805826 0.720565 0.772701 0.790021 0.90823 0.643351 0.941502 0.673458 0.967206 0.993657 0.88048 0.993657 0.405904 0.867481 0.845827 0.642919 0.834681 0.936453 0.959576 0.924343 0.959576 0.993657 0.920028 0.993657 0.445452 0.865081 0.816633 0.645256 0.864004 0.993657 0.959576 + + + + + + + + + + + + + + +

191 0 0 192 0 1 190 0 2 190 0 2 192 0 1 189 0 3 189 0 3 192 0 1 188 0 4 188 0 4 192 0 1 187 0 5 187 0 5 192 0 1 186 0 6 186 0 6 192 0 1 185 0 7 185 0 7 192 0 1 184 0 8 184 0 8 192 0 1 183 0 9 183 0 9 192 0 1 182 0 10 182 0 10 192 0 1 181 0 11 181 0 11 192 0 1 180 0 12 180 0 12 192 0 1 179 0 13 179 0 13 192 0 1 178 0 14 178 0 14 192 0 1 177 0 15 177 0 15 192 0 1 176 0 16 176 0 16 192 0 1 175 0 17 175 0 17 192 0 1 174 0 18 174 0 18 192 0 1 173 0 19 173 0 19 192 0 1 172 0 20 172 0 20 192 0 1 171 0 21 171 0 21 192 0 1 170 0 22 170 0 22 192 0 1 169 0 23 169 0 23 192 0 1 168 0 24 168 0 24 192 0 1 191 0 0 7 1 25 193 1 26 8 1 27 8 1 27 193 1 26 9 1 28 9 1 28 193 1 26 10 1 29 10 1 29 193 1 26 11 1 30 11 1 30 193 1 26 12 1 31 12 1 31 193 1 26 13 1 32 13 1 32 193 1 26 14 1 33 14 1 33 193 1 26 15 1 34 15 1 34 193 1 26 16 1 35 16 1 35 193 1 26 17 1 36 17 1 36 193 1 26 18 1 37 18 1 37 193 1 26 19 1 38 19 1 38 193 1 26 20 1 39 20 1 39 193 1 26 21 1 40 21 1 40 193 1 26 22 1 41 22 1 41 193 1 26 23 1 42 23 1 42 193 1 26 0 1 43 0 1 43 193 1 26 1 1 44 1 1 44 193 1 26 2 1 45 2 1 45 193 1 26 3 1 46 3 1 46 193 1 26 4 1 47 4 1 47 193 1 26 5 1 48 5 1 48 193 1 26 6 1 49 6 1 49 193 1 26 7 1 25 385 1 0 384 1 2 386 1 1 384 1 2 383 1 3 386 1 1 383 1 3 382 1 4 386 1 1 382 1 4 381 1 5 386 1 1 381 1 5 380 1 6 386 1 1 380 1 6 379 1 7 386 1 1 379 1 7 378 1 8 386 1 1 378 1 8 377 1 9 386 1 1 377 1 9 376 1 10 386 1 1 376 1 10 375 1 11 386 1 1 375 1 11 374 1 12 386 1 1 374 1 12 373 1 13 386 1 1 373 1 13 372 1 14 386 1 1 372 1 14 371 1 15 386 1 1 371 1 15 370 1 16 386 1 1 370 1 16 369 1 17 386 1 1 369 1 17 368 1 18 386 1 1 368 1 18 367 1 19 386 1 1 367 1 19 366 1 20 386 1 1 366 1 20 365 1 21 386 1 1 365 1 21 364 1 22 386 1 1 364 1 22 363 1 23 386 1 1 363 1 23 362 1 24 386 1 1 362 1 24 385 1 0 386 1 1 201 0 25 202 0 27 387 0 26 202 0 27 203 0 28 387 0 26 203 0 28 204 0 29 387 0 26 204 0 29 205 0 30 387 0 26 205 0 30 206 0 31 387 0 26 206 0 31 207 0 32 387 0 26 207 0 32 208 0 33 387 0 26 208 0 33 209 0 34 387 0 26 209 0 34 210 0 35 387 0 26 210 0 35 211 0 36 387 0 26 211 0 36 212 0 37 387 0 26 212 0 37 213 0 38 387 0 26 213 0 38 214 0 39 387 0 26 214 0 39 215 0 40 387 0 26 215 0 40 216 0 41 387 0 26 216 0 41 217 0 42 387 0 26 217 0 42 194 0 43 387 0 26 194 0 43 195 0 44 387 0 26 195 0 44 196 0 45 387 0 26 196 0 45 197 0 46 387 0 26 197 0 46 198 0 47 387 0 26 198 0 47 199 0 48 387 0 26 199 0 48 200 0 49 387 0 26 200 0 49 201 0 25 387 0 26 66 2 50 68 3 51 81 4 52 75 5 53 81 4 52 68 3 51 52 6 54 83 7 55 50 8 56 87 9 57 50 8 56 83 7 55 34 10 58 36 11 59 93 12 60 90 13 61 93 12 60 36 11 59 58 14 62 95 15 63 56 16 64 78 17 65 56 16 64 95 15 63 48 18 66 46 19 67 12 20 68 11 21 69 12 20 68 46 19 67 24 22 70 70 23 71 0 24 72 23 25 73 0 24 72 70 23 71 71 26 74 119 27 75 69 28 76 118 29 77 69 28 76 119 27 75 45 30 78 47 31 79 106 32 80 107 33 81 106 32 80 47 31 79 118 29 77 119 27 75 142 0 82 143 0 83 142 0 82 119 27 75 106 32 80 107 33 81 130 0 84 131 0 85 130 0 84 107 33 81 138 34 86 162 35 87 137 36 88 161 37 89 137 36 88 162 35 87 126 38 90 150 39 91 125 40 92 149 41 93 125 40 92 150 39 91 152 0 94 176 0 16 151 0 95 175 0 17 151 0 95 176 0 16 163 0 96 164 0 97 187 0 5 188 0 4 187 0 5 164 0 97 260 42 50 275 43 52 262 44 51 269 45 53 262 44 51 275 43 52 246 46 54 244 47 56 277 48 55 281 49 57 277 48 55 244 47 56 228 50 58 287 51 60 230 52 59 284 53 61 230 52 59 287 51 60 252 54 62 250 55 64 289 56 63 272 57 65 289 56 63 250 55 64 242 58 66 206 20 68 240 59 67 205 21 69 240 59 67 206 20 68 218 60 70 194 24 72 264 61 71 217 25 73 264 61 71 194 24 72 265 62 74 263 63 76 313 64 75 312 65 77 313 64 75 263 63 76 239 66 78 300 67 80 241 68 79 301 69 81 241 68 79 300 67 80 312 65 77 336 1 82 313 64 75 337 1 83 313 64 75 336 1 82 300 67 80 324 1 84 301 69 81 325 1 85 301 69 81 324 1 84 332 70 86 331 71 88 356 72 87 355 73 89 356 72 87 331 71 88 320 74 90 319 75 92 344 76 91 343 77 93 344 76 91 319 75 92 346 1 94 345 1 95 370 1 16 369 1 17 370 1 16 345 1 95 357 1 96 381 1 5 358 1 97 382 1 4 358 1 97 381 1 5 75 78 98 69 28 76 81 79 99 67 80 100 81 79 99 69 28 76 83 81 101 53 82 102 87 83 103 51 84 104 87 83 103 53 82 102 93 85 105 90 86 106 35 87 107 37 88 108 35 87 107 90 86 106 78 89 109 95 90 110 57 91 111 59 92 112 57 91 111 95 90 110 46 19 67 44 93 113 11 21 69 10 94 114 11 21 69 44 93 113 70 23 71 68 3 51 23 25 73 22 95 115 23 25 73 68 3 51 71 26 74 25 96 116 119 27 75 96 97 117 119 27 75 25 96 116 49 98 118 108 99 119 47 31 79 107 33 81 47 31 79 108 99 119 96 97 117 120 0 120 119 27 75 143 0 83 119 27 75 120 0 120 108 99 119 132 0 121 107 33 81 131 0 85 107 33 81 132 0 121 138 34 86 139 100 122 162 35 87 163 101 96 162 35 87 139 100 122 127 102 123 151 103 95 126 38 90 150 39 91 126 38 90 151 103 95 152 0 94 153 0 124 176 0 16 177 0 15 176 0 16 153 0 124 165 0 125 189 0 3 164 0 97 188 0 4 164 0 97 189 0 3 269 104 98 275 105 99 263 63 76 261 106 100 263 63 76 275 105 99 277 107 101 281 108 103 247 109 102 245 110 104 247 109 102 281 108 103 287 111 105 229 112 107 284 113 106 231 114 108 284 113 106 229 112 107 272 115 109 251 116 111 289 117 110 253 118 112 289 117 110 251 116 111 240 59 67 205 21 69 238 119 113 204 94 114 238 119 113 205 21 69 264 61 71 217 25 73 262 44 51 216 95 115 262 44 51 217 25 73 265 62 74 313 64 75 219 120 116 290 121 117 219 120 116 313 64 75 243 122 118 241 68 79 302 123 119 301 69 81 302 123 119 241 68 79 290 121 117 313 64 75 314 1 120 337 1 83 314 1 120 313 64 75 302 123 119 301 69 81 326 1 121 325 1 85 326 1 121 301 69 81 332 70 86 356 72 87 333 124 122 357 125 96 333 124 122 356 72 87 321 126 123 320 74 90 345 127 95 344 76 91 345 127 95 320 74 90 346 1 94 370 1 16 347 1 124 371 1 15 347 1 124 370 1 16 359 1 125 358 1 97 383 1 3 382 1 4 383 1 3 358 1 97 54 128 126 56 16 64 79 129 127 78 17 65 79 129 127 56 16 64 66 2 50 81 4 52 64 130 128 85 131 129 64 130 128 81 4 52 50 8 56 87 9 57 48 18 66 91 132 130 48 18 66 87 9 57 32 133 131 34 10 58 72 134 132 93 12 60 72 134 132 34 10 58 40 135 133 38 136 134 8 137 135 7 138 136 8 137 135 38 136 134 64 130 128 62 139 137 20 140 138 19 141 139 20 140 138 62 139 137 31 142 140 99 143 141 29 144 142 98 145 143 29 144 142 99 143 141 55 146 144 111 147 145 53 82 102 110 148 146 53 82 102 111 147 145 98 145 143 99 143 141 122 0 147 123 0 148 122 0 147 99 143 141 111 147 145 135 0 149 110 148 146 134 0 150 110 148 146 135 0 149 141 149 151 142 150 82 165 151 125 166 152 152 165 151 125 142 150 82 130 153 84 154 154 153 129 155 154 153 156 124 129 155 154 154 154 153 155 0 155 156 0 156 179 0 13 180 0 12 179 0 13 156 0 156 167 0 157 144 0 158 191 0 0 168 0 24 191 0 0 144 0 158 248 157 126 273 158 127 250 55 64 272 57 65 250 55 64 273 158 127 260 42 50 258 159 128 275 43 52 279 160 129 275 43 52 258 159 128 244 47 56 242 58 66 281 49 57 285 161 130 281 49 57 242 58 66 226 162 131 266 163 132 228 50 58 287 51 60 228 50 58 266 163 132 234 164 133 202 137 135 232 165 134 201 138 136 232 165 134 202 137 135 258 159 128 214 140 138 256 166 137 213 141 139 256 166 137 214 140 138 225 167 140 223 168 142 293 169 141 292 170 143 293 169 141 223 168 142 249 171 144 247 109 102 305 172 145 304 173 146 305 172 145 247 109 102 292 170 143 316 1 147 293 169 141 317 1 148 293 169 141 316 1 147 305 172 145 304 173 146 329 1 149 328 1 150 329 1 149 304 173 146 335 174 151 359 175 125 336 176 82 360 177 152 336 176 82 359 175 125 324 178 84 323 179 154 348 180 153 347 181 124 348 180 153 323 179 154 349 1 155 373 1 13 350 1 156 374 1 12 350 1 156 373 1 13 361 1 157 385 1 0 338 1 158 362 1 24 338 1 158 385 1 0 30 182 159 73 183 160 28 184 161 80 185 162 28 184 161 73 183 160 40 135 133 82 186 163 38 136 134 86 187 164 38 136 134 82 186 163 62 139 137 89 188 165 60 189 166 92 190 167 60 189 166 89 188 165 46 19 67 94 191 168 44 93 113 76 192 169 44 93 113 94 191 168 44 93 113 42 193 170 10 94 114 9 194 171 10 94 114 42 193 170 68 3 51 66 2 50 22 95 115 21 195 172 22 95 115 66 2 50 27 196 173 97 197 174 25 96 116 96 97 117 25 96 116 97 197 174 49 98 118 51 84 104 108 99 119 109 198 175 108 99 119 51 84 104 96 97 117 97 197 174 120 0 120 121 0 176 120 0 120 97 197 174 108 99 119 109 198 175 132 0 121 133 0 177 132 0 121 109 198 175 140 199 178 164 200 97 139 100 122 163 101 96 139 100 122 164 200 97 128 201 179 152 202 94 127 102 123 151 103 95 127 102 123 152 202 94 153 0 124 154 0 153 177 0 15 178 0 14 177 0 15 154 0 153 165 0 125 166 0 152 189 0 3 190 0 2 189 0 3 166 0 152 224 203 159 222 204 161 267 205 160 274 206 162 267 205 160 222 204 161 234 164 133 232 165 134 276 207 163 280 208 164 276 207 163 232 165 134 256 166 137 254 209 166 283 210 165 286 211 167 283 210 165 254 209 166 240 59 67 238 119 113 288 212 168 270 213 169 288 212 168 238 119 113 238 119 113 204 94 114 236 214 170 203 194 171 236 214 170 204 94 114 262 44 51 216 95 115 260 42 50 215 195 172 260 42 50 216 95 115 221 215 173 219 120 116 291 216 174 290 121 117 291 216 174 219 120 116 243 122 118 302 123 119 245 110 104 303 217 175 245 110 104 302 123 119 290 121 117 314 1 120 291 216 174 315 1 176 291 216 174 314 1 120 302 123 119 326 1 121 303 217 175 327 1 177 303 217 175 326 1 121 334 218 178 333 124 122 358 219 97 357 125 96 358 219 97 333 124 122 322 220 179 321 126 123 346 221 94 345 127 95 346 221 94 321 126 123 347 1 124 371 1 15 348 1 153 372 1 14 348 1 153 371 1 15 359 1 125 383 1 3 360 1 152 384 1 2 360 1 152 383 1 3 80 222 180 73 223 181 29 144 142 31 142 140 29 144 142 73 223 181 86 224 182 82 225 183 39 226 184 41 227 185 39 226 184 82 225 183 92 228 186 89 229 187 61 230 188 63 231 189 61 230 188 89 229 187 76 232 190 94 233 191 45 30 78 47 31 79 45 30 78 94 233 191 42 193 170 40 135 133 9 194 171 8 137 135 9 194 171 40 135 133 66 2 50 64 130 128 21 195 172 20 140 138 21 195 172 64 130 128 27 196 173 29 144 142 97 197 174 98 145 143 97 197 174 29 144 142 53 82 102 110 148 146 51 84 104 109 198 175 51 84 104 110 148 146 98 145 143 122 0 147 97 197 174 121 0 176 97 197 174 122 0 147 110 148 146 134 0 150 109 198 175 133 0 177 109 198 175 134 0 150 141 149 151 165 151 125 140 199 178 164 200 97 140 199 178 165 151 125 129 155 154 153 156 124 128 201 179 152 202 94 128 201 179 153 156 124 155 0 155 179 0 13 154 0 153 178 0 14 154 0 153 179 0 13 167 0 157 191 0 0 166 0 152 190 0 2 166 0 152 191 0 0 274 234 180 223 168 142 267 235 181 225 167 140 267 235 181 223 168 142 280 236 182 233 237 184 276 238 183 235 239 185 276 238 183 233 237 184 286 240 186 255 241 188 283 242 187 257 243 189 283 242 187 255 241 188 270 244 190 239 66 78 288 245 191 241 68 79 288 245 191 239 66 78 236 214 170 203 194 171 234 164 133 202 137 135 234 164 133 203 194 171 260 42 50 215 195 172 258 159 128 214 140 138 258 159 128 215 195 172 221 215 173 291 216 174 223 168 142 292 170 143 223 168 142 291 216 174 247 109 102 245 110 104 304 173 146 303 217 175 304 173 146 245 110 104 292 170 143 291 216 174 316 1 147 315 1 176 316 1 147 291 216 174 304 173 146 303 217 175 328 1 150 327 1 177 328 1 150 303 217 175 335 174 151 334 218 178 359 175 125 358 219 97 359 175 125 334 218 178 323 179 154 322 220 179 347 181 124 346 221 94 347 181 124 322 220 179 349 1 155 348 1 153 373 1 13 372 1 14 373 1 13 348 1 153 361 1 157 360 1 152 385 1 0 384 1 2 385 1 0 360 1 152 78 89 109 57 91 111 79 246 192 55 146 144 79 246 192 57 91 111 85 247 193 81 79 99 65 248 194 67 80 100 65 248 194 81 79 99 91 249 195 87 83 103 49 98 118 51 84 104 49 98 118 87 83 103 93 85 105 35 87 107 72 250 196 33 251 197 72 250 196 35 87 107 38 136 134 36 11 59 7 138 136 6 252 198 7 138 136 36 11 59 62 139 137 60 189 166 19 141 139 18 253 199 19 141 139 60 189 166 31 142 140 33 251 197 99 143 141 100 254 200 99 143 141 33 251 197 55 146 144 57 91 111 111 147 145 112 255 201 111 147 145 57 91 111 100 254 200 124 0 202 99 143 141 123 0 148 99 143 141 124 0 202 111 147 145 112 255 201 135 0 149 136 0 203 135 0 149 112 255 201 142 150 82 143 256 83 166 152 152 167 257 157 166 152 152 143 256 83 131 258 85 155 259 155 130 153 84 154 154 153 130 153 84 155 259 155 157 0 204 181 0 11 156 0 156 180 0 12 156 0 156 181 0 11 145 0 205 169 0 23 144 0 158 168 0 24 144 0 158 169 0 23 272 115 109 273 260 192 251 116 111 249 171 144 251 116 111 273 260 192 279 261 193 259 262 194 275 105 99 261 106 100 275 105 99 259 262 194 285 263 195 243 122 118 281 108 103 245 110 104 281 108 103 243 122 118 287 111 105 266 264 196 229 112 107 227 265 197 229 112 107 266 264 196 232 165 134 201 138 136 230 52 59 200 252 198 230 52 59 201 138 136 256 166 137 213 141 139 254 209 166 212 253 199 254 209 166 213 141 139 225 167 140 293 169 141 227 265 197 294 266 200 227 265 197 293 169 141 249 171 144 305 172 145 251 116 111 306 267 201 251 116 111 305 172 145 294 266 200 293 169 141 318 1 202 317 1 148 318 1 202 293 169 141 305 172 145 329 1 149 306 267 201 330 1 203 306 267 201 329 1 149 336 176 82 360 177 152 337 268 83 361 269 157 337 268 83 360 177 152 325 270 85 324 178 84 349 271 155 348 180 153 349 271 155 324 178 84 351 1 204 350 1 156 375 1 11 374 1 12 375 1 11 350 1 156 339 1 205 338 1 158 363 1 23 362 1 24 363 1 23 338 1 158 44 93 113 76 192 169 42 193 170 77 272 206 42 193 170 76 192 169 26 273 207 28 184 161 84 274 208 80 185 162 84 274 208 28 184 161 38 136 134 86 187 164 36 11 59 90 13 61 36 11 59 86 187 164 58 14 62 60 189 166 95 15 63 92 190 167 95 15 63 60 189 166 36 11 59 34 10 58 6 252 198 5 275 209 6 252 198 34 10 58 60 189 166 58 14 62 18 253 199 17 276 210 18 253 199 58 14 62 35 87 107 101 277 211 33 251 197 100 254 200 33 251 197 101 277 211 59 92 112 113 278 212 57 91 111 112 255 201 57 91 111 113 278 212 101 277 211 125 0 92 100 254 200 124 0 202 100 254 200 125 0 92 113 278 212 137 0 88 112 255 201 136 0 203 112 255 201 137 0 88 143 256 83 120 279 120 167 257 157 144 280 158 167 257 157 120 279 120 132 281 121 156 282 156 131 258 85 155 259 155 131 258 85 156 282 156 157 0 204 158 0 213 181 0 11 182 0 10 181 0 11 158 0 213 145 0 205 146 0 214 169 0 23 170 0 22 169 0 23 146 0 214 238 119 113 236 214 170 270 213 169 271 283 206 270 213 169 236 214 170 220 284 207 278 285 208 222 204 161 274 206 162 222 204 161 278 285 208 232 165 134 230 52 59 280 208 164 284 53 61 280 208 164 230 52 59 252 54 62 289 56 63 254 209 166 286 211 167 254 209 166 289 56 63 230 52 59 200 252 198 228 50 58 199 275 209 228 50 58 200 252 198 254 209 166 212 253 199 252 54 62 211 276 210 252 54 62 212 253 199 229 112 107 227 265 197 295 286 211 294 266 200 295 286 211 227 265 197 253 118 112 251 116 111 307 287 212 306 267 201 307 287 212 251 116 111 295 286 211 294 266 200 319 1 92 318 1 202 319 1 92 294 266 200 307 287 212 306 267 201 331 1 88 330 1 203 331 1 88 306 267 201 337 268 83 361 269 157 314 288 120 338 289 158 314 288 120 361 269 157 326 290 121 325 270 85 350 291 156 349 271 155 350 291 156 325 270 85 351 1 204 375 1 11 352 1 213 376 1 10 352 1 213 375 1 11 339 1 205 363 1 23 340 1 214 364 1 22 340 1 214 363 1 23 76 232 190 45 30 78 77 292 215 43 293 216 77 292 215 45 30 78 80 222 180 29 144 142 84 294 217 27 196 173 84 294 217 29 144 142 86 224 182 39 226 184 90 86 106 37 88 108 90 86 106 39 226 184 92 228 186 61 230 188 95 90 110 59 92 112 95 90 110 61 230 188 34 10 58 32 133 131 5 275 209 4 295 218 5 275 209 32 133 131 58 14 62 56 16 64 17 276 210 16 296 219 17 276 210 56 16 64 35 87 107 37 88 108 101 277 211 102 297 220 101 277 211 37 88 108 59 92 112 61 230 188 113 278 212 114 298 221 113 278 212 61 230 188 102 297 220 126 0 90 101 277 211 125 0 92 101 277 211 126 0 90 114 298 221 138 0 86 113 278 212 137 0 88 113 278 212 138 0 86 120 279 120 121 299 176 144 280 158 145 300 205 144 280 158 121 299 176 133 301 177 157 302 204 132 281 121 156 282 156 132 281 121 157 302 204 159 0 222 183 0 9 158 0 213 182 0 10 158 0 213 183 0 9 147 0 223 171 0 21 146 0 214 170 0 22 146 0 214 171 0 21 270 244 190 271 303 215 239 66 78 237 304 216 239 66 78 271 303 215 274 234 180 278 305 217 223 168 142 221 215 173 223 168 142 278 305 217 280 236 182 284 113 106 233 237 184 231 114 108 233 237 184 284 113 106 286 240 186 289 117 110 255 241 188 253 118 112 255 241 188 289 117 110 228 50 58 199 275 209 226 162 131 198 295 218 226 162 131 199 275 209 252 54 62 211 276 210 250 55 64 210 296 219 250 55 64 211 276 210 229 112 107 295 286 211 231 114 108 296 306 220 231 114 108 295 286 211 253 118 112 307 287 212 255 241 188 308 307 221 255 241 188 307 287 212 296 306 220 295 286 211 320 1 90 319 1 92 320 1 90 295 286 211 308 307 221 307 287 212 332 1 86 331 1 88 332 1 86 307 287 212 314 288 120 338 289 158 315 308 176 339 309 205 315 308 176 338 289 158 327 310 177 326 290 121 351 311 204 350 291 156 351 311 204 326 290 121 353 1 222 352 1 213 377 1 9 376 1 10 377 1 9 352 1 213 341 1 223 340 1 214 365 1 21 364 1 22 365 1 21 340 1 214 68 3 51 70 23 71 75 5 53 74 312 224 75 5 53 70 23 71 54 128 126 79 129 127 52 6 54 83 7 55 52 6 54 79 129 127 62 139 137 64 130 128 89 188 165 85 131 129 89 188 165 64 130 128 24 22 70 88 313 225 70 23 71 74 312 224 70 23 71 88 313 225 32 133 131 30 182 159 4 295 218 3 314 226 4 295 218 30 182 159 56 16 64 54 128 126 16 296 219 15 315 227 16 296 219 54 128 126 39 226 184 103 316 228 37 88 108 102 297 220 37 88 108 103 316 228 63 231 189 115 317 229 61 230 188 114 298 221 61 230 188 115 317 229 102 297 220 103 316 228 126 0 90 127 0 123 126 0 90 103 316 228 114 298 221 115 317 229 138 0 86 139 0 122 138 0 86 115 317 229 121 299 176 122 318 147 145 300 205 146 319 214 145 300 205 122 318 147 134 320 150 158 321 213 133 301 177 157 302 204 133 301 177 158 321 213 160 0 230 184 0 8 159 0 222 183 0 9 159 0 222 184 0 8 148 0 231 172 0 20 147 0 223 171 0 21 147 0 223 172 0 20 262 44 51 269 45 53 264 61 71 268 322 224 264 61 71 269 45 53 248 157 126 246 46 54 273 158 127 277 48 55 273 158 127 246 46 54 256 166 137 283 210 165 258 159 128 279 160 129 258 159 128 283 210 165 218 60 70 264 61 71 282 323 225 268 322 224 282 323 225 264 61 71 226 162 131 198 295 218 224 203 159 197 314 226 224 203 159 198 295 218 250 55 64 210 296 219 248 157 126 209 315 227 248 157 126 210 296 219 233 237 184 231 114 108 297 324 228 296 306 220 297 324 228 231 114 108 257 243 189 255 241 188 309 325 229 308 307 221 309 325 229 255 241 188 296 306 220 320 1 90 297 324 228 321 1 123 297 324 228 320 1 90 308 307 221 332 1 86 309 325 229 333 1 122 309 325 229 332 1 86 315 308 176 339 309 205 316 326 147 340 327 214 316 326 147 339 309 205 328 328 150 327 310 177 352 329 213 351 311 204 352 329 213 327 310 177 354 1 230 353 1 222 378 1 8 377 1 9 378 1 8 353 1 222 342 1 231 341 1 223 366 1 20 365 1 21 366 1 20 341 1 223 75 78 98 74 330 232 69 28 76 71 26 74 69 28 76 74 330 232 79 246 192 55 146 144 83 81 101 53 82 102 83 81 101 55 146 144 85 247 193 65 248 194 89 229 187 63 231 189 89 229 187 65 248 194 88 331 233 25 96 116 74 330 232 71 26 74 74 330 232 25 96 116 30 182 159 28 184 161 3 314 226 2 332 234 3 314 226 28 184 161 54 128 126 52 6 54 15 315 227 14 333 235 15 315 227 52 6 54 41 227 185 104 334 236 39 226 184 103 316 228 39 226 184 104 334 236 63 231 189 65 248 194 115 317 229 116 335 237 115 317 229 65 248 194 104 334 236 128 0 179 103 316 228 127 0 123 103 316 228 128 0 179 116 335 237 140 0 178 115 317 229 139 0 122 115 317 229 140 0 178 122 318 147 123 336 148 146 319 214 147 337 223 146 319 214 123 336 148 134 320 150 135 338 149 158 321 213 159 339 222 158 321 213 135 338 149 161 0 89 185 0 7 160 0 230 184 0 8 160 0 230 185 0 7 148 0 231 149 0 93 172 0 20 173 0 19 172 0 20 149 0 93 269 104 98 263 63 76 268 340 232 265 62 74 268 340 232 263 63 76 273 260 192 277 107 101 249 171 144 247 109 102 249 171 144 277 107 101 279 261 193 283 242 187 259 262 194 257 243 189 259 262 194 283 242 187 282 341 233 268 340 232 219 120 116 265 62 74 219 120 116 268 340 232 224 203 159 197 314 226 222 204 161 196 332 234 222 204 161 197 314 226 248 157 126 209 315 227 246 46 54 208 333 235 246 46 54 209 315 227 235 239 185 233 237 184 298 342 236 297 324 228 298 342 236 233 237 184 257 243 189 309 325 229 259 262 194 310 343 237 259 262 194 309 325 229 298 342 236 297 324 228 322 1 179 321 1 123 322 1 179 297 324 228 310 343 237 309 325 229 334 1 178 333 1 122 334 1 178 309 325 229 316 326 147 340 327 214 317 344 148 341 345 223 317 344 148 340 327 214 328 328 150 352 329 213 329 346 149 353 347 222 329 346 149 352 329 213 355 1 89 354 1 230 379 1 7 378 1 8 379 1 7 354 1 230 342 1 231 366 1 20 343 1 93 367 1 19 343 1 93 366 1 20 32 133 131 72 134 132 30 182 159 73 183 160 30 182 159 72 134 132 40 135 133 42 193 170 82 186 163 77 272 206 82 186 163 42 193 170 24 22 238 26 273 207 88 313 239 84 274 208 88 313 239 26 273 207 48 18 66 91 132 130 46 19 67 94 191 168 46 19 67 91 132 130 28 184 161 26 273 207 2 332 234 1 348 240 2 332 234 26 273 207 52 6 54 50 8 56 14 333 235 13 349 241 14 333 235 50 8 56 43 293 216 105 350 242 41 227 185 104 334 236 41 227 185 105 350 242 67 80 100 117 351 243 65 248 194 116 335 237 65 248 194 117 351 243 105 350 242 129 0 154 104 334 236 128 0 179 104 334 236 129 0 154 116 335 237 117 351 243 140 0 178 141 0 151 140 0 178 117 351 243 123 336 148 124 352 202 147 337 223 148 353 231 147 337 223 124 352 202 135 338 149 136 354 203 159 339 222 160 355 230 159 339 222 136 354 203 161 0 89 162 0 87 185 0 7 186 0 6 185 0 7 162 0 87 149 0 93 150 0 91 173 0 19 174 0 18 173 0 19 150 0 91 226 162 131 224 203 159 266 163 132 267 205 160 266 163 132 224 203 159 234 164 133 276 207 163 236 214 170 271 283 206 236 214 170 276 207 163 218 60 238 282 323 239 220 284 207 278 285 208 220 284 207 282 323 239 242 58 66 240 59 67 285 161 130 288 212 168 285 161 130 240 59 67 222 204 161 196 332 234 220 284 207 195 348 240 220 284 207 196 332 234 246 46 54 208 333 235 244 47 56 207 349 241 244 47 56 208 333 235 237 304 216 235 239 185 299 356 242 298 342 236 299 356 242 235 239 185 261 106 100 259 262 194 311 357 243 310 343 237 311 357 243 259 262 194 299 356 242 298 342 236 323 1 154 322 1 179 323 1 154 298 342 236 310 343 237 334 1 178 311 357 243 335 1 151 311 357 243 334 1 178 317 344 148 341 345 223 318 358 202 342 359 231 318 358 202 341 345 223 329 346 149 353 347 222 330 360 203 354 361 230 330 360 203 353 347 222 355 1 89 379 1 7 356 1 87 380 1 6 356 1 87 379 1 7 343 1 93 367 1 19 344 1 91 368 1 18 344 1 91 367 1 19 72 250 196 33 251 197 73 223 181 31 142 140 73 223 181 33 251 197 82 225 183 77 292 215 41 227 185 43 293 216 41 227 185 77 292 215 88 331 233 84 294 217 25 96 116 27 196 173 25 96 116 84 294 217 91 249 195 49 98 118 94 233 191 47 31 79 94 233 191 49 98 118 26 273 207 24 22 238 1 348 240 0 24 244 1 348 240 24 22 238 50 8 56 48 18 66 13 349 241 12 20 68 13 349 241 48 18 66 43 293 216 45 30 78 105 350 242 106 32 80 105 350 242 45 30 78 67 80 100 69 28 76 117 351 243 118 29 77 117 351 243 69 28 76 105 350 242 106 32 80 129 0 154 130 0 84 129 0 154 106 32 80 118 29 77 142 0 82 117 351 243 141 0 151 117 351 243 142 0 82 124 352 202 125 40 92 148 353 231 149 41 93 148 353 231 125 40 92 136 354 203 137 36 88 160 355 230 161 37 89 160 355 230 137 36 88 163 0 96 187 0 5 162 0 87 186 0 6 162 0 87 187 0 5 151 0 95 175 0 17 150 0 91 174 0 18 150 0 91 175 0 17 266 264 196 267 235 181 227 265 197 225 167 140 227 265 197 267 235 181 276 238 183 235 239 185 271 303 215 237 304 216 271 303 215 235 239 185 282 341 233 219 120 116 278 305 217 221 215 173 278 305 217 219 120 116 285 263 195 288 245 191 243 122 118 241 68 79 243 122 118 288 245 191 220 284 207 195 348 240 218 60 238 194 24 244 218 60 238 195 348 240 244 47 56 207 349 241 242 58 66 206 20 68 242 58 66 207 349 241 237 304 216 299 356 242 239 66 78 300 67 80 239 66 78 299 356 242 261 106 100 311 357 243 263 63 76 312 65 77 263 63 76 311 357 243 299 356 242 323 1 154 300 67 80 324 1 84 300 67 80 323 1 154 312 65 77 311 357 243 336 1 82 335 1 151 336 1 82 311 357 243 318 358 202 342 359 231 319 75 92 343 77 93 319 75 92 342 359 231 330 360 203 354 361 230 331 71 88 355 73 89 331 71 88 354 361 230 357 1 96 356 1 87 381 1 5 380 1 6 381 1 5 356 1 87 345 1 95 344 1 91 369 1 17 368 1 18 369 1 17 344 1 91

+
+
+
+
+ + + + + 0.2 0.2 0.2 + + + + + + + + + + + + + + + + + + + + + + + 1.43267 0.427722 -2.98023e-008 + 0 1 0 0 + 1 0 0 0 + 0 0 1 349.847 + 1 1 1 + + + + + + + + + + + + -1.35233 0.427722 -2.98023e-008 + 0 1 0 0 + 1 0 0 0 + 0 0 1 349.847 + 1 1 1 + + + + + + + + + + + + + + 0 0 0 + 0 1 0 0 + 1 0 0 0 + 0 0 1 0 + 1 1 1 + + + 0 0 0 + 0 1 0 0 + 1 0 0 0 + 0 0 1 0 + 1 1 1 + + + + + + + +
diff --git a/Apps/SampleData/models/CesiumMilkTruck/CesiumMilkTruck.jpg b/Apps/SampleData/models/CesiumMilkTruck/CesiumMilkTruck.jpg new file mode 100644 index 000000000000..0bebaadc1874 Binary files /dev/null and b/Apps/SampleData/models/CesiumMilkTruck/CesiumMilkTruck.jpg differ diff --git a/Apps/SampleData/models/ParcLeadMine/ParcLeadMine.glb b/Apps/SampleData/models/ParcLeadMine/ParcLeadMine.glb new file mode 100644 index 000000000000..039106ffce3c Binary files /dev/null and b/Apps/SampleData/models/ParcLeadMine/ParcLeadMine.glb differ diff --git a/Apps/Sandcastle/CesiumSandcastle.js b/Apps/Sandcastle/CesiumSandcastle.js index 0e554218e2b4..626d40b28b05 100644 --- a/Apps/Sandcastle/CesiumSandcastle.js +++ b/Apps/Sandcastle/CesiumSandcastle.js @@ -550,6 +550,7 @@ require({ lineNumbers: true, matchBrackets: true, indentUnit: 2, + viewportMargin: 1300, extraKeys: { "Ctrl-Space": "autocomplete", F8: "runCesium", @@ -566,6 +567,7 @@ require({ lineNumbers: true, matchBrackets: true, indentUnit: 2, + viewportMargin: 1300, extraKeys: { F8: "runCesium", Tab: "indentMore", diff --git a/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html b/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html index b3a9850907e8..94183c92104e 100644 --- a/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html +++ b/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html @@ -39,6 +39,9 @@ terrainProvider: Cesium.createWorldTerrain(), }); + var scene = viewer.scene; + var globe = scene.globe; + // Tropics of Cancer and Capricorn var coffeeBeltRectangle = Cesium.Rectangle.fromDegrees( -180.0, @@ -47,9 +50,11 @@ 23.43687 ); - viewer.scene.globe.cartographicLimitRectangle = coffeeBeltRectangle; - viewer.scene.globe.showSkirts = false; - viewer.scene.skyAtmosphere.show = false; + globe.cartographicLimitRectangle = coffeeBeltRectangle; + globe.showSkirts = false; + globe.backFaceCulling = false; + globe.undergroundColor = undefined; + scene.skyAtmosphere.show = false; // Add rectangles to show bounds var rectangles = []; diff --git a/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.jpg b/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.jpg index db87f75e3b4c..71c823c9144e 100644 Binary files a/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.jpg and b/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.jpg differ diff --git a/Apps/Sandcastle/gallery/Cesium OSM Buildings.html b/Apps/Sandcastle/gallery/Cesium OSM Buildings.html new file mode 100755 index 000000000000..80e84f39a81d --- /dev/null +++ b/Apps/Sandcastle/gallery/Cesium OSM Buildings.html @@ -0,0 +1,62 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+
+ + + diff --git a/Apps/Sandcastle/gallery/Cesium OSM Buildings.jpg b/Apps/Sandcastle/gallery/Cesium OSM Buildings.jpg new file mode 100755 index 000000000000..37352a97802c Binary files /dev/null and b/Apps/Sandcastle/gallery/Cesium OSM Buildings.jpg differ diff --git a/Apps/Sandcastle/gallery/Custom Geocoder.html b/Apps/Sandcastle/gallery/Custom Geocoder.html index eaec37884faf..f145f240a408 100644 --- a/Apps/Sandcastle/gallery/Custom Geocoder.html +++ b/Apps/Sandcastle/gallery/Custom Geocoder.html @@ -56,7 +56,7 @@ * The function called to geocode using this geocoder service. * * @param {String} input The query to be sent to the geocoder service - * @returns {Promise} + * @returns {Promise} */ OpenStreetMapNominatimGeocoder.prototype.geocode = function (input) { var endpoint = "https://nominatim.openstreetmap.org/search"; diff --git a/Apps/Sandcastle/gallery/Earth at Night.html b/Apps/Sandcastle/gallery/Earth at Night.html index 50e92f081f8d..c882a10d24fd 100644 --- a/Apps/Sandcastle/gallery/Earth at Night.html +++ b/Apps/Sandcastle/gallery/Earth at Night.html @@ -39,6 +39,40 @@ var viewer = new Cesium.Viewer("cesiumContainer", { imageryProvider: new Cesium.IonImageryProvider({ assetId: 3812 }), }); + + // The rest of the code is for dynamic lighting + var dynamicLighting = false; + + viewer.clock.multiplier = 4000; + + var imageryLayers = viewer.imageryLayers; + var nightLayer = imageryLayers.get(0); + var dayLayer = imageryLayers.addImageryProvider( + new Cesium.IonImageryProvider({ + assetId: 3845, + }) + ); + imageryLayers.lowerToBottom(dayLayer); + + function updateLighting(dynamicLighting) { + dayLayer.show = dynamicLighting; + viewer.scene.globe.enableLighting = dynamicLighting; + viewer.clock.shouldAnimate = dynamicLighting; + + // If dynamic lighting is enabled, make the night imagery invisible + // on the lit side of the globe. + nightLayer.dayAlpha = dynamicLighting ? 0.0 : 1.0; + } + + updateLighting(dynamicLighting); + + Sandcastle.addToggleButton( + "Dynamic lighting", + dynamicLighting, + function (checked) { + updateLighting(checked); + } + ); //Sandcastle_End Sandcastle.finishedLoading(); } diff --git a/Apps/Sandcastle/gallery/Export KML.html b/Apps/Sandcastle/gallery/Export KML.html index 52bf40434f3a..a9c84099a029 100644 --- a/Apps/Sandcastle/gallery/Export KML.html +++ b/Apps/Sandcastle/gallery/Export KML.html @@ -49,8 +49,8 @@ version: "1.0", }, { - id: "aircraft model", - name: "Cesium Air", + id: "truck model", + name: "Cesium Milk Truck", position: { cartographicDegrees: [-77, 37, 0], }, @@ -85,7 +85,7 @@ }); var texturePromise = Cesium.Resource.fetchBlob({ - url: "../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.png", + url: "../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.jpg", }); // This callback allows us to set the URL of the model to use @@ -96,7 +96,7 @@ if (resource.url.indexOf("CesiumMilkTruck") !== -1) { externalFiles["model/CesiumMilkTruck.dae"] = daeModelPromise; - externalFiles["model/CesiumMilkTruck.png"] = texturePromise; + externalFiles["model/CesiumMilkTruck.jpg"] = texturePromise; return "model/CesiumMilkTruck.dae"; } @@ -132,7 +132,7 @@ .add(dataSourcePromise) .then(function (dataSource) { viewer.trackedEntity = dataSource.entities.getById( - "aircraft model" + "truck model" ); }); }, @@ -152,7 +152,8 @@ }) .then(function (result) { downloadBlob(filenameToSave, result.kmz); - }); + }) + .otherwise(console.error); }); //Sandcastle_End Sandcastle.finishedLoading(); diff --git a/Apps/Sandcastle/gallery/Fog Post Process.html b/Apps/Sandcastle/gallery/Fog Post Process.html new file mode 100644 index 000000000000..13b3a8c884bc --- /dev/null +++ b/Apps/Sandcastle/gallery/Fog Post Process.html @@ -0,0 +1,116 @@ + + + + + + + + + Cesium Demo + + + + + +
+

Loading...

+
+ + + diff --git a/Apps/Sandcastle/gallery/Fog Post Process.jpg b/Apps/Sandcastle/gallery/Fog Post Process.jpg new file mode 100644 index 000000000000..7bc69a059cbd Binary files /dev/null and b/Apps/Sandcastle/gallery/Fog Post Process.jpg differ diff --git a/Apps/Sandcastle/gallery/Globe Interior.html b/Apps/Sandcastle/gallery/Globe Interior.html new file mode 100644 index 000000000000..9560ac61dff2 --- /dev/null +++ b/Apps/Sandcastle/gallery/Globe Interior.html @@ -0,0 +1,190 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+
+ + + diff --git a/Apps/Sandcastle/gallery/Globe Interior.jpg b/Apps/Sandcastle/gallery/Globe Interior.jpg new file mode 100644 index 000000000000..be1e03bf687c Binary files /dev/null and b/Apps/Sandcastle/gallery/Globe Interior.jpg differ diff --git a/Apps/Sandcastle/gallery/Globe Translucency.html b/Apps/Sandcastle/gallery/Globe Translucency.html new file mode 100644 index 000000000000..2cb67a4ceff8 --- /dev/null +++ b/Apps/Sandcastle/gallery/Globe Translucency.html @@ -0,0 +1,313 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+
+ + + + + + + + + + + + + + + + + + + +
Translucency enabled + +
Fade by distance + +
Show vector data + +
Alpha + + +
+
+ + + diff --git a/Apps/Sandcastle/gallery/Globe Translucency.jpg b/Apps/Sandcastle/gallery/Globe Translucency.jpg new file mode 100644 index 000000000000..80bcc9531cd5 Binary files /dev/null and b/Apps/Sandcastle/gallery/Globe Translucency.jpg differ diff --git a/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html b/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html index 90df4ebff6e7..7c46b515a0c4 100644 --- a/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html +++ b/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html @@ -161,9 +161,8 @@ addBaseLayerOption("Bing Maps Aerial", undefined); // the current base layer addBaseLayerOption( "Bing Maps Road", - new Cesium.BingMapsImageryProvider({ - url: "https://dev.virtualearth.net", - mapStyle: Cesium.BingMapsStyle.ROAD, + Cesium.createWorldImagery({ + style: Cesium.IonWorldImageryStyle.ROAD, }) ); addBaseLayerOption( diff --git a/Apps/Sandcastle/gallery/Terrain Clipping Planes.html b/Apps/Sandcastle/gallery/Terrain Clipping Planes.html index 8a49925d6954..af89876e7be6 100644 --- a/Apps/Sandcastle/gallery/Terrain Clipping Planes.html +++ b/Apps/Sandcastle/gallery/Terrain Clipping Planes.html @@ -362,6 +362,9 @@ ), ], unionClippingRegions: true, + edgeWidth: edgeStylingEnabled ? 1.0 : 0.0, + edgeColor: Cesium.Color.WHITE, + enabled: clippingPlanesEnabled, }); globe.backFaceCulling = false; globe.showSkirts = false; diff --git a/Apps/Sandcastle/gallery/Underground Color.html b/Apps/Sandcastle/gallery/Underground Color.html new file mode 100644 index 000000000000..ad05cf450577 --- /dev/null +++ b/Apps/Sandcastle/gallery/Underground Color.html @@ -0,0 +1,230 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+
+ + + + + + + + + + + + + + + + + + + + + + + +
Enabled + +
Near distance + + +
Far distance + + +
Near alpha + + +
Far alpha + + +
+
+ + + diff --git a/Apps/Sandcastle/gallery/Underground Color.jpg b/Apps/Sandcastle/gallery/Underground Color.jpg new file mode 100644 index 000000000000..77bb505db6b2 Binary files /dev/null and b/Apps/Sandcastle/gallery/Underground Color.jpg differ diff --git a/CHANGES.md b/CHANGES.md index fe3a917080f3..3b07c0f7430c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,14 +1,64 @@ # Change Log +### 1.70.1 - 2020-06-10 + +##### Additions :tada: + +- Add a `toString` method to the `Resource` class in case an instance gets logged as a string. [#8722](https://github.com/CesiumGS/cesium/issues/8722) +- Exposed `Transforms.rotationMatrixFromPositionVelocity` method from Cesium's private API. [#8927](https://github.com/CesiumGS/cesium/issues/8927) + +##### Fixes :wrench: + +- Fixed JSDoc and TypeScript type definitions for all `ImageryProvider` types, which were missing `defaultNightAlpha` and `defaultDayAlpha` properties. [#8908](https://github.com/CesiumGS/cesium/pull/8908) +- Fixed JSDoc and TypeScript for `MaterialProperty`, which were missing the ability to take primitive types in their constructor. [#8904](https://github.com/CesiumGS/cesium/pull/8904) +- Fixed JSDoc and TypeScript type definitions to allow the creation of `GeometryInstance` instances using `XXXGeometry` classes. [#8941](https://github.com/CesiumGS/cesium/pull/8941). +- Fixed JSDoc and TypeScript for `buildModuleUrl`, which was accidentally excluded from the official CesiumJS API. [#8923](https://github.com/CesiumGS/cesium/pull/8923) +- Fixed JSDoc and TypeScript type definitions for `EllipsoidGeodesic` which incorrectly listed `result` as required. [#8904](https://github.com/CesiumGS/cesium/pull/8904) +- Fixed JSDoc and TypeScript type definitions for `EllipsoidTangentPlane.fromPoints`, which takes an array of `Cartesian3`, not a single instance. [#8928](https://github.com/CesiumGS/cesium/pull/8928) +- Fixed JSDoc and TypeScript type definitions for `EntityCollection.getById` and `CompositeEntityCollection.getById`, which can both return undefined. [#8928](https://github.com/CesiumGS/cesium/pull/8928) +- Fixed JSDoc and TypeScript type definitions for `Viewer` options parameters. +- Fixed a memory leak where some 3D Tiles requests were being unintentionally retained after the requests were cancelled. [#8843](https://github.com/CesiumGS/cesium/pull/8843) +- Fixed a bug with handling of PixelFormat's flipY. [#8893](https://github.com/CesiumGS/cesium/pull/8893) + ### 1.70.0 - 2020-06-01 +##### Major Announcements :loudspeaker: + +- All Cesium ion users now have access to Cesium OSM Buildings - a 3D buildings layer covering the entire world built with OpenStreetMap building data, available as 3D Tiles. Read more about it [on our blog](https://cesium.com/blog/2020/06/01/cesium-osm-buildings/). + - [Explore it on Sandcastle](https://sandcastle.cesium.com/index.html?src=Cesium%20OSM%20Buildings.html). + - Add it to your CesiumJS app: `viewer.scene.primitives.add(Cesium.createOsmBuildings())`. + - Contains per-feature data like building name, address, and much more. [Read more about the available properties](https://cesium.com/content/cesium-osm-buildings/). +- CesiumJS now ships with official TypeScript type definitions! [#8878](https://github.com/CesiumGS/cesium/pull/8878) + - If you import CesiumJS as a module, the new definitions will automatically be used by TypeScript and related tooling. + - If you import individual CesiumJS source files directly, you'll need to add `"types": ["cesium"]` in your tsconfig.json in order for the definitions to be used. + - If you’re using your own custom definitions and you’re not yet ready to switch, you can delete `Source/Cesium.d.ts` after install. + - See our [blog post](https://cesium.com/blog/2020/06/01/cesiumjs-tsd/) for more information and a technical overview of how it all works. +- CesiumJS now supports underground rendering with globe translucency! [#8726](https://github.com/CesiumGS/cesium/pull/8726) + - Added options for controlling globe translucency through the new [`GlobeTranslucency`](https://cesium.com/docs/cesiumjs-ref-doc/GlobeTranslucency.html) object including front face alpha, back face alpha, and a translucency rectangle. + - Added `Globe.undergroundColor` and `Globe.undergroundColorAlphaByDistance` for controlling how the back side of the globe is rendered when the camera is underground or the globe is translucent. [#8867](https://github.com/CesiumGS/cesium/pull/8867) + - Improved camera controls when the camera is underground. [#8811](https://github.com/CesiumGS/cesium/pull/8811) + - Sandcastle examples: [Globe Translucency](https://sandcastle.cesium.com/?src=Globe%20Translucency.html), [Globe Interior](https://sandcastle.cesium.com/?src=Globe%20Interior.html), and [Underground Color](https://sandcastle.cesium.com/?src=Underground%20Color.html&label=All) + ##### Additions :tada: +- Our API reference documentation has received dozens of fixes and improvements, largely due to the TypeScript effort. - Added `Cesium3DTileset.extensions` to get the extensions property from the tileset JSON. [#8829](https://github.com/CesiumGS/cesium/pull/8829) +- Added `Camera.completeFlight`, which causes the current camera flight to immediately jump to the final destination and call its complete callback. [#8788](https://github.com/CesiumGS/cesium/pull/8788) +- Added `nightAlpha` and `dayAlpha` properties to `ImageryLayer` to control alpha separately for the night and day sides of the globe. [#8868](https://github.com/CesiumGS/cesium/pull/8868) +- Added `SkyAtmosphere.perFragmentAtmosphere` to switch between per-vertex and per-fragment atmosphere shading. [#8866](https://github.com/CesiumGS/cesium/pull/8866) +- Added a new sandcastle example to show how to add fog using a `PostProcessStage` [#8798](https://github.com/CesiumGS/cesium/pull/8798) +- Added `frustumSplits` option to `DebugCameraPrimitive`. [8849](https://github.com/CesiumGS/cesium/pull/8849) +- Supported `#rgba` and `#rrggbbaa` formats in `Color.fromCssColorString`. [8873](https://github.com/CesiumGS/cesium/pull/8873) ##### Fixes :wrench: -- This fixes a bug where a removed billboard can prevent changing of the terrainProvider [#8766](https://github.com/CesiumGS/cesium/pull/8766) +- Fixed a bug that could cause rendering of a glTF model to become corrupt when switching from a Uint16 to a Uint32 index buffer to accomodate new vertices added for edge outlining. [#8820](https://github.com/CesiumGS/cesium/pull/8820) +- Fixed a bug where a removed billboard could prevent changing of the `TerrainProvider`. [#8766](https://github.com/CesiumGS/cesium/pull/8766) +- Fixed an issue with 3D Tiles point cloud styling where `${feature.propertyName}` and `${feature["propertyName"]}` syntax would cause a crash. Also fixed an issue where property names with non-alphanumeric characters would crash. [#8785](https://github.com/CesiumGS/cesium/pull/8785) +- Fixed a bug where `DebugCameraPrimitive` was ignoring the near and far planes of the `Camera`. [#8848](https://github.com/CesiumGS/cesium/issues/8848) +- Fixed sky atmosphere artifacts below the horizon. [#8866](https://github.com/CesiumGS/cesium/pull/8866) +- Fixed ground primitives in orthographic mode. [#5110](https://github.com/CesiumGS/cesium/issues/5110) +- Fixed the depth plane in orthographic mode. This improves the quality of polylines and other primitives that are rendered near the horizon. [8858](https://github.com/CesiumGS/cesium/pull/8858) ### 1.69.0 - 2020-05-01 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 647a89147d1c..1a993d617dee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,7 +79,7 @@ Our code is our lifeblood so maintaining CesiumJS's high code quality is importa - If you added new identifiers to the CesiumJS API: - Update [CHANGES.md](CHANGES.md). - Include reference documentation with code examples. Follow the [Documentation Guide](Documentation/Contributors/DocumentationGuide/README.md). - - If the change is significant, add a new [Sandcastle](https://sandcastle.cesium.com) example or extend and existing one. + - If the change is significant, add a new [Sandcastle](https://sandcastle.cesium.com) example or extend an existing one. - If you added third-party libraries, including new version of existing libraries, update [LICENSE.md](LICENSE.md). Mention it in [CHANGES.md](CHANGES.md). If you plan to add a third-party library, start a [GitHub issue](https://github.com/CesiumGS/cesium/issues/new) discussing it first. ## Code of Conduct diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 56a2e370dffe..ded4552a8d07 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -143,10 +143,13 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu - [Samuel Vargas](https://github.com/Samulus) - [Sam Suhag](https://github.com/sanjeetsuhag) - [Youssef Victor](https://github.com/YoussefV) + - [Eli Bogomolny](https://github.com/ebogo1) - [Northrop Grumman](http://www.northropgrumman.com) - [Joseph Stein](https://github.com/nahgrin) - [EOX IT Services GmbH](https://eox.at) - [Daniel Santillan](https://github.com/santilland) +- [Navagis, Inc.](https://navagis.com/) + - [Jonathan Nogueira](https://github.com/LuminousPath) ## [Individual CLA](Documentation/Contributors/CLAs/individual-contributor-license-agreement-v1.0.pdf) @@ -256,3 +259,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu - [SungHo Lim](https://github.com/SambaLim) - [Michael Fink](https://github.com/vividos) - [Jakub Vrana](https://github.com/vrana) +- [Edvinas Pranka](https://github.com/epranka) +- [James Bromwell](https://github.com/thw0rted) +- [Brandon Nguyen](https://github.com/bn-dignitas) +- [Wang Bao](https://github.com/xiaobaogeit) +- [John Remsberg](https://github.com/easternmotors) diff --git a/Documentation/Contributors/DocumentationGuide/README.md b/Documentation/Contributors/DocumentationGuide/README.md index d20b1884d9e3..788700a900d7 100644 --- a/Documentation/Contributors/DocumentationGuide/README.md +++ b/Documentation/Contributors/DocumentationGuide/README.md @@ -25,6 +25,7 @@ Generally, just follow the patterns that are already in comparable parts of the - [Property](#property) - [Property Getter/Setter](#property-gettersetter) - [Standalone Function](#standalone-function) +- [TypeScript type definitions](#typescript) ## Building the Doc @@ -52,7 +53,7 @@ Consider one of the simplest functions in CesiumJS, `defined`: ```javascript /** - * @exports defined + * @function * * @param {*} value The object. * @returns {Boolean} Returns true if the object is defined, returns false otherwise. @@ -70,7 +71,7 @@ function defined(value) { ``` - The doc for `defined` is in the comment starting with `/**`. JSDoc tags begin with `@`. -- `@exports` describes the name of the function that is exported from the module. +- `@function` tells JSDoc that this is a function. - `@param` describes the function's parameters, and `@returns` describes the function's return value. - `@example` describes a code sample. @@ -379,7 +380,7 @@ Cartesian4.fromArray = Cartesian4.unpack; /** * Sort the items in the queue in-place. * - * @param {Queue~Comparator} compareFunction A function that defines the sort order. + * @param {Queue.Comparator} compareFunction A function that defines the sort order. */ Queue.prototype.sort = function (compareFunction) { if (this._offset > 0) { @@ -393,7 +394,7 @@ Queue.prototype.sort = function (compareFunction) { /** * A function used to compare two items while sorting a queue. - * @callback Queue~Comparator + * @callback Queue.Comparator * * @param {*} a An item in the array. * @param {*} b An item in the array. @@ -535,7 +536,7 @@ DESCRIPTION. ``` DESCRIPTION. -@exports NAME +@function @param {TYPE} NAME DESCRIPTION. @param {TYPE|OTHER_TYPE} NAME DESCRIPTION WITH LONG @@ -552,3 +553,13 @@ DESCRIPTION. [@private] ``` + +# TypeScript + +We also use JSDoc to build official TypeScript type definitions. Normally this behavior is transparent to the developer and happens as part of CI, however incorrect or non-standard JSDoc can lead to failures. If CI is failing because of the `build-ts` step, you can debug it locally by running: + +``` +npm run build-ts +``` + +In most cases, the TypeScript compiler will provide a very obvious error and line number which will help you track down the offending, most likely incorrect, JSDoc. diff --git a/LICENSE.md b/LICENSE.md index e41511605215..0c99e6fa6fa4 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -959,6 +959,12 @@ Creative Commons Attribution 3.0 (c) copyright 2012, Dennis Haupt http://www.blendswap.com/blends/view/61653 +### Perc Lead Mine + +Creative Commons Attribution 4.0 International +(c) copyright 2019, Dr Edward Alan Lockhart +https://sketchfab.com/3d-models/parc-lead-mine-4759a23abbff454c8c682ff9b02ba111 + ### GitHub logo https://github.com/logos diff --git a/Source/Core/ApproximateTerrainHeights.js b/Source/Core/ApproximateTerrainHeights.js index 76138aa5a333..c571d4dadf09 100644 --- a/Source/Core/ApproximateTerrainHeights.js +++ b/Source/Core/ApproximateTerrainHeights.js @@ -36,7 +36,7 @@ var ApproximateTerrainHeights = {}; /** * Initializes the minimum and maximum terrain heights - * @return {Promise} + * @return {Promise} */ ApproximateTerrainHeights.initialize = function () { var initPromise = ApproximateTerrainHeights._initPromise; diff --git a/Source/Core/ArcGISTiledElevationTerrainProvider.js b/Source/Core/ArcGISTiledElevationTerrainProvider.js index f60d5d4d6e6b..19058e16cd03 100644 --- a/Source/Core/ArcGISTiledElevationTerrainProvider.js +++ b/Source/Core/ArcGISTiledElevationTerrainProvider.js @@ -294,6 +294,19 @@ Object.defineProperties(ArcGISTiledElevationTerrainProvider.prototype, { return false; }, }, + /** + * Gets an object that can be used to determine availability of terrain from this provider, such as + * at points and in rectangles. This function should not be called before + * {@link TerrainProvider#ready} returns true. This property may be undefined if availability + * information is not available. + * @memberof ArcGISTiledElevationTerrainProvider.prototype + * @type {TileAvailability} + */ + availability: { + get: function () { + return undefined; + }, + }, }); /** @@ -459,7 +472,7 @@ ArcGISTiledElevationTerrainProvider.prototype.getTileDataAvailable = function ( * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded + * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded */ ArcGISTiledElevationTerrainProvider.prototype.loadTileDataAvailability = function ( x, diff --git a/Source/Core/ArcType.js b/Source/Core/ArcType.js index be4685caba9f..2c53d3b539cd 100644 --- a/Source/Core/ArcType.js +++ b/Source/Core/ArcType.js @@ -1,7 +1,7 @@ /** * ArcType defines the path that should be taken connecting vertices. * - * @exports ArcType + * @enum {Number} */ var ArcType = { /** diff --git a/Source/Core/AttributeCompression.js b/Source/Core/AttributeCompression.js index e50ee42734f1..dcabcdcb617d 100644 --- a/Source/Core/AttributeCompression.js +++ b/Source/Core/AttributeCompression.js @@ -11,7 +11,7 @@ var LEFT_SHIFT = 256.0; /** * Attribute compression and decompression functions. * - * @exports AttributeCompression + * @namespace AttributeCompression * * @private */ diff --git a/Source/Core/BingMapsApi.js b/Source/Core/BingMapsApi.js index aa98a5c11a07..4b8ce8feaa5b 100644 --- a/Source/Core/BingMapsApi.js +++ b/Source/Core/BingMapsApi.js @@ -7,7 +7,7 @@ import defined from "./defined.js"; * or {@link BingMapsGeocoderService}. You can create your own key at * {@link https://www.bingmapsportal.com/}. * - * @exports BingMapsApi + * @namespace BingMapsApi */ var BingMapsApi = {}; @@ -19,6 +19,12 @@ var BingMapsApi = {}; */ BingMapsApi.defaultKey = undefined; +/** + * Gets the key to use to access the Bing Maps API. If the provided + * key is defined, it is returned. Otherwise, returns {@link BingMapsApi.defaultKey}. + * @param {string|null|undefined} providedKey The provided key to use if defined. + * @returns {string|undefined} The Bing Maps API key to use. + */ BingMapsApi.getKey = function (providedKey) { if (defined(providedKey)) { return providedKey; diff --git a/Source/Core/BingMapsGeocoderService.js b/Source/Core/BingMapsGeocoderService.js index 9c612328ed7d..82ba8af08a2c 100644 --- a/Source/Core/BingMapsGeocoderService.js +++ b/Source/Core/BingMapsGeocoderService.js @@ -58,7 +58,7 @@ Object.defineProperties(BingMapsGeocoderService.prototype, { * @function * * @param {String} query The query to be sent to the geocoder service - * @returns {Promise} + * @returns {Promise} */ BingMapsGeocoderService.prototype.geocode = function (query) { //>>includeStart('debug', pragmas.debug); diff --git a/Source/Core/Cartesian2.js b/Source/Core/Cartesian2.js index 012eed00c8ad..64a5ca0422bf 100644 --- a/Source/Core/Cartesian2.js +++ b/Source/Core/Cartesian2.js @@ -665,7 +665,7 @@ Cartesian2.equalsArray = function (cartesian, array, offset) { * * @param {Cartesian2} [left] The first Cartesian. * @param {Cartesian2} [right] The second Cartesian. - * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. + * @param {Number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ @@ -745,7 +745,7 @@ Cartesian2.prototype.equals = function (right) { * false otherwise. * * @param {Cartesian2} [right] The right hand side Cartesian. - * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. + * @param {Number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} true if they are within the provided epsilon, false otherwise. */ diff --git a/Source/Core/Cartesian3.js b/Source/Core/Cartesian3.js index ea2b96056caf..fa224fbf6490 100644 --- a/Source/Core/Cartesian3.js +++ b/Source/Core/Cartesian3.js @@ -742,7 +742,7 @@ Cartesian3.equalsArray = function (cartesian, array, offset) { * * @param {Cartesian3} [left] The first Cartesian. * @param {Cartesian3} [right] The second Cartesian. - * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. + * @param {Number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ @@ -1152,7 +1152,7 @@ Cartesian3.prototype.equals = function (right) { * false otherwise. * * @param {Cartesian3} [right] The right hand side Cartesian. - * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. + * @param {Number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} true if they are within the provided epsilon, false otherwise. */ diff --git a/Source/Core/Cartesian4.js b/Source/Core/Cartesian4.js index 82087c3bcd9b..3309b0749536 100644 --- a/Source/Core/Cartesian4.js +++ b/Source/Core/Cartesian4.js @@ -735,7 +735,7 @@ Cartesian4.equalsArray = function (cartesian, array, offset) { * * @param {Cartesian4} [left] The first Cartesian. * @param {Cartesian4} [right] The second Cartesian. - * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. + * @param {Number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ @@ -843,7 +843,7 @@ Cartesian4.prototype.equals = function (right) { * false otherwise. * * @param {Cartesian4} [right] The right hand side Cartesian. - * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. + * @param {Number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} true if they are within the provided epsilon, false otherwise. */ diff --git a/Source/Core/Cartographic.js b/Source/Core/Cartographic.js index 42cb40cf9c5b..d0b7b144c463 100644 --- a/Source/Core/Cartographic.js +++ b/Source/Core/Cartographic.js @@ -233,13 +233,11 @@ Cartographic.equals = function (left, right) { * * @param {Cartographic} [left] The first cartographic. * @param {Cartographic} [right] The second cartographic. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ Cartographic.equalsEpsilon = function (left, right, epsilon) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.number("epsilon", epsilon); - //>>includeEnd('debug'); + epsilon = defaultValue(epsilon, 0); return ( left === right || @@ -286,7 +284,7 @@ Cartographic.prototype.equals = function (right) { * false otherwise. * * @param {Cartographic} [right] The second cartographic. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ Cartographic.prototype.equalsEpsilon = function (right, epsilon) { diff --git a/Source/Core/CartographicGeocoderService.js b/Source/Core/CartographicGeocoderService.js index 68b090f8ede6..dabaa326886b 100644 --- a/Source/Core/CartographicGeocoderService.js +++ b/Source/Core/CartographicGeocoderService.js @@ -15,7 +15,7 @@ function CartographicGeocoderService() {} * @function * * @param {String} query The query to be sent to the geocoder service - * @returns {Promise} + * @returns {Promise} */ CartographicGeocoderService.prototype.geocode = function (query) { //>>includeStart('debug', pragmas.debug); diff --git a/Source/Core/CesiumTerrainProvider.js b/Source/Core/CesiumTerrainProvider.js index d7dfee685e15..587611b98e29 100644 --- a/Source/Core/CesiumTerrainProvider.js +++ b/Source/Core/CesiumTerrainProvider.js @@ -485,7 +485,7 @@ function CesiumTerrainProvider(options) { * When using the Quantized-Mesh format, a tile may be returned that includes additional extensions, such as PerVertexNormals, watermask, etc. * This enumeration defines the unique identifiers for each type of extension data that has been appended to the standard mesh data. * - * @exports QuantizedMeshExtensionIds + * @namespace QuantizedMeshExtensionIds * @see CesiumTerrainProvider * @private */ @@ -1201,7 +1201,7 @@ CesiumTerrainProvider.prototype.getTileDataAvailable = function (x, y, level) { * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded + * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded */ CesiumTerrainProvider.prototype.loadTileDataAvailability = function ( x, diff --git a/Source/Core/ClockRange.js b/Source/Core/ClockRange.js index c4aeb2255b39..adc12d477499 100644 --- a/Source/Core/ClockRange.js +++ b/Source/Core/ClockRange.js @@ -2,7 +2,7 @@ * Constants used by {@link Clock#tick} to determine behavior * when {@link Clock#startTime} or {@link Clock#stopTime} is reached. * - * @exports ClockRange + * @enum {Number} * * @see Clock * @see ClockStep diff --git a/Source/Core/ClockStep.js b/Source/Core/ClockStep.js index 4675cf7f4551..269fbddaf8bf 100644 --- a/Source/Core/ClockStep.js +++ b/Source/Core/ClockStep.js @@ -2,7 +2,7 @@ * Constants to determine how much time advances with each call * to {@link Clock#tick}. * - * @exports ClockStep + * @enum {Number} * * @see Clock * @see ClockRange diff --git a/Source/Core/Color.js b/Source/Core/Color.js index ed52b6331591..a70a4cfe8f07 100644 --- a/Source/Core/Color.js +++ b/Source/Core/Color.js @@ -347,19 +347,19 @@ Color.fromRandom = function (options, result) { return result; }; -//#rgb -var rgbMatcher = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i; -//#rrggbb -var rrggbbMatcher = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i; +//#rgba +var rgbaMatcher = /^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i; +//#rrggbbaa +var rrggbbaaMatcher = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i; //rgb(), rgba(), or rgb%() var rgbParenthesesMatcher = /^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i; -//hsl(), hsla(), or hsl%() +//hsl() or hsla() var hslParenthesesMatcher = /^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i; /** * Creates a Color instance from a CSS color value. * - * @param {String} color The CSS color value in #rgb, #rrggbb, rgb(), rgba(), hsl(), or hsla() format. + * @param {String} color The CSS color value in #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(), rgba(), hsl(), or hsla() format. * @param {Color} [result] The object to store the result in, if undefined a new instance will be created. * @returns {Color} The color object, or undefined if the string was not a valid CSS color. * @@ -385,21 +385,21 @@ Color.fromCssColorString = function (color, result) { return result; } - var matches = rgbMatcher.exec(color); + var matches = rgbaMatcher.exec(color); if (matches !== null) { result.red = parseInt(matches[1], 16) / 15; result.green = parseInt(matches[2], 16) / 15.0; result.blue = parseInt(matches[3], 16) / 15.0; - result.alpha = 1.0; + result.alpha = parseInt(defaultValue(matches[4], "f"), 16) / 15.0; return result; } - matches = rrggbbMatcher.exec(color); + matches = rrggbbaaMatcher.exec(color); if (matches !== null) { result.red = parseInt(matches[1], 16) / 255.0; result.green = parseInt(matches[2], 16) / 255.0; result.blue = parseInt(matches[3], 16) / 255.0; - result.alpha = 1.0; + result.alpha = parseInt(defaultValue(matches[4], "ff"), 16) / 255.0; return result; } diff --git a/Source/Core/ComponentDatatype.js b/Source/Core/ComponentDatatype.js index b4cdf116f70d..56c73c4099a8 100644 --- a/Source/Core/ComponentDatatype.js +++ b/Source/Core/ComponentDatatype.js @@ -7,7 +7,7 @@ import WebGLConstants from "./WebGLConstants.js"; * WebGL component datatypes. Components are intrinsics, * which form attributes, which form vertices. * - * @exports ComponentDatatype + * @enum {Number} */ var ComponentDatatype = { /** @@ -137,7 +137,7 @@ ComponentDatatype.getSizeInBytes = function (componentDatatype) { /** * Gets the {@link ComponentDatatype} for the provided TypedArray instance. * - * @param {TypedArray} array The typed array. + * @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} array The typed array. * @returns {ComponentDatatype} The ComponentDatatype for the provided array, or undefined if the array is not a TypedArray. */ ComponentDatatype.fromTypedArray = function (array) { diff --git a/Source/Core/CornerType.js b/Source/Core/CornerType.js index 0260a53fe8a0..202d36dac32a 100644 --- a/Source/Core/CornerType.js +++ b/Source/Core/CornerType.js @@ -4,7 +4,7 @@ * @demo The {@link https://sandcastle.cesium.com/index.html?src=Corridor.html&label=Geometries|Corridor Demo} * demonstrates the three corner types, as used by {@link CorridorGraphics}. * - * @exports CornerType + * @enum {Number} */ var CornerType = { /** diff --git a/Source/Core/CubicRealPolynomial.js b/Source/Core/CubicRealPolynomial.js index c4b3390444f7..c87a43497238 100644 --- a/Source/Core/CubicRealPolynomial.js +++ b/Source/Core/CubicRealPolynomial.js @@ -4,7 +4,7 @@ import QuadraticRealPolynomial from "./QuadraticRealPolynomial.js"; /** * Defines functions for 3rd order polynomial functions of one variable with only real coefficients. * - * @exports CubicRealPolynomial + * @namespace CubicRealPolynomial */ var CubicRealPolynomial = {}; diff --git a/Source/Core/DefaultProxy.js b/Source/Core/DefaultProxy.js index 948675d8b968..38ac7f817973 100644 --- a/Source/Core/DefaultProxy.js +++ b/Source/Core/DefaultProxy.js @@ -4,6 +4,7 @@ * * @alias DefaultProxy * @constructor + * @extends {Proxy} * * @param {String} proxy The proxy URL that will be used to requests all resources. */ @@ -21,4 +22,5 @@ DefaultProxy.prototype.getURL = function (resource) { var prefix = this.proxy.indexOf("?") === -1 ? "?" : ""; return this.proxy + prefix + encodeURIComponent(resource); }; + export default DefaultProxy; diff --git a/Source/Core/EarthOrientationParameters.js b/Source/Core/EarthOrientationParameters.js index 27ddc9eeefa7..11b697533d42 100644 --- a/Source/Core/EarthOrientationParameters.js +++ b/Source/Core/EarthOrientationParameters.js @@ -136,7 +136,7 @@ EarthOrientationParameters.NONE = Object.freeze({ * Gets a promise that, when resolved, indicates that the EOP data has been loaded and is * ready to use. * - * @returns {Promise} The promise. + * @returns {Promise} The promise. */ EarthOrientationParameters.prototype.getPromiseToLoad = function () { return when(this._downloadPromise); diff --git a/Source/Core/EasingFunction.js b/Source/Core/EasingFunction.js index d3573cf158e9..c38aeddabad7 100644 --- a/Source/Core/EasingFunction.js +++ b/Source/Core/EasingFunction.js @@ -5,13 +5,13 @@ import Tween from "../ThirdParty/Tween.js"; * {@link https://github.com/sole/tween.js/|Tween.js} and Robert Penner. See the * {@link http://sole.github.io/tween.js/examples/03_graphs.html|Tween.js graphs for each function}. * - * @exports EasingFunction + * @namespace */ var EasingFunction = { /** * Linear easing. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ LINEAR_NONE: Tween.Easing.Linear.None, @@ -19,21 +19,21 @@ var EasingFunction = { /** * Quadratic in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ QUADRACTIC_IN: Tween.Easing.Quadratic.In, /** * Quadratic out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ QUADRACTIC_OUT: Tween.Easing.Quadratic.Out, /** * Quadratic in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ QUADRACTIC_IN_OUT: Tween.Easing.Quadratic.InOut, @@ -41,21 +41,21 @@ var EasingFunction = { /** * Cubic in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ CUBIC_IN: Tween.Easing.Cubic.In, /** * Cubic out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ CUBIC_OUT: Tween.Easing.Cubic.Out, /** * Cubic in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ CUBIC_IN_OUT: Tween.Easing.Cubic.InOut, @@ -63,21 +63,21 @@ var EasingFunction = { /** * Quartic in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ QUARTIC_IN: Tween.Easing.Quartic.In, /** * Quartic out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ QUARTIC_OUT: Tween.Easing.Quartic.Out, /** * Quartic in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ QUARTIC_IN_OUT: Tween.Easing.Quartic.InOut, @@ -85,21 +85,21 @@ var EasingFunction = { /** * Quintic in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ QUINTIC_IN: Tween.Easing.Quintic.In, /** * Quintic out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ QUINTIC_OUT: Tween.Easing.Quintic.Out, /** * Quintic in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ QUINTIC_IN_OUT: Tween.Easing.Quintic.InOut, @@ -107,21 +107,21 @@ var EasingFunction = { /** * Sinusoidal in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ SINUSOIDAL_IN: Tween.Easing.Sinusoidal.In, /** * Sinusoidal out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ SINUSOIDAL_OUT: Tween.Easing.Sinusoidal.Out, /** * Sinusoidal in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ SINUSOIDAL_IN_OUT: Tween.Easing.Sinusoidal.InOut, @@ -129,21 +129,21 @@ var EasingFunction = { /** * Exponential in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ EXPONENTIAL_IN: Tween.Easing.Exponential.In, /** * Exponential out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ EXPONENTIAL_OUT: Tween.Easing.Exponential.Out, /** * Exponential in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ EXPONENTIAL_IN_OUT: Tween.Easing.Exponential.InOut, @@ -151,21 +151,21 @@ var EasingFunction = { /** * Circular in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ CIRCULAR_IN: Tween.Easing.Circular.In, /** * Circular out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ CIRCULAR_OUT: Tween.Easing.Circular.Out, /** * Circular in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ CIRCULAR_IN_OUT: Tween.Easing.Circular.InOut, @@ -173,21 +173,21 @@ var EasingFunction = { /** * Elastic in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ ELASTIC_IN: Tween.Easing.Elastic.In, /** * Elastic out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ ELASTIC_OUT: Tween.Easing.Elastic.Out, /** * Elastic in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ ELASTIC_IN_OUT: Tween.Easing.Elastic.InOut, @@ -195,21 +195,21 @@ var EasingFunction = { /** * Back in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ BACK_IN: Tween.Easing.Back.In, /** * Back out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ BACK_OUT: Tween.Easing.Back.Out, /** * Back in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ BACK_IN_OUT: Tween.Easing.Back.InOut, @@ -217,21 +217,21 @@ var EasingFunction = { /** * Bounce in. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ BOUNCE_IN: Tween.Easing.Bounce.In, /** * Bounce out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ BOUNCE_OUT: Tween.Easing.Bounce.Out, /** * Bounce in then out. * - * @type {EasingFunction~Callback} + * @type {EasingFunction.Callback} * @constant */ BOUNCE_IN_OUT: Tween.Easing.Bounce.InOut, @@ -239,7 +239,7 @@ var EasingFunction = { /** * Function interface for implementing a custom easing function. - * @callback EasingFunction~Callback + * @callback EasingFunction.Callback * @param {Number} time The time in the range [0, 1]. * @returns {Number} The value of the function at the given time. * diff --git a/Source/Core/EllipsoidGeodesic.js b/Source/Core/EllipsoidGeodesic.js index 0eab9a057c2a..29272cf19e99 100644 --- a/Source/Core/EllipsoidGeodesic.js +++ b/Source/Core/EllipsoidGeodesic.js @@ -401,7 +401,7 @@ EllipsoidGeodesic.prototype.setEndPoints = function (start, end) { * Provides the location of a point at the indicated portion along the geodesic. * * @param {Number} fraction The portion of the distance between the initial and final points. - * @param {Cartographic} result The object in which to store the result. + * @param {Cartographic} [result] The object in which to store the result. * @returns {Cartographic} The location of the point along the geodesic. */ EllipsoidGeodesic.prototype.interpolateUsingFraction = function ( @@ -418,7 +418,7 @@ EllipsoidGeodesic.prototype.interpolateUsingFraction = function ( * Provides the location of a point at the indicated distance along the geodesic. * * @param {Number} distance The distance from the inital point to the point of interest along the geodesic - * @param {Cartographic} result The object in which to store the result. + * @param {Cartographic} [result] The object in which to store the result. * @returns {Cartographic} The location of the point along the geodesic. * * @exception {DeveloperError} start and end must be set before calling function interpolateUsingSurfaceDistance diff --git a/Source/Core/EllipsoidTangentPlane.js b/Source/Core/EllipsoidTangentPlane.js index c5e905e0a729..254e2891e27a 100644 --- a/Source/Core/EllipsoidTangentPlane.js +++ b/Source/Core/EllipsoidTangentPlane.js @@ -119,7 +119,7 @@ Object.defineProperties(EllipsoidTangentPlane.prototype, { /** * Gets the local Z-axis (up) of the tangent plane. - * @member EllipsoidTangentPlane.prototype + * @memberof EllipsoidTangentPlane.prototype * @readonly * @type {Cartesian3} */ @@ -135,7 +135,7 @@ var tmp = new AxisAlignedBoundingBox(); * Creates a new instance from the provided ellipsoid and the center * point of the provided Cartesians. * - * @param {Cartesian3} cartesians The list of positions surrounding the center point. + * @param {Cartesian3[]} cartesians The list of positions surrounding the center point. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid to use. */ EllipsoidTangentPlane.fromPoints = function (cartesians, ellipsoid) { diff --git a/Source/Core/EllipsoidTerrainProvider.js b/Source/Core/EllipsoidTerrainProvider.js index 4f35102553d1..91b71b9c3064 100644 --- a/Source/Core/EllipsoidTerrainProvider.js +++ b/Source/Core/EllipsoidTerrainProvider.js @@ -132,6 +132,19 @@ Object.defineProperties(EllipsoidTerrainProvider.prototype, { return false; }, }, + /** + * Gets an object that can be used to determine availability of terrain from this provider, such as + * at points and in rectangles. This function should not be called before + * {@link TerrainProvider#ready} returns true. This property may be undefined if availability + * information is not available. + * @memberof EllipsoidTerrainProvider.prototype + * @type {TileAvailability} + */ + availability: { + get: function () { + return undefined; + }, + }, }); /** @@ -199,7 +212,7 @@ EllipsoidTerrainProvider.prototype.getTileDataAvailable = function ( * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded + * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded */ EllipsoidTerrainProvider.prototype.loadTileDataAvailability = function ( x, diff --git a/Source/Core/Event.js b/Source/Core/Event.js index 8f952750c521..99001dc5fce5 100644 --- a/Source/Core/Event.js +++ b/Source/Core/Event.js @@ -49,7 +49,7 @@ Object.defineProperties(Event.prototype, { * @param {Function} listener The function to be executed when the event is raised. * @param {Object} [scope] An optional object scope to serve as the this * pointer in which the listener function will execute. - * @returns {Event~RemoveCallback} A function that will remove this event listener when invoked. + * @returns {Event.RemoveCallback} A function that will remove this event listener when invoked. * * @see Event#raiseEvent * @see Event#removeEventListener @@ -119,7 +119,7 @@ function compareNumber(a, b) { /** * Raises the event by calling each registered listener with all supplied arguments. * - * @param {*} arguments This method takes any number of parameters and passes them through to the listener functions. + * @param {...Object} arguments This method takes any number of parameters and passes them through to the listener functions. * * @see Event#addEventListener * @see Event#removeEventListener @@ -157,6 +157,6 @@ Event.prototype.raiseEvent = function () { /** * A function that removes a listener. - * @callback Event~RemoveCallback + * @callback Event.RemoveCallback */ export default Event; diff --git a/Source/Core/EventHelper.js b/Source/Core/EventHelper.js index ed9e73fe184b..bf928ae5f335 100644 --- a/Source/Core/EventHelper.js +++ b/Source/Core/EventHelper.js @@ -32,7 +32,7 @@ function EventHelper() { * @param {Function} listener The function to be executed when the event is raised. * @param {Object} [scope] An optional object scope to serve as the this * pointer in which the listener function will execute. - * @returns {EventHelper~RemoveCallback} A function that will remove this event listener when invoked. + * @returns {EventHelper.RemoveCallback} A function that will remove this event listener when invoked. * * @see Event#addEventListener */ @@ -69,6 +69,6 @@ EventHelper.prototype.removeAll = function () { /** * A function that removes a listener. - * @callback EventHelper~RemoveCallback + * @callback EventHelper.RemoveCallback */ export default EventHelper; diff --git a/Source/Core/ExtrapolationType.js b/Source/Core/ExtrapolationType.js index 43d01df39e27..58d1e2db16f1 100644 --- a/Source/Core/ExtrapolationType.js +++ b/Source/Core/ExtrapolationType.js @@ -2,7 +2,7 @@ * Constants to determine how an interpolated value is extrapolated * when querying outside the bounds of available data. * - * @exports ExtrapolationType + * @enum {Number} * * @see SampledProperty */ diff --git a/Source/Core/FeatureDetection.js b/Source/Core/FeatureDetection.js index d5265a72330e..7cc66fa3f561 100644 --- a/Source/Core/FeatureDetection.js +++ b/Source/Core/FeatureDetection.js @@ -3,7 +3,6 @@ import defaultValue from "./defaultValue.js"; import defined from "./defined.js"; import DeveloperError from "./DeveloperError.js"; import Fullscreen from "./Fullscreen.js"; -/*global CanvasPixelArray*/ var theNavigator; if (typeof navigator !== "undefined") { @@ -276,8 +275,8 @@ if (typeof ArrayBuffer !== "undefined") { typedArrayTypes.push(Uint8ClampedArray); } - if (typeof CanvasPixelArray !== "undefined") { - typedArrayTypes.push(CanvasPixelArray); + if (typeof Uint8ClampedArray !== "undefined") { + typedArrayTypes.push(Uint8ClampedArray); } } @@ -285,7 +284,7 @@ if (typeof ArrayBuffer !== "undefined") { * A set of functions to detect whether the current browser supports * various features. * - * @exports FeatureDetection + * @namespace FeatureDetection */ var FeatureDetection = { isChrome: isChrome, diff --git a/Source/Core/Fullscreen.js b/Source/Core/Fullscreen.js index 85574b3c7d66..15426970af2a 100644 --- a/Source/Core/Fullscreen.js +++ b/Source/Core/Fullscreen.js @@ -13,8 +13,7 @@ var _names = { /** * Browser-independent functions for working with the standard fullscreen API. * - * @exports Fullscreen - * @namespace + * @namespace Fullscreen * * @see {@link http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html|W3C Fullscreen Living Specification} */ @@ -216,7 +215,7 @@ Fullscreen.supportsFullscreen = function () { * If fullscreen mode is not supported by the browser, does nothing. * * @param {Object} element The HTML element which will be placed into fullscreen mode. - * @param {HMDVRDevice} [vrDevice] The VR device. + * @param {Object} [vrDevice] The HMDVRDevice device. * * @example * // Put the entire page into fullscreen. diff --git a/Source/Core/GeocodeType.js b/Source/Core/GeocodeType.js index c38d80365a44..956a2047665f 100644 --- a/Source/Core/GeocodeType.js +++ b/Source/Core/GeocodeType.js @@ -1,6 +1,6 @@ /** * The type of geocoding to be performed by a {@link GeocoderService}. - * @exports GeocodeType + * @enum {Number} * @see Geocoder */ var GeocodeType = { diff --git a/Source/Core/GeocoderService.js b/Source/Core/GeocoderService.js index 4576de2fa3d7..5162da37835a 100644 --- a/Source/Core/GeocoderService.js +++ b/Source/Core/GeocoderService.js @@ -1,7 +1,7 @@ import DeveloperError from "./DeveloperError.js"; /** - * @typedef {Object} GeocoderService~Result + * @typedef {Object} GeocoderService.Result * @property {String} displayName The display name for a location * @property {Rectangle|Cartesian3} destination The bounding box for a location */ @@ -23,7 +23,7 @@ function GeocoderService() {} * * @param {String} query The query to be sent to the geocoder service * @param {GeocodeType} [type=GeocodeType.SEARCH] The type of geocode to perform. - * @returns {Promise} + * @returns {Promise} */ GeocoderService.prototype.geocode = DeveloperError.throwInstantiationError; export default GeocoderService; diff --git a/Source/Core/GeometryAttribute.js b/Source/Core/GeometryAttribute.js index 96e293303d46..05a244a4498b 100644 --- a/Source/Core/GeometryAttribute.js +++ b/Source/Core/GeometryAttribute.js @@ -14,7 +14,7 @@ import DeveloperError from "./DeveloperError.js"; * @param {ComponentDatatype} [options.componentDatatype] The datatype of each component in the attribute, e.g., individual elements in values. * @param {Number} [options.componentsPerAttribute] A number between 1 and 4 that defines the number of components in an attributes. * @param {Boolean} [options.normalize=false] When true and componentDatatype is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering. - * @param {TypedArray} [options.values] The values for the attributes stored in a typed array. + * @param {number[]|Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} [options.values] The values for the attributes stored in a typed array. * * @exception {DeveloperError} options.componentsPerAttribute must be between 1 and 4. * @@ -120,7 +120,7 @@ function GeometryAttribute(options) { * every three elements in values defines one attributes since * componentsPerAttribute is 3. * - * @type TypedArray + * @type {number[]|Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} * * @default undefined * diff --git a/Source/Core/GeometryFactory.js b/Source/Core/GeometryFactory.js new file mode 100644 index 000000000000..10ee22d3cf1e --- /dev/null +++ b/Source/Core/GeometryFactory.js @@ -0,0 +1,25 @@ +import DeveloperError from "../Core/DeveloperError.js"; + +/** + * Base class for all geometry creation utility classes that can be passed to {@link GeometryInstance} + * for asynchronous geometry creation. + * + * @constructor + * @class + * @abstract + */ +function GeometryFactory() { + DeveloperError.throwInstantiationError(); +} + +/** + * Returns a geometry. + * + * @param {GeometryFactory} geometryFactory A description of the circle. + * @returns {Geometry|undefined} The computed vertices and indices. + */ +GeometryFactory.createGeometry = function (geometryFactory) { + DeveloperError.throwInstantiationError(); +}; + +export default GeometryFactory; diff --git a/Source/Core/GeometryInstance.js b/Source/Core/GeometryInstance.js index 5b845ac4f837..195e61cf4eb2 100644 --- a/Source/Core/GeometryInstance.js +++ b/Source/Core/GeometryInstance.js @@ -13,7 +13,7 @@ import Matrix4 from "./Matrix4.js"; * @constructor * * @param {Object} options Object with the following properties: - * @param {Geometry} options.geometry The geometry to instance. + * @param {Geometry|GeometryFactory} options.geometry The geometry to instance. * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The model matrix that transforms to transform the geometry from model to world coordinates. * @param {Object} [options.id] A user-defined object to return when the instance is picked with {@link Scene#pick} or get/set per-instance attributes with {@link Primitive#getGeometryInstanceAttributes}. * @param {Object} [options.attributes] Per-instance attributes like a show or color attribute shown in the example below. diff --git a/Source/Core/GeometryPipeline.js b/Source/Core/GeometryPipeline.js index b711aea73f1d..32a080a9aea9 100644 --- a/Source/Core/GeometryPipeline.js +++ b/Source/Core/GeometryPipeline.js @@ -27,7 +27,7 @@ import Tipsify from "./Tipsify.js"; /** * Content pipeline functions for geometries. * - * @exports GeometryPipeline + * @namespace GeometryPipeline * * @see Geometry */ diff --git a/Source/Core/GoogleEarthEnterpriseTerrainData.js b/Source/Core/GoogleEarthEnterpriseTerrainData.js index ac8fd12a35d7..f8137464e24f 100644 --- a/Source/Core/GoogleEarthEnterpriseTerrainData.js +++ b/Source/Core/GoogleEarthEnterpriseTerrainData.js @@ -107,7 +107,7 @@ Object.defineProperties(GoogleEarthEnterpriseTerrainData.prototype, { * Uint8Array or image where a value of 255 indicates water and a value of 0 indicates land. * Values in between 0 and 255 are allowed as well to smoothly blend between land and water. * @memberof GoogleEarthEnterpriseTerrainData.prototype - * @type {Uint8Array|Image|Canvas} + * @type {Uint8Array|HTMLImageElement|HTMLCanvasElement} */ waterMask: { get: function () { diff --git a/Source/Core/GoogleEarthEnterpriseTerrainProvider.js b/Source/Core/GoogleEarthEnterpriseTerrainProvider.js index c952dff0eae5..551d5c665664 100644 --- a/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +++ b/Source/Core/GoogleEarthEnterpriseTerrainProvider.js @@ -619,7 +619,7 @@ GoogleEarthEnterpriseTerrainProvider.prototype.getTileDataAvailable = function ( * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded + * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded */ GoogleEarthEnterpriseTerrainProvider.prototype.loadTileDataAvailability = function ( x, diff --git a/Source/Core/GregorianDate.js b/Source/Core/GregorianDate.js index 72fe1beac700..cd4c53c1d1a3 100644 --- a/Source/Core/GregorianDate.js +++ b/Source/Core/GregorianDate.js @@ -4,6 +4,15 @@ * @alias GregorianDate * @constructor * + * @param {Number} [year] The year as a whole number. + * @param {Number} [month] The month as a whole number with range [1, 12]. + * @param {Number} [day] The day of the month as a whole number starting at 1. + * @param {Number} [hour] The hour as a whole number with range [0, 23]. + * @param {Number} [minute] The minute of the hour as a whole number with range [0, 59]. + * @param {Number} [second] The second of the minute as a whole number with range [0, 60], with 60 representing a leap second. + * @param {Number} [millisecond] The millisecond of the second as a floating point number with range [0.0, 1000.0). + * @param {Boolean} [isLeapSecond] Whether this time is during a leap second. + * * @see JulianDate#toGregorianDate */ function GregorianDate( diff --git a/Source/Core/GroundPolylineGeometry.js b/Source/Core/GroundPolylineGeometry.js index d51b1a7b5d16..b2e1fcb823c8 100644 --- a/Source/Core/GroundPolylineGeometry.js +++ b/Source/Core/GroundPolylineGeometry.js @@ -1310,7 +1310,7 @@ function generateGeometryAttributes( * - encoded texture coordinate offsets ****************************************/ - /** 3D **/ + /* 3D */ var segmentLength3D = Cartesian3.distance(startTop, endTop); var encodedStart = EncodedCartesian3.fromCartesian( @@ -1348,7 +1348,7 @@ function generateGeometryAttributes( var texcoordNormalization3DX = segmentLength3D / length3D; var texcoordNormalization3DY = lengthSoFar3D / length3D; - /** 2D **/ + /* 2D */ var segmentLength2D = 0.0; var encodedStart2D; var forwardOffset2D; diff --git a/Source/Core/HeadingPitchRange.js b/Source/Core/HeadingPitchRange.js index 974620261628..15741102e771 100644 --- a/Source/Core/HeadingPitchRange.js +++ b/Source/Core/HeadingPitchRange.js @@ -17,6 +17,7 @@ function HeadingPitchRange(heading, pitch, range) { /** * Heading is the rotation from the local north direction where a positive angle is increasing eastward. * @type {Number} + * @default 0.0 */ this.heading = defaultValue(heading, 0.0); @@ -24,12 +25,14 @@ function HeadingPitchRange(heading, pitch, range) { * Pitch is the rotation from the local xy-plane. Positive pitch angles * are above the plane. Negative pitch angles are below the plane. * @type {Number} + * @default 0.0 */ this.pitch = defaultValue(pitch, 0.0); /** * Range is the distance from the center of the local frame. * @type {Number} + * @default 0.0 */ this.range = defaultValue(range, 0.0); } diff --git a/Source/Core/HeadingPitchRoll.js b/Source/Core/HeadingPitchRoll.js index b3b193833eba..acfd5c82896c 100644 --- a/Source/Core/HeadingPitchRoll.js +++ b/Source/Core/HeadingPitchRoll.js @@ -15,8 +15,23 @@ import CesiumMath from "./Math.js"; * @param {Number} [roll=0.0] The roll component in radians. */ function HeadingPitchRoll(heading, pitch, roll) { + /** + * Gets or sets the heading. + * @type {Number} + * @default 0.0 + */ this.heading = defaultValue(heading, 0.0); + /** + * Gets or sets the pitch. + * @type {Number} + * @default 0.0 + */ this.pitch = defaultValue(pitch, 0.0); + /** + * Gets or sets the roll. + * @type {Number} + * @default 0.0 + */ this.roll = defaultValue(roll, 0.0); } @@ -131,7 +146,7 @@ HeadingPitchRoll.equals = function (left, right) { * * @param {HeadingPitchRoll} [left] The first HeadingPitchRoll. * @param {HeadingPitchRoll} [right] The second HeadingPitchRoll. - * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. + * @param {Number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ @@ -193,7 +208,7 @@ HeadingPitchRoll.prototype.equals = function (right) { * false otherwise. * * @param {HeadingPitchRoll} [right] The right hand side HeadingPitchRoll. - * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. + * @param {Number} [relativeEpsilon=0] The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} true if they are within the provided epsilon, false otherwise. */ diff --git a/Source/Core/Heap.js b/Source/Core/Heap.js index 02d5fb1106b0..8d7d6ebece75 100644 --- a/Source/Core/Heap.js +++ b/Source/Core/Heap.js @@ -10,7 +10,7 @@ import defined from "./defined.js"; * @private * * @param {Object} options Object with the following properties: - * @param {Heap~ComparatorCallback} options.comparator The comparator to use for the heap. If comparator(a, b) is less than 0, sort a to a lower index than b, otherwise sort to a higher index. + * @param {Heap.ComparatorCallback} options.comparator The comparator to use for the heap. If comparator(a, b) is less than 0, sort a to a lower index than b, otherwise sort to a higher index. */ function Heap(options) { //>>includeStart('debug', pragmas.debug); @@ -78,7 +78,7 @@ Object.defineProperties(Heap.prototype, { * * @memberof Heap.prototype * - * @type {Heap~ComparatorCallback} + * @type {Heap.ComparatorCallback} */ comparator: { get: function () { @@ -216,7 +216,7 @@ Heap.prototype.pop = function (index) { /** * The comparator to use for the heap. - * @callback Heap~ComparatorCallback + * @callback Heap.ComparatorCallback * @param {*} a An element in the heap. * @param {*} b An element in the heap. * @returns {Number} If the result of the comparison is less than 0, sort a to a lower index than b, otherwise sort to a higher index. diff --git a/Source/Core/HeightmapEncoding.js b/Source/Core/HeightmapEncoding.js index d09a62705b93..56f56a1b6305 100644 --- a/Source/Core/HeightmapEncoding.js +++ b/Source/Core/HeightmapEncoding.js @@ -1,7 +1,7 @@ /** * The encoding that is used for a heightmap * - * @exports HeightmapEncoding + * @enum {Number} */ var HeightmapEncoding = { /** diff --git a/Source/Core/HeightmapTerrainData.js b/Source/Core/HeightmapTerrainData.js index ee6031b2b8fe..949ce5c1b6d7 100644 --- a/Source/Core/HeightmapTerrainData.js +++ b/Source/Core/HeightmapTerrainData.js @@ -23,7 +23,7 @@ import TerrainProvider from "./TerrainProvider.js"; * @constructor * * @param {Object} options Object with the following properties: - * @param {TypedArray} options.buffer The buffer containing height data. + * @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} options.buffer The buffer containing height data. * @param {Number} options.width The width (longitude direction) of the heightmap, in samples. * @param {Number} options.height The height (latitude direction) of the heightmap, in samples. * @param {Number} [options.childTileMask=15] A bit mask indicating which of this tile's four children exist. @@ -167,7 +167,7 @@ Object.defineProperties(HeightmapTerrainData.prototype, { * Uint8Array or image where a value of 255 indicates water and a value of 0 indicates land. * Values in between 0 and 255 are allowed as well to smoothly blend between land and water. * @memberof HeightmapTerrainData.prototype - * @type {Uint8Array|Image|Canvas} + * @type {Uint8Array|HTMLImageElement|HTMLCanvasElement} */ waterMask: { get: function () { diff --git a/Source/Core/HeightmapTessellator.js b/Source/Core/HeightmapTessellator.js index 00e2c6f50b22..729443340b34 100644 --- a/Source/Core/HeightmapTessellator.js +++ b/Source/Core/HeightmapTessellator.js @@ -18,7 +18,7 @@ import WebMercatorProjection from "./WebMercatorProjection.js"; /** * Contains functions to create a mesh from a heightmap image. * - * @exports HeightmapTessellator + * @namespace HeightmapTessellator * * @private */ @@ -47,7 +47,7 @@ var maximumScratch = new Cartesian3(); * Fills an array of vertices from a heightmap image. * * @param {Object} options Object with the following properties: - * @param {TypedArray} options.heightmap The heightmap to tessellate. + * @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} options.heightmap The heightmap to tessellate. * @param {Number} options.width The width of the heightmap, in height samples. * @param {Number} options.height The height of the heightmap, in height samples. * @param {Number} options.skirtHeight The height of skirts to drape at the edges of the heightmap. diff --git a/Source/Core/HermitePolynomialApproximation.js b/Source/Core/HermitePolynomialApproximation.js index 032327e8d096..33c8f4baf38c 100644 --- a/Source/Core/HermitePolynomialApproximation.js +++ b/Source/Core/HermitePolynomialApproximation.js @@ -64,7 +64,7 @@ function calculateCoefficientTerm( /** * An {@link InterpolationAlgorithm} for performing Hermite interpolation. * - * @exports HermitePolynomialApproximation + * @namespace HermitePolynomialApproximation */ var HermitePolynomialApproximation = { type: "Hermite", diff --git a/Source/Core/Iau2000Orientation.js b/Source/Core/Iau2000Orientation.js index b43690f8e723..07f7bc8aa18a 100644 --- a/Source/Core/Iau2000Orientation.js +++ b/Source/Core/Iau2000Orientation.js @@ -9,7 +9,7 @@ import TimeConstants from "./TimeConstants.js"; * The data comes from the Report of the IAU/IAG Working Group on Cartographic * Coordinates and Rotational Elements: 2000. * - * @exports Iau2000Orientation + * @namespace Iau2000Orientation * * @private */ @@ -39,6 +39,7 @@ var dateTT = new JulianDate(); * @param {JulianDate} [date=JulianDate.now()] The date to evaluate the parameters. * @param {IauOrientationParameters} [result] The object onto which to store the result. * @returns {IauOrientationParameters} The modified result parameter or a new instance representing the orientation of the Earth's Moon. + * @private */ Iau2000Orientation.ComputeMoon = function (date, result) { if (!defined(date)) { diff --git a/Source/Core/Iau2006XysData.js b/Source/Core/Iau2006XysData.js index a7810c6e424b..325f7a164195 100644 --- a/Source/Core/Iau2006XysData.js +++ b/Source/Core/Iau2006XysData.js @@ -94,7 +94,7 @@ function getDaysSinceEpoch(xys, dayTT, secondTT) { * the Terrestrial Time (TT) time standard. * @param {Number} stopSecondTT The seconds past noon of the end of the interval to preload, expressed in * the Terrestrial Time (TT) time standard. - * @returns {Promise} A promise that, when resolved, indicates that the requested interval has been + * @returns {Promise} A promise that, when resolved, indicates that the requested interval has been * preloaded. */ Iau2006XysData.prototype.preload = function ( diff --git a/Source/Core/IauOrientationAxes.js b/Source/Core/IauOrientationAxes.js index 88a710d25384..1d24fbd4eb33 100644 --- a/Source/Core/IauOrientationAxes.js +++ b/Source/Core/IauOrientationAxes.js @@ -12,7 +12,7 @@ import Quaternion from "./Quaternion.js"; * @alias IauOrientationAxes * @constructor * - * @param {IauOrientationAxes~ComputeFunction} [computeFunction] The function that computes the {@link IauOrientationParameters} given a {@link JulianDate}. + * @param {IauOrientationAxes.ComputeFunction} [computeFunction] The function that computes the {@link IauOrientationParameters} given a {@link JulianDate}. * * @see Iau2000Orientation * @@ -97,8 +97,9 @@ IauOrientationAxes.prototype.evaluate = function (date, result) { /** * A function that computes the {@link IauOrientationParameters} for a {@link JulianDate}. - * @callback IauOrientationAxes~ComputeFunction + * @callback IauOrientationAxes.ComputeFunction * @param {JulianDate} date The date to evaluate the parameters. * @returns {IauOrientationParameters} The orientation parameters. + * @private */ export default IauOrientationAxes; diff --git a/Source/Core/IauOrientationParameters.js b/Source/Core/IauOrientationParameters.js index 5fd99747659f..361aa7725fd8 100644 --- a/Source/Core/IauOrientationParameters.js +++ b/Source/Core/IauOrientationParameters.js @@ -6,7 +6,7 @@ * except that they are expressed in radians. *

* - * @exports IauOrientationParameters + * @namespace IauOrientationParameters * * @private */ diff --git a/Source/Core/IndexDatatype.js b/Source/Core/IndexDatatype.js index 114e580f9771..3fa2c587262a 100644 --- a/Source/Core/IndexDatatype.js +++ b/Source/Core/IndexDatatype.js @@ -7,7 +7,7 @@ import WebGLConstants from "./WebGLConstants.js"; * Constants for WebGL index datatypes. These corresponds to the * type parameter of {@link http://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawElements.xml|drawElements}. * - * @exports IndexDatatype + * @enum {Number} */ var IndexDatatype = { /** diff --git a/Source/Core/InterpolationAlgorithm.js b/Source/Core/InterpolationAlgorithm.js index 10e5a954e665..f512c94c73a4 100644 --- a/Source/Core/InterpolationAlgorithm.js +++ b/Source/Core/InterpolationAlgorithm.js @@ -3,7 +3,7 @@ import DeveloperError from "./DeveloperError.js"; /** * The interface for interpolation algorithms. * - * @exports InterpolationAlgorithm + * @interface InterpolationAlgorithm * * @see LagrangePolynomialApproximation * @see LinearApproximation diff --git a/Source/Core/Intersect.js b/Source/Core/Intersect.js index 28722d5f1765..96effac7107f 100644 --- a/Source/Core/Intersect.js +++ b/Source/Core/Intersect.js @@ -4,7 +4,7 @@ * partially inside the frustum and partially outside (INTERSECTING), or somwhere entirely * outside of the frustum's 6 planes (OUTSIDE). * - * @exports Intersect + * @enum {Number} */ var Intersect = { /** diff --git a/Source/Core/IntersectionTests.js b/Source/Core/IntersectionTests.js index f5ce668b4af5..dba56cf8a3e7 100644 --- a/Source/Core/IntersectionTests.js +++ b/Source/Core/IntersectionTests.js @@ -13,8 +13,7 @@ import Ray from "./Ray.js"; /** * Functions for computing the intersection between geometries such as rays, planes, triangles, and ellipsoids. * - * @exports IntersectionTests - * @namespace + * @namespace IntersectionTests */ var IntersectionTests = {}; diff --git a/Source/Core/Intersections2D.js b/Source/Core/Intersections2D.js index 0153ba04fa6e..08c62fc4641c 100644 --- a/Source/Core/Intersections2D.js +++ b/Source/Core/Intersections2D.js @@ -7,7 +7,7 @@ import DeveloperError from "./DeveloperError.js"; /** * Contains functions for operating on 2D triangles. * - * @exports Intersections2D + * @namespace Intersections2D */ var Intersections2D = {}; diff --git a/Source/Core/Ion.js b/Source/Core/Ion.js index 3745f1fe0f10..1bb1005a2b0a 100644 --- a/Source/Core/Ion.js +++ b/Source/Core/Ion.js @@ -4,10 +4,9 @@ import Resource from "./Resource.js"; var defaultTokenCredit; var defaultAccessToken = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNWMwZmFjMy04ZmRmLTRhMjktYjUzYi00YWQ4N2ZiNmIwNjUiLCJpZCI6MjU5LCJzY29wZXMiOlsiYXNyIiwiZ2MiXSwiaWF0IjoxNTg4MzQxMTA4fQ.scXa4kn5vzNVSgsEYKNYP0szYXPq1Djx1SH0KcAOrrk"; + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwNjk5ODcyYS00MWMyLTQ1NjctYTRhYS0zMmM3ZjYzMGM2ZGEiLCJpZCI6MjU5LCJzY29wZXMiOlsiYXNyIiwiZ2MiXSwiaWF0IjoxNTkxMDI3NDUwfQ.xUBBQH34cd86pfNMSQ6tBBelRx3g_RS51-nSUFlZq24"; /** * Default settings for accessing the Cesium ion API. - * @exports Ion * * An ion access token is only required if you are using any ion related APIs. * A default access token is provided for evaluation purposes only. @@ -18,6 +17,7 @@ var defaultAccessToken = * @see IonGeocoderService * @see createWorldImagery * @see createWorldTerrain + * @namespace Ion */ var Ion = {}; diff --git a/Source/Core/IonGeocoderService.js b/Source/Core/IonGeocoderService.js index 8ae06d2c92ea..daf44dc432e0 100644 --- a/Source/Core/IonGeocoderService.js +++ b/Source/Core/IonGeocoderService.js @@ -14,7 +14,6 @@ import Resource from "./Resource.js"; * @param {Object} options Object with the following properties: * @param {Scene} options.scene The scene * @param {String} [options.accessToken=Ion.defaultAccessToken] The access token to use. - * @param {String} [options.accessToken=Ion.defaultAccessToken] The access token to use. * @param {String|Resource} [options.server=Ion.defaultServer] The resource to the Cesium ion API server. * * @see Ion @@ -57,7 +56,7 @@ function IonGeocoderService(options) { * * @param {String} query The query to be sent to the geocoder service * @param {GeocodeType} [type=GeocodeType.SEARCH] The type of geocode to perform. - * @returns {Promise} + * @returns {Promise} */ IonGeocoderService.prototype.geocode = function (query, geocodeType) { return this._pelias.geocode(query, geocodeType); diff --git a/Source/Core/Iso8601.js b/Source/Core/Iso8601.js index 74757520f428..97738cf93470 100644 --- a/Source/Core/Iso8601.js +++ b/Source/Core/Iso8601.js @@ -17,7 +17,7 @@ var MAXIMUM_INTERVAL = Object.freeze( /** * Constants related to ISO8601 support. * - * @exports Iso8601 + * @namespace * * @see {@link http://en.wikipedia.org/wiki/ISO_8601|ISO 8601 on Wikipedia} * @see JulianDate diff --git a/Source/Core/JulianDate.js b/Source/Core/JulianDate.js index e3b77af8ab09..42388d916217 100644 --- a/Source/Core/JulianDate.js +++ b/Source/Core/JulianDate.js @@ -901,15 +901,11 @@ JulianDate.equals = function (left, right) { * * @param {JulianDate} [left] The first instance. * @param {JulianDate} [right] The second instance. - * @param {Number} epsilon The maximum number of seconds that should separate the two instances. + * @param {Number} [epsilon=0] The maximum number of seconds that should separate the two instances. * @returns {Boolean} true if the two dates are within epsilon seconds of each other; otherwise false. */ JulianDate.equalsEpsilon = function (left, right, epsilon) { - //>>includeStart('debug', pragmas.debug); - if (!defined(epsilon)) { - throw new DeveloperError("epsilon is required."); - } - //>>includeEnd('debug'); + epsilon = defaultValue(epsilon, 0); return ( left === right || @@ -1182,7 +1178,7 @@ JulianDate.prototype.equals = function (right) { * seconds, must be less than epsilon. * * @param {JulianDate} [right] The second instance. - * @param {Number} epsilon The maximum number of seconds that should separate the two instances. + * @param {Number} [epsilon=0] The maximum number of seconds that should separate the two instances. * @returns {Boolean} true if the two dates are within epsilon seconds of each other; otherwise false. */ JulianDate.prototype.equalsEpsilon = function (right, epsilon) { diff --git a/Source/Core/KeyboardEventModifier.js b/Source/Core/KeyboardEventModifier.js index 8d347200957f..0ff50f243cfe 100644 --- a/Source/Core/KeyboardEventModifier.js +++ b/Source/Core/KeyboardEventModifier.js @@ -2,7 +2,7 @@ * This enumerated type is for representing keyboard modifiers. These are keys * that are held down in addition to other event types. * - * @exports KeyboardEventModifier + * @enum {Number} */ var KeyboardEventModifier = { /** diff --git a/Source/Core/LagrangePolynomialApproximation.js b/Source/Core/LagrangePolynomialApproximation.js index 4bc59175b5b9..f43816a698c5 100644 --- a/Source/Core/LagrangePolynomialApproximation.js +++ b/Source/Core/LagrangePolynomialApproximation.js @@ -3,7 +3,7 @@ import defined from "./defined.js"; /** * An {@link InterpolationAlgorithm} for performing Lagrange interpolation. * - * @exports LagrangePolynomialApproximation + * @namespace LagrangePolynomialApproximation */ var LagrangePolynomialApproximation = { type: "Lagrange", diff --git a/Source/Core/LinearApproximation.js b/Source/Core/LinearApproximation.js index ffca6c48fec5..5665e9f34168 100644 --- a/Source/Core/LinearApproximation.js +++ b/Source/Core/LinearApproximation.js @@ -4,7 +4,7 @@ import DeveloperError from "./DeveloperError.js"; /** * An {@link InterpolationAlgorithm} for performing linear interpolation. * - * @exports LinearApproximation + * @namespace LinearApproximation */ var LinearApproximation = { type: "Linear", diff --git a/Source/Core/MapboxApi.js b/Source/Core/MapboxApi.js index 1460fc3d8601..e808890e7d33 100644 --- a/Source/Core/MapboxApi.js +++ b/Source/Core/MapboxApi.js @@ -2,7 +2,7 @@ import Credit from "./Credit.js"; import defined from "./defined.js"; /** - * @exports MapboxApi + * @namespace MapboxApi */ var MapboxApi = {}; diff --git a/Source/Core/Math.js b/Source/Core/Math.js index ea3e31635ece..cf8bc84ef8c7 100644 --- a/Source/Core/Math.js +++ b/Source/Core/Math.js @@ -411,7 +411,6 @@ CesiumMath.ONE_OVER_TWO_PI = 1.0 / (2.0 * Math.PI); * * @type {Number} * @constant - * @default Math.PI / 180.0 */ CesiumMath.RADIANS_PER_DEGREE = Math.PI / 180.0; @@ -420,7 +419,6 @@ CesiumMath.RADIANS_PER_DEGREE = Math.PI / 180.0; * * @type {Number} * @constant - * @default 180.0 / Math.PI */ CesiumMath.DEGREES_PER_RADIAN = 180.0 / Math.PI; @@ -429,7 +427,6 @@ CesiumMath.DEGREES_PER_RADIAN = 180.0 / Math.PI; * * @type {Number} * @constant - * @default {@link CesiumMath.RADIANS_PER_DEGREE} / 3600.0 */ CesiumMath.RADIANS_PER_ARCSECOND = CesiumMath.RADIANS_PER_DEGREE / 3600.0; @@ -580,7 +577,7 @@ CesiumMath.mod = function (m, n) { * * @param {Number} left The first value to compare. * @param {Number} right The other value to compare. - * @param {Number} relativeEpsilon The maximum inclusive delta between left and right for the relative tolerance test. + * @param {Number} [relativeEpsilon=0] The maximum inclusive delta between left and right for the relative tolerance test. * @param {Number} [absoluteEpsilon=relativeEpsilon] The maximum inclusive delta between left and right for the absolute tolerance test. * @returns {Boolean} true if the values are equal within the epsilon; otherwise, false. * @@ -603,10 +600,9 @@ CesiumMath.equalsEpsilon = function ( if (!defined(right)) { throw new DeveloperError("right is required."); } - if (!defined(relativeEpsilon)) { - throw new DeveloperError("relativeEpsilon is required."); - } //>>includeEnd('debug'); + + relativeEpsilon = defaultValue(relativeEpsilon, 0.0); absoluteEpsilon = defaultValue(absoluteEpsilon, relativeEpsilon); var absDiff = Math.abs(left - right); return ( diff --git a/Source/Core/Matrix2.js b/Source/Core/Matrix2.js index a51bac194da8..e3a91145ab99 100644 --- a/Source/Core/Matrix2.js +++ b/Source/Core/Matrix2.js @@ -8,6 +8,7 @@ import defined from "./defined.js"; * Constructor parameters are in row-major order for code readability. * @alias Matrix2 * @constructor + * @implements {ArrayLike} * * @param {Number} [column0Row0=0.0] The value for column 0, row 0. * @param {Number} [column1Row0=0.0] The value for column 1, row 0. @@ -725,14 +726,11 @@ Matrix2.equalsArray = function (matrix, array, offset) { * * @param {Matrix2} [left] The first matrix. * @param {Matrix2} [right] The second matrix. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ Matrix2.equalsEpsilon = function (left, right, epsilon) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.number("epsilon", epsilon); - //>>includeEnd('debug'); - + epsilon = defaultValue(epsilon, 0); return ( left === right || (defined(left) && @@ -849,7 +847,7 @@ Matrix2.prototype.equals = function (right) { * false otherwise. * * @param {Matrix2} [right] The right hand side matrix. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if they are within the provided epsilon, false otherwise. */ Matrix2.prototype.equalsEpsilon = function (right, epsilon) { diff --git a/Source/Core/Matrix3.js b/Source/Core/Matrix3.js index bee35156cacb..f01c549fc61c 100644 --- a/Source/Core/Matrix3.js +++ b/Source/Core/Matrix3.js @@ -10,6 +10,7 @@ import CesiumMath from "./Math.js"; * Constructor parameters are in row-major order for code readability. * @alias Matrix3 * @constructor + * @implements {ArrayLike} * * @param {Number} [column0Row0=0.0] The value for column 0, row 0. * @param {Number} [column1Row0=0.0] The value for column 1, row 0. @@ -1394,13 +1395,11 @@ Matrix3.equals = function (left, right) { * * @param {Matrix3} [left] The first matrix. * @param {Matrix3} [right] The second matrix. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ Matrix3.equalsEpsilon = function (left, right, epsilon) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.number("epsilon", epsilon); - //>>includeEnd('debug'); + epsilon = defaultValue(epsilon, 0); return ( left === right || @@ -1568,7 +1567,7 @@ Matrix3.equalsArray = function (matrix, array, offset) { * false otherwise. * * @param {Matrix3} [right] The right hand side matrix. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if they are within the provided epsilon, false otherwise. */ Matrix3.prototype.equalsEpsilon = function (right, epsilon) { diff --git a/Source/Core/Matrix4.js b/Source/Core/Matrix4.js index 6802b45f874f..1d9d53620814 100644 --- a/Source/Core/Matrix4.js +++ b/Source/Core/Matrix4.js @@ -12,6 +12,7 @@ import RuntimeError from "./RuntimeError.js"; * Constructor parameters are in row-major order for code readability. * @alias Matrix4 * @constructor + * @implements {ArrayLike} * * @param {Number} [column0Row0=0.0] The value for column 0, row 0. * @param {Number} [column1Row0=0.0] The value for column 1, row 0. @@ -943,10 +944,10 @@ Matrix4.computeInfinitePerspectiveOffCenter = function ( /** * Computes a Matrix4 instance that transforms from normalized device coordinates to window coordinates. * - * @param {Object}[viewport = { x : 0.0, y : 0.0, width : 0.0, height : 0.0 }] The viewport's corners as shown in Example 1. - * @param {Number}[nearDepthRange=0.0] The near plane distance in window coordinates. - * @param {Number}[farDepthRange=1.0] The far plane distance in window coordinates. - * @param {Matrix4} result The object in which the result will be stored. + * @param {Object} [viewport = { x : 0.0, y : 0.0, width : 0.0, height : 0.0 }] The viewport's corners as shown in Example 1. + * @param {Number} [nearDepthRange=0.0] The near plane distance in window coordinates. + * @param {Number} [farDepthRange=1.0] The far plane distance in window coordinates. + * @param {Matrix4} [result] The object in which the result will be stored. * @returns {Matrix4} The modified result parameter. * * @example @@ -964,9 +965,9 @@ Matrix4.computeViewportTransformation = function ( farDepthRange, result ) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.object("result", result); - //>>includeEnd('debug'); + if (!defined(result)) { + result = new Matrix4(); + } viewport = defaultValue(viewport, defaultValue.EMPTY_OBJECT); var x = defaultValue(viewport.x, 0.0); @@ -2257,7 +2258,7 @@ Matrix4.equals = function (left, right) { * * @param {Matrix4} [left] The first matrix. * @param {Matrix4} [right] The second matrix. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. * * @example @@ -2282,9 +2283,7 @@ Matrix4.equals = function (left, right) { * //Prints "Difference between both the matrices is not less than 0.1" on the console */ Matrix4.equalsEpsilon = function (left, right, epsilon) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.number("epsilon", epsilon); - //>>includeEnd('debug'); + epsilon = defaultValue(epsilon, 0); return ( left === right || @@ -2895,7 +2894,7 @@ Matrix4.equalsArray = function (matrix, array, offset) { * false otherwise. * * @param {Matrix4} [right] The right hand side matrix. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if they are within the provided epsilon, false otherwise. */ Matrix4.prototype.equalsEpsilon = function (right, epsilon) { diff --git a/Source/Core/OpenCageGeocoderService.js b/Source/Core/OpenCageGeocoderService.js index aab2515a09be..1a743c4dc259 100644 --- a/Source/Core/OpenCageGeocoderService.js +++ b/Source/Core/OpenCageGeocoderService.js @@ -54,7 +54,7 @@ Object.defineProperties(OpenCageGeocoderService.prototype, { /** * The Resource used to access the OpenCage endpoint. * @type {Resource} - * @memberof {OpenCageGeocoderService.prototype} + * @memberof OpenCageGeocoderService.prototype * @readonly */ url: { @@ -65,7 +65,7 @@ Object.defineProperties(OpenCageGeocoderService.prototype, { /** * Optional params passed to OpenCage in order to customize geocoding * @type {Object} - * @memberof {OpenCageGeocoderService.prototype} + * @memberof OpenCageGeocoderService.prototype * @readonly */ params: { @@ -79,7 +79,7 @@ Object.defineProperties(OpenCageGeocoderService.prototype, { * @function * * @param {String} query The query to be sent to the geocoder service - * @returns {Promise} + * @returns {Promise} */ OpenCageGeocoderService.prototype.geocode = function (query) { //>>includeStart('debug', pragmas.debug); diff --git a/Source/Core/Packable.js b/Source/Core/Packable.js index cda6966f5235..479c91ae64a7 100644 --- a/Source/Core/Packable.js +++ b/Source/Core/Packable.js @@ -5,7 +5,7 @@ import DeveloperError from "./DeveloperError.js"; * elements in an array. These methods and properties are expected to be * defined on a constructor function. * - * @exports Packable + * @interface Packable * * @see PackableForInterpolation */ diff --git a/Source/Core/PackableForInterpolation.js b/Source/Core/PackableForInterpolation.js index 6f3cc9099e2c..c3a0f603162f 100644 --- a/Source/Core/PackableForInterpolation.js +++ b/Source/Core/PackableForInterpolation.js @@ -5,7 +5,7 @@ import DeveloperError from "./DeveloperError.js"; * different representation than their packed value. These methods and * properties are expected to be defined on a constructor function. * - * @exports PackableForInterpolation + * @namespace PackableForInterpolation * * @see Packable */ @@ -23,7 +23,7 @@ var PackableForInterpolation = { * @param {Number[]} packedArray The packed array. * @param {Number} [startingIndex=0] The index of the first element to be converted. * @param {Number} [lastIndex=packedArray.length] The index of the last element to be converted. - * @param {Number[]} result The object into which to store the result. + * @param {Number[]} [result] The object into which to store the result. */ convertPackedArrayForInterpolation: DeveloperError.throwInstantiationError, diff --git a/Source/Core/PeliasGeocoderService.js b/Source/Core/PeliasGeocoderService.js index daf2f211bc12..7377186bae27 100644 --- a/Source/Core/PeliasGeocoderService.js +++ b/Source/Core/PeliasGeocoderService.js @@ -51,7 +51,7 @@ Object.defineProperties(PeliasGeocoderService.prototype, { * * @param {String} query The query to be sent to the geocoder service * @param {GeocodeType} [type=GeocodeType.SEARCH] The type of geocode to perform. - * @returns {Promise} + * @returns {Promise} */ PeliasGeocoderService.prototype.geocode = function (query, type) { //>>includeStart('debug', pragmas.debug); diff --git a/Source/Core/PinBuilder.js b/Source/Core/PinBuilder.js index 3248d0d1bdfc..e0ea7dc05a9d 100644 --- a/Source/Core/PinBuilder.js +++ b/Source/Core/PinBuilder.js @@ -27,7 +27,7 @@ function PinBuilder() { * * @param {Color} color The color of the pin. * @param {Number} size The size of the pin, in pixels. - * @returns {Canvas} The canvas element that represents the generated pin. + * @returns {HTMLCanvasElement} The canvas element that represents the generated pin. */ PinBuilder.prototype.fromColor = function (color, size) { //>>includeStart('debug', pragmas.debug); @@ -47,7 +47,7 @@ PinBuilder.prototype.fromColor = function (color, size) { * @param {Resource|String} url The url of the image to be stamped onto the pin. * @param {Color} color The color of the pin. * @param {Number} size The size of the pin, in pixels. - * @returns {Canvas|Promise.} The canvas element or a Promise to the canvas element that represents the generated pin. + * @returns {HTMLCanvasElement|Promise.} The canvas element or a Promise to the canvas element that represents the generated pin. */ PinBuilder.prototype.fromUrl = function (url, color, size) { //>>includeStart('debug', pragmas.debug); @@ -70,7 +70,7 @@ PinBuilder.prototype.fromUrl = function (url, color, size) { * @param {String} id The id of the maki icon to be stamped onto the pin. * @param {Color} color The color of the pin. * @param {Number} size The size of the pin, in pixels. - * @returns {Canvas|Promise.} The canvas element or a Promise to the canvas element that represents the generated pin. + * @returns {HTMLCanvasElement|Promise.} The canvas element or a Promise to the canvas element that represents the generated pin. */ PinBuilder.prototype.fromMakiIconId = function (id, color, size) { //>>includeStart('debug', pragmas.debug); @@ -100,7 +100,7 @@ PinBuilder.prototype.fromMakiIconId = function (id, color, size) { * @param {String} text The text to be stamped onto the pin. * @param {Color} color The color of the pin. * @param {Number} size The size of the pin, in pixels. - * @returns {Canvas} The canvas element that represents the generated pin. + * @returns {HTMLCanvasElement} The canvas element that represents the generated pin. */ PinBuilder.prototype.fromText = function (text, color, size) { //>>includeStart('debug', pragmas.debug); diff --git a/Source/Core/PixelFormat.js b/Source/Core/PixelFormat.js index 0b3115fbff21..fd603e08fcbf 100644 --- a/Source/Core/PixelFormat.js +++ b/Source/Core/PixelFormat.js @@ -4,7 +4,7 @@ import WebGLConstants from "./WebGLConstants.js"; /** * The format of a pixel, i.e., the number of components it has and what they represent. * - * @exports PixelFormat + * @enum {Number} */ var PixelFormat = { /** @@ -134,223 +134,239 @@ var PixelFormat = { * @constant */ RGB_ETC1: WebGLConstants.COMPRESSED_RGB_ETC1_WEBGL, +}; - /** - * @private - */ - componentsLength: function (pixelFormat) { - switch (pixelFormat) { - case PixelFormat.RGB: - return 3; - case PixelFormat.RGBA: - return 4; - case PixelFormat.LUMINANCE_ALPHA: - return 2; - case PixelFormat.ALPHA: - case PixelFormat.LUMINANCE: - return 1; - default: - return 1; - } - }, - - /** - * @private - */ - validate: function (pixelFormat) { - return ( - pixelFormat === PixelFormat.DEPTH_COMPONENT || - pixelFormat === PixelFormat.DEPTH_STENCIL || - pixelFormat === PixelFormat.ALPHA || - pixelFormat === PixelFormat.RGB || - pixelFormat === PixelFormat.RGBA || - pixelFormat === PixelFormat.LUMINANCE || - pixelFormat === PixelFormat.LUMINANCE_ALPHA || - pixelFormat === PixelFormat.RGB_DXT1 || - pixelFormat === PixelFormat.RGBA_DXT1 || - pixelFormat === PixelFormat.RGBA_DXT3 || - pixelFormat === PixelFormat.RGBA_DXT5 || - pixelFormat === PixelFormat.RGB_PVRTC_4BPPV1 || - pixelFormat === PixelFormat.RGB_PVRTC_2BPPV1 || - pixelFormat === PixelFormat.RGBA_PVRTC_4BPPV1 || - pixelFormat === PixelFormat.RGBA_PVRTC_2BPPV1 || - pixelFormat === PixelFormat.RGB_ETC1 - ); - }, +/** + * @private + */ +PixelFormat.componentsLength = function (pixelFormat) { + switch (pixelFormat) { + case PixelFormat.RGB: + return 3; + case PixelFormat.RGBA: + return 4; + case PixelFormat.LUMINANCE_ALPHA: + return 2; + case PixelFormat.ALPHA: + case PixelFormat.LUMINANCE: + return 1; + default: + return 1; + } +}; - /** - * @private - */ - isColorFormat: function (pixelFormat) { - return ( - pixelFormat === PixelFormat.ALPHA || - pixelFormat === PixelFormat.RGB || - pixelFormat === PixelFormat.RGBA || - pixelFormat === PixelFormat.LUMINANCE || - pixelFormat === PixelFormat.LUMINANCE_ALPHA - ); - }, +/** + * @private + */ +PixelFormat.validate = function (pixelFormat) { + return ( + pixelFormat === PixelFormat.DEPTH_COMPONENT || + pixelFormat === PixelFormat.DEPTH_STENCIL || + pixelFormat === PixelFormat.ALPHA || + pixelFormat === PixelFormat.RGB || + pixelFormat === PixelFormat.RGBA || + pixelFormat === PixelFormat.LUMINANCE || + pixelFormat === PixelFormat.LUMINANCE_ALPHA || + pixelFormat === PixelFormat.RGB_DXT1 || + pixelFormat === PixelFormat.RGBA_DXT1 || + pixelFormat === PixelFormat.RGBA_DXT3 || + pixelFormat === PixelFormat.RGBA_DXT5 || + pixelFormat === PixelFormat.RGB_PVRTC_4BPPV1 || + pixelFormat === PixelFormat.RGB_PVRTC_2BPPV1 || + pixelFormat === PixelFormat.RGBA_PVRTC_4BPPV1 || + pixelFormat === PixelFormat.RGBA_PVRTC_2BPPV1 || + pixelFormat === PixelFormat.RGB_ETC1 + ); +}; - /** - * @private - */ - isDepthFormat: function (pixelFormat) { - return ( - pixelFormat === PixelFormat.DEPTH_COMPONENT || - pixelFormat === PixelFormat.DEPTH_STENCIL - ); - }, +/** + * @private + */ +PixelFormat.isColorFormat = function (pixelFormat) { + return ( + pixelFormat === PixelFormat.ALPHA || + pixelFormat === PixelFormat.RGB || + pixelFormat === PixelFormat.RGBA || + pixelFormat === PixelFormat.LUMINANCE || + pixelFormat === PixelFormat.LUMINANCE_ALPHA + ); +}; - /** - * @private - */ - isCompressedFormat: function (pixelFormat) { - return ( - pixelFormat === PixelFormat.RGB_DXT1 || - pixelFormat === PixelFormat.RGBA_DXT1 || - pixelFormat === PixelFormat.RGBA_DXT3 || - pixelFormat === PixelFormat.RGBA_DXT5 || - pixelFormat === PixelFormat.RGB_PVRTC_4BPPV1 || - pixelFormat === PixelFormat.RGB_PVRTC_2BPPV1 || - pixelFormat === PixelFormat.RGBA_PVRTC_4BPPV1 || - pixelFormat === PixelFormat.RGBA_PVRTC_2BPPV1 || - pixelFormat === PixelFormat.RGB_ETC1 - ); - }, +/** + * @private + */ +PixelFormat.isDepthFormat = function (pixelFormat) { + return ( + pixelFormat === PixelFormat.DEPTH_COMPONENT || + pixelFormat === PixelFormat.DEPTH_STENCIL + ); +}; - /** - * @private - */ - isDXTFormat: function (pixelFormat) { - return ( - pixelFormat === PixelFormat.RGB_DXT1 || - pixelFormat === PixelFormat.RGBA_DXT1 || - pixelFormat === PixelFormat.RGBA_DXT3 || - pixelFormat === PixelFormat.RGBA_DXT5 - ); - }, +/** + * @private + */ +PixelFormat.isCompressedFormat = function (pixelFormat) { + return ( + pixelFormat === PixelFormat.RGB_DXT1 || + pixelFormat === PixelFormat.RGBA_DXT1 || + pixelFormat === PixelFormat.RGBA_DXT3 || + pixelFormat === PixelFormat.RGBA_DXT5 || + pixelFormat === PixelFormat.RGB_PVRTC_4BPPV1 || + pixelFormat === PixelFormat.RGB_PVRTC_2BPPV1 || + pixelFormat === PixelFormat.RGBA_PVRTC_4BPPV1 || + pixelFormat === PixelFormat.RGBA_PVRTC_2BPPV1 || + pixelFormat === PixelFormat.RGB_ETC1 + ); +}; - /** - * @private - */ - isPVRTCFormat: function (pixelFormat) { - return ( - pixelFormat === PixelFormat.RGB_PVRTC_4BPPV1 || - pixelFormat === PixelFormat.RGB_PVRTC_2BPPV1 || - pixelFormat === PixelFormat.RGBA_PVRTC_4BPPV1 || - pixelFormat === PixelFormat.RGBA_PVRTC_2BPPV1 - ); - }, +/** + * @private + */ +PixelFormat.isDXTFormat = function (pixelFormat) { + return ( + pixelFormat === PixelFormat.RGB_DXT1 || + pixelFormat === PixelFormat.RGBA_DXT1 || + pixelFormat === PixelFormat.RGBA_DXT3 || + pixelFormat === PixelFormat.RGBA_DXT5 + ); +}; - /** - * @private - */ - isETC1Format: function (pixelFormat) { - return pixelFormat === PixelFormat.RGB_ETC1; - }, +/** + * @private + */ +PixelFormat.isPVRTCFormat = function (pixelFormat) { + return ( + pixelFormat === PixelFormat.RGB_PVRTC_4BPPV1 || + pixelFormat === PixelFormat.RGB_PVRTC_2BPPV1 || + pixelFormat === PixelFormat.RGBA_PVRTC_4BPPV1 || + pixelFormat === PixelFormat.RGBA_PVRTC_2BPPV1 + ); +}; - /** - * @private - */ - compressedTextureSizeInBytes: function (pixelFormat, width, height) { - switch (pixelFormat) { - case PixelFormat.RGB_DXT1: - case PixelFormat.RGBA_DXT1: - case PixelFormat.RGB_ETC1: - return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8; - - case PixelFormat.RGBA_DXT3: - case PixelFormat.RGBA_DXT5: - return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 16; - - case PixelFormat.RGB_PVRTC_4BPPV1: - case PixelFormat.RGBA_PVRTC_4BPPV1: - return Math.floor( - (Math.max(width, 8) * Math.max(height, 8) * 4 + 7) / 8 - ); - - case PixelFormat.RGB_PVRTC_2BPPV1: - case PixelFormat.RGBA_PVRTC_2BPPV1: - return Math.floor( - (Math.max(width, 16) * Math.max(height, 8) * 2 + 7) / 8 - ); - - default: - return 0; - } - }, +/** + * @private + */ +PixelFormat.isETC1Format = function (pixelFormat) { + return pixelFormat === PixelFormat.RGB_ETC1; +}; - /** - * @private - */ - textureSizeInBytes: function (pixelFormat, pixelDatatype, width, height) { - var componentsLength = PixelFormat.componentsLength(pixelFormat); - if (PixelDatatype.isPacked(pixelDatatype)) { - componentsLength = 1; - } - return ( - componentsLength * - PixelDatatype.sizeInBytes(pixelDatatype) * - width * - height - ); - }, +/** + * @private + */ +PixelFormat.compressedTextureSizeInBytes = function ( + pixelFormat, + width, + height +) { + switch (pixelFormat) { + case PixelFormat.RGB_DXT1: + case PixelFormat.RGBA_DXT1: + case PixelFormat.RGB_ETC1: + return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8; + + case PixelFormat.RGBA_DXT3: + case PixelFormat.RGBA_DXT5: + return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 16; + + case PixelFormat.RGB_PVRTC_4BPPV1: + case PixelFormat.RGBA_PVRTC_4BPPV1: + return Math.floor((Math.max(width, 8) * Math.max(height, 8) * 4 + 7) / 8); + + case PixelFormat.RGB_PVRTC_2BPPV1: + case PixelFormat.RGBA_PVRTC_2BPPV1: + return Math.floor( + (Math.max(width, 16) * Math.max(height, 8) * 2 + 7) / 8 + ); + + default: + return 0; + } +}; - /** - * @private - */ - alignmentInBytes: function (pixelFormat, pixelDatatype, width) { - var mod = - PixelFormat.textureSizeInBytes(pixelFormat, pixelDatatype, width, 1) % 4; - return mod === 0 ? 4 : mod === 2 ? 2 : 1; - }, +/** + * @private + */ +PixelFormat.textureSizeInBytes = function ( + pixelFormat, + pixelDatatype, + width, + height +) { + var componentsLength = PixelFormat.componentsLength(pixelFormat); + if (PixelDatatype.isPacked(pixelDatatype)) { + componentsLength = 1; + } + return ( + componentsLength * PixelDatatype.sizeInBytes(pixelDatatype) * width * height + ); +}; - /** - * @private - */ - createTypedArray: function (pixelFormat, pixelDatatype, width, height) { - var constructor; - var sizeInBytes = PixelDatatype.sizeInBytes(pixelDatatype); - if (sizeInBytes === Uint8Array.BYTES_PER_ELEMENT) { - constructor = Uint8Array; - } else if (sizeInBytes === Uint16Array.BYTES_PER_ELEMENT) { - constructor = Uint16Array; - } else if ( - sizeInBytes === Float32Array.BYTES_PER_ELEMENT && - pixelDatatype === PixelDatatype.FLOAT - ) { - constructor = Float32Array; - } else { - constructor = Uint32Array; - } +/** + * @private + */ +PixelFormat.alignmentInBytes = function (pixelFormat, pixelDatatype, width) { + var mod = + PixelFormat.textureSizeInBytes(pixelFormat, pixelDatatype, width, 1) % 4; + return mod === 0 ? 4 : mod === 2 ? 2 : 1; +}; - var size = PixelFormat.componentsLength(pixelFormat) * width * height; - return new constructor(size); - }, +/** + * @private + */ +PixelFormat.createTypedArray = function ( + pixelFormat, + pixelDatatype, + width, + height +) { + var constructor; + var sizeInBytes = PixelDatatype.sizeInBytes(pixelDatatype); + if (sizeInBytes === Uint8Array.BYTES_PER_ELEMENT) { + constructor = Uint8Array; + } else if (sizeInBytes === Uint16Array.BYTES_PER_ELEMENT) { + constructor = Uint16Array; + } else if ( + sizeInBytes === Float32Array.BYTES_PER_ELEMENT && + pixelDatatype === PixelDatatype.FLOAT + ) { + constructor = Float32Array; + } else { + constructor = Uint32Array; + } + + var size = PixelFormat.componentsLength(pixelFormat) * width * height; + return new constructor(size); +}; - /** - * @private - */ - flipY: function (bufferView, pixelFormat, pixelDatatype, width, height) { - if (height === 1) { - return bufferView; - } - var flipped = PixelFormat.createTypedArray( - pixelFormat, - pixelDatatype, - width, - height - ); - var numberOfComponents = PixelFormat.componentsLength(pixelFormat); - var textureWidth = width * numberOfComponents; - for (var i = 0; i < height; ++i) { - var row = i * height * numberOfComponents; - var flippedRow = (height - i - 1) * height * numberOfComponents; - for (var j = 0; j < textureWidth; ++j) { - flipped[flippedRow + j] = bufferView[row + j]; - } +/** + * @private + */ +PixelFormat.flipY = function ( + bufferView, + pixelFormat, + pixelDatatype, + width, + height +) { + if (height === 1) { + return bufferView; + } + var flipped = PixelFormat.createTypedArray( + pixelFormat, + pixelDatatype, + width, + height + ); + var numberOfComponents = PixelFormat.componentsLength(pixelFormat); + var textureWidth = width * numberOfComponents; + for (var i = 0; i < height; ++i) { + var row = i * width * numberOfComponents; + var flippedRow = (height - i - 1) * width * numberOfComponents; + for (var j = 0; j < textureWidth; ++j) { + flipped[flippedRow + j] = bufferView[row + j]; } - return flipped; - }, + } + return flipped; }; + export default Object.freeze(PixelFormat); diff --git a/Source/Core/PlaneGeometry.js b/Source/Core/PlaneGeometry.js index 2987229952ea..200c09bc1856 100644 --- a/Source/Core/PlaneGeometry.js +++ b/Source/Core/PlaneGeometry.js @@ -16,7 +16,7 @@ import VertexFormat from "./VertexFormat.js"; * @alias PlaneGeometry * @constructor * - * @param {Object} options Object with the following properties: + * @param {Object} [options] Object with the following properties: * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed. * * @example diff --git a/Source/Core/PrimitiveType.js b/Source/Core/PrimitiveType.js index ae090d547ef5..87ee47b4f52d 100644 --- a/Source/Core/PrimitiveType.js +++ b/Source/Core/PrimitiveType.js @@ -3,7 +3,7 @@ import WebGLConstants from "./WebGLConstants.js"; /** * The type of a geometric primitive, i.e., points, lines, and triangles. * - * @exports PrimitiveType + * @enum {Number} */ var PrimitiveType = { /** @@ -65,20 +65,21 @@ var PrimitiveType = { * @constant */ TRIANGLE_FAN: WebGLConstants.TRIANGLE_FAN, +}; - /** - * @private - */ - validate: function (primitiveType) { - return ( - primitiveType === PrimitiveType.POINTS || - primitiveType === PrimitiveType.LINES || - primitiveType === PrimitiveType.LINE_LOOP || - primitiveType === PrimitiveType.LINE_STRIP || - primitiveType === PrimitiveType.TRIANGLES || - primitiveType === PrimitiveType.TRIANGLE_STRIP || - primitiveType === PrimitiveType.TRIANGLE_FAN - ); - }, +/** + * @private + */ +PrimitiveType.validate = function (primitiveType) { + return ( + primitiveType === PrimitiveType.POINTS || + primitiveType === PrimitiveType.LINES || + primitiveType === PrimitiveType.LINE_LOOP || + primitiveType === PrimitiveType.LINE_STRIP || + primitiveType === PrimitiveType.TRIANGLES || + primitiveType === PrimitiveType.TRIANGLE_STRIP || + primitiveType === PrimitiveType.TRIANGLE_FAN + ); }; + export default Object.freeze(PrimitiveType); diff --git a/Source/Core/Proxy.js b/Source/Core/Proxy.js new file mode 100644 index 000000000000..43af4dbabc38 --- /dev/null +++ b/Source/Core/Proxy.js @@ -0,0 +1,24 @@ +import DeveloperError from "./DeveloperError.js"; + +/** + * Base class for proxying requested made by {@link Resource}. + * + * @alias Proxy + * @constructor + * + * @see DefaultProxy + */ +function Proxy() { + DeveloperError.throwInstantiationError(); +} + +/** + * Get the final URL to use to request a given resource. + * + * @param {String} resource The resource to request. + * @returns {String} proxied resource + * @function + */ +Proxy.prototype.getURL = DeveloperError.throwInstantiationError; + +export default Proxy; diff --git a/Source/Core/QuadraticRealPolynomial.js b/Source/Core/QuadraticRealPolynomial.js index 57daad889e36..1922d2cec077 100644 --- a/Source/Core/QuadraticRealPolynomial.js +++ b/Source/Core/QuadraticRealPolynomial.js @@ -4,7 +4,7 @@ import CesiumMath from "./Math.js"; /** * Defines functions for 2nd order polynomial functions of one variable with only real coefficients. * - * @exports QuadraticRealPolynomial + * @namespace QuadraticRealPolynomial */ var QuadraticRealPolynomial = {}; diff --git a/Source/Core/QuantizedMeshTerrainData.js b/Source/Core/QuantizedMeshTerrainData.js index 0e3949cf5a2b..8bd031b9174b 100644 --- a/Source/Core/QuantizedMeshTerrainData.js +++ b/Source/Core/QuantizedMeshTerrainData.js @@ -222,7 +222,7 @@ Object.defineProperties(QuantizedMeshTerrainData.prototype, { * Uint8Array or image where a value of 255 indicates water and a value of 0 indicates land. * Values in between 0 and 255 are allowed as well to smoothly blend between land and water. * @memberof QuantizedMeshTerrainData.prototype - * @type {Uint8Array|Image|Canvas} + * @type {Uint8Array|HTMLImageElement|HTMLCanvasElement} */ waterMask: { get: function () { diff --git a/Source/Core/QuarticRealPolynomial.js b/Source/Core/QuarticRealPolynomial.js index 61eda3a90c00..ae91fac52a25 100644 --- a/Source/Core/QuarticRealPolynomial.js +++ b/Source/Core/QuarticRealPolynomial.js @@ -6,7 +6,7 @@ import QuadraticRealPolynomial from "./QuadraticRealPolynomial.js"; /** * Defines functions for 4th order polynomial functions of one variable with only real coefficients. * - * @exports QuarticRealPolynomial + * @namespace QuarticRealPolynomial */ var QuarticRealPolynomial = {}; diff --git a/Source/Core/Quaternion.js b/Source/Core/Quaternion.js index eb2c7bcb9e1b..b35bab7812eb 100644 --- a/Source/Core/Quaternion.js +++ b/Source/Core/Quaternion.js @@ -286,7 +286,7 @@ Quaternion.packedInterpolationLength = 3; * @param {Number[]} packedArray The packed array. * @param {Number} [startingIndex=0] The index of the first element to be converted. * @param {Number} [lastIndex=packedArray.length] The index of the last element to be converted. - * @param {Number[]} result The object into which to store the result. + * @param {Number[]} [result] The object into which to store the result. */ Quaternion.convertPackedArrayForInterpolation = function ( packedArray, @@ -330,6 +330,9 @@ Quaternion.convertPackedArrayForInterpolation = function ( sampledQuaternionAxis ); var angle = Quaternion.computeAngle(sampledQuaternionTempQuaternion); + if (!defined(result)) { + result = []; + } result[offset] = sampledQuaternionAxis.x * angle; result[offset + 1] = sampledQuaternionAxis.y * angle; result[offset + 2] = sampledQuaternionAxis.z * angle; @@ -1056,13 +1059,11 @@ Quaternion.equals = function (left, right) { * * @param {Quaternion} [left] The first quaternion. * @param {Quaternion} [right] The second quaternion. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ Quaternion.equalsEpsilon = function (left, right, epsilon) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.number("epsilon", epsilon); - //>>includeEnd('debug'); + epsilon = defaultValue(epsilon, 0); return ( left === right || @@ -1118,7 +1119,7 @@ Quaternion.prototype.equals = function (right) { * false otherwise. * * @param {Quaternion} [right] The right hand side quaternion. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ Quaternion.prototype.equalsEpsilon = function (right, epsilon) { diff --git a/Source/Core/Queue.js b/Source/Core/Queue.js index 49488468e146..b3186f6af222 100644 --- a/Source/Core/Queue.js +++ b/Source/Core/Queue.js @@ -96,7 +96,7 @@ Queue.prototype.clear = function () { /** * Sort the items in the queue in-place. * - * @param {Queue~Comparator} compareFunction A function that defines the sort order. + * @param {Queue.Comparator} compareFunction A function that defines the sort order. */ Queue.prototype.sort = function (compareFunction) { if (this._offset > 0) { @@ -110,7 +110,7 @@ Queue.prototype.sort = function (compareFunction) { /** * A function used to compare two items while sorting a queue. - * @callback Queue~Comparator + * @callback Queue.Comparator * * @param {*} a An item in the array. * @param {*} b An item in the array. diff --git a/Source/Core/Rectangle.js b/Source/Core/Rectangle.js index 9da1d61235ad..aa2f915fb992 100644 --- a/Source/Core/Rectangle.js +++ b/Source/Core/Rectangle.js @@ -57,6 +57,7 @@ Object.defineProperties(Rectangle.prototype, { * Gets the width of the rectangle in radians. * @memberof Rectangle.prototype * @type {Number} + * @readonly */ width: { get: function () { @@ -68,6 +69,7 @@ Object.defineProperties(Rectangle.prototype, { * Gets the height of the rectangle in radians. * @memberof Rectangle.prototype * @type {Number} + * @readonly */ height: { get: function () { @@ -370,13 +372,11 @@ Rectangle.clone = function (rectangle, result) { * * @param {Rectangle} [left] The first Rectangle. * @param {Rectangle} [right] The second Rectangle. - * @param {Number} absoluteEpsilon The absolute epsilon tolerance to use for equality testing. + * @param {Number} [absoluteEpsilon=0] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} true if left and right are within the provided epsilon, false otherwise. */ Rectangle.equalsEpsilon = function (left, right, absoluteEpsilon) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.number("absoluteEpsilon", absoluteEpsilon); - //>>includeEnd('debug'); + absoluteEpsilon = defaultValue(absoluteEpsilon, 0); return ( left === right || @@ -436,14 +436,10 @@ Rectangle.equals = function (left, right) { * false otherwise. * * @param {Rectangle} [other] The Rectangle to compare. - * @param {Number} epsilon The epsilon to use for equality testing. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. * @returns {Boolean} true if the Rectangles are within the provided epsilon, false otherwise. */ Rectangle.prototype.equalsEpsilon = function (other, epsilon) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.number("epsilon", epsilon); - //>>includeEnd('debug'); - return Rectangle.equalsEpsilon(this, other, epsilon); }; diff --git a/Source/Core/ReferenceFrame.js b/Source/Core/ReferenceFrame.js index a4fd843c52f6..e043a530789f 100644 --- a/Source/Core/ReferenceFrame.js +++ b/Source/Core/ReferenceFrame.js @@ -1,7 +1,7 @@ /** * Constants for identifying well-known reference frames. * - * @exports ReferenceFrame + * @enum {Number} */ var ReferenceFrame = { /** diff --git a/Source/Core/Request.js b/Source/Core/Request.js index 79c0a9563032..d9f219561ea3 100644 --- a/Source/Core/Request.js +++ b/Source/Core/Request.js @@ -8,13 +8,12 @@ import RequestType from "./RequestType.js"; * * @alias Request * @constructor - * @namespace - * @exports Request + * @param {Object} [options] An object with the following properties: * @param {String} [options.url] The url to request. - * @param {Request~RequestCallback} [options.requestFunction] The function that makes the actual data request. - * @param {Request~CancelCallback} [options.cancelFunction] The function that is called when the request is cancelled. - * @param {Request~PriorityCallback} [options.priorityFunction] The function that is called to update the request's priority, which occurs once per frame. + * @param {Request.RequestCallback} [options.requestFunction] The function that makes the actual data request. + * @param {Request.CancelCallback} [options.cancelFunction] The function that is called when the request is cancelled. + * @param {Request.PriorityCallback} [options.priorityFunction] The function that is called to update the request's priority, which occurs once per frame. * @param {Number} [options.priority=0.0] The initial priority of the request. * @param {Boolean} [options.throttle=false] Whether to throttle and prioritize the request. If false, the request will be sent immediately. If true, the request will be throttled and sent based on priority. * @param {Boolean} [options.throttleByServer=false] Whether to throttle the request by server. @@ -36,21 +35,21 @@ function Request(options) { /** * The function that makes the actual data request. * - * @type {Request~RequestCallback} + * @type {Request.RequestCallback} */ this.requestFunction = options.requestFunction; /** * The function that is called when the request is cancelled. * - * @type {Request~CancelCallback} + * @type {Request.CancelCallback} */ this.cancelFunction = options.cancelFunction; /** * The function that is called to update the request's priority, which occurs once per frame. * - * @type {Request~PriorityCallback} + * @type {Request.PriorityCallback} */ this.priorityFunction = options.priorityFunction; @@ -176,18 +175,18 @@ Request.prototype.clone = function (result) { /** * The function that makes the actual data request. - * @callback Request~RequestCallback - * @returns {Promise} A promise for the requested data. + * @callback Request.RequestCallback + * @returns {Promise} A promise for the requested data. */ /** * The function that is called when the request is cancelled. - * @callback Request~CancelCallback + * @callback Request.CancelCallback */ /** * The function that is called to update the request's priority, which occurs once per frame. - * @callback Request~PriorityCallback + * @callback Request.PriorityCallback * @returns {Number} The updated priority value. */ export default Request; diff --git a/Source/Core/RequestScheduler.js b/Source/Core/RequestScheduler.js index 12ff73f767b3..c16f6796a03f 100644 --- a/Source/Core/RequestScheduler.js +++ b/Source/Core/RequestScheduler.js @@ -44,7 +44,7 @@ var requestCompletedEvent = new Event(); * a lot of new requests may be generated and a lot of in-flight requests may become redundant. The request scheduler manually constrains the * number of requests so that newer requests wait in a shorter queue and don't have to compete for bandwidth with requests that have expired. * - * @exports RequestScheduler + * @namespace RequestScheduler * */ function RequestScheduler() {} @@ -66,6 +66,7 @@ RequestScheduler.maximumRequestsPerServer = 6; /** * A per server key list of overrides to use for throttling instead of maximumRequestsPerServer + * @type {Object} * * @example * RequestScheduler.requestsByServer = { @@ -181,6 +182,8 @@ function getRequestReceivedFunction(request) { requestCompletedEvent.raiseEvent(); request.state = RequestState.RECEIVED; request.deferred.resolve(results); + // explicitly set to undefined to ensure GC of request response data. See #8843 + request.deferred = undefined; }; } @@ -217,7 +220,12 @@ function cancelRequest(request) { var active = request.state === RequestState.ACTIVE; request.state = RequestState.CANCELLED; ++statistics.numberOfCancelledRequests; - request.deferred.reject(); + // check that deferred has not been cleared since cancelRequest can be called + // on a finished request, e.g. by clearForSpecs during tests + if (defined(request.deferred)) { + request.deferred.reject(); + request.deferred = undefined; + } if (active) { --statistics.numberOfActiveRequests; diff --git a/Source/Core/RequestState.js b/Source/Core/RequestState.js index 19e2cd1029bd..7dde7663867a 100644 --- a/Source/Core/RequestState.js +++ b/Source/Core/RequestState.js @@ -1,7 +1,7 @@ /** * State of the request. * - * @exports RequestState + * @enum {Number} */ var RequestState = { /** diff --git a/Source/Core/RequestType.js b/Source/Core/RequestType.js index c5f99a70b164..2dc54e96e8bf 100644 --- a/Source/Core/RequestType.js +++ b/Source/Core/RequestType.js @@ -1,7 +1,7 @@ /** * An enum identifying the type of request. Used for finer grained logging and priority sorting. * - * @exports RequestType + * @enum {Number} */ var RequestType = { /** diff --git a/Source/Core/Resource.js b/Source/Core/Resource.js index a95c8746d243..4dba57ae1a88 100644 --- a/Source/Core/Resource.js +++ b/Source/Core/Resource.js @@ -223,8 +223,8 @@ function combineQueryParameters(q1, q2, preserveQueryParameters) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @@ -291,7 +291,7 @@ function Resource(options) { /** * A proxy to be used when loading the resource. * - * @type {DefaultProxy} + * @type {Proxy} */ this.proxy = options.proxy; @@ -521,11 +521,21 @@ Object.defineProperties(Resource.prototype, { }, }); +/** + * Override Object#toString so that implicit string conversion gives the + * complete URL represented by this Resource. + * + * @returns {String} The URL represented by this Resource + */ +Resource.prototype.toString = function () { + return this.getUrlComponent(true, true); +}; + /** * Returns the url, optional with the query string and processed by a proxy. * * @param {Boolean} [query=false] If true, the query string is included. - * @param {Boolean} [proxy=false] If true, the url is processed the proxy object if defined. + * @param {Boolean} [proxy=false] If true, the url is processed by the proxy object, if defined. * * @returns {String} The url with all the requested components. */ @@ -620,8 +630,8 @@ Resource.prototype.setTemplateValues = function (template, useAsDefault) { * @param {Object} [options.queryParameters] An object containing query parameters that will be combined with those of the current instance. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). These will be combined with those of the current instance. * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The function to call when loading the resource fails. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The function to call when loading the resource fails. * @param {Number} [options.retryAttempts] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {Boolean} [options.preserveQueryParameters=false] If true, this will keep all query parameters from the current resource and derived resource. If false, derived parameters will replace those of the current resource. @@ -782,8 +792,8 @@ Resource.prototype.fetchArrayBuffer = function () { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. @@ -826,8 +836,8 @@ Resource.prototype.fetchBlob = function () { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. @@ -846,7 +856,7 @@ Resource.fetchBlob = function (options) { * @param {Boolean} [options.preferBlob=false] If true, we will load the image via a blob. * @param {Boolean} [options.preferImageBitmap=false] If true, image will be decoded during fetch and an ImageBitmap is returned. * @param {Boolean} [options.flipY=false] If true, image will be vertically flipped during decode. Only applies if the browser supports createImageBitmap. - * @returns {Promise.|Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.|Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1033,14 +1043,14 @@ function fetchImage(options) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. * @param {Boolean} [options.flipY=false] Whether to vertically flip the image during fetch and decode. Only applies when requesting an image and the browser supports createImageBitmap. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {Boolean} [options.preferBlob=false] If true, we will load the image via a blob. * @param {Boolean} [options.preferImageBitmap=false] If true, image will be decoded during fetch and an ImageBitmap is returned. - * @returns {Promise.|Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.|Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.fetchImage = function (options) { var resource = new Resource(options); @@ -1091,8 +1101,8 @@ Resource.prototype.fetchText = function () { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. @@ -1111,7 +1121,7 @@ Resource.fetchText = function (options) { * adds 'Accept: application/json,*/*;q=0.01' to the request headers, if not * already specified. * - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1152,11 +1162,11 @@ Resource.prototype.fetchJson = function () { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.fetchJson = function (options) { var resource = new Resource(options); @@ -1201,8 +1211,8 @@ Resource.prototype.fetchXML = function () { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. @@ -1216,7 +1226,7 @@ Resource.fetchXML = function (options) { * Requests a resource using JSONP. * * @param {String} [callbackParameterName='callback'] The callback parameter name that the server expects. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1304,12 +1314,12 @@ function fetchJsonp(resource, callbackParameterName, functionName) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {String} [options.callbackParameterName='callback'] The callback parameter name that the server expects. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.fetchJsonp = function (options) { var resource = new Resource(options); @@ -1357,9 +1367,12 @@ Resource.prototype._makeRequest = function (options) { return promise .then(function (data) { + // explicitly set to undefined to ensure GC of request response data. See #8843 + request.cancelFunction = undefined; return data; }) .otherwise(function (e) { + request.cancelFunction = undefined; if (request.state !== RequestState.FAILED) { return when.reject(e); } @@ -1441,7 +1454,7 @@ function decodeDataUri(dataUriRegexResult, responseType) { * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {Object} [options.headers] Additional HTTP headers to send with the request, if any. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1470,13 +1483,13 @@ Resource.prototype.fetch = function (options) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.fetch = function (options) { var resource = new Resource(options); @@ -1497,7 +1510,7 @@ Resource.fetch = function (options) { * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {Object} [options.headers] Additional HTTP headers to send with the request, if any. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1527,13 +1540,13 @@ Resource.prototype.delete = function (options) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.delete = function (options) { var resource = new Resource(options); @@ -1555,7 +1568,7 @@ Resource.delete = function (options) { * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {Object} [options.headers] Additional HTTP headers to send with the request, if any. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1584,13 +1597,13 @@ Resource.prototype.head = function (options) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.head = function (options) { var resource = new Resource(options); @@ -1611,7 +1624,7 @@ Resource.head = function (options) { * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {Object} [options.headers] Additional HTTP headers to send with the request, if any. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1640,13 +1653,13 @@ Resource.prototype.options = function (options) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.options = function (options) { var resource = new Resource(options); @@ -1669,7 +1682,7 @@ Resource.options = function (options) { * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {Object} [options.headers] Additional HTTP headers to send with the request, if any. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1702,13 +1715,13 @@ Resource.prototype.post = function (data, options) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.post = function (options) { var resource = new Resource(options); @@ -1730,7 +1743,7 @@ Resource.post = function (options) { * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {Object} [options.headers] Additional HTTP headers to send with the request, if any. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1763,13 +1776,13 @@ Resource.prototype.put = function (data, options) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.put = function (options) { var resource = new Resource(options); @@ -1791,7 +1804,7 @@ Resource.put = function (options) { * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {Object} [options.headers] Additional HTTP headers to send with the request, if any. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. * * * @example @@ -1824,13 +1837,13 @@ Resource.prototype.patch = function (data, options) { * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. - * @param {DefaultProxy} [options.proxy] A proxy to be used when loading the resource. - * @param {Resource~RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. + * @param {Proxy} [options.proxy] A proxy to be used when loading the resource. + * @param {Resource.RetryCallback} [options.retryCallback] The Function to call when a request for this resource fails. If it returns true, the request will be retried. * @param {Number} [options.retryAttempts=0] The number of times the retryCallback should be called before giving up. * @param {Request} [options.request] A Request object that will be used. Intended for internal use only. * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. - * @returns {Promise.|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. + * @returns {Promise.<*>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. */ Resource.patch = function (options) { var resource = new Resource(options); @@ -2202,7 +2215,7 @@ Resource.DEFAULT = Object.freeze( /** * A function that returns the value of the property. - * @callback Resource~RetryCallback + * @callback Resource.RetryCallback * * @param {Resource} [resource] The resource that failed to load. * @param {Error} [error] The error that occurred during the loading of the resource. diff --git a/Source/Core/ScreenSpaceEventHandler.js b/Source/Core/ScreenSpaceEventHandler.js index 050e7edd72c7..db52177dc029 100644 --- a/Source/Core/ScreenSpaceEventHandler.js +++ b/Source/Core/ScreenSpaceEventHandler.js @@ -897,7 +897,7 @@ function handlePointerMove(screenSpaceEventHandler, event) { * * @alias ScreenSpaceEventHandler * - * @param {Canvas} [element=document] The element to add events to. + * @param {HTMLCanvasElement} [element=document] The element to add events to. * * @constructor */ diff --git a/Source/Core/ScreenSpaceEventType.js b/Source/Core/ScreenSpaceEventType.js index 842988855518..406533eb769b 100644 --- a/Source/Core/ScreenSpaceEventType.js +++ b/Source/Core/ScreenSpaceEventType.js @@ -1,7 +1,7 @@ /** * This enumerated type is for classifying mouse events: down, up, click, double click, move and move while a button is held down. * - * @exports ScreenSpaceEventType + * @enum {Number} */ var ScreenSpaceEventType = { /** diff --git a/Source/Core/Simon1994PlanetaryPositions.js b/Source/Core/Simon1994PlanetaryPositions.js index 91f9f61ba03c..1517ad39aea6 100644 --- a/Source/Core/Simon1994PlanetaryPositions.js +++ b/Source/Core/Simon1994PlanetaryPositions.js @@ -11,7 +11,7 @@ import TimeStandard from "./TimeStandard.js"; * Contains functions for finding the Cartesian coordinates of the sun and the moon in the * Earth-centered inertial frame. * - * @exports Simon1994PlanetaryPositions + * @namespace Simon1994PlanetaryPositions */ var Simon1994PlanetaryPositions = {}; diff --git a/Source/Core/SimplePolylineGeometry.js b/Source/Core/SimplePolylineGeometry.js index 08ba7e6f1e84..08fcb5bd134b 100644 --- a/Source/Core/SimplePolylineGeometry.js +++ b/Source/Core/SimplePolylineGeometry.js @@ -251,7 +251,7 @@ var generateArcOptionsScratch = { * Computes the geometric representation of a simple polyline, including its vertices, indices, and a bounding sphere. * * @param {SimplePolylineGeometry} simplePolylineGeometry A description of the polyline. - * @returns {Geometry} The computed vertices and indices. + * @returns {Geometry|undefined} The computed vertices and indices. */ SimplePolylineGeometry.createGeometry = function (simplePolylineGeometry) { var positions = simplePolylineGeometry._positions; diff --git a/Source/Core/SphereGeometry.js b/Source/Core/SphereGeometry.js index b47c4dfbb9e9..9a3e46c97540 100644 --- a/Source/Core/SphereGeometry.js +++ b/Source/Core/SphereGeometry.js @@ -110,7 +110,7 @@ SphereGeometry.unpack = function (array, startingIndex, result) { * Computes the geometric representation of a sphere, including its vertices, indices, and a bounding sphere. * * @param {SphereGeometry} sphereGeometry A description of the sphere. - * @returns {Geometry} The computed vertices and indices. + * @returns {Geometry|undefined} The computed vertices and indices. */ SphereGeometry.createGeometry = function (sphereGeometry) { return EllipsoidGeometry.createGeometry(sphereGeometry._ellipsoidGeometry); diff --git a/Source/Core/SphereOutlineGeometry.js b/Source/Core/SphereOutlineGeometry.js index 2d4133775e18..dbb3d1b1fe3a 100644 --- a/Source/Core/SphereOutlineGeometry.js +++ b/Source/Core/SphereOutlineGeometry.js @@ -110,7 +110,7 @@ SphereOutlineGeometry.unpack = function (array, startingIndex, result) { * Computes the geometric representation of an outline of a sphere, including its vertices, indices, and a bounding sphere. * * @param {SphereOutlineGeometry} sphereGeometry A description of the sphere outline. - * @returns {Geometry} The computed vertices and indices. + * @returns {Geometry|undefined} The computed vertices and indices. */ SphereOutlineGeometry.createGeometry = function (sphereGeometry) { return EllipsoidOutlineGeometry.createGeometry( diff --git a/Source/Core/TerrainData.js b/Source/Core/TerrainData.js index 570418275b0b..a76e95e998f4 100644 --- a/Source/Core/TerrainData.js +++ b/Source/Core/TerrainData.js @@ -29,7 +29,7 @@ Object.defineProperties(TerrainData.prototype, { * Uint8Array or image where a value of 255 indicates water and a value of 0 indicates land. * Values in between 0 and 255 are allowed as well to smoothly blend between land and water. * @memberof TerrainData.prototype - * @type {Uint8Array|Image|Canvas} + * @type {Uint8Array|HTMLImageElement|HTMLCanvasElement} */ waterMask: { get: DeveloperError.throwInstantiationError, diff --git a/Source/Core/TerrainProvider.js b/Source/Core/TerrainProvider.js index 21b44393f51d..d733d202e89a 100644 --- a/Source/Core/TerrainProvider.js +++ b/Source/Core/TerrainProvider.js @@ -439,7 +439,7 @@ TerrainProvider.prototype.getTileDataAvailable = * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded + * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded */ TerrainProvider.prototype.loadTileDataAvailability = DeveloperError.throwInstantiationError; diff --git a/Source/Core/TerrainQuantization.js b/Source/Core/TerrainQuantization.js index 594b59da6672..7e3153f803d7 100644 --- a/Source/Core/TerrainQuantization.js +++ b/Source/Core/TerrainQuantization.js @@ -1,7 +1,7 @@ /** * This enumerated type is used to determine how the vertices of the terrain mesh are compressed. * - * @exports TerrainQuantization + * @enum {Number} * * @private */ diff --git a/Source/Core/TileProviderError.js b/Source/Core/TileProviderError.js index d8c36b2aeb61..a7465cbd711b 100644 --- a/Source/Core/TileProviderError.js +++ b/Source/Core/TileProviderError.js @@ -102,7 +102,7 @@ function TileProviderError( * error is not specific to a particular tile. * @param {Number} level The level-of-detail of the tile that experienced the error, or undefined if the * error is not specific to a particular tile. - * @param {TileProviderError~RetryFunction} retryFunction The function to call to retry the operation. If undefined, the + * @param {TileProviderError.RetryFunction} retryFunction The function to call to retry the operation. If undefined, the * operation will not be retried. * @param {Error} [errorDetails] The error or exception that occurred, if any. * @returns {TileProviderError} The error instance that was passed to the event listeners and that @@ -175,6 +175,6 @@ TileProviderError.handleSuccess = function (previousError) { /** * A function that will be called to retry the operation. - * @callback TileProviderError~RetryFunction + * @callback TileProviderError.RetryFunction */ export default TileProviderError; diff --git a/Source/Core/TimeConstants.js b/Source/Core/TimeConstants.js index caf182f080e1..d6a805af65d9 100644 --- a/Source/Core/TimeConstants.js +++ b/Source/Core/TimeConstants.js @@ -1,7 +1,7 @@ /** * Constants for time conversions like those done by {@link JulianDate}. * - * @exports TimeConstants + * @namespace TimeConstants * * @see JulianDate * diff --git a/Source/Core/TimeInterval.js b/Source/Core/TimeInterval.js index e694e0079a82..679245751d50 100644 --- a/Source/Core/TimeInterval.js +++ b/Source/Core/TimeInterval.js @@ -217,7 +217,7 @@ TimeInterval.clone = function (timeInterval, result) { * * @param {TimeInterval} [left] The first instance. * @param {TimeInterval} [right] The second instance. - * @param {TimeInterval~DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. + * @param {TimeInterval.DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. * @returns {Boolean} true if the dates are equal; otherwise, false. */ TimeInterval.equals = function (left, right, dataComparer) { @@ -243,14 +243,12 @@ TimeInterval.equals = function (left, right, dataComparer) { * * @param {TimeInterval} [left] The first instance. * @param {TimeInterval} [right] The second instance. - * @param {Number} epsilon The maximum number of seconds that should separate the two instances. - * @param {TimeInterval~DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. + * @param {Number} [epsilon=0] The maximum number of seconds that should separate the two instances. + * @param {TimeInterval.DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. * @returns {Boolean} true if the two dates are within epsilon seconds of each other; otherwise false. */ TimeInterval.equalsEpsilon = function (left, right, epsilon, dataComparer) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.number("epsilon", epsilon); - //>>includeEnd('debug'); + epsilon = defaultValue(epsilon, 0); return ( left === right || @@ -271,14 +269,13 @@ TimeInterval.equalsEpsilon = function (left, right, epsilon, dataComparer) { * * @param {TimeInterval} left The first interval. * @param {TimeInterval} [right] The second interval. - * @param {TimeInterval} result An existing instance to use for the result. - * @param {TimeInterval~MergeCallback} [mergeCallback] A function which merges the data of the two intervals. If omitted, the data from the left interval will be used. + * @param {TimeInterval} [result] An existing instance to use for the result. + * @param {TimeInterval.MergeCallback} [mergeCallback] A function which merges the data of the two intervals. If omitted, the data from the left interval will be used. * @returns {TimeInterval} The modified result parameter. */ TimeInterval.intersect = function (left, right, result, mergeCallback) { //>>includeStart('debug', pragmas.debug); Check.typeOf.object("left", left); - Check.typeOf.object("result", result); //>>includeEnd('debug'); if (!defined(right)) { @@ -309,6 +306,10 @@ TimeInterval.intersect = function (left, right, result, mergeCallback) { var rightIsStopIncluded = right.isStopIncluded; var leftLessThanRight = JulianDate.lessThan(leftStop, rightStop); + if (!defined(result)) { + result = new TimeInterval(); + } + result.start = intersectsStartRight ? rightStart : leftStart; result.isStartIncluded = (leftIsStartIncluded && rightIsStartIncluded) || @@ -371,7 +372,7 @@ TimeInterval.prototype.clone = function (result) { * true if they are equal, false otherwise. * * @param {TimeInterval} [right] The right hand side interval. - * @param {TimeInterval~DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. + * @param {TimeInterval.DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. * @returns {Boolean} true if they are equal, false otherwise. */ TimeInterval.prototype.equals = function (right, dataComparer) { @@ -384,8 +385,8 @@ TimeInterval.prototype.equals = function (right, dataComparer) { * false otherwise. * * @param {TimeInterval} [right] The right hand side interval. - * @param {Number} epsilon The epsilon to use for equality testing. - * @param {TimeInterval~DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. + * @param {Number} [epsilon=0] The epsilon to use for equality testing. + * @param {TimeInterval.DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. * @returns {Boolean} true if they are within the provided epsilon, false otherwise. */ TimeInterval.prototype.equalsEpsilon = function (right, epsilon, dataComparer) { @@ -418,7 +419,7 @@ TimeInterval.EMPTY = Object.freeze( /** * Function interface for merging interval data. - * @callback TimeInterval~MergeCallback + * @callback TimeInterval.MergeCallback * * @param {*} leftData The first data instance. * @param {*} rightData The second data instance. @@ -427,7 +428,7 @@ TimeInterval.EMPTY = Object.freeze( /** * Function interface for comparing interval data. - * @callback TimeInterval~DataComparer + * @callback TimeInterval.DataComparer * @param {*} leftData The first data instance. * @param {*} rightData The second data instance. * @returns {Boolean} true if the provided instances are equal, false otherwise. diff --git a/Source/Core/TimeIntervalCollection.js b/Source/Core/TimeIntervalCollection.js index 7ec77401a76d..ba087ab14838 100644 --- a/Source/Core/TimeIntervalCollection.js +++ b/Source/Core/TimeIntervalCollection.js @@ -129,7 +129,7 @@ Object.defineProperties(TimeIntervalCollection.prototype, { * true if they are equal, false otherwise. * * @param {TimeIntervalCollection} [right] The right hand side collection. - * @param {TimeInterval~DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. + * @param {TimeInterval.DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. * @returns {Boolean} true if they are equal, false otherwise. */ TimeIntervalCollection.prototype.equals = function (right, dataComparer) { @@ -157,7 +157,7 @@ TimeIntervalCollection.prototype.equals = function (right, dataComparer) { * Gets the interval at the specified index. * * @param {Number} index The index of the interval to retrieve. - * @returns {TimeInterval} The interval at the specified index, or undefined if no interval exists as that index. + * @returns {TimeInterval|undefined} The interval at the specified index, or undefined if no interval exists as that index. */ TimeIntervalCollection.prototype.get = function (index) { //>>includeStart('debug', pragmas.debug); @@ -274,7 +274,7 @@ TimeIntervalCollection.prototype.indexOf = function (date) { * @param {JulianDate} [options.stop] The stop time of the interval. * @param {Boolean} [options.isStartIncluded] true if options.start is included in the interval, false otherwise. * @param {Boolean} [options.isStopIncluded] true if options.stop is included in the interval, false otherwise. - * @returns {TimeInterval} The first interval in the collection that matches the specified parameters. + * @returns {TimeInterval|undefined} The first interval in the collection that matches the specified parameters. */ TimeIntervalCollection.prototype.findInterval = function (options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -305,7 +305,7 @@ TimeIntervalCollection.prototype.findInterval = function (options) { * The data in the new interval takes precedence over any existing intervals in the collection. * * @param {TimeInterval} interval The interval to add. - * @param {TimeInterval~DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. + * @param {TimeInterval.DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. */ TimeIntervalCollection.prototype.addInterval = function ( interval, @@ -664,8 +664,8 @@ TimeIntervalCollection.prototype.removeInterval = function (interval) { * Creates a new instance that is the intersection of this collection and the provided collection. * * @param {TimeIntervalCollection} other The collection to intersect with. - * @param {TimeInterval~DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. - * @param {TimeInterval~MergeCallback} [mergeCallback] A function which merges the data of the two intervals. If omitted, the data from the left interval will be used. + * @param {TimeInterval.DataComparer} [dataComparer] A function which compares the data of the two intervals. If omitted, reference equality is used. + * @param {TimeInterval.MergeCallback} [mergeCallback] A function which merges the data of the two intervals. If omitted, the data from the left interval will be used. * @returns {TimeIntervalCollection} A new TimeIntervalCollection which is the intersection of this collection and the provided collection. */ TimeIntervalCollection.prototype.intersect = function ( diff --git a/Source/Core/TimeStandard.js b/Source/Core/TimeStandard.js index a41435ea9424..97f951354a94 100644 --- a/Source/Core/TimeStandard.js +++ b/Source/Core/TimeStandard.js @@ -1,7 +1,7 @@ /** * Provides the type of time standards which JulianDate can take as input. * - * @exports TimeStandard + * @enum {Number} * * @see JulianDate */ diff --git a/Source/Core/Tipsify.js b/Source/Core/Tipsify.js index 6836c7207ba9..575bd76788a5 100644 --- a/Source/Core/Tipsify.js +++ b/Source/Core/Tipsify.js @@ -8,7 +8,7 @@ import DeveloperError from "./DeveloperError.js"; * 'Fast Triangle Reordering for Vertex Locality and Reduced Overdraw.' * The runtime is linear but several passes are made. * - * @exports Tipsify + * @namespace Tipsify * * @see * Fast Triangle Reordering for Vertex Locality and Reduced Overdraw diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index 5bf47eff85f9..be3f81aeff49 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -23,8 +23,7 @@ import TimeConstants from "./TimeConstants.js"; /** * Contains functions for transforming positions to various reference frames. * - * @exports Transforms - * @namespace + * @namespace Transforms */ var Transforms = {}; @@ -96,7 +95,7 @@ var scratchThirdCartesian = new Cartesian3(); * 'east', 'north', 'up', 'west', 'south' or 'down'. * @param {String} secondAxis name of the second axis of the local reference frame. Must be * 'east', 'north', 'up', 'west', 'south' or 'down'. - * @return {localFrameToFixedFrameGenerator~resultat} The function that will computes a + * @return {Transforms.LocalFrameToFixedFrame} The function that will computes a * 4x4 transformation matrix from a reference frame, with first axis and second axis compliant with the parameters, */ Transforms.localFrameToFixedFrameGenerator = function (firstAxis, secondAxis) { @@ -113,7 +112,7 @@ Transforms.localFrameToFixedFrameGenerator = function (firstAxis, secondAxis) { /** * Computes a 4x4 transformation matrix from a reference frame * centered at the provided origin to the provided ellipsoid's fixed reference frame. - * @callback Transforms~LocalFrameToFixedFrame + * @callback Transforms.LocalFrameToFixedFrame * @param {Cartesian3} origin The center point of the local reference frame. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. * @param {Matrix4} [result] The object onto which to store the result. @@ -369,7 +368,7 @@ var scratchHPRMatrix4 = new Matrix4(); * @param {Cartesian3} origin The center point of the local reference frame. * @param {HeadingPitchRoll} headingPitchRoll The heading, pitch, and roll. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. - * @param {Transforms~LocalFrameToFixedFrame} [fixedFrameTransform=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation + * @param {Transforms.LocalFrameToFixedFrame} [fixedFrameTransform=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation * matrix from a reference frame to the provided ellipsoid's fixed reference frame * @param {Matrix4} [result] The object onto which to store the result. * @returns {Matrix4} The modified result parameter or a new Matrix4 instance if none was provided. @@ -424,7 +423,7 @@ var scratchHPRMatrix3 = new Matrix3(); * @param {Cartesian3} origin The center point of the local reference frame. * @param {HeadingPitchRoll} headingPitchRoll The heading, pitch, and roll. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. - * @param {Transforms~LocalFrameToFixedFrame} [fixedFrameTransform=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation + * @param {Transforms.LocalFrameToFixedFrame} [fixedFrameTransform=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation * matrix from a reference frame to the provided ellipsoid's fixed reference frame * @param {Quaternion} [result] The object onto which to store the result. * @returns {Quaternion} The modified result parameter or a new Quaternion instance if none was provided. @@ -473,7 +472,7 @@ var hprQuaternionScratch = new Quaternion(); * * @param {Matrix4} transform The transform * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. - * @param {Transforms~LocalFrameToFixedFrame} [fixedFrameTransform=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation + * @param {Transforms.LocalFrameToFixedFrame} [fixedFrameTransform=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation * matrix from a reference frame to the provided ellipsoid's fixed reference frame * @param {HeadingPitchRoll} [result] The object onto which to store the result. * @returns {HeadingPitchRoll} The modified result parameter or a new HeadingPitchRoll instance if none was provided. @@ -654,7 +653,7 @@ var j2000ttDays = 2451545.0; * indicates that the preload has completed. * * @param {TimeInterval} timeInterval The interval to preload. - * @returns {Promise} A promise that, when resolved, indicates that the preload has completed + * @returns {Promise} A promise that, when resolved, indicates that the preload has completed * and evaluation of the transformation between the fixed and ICRF axes will * no longer return undefined for a time inside the interval. * @@ -950,7 +949,13 @@ var rightScratch = new Cartesian3(); var upScratch = new Cartesian3(); /** - * @private + * Transform a position and velocity to a rotation matrix. + * + * @param {Cartesian3} position The position to transform. + * @param {Cartesian3} velocity The velocity vector to transform. + * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. + * @param {Matrix3} [result] The object onto which to store the result. + * @returns {Matrix3} The modified result parameter or a new Matrix3 instance if none was provided. */ Transforms.rotationMatrixFromPositionVelocity = function ( position, diff --git a/Source/Core/TridiagonalSystemSolver.js b/Source/Core/TridiagonalSystemSolver.js index b4cef5548d7c..dd387a708e34 100644 --- a/Source/Core/TridiagonalSystemSolver.js +++ b/Source/Core/TridiagonalSystemSolver.js @@ -6,7 +6,7 @@ import DeveloperError from "./DeveloperError.js"; * Uses the Tridiagonal Matrix Algorithm, also known as the Thomas Algorithm, to solve * a system of linear equations where the coefficient matrix is a tridiagonal matrix. * - * @exports TridiagonalSystemSolver + * @namespace TridiagonalSystemSolver */ var TridiagonalSystemSolver = {}; diff --git a/Source/Core/TrustedServers.js b/Source/Core/TrustedServers.js index 8393a1adb192..7618506de07e 100644 --- a/Source/Core/TrustedServers.js +++ b/Source/Core/TrustedServers.js @@ -6,7 +6,7 @@ import DeveloperError from "./DeveloperError.js"; * A singleton that contains all of the servers that are trusted. Credentials will be sent with * any requests to these servers. * - * @exports TrustedServers + * @namespace TrustedServers * * @see {@link http://www.w3.org/TR/cors/|Cross-Origin Resource Sharing} */ diff --git a/Source/Core/VRTheWorldTerrainProvider.js b/Source/Core/VRTheWorldTerrainProvider.js index 00870f6878ca..fc75acc64ce8 100644 --- a/Source/Core/VRTheWorldTerrainProvider.js +++ b/Source/Core/VRTheWorldTerrainProvider.js @@ -245,6 +245,19 @@ Object.defineProperties(VRTheWorldTerrainProvider.prototype, { return false; }, }, + /** + * Gets an object that can be used to determine availability of terrain from this provider, such as + * at points and in rectangles. This function should not be called before + * {@link TerrainProvider#ready} returns true. This property may be undefined if availability + * information is not available. + * @memberof VRTheWorldTerrainProvider.prototype + * @type {TileAvailability} + */ + availability: { + get: function () { + return undefined; + }, + }, }); /** @@ -417,7 +430,7 @@ VRTheWorldTerrainProvider.prototype.getTileDataAvailable = function ( * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded + * @returns {undefined|Promise} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded */ VRTheWorldTerrainProvider.prototype.loadTileDataAvailability = function ( x, diff --git a/Source/Core/Visibility.js b/Source/Core/Visibility.js index c052f3f4a128..cc20094d549b 100644 --- a/Source/Core/Visibility.js +++ b/Source/Core/Visibility.js @@ -4,7 +4,7 @@ * it has no visibility, may partially block an occludee from view, or may not block it at all, * leading to full visibility. * - * @exports Visibility + * @enum {Number} */ var Visibility = { /** diff --git a/Source/Core/WebGLConstants.js b/Source/Core/WebGLConstants.js index e0923a3d8f8b..32b63443cd2a 100644 --- a/Source/Core/WebGLConstants.js +++ b/Source/Core/WebGLConstants.js @@ -7,7 +7,7 @@ * and [WebGL 2.0]{@link https://www.khronos.org/registry/webgl/specs/latest/2.0/} * specifications. * - * @exports WebGLConstants + * @enum {Number} */ var WebGLConstants = { DEPTH_BUFFER_BIT: 0x00000100, diff --git a/Source/Core/WindingOrder.js b/Source/Core/WindingOrder.js index a24e50a49b54..2ec8947e6886 100644 --- a/Source/Core/WindingOrder.js +++ b/Source/Core/WindingOrder.js @@ -3,7 +3,7 @@ import WebGLConstants from "./WebGLConstants.js"; /** * Winding order defines the order of vertices for a triangle to be considered front-facing. * - * @exports WindingOrder + * @enum {Number} */ var WindingOrder = { /** @@ -21,15 +21,16 @@ var WindingOrder = { * @constant */ COUNTER_CLOCKWISE: WebGLConstants.CCW, +}; - /** - * @private - */ - validate: function (windingOrder) { - return ( - windingOrder === WindingOrder.CLOCKWISE || - windingOrder === WindingOrder.COUNTER_CLOCKWISE - ); - }, +/** + * @private + */ +WindingOrder.validate = function (windingOrder) { + return ( + windingOrder === WindingOrder.CLOCKWISE || + windingOrder === WindingOrder.COUNTER_CLOCKWISE + ); }; + export default Object.freeze(WindingOrder); diff --git a/Source/Core/barycentricCoordinates.js b/Source/Core/barycentricCoordinates.js index 70b81978626f..61daebcf5530 100644 --- a/Source/Core/barycentricCoordinates.js +++ b/Source/Core/barycentricCoordinates.js @@ -11,7 +11,7 @@ var scratchCartesian3 = new Cartesian3(); /** * Computes the barycentric coordinates for a point with respect to a triangle. * - * @exports barycentricCoordinates + * @function * * @param {Cartesian2|Cartesian3} point The point to test. * @param {Cartesian2|Cartesian3} p0 The first point of the triangle, corresponding to the barycentric x-axis. diff --git a/Source/Core/binarySearch.js b/Source/Core/binarySearch.js index b4866ac34565..20c9655620ea 100644 --- a/Source/Core/binarySearch.js +++ b/Source/Core/binarySearch.js @@ -3,10 +3,10 @@ import Check from "./Check.js"; /** * Finds an item in a sorted array. * - * @exports binarySearch + * @function * @param {Array} array The sorted array to search. * @param {*} itemToFind The item to find in the array. - * @param {binarySearch~Comparator} comparator The function to use to compare the item to + * @param {binarySearchComparator} comparator The function to use to compare the item to * elements in the array. * @returns {Number} The index of itemToFind in the array, if it exists. If itemToFind * does not exist, the return value is a negative number which is the bitwise complement (~) @@ -51,7 +51,7 @@ function binarySearch(array, itemToFind, comparator) { /** * A function used to compare two items while performing a binary search. - * @callback binarySearch~Comparator + * @callback binarySearchComparator * * @param {*} a An item in the array. * @param {*} b The item being searched for. diff --git a/Source/Core/buildModuleUrl.js b/Source/Core/buildModuleUrl.js index b79c07069ca8..aa1a57c27a39 100644 --- a/Source/Core/buildModuleUrl.js +++ b/Source/Core/buildModuleUrl.js @@ -5,7 +5,7 @@ import Resource from "./Resource.js"; /*global CESIUM_BASE_URL*/ -var cesiumScriptRegex = /((?:.*\/)|^)Cesium\.js$/; +var cesiumScriptRegex = /((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/; function getBaseUrlFromCesiumScript() { var scripts = document.getElementsByTagName("script"); for (var i = 0, len = scripts.length; i < len; ++i) { @@ -90,13 +90,20 @@ function buildModuleUrlFromBaseUrl(moduleID) { var implementation; /** - * Given a non-relative moduleID, returns an absolute URL to the file represented by that module ID, - * using, in order of preference, require.toUrl, the value of a global CESIUM_BASE_URL, or - * the base URL of the Cesium.js script. + * Given a relative URL under the Cesium base URL, returns an absolute URL. + * @function * - * @private + * @param {String} relativeUrl The relative path. + * + * @example + * var viewer = new Cesium.Viewer("cesiumContainer", { + * imageryProvider: new Cesium.TileMapServiceImageryProvider({ + * url: Cesium.buildModuleUrl("Assets/Textures/NaturalEarthII"), + * }), + * baseLayerPicker: false, + * }); */ -function buildModuleUrl(moduleID) { +function buildModuleUrl(relativeUrl) { if (!defined(implementation)) { //select implementation if ( @@ -111,7 +118,7 @@ function buildModuleUrl(moduleID) { } } - var url = implementation(moduleID); + var url = implementation(relativeUrl); return url; } diff --git a/Source/Core/cancelAnimationFrame.js b/Source/Core/cancelAnimationFrame.js index fdfdab4883f7..c0b1cfd58883 100644 --- a/Source/Core/cancelAnimationFrame.js +++ b/Source/Core/cancelAnimationFrame.js @@ -29,7 +29,7 @@ if (typeof cancelAnimationFrame !== "undefined") { /** * A browser-independent function to cancel an animation frame requested using {@link requestAnimationFrame}. * - * @exports cancelAnimationFrame + * @function cancelAnimationFrame * * @param {Number} requestID The value returned by {@link requestAnimationFrame}. * diff --git a/Source/Core/clone.js b/Source/Core/clone.js index 589e026d2a4c..98ae5f2809d5 100644 --- a/Source/Core/clone.js +++ b/Source/Core/clone.js @@ -3,7 +3,7 @@ import defaultValue from "./defaultValue.js"; /** * Clones an object, returning a new object containing the same properties. * - * @exports clone + * @function * * @param {Object} object The object to clone. * @param {Boolean} [deep=false] If true, all properties will be deep cloned recursively. diff --git a/Source/Core/combine.js b/Source/Core/combine.js index 4c589c03ac34..c238e11e226f 100644 --- a/Source/Core/combine.js +++ b/Source/Core/combine.js @@ -30,7 +30,7 @@ import defined from "./defined.js"; * @param {Boolean} [deep=false] Perform a recursive merge. * @returns {Object} The combined object containing all properties from both objects. * - * @exports combine + * @function */ function combine(object1, object2, deep) { deep = defaultValue(deep, false); diff --git a/Source/Core/createGuid.js b/Source/Core/createGuid.js index d141e7df4fb6..882eef2e2950 100644 --- a/Source/Core/createGuid.js +++ b/Source/Core/createGuid.js @@ -1,7 +1,7 @@ /** * Creates a Globally unique identifier (GUID) string. A GUID is 128 bits long, and can guarantee uniqueness across space and time. * - * @exports createGuid + * @function * * @returns {String} * diff --git a/Source/Core/createWorldTerrain.js b/Source/Core/createWorldTerrain.js index a2e7f4572bd4..7b4eccaa20ae 100644 --- a/Source/Core/createWorldTerrain.js +++ b/Source/Core/createWorldTerrain.js @@ -5,7 +5,7 @@ import IonResource from "./IonResource.js"; /** * Creates a {@link CesiumTerrainProvider} instance for the {@link https://cesium.com/content/#cesium-world-terrain|Cesium World Terrain}. * - * @exports createWorldTerrain + * @function * * @param {Object} [options] Object with the following properties: * @param {Boolean} [options.requestVertexNormals=false] Flag that indicates if the client should request additional lighting information from the server if available. diff --git a/Source/Core/defaultValue.js b/Source/Core/defaultValue.js index ad5a279b0658..9a52e51ecfb6 100644 --- a/Source/Core/defaultValue.js +++ b/Source/Core/defaultValue.js @@ -2,7 +2,7 @@ * Returns the first parameter if not undefined, otherwise the second parameter. * Useful for setting a default value for a parameter. * - * @exports defaultValue + * @function * * @param {*} a * @param {*} b @@ -22,6 +22,8 @@ function defaultValue(a, b) { * A frozen empty object that can be used as the default value for options passed as * an object literal. * @type {Object} + * @memberof defaultValue */ defaultValue.EMPTY_OBJECT = Object.freeze({}); + export default defaultValue; diff --git a/Source/Core/defined.js b/Source/Core/defined.js index 837d212e5488..d9125ecd06b0 100644 --- a/Source/Core/defined.js +++ b/Source/Core/defined.js @@ -1,5 +1,5 @@ /** - * @exports defined + * @function * * @param {*} value The object. * @returns {Boolean} Returns true if the object is defined, returns false otherwise. diff --git a/Source/Core/deprecationWarning.js b/Source/Core/deprecationWarning.js index 77efbe1f1d4e..6e762389326f 100644 --- a/Source/Core/deprecationWarning.js +++ b/Source/Core/deprecationWarning.js @@ -7,7 +7,7 @@ import oneTimeWarning from "./oneTimeWarning.js"; * console.log directly since this does not log duplicate messages * unless it is called from multiple workers. * - * @exports deprecationWarning + * @function deprecationWarning * * @param {String} identifier The unique identifier for this deprecated API. * @param {String} message The message to log to the console. diff --git a/Source/Core/destroyObject.js b/Source/Core/destroyObject.js index 8e3f631be348..6a73f626eec8 100644 --- a/Source/Core/destroyObject.js +++ b/Source/Core/destroyObject.js @@ -16,7 +16,7 @@ function returnTrue() { * which then releases the native resource and calls destroyObject to put itself * in a destroyed state. * - * @exports destroyObject + * @function * * @param {Object} object The object to destroy. * @param {String} [message] The message to include in the exception that is thrown if diff --git a/Source/Core/formatError.js b/Source/Core/formatError.js index 9593effbc986..02c2c532be6f 100644 --- a/Source/Core/formatError.js +++ b/Source/Core/formatError.js @@ -4,7 +4,7 @@ import defined from "./defined.js"; * Formats an error object into a String. If available, uses name, message, and stack * properties, otherwise, falls back on toString(). * - * @exports formatError + * @function * * @param {*} object The item to find in the array. * @returns {String} A string containing the formatted error. diff --git a/Source/Core/getAbsoluteUri.js b/Source/Core/getAbsoluteUri.js index 7a0b3c747bf3..fa10178da021 100644 --- a/Source/Core/getAbsoluteUri.js +++ b/Source/Core/getAbsoluteUri.js @@ -5,7 +5,7 @@ import DeveloperError from "./DeveloperError.js"; /** * Given a relative Uri and a base Uri, returns the absolute Uri of the relative Uri. - * @exports getAbsoluteUri + * @function * * @param {String} relative The relative Uri. * @param {String} [base] The base Uri. diff --git a/Source/Core/getBaseUri.js b/Source/Core/getBaseUri.js index 9a50b773c32d..a12482eff87a 100644 --- a/Source/Core/getBaseUri.js +++ b/Source/Core/getBaseUri.js @@ -4,7 +4,7 @@ import DeveloperError from "./DeveloperError.js"; /** * Given a URI, returns the base path of the URI. - * @exports getBaseUri + * @function * * @param {String} uri The Uri. * @param {Boolean} [includeQuery = false] Whether or not to include the query string and fragment form the uri diff --git a/Source/Core/getExtensionFromUri.js b/Source/Core/getExtensionFromUri.js index e961fcd7dfb5..084443c6da38 100644 --- a/Source/Core/getExtensionFromUri.js +++ b/Source/Core/getExtensionFromUri.js @@ -4,7 +4,7 @@ import DeveloperError from "./DeveloperError.js"; /** * Given a URI, returns the extension of the URI. - * @exports getExtensionFromUri + * @function getExtensionFromUri * * @param {String} uri The Uri. * @returns {String} The extension of the Uri. diff --git a/Source/Core/getFilenameFromUri.js b/Source/Core/getFilenameFromUri.js index 20b6f7fd6385..4bb4f6372c18 100644 --- a/Source/Core/getFilenameFromUri.js +++ b/Source/Core/getFilenameFromUri.js @@ -4,7 +4,7 @@ import DeveloperError from "./DeveloperError.js"; /** * Given a URI, returns the last segment of the URI, removing any path or query information. - * @exports getFilenameFromUri + * @function getFilenameFromUri * * @param {String} uri The Uri. * @returns {String} The last segment of the Uri. diff --git a/Source/Core/getImagePixels.js b/Source/Core/getImagePixels.js index 69476755a46d..d6a8044e9c6b 100644 --- a/Source/Core/getImagePixels.js +++ b/Source/Core/getImagePixels.js @@ -6,12 +6,12 @@ var context2DsByWidthAndHeight = {}; * Extract a pixel array from a loaded image. Draws the image * into a canvas so it can read the pixels back. * - * @exports getImagePixels + * @function getImagePixels * - * @param {Image} image The image to extract pixels from. + * @param {HTMLImageElement} image The image to extract pixels from. * @param {Number} width The width of the image. If not defined, then image.width is assigned. * @param {Number} height The height of the image. If not defined, then image.height is assigned. - * @returns {CanvasPixelArray} The pixels of the image. + * @returns {ImageData} The pixels of the image. */ function getImagePixels(image, width, height) { if (!defined(width)) { diff --git a/Source/Core/getTimestamp.js b/Source/Core/getTimestamp.js index b75cbcac3523..664c39aa26c2 100644 --- a/Source/Core/getTimestamp.js +++ b/Source/Core/getTimestamp.js @@ -4,7 +4,7 @@ * measured from. This function uses performance.now() if it is available, or Date.now() * otherwise. * - * @exports getTimestamp + * @function getTimestamp * * @returns {Number} The timestamp in milliseconds since some unspecified reference time. */ diff --git a/Source/Core/isBlobUri.js b/Source/Core/isBlobUri.js index 96ac059334ef..513e448fefdb 100644 --- a/Source/Core/isBlobUri.js +++ b/Source/Core/isBlobUri.js @@ -5,7 +5,7 @@ var blobUriRegex = /^blob:/i; /** * Determines if the specified uri is a blob uri. * - * @exports isBlobUri + * @function isBlobUri * * @param {String} uri The uri to test. * @returns {Boolean} true when the uri is a blob uri; otherwise, false. diff --git a/Source/Core/isDataUri.js b/Source/Core/isDataUri.js index 12c36d108a6d..a32ad5dcef6d 100644 --- a/Source/Core/isDataUri.js +++ b/Source/Core/isDataUri.js @@ -5,7 +5,7 @@ var dataUriRegex = /^data:/i; /** * Determines if the specified uri is a data uri. * - * @exports isDataUri + * @function isDataUri * * @param {String} uri The uri to test. * @returns {Boolean} true when the uri is a data uri; otherwise, false. diff --git a/Source/Core/isLeapYear.js b/Source/Core/isLeapYear.js index 3e180bcafab8..84380496dd7d 100644 --- a/Source/Core/isLeapYear.js +++ b/Source/Core/isLeapYear.js @@ -3,7 +3,7 @@ import DeveloperError from "./DeveloperError.js"; /** * Determines if a given date is a leap year. * - * @exports isLeapYear + * @function isLeapYear * * @param {Number} year The year to be tested. * @returns {Boolean} True if year is a leap year. diff --git a/Source/Core/loadCRN.js b/Source/Core/loadCRN.js index 68b659c2833c..c7676364cc13 100644 --- a/Source/Core/loadCRN.js +++ b/Source/Core/loadCRN.js @@ -17,7 +17,7 @@ var transcodeTaskProcessor = new TaskProcessor( * using XMLHttpRequest, which means that in order to make requests to another origin, * the server must have Cross-Origin Resource Sharing (CORS) headers enabled. * - * @exports loadCRN + * @function loadCRN * * @param {Resource|String|ArrayBuffer} resourceOrUrlOrBuffer The URL of the binary data or an ArrayBuffer. * @returns {Promise.|undefined} A promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. diff --git a/Source/Core/loadKTX.js b/Source/Core/loadKTX.js index 48e9ef10c288..6fdab8ae14ec 100644 --- a/Source/Core/loadKTX.js +++ b/Source/Core/loadKTX.js @@ -25,7 +25,7 @@ import WebGLConstants from "./WebGLConstants.js"; * *

* - * @exports loadKTX + * @function loadKTX * * @param {Resource|String|ArrayBuffer} resourceOrUrlOrBuffer The URL of the binary data or an ArrayBuffer. * @returns {Promise.|undefined} A promise that will resolve to the requested data when loaded. Returns undefined if request.throttle is true and the request does not have high enough priority. diff --git a/Source/Core/mergeSort.js b/Source/Core/mergeSort.js index 1b1d2341c95a..ffe0b095b420 100644 --- a/Source/Core/mergeSort.js +++ b/Source/Core/mergeSort.js @@ -55,9 +55,9 @@ function sort(array, compare, userDefinedObject, start, end) { /** * A stable merge sort. * - * @exports mergeSort + * @function mergeSort * @param {Array} array The array to sort. - * @param {mergeSort~Comparator} comparator The function to use to compare elements in the array. + * @param {mergeSortComparator} comparator The function to use to compare elements in the array. * @param {*} [userDefinedObject] Any item to pass as the third parameter to comparator. * * @example @@ -94,7 +94,7 @@ function mergeSort(array, comparator, userDefinedObject) { /** * A function used to compare two items while performing a merge sort. - * @callback mergeSort~Comparator + * @callback mergeSortComparator * * @param {*} a An item in the array. * @param {*} b An item in the array. diff --git a/Source/Core/objectToQuery.js b/Source/Core/objectToQuery.js index 598d05242b6e..85ea4fe51261 100644 --- a/Source/Core/objectToQuery.js +++ b/Source/Core/objectToQuery.js @@ -5,7 +5,7 @@ import DeveloperError from "./DeveloperError.js"; * Converts an object representing a set of name/value pairs into a query string, * with names and values encoded properly for use in a URL. Values that are arrays * will produce multiple values with the same name. - * @exports objectToQuery + * @function objectToQuery * * @param {Object} obj The object containing data to encode. * @returns {String} An encoded query string. diff --git a/Source/Core/oneTimeWarning.js b/Source/Core/oneTimeWarning.js index 11f0a043f935..849604bf1eab 100644 --- a/Source/Core/oneTimeWarning.js +++ b/Source/Core/oneTimeWarning.js @@ -9,7 +9,7 @@ var warnings = {}; * console.log directly since this does not log duplicate messages * unless it is called from multiple workers. * - * @exports oneTimeWarning + * @function oneTimeWarning * * @param {String} identifier The unique identifier for this warning. * @param {String} [message=identifier] The message to log to the console. diff --git a/Source/Core/parseResponseHeaders.js b/Source/Core/parseResponseHeaders.js index 5a2f30dd9a60..d6501c19200f 100644 --- a/Source/Core/parseResponseHeaders.js +++ b/Source/Core/parseResponseHeaders.js @@ -2,7 +2,7 @@ * Parses the result of XMLHttpRequest's getAllResponseHeaders() method into * a dictionary. * - * @exports parseResponseHeaders + * @function parseResponseHeaders * * @param {String} headerString The header string returned by getAllResponseHeaders(). The format is * described here: http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders()-method diff --git a/Source/Core/pointInsideTriangle.js b/Source/Core/pointInsideTriangle.js index 19cf0608f9f4..ca4f55b87356 100644 --- a/Source/Core/pointInsideTriangle.js +++ b/Source/Core/pointInsideTriangle.js @@ -6,7 +6,7 @@ var coords = new Cartesian3(); /** * Determines if a point is inside a triangle. * - * @exports pointInsideTriangle + * @function pointInsideTriangle * * @param {Cartesian2|Cartesian3} point The point to test. * @param {Cartesian2|Cartesian3} p0 The first point of the triangle. diff --git a/Source/Core/queryToObject.js b/Source/Core/queryToObject.js index 7668c63dbeb4..bc36e569ae18 100644 --- a/Source/Core/queryToObject.js +++ b/Source/Core/queryToObject.js @@ -5,7 +5,7 @@ import DeveloperError from "./DeveloperError.js"; * Parses a query string into an object, where the keys and values of the object are the * name/value pairs from the query string, decoded. If a name appears multiple times, * the value in the object will be an array of values. - * @exports queryToObject + * @function queryToObject * * @param {String} queryString The query string. * @returns {Object} An object containing the parameters parsed from the query string. diff --git a/Source/Core/requestAnimationFrame.js b/Source/Core/requestAnimationFrame.js index 3c4db07f3ed9..e0fb02d9cb80 100644 --- a/Source/Core/requestAnimationFrame.js +++ b/Source/Core/requestAnimationFrame.js @@ -41,9 +41,9 @@ if (typeof requestAnimationFrame !== "undefined") { * A browser-independent function to request a new animation frame. This is used to create * an application's draw loop as shown in the example below. * - * @exports requestAnimationFrame + * @function requestAnimationFrame * - * @param {requestAnimationFrame~Callback} callback The function to call when the next frame should be drawn. + * @param {requestAnimationFrameCallback} callback The function to call when the next frame should be drawn. * @returns {Number} An ID that can be passed to {@link cancelAnimationFrame} to cancel the request. * * @@ -67,7 +67,7 @@ function requestAnimationFramePolyFill(callback) { /** * A function that will be called when the next frame should be drawn. - * @callback requestAnimationFrame~Callback + * @callback requestAnimationFrameCallback * * @param {Number} timestamp A timestamp for the frame, in milliseconds. */ diff --git a/Source/Core/sampleTerrain.js b/Source/Core/sampleTerrain.js index 8696e1e34ed1..93f2f6f3407c 100644 --- a/Source/Core/sampleTerrain.js +++ b/Source/Core/sampleTerrain.js @@ -15,7 +15,7 @@ import Check from "./Check.js"; * terrain level of detail as input, if you need to get the altitude of the terrain as precisely * as possible (i.e. with maximum level of detail) use {@link sampleTerrainMostDetailed}. * - * @exports sampleTerrain + * @function sampleTerrain * * @param {TerrainProvider} terrainProvider The terrain provider from which to query heights. * @param {Number} level The terrain level-of-detail from which to query terrain heights. diff --git a/Source/Core/sampleTerrainMostDetailed.js b/Source/Core/sampleTerrainMostDetailed.js index f899cbb870d1..21a598632a0e 100644 --- a/Source/Core/sampleTerrainMostDetailed.js +++ b/Source/Core/sampleTerrainMostDetailed.js @@ -9,7 +9,7 @@ var scratchCartesian2 = new Cartesian2(); /** * Initiates a sampleTerrain() request at the maximum available tile level for a terrain dataset. * - * @exports sampleTerrainMostDetailed + * @function sampleTerrainMostDetailed * * @param {TerrainProvider} terrainProvider The terrain provider from which to query heights. * @param {Cartographic[]} positions The positions to update with terrain heights. diff --git a/Source/Core/scaleToGeodeticSurface.js b/Source/Core/scaleToGeodeticSurface.js index 563d651cb392..04beab4efdc4 100644 --- a/Source/Core/scaleToGeodeticSurface.js +++ b/Source/Core/scaleToGeodeticSurface.js @@ -18,7 +18,7 @@ var scaleToGeodeticSurfaceGradient = new Cartesian3(); * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3} The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center. * - * @exports scaleToGeodeticSurface + * @function scaleToGeodeticSurface * * @private */ diff --git a/Source/Core/subdivideArray.js b/Source/Core/subdivideArray.js index 5697a7119afd..a4eed785084c 100644 --- a/Source/Core/subdivideArray.js +++ b/Source/Core/subdivideArray.js @@ -4,7 +4,7 @@ import DeveloperError from "./DeveloperError.js"; /** * Subdivides an array into a number of smaller, equal sized arrays. * - * @exports subdivideArray + * @function subdivideArray * * @param {Array} array The array to divide. * @param {Number} numberOfArrays The number of arrays to divide the provided array into. diff --git a/Source/Core/writeTextToCanvas.js b/Source/Core/writeTextToCanvas.js index 6e13eaac6b70..6c1a8544d1c8 100644 --- a/Source/Core/writeTextToCanvas.js +++ b/Source/Core/writeTextToCanvas.js @@ -21,10 +21,10 @@ var imageSmoothingEnabledName; * @param {Number} [options.strokeWidth=1] The stroke width. * @param {Color} [options.backgroundColor=Color.TRANSPARENT] The background color of the canvas. * @param {Number} [options.padding=0] The pixel size of the padding to add around the text. - * @returns {Canvas} A new canvas with the given text drawn into it. The dimensions object + * @returns {HTMLCanvasElement} A new canvas with the given text drawn into it. The dimensions object * from measureText will also be added to the returned canvas. If text is * blank, returns undefined. - * @exports writeTextToCanvas + * @function writeTextToCanvas */ function writeTextToCanvas(text, options) { //>>includeStart('debug', pragmas.debug); diff --git a/Source/DataSources/BillboardGraphics.js b/Source/DataSources/BillboardGraphics.js index 09ba9cd20611..fe5144eb4944 100644 --- a/Source/DataSources/BillboardGraphics.js +++ b/Source/DataSources/BillboardGraphics.js @@ -4,6 +4,33 @@ import DeveloperError from "../Core/DeveloperError.js"; import Event from "../Core/Event.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} BillboardGraphics.ConstructorOptions + * + * Initialization options for the BillboardGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the billboard. + * @property {Property | string | HTMLCanvasElement} [image] A Property specifying the Image, URI, or Canvas to use for the billboard. + * @property {Property | number} [scale=1.0] A numeric Property specifying the scale to apply to the image size. + * @property {Property | Cartesian2} [pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} Property specifying the pixel offset. + * @property {Property | Cartesian3} [eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the eye offset. + * @property {Property | HorizontalOrigin} [horizontalOrigin=HorizontalOrigin.CENTER] A Property specifying the {@link HorizontalOrigin}. + * @property {Property | VerticalOrigin} [verticalOrigin=VerticalOrigin.CENTER] A Property specifying the {@link VerticalOrigin}. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to. + * @property {Property | Color} [color=Color.WHITE] A Property specifying the tint {@link Color} of the image. + * @property {Property | number} [rotation=0] A numeric Property specifying the rotation about the alignedAxis. + * @property {Property | Cartesian3} [alignedAxis=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the unit vector axis of rotation. + * @property {Property | boolean} [sizeInMeters] A boolean Property specifying whether this billboard's size should be measured in meters. + * @property {Property | number} [width] A numeric Property specifying the width of the billboard in pixels, overriding the native size. + * @property {Property | number} [height] A numeric Property specifying the height of the billboard in pixels, overriding the native size. + * @property {Property | NearFarScalar} [scaleByDistance] A {@link NearFarScalar} Property used to scale the point based on distance from the camera. + * @property {Property | NearFarScalar} [translucencyByDistance] A {@link NearFarScalar} Property used to set translucency based on distance from the camera. + * @property {Property | NearFarScalar} [pixelOffsetScaleByDistance] A {@link NearFarScalar} Property used to set pixelOffset based on distance from the camera. + * @property {Property | BoundingRectangle} [imageSubRegion] A Property specifying a {@link BoundingRectangle} that defines a sub-region of the image to use for the billboard, rather than the entire image, measured in pixels from the bottom-left. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this billboard will be displayed. + * @property {Property | number} [disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to. + */ + /** * Describes a two dimensional icon located at the position of the containing {@link Entity}. *

@@ -16,27 +43,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias BillboardGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the billboard. - * @param {Property} [options.image] A Property specifying the Image, URI, or Canvas to use for the billboard. - * @param {Property} [options.scale=1.0] A numeric Property specifying the scale to apply to the image size. - * @param {Property} [options.pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} Property specifying the pixel offset. - * @param {Property} [options.eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the eye offset. - * @param {Property} [options.horizontalOrigin=HorizontalOrigin.CENTER] A Property specifying the {@link HorizontalOrigin}. - * @param {Property} [options.verticalOrigin=VerticalOrigin.CENTER] A Property specifying the {@link VerticalOrigin}. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to. - * @param {Property} [options.color=Color.WHITE] A Property specifying the tint {@link Color} of the image. - * @param {Property} [options.rotation=0] A numeric Property specifying the rotation about the alignedAxis. - * @param {Property} [options.alignedAxis=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the unit vector axis of rotation. - * @param {Property} [options.sizeInMeters] A boolean Property specifying whether this billboard's size should be measured in meters. - * @param {Property} [options.width] A numeric Property specifying the width of the billboard in pixels, overriding the native size. - * @param {Property} [options.height] A numeric Property specifying the height of the billboard in pixels, overriding the native size. - * @param {Property} [options.scaleByDistance] A {@link NearFarScalar} Property used to scale the point based on distance from the camera. - * @param {Property} [options.translucencyByDistance] A {@link NearFarScalar} Property used to set translucency based on distance from the camera. - * @param {Property} [options.pixelOffsetScaleByDistance] A {@link NearFarScalar} Property used to set pixelOffset based on distance from the camera. - * @param {Property} [options.imageSubRegion] A Property specifying a {@link BoundingRectangle} that defines a sub-region of the image to use for the billboard, rather than the entire image, measured in pixels from the bottom-left. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this billboard will be displayed. - * @param {Property} [options.disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to. + * @param {BillboardGraphics.ConstructorOptions} [options] Object describing initialization options * * @demo {@link https://sandcastle.cesium.com/index.html?src=Billboards.html|Cesium Sandcastle Billboard Demo} */ @@ -103,7 +110,7 @@ Object.defineProperties(BillboardGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the billboard. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -111,7 +118,7 @@ Object.defineProperties(BillboardGraphics.prototype, { /** * Gets or sets the Property specifying the Image, URI, or Canvas to use for the billboard. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ image: createPropertyDescriptor("image"), @@ -125,7 +132,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * *

* @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ scale: createPropertyDescriptor("scale"), @@ -145,7 +152,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * *

* @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Cartesian2.ZERO */ pixelOffset: createPropertyDescriptor("pixelOffset"), @@ -170,7 +177,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * *

* @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Cartesian3.ZERO */ eyeOffset: createPropertyDescriptor("eyeOffset"), @@ -178,7 +185,7 @@ Object.defineProperties(BillboardGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HorizontalOrigin}. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HorizontalOrigin.CENTER */ horizontalOrigin: createPropertyDescriptor("horizontalOrigin"), @@ -186,7 +193,7 @@ Object.defineProperties(BillboardGraphics.prototype, { /** * Gets or sets the Property specifying the {@link VerticalOrigin}. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default VerticalOrigin.CENTER */ verticalOrigin: createPropertyDescriptor("verticalOrigin"), @@ -194,7 +201,7 @@ Object.defineProperties(BillboardGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -214,7 +221,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * *

* @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.WHITE */ color: createPropertyDescriptor("color"), @@ -223,7 +230,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * Gets or sets the numeric Property specifying the rotation of the image * counter clockwise from the alignedAxis. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0 */ rotation: createPropertyDescriptor("rotation"), @@ -232,7 +239,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * Gets or sets the {@link Cartesian3} Property specifying the unit vector axis of rotation * in the fixed frame. When set to Cartesian3.ZERO the rotation is from the top of the screen. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Cartesian3.ZERO */ alignedAxis: createPropertyDescriptor("alignedAxis"), @@ -240,7 +247,7 @@ Object.defineProperties(BillboardGraphics.prototype, { /** * Gets or sets the boolean Property specifying if this billboard's size will be measured in meters. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ sizeInMeters: createPropertyDescriptor("sizeInMeters"), @@ -249,7 +256,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * Gets or sets the numeric Property specifying the width of the billboard in pixels. * When undefined, the native width is used. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ width: createPropertyDescriptor("width"), @@ -257,40 +264,40 @@ Object.defineProperties(BillboardGraphics.prototype, { * Gets or sets the numeric Property specifying the height of the billboard in pixels. * When undefined, the native height is used. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ height: createPropertyDescriptor("height"), /** * Gets or sets {@link NearFarScalar} Property specifying the scale of the billboard based on the distance from the camera. * A billboard's scale will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the billboard's scale remains clamped to the nearest bound. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ scaleByDistance: createPropertyDescriptor("scaleByDistance"), /** * Gets or sets {@link NearFarScalar} Property specifying the translucency of the billboard based on the distance from the camera. * A billboard's translucency will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the billboard's translucency remains clamped to the nearest bound. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ translucencyByDistance: createPropertyDescriptor("translucencyByDistance"), /** * Gets or sets {@link NearFarScalar} Property specifying the pixel offset of the billboard based on the distance from the camera. * A billboard's pixel offset will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the billboard's pixel offset remains clamped to the nearest bound. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ pixelOffsetScaleByDistance: createPropertyDescriptor( "pixelOffsetScaleByDistance" @@ -301,14 +308,14 @@ Object.defineProperties(BillboardGraphics.prototype, { * sub-region of the image to use for the billboard, rather than the entire image, * measured in pixels from the bottom-left. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ imageSubRegion: createPropertyDescriptor("imageSubRegion"), /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this billboard will be displayed. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" @@ -318,7 +325,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * Gets or sets the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain. * When set to zero, the depth test is always applied. When set to Number.POSITIVE_INFINITY, the depth test is never applied. * @memberof BillboardGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ disableDepthTestDistance: createPropertyDescriptor( "disableDepthTestDistance" diff --git a/Source/DataSources/BoundingSphereState.js b/Source/DataSources/BoundingSphereState.js index 59eac59561ee..f16ac0be0793 100644 --- a/Source/DataSources/BoundingSphereState.js +++ b/Source/DataSources/BoundingSphereState.js @@ -1,6 +1,6 @@ /** * The state of a BoundingSphere computation being performed by a {@link Visualizer}. - * @exports BoundingSphereState + * @enum {Number} * @private */ var BoundingSphereState = { diff --git a/Source/DataSources/BoxGeometryUpdater.js b/Source/DataSources/BoxGeometryUpdater.js index b9a16b1a83f9..fa45b4d15fc0 100644 --- a/Source/DataSources/BoxGeometryUpdater.js +++ b/Source/DataSources/BoxGeometryUpdater.js @@ -66,6 +66,7 @@ Object.defineProperties(BoxGeometryUpdater.prototype, { * @type {TerrainOffsetProperty} * @memberof BoxGeometryUpdater.prototype * @readonly + * @private */ terrainOffsetProperty: { get: function () { diff --git a/Source/DataSources/BoxGraphics.js b/Source/DataSources/BoxGraphics.js index 981782d7d6fa..c0de6ca10660 100644 --- a/Source/DataSources/BoxGraphics.js +++ b/Source/DataSources/BoxGraphics.js @@ -5,23 +5,31 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} BoxGraphics.ConstructorOptions + * + * Initialization options for the BoxGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the box. + * @property {Property | Cartesian3} [dimensions] A {@link Cartesian3} Property specifying the length, width, and height of the box. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height from the entity position is relative to. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the box is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the box. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the box is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the box casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this box will be displayed. + * + */ + /** * Describes a box. The center position and orientation are determined by the containing {@link Entity}. * * @alias BoxGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the box. - * @param {Property} [options.dimensions] A {@link Cartesian3} Property specifying the length, width, and height of the box. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height from the entity position is relative to. - * @param {Property} [options.fill=true] A boolean Property specifying whether the box is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the box. - * @param {Property} [options.outline=false] A boolean Property specifying whether the box is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the box casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this box will be displayed. + * @param {BoxGraphics.ConstructorOptions} [options] Object describing initialization options * * @demo {@link https://sandcastle.cesium.com/index.html?src=Box.html|Cesium Sandcastle Box Demo} */ @@ -67,7 +75,7 @@ Object.defineProperties(BoxGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the box. * @memberof BoxGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -75,14 +83,14 @@ Object.defineProperties(BoxGraphics.prototype, { /** * Gets or sets {@link Cartesian3} Property property specifying the length, width, and height of the box. * @memberof BoxGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ dimensions: createPropertyDescriptor("dimensions"), /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof BoxGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -90,7 +98,7 @@ Object.defineProperties(BoxGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the box is filled with the provided material. * @memberof BoxGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -98,7 +106,7 @@ Object.defineProperties(BoxGraphics.prototype, { /** * Gets or sets the material used to fill the box. * @memberof BoxGraphics.prototype - * @type {MaterialProperty} + * @type {MaterialProperty|undefined} * @default Color.WHITE */ material: createMaterialPropertyDescriptor("material"), @@ -106,7 +114,7 @@ Object.defineProperties(BoxGraphics.prototype, { /** * Gets or sets the Property specifying whether the box is outlined. * @memberof BoxGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -114,7 +122,7 @@ Object.defineProperties(BoxGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof BoxGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -122,7 +130,7 @@ Object.defineProperties(BoxGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof BoxGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -131,7 +139,7 @@ Object.defineProperties(BoxGraphics.prototype, { * Get or sets the enum Property specifying whether the box * casts or receives shadows from light sources. * @memberof BoxGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -139,7 +147,7 @@ Object.defineProperties(BoxGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this box will be displayed. * @memberof BoxGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" diff --git a/Source/DataSources/CallbackProperty.js b/Source/DataSources/CallbackProperty.js index dd06f384b2db..e353d092bcba 100644 --- a/Source/DataSources/CallbackProperty.js +++ b/Source/DataSources/CallbackProperty.js @@ -8,7 +8,7 @@ import Event from "../Core/Event.js"; * @alias CallbackProperty * @constructor * - * @param {CallbackProperty~Callback} callback The function to be called when the property is evaluated. + * @param {CallbackProperty.Callback} callback The function to be called when the property is evaluated. * @param {Boolean} isConstant true when the callback function returns the same value every time, false if the value will change. */ function CallbackProperty(callback, isConstant) { @@ -60,7 +60,7 @@ CallbackProperty.prototype.getValue = function (time, result) { /** * Sets the callback to be used. * - * @param {CallbackProperty~Callback} callback The function to be called when the property is evaluated. + * @param {CallbackProperty.Callback} callback The function to be called when the property is evaluated. * @param {Boolean} isConstant true when the callback function returns the same value every time, false if the value will change. */ CallbackProperty.prototype.setCallback = function (callback, isConstant) { @@ -101,7 +101,7 @@ CallbackProperty.prototype.equals = function (other) { /** * A function that returns the value of the property. - * @callback CallbackProperty~Callback + * @callback CallbackProperty.Callback * * @param {JulianDate} [time] The time for which to retrieve the value. * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned. diff --git a/Source/DataSources/Cesium3DTilesetGraphics.js b/Source/DataSources/Cesium3DTilesetGraphics.js index 9a76ece06a0e..3caf31975b3f 100644 --- a/Source/DataSources/Cesium3DTilesetGraphics.js +++ b/Source/DataSources/Cesium3DTilesetGraphics.js @@ -4,6 +4,16 @@ import DeveloperError from "../Core/DeveloperError.js"; import Event from "../Core/Event.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} Cesium3DTilesetGraphics.ConstructorOptions + * + * Initialization options for the Cesium3DTilesetGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the tileset. + * @property {Property | string | Resource} [uri] A string or Resource Property specifying the URI of the tileset. + * @property {Property | number} [maximumScreenSpaceError] A number or Property specifying the maximum screen space error used to drive level of detail refinement. + */ + /** * A 3D Tiles tileset represented by an {@link Entity}. * The tileset modelMatrix is determined by the containing Entity position and orientation @@ -12,10 +22,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias Cesium3DTilesetGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the tileset. - * @param {Property} [options.uri] A string or Resource Property specifying the URI of the tileset. - * @param {Property} [options.maximumScreenSpaceError] A number or Property specifying the maximum screen space error used to drive level of detail refinement. + * @param {Cesium3DTilesetGraphics.ConstructorOptions} [options] Object describing initialization options */ function Cesium3DTilesetGraphics(options) { this._definitionChanged = new Event(); @@ -45,7 +52,7 @@ Object.defineProperties(Cesium3DTilesetGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the model. * @memberof Cesium3DTilesetGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -53,14 +60,14 @@ Object.defineProperties(Cesium3DTilesetGraphics.prototype, { /** * Gets or sets the string Property specifying the URI of the glTF asset. * @memberof Cesium3DTilesetGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ uri: createPropertyDescriptor("uri"), /** * Gets or sets the maximum screen space error used to drive level of detail refinement. * @memberof Cesium3DTilesetGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ maximumScreenSpaceError: createPropertyDescriptor("maximumScreenSpaceError"), }); diff --git a/Source/DataSources/CheckerboardMaterialProperty.js b/Source/DataSources/CheckerboardMaterialProperty.js index 59fcc1ef716f..b4766ec6b3d9 100644 --- a/Source/DataSources/CheckerboardMaterialProperty.js +++ b/Source/DataSources/CheckerboardMaterialProperty.js @@ -16,9 +16,9 @@ var defaultRepeat = new Cartesian2(2.0, 2.0); * @constructor * * @param {Object} [options] Object with the following properties: - * @param {Property} [options.evenColor=Color.WHITE] A Property specifying the first {@link Color}. - * @param {Property} [options.oddColor=Color.BLACK] A Property specifying the second {@link Color}. - * @param {Property} [options.repeat=new Cartesian2(2.0, 2.0)] A {@link Cartesian2} Property specifying how many times the tiles repeat in each direction. + * @param {Property|Color} [options.evenColor=Color.WHITE] A Property specifying the first {@link Color}. + * @param {Property|Color} [options.oddColor=Color.BLACK] A Property specifying the second {@link Color}. + * @param {Property|Cartesian2} [options.repeat=new Cartesian2(2.0, 2.0)] A {@link Cartesian2} Property specifying how many times the tiles repeat in each direction. */ function CheckerboardMaterialProperty(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -73,7 +73,7 @@ Object.defineProperties(CheckerboardMaterialProperty.prototype, { /** * Gets or sets the Property specifying the first {@link Color}. * @memberof CheckerboardMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.WHITE */ evenColor: createPropertyDescriptor("evenColor"), @@ -81,7 +81,7 @@ Object.defineProperties(CheckerboardMaterialProperty.prototype, { /** * Gets or sets the Property specifying the second {@link Color}. * @memberof CheckerboardMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ oddColor: createPropertyDescriptor("oddColor"), @@ -89,7 +89,7 @@ Object.defineProperties(CheckerboardMaterialProperty.prototype, { /** * Gets or sets the {@link Cartesian2} Property specifying how many times the tiles repeat in each direction. * @memberof CheckerboardMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default new Cartesian2(2.0, 2.0) */ repeat: createPropertyDescriptor("repeat"), diff --git a/Source/DataSources/ColorMaterialProperty.js b/Source/DataSources/ColorMaterialProperty.js index f5e99f4be3f5..f5e60c7dd5f9 100644 --- a/Source/DataSources/ColorMaterialProperty.js +++ b/Source/DataSources/ColorMaterialProperty.js @@ -7,7 +7,7 @@ import Property from "./Property.js"; /** * A {@link MaterialProperty} that maps to solid color {@link Material} uniforms. * - * @param {Property} [color=Color.WHITE] The {@link Color} Property to be used. + * @param {Property|Color} [color=Color.WHITE] The {@link Color} Property to be used. * * @alias ColorMaterialProperty * @constructor @@ -53,7 +53,7 @@ Object.defineProperties(ColorMaterialProperty.prototype, { /** * Gets or sets the {@link Color} {@link Property}. * @memberof ColorMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.WHITE */ color: createPropertyDescriptor("color"), diff --git a/Source/DataSources/CompositeEntityCollection.js b/Source/DataSources/CompositeEntityCollection.js index 6ee80559c008..369d578f2776 100644 --- a/Source/DataSources/CompositeEntityCollection.js +++ b/Source/DataSources/CompositeEntityCollection.js @@ -463,7 +463,7 @@ CompositeEntityCollection.prototype.computeAvailability = function () { * Gets an entity with the specified id. * * @param {String} id The id of the entity to retrieve. - * @returns {Entity} The entity with the provided id or undefined if the id did not exist in the collection. + * @returns {Entity|undefined} The entity with the provided id or undefined if the id did not exist in the collection. */ CompositeEntityCollection.prototype.getById = function (id) { return this._composite.getById(id); diff --git a/Source/DataSources/CorridorGraphics.js b/Source/DataSources/CorridorGraphics.js index bf529b5a75a8..eff199e367c2 100644 --- a/Source/DataSources/CorridorGraphics.js +++ b/Source/DataSources/CorridorGraphics.js @@ -5,6 +5,31 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} CorridorGraphics.ConstructorOptions + * + * Initialization options for the CorridorGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the corridor. + * @property {Property | Cartesian3} [positions] A Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor. + * @property {Property | number} [width] A numeric Property specifying the distance between the edges of the corridor. + * @property {Property | number} [height=0] A numeric Property specifying the altitude of the corridor relative to the ellipsoid surface. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to. + * @property {Property | number} [extrudedHeight] A numeric Property specifying the altitude of the corridor's extruded face relative to the ellipsoid surface. + * @property {Property | HeightReference} [extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to. + * @property {Property | CornerType} [cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners. + * @property {Property | number} [granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the corridor is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the corridor. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the corridor is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the corridor casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this corridor will be displayed. + * @property {Property | ClassificationType} [classificationType=ClassificationType.BOTH] An enum Property specifying whether this corridor will classify terrain, 3D Tiles, or both when on the ground. + * @property {ConstantProperty | number} [zIndex] A Property specifying the zIndex of the corridor, used for ordering. Only has an effect if height and extrudedHeight are undefined, and if the corridor is static. + */ + /** * Describes a corridor, which is a shape defined by a centerline and width that * conforms to the curvature of the globe. It can be placed on the surface or at altitude @@ -13,25 +38,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias CorridorGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the corridor. - * @param {Property} [options.positions] A Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor. - * @param {Property} [options.width] A numeric Property specifying the distance between the edges of the corridor. - * @param {Property} [options.height=0] A numeric Property specifying the altitude of the corridor relative to the ellipsoid surface. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to. - * @param {Property} [options.extrudedHeight] A numeric Property specifying the altitude of the corridor's extruded face relative to the ellipsoid surface. - * @param {Property} [options.extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to. - * @param {Property} [options.cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners. - * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude. - * @param {Property} [options.fill=true] A boolean Property specifying whether the corridor is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the corridor. - * @param {Property} [options.outline=false] A boolean Property specifying whether the corridor is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the corridor casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this corridor will be displayed. - * @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this corridor will classify terrain, 3D Tiles, or both when on the ground. - * @param {ConstantProperty} [options.zIndex] A Property specifying the zIndex of the corridor, used for ordering. Only has an effect if height and extrudedHeight are undefined, and if the corridor is static. + * @param {CorridorGraphics.ConstructorOptions} [options] Object describing initialization options * * @see Entity * @demo {@link https://sandcastle.cesium.com/index.html?src=Corridor.html|Cesium Sandcastle Corridor Demo} @@ -94,7 +101,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the corridor. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -102,21 +109,21 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets a Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ positions: createPropertyDescriptor("positions"), /** * Gets or sets the numeric Property specifying the width of the corridor. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ width: createPropertyDescriptor("width"), /** * Gets or sets the numeric Property specifying the altitude of the corridor. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.0 */ height: createPropertyDescriptor("height"), @@ -124,7 +131,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -134,14 +141,14 @@ Object.defineProperties(CorridorGraphics.prototype, { * Setting this property creates a corridor shaped volume starting at height and ending * at this altitude. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ extrudedHeight: createPropertyDescriptor("extrudedHeight"), /** * Gets or sets the Property specifying the extruded {@link HeightReference}. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ extrudedHeightReference: createPropertyDescriptor("extrudedHeightReference"), @@ -149,7 +156,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the {@link CornerType} Property specifying how corners are styled. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default CornerType.ROUNDED */ cornerType: createPropertyDescriptor("cornerType"), @@ -157,7 +164,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the numeric Property specifying the sampling distance between each latitude and longitude point. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default {CesiumMath.RADIANS_PER_DEGREE} */ granularity: createPropertyDescriptor("granularity"), @@ -165,7 +172,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the corridor is filled with the provided material. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -173,7 +180,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the Property specifying the material used to fill the corridor. * @memberof CorridorGraphics.prototype - * @type {MaterialProperty} + * @type {MaterialProperty|undefined} * @default Color.WHITE */ material: createMaterialPropertyDescriptor("material"), @@ -181,7 +188,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the Property specifying whether the corridor is outlined. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -189,7 +196,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -197,7 +204,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -206,7 +213,7 @@ Object.defineProperties(CorridorGraphics.prototype, { * Get or sets the enum Property specifying whether the corridor * casts or receives shadows from light sources. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -214,7 +221,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this corridor will be displayed. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" @@ -223,7 +230,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the {@link ClassificationType} Property specifying whether this corridor will classify terrain, 3D Tiles, or both when on the ground. * @memberof CorridorGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ClassificationType.BOTH */ classificationType: createPropertyDescriptor("classificationType"), @@ -231,7 +238,7 @@ Object.defineProperties(CorridorGraphics.prototype, { /** * Gets or sets the zIndex Property specifying the ordering of the corridor. Only has an effect if the coridor is static and neither height or exturdedHeight are specified. * @memberof CorridorGraphics.prototype - * @type {ConstantProperty} + * @type {ConstantProperty|undefined} * @default 0 */ zIndex: createPropertyDescriptor("zIndex"), diff --git a/Source/DataSources/CustomDataSource.js b/Source/DataSources/CustomDataSource.js index 0332bfd5866c..eb14891e200e 100644 --- a/Source/DataSources/CustomDataSource.js +++ b/Source/DataSources/CustomDataSource.js @@ -156,4 +156,18 @@ Object.defineProperties(CustomDataSource.prototype, { }, }, }); + +/** + * Updates the data source to the provided time. This function is optional and + * is not required to be implemented. It is provided for data sources which + * retrieve data based on the current animation time or scene state. + * If implemented, update will be called by {@link DataSourceDisplay} once a frame. + * + * @param {JulianDate} time The simulation time. + * @returns {Boolean} True if this data source is ready to be displayed at the provided time, false otherwise. + */ +CustomDataSource.prototype.update = function (time) { + return true; +}; + export default CustomDataSource; diff --git a/Source/DataSources/CylinderGeometryUpdater.js b/Source/DataSources/CylinderGeometryUpdater.js index bcfb95bb6ac0..17b2b0e29b85 100644 --- a/Source/DataSources/CylinderGeometryUpdater.js +++ b/Source/DataSources/CylinderGeometryUpdater.js @@ -75,6 +75,7 @@ Object.defineProperties(CylinderGeometryUpdater.prototype, { * @type {TerrainOffsetProperty} * @memberof CylinderGeometryUpdater.prototype * @readonly + * @private */ terrainOffsetProperty: { get: function () { diff --git a/Source/DataSources/CylinderGraphics.js b/Source/DataSources/CylinderGraphics.js index 0e9733b5ae8e..1f03e2a9931a 100644 --- a/Source/DataSources/CylinderGraphics.js +++ b/Source/DataSources/CylinderGraphics.js @@ -5,6 +5,27 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} CylinderGraphics.ConstructorOptions + * + * Initialization options for the CylinderGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the cylinder. + * @property {Property | number} [length] A numeric Property specifying the length of the cylinder. + * @property {Property | number} [topRadius] A numeric Property specifying the radius of the top of the cylinder. + * @property {Property | number} [bottomRadius] A numeric Property specifying the radius of the bottom of the cylinder. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height from the entity position is relative to. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the cylinder is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the cylinder. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the cylinder is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | number} [numberOfVerticalLines=16] A numeric Property specifying the number of vertical lines to draw along the perimeter for the outline. + * @property {Property | number} [slices=128] The number of edges around the perimeter of the cylinder. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the cylinder casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this cylinder will be displayed. + */ + /** * Describes a cylinder, truncated cone, or cone defined by a length, top radius, and bottom radius. * The center position and orientation are determined by the containing {@link Entity}. @@ -12,21 +33,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias CylinderGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the cylinder. - * @param {Property} [options.length] A numeric Property specifying the length of the cylinder. - * @param {Property} [options.topRadius] A numeric Property specifying the radius of the top of the cylinder. - * @param {Property} [options.bottomRadius] A numeric Property specifying the radius of the bottom of the cylinder. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height from the entity position is relative to. - * @param {Property} [options.fill=true] A boolean Property specifying whether the cylinder is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the cylinder. - * @param {Property} [options.outline=false] A boolean Property specifying whether the cylinder is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.numberOfVerticalLines=16] A numeric Property specifying the number of vertical lines to draw along the perimeter for the outline. - * @param {Property} [options.slices=128] The number of edges around the perimeter of the cylinder. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the cylinder casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this cylinder will be displayed. + * @param {CylinderGraphics.ConstructorOptions} [options] Object describing initialization options */ function CylinderGraphics(options) { this._definitionChanged = new Event(); @@ -79,7 +86,7 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the cylinder. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -87,28 +94,28 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the numeric Property specifying the length of the cylinder. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ length: createPropertyDescriptor("length"), /** * Gets or sets the numeric Property specifying the radius of the top of the cylinder. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ topRadius: createPropertyDescriptor("topRadius"), /** * Gets or sets the numeric Property specifying the radius of the bottom of the cylinder. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ bottomRadius: createPropertyDescriptor("bottomRadius"), /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -116,7 +123,7 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the cylinder is filled with the provided material. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -124,7 +131,7 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the Property specifying the material used to fill the cylinder. * @memberof CylinderGraphics.prototype - * @type {MaterialProperty} + * @type {MaterialProperty|undefined} * @default Color.WHITE */ material: createMaterialPropertyDescriptor("material"), @@ -132,7 +139,7 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the cylinder is outlined. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -140,7 +147,7 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -148,7 +155,7 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -156,7 +163,7 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the Property specifying the number of vertical lines to draw along the perimeter for the outline. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 16 */ numberOfVerticalLines: createPropertyDescriptor("numberOfVerticalLines"), @@ -164,7 +171,7 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the Property specifying the number of edges around the perimeter of the cylinder. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 128 */ slices: createPropertyDescriptor("slices"), @@ -173,7 +180,7 @@ Object.defineProperties(CylinderGraphics.prototype, { * Get or sets the enum Property specifying whether the cylinder * casts or receives shadows from light sources. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -181,7 +188,7 @@ Object.defineProperties(CylinderGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this cylinder will be displayed. * @memberof CylinderGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" diff --git a/Source/DataSources/CzmlDataSource.js b/Source/DataSources/CzmlDataSource.js index b89fea89ed24..b3517530ab20 100644 --- a/Source/DataSources/CzmlDataSource.js +++ b/Source/DataSources/CzmlDataSource.js @@ -4648,6 +4648,15 @@ function DocumentPacket() { this.clock = undefined; } +/** + * @typedef {Object} CzmlDataSource.LoadOptions + * + * Initialization options for the `load` method. + * + * @property {Resource|string} [sourceUri] Overrides the url to use for resolving relative links. + * @property {Credit|string} [credit] A credit for the data source, which is displayed on the canvas. + */ + /** * A {@link DataSource} which processes {@link https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/CZML-Guide|CZML}. * @alias CzmlDataSource @@ -4676,9 +4685,8 @@ function CzmlDataSource(name) { * Creates a Promise to a new instance loaded with the provided CZML data. * * @param {Resource|String|Object} czml A url or CZML object to be processed. - * @param {Object} [options] An object with the following properties: - * @param {Resource|String} [options.sourceUri] Overrides the url to use for resolving relative links. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. + * @param {CzmlDataSource.LoadOptions} [options] An object specifying configuration options + * * @returns {Promise.} A promise that resolves to the new instance once the data is processed. */ CzmlDataSource.load = function (czml, options) { @@ -4849,15 +4857,27 @@ CzmlDataSource.prototype.process = function (czml, options) { * Loads the provided url or CZML object, replacing any existing data. * * @param {Resource|String|Object} czml A url or CZML object to be processed. - * @param {Object} [options] An object with the following properties: - * @param {String} [options.sourceUri] Overrides the url to use for resolving relative links. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. + * @param {CzmlDataSource.LoadOptions} [options] An object specifying configuration options + * @returns {Promise.} A promise that resolves to this instances once the data is processed. */ CzmlDataSource.prototype.load = function (czml, options) { return load(this, czml, options, true); }; +/** + * Updates the data source to the provided time. This function is optional and + * is not required to be implemented. It is provided for data sources which + * retrieve data based on the current animation time or scene state. + * If implemented, update will be called by {@link DataSourceDisplay} once a frame. + * + * @param {JulianDate} time The simulation time. + * @returns {Boolean} True if this data source is ready to be displayed at the provided time, false otherwise. + */ +CzmlDataSource.prototype.update = function (time) { + return true; +}; + /** * A helper function used by custom CZML updater functions * which creates or updates a {@link Property} from a CZML packet. diff --git a/Source/DataSources/DataSource.js b/Source/DataSources/DataSource.js index f50dd3542ac2..182dac7602bf 100644 --- a/Source/DataSources/DataSource.js +++ b/Source/DataSources/DataSource.js @@ -96,12 +96,13 @@ Object.defineProperties(DataSource.prototype, { * is not required to be implemented. It is provided for data sources which * retrieve data based on the current animation time or scene state. * If implemented, update will be called by {@link DataSourceDisplay} once a frame. - * @function * * @param {JulianDate} time The simulation time. * @returns {Boolean} True if this data source is ready to be displayed at the provided time, false otherwise. */ -DataSource.prototype.update = DeveloperError.throwInstantiationError; +DataSource.prototype.update = function (time) { + DeveloperError.throwInstantiationError(); +}; /** * @private diff --git a/Source/DataSources/DataSourceDisplay.js b/Source/DataSources/DataSourceDisplay.js index d74732437c31..909057bdd92f 100644 --- a/Source/DataSources/DataSourceDisplay.js +++ b/Source/DataSources/DataSourceDisplay.js @@ -28,7 +28,7 @@ import PolylineVisualizer from "./PolylineVisualizer.js"; * @param {Object} options Object with the following properties: * @param {Scene} options.scene The scene in which to display the data. * @param {DataSourceCollection} options.dataSourceCollection The data sources to display. - * @param {DataSourceDisplay~VisualizersCallback} [options.visualizersCallback=DataSourceDisplay.defaultVisualizersCallback] + * @param {DataSourceDisplay.VisualizersCallback} [options.visualizersCallback=DataSourceDisplay.defaultVisualizersCallback] * A function which creates an array of visualizers used for visualization. * If undefined, all standard visualizers are used. */ @@ -124,7 +124,7 @@ function DataSourceDisplay(options) { * Gets or sets the default function which creates an array of visualizers used for visualization. * By default, this function uses all standard visualizers. * - * @type {DataSourceDisplay~VisualizersCallback} + * @type {DataSourceDisplay.VisualizersCallback} */ DataSourceDisplay.defaultVisualizersCallback = function ( scene, @@ -496,7 +496,7 @@ DataSourceDisplay.prototype._onDataSourceMoved = function ( /** * A function which creates an array of visualizers used for visualization. - * @callback DataSourceDisplay~VisualizersCallback + * @callback DataSourceDisplay.VisualizersCallback * * @param {Scene} scene The scene to create visualizers for. * @param {DataSource} dataSource The data source to create visualizers for. diff --git a/Source/DataSources/EllipseGraphics.js b/Source/DataSources/EllipseGraphics.js index 56c64aa94697..fe34d15cce85 100644 --- a/Source/DataSources/EllipseGraphics.js +++ b/Source/DataSources/EllipseGraphics.js @@ -5,6 +5,33 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} EllipseGraphics.ConstructorOptions + * + * Initialization options for the EllipseGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the ellipse. + * @property {Property | number} [semiMajorAxis] The numeric Property specifying the semi-major axis. + * @property {Property | number} [semiMinorAxis] The numeric Property specifying the semi-minor axis. + * @property {Property | number} [height=0] A numeric Property specifying the altitude of the ellipse relative to the ellipsoid surface. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to. + * @property {Property | number} [extrudedHeight] A numeric Property specifying the altitude of the ellipse's extruded face relative to the ellipsoid surface. + * @property {Property | HeightReference} [extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to. + * @property {Property | number} [rotation=0.0] A numeric property specifying the rotation of the ellipse counter-clockwise from north. + * @property {Property | number} [stRotation=0.0] A numeric property specifying the rotation of the ellipse texture counter-clockwise from north. + * @property {Property | number} [granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between points on the ellipse. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the ellipse is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the ellipse. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the ellipse is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | number} [numberOfVerticalLines=16] A numeric Property specifying the number of vertical lines to draw along the perimeter for the outline. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the ellipse casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this ellipse will be displayed. + * @property {Property | ClassificationType} [classificationType=ClassificationType.BOTH] An enum Property specifying whether this ellipse will classify terrain, 3D Tiles, or both when on the ground. + * @property {ConstantProperty | number} [zIndex=0] A property specifying the zIndex of the Ellipse. Used for ordering ground geometry. Only has an effect if the ellipse is constant and neither height or exturdedHeight are specified. + */ + /** * Describes an ellipse defined by a center point and semi-major and semi-minor axes. * The ellipse conforms to the curvature of the globe and can be placed on the surface or @@ -14,27 +41,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias EllipseGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the ellipse. - * @param {Property} [options.semiMajorAxis] The numeric Property specifying the semi-major axis. - * @param {Property} [options.semiMinorAxis] The numeric Property specifying the semi-minor axis. - * @param {Property} [options.height=0] A numeric Property specifying the altitude of the ellipse relative to the ellipsoid surface. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to. - * @param {Property} [options.extrudedHeight] A numeric Property specifying the altitude of the ellipse's extruded face relative to the ellipsoid surface. - * @param {Property} [options.extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to. - * @param {Property} [options.rotation=0.0] A numeric property specifying the rotation of the ellipse counter-clockwise from north. - * @param {Property} [options.stRotation=0.0] A numeric property specifying the rotation of the ellipse texture counter-clockwise from north. - * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between points on the ellipse. - * @param {Property} [options.fill=true] A boolean Property specifying whether the ellipse is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the ellipse. - * @param {Property} [options.outline=false] A boolean Property specifying whether the ellipse is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.numberOfVerticalLines=16] A numeric Property specifying the number of vertical lines to draw along the perimeter for the outline. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the ellipse casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this ellipse will be displayed. - * @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this ellipse will classify terrain, 3D Tiles, or both when on the ground. - * @param {ConstantProperty} [options.zIndex=0] A property specifying the zIndex of the Ellipse. Used for ordering ground geometry. Only has an effect if the ellipse is constant and neither height or exturdedHeight are specified. + * @param {EllipseGraphics.ConstructorOptions} [options] Object describing initialization options * * @demo {@link https://sandcastle.cesium.com/index.html?src=Circles and Ellipses.html|Cesium Sandcastle Circles and Ellipses Demo} */ @@ -101,7 +108,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the ellipse. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -109,21 +116,21 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the numeric Property specifying the semi-major axis. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ semiMajorAxis: createPropertyDescriptor("semiMajorAxis"), /** * Gets or sets the numeric Property specifying the semi-minor axis. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ semiMinorAxis: createPropertyDescriptor("semiMinorAxis"), /** * Gets or sets the numeric Property specifying the altitude of the ellipse. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.0 */ height: createPropertyDescriptor("height"), @@ -131,7 +138,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -140,14 +147,14 @@ Object.defineProperties(EllipseGraphics.prototype, { * Gets or sets the numeric Property specifying the altitude of the ellipse extrusion. * Setting this property creates volume starting at height and ending at this altitude. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ extrudedHeight: createPropertyDescriptor("extrudedHeight"), /** * Gets or sets the Property specifying the extruded {@link HeightReference}. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ extrudedHeightReference: createPropertyDescriptor("extrudedHeightReference"), @@ -155,7 +162,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the numeric property specifying the rotation of the ellipse clockwise from north. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0 */ rotation: createPropertyDescriptor("rotation"), @@ -163,7 +170,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the numeric property specifying the rotation of the ellipse texture counter-clockwise from north. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0 */ stRotation: createPropertyDescriptor("stRotation"), @@ -171,7 +178,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the numeric Property specifying the angular distance between points on the ellipse. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default {CesiumMath.RADIANS_PER_DEGREE} */ granularity: createPropertyDescriptor("granularity"), @@ -179,7 +186,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the ellipse is filled with the provided material. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -187,7 +194,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the Property specifying the material used to fill the ellipse. * @memberof EllipseGraphics.prototype - * @type {MaterialProperty} + * @type {MaterialProperty|undefined} * @default Color.WHITE */ material: createMaterialPropertyDescriptor("material"), @@ -195,7 +202,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the Property specifying whether the ellipse is outlined. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -203,7 +210,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -211,7 +218,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -219,7 +226,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the numeric Property specifying the number of vertical lines to draw along the perimeter for the outline. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 16 */ numberOfVerticalLines: createPropertyDescriptor("numberOfVerticalLines"), @@ -228,7 +235,7 @@ Object.defineProperties(EllipseGraphics.prototype, { * Get or sets the enum Property specifying whether the ellipse * casts or receives shadows from light sources. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -236,7 +243,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this ellipse will be displayed. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" @@ -245,7 +252,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the {@link ClassificationType} Property specifying whether this ellipse will classify terrain, 3D Tiles, or both when on the ground. * @memberof EllipseGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ClassificationType.BOTH */ classificationType: createPropertyDescriptor("classificationType"), @@ -253,7 +260,7 @@ Object.defineProperties(EllipseGraphics.prototype, { /** * Gets or sets the zIndex Property specifying the ellipse ordering. Only has an effect if the ellipse is constant and neither height or extrudedHeight are specified * @memberof EllipseGraphics.prototype - * @type {ConstantProperty} + * @type {ConstantProperty|undefined} * @default 0 */ zIndex: createPropertyDescriptor("zIndex"), diff --git a/Source/DataSources/EllipsoidGeometryUpdater.js b/Source/DataSources/EllipsoidGeometryUpdater.js index 2718bc8f2179..6531eb18564d 100644 --- a/Source/DataSources/EllipsoidGeometryUpdater.js +++ b/Source/DataSources/EllipsoidGeometryUpdater.js @@ -92,6 +92,7 @@ Object.defineProperties(EllipsoidGeometryUpdater.prototype, { * @type {TerrainOffsetProperty} * @memberof EllipsoidGeometryUpdater.prototype * @readonly + * @private */ terrainOffsetProperty: { get: function () { diff --git a/Source/DataSources/EllipsoidGraphics.js b/Source/DataSources/EllipsoidGraphics.js index 262f65c0cea1..3c999eafda81 100644 --- a/Source/DataSources/EllipsoidGraphics.js +++ b/Source/DataSources/EllipsoidGraphics.js @@ -5,31 +5,38 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} EllipsoidGraphics.ConstructorOptions + * + * Initialization options for the EllipsoidGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the ellipsoid. + * @property {Property | Cartesian3} [radii] A {@link Cartesian3} Property specifying the radii of the ellipsoid. + * @property {Property | Cartesian3} [innerRadii] A {@link Cartesian3} Property specifying the inner radii of the ellipsoid. + * @property {Property | number} [minimumClock=0.0] A Property specifying the minimum clock angle of the ellipsoid. + * @property {Property | number} [maximumClock=2*PI] A Property specifying the maximum clock angle of the ellipsoid. + * @property {Property | number} [minimumCone=0.0] A Property specifying the minimum cone angle of the ellipsoid. + * @property {Property | number} [maximumCone=PI] A Property specifying the maximum cone angle of the ellipsoid. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height from the entity position is relative to. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the ellipsoid is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the ellipsoid. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the ellipsoid is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | number} [stackPartitions=64] A Property specifying the number of stacks. + * @property {Property | number} [slicePartitions=64] A Property specifying the number of radial slices. + * @property {Property | number} [subdivisions=128] A Property specifying the number of samples per outline ring, determining the granularity of the curvature. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the ellipsoid casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this ellipsoid will be displayed. + */ + /** * Describe an ellipsoid or sphere. The center position and orientation are determined by the containing {@link Entity}. * * @alias EllipsoidGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the ellipsoid. - * @param {Property} [options.radii] A {@link Cartesian3} Property specifying the radii of the ellipsoid. - * @param {Property} [options.innerRadii] A {@link Cartesian3} Property specifying the inner radii of the ellipsoid. - * @param {Property} [options.minimumClock=0.0] A Property specifying the minimum clock angle of the ellipsoid. - * @param {Property} [options.maximumClock=2*PI] A Property specifying the maximum clock angle of the ellipsoid. - * @param {Property} [options.minimumCone=0.0] A Property specifying the minimum cone angle of the ellipsoid. - * @param {Property} [options.maximumCone=PI] A Property specifying the maximum cone angle of the ellipsoid. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height from the entity position is relative to. - * @param {Property} [options.fill=true] A boolean Property specifying whether the ellipsoid is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the ellipsoid. - * @param {Property} [options.outline=false] A boolean Property specifying whether the ellipsoid is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.stackPartitions=64] A Property specifying the number of stacks. - * @param {Property} [options.slicePartitions=64] A Property specifying the number of radial slices. - * @param {Property} [options.subdivisions=128] A Property specifying the number of samples per outline ring, determining the granularity of the curvature. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the ellipsoid casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this ellipsoid will be displayed. + * @param {EllipsoidGraphics.ConstructorOptions} [options] Object describing initialization options * * @demo {@link https://sandcastle.cesium.com/index.html?src=Spheres%20and%20Ellipsoids.html|Cesium Sandcastle Spheres and Ellipsoids Demo} */ @@ -92,7 +99,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the ellipsoid. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -100,14 +107,14 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the {@link Cartesian3} {@link Property} specifying the radii of the ellipsoid. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ radii: createPropertyDescriptor("radii"), /** * Gets or sets the {@link Cartesian3} {@link Property} specifying the inner radii of the ellipsoid. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default radii */ innerRadii: createPropertyDescriptor("innerRadii"), @@ -115,7 +122,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying the minimum clock angle of the ellipsoid. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.0 */ minimumClock: createPropertyDescriptor("minimumClock"), @@ -123,7 +130,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying the maximum clock angle of the ellipsoid. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 2*PI */ maximumClock: createPropertyDescriptor("maximumClock"), @@ -131,7 +138,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying the minimum cone angle of the ellipsoid. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.0 */ minimumCone: createPropertyDescriptor("minimumCone"), @@ -139,7 +146,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying the maximum cone angle of the ellipsoid. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default PI */ maximumCone: createPropertyDescriptor("maximumCone"), @@ -147,7 +154,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -155,7 +162,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the ellipsoid is filled with the provided material. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -171,7 +178,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying whether the ellipsoid is outlined. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -179,7 +186,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -187,7 +194,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -195,7 +202,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying the number of stacks. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 64 */ stackPartitions: createPropertyDescriptor("stackPartitions"), @@ -203,7 +210,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying the number of radial slices per 360 degrees. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 64 */ slicePartitions: createPropertyDescriptor("slicePartitions"), @@ -211,7 +218,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the Property specifying the number of samples per outline ring, determining the granularity of the curvature. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 128 */ subdivisions: createPropertyDescriptor("subdivisions"), @@ -220,7 +227,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { * Get or sets the enum Property specifying whether the ellipsoid * casts or receives shadows from light sources. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -228,7 +235,7 @@ Object.defineProperties(EllipsoidGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this ellipsoid will be displayed. * @memberof EllipsoidGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" diff --git a/Source/DataSources/Entity.js b/Source/DataSources/Entity.js index 119711736bce..091ca47492df 100644 --- a/Source/DataSources/Entity.js +++ b/Source/DataSources/Entity.js @@ -60,6 +60,40 @@ function createPropertyTypeDescriptor(name, Type) { }); } +/** + * @typedef {Object} Entity.ConstructorOptions + * + * Initialization options for the Entity constructor + * + * @property {String} [id] A unique identifier for this object. If none is provided, a GUID is generated. + * @property {String} [name] A human readable name to display to users. It does not have to be unique. + * @property {TimeIntervalCollection} [availability] The availability, if any, associated with this object. + * @property {Boolean} [show] A boolean value indicating if the entity and its children are displayed. + * @property {Property | string} [description] A string Property specifying an HTML description for this entity. + * @property {PositionProperty | Cartesian3} [position] A Property specifying the entity position. + * @property {Property} [orientation] A Property specifying the entity orientation. + * @property {Property} [viewFrom] A suggested initial offset for viewing this object. + * @property {Entity} [parent] A parent entity to associate with this entity. + * @property {BillboardGraphics | BillboardGraphics.ConstructorOptions} [billboard] A billboard to associate with this entity. + * @property {BoxGraphics | BoxGraphics.ConstructorOptions} [box] A box to associate with this entity. + * @property {CorridorGraphics | CorridorGraphics.ConstructorOptions} [corridor] A corridor to associate with this entity. + * @property {CylinderGraphics | CylinderGraphics.ConstructorOptions} [cylinder] A cylinder to associate with this entity. + * @property {EllipseGraphics | EllipseGraphics.ConstructorOptions} [ellipse] A ellipse to associate with this entity. + * @property {EllipsoidGraphics | EllipsoidGraphics.ConstructorOptions} [ellipsoid] A ellipsoid to associate with this entity. + * @property {LabelGraphics | LabelGraphics.ConstructorOptions} [label] A options.label to associate with this entity. + * @property {ModelGraphics | ModelGraphics.ConstructorOptions} [model] A model to associate with this entity. + * @property {Cesium3DTilesetGraphics | Cesium3DTilesetGraphics.ConstructorOptions} [tileset] A 3D Tiles tileset to associate with this entity. + * @property {PathGraphics | PathGraphics.ConstructorOptions} [path] A path to associate with this entity. + * @property {PlaneGraphics | PlaneGraphics.ConstructorOptions} [plane] A plane to associate with this entity. + * @property {PointGraphics | PointGraphics.ConstructorOptions} [point] A point to associate with this entity. + * @property {PolygonGraphics | PolygonGraphics.ConstructorOptions} [polygon] A polygon to associate with this entity. + * @property {PolylineGraphics | PolylineGraphics.ConstructorOptions} [polyline] A polyline to associate with this entity. + * @property {PropertyBag | Object.} [properties] Arbitrary properties to associate with this entity. + * @property {PolylineVolumeGraphics | PolylineVolumeGraphics.ConstructorOptions} [polylineVolume] A polylineVolume to associate with this entity. + * @property {RectangleGraphics | RectangleGraphics.ConstructorOptions} [rectangle] A rectangle to associate with this entity. + * @property {WallGraphics | WallGraphics.ConstructorOptions} [wall] A wall to associate with this entity. + */ + /** * Entity instances aggregate multiple forms of visualization into a single high-level object. * They can be created manually and added to {@link Viewer#entities} or be produced by @@ -67,34 +101,7 @@ function createPropertyTypeDescriptor(name, Type) { * @alias Entity * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {String} [options.id] A unique identifier for this object. If none is provided, a GUID is generated. - * @param {String} [options.name] A human readable name to display to users. It does not have to be unique. - * @param {TimeIntervalCollection} [options.availability] The availability, if any, associated with this object. - * @param {Boolean} [options.show] A boolean value indicating if the entity and its children are displayed. - * @param {Property} [options.description] A string Property specifying an HTML description for this entity. - * @param {PositionProperty} [options.position] A Property specifying the entity position. - * @param {Property} [options.orientation] A Property specifying the entity orientation. - * @param {Property} [options.viewFrom] A suggested initial offset for viewing this object. - * @param {Entity} [options.parent] A parent entity to associate with this entity. - * @param {BillboardGraphics} [options.billboard] A billboard to associate with this entity. - * @param {BoxGraphics} [options.box] A box to associate with this entity. - * @param {CorridorGraphics} [options.corridor] A corridor to associate with this entity. - * @param {CylinderGraphics} [options.cylinder] A cylinder to associate with this entity. - * @param {EllipseGraphics} [options.ellipse] A ellipse to associate with this entity. - * @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 {Cesium3DTilesetGraphics} [options.tileset] A 3D Tiles tileset to associate with this entity. - * @param {PathGraphics} [options.path] A path to associate with this entity. - * @param {PlaneGraphics} [options.plane] A plane 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. - * @param {PolylineGraphics} [options.polyline] A polyline to associate with this entity. - * @param {PropertyBag} [options.properties] Arbitrary properties to associate with this entity. - * @param {PolylineVolumeGraphics} [options.polylineVolume] A polylineVolume to associate with this entity. - * @param {RectangleGraphics} [options.rectangle] A rectangle to associate with this entity. - * @param {WallGraphics} [options.wall] A wall to associate with this entity. + * @param {Entity.ConstructorOptions} [options] Object describing initialization options * * @see {@link https://cesium.com/docs/tutorials/creating-entities/|Creating Entities} */ @@ -220,7 +227,7 @@ Object.defineProperties(Entity.prototype, { * If availability exists, the objects other properties will only * provide valid data if queried within the given interval. * @memberof Entity.prototype - * @type {TimeIntervalCollection} + * @type {TimeIntervalCollection|undefined} */ availability: createRawPropertyDescriptor("availability"), /** @@ -249,7 +256,7 @@ Object.defineProperties(Entity.prototype, { * Gets or sets the name of the object. The name is intended for end-user * consumption and does not need to be unique. * @memberof Entity.prototype - * @type {String} + * @type {String|undefined} */ name: createRawPropertyDescriptor("name"), /** @@ -302,7 +309,7 @@ Object.defineProperties(Entity.prototype, { /** * Gets or sets the parent object. * @memberof Entity.prototype - * @type {Entity} + * @type {Entity|undefined} */ parent: { get: function () { @@ -338,7 +345,7 @@ Object.defineProperties(Entity.prototype, { /** * Gets the names of all properties registered on this instance. * @memberof Entity.prototype - * @type {Array} + * @type {string[]} */ propertyNames: { get: function () { @@ -348,103 +355,103 @@ Object.defineProperties(Entity.prototype, { /** * Gets or sets the billboard. * @memberof Entity.prototype - * @type {BillboardGraphics} + * @type {BillboardGraphics|undefined} */ billboard: createPropertyTypeDescriptor("billboard", BillboardGraphics), /** * Gets or sets the box. * @memberof Entity.prototype - * @type {BoxGraphics} + * @type {BoxGraphics|undefined} */ box: createPropertyTypeDescriptor("box", BoxGraphics), /** * Gets or sets the corridor. * @memberof Entity.prototype - * @type {CorridorGraphics} + * @type {CorridorGraphics|undefined} */ corridor: createPropertyTypeDescriptor("corridor", CorridorGraphics), /** * Gets or sets the cylinder. * @memberof Entity.prototype - * @type {CylinderGraphics} + * @type {CylinderGraphics|undefined} */ cylinder: createPropertyTypeDescriptor("cylinder", CylinderGraphics), /** * Gets or sets the description. * @memberof Entity.prototype - * @type {Property} + * @type {Property|undefined} */ description: createPropertyDescriptor("description"), /** * Gets or sets the ellipse. * @memberof Entity.prototype - * @type {EllipseGraphics} + * @type {EllipseGraphics|undefined} */ ellipse: createPropertyTypeDescriptor("ellipse", EllipseGraphics), /** * Gets or sets the ellipsoid. * @memberof Entity.prototype - * @type {EllipsoidGraphics} + * @type {EllipsoidGraphics|undefined} */ ellipsoid: createPropertyTypeDescriptor("ellipsoid", EllipsoidGraphics), /** * Gets or sets the label. * @memberof Entity.prototype - * @type {LabelGraphics} + * @type {LabelGraphics|undefined} */ label: createPropertyTypeDescriptor("label", LabelGraphics), /** * Gets or sets the model. * @memberof Entity.prototype - * @type {ModelGraphics} + * @type {ModelGraphics|undefined} */ model: createPropertyTypeDescriptor("model", ModelGraphics), /** * Gets or sets the tileset. * @memberof Entity.prototype - * @type {Cesium3DTilesetGraphics} + * @type {Cesium3DTilesetGraphics|undefined} */ tileset: createPropertyTypeDescriptor("tileset", Cesium3DTilesetGraphics), /** * Gets or sets the orientation. * @memberof Entity.prototype - * @type {Property} + * @type {Property|undefined} */ orientation: createPropertyDescriptor("orientation"), /** * Gets or sets the path. * @memberof Entity.prototype - * @type {PathGraphics} + * @type {PathGraphics|undefined} */ path: createPropertyTypeDescriptor("path", PathGraphics), /** * Gets or sets the plane. * @memberof Entity.prototype - * @type {PlaneGraphics} + * @type {PlaneGraphics|undefined} */ plane: createPropertyTypeDescriptor("plane", PlaneGraphics), /** * Gets or sets the point graphic. * @memberof Entity.prototype - * @type {PointGraphics} + * @type {PointGraphics|undefined} */ point: createPropertyTypeDescriptor("point", PointGraphics), /** * Gets or sets the polygon. * @memberof Entity.prototype - * @type {PolygonGraphics} + * @type {PolygonGraphics|undefined} */ polygon: createPropertyTypeDescriptor("polygon", PolygonGraphics), /** * Gets or sets the polyline. * @memberof Entity.prototype - * @type {PolylineGraphics} + * @type {PolylineGraphics|undefined} */ polyline: createPropertyTypeDescriptor("polyline", PolylineGraphics), /** * Gets or sets the polyline volume. * @memberof Entity.prototype - * @type {PolylineVolumeGraphics} + * @type {PolylineVolumeGraphics|undefined} */ polylineVolume: createPropertyTypeDescriptor( "polylineVolume", @@ -453,19 +460,19 @@ Object.defineProperties(Entity.prototype, { /** * Gets or sets the bag of arbitrary properties associated with this entity. * @memberof Entity.prototype - * @type {PropertyBag} + * @type {PropertyBag|undefined} */ properties: createPropertyTypeDescriptor("properties", PropertyBag), /** * Gets or sets the position. * @memberof Entity.prototype - * @type {PositionProperty} + * @type {PositionProperty|undefined} */ position: createPositionPropertyDescriptor("position"), /** * Gets or sets the rectangle. * @memberof Entity.prototype - * @type {RectangleGraphics} + * @type {RectangleGraphics|undefined} */ rectangle: createPropertyTypeDescriptor("rectangle", RectangleGraphics), /** @@ -473,13 +480,13 @@ Object.defineProperties(Entity.prototype, { * The offset is typically defined in the east-north-up reference frame, * but may be another frame depending on the object's velocity. * @memberof Entity.prototype - * @type {Property} + * @type {Property|undefined} */ viewFrom: createPropertyDescriptor("viewFrom"), /** * Gets or sets the wall. * @memberof Entity.prototype - * @type {WallGraphics} + * @type {WallGraphics|undefined} */ wall: createPropertyTypeDescriptor("wall", WallGraphics), }); diff --git a/Source/DataSources/EntityCluster.js b/Source/DataSources/EntityCluster.js index 977483823518..2779deb12142 100644 --- a/Source/DataSources/EntityCluster.js +++ b/Source/DataSources/EntityCluster.js @@ -547,7 +547,7 @@ Object.defineProperties(EntityCluster.prototype, { }, }, /** - * Gets the event that will be raised when a new cluster will be displayed. The signature of the event listener is {@link EntityCluster~newClusterCallback}. + * Gets the event that will be raised when a new cluster will be displayed. The signature of the event listener is {@link EntityCluster.newClusterCallback}. * @memberof EntityCluster.prototype * @type {Event} */ @@ -960,7 +960,7 @@ EntityCluster.prototype.destroy = function () { /** * A event listener function used to style clusters. - * @callback EntityCluster~newClusterCallback + * @callback EntityCluster.newClusterCallback * * @param {Entity[]} clusteredEntities An array of the entities contained in the cluster. * @param {Object} cluster An object containing billboard, label, and point properties. The values are the same as diff --git a/Source/DataSources/EntityCollection.js b/Source/DataSources/EntityCollection.js index c28ce12c4f6a..614a03d67d4b 100644 --- a/Source/DataSources/EntityCollection.js +++ b/Source/DataSources/EntityCollection.js @@ -264,7 +264,7 @@ EntityCollection.prototype.computeAvailability = function () { /** * Add an entity to the collection. * - * @param {Entity} entity The entity to be added. + * @param {Entity | Entity.ConstructorOptions} entity The entity to be added. * @returns {Entity} The entity that was added. * @exception {DeveloperError} An entity with already exists in this collection. */ @@ -397,7 +397,7 @@ EntityCollection.prototype.removeAll = function () { * Gets an entity with the specified id. * * @param {String} id The id of the entity to retrieve. - * @returns {Entity} The entity with the provided id or undefined if the id did not exist in the collection. + * @returns {Entity|undefined} The entity with the provided id or undefined if the id did not exist in the collection. */ EntityCollection.prototype.getById = function (id) { //>>includeStart('debug', pragmas.debug); diff --git a/Source/DataSources/GeoJsonDataSource.js b/Source/DataSources/GeoJsonDataSource.js index e5d73e80ce41..56fda5ed7da0 100644 --- a/Source/DataSources/GeoJsonDataSource.js +++ b/Source/DataSources/GeoJsonDataSource.js @@ -557,6 +557,22 @@ function processTopology(dataSource, geoJson, geometry, crsFunction, options) { } } +/** + * @typedef {Object} GeoJsonDataSource.LoadOptions + * + * Initialization options for the `load` method. + * + * @property {String} [sourceUri] Overrides the url to use for resolving relative links. + * @property {Number} [markerSize=GeoJsonDataSource.markerSize] The default size of the map pin created for each point, in pixels. + * @property {String} [markerSymbol=GeoJsonDataSource.markerSymbol] The default symbol of the map pin created for each point. + * @property {Color} [markerColor=GeoJsonDataSource.markerColor] The default color of the map pin created for each point. + * @property {Color} [stroke=GeoJsonDataSource.stroke] The default color of polylines and polygon outlines. + * @property {Number} [strokeWidth=GeoJsonDataSource.strokeWidth] The default width of polylines and polygon outlines. + * @property {Color} [fill=GeoJsonDataSource.fill] The default color for polygon interiors. + * @property {Boolean} [clampToGround=GeoJsonDataSource.clampToGround] true if we want the geometry features (polygons or linestrings) clamped to the ground. + * @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas. + */ + /** * A {@link DataSource} which processes both * {@link http://www.geojson.org/|GeoJSON} and {@link https://github.com/mbostock/topojson|TopoJSON} data. @@ -599,16 +615,7 @@ function GeoJsonDataSource(name) { * Creates a Promise to a new instance loaded with the provided GeoJSON or TopoJSON data. * * @param {Resource|String|Object} data A url, GeoJSON object, or TopoJSON object to be loaded. - * @param {Object} [options] An object with the following properties: - * @param {String} [options.sourceUri] Overrides the url to use for resolving relative links. - * @param {Number} [options.markerSize=GeoJsonDataSource.markerSize] The default size of the map pin created for each point, in pixels. - * @param {String} [options.markerSymbol=GeoJsonDataSource.markerSymbol] The default symbol of the map pin created for each point. - * @param {Color} [options.markerColor=GeoJsonDataSource.markerColor] The default color of the map pin created for each point. - * @param {Color} [options.stroke=GeoJsonDataSource.stroke] The default color of polylines and polygon outlines. - * @param {Number} [options.strokeWidth=GeoJsonDataSource.strokeWidth] The default width of polylines and polygon outlines. - * @param {Color} [options.fill=GeoJsonDataSource.fill] The default color for polygon interiors. - * @param {Boolean} [options.clampToGround=GeoJsonDataSource.clampToGround] true if we want the geometry features (polygons or linestrings) clamped to the ground. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. + * @param {GeoJsonDataSource.LoadOptions} [options] An object specifying configuration options * * @returns {Promise.} A promise that will resolve when the data is loaded. */ @@ -888,7 +895,7 @@ Object.defineProperties(GeoJsonDataSource.prototype, { * @param {Resource|String|Object} data A url, GeoJSON object, or TopoJSON object to be loaded. * @param {Object} [options] An object with the following properties: * @param {String} [options.sourceUri] Overrides the url to use for resolving relative links. - * @param {GeoJsonDataSource~describe} [options.describe=GeoJsonDataSource.defaultDescribeProperty] A function which returns a Property object (or just a string), + * @param {GeoJsonDataSource.describe} [options.describe=GeoJsonDataSource.defaultDescribeProperty] A function which returns a Property object (or just a string), * which converts the properties into an html description. * @param {Number} [options.markerSize=GeoJsonDataSource.markerSize] The default size of the map pin created for each point, in pixels. * @param {String} [options.markerSymbol=GeoJsonDataSource.markerSymbol] The default symbol of the map pin created for each point. @@ -964,6 +971,19 @@ GeoJsonDataSource.prototype.load = function (data, options) { }); }; +/** + * Updates the data source to the provided time. This function is optional and + * is not required to be implemented. It is provided for data sources which + * retrieve data based on the current animation time or scene state. + * If implemented, update will be called by {@link DataSourceDisplay} once a frame. + * + * @param {JulianDate} time The simulation time. + * @returns {Boolean} True if this data source is ready to be displayed at the provided time, false otherwise. + */ +GeoJsonDataSource.prototype.update = function (time) { + return true; +}; + function load(that, geoJson, options, sourceUri) { var name; if (defined(sourceUri)) { @@ -1037,7 +1057,7 @@ function load(that, geoJson, options, sourceUri) { /** * This callback is displayed as part of the GeoJsonDataSource class. - * @callback GeoJsonDataSource~describe + * @callback GeoJsonDataSource.describe * @param {Object} properties The properties of the feature. * @param {String} nameProperty The property key that Cesium estimates to have the name of the feature. */ diff --git a/Source/DataSources/GeometryUpdater.js b/Source/DataSources/GeometryUpdater.js index 1377c87dc82c..d23137b4b797 100644 --- a/Source/DataSources/GeometryUpdater.js +++ b/Source/DataSources/GeometryUpdater.js @@ -519,6 +519,7 @@ GeometryUpdater.prototype._onEntityPropertyChanged = function ( * @returns {DynamicGeometryUpdater} The dynamic updater used to update the geometry each frame. * * @exception {DeveloperError} This instance does not represent dynamic geometry. + * @private */ GeometryUpdater.prototype.createDynamicUpdater = function ( primitives, diff --git a/Source/DataSources/GridMaterialProperty.js b/Source/DataSources/GridMaterialProperty.js index a1557b0d6f5d..3addebd12796 100644 --- a/Source/DataSources/GridMaterialProperty.js +++ b/Source/DataSources/GridMaterialProperty.js @@ -17,11 +17,11 @@ var defaultLineThickness = new Cartesian2(1, 1); * @alias GridMaterialProperty * * @param {Object} [options] Object with the following properties: - * @param {Property} [options.color=Color.WHITE] A Property specifying the grid {@link Color}. - * @param {Property} [options.cellAlpha=0.1] A numeric Property specifying cell alpha values. - * @param {Property} [options.lineCount=new Cartesian2(8, 8)] A {@link Cartesian2} Property specifying the number of grid lines along each axis. - * @param {Property} [options.lineThickness=new Cartesian2(1.0, 1.0)] A {@link Cartesian2} Property specifying the thickness of grid lines along each axis. - * @param {Property} [options.lineOffset=new Cartesian2(0.0, 0.0)] A {@link Cartesian2} Property specifying starting offset of grid lines along each axis. + * @param {Property|Color} [options.color=Color.WHITE] A Property specifying the grid {@link Color}. + * @param {Property|Number} [options.cellAlpha=0.1] A numeric Property specifying cell alpha values. + * @param {Property|Cartesian2} [options.lineCount=new Cartesian2(8, 8)] A {@link Cartesian2} Property specifying the number of grid lines along each axis. + * @param {Property|Cartesian2} [options.lineThickness=new Cartesian2(1.0, 1.0)] A {@link Cartesian2} Property specifying the thickness of grid lines along each axis. + * @param {Property|Cartesian2} [options.lineOffset=new Cartesian2(0.0, 0.0)] A {@link Cartesian2} Property specifying starting offset of grid lines along each axis. * * @constructor */ @@ -86,7 +86,7 @@ Object.defineProperties(GridMaterialProperty.prototype, { /** * Gets or sets the Property specifying the grid {@link Color}. * @memberof GridMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.WHITE */ color: createPropertyDescriptor("color"), @@ -94,7 +94,7 @@ Object.defineProperties(GridMaterialProperty.prototype, { /** * Gets or sets the numeric Property specifying cell alpha values. * @memberof GridMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.1 */ cellAlpha: createPropertyDescriptor("cellAlpha"), @@ -102,7 +102,7 @@ Object.defineProperties(GridMaterialProperty.prototype, { /** * Gets or sets the {@link Cartesian2} Property specifying the number of grid lines along each axis. * @memberof GridMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default new Cartesian2(8.0, 8.0) */ lineCount: createPropertyDescriptor("lineCount"), @@ -110,7 +110,7 @@ Object.defineProperties(GridMaterialProperty.prototype, { /** * Gets or sets the {@link Cartesian2} Property specifying the thickness of grid lines along each axis. * @memberof GridMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default new Cartesian2(1.0, 1.0) */ lineThickness: createPropertyDescriptor("lineThickness"), @@ -118,7 +118,7 @@ Object.defineProperties(GridMaterialProperty.prototype, { /** * Gets or sets the {@link Cartesian2} Property specifying the starting offset of grid lines along each axis. * @memberof GridMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default new Cartesian2(0.0, 0.0) */ lineOffset: createPropertyDescriptor("lineOffset"), diff --git a/Source/DataSources/GroundGeometryUpdater.js b/Source/DataSources/GroundGeometryUpdater.js index 724b0b04f1c1..2879e88ea059 100644 --- a/Source/DataSources/GroundGeometryUpdater.js +++ b/Source/DataSources/GroundGeometryUpdater.js @@ -54,6 +54,7 @@ Object.defineProperties(GroundGeometryUpdater.prototype, { * @type {TerrainOffsetProperty} * @memberof GroundGeometryUpdater.prototype * @readonly + * @private */ terrainOffsetProperty: { get: function () { diff --git a/Source/DataSources/ImageMaterialProperty.js b/Source/DataSources/ImageMaterialProperty.js index a1c3b717c0be..8fdc3f61417f 100644 --- a/Source/DataSources/ImageMaterialProperty.js +++ b/Source/DataSources/ImageMaterialProperty.js @@ -16,10 +16,10 @@ var defaultColor = Color.WHITE; * @constructor * * @param {Object} [options] Object with the following properties: - * @param {Property} [options.image] A Property specifying the Image, URL, Canvas, or Video. - * @param {Property} [options.repeat=new Cartesian2(1.0, 1.0)] A {@link Cartesian2} Property specifying the number of times the image repeats in each direction. - * @param {Property} [options.color=Color.WHITE] The color applied to the image - * @param {Property} [options.transparent=false] Set to true when the image has transparency (for example, when a png has transparent sections) + * @param {Property|String|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [options.image] A Property specifying the Image, URL, Canvas, or Video. + * @param {Property|Cartesian2} [options.repeat=new Cartesian2(1.0, 1.0)] A {@link Cartesian2} Property specifying the number of times the image repeats in each direction. + * @param {Property|Color} [options.color=Color.WHITE] The color applied to the image + * @param {Property|Boolean} [options.transparent=false] Set to true when the image has transparency (for example, when a png has transparent sections) */ function ImageMaterialProperty(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -75,14 +75,14 @@ Object.defineProperties(ImageMaterialProperty.prototype, { /** * Gets or sets the Property specifying Image, URL, Canvas, or Video to use. * @memberof ImageMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} */ image: createPropertyDescriptor("image"), /** * Gets or sets the {@link Cartesian2} Property specifying the number of times the image repeats in each direction. * @memberof ImageMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default new Cartesian2(1, 1) */ repeat: createPropertyDescriptor("repeat"), @@ -90,7 +90,7 @@ Object.defineProperties(ImageMaterialProperty.prototype, { /** * Gets or sets the Color Property specifying the desired color applied to the image. * @memberof ImageMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ color: createPropertyDescriptor("color"), @@ -98,7 +98,7 @@ Object.defineProperties(ImageMaterialProperty.prototype, { /** * Gets or sets the Boolean Property specifying whether the image has transparency * @memberof ImageMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ transparent: createPropertyDescriptor("transparent"), diff --git a/Source/DataSources/KmlDataSource.js b/Source/DataSources/KmlDataSource.js index 124298ba9a96..592e951fa0f7 100644 --- a/Source/DataSources/KmlDataSource.js +++ b/Source/DataSources/KmlDataSource.js @@ -3338,6 +3338,19 @@ function load(dataSource, entityCollection, data, options) { }); } +/** + * @typedef {Object} KmlDataSource.LoadOptions + * + * Initialization options for the `load` method. + * + * @property {Camera} camera The camera that is used for viewRefreshModes and sending camera properties to network links. + * @property {HTMLCanvasElement} canvas The canvas that is used for sending viewer properties to network links. + * @property {String} [sourceUri] Overrides the url to use for resolving relative links and other KML network features. + * @property {Boolean} [clampToGround=false] true if we want the geometry features (Polygons, LineStrings and LinearRings) clamped to the ground. + * @property {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The global ellipsoid used for geographical calculations. + * @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas. + */ + /** * A {@link DataSource} which processes Keyhole Markup Language 2.2 (KML). *

@@ -3358,7 +3371,7 @@ function load(dataSource, entityCollection, data, options) { * * @param {Object} options An object with the following properties: * @param {Camera} options.camera The camera that is used for viewRefreshModes and sending camera properties to network links. - * @param {Canvas} options.canvas The canvas that is used for sending viewer properties to network links. + * @param {HTMLCanvasElement} options.canvas The canvas that is used for sending viewer properties to network links. * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The global ellipsoid used for geographical calculations. * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. * @@ -3434,13 +3447,7 @@ function KmlDataSource(options) { * Creates a Promise to a new instance loaded with the provided KML data. * * @param {Resource|String|Document|Blob} data A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document. - * @param {Object} options An object with the following properties: - * @param {Camera} options.camera The camera that is used for viewRefreshModes and sending camera properties to network links. - * @param {Canvas} options.canvas The canvas that is used for sending viewer properties to network links. - * @param {String} [options.sourceUri] Overrides the url to use for resolving relative links and other KML network features. - * @param {Boolean} [options.clampToGround=false] true if we want the geometry features (Polygons, LineStrings and LinearRings) clamped to the ground. - * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The global ellipsoid used for geographical calculations. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. + * @param {KmlDataSource.LoadOptions} [options] An object specifying configuration options * * @returns {Promise.} A promise that will resolve to a new KmlDataSource instance once the KML is loaded. */ @@ -3865,8 +3872,7 @@ function getNetworkLinkUpdateCallback( var entitiesToIgnore = new AssociativeArray(); /** - * Updates any NetworkLink that require updating - * @function + * Updates any NetworkLink that require updating. * * @param {JulianDate} time The simulation time. * @returns {Boolean} True if this data source is ready to be displayed at the provided time, false otherwise. @@ -4006,112 +4012,68 @@ KmlDataSource.prototype.update = function (time) { * @constructor */ function KmlFeatureData() { + /** + * @typedef KmlFeatureData.Author + * @type {Object} + * @property {String} name Gets the name. + * @property {String} uri Gets the URI. + * @property {Number} age Gets the email. + */ + /** * Gets the atom syndication format author field. - * @type Object + * @type {KmlFeatureData.Author} */ this.author = { - /** - * Gets the name. - * @type String - * @alias author.name - * @memberof! KmlFeatureData# - * @property author.name - */ name: undefined, - /** - * Gets the URI. - * @type String - * @alias author.uri - * @memberof! KmlFeatureData# - * @property author.uri - */ uri: undefined, - /** - * Gets the email. - * @type String - * @alias author.email - * @memberof! KmlFeatureData# - * @property author.email - */ email: undefined, }; + /** + * @typedef KmlFeatureData.Link + * @type {Object} + * @property {String} href Gets the href. + * @property {String} hreflang Gets the language of the linked resource. + * @property {String} rel Gets the link relation. + * @property {String} type Gets the link type. + * @property {String} title Gets the link title. + * @property {String} length Gets the link length. + */ + /** * Gets the link. - * @type Object + * @type {KmlFeatureData.Link} */ this.link = { - /** - * Gets the href. - * @type String - * @alias link.href - * @memberof! KmlFeatureData# - * @property link.href - */ href: undefined, - /** - * Gets the language of the linked resource. - * @type String - * @alias link.hreflang - * @memberof! KmlFeatureData# - * @property link.hreflang - */ hreflang: undefined, - /** - * Gets the link relation. - * @type String - * @alias link.rel - * @memberof! KmlFeatureData# - * @property link.rel - */ rel: undefined, - /** - * Gets the link type. - * @type String - * @alias link.type - * @memberof! KmlFeatureData# - * @property link.type - */ type: undefined, - /** - * Gets the link title. - * @type String - * @alias link.title - * @memberof! KmlFeatureData# - * @property link.title - */ title: undefined, - /** - * Gets the link length. - * @type String - * @alias link.length - * @memberof! KmlFeatureData# - * @property link.length - */ length: undefined, }; /** * Gets the unstructured address field. - * @type String + * @type {String} */ this.address = undefined; /** * Gets the phone number. - * @type String + * @type {String} */ this.phoneNumber = undefined; /** * Gets the snippet. - * @type String + * @type {String} */ this.snippet = undefined; /** * Gets the extended data, parsed into a JSON object. * Currently only the Data property is supported. * SchemaData and custom data are ignored. - * @type String + * @type {String} */ this.extendedData = undefined; } diff --git a/Source/DataSources/KmlTourFlyTo.js b/Source/DataSources/KmlTourFlyTo.js index 97a3d8cce55b..f2f6b980fda4 100644 --- a/Source/DataSources/KmlTourFlyTo.js +++ b/Source/DataSources/KmlTourFlyTo.js @@ -24,7 +24,7 @@ function KmlTourFlyTo(duration, flyToMode, view) { /** * Play this playlist entry * - * @param {KmlTourFlyTo~DoneCallback} done function which will be called when playback ends + * @param {KmlTourFlyTo.DoneCallback} done function which will be called when playback ends * @param {Camera} camera Cesium camera * @param {Object} [cameraOptions] which will be merged with camera flyTo options. See {@link Camera#flyTo} */ @@ -95,7 +95,7 @@ KmlTourFlyTo.prototype.getCameraOptions = function (cameraOptions) { /** * A function that will be executed when the flight completes. - * @callback KmlTourFlyTo~DoneCallback + * @callback KmlTourFlyTo.DoneCallback * * @param {Boolean} terminated true if {@link KmlTourFlyTo#stop} was * called before entry done playback. diff --git a/Source/DataSources/KmlTourWait.js b/Source/DataSources/KmlTourWait.js index 6a809461ae42..476603d18553 100644 --- a/Source/DataSources/KmlTourWait.js +++ b/Source/DataSources/KmlTourWait.js @@ -16,7 +16,7 @@ function KmlTourWait(duration) { /** * Play this playlist entry * - * @param {KmlTourWait~DoneCallback} done function which will be called when playback ends + * @param {KmlTourWait.DoneCallback} done function which will be called when playback ends */ KmlTourWait.prototype.play = function (done) { var self = this; @@ -40,7 +40,7 @@ KmlTourWait.prototype.stop = function () { /** * A function which will be called when playback ends. * - * @callback KmlTourWait~DoneCallback + * @callback KmlTourWait.DoneCallback * @param {Boolean} terminated true if {@link KmlTourWait#stop} was * called before entry done playback. */ diff --git a/Source/DataSources/LabelGraphics.js b/Source/DataSources/LabelGraphics.js index 85a468c21c88..3495a7e88e08 100644 --- a/Source/DataSources/LabelGraphics.js +++ b/Source/DataSources/LabelGraphics.js @@ -4,6 +4,34 @@ import DeveloperError from "../Core/DeveloperError.js"; import Event from "../Core/Event.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} LabelGraphics.ConstructorOptions + * + * Initialization options for the LabelGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the label. + * @property {Property | string} [text] A Property specifying the text. Explicit newlines '\n' are supported. + * @property {Property | string} [font='30px sans-serif'] A Property specifying the CSS font. + * @property {Property | LabelStyle} [style=LabelStyle.FILL] A Property specifying the {@link LabelStyle}. + * @property {Property | number} [scale=1.0] A numeric Property specifying the scale to apply to the text. + * @property {Property | boolean} [showBackground=false] A boolean Property specifying the visibility of the background behind the label. + * @property {Property | Color} [backgroundColor=new Color(0.165, 0.165, 0.165, 0.8)] A Property specifying the background {@link Color}. + * @property {Property | Cartesian2} [backgroundPadding=new Cartesian2(7, 5)] A {@link Cartesian2} Property specifying the horizontal and vertical background padding in pixels. + * @property {Property | Cartesian2} [pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} Property specifying the pixel offset. + * @property {Property | Cartesian3} [eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the eye offset. + * @property {Property | HorizontalOrigin} [horizontalOrigin=HorizontalOrigin.CENTER] A Property specifying the {@link HorizontalOrigin}. + * @property {Property | VerticalOrigin} [verticalOrigin=VerticalOrigin.CENTER] A Property specifying the {@link VerticalOrigin}. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to. + * @property {Property | Color} [fillColor=Color.WHITE] A Property specifying the fill {@link Color}. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the outline {@link Color}. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the outline width. + * @property {Property | NearFarScalar} [translucencyByDistance] A {@link NearFarScalar} Property used to set translucency based on distance from the camera. + * @property {Property | NearFarScalar} [pixelOffsetScaleByDistance] A {@link NearFarScalar} Property used to set pixelOffset based on distance from the camera. + * @property {Property | NearFarScalar} [scaleByDistance] A {@link NearFarScalar} Property used to set scale based on distance from the camera. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this label will be displayed. + * @property {Property | number} [disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to. + */ + /** * Describes a two dimensional label located at the position of the containing {@link Entity}. *

@@ -16,28 +44,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias LabelGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the label. - * @param {Property} [options.text] A Property specifying the text. Explicit newlines '\n' are supported. - * @param {Property} [options.font='30px sans-serif'] A Property specifying the CSS font. - * @param {Property} [options.style=LabelStyle.FILL] A Property specifying the {@link LabelStyle}. - * @param {Property} [options.scale=1.0] A numeric Property specifying the scale to apply to the text. - * @param {Property} [options.showBackground=false] A boolean Property specifying the visibility of the background behind the label. - * @param {Property} [options.backgroundColor=new Color(0.165, 0.165, 0.165, 0.8)] A Property specifying the background {@link Color}. - * @param {Property} [options.backgroundPadding=new Cartesian2(7, 5)] A {@link Cartesian2} Property specifying the horizontal and vertical background padding in pixels. - * @param {Property} [options.pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} Property specifying the pixel offset. - * @param {Property} [options.eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the eye offset. - * @param {Property} [options.horizontalOrigin=HorizontalOrigin.CENTER] A Property specifying the {@link HorizontalOrigin}. - * @param {Property} [options.verticalOrigin=VerticalOrigin.CENTER] A Property specifying the {@link VerticalOrigin}. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to. - * @param {Property} [options.fillColor=Color.WHITE] A Property specifying the fill {@link Color}. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the outline {@link Color}. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the outline width. - * @param {Property} [options.translucencyByDistance] A {@link NearFarScalar} Property used to set translucency based on distance from the camera. - * @param {Property} [options.pixelOffsetScaleByDistance] A {@link NearFarScalar} Property used to set pixelOffset based on distance from the camera. - * @param {Property} [options.scaleByDistance] A {@link NearFarScalar} Property used to set scale based on distance from the camera. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this label will be displayed. - * @param {Property} [options.disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to. + * @param {LabelGraphics.ConstructorOptions} [options] Object describing initialization options * * @demo {@link https://sandcastle.cesium.com/index.html?src=Labels.html|Cesium Sandcastle Labels Demo} */ @@ -106,7 +113,7 @@ Object.defineProperties(LabelGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the label. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ show: createPropertyDescriptor("show"), @@ -114,14 +121,14 @@ Object.defineProperties(LabelGraphics.prototype, { * Gets or sets the string Property specifying the text of the label. * Explicit newlines '\n' are supported. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ text: createPropertyDescriptor("text"), /** * Gets or sets the string Property specifying the font in CSS syntax. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font|CSS font on MDN} */ font: createPropertyDescriptor("font"), @@ -129,7 +136,7 @@ Object.defineProperties(LabelGraphics.prototype, { /** * Gets or sets the Property specifying the {@link LabelStyle}. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ style: createPropertyDescriptor("style"), @@ -144,7 +151,7 @@ Object.defineProperties(LabelGraphics.prototype, { * *

* @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ scale: createPropertyDescriptor("scale"), @@ -152,7 +159,7 @@ Object.defineProperties(LabelGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the background behind the label. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ showBackground: createPropertyDescriptor("showBackground"), @@ -160,7 +167,7 @@ Object.defineProperties(LabelGraphics.prototype, { /** * Gets or sets the Property specifying the background {@link Color}. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default new Color(0.165, 0.165, 0.165, 0.8) */ backgroundColor: createPropertyDescriptor("backgroundColor"), @@ -169,7 +176,7 @@ Object.defineProperties(LabelGraphics.prototype, { * Gets or sets the {@link Cartesian2} Property specifying the label's horizontal and vertical * background padding in pixels. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default new Cartesian2(7, 5) */ backgroundPadding: createPropertyDescriptor("backgroundPadding"), @@ -189,7 +196,7 @@ Object.defineProperties(LabelGraphics.prototype, { * *

* @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Cartesian2.ZERO */ pixelOffset: createPropertyDescriptor("pixelOffset"), @@ -214,7 +221,7 @@ Object.defineProperties(LabelGraphics.prototype, { * *

* @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Cartesian3.ZERO */ eyeOffset: createPropertyDescriptor("eyeOffset"), @@ -222,21 +229,21 @@ Object.defineProperties(LabelGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HorizontalOrigin}. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ horizontalOrigin: createPropertyDescriptor("horizontalOrigin"), /** * Gets or sets the Property specifying the {@link VerticalOrigin}. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ verticalOrigin: createPropertyDescriptor("verticalOrigin"), /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -244,43 +251,43 @@ Object.defineProperties(LabelGraphics.prototype, { /** * Gets or sets the Property specifying the fill {@link Color}. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ fillColor: createPropertyDescriptor("fillColor"), /** * Gets or sets the Property specifying the outline {@link Color}. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ outlineColor: createPropertyDescriptor("outlineColor"), /** * Gets or sets the numeric Property specifying the outline width. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ outlineWidth: createPropertyDescriptor("outlineWidth"), /** * Gets or sets {@link NearFarScalar} Property specifying the translucency of the label based on the distance from the camera. * A label's translucency will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the label's translucency remains clamped to the nearest bound. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ translucencyByDistance: createPropertyDescriptor("translucencyByDistance"), /** * Gets or sets {@link NearFarScalar} Property specifying the pixel offset of the label based on the distance from the camera. * A label's pixel offset will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the label's pixel offset remains clamped to the nearest bound. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ pixelOffsetScaleByDistance: createPropertyDescriptor( "pixelOffsetScaleByDistance" @@ -289,19 +296,19 @@ Object.defineProperties(LabelGraphics.prototype, { /** * Gets or sets near and far scaling properties of a Label based on the label's distance from the camera. * A label's scale will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the label's scale remains clamped to the nearest bound. If undefined, * scaleByDistance will be disabled. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ scaleByDistance: createPropertyDescriptor("scaleByDistance"), /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this label will be displayed. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" @@ -311,7 +318,7 @@ Object.defineProperties(LabelGraphics.prototype, { * Gets or sets the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain. * When set to zero, the depth test is always applied. When set to Number.POSITIVE_INFINITY, the depth test is never applied. * @memberof LabelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ disableDepthTestDistance: createPropertyDescriptor( "disableDepthTestDistance" diff --git a/Source/DataSources/ModelGraphics.js b/Source/DataSources/ModelGraphics.js index 94a52176a947..a30b00954c88 100644 --- a/Source/DataSources/ModelGraphics.js +++ b/Source/DataSources/ModelGraphics.js @@ -18,6 +18,34 @@ function createArticulationStagePropertyBag(value) { return new PropertyBag(value); } +/** + * @typedef {Object} ModelGraphics.ConstructorOptions + * + * Initialization options for the ModelGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the model. + * @property {Property | string | Resource} [uri] A string or Resource Property specifying the URI of the glTF asset. + * @property {Property | number} [scale=1.0] A numeric Property specifying a uniform linear scale. + * @property {Property | number} [minimumPixelSize=0.0] A numeric Property specifying the approximate minimum pixel size of the model regardless of zoom. + * @property {Property | number} [maximumScale] The maximum scale size of a model. An upper limit for minimumPixelSize. + * @property {Property | boolean} [incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded. + * @property {Property | boolean} [runAnimations=true] A boolean Property specifying if glTF animations specified in the model should be started. + * @property {Property | boolean} [clampAnimations=true] A boolean Property specifying if glTF animations should hold the last pose for time durations with no keyframes. + * @property {Property | ShadowMode} [shadows=ShadowMode.ENABLED] An enum Property specifying whether the model casts or receives shadows from light sources. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to. + * @property {Property | Color} [silhouetteColor=Color.RED] A Property specifying the {@link Color} of the silhouette. + * @property {Property | number} [silhouetteSize=0.0] A numeric Property specifying the size of the silhouette in pixels. + * @property {Property | Color} [color=Color.WHITE] A Property specifying the {@link Color} that blends with the model's rendered color. + * @property {Property | ColorBlendMode} [colorBlendMode=ColorBlendMode.HIGHLIGHT] An enum Property specifying how the color blends with the model. + * @property {Property | number} [colorBlendAmount=0.5] A numeric Property specifying the color strength when the colorBlendMode is MIX. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two. + * @property {Property | Cartesian2} [imageBasedLightingFactor=new Cartesian2(1.0, 1.0)] A property specifying the contribution from diffuse and specular image-based lighting. + * @property {Property | Color} [lightColor] A property specifying the light color when shading the model. When undefined the scene's light color is used instead. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this model will be displayed. + * @property {PropertyBag | Object.} [nodeTransformations] An object, where keys are names of nodes, and values are {@link TranslationRotationScale} Properties describing the transformation to apply to that node. The transformation is applied after the node's existing transformation as specified in the glTF, and does not replace the node's existing transformation. + * @property {PropertyBag | Object.} [articulations] An object, where keys are composed of an articulation name, a single space, and a stage name, and the values are numeric properties. + * @property {Property | ClippingPlaneCollection} [clippingPlanes] A property specifying the {@link ClippingPlaneCollection} used to selectively disable rendering the model. + */ + /** * A 3D model based on {@link https://github.com/KhronosGroup/glTF|glTF}, the runtime asset format for WebGL, OpenGL ES, and OpenGL. * The position and orientation of the model is determined by the containing {@link Entity}. @@ -29,28 +57,7 @@ function createArticulationStagePropertyBag(value) { * @alias ModelGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the model. - * @param {Property} [options.uri] A string or Resource Property specifying the URI of the glTF asset. - * @param {Property} [options.scale=1.0] A numeric Property specifying a uniform linear scale. - * @param {Property} [options.minimumPixelSize=0.0] A numeric Property specifying the approximate minimum pixel size of the model regardless of zoom. - * @param {Property} [options.maximumScale] The maximum scale size of a model. An upper limit for minimumPixelSize. - * @param {Property} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded. - * @param {Property} [options.runAnimations=true] A boolean Property specifying if glTF animations specified in the model should be started. - * @param {Property} [options.clampAnimations=true] A boolean Property specifying if glTF animations should hold the last pose for time durations with no keyframes. - * @param {Property} [options.shadows=ShadowMode.ENABLED] An enum Property specifying whether the model casts or receives shadows from light sources. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to. - * @param {Property} [options.silhouetteColor=Color.RED] A Property specifying the {@link Color} of the silhouette. - * @param {Property} [options.silhouetteSize=0.0] A numeric Property specifying the size of the silhouette in pixels. - * @param {Property} [options.color=Color.WHITE] A Property specifying the {@link Color} that blends with the model's rendered color. - * @param {Property} [options.colorBlendMode=ColorBlendMode.HIGHLIGHT] An enum Property specifying how the color blends with the model. - * @param {Property} [options.colorBlendAmount=0.5] A numeric Property specifying the color strength when the colorBlendMode is MIX. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two. - * @param {Property} [options.imageBasedLightingFactor=new Cartesian2(1.0, 1.0)] A property specifying the contribution from diffuse and specular image-based lighting. - * @param {Property} [options.lightColor] A property specifying the light color when shading the model. When undefined the scene's light color is used instead. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this model will be displayed. - * @param {PropertyBag} [options.nodeTransformations] An object, where keys are names of nodes, and values are {@link TranslationRotationScale} Properties describing the transformation to apply to that node. The transformation is applied after the node's existing transformation as specified in the glTF, and does not replace the node's existing transformation. - * @param {PropertyBag} [options.articulations] An object, where keys are composed of an articulation name, a single space, and a stage name, and the values are numeric properties. - * @param {Property} [options.clippingPlanes] A property specifying the {@link ClippingPlaneCollection} used to selectively disable rendering the model. + * @param {ModelGraphics.ConstructorOptions} [options] Object describing initialization options * * @see {@link https://cesium.com/docs/tutorials/3d-models/|3D Models Tutorial} * @demo {@link https://sandcastle.cesium.com/index.html?src=3D%20Models.html|Cesium Sandcastle 3D Models Demo} @@ -119,7 +126,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the model. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -127,7 +134,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * Gets or sets the string Property specifying the URI of the glTF asset. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ uri: createPropertyDescriptor("uri"), @@ -136,7 +143,7 @@ Object.defineProperties(ModelGraphics.prototype, { * for this model. Values greater than 1.0 increase the size of the model while * values less than 1.0 decrease it. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ scale: createPropertyDescriptor("scale"), @@ -147,7 +154,7 @@ Object.defineProperties(ModelGraphics.prototype, { * a model is visible even when the viewer zooms out. When 0.0, * no minimum size is enforced. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.0 */ minimumPixelSize: createPropertyDescriptor("minimumPixelSize"), @@ -157,7 +164,7 @@ Object.defineProperties(ModelGraphics.prototype, { * size of a model. This property is used as an upper limit for * {@link ModelGraphics#minimumPixelSize}. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ maximumScale: createPropertyDescriptor("maximumScale"), @@ -165,7 +172,7 @@ Object.defineProperties(ModelGraphics.prototype, { * Get or sets the boolean Property specifying whether textures * may continue to stream in after the model is loaded. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ incrementallyLoadTextures: createPropertyDescriptor( "incrementallyLoadTextures" @@ -174,7 +181,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * Gets or sets the boolean Property specifying if glTF animations should be run. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ runAnimations: createPropertyDescriptor("runAnimations"), @@ -182,7 +189,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * Gets or sets the boolean Property specifying if glTF animations should hold the last pose for time durations with no keyframes. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ clampAnimations: createPropertyDescriptor("clampAnimations"), @@ -191,7 +198,7 @@ Object.defineProperties(ModelGraphics.prototype, { * Get or sets the enum Property specifying whether the model * casts or receives shadows from light sources. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.ENABLED */ shadows: createPropertyDescriptor("shadows"), @@ -199,7 +206,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -207,7 +214,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the silhouette. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.RED */ silhouetteColor: createPropertyDescriptor("silhouetteColor"), @@ -215,7 +222,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * Gets or sets the numeric Property specifying the size of the silhouette in pixels. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.0 */ silhouetteSize: createPropertyDescriptor("silhouetteSize"), @@ -223,7 +230,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} that blends with the model's rendered color. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.WHITE */ color: createPropertyDescriptor("color"), @@ -231,7 +238,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * Gets or sets the enum Property specifying how the color blends with the model. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ColorBlendMode.HIGHLIGHT */ colorBlendMode: createPropertyDescriptor("colorBlendMode"), @@ -241,7 +248,7 @@ Object.defineProperties(ModelGraphics.prototype, { * A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with * any value in-between resulting in a mix of the two. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.5 */ colorBlendAmount: createPropertyDescriptor("colorBlendAmount"), @@ -249,7 +256,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * A property specifying the {@link Cartesian2} used to scale the diffuse and specular image-based lighting contribution to the final color. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ imageBasedLightingFactor: createPropertyDescriptor( "imageBasedLightingFactor" @@ -258,14 +265,14 @@ Object.defineProperties(ModelGraphics.prototype, { /** * A property specifying the {@link Cartesian3} light color when shading the model. When undefined the scene's light color is used instead. * @memberOf ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ lightColor: createPropertyDescriptor("lightColor"), /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this model will be displayed. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" @@ -299,7 +306,7 @@ Object.defineProperties(ModelGraphics.prototype, { /** * A property specifying the {@link ClippingPlaneCollection} used to selectively disable rendering the model. * @memberof ModelGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ clippingPlanes: createPropertyDescriptor("clippingPlanes"), }); diff --git a/Source/DataSources/NodeTransformationProperty.js b/Source/DataSources/NodeTransformationProperty.js index 9cf7ad22ccda..f5070203484f 100644 --- a/Source/DataSources/NodeTransformationProperty.js +++ b/Source/DataSources/NodeTransformationProperty.js @@ -13,9 +13,9 @@ var defaultNodeTransformation = new TranslationRotationScale(); * @constructor * * @param {Object} [options] Object with the following properties: - * @param {Property} [options.translation=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the (x, y, z) translation to apply to the node. - * @param {Property} [options.rotation=Quaternion.IDENTITY] A {@link Quaternion} Property specifying the (x, y, z, w) rotation to apply to the node. - * @param {Property} [options.scale=new Cartesian3(1.0, 1.0, 1.0)] A {@link Cartesian3} Property specifying the (x, y, z) scaling to apply to the node. + * @param {Property|Cartesian3} [options.translation=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the (x, y, z) translation to apply to the node. + * @param {Property|Quaternion} [options.rotation=Quaternion.IDENTITY] A {@link Quaternion} Property specifying the (x, y, z, w) rotation to apply to the node. + * @param {Property|Cartesian3} [options.scale=new Cartesian3(1.0, 1.0, 1.0)] A {@link Cartesian3} Property specifying the (x, y, z) scaling to apply to the node. */ function NodeTransformationProperty(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -70,7 +70,7 @@ Object.defineProperties(NodeTransformationProperty.prototype, { /** * Gets or sets the {@link Cartesian3} Property specifying the (x, y, z) translation to apply to the node. * @memberof NodeTransformationProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Cartesian3.ZERO */ translation: createPropertyDescriptor("translation"), @@ -78,7 +78,7 @@ Object.defineProperties(NodeTransformationProperty.prototype, { /** * Gets or sets the {@link Quaternion} Property specifying the (x, y, z, w) rotation to apply to the node. * @memberof NodeTransformationProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Quaternion.IDENTITY */ rotation: createPropertyDescriptor("rotation"), @@ -86,7 +86,7 @@ Object.defineProperties(NodeTransformationProperty.prototype, { /** * Gets or sets the {@link Cartesian3} Property specifying the (x, y, z) scaling to apply to the node. * @memberof NodeTransformationProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default new Cartesian3(1.0, 1.0, 1.0) */ scale: createPropertyDescriptor("scale"), diff --git a/Source/DataSources/PathGraphics.js b/Source/DataSources/PathGraphics.js index b2d36c1ba7c5..4e95e18792de 100644 --- a/Source/DataSources/PathGraphics.js +++ b/Source/DataSources/PathGraphics.js @@ -5,20 +5,27 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} PathGraphics.ConstructorOptions + * + * Initialization options for the PathGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the path. + * @property {Property | number} [leadTime] A Property specifying the number of seconds in front the object to show. + * @property {Property | number} [trailTime] A Property specifying the number of seconds behind of the object to show. + * @property {Property | number} [width=1.0] A numeric Property specifying the width in pixels. + * @property {Property | number} [resolution=60] A numeric Property specifying the maximum number of seconds to step when sampling the position. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to draw the path. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this path will be displayed. + */ + /** * Describes a polyline defined as the path made by an {@link Entity} as it moves over time. * * @alias PathGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the path. - * @param {Property} [options.leadTime] A Property specifying the number of seconds in front the object to show. - * @param {Property} [options.trailTime] A Property specifying the number of seconds behind of the object to show. - * @param {Property} [options.width=1.0] A numeric Property specifying the width in pixels. - * @param {Property} [options.resolution=60] A numeric Property specifying the maximum number of seconds to step when sampling the position. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to draw the path. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this path will be displayed. + * @param {PathGraphics.ConstructorOptions} [options] Object describing initialization options */ function PathGraphics(options) { this._definitionChanged = new Event(); @@ -56,7 +63,7 @@ Object.defineProperties(PathGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the path. * @memberof PathGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -64,21 +71,21 @@ Object.defineProperties(PathGraphics.prototype, { /** * Gets or sets the Property specifying the number of seconds in front of the object to show. * @memberof PathGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ leadTime: createPropertyDescriptor("leadTime"), /** * Gets or sets the Property specifying the number of seconds behind the object to show. * @memberof PathGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ trailTime: createPropertyDescriptor("trailTime"), /** * Gets or sets the numeric Property specifying the width in pixels. * @memberof PathGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ width: createPropertyDescriptor("width"), @@ -86,7 +93,7 @@ Object.defineProperties(PathGraphics.prototype, { /** * Gets or sets the Property specifying the maximum number of seconds to step when sampling the position. * @memberof PathGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 60 */ resolution: createPropertyDescriptor("resolution"), @@ -102,7 +109,7 @@ Object.defineProperties(PathGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this path will be displayed. * @memberof PathGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" diff --git a/Source/DataSources/PlaneGraphics.js b/Source/DataSources/PlaneGraphics.js index 3cd6e2a33f54..2745da6a6661 100644 --- a/Source/DataSources/PlaneGraphics.js +++ b/Source/DataSources/PlaneGraphics.js @@ -5,23 +5,30 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} PlaneGraphics.ConstructorOptions + * + * Initialization options for the PlaneGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the plane. + * @property {Property | Plane} [plane] A {@link Plane} Property specifying the normal and distance for the plane. + * @property {Property | Cartesian2} [dimensions] A {@link Cartesian2} Property specifying the width and height of the plane. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the plane is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the plane. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the plane is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the plane casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this plane will be displayed. + */ + /** * Describes a plane. The center position and orientation are determined by the containing {@link Entity}. * * @alias PlaneGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the plane. - * @param {Property} [options.plane] A {@link Plane} Property specifying the normal and distance for the plane. - * @param {Property} [options.dimensions] A {@link Cartesian2} Property specifying the width and height of the plane. - * @param {Property} [options.fill=true] A boolean Property specifying whether the plane is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the plane. - * @param {Property} [options.outline=false] A boolean Property specifying whether the plane is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the plane casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this plane will be displayed. + * @param {PlaneGraphics.ConstructorOptions} [options] Object describing initialization options * * @demo {@link https://sandcastle.cesium.com/index.html?src=Plane.html|Cesium Sandcastle Plane Demo} */ @@ -67,7 +74,7 @@ Object.defineProperties(PlaneGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the plane. * @memberof PlaneGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -76,7 +83,7 @@ Object.defineProperties(PlaneGraphics.prototype, { * Gets or sets the {@link Plane} Property specifying the normal and distance of the plane. * * @memberof PlaneGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ plane: createPropertyDescriptor("plane"), @@ -84,14 +91,14 @@ Object.defineProperties(PlaneGraphics.prototype, { * Gets or sets the {@link Cartesian2} Property specifying the width and height of the plane. * * @memberof PlaneGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ dimensions: createPropertyDescriptor("dimensions"), /** * Gets or sets the boolean Property specifying whether the plane is filled with the provided material. * @memberof PlaneGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -107,7 +114,7 @@ Object.defineProperties(PlaneGraphics.prototype, { /** * Gets or sets the Property specifying whether the plane is outlined. * @memberof PlaneGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -115,7 +122,7 @@ Object.defineProperties(PlaneGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof PlaneGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -123,7 +130,7 @@ Object.defineProperties(PlaneGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof PlaneGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -132,7 +139,7 @@ Object.defineProperties(PlaneGraphics.prototype, { * Get or sets the enum Property specifying whether the plane * casts or receives shadows from light sources. * @memberof PlaneGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -140,7 +147,7 @@ Object.defineProperties(PlaneGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this plane will be displayed. * @memberof PlaneGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" diff --git a/Source/DataSources/PointGraphics.js b/Source/DataSources/PointGraphics.js index 3df09de18218..982d86906ff8 100644 --- a/Source/DataSources/PointGraphics.js +++ b/Source/DataSources/PointGraphics.js @@ -4,23 +4,30 @@ import DeveloperError from "../Core/DeveloperError.js"; import Event from "../Core/Event.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} PointGraphics.ConstructorOptions + * + * Initialization options for the PointGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the point. + * @property {Property | number} [pixelSize=1] A numeric Property specifying the size in pixels. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to. + * @property {Property | Color} [color=Color.WHITE] A Property specifying the {@link Color} of the point. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=0] A numeric Property specifying the the outline width in pixels. + * @property {Property | NearFarScalar} [scaleByDistance] A {@link NearFarScalar} Property used to scale the point based on distance. + * @property {Property | NearFarScalar} [translucencyByDistance] A {@link NearFarScalar} Property used to set translucency based on distance from the camera. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this point will be displayed. + * @property {Property | number} [disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to. + */ + /** * Describes a graphical point located at the position of the containing {@link Entity}. * * @alias PointGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the point. - * @param {Property} [options.pixelSize=1] A numeric Property specifying the size in pixels. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to. - * @param {Property} [options.color=Color.WHITE] A Property specifying the {@link Color} of the point. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=0] A numeric Property specifying the the outline width in pixels. - * @param {Property} [options.scaleByDistance] A {@link NearFarScalar} Property used to scale the point based on distance. - * @param {Property} [options.translucencyByDistance] A {@link NearFarScalar} Property used to set translucency based on distance from the camera. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this point will be displayed. - * @param {Property} [options.disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to. + * @param {PointGraphics.ConstructorOptions} [options] Object describing initialization options */ function PointGraphics(options) { this._definitionChanged = new Event(); @@ -65,7 +72,7 @@ Object.defineProperties(PointGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the point. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -73,7 +80,7 @@ Object.defineProperties(PointGraphics.prototype, { /** * Gets or sets the numeric Property specifying the size in pixels. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1 */ pixelSize: createPropertyDescriptor("pixelSize"), @@ -81,7 +88,7 @@ Object.defineProperties(PointGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -89,7 +96,7 @@ Object.defineProperties(PointGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the point. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.WHITE */ color: createPropertyDescriptor("color"), @@ -97,7 +104,7 @@ Object.defineProperties(PointGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -105,7 +112,7 @@ Object.defineProperties(PointGraphics.prototype, { /** * Gets or sets the numeric Property specifying the the outline width in pixels. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -114,25 +121,25 @@ Object.defineProperties(PointGraphics.prototype, { * Gets or sets the {@link NearFarScalar} Property used to scale the point based on distance. * If undefined, a constant size is used. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ scaleByDistance: createPropertyDescriptor("scaleByDistance"), /** * Gets or sets {@link NearFarScalar} Property specifying the translucency of the point based on the distance from the camera. * A point's translucency will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the points's translucency remains clamped to the nearest bound. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ translucencyByDistance: createPropertyDescriptor("translucencyByDistance"), /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this point will be displayed. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" @@ -142,7 +149,7 @@ Object.defineProperties(PointGraphics.prototype, { * Gets or sets the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain. * When set to zero, the depth test is always applied. When set to Number.POSITIVE_INFINITY, the depth test is never applied. * @memberof PointGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ disableDepthTestDistance: createPropertyDescriptor( "disableDepthTestDistance" diff --git a/Source/DataSources/PolygonGraphics.js b/Source/DataSources/PolygonGraphics.js index 2650b8e9dc39..fb813e568dca 100644 --- a/Source/DataSources/PolygonGraphics.js +++ b/Source/DataSources/PolygonGraphics.js @@ -15,6 +15,34 @@ function createPolygonHierarchyProperty(value) { return new ConstantProperty(value); } +/** + * @typedef {Object} PolygonGraphics.ConstructorOptions + * + * Initialization options for the PolygonGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the polygon. + * @property {Property | PolygonHierarchy} [hierarchy] A Property specifying the {@link PolygonHierarchy}. + * @property {Property | number} [height=0] A numeric Property specifying the altitude of the polygon relative to the ellipsoid surface. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to. + * @property {Property | number} [extrudedHeight] A numeric Property specifying the altitude of the polygon's extruded face relative to the ellipsoid surface. + * @property {Property | HeightReference} [extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to. + * @property {Property | number} [stRotation=0.0] A numeric property specifying the rotation of the polygon texture counter-clockwise from north. + * @property {Property | number} [granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude point. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the polygon is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the polygon. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the polygon is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | boolean} [perPositionHeight=false] A boolean specifying whether or not the height of each position is used. + * @property {Boolean | boolean} [closeTop=true] When false, leaves off the top of an extruded polygon open. + * @property {Boolean | boolean} [closeBottom=true] When false, leaves off the bottom of an extruded polygon open. + * @property {Property | ArcType} [arcType=ArcType.GEODESIC] The type of line the polygon edges must follow. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the polygon casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this polygon will be displayed. + * @property {Property | ClassificationType} [classificationType=ClassificationType.BOTH] An enum Property specifying whether this polygon will classify terrain, 3D Tiles, or both when on the ground. + * @property {ConstantProperty | number} [zIndex=0] A property specifying the zIndex used for ordering ground geometry. Only has an effect if the polygon is constant and neither height or extrudedHeight are specified. + */ + /** * Describes a polygon defined by an hierarchy of linear rings which make up the outer shape and any nested holes. * The polygon conforms to the curvature of the globe and can be placed on the surface or @@ -23,28 +51,7 @@ function createPolygonHierarchyProperty(value) { * @alias PolygonGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the polygon. - * @param {Property} [options.hierarchy] A Property specifying the {@link PolygonHierarchy}. - * @param {Property} [options.height=0] A numeric Property specifying the altitude of the polygon relative to the ellipsoid surface. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to. - * @param {Property} [options.extrudedHeight] A numeric Property specifying the altitude of the polygon's extruded face relative to the ellipsoid surface. - * @param {Property} [options.extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to. - * @param {Property} [options.stRotation=0.0] A numeric property specifying the rotation of the polygon texture counter-clockwise from north. - * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude point. - * @param {Property} [options.fill=true] A boolean Property specifying whether the polygon is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the polygon. - * @param {Property} [options.outline=false] A boolean Property specifying whether the polygon is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.perPositionHeight=false] A boolean specifying whether or not the the height of each position is used. - * @param {Boolean} [options.closeTop=true] When false, leaves off the top of an extruded polygon open. - * @param {Boolean} [options.closeBottom=true] When false, leaves off the bottom of an extruded polygon open. - * @param {Property} [options.arcType=ArcType.GEODESIC] The type of line the polygon edges must follow. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the polygon casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this polygon will be displayed. - * @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this polygon will classify terrain, 3D Tiles, or both when on the ground. - * @param {ConstantProperty} [options.zIndex=0] A property specifying the zIndex used for ordering ground geometry. Only has an effect if the polygon is constant and neither height or extrudedHeight are specified. + * @param {PolygonGraphics.ConstructorOptions} [options] Object describing initialization options * * @see Entity * @demo {@link https://sandcastle.cesium.com/index.html?src=Polygon.html|Cesium Sandcastle Polygon Demo} @@ -114,7 +121,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the polygon. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -122,7 +129,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the Property specifying the {@link PolygonHierarchy}. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ hierarchy: createPropertyDescriptor( "hierarchy", @@ -133,7 +140,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the numeric Property specifying the constant altitude of the polygon. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.0 */ height: createPropertyDescriptor("height"), @@ -141,7 +148,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -151,14 +158,14 @@ Object.defineProperties(PolygonGraphics.prototype, { * If {@link PolygonGraphics#perPositionHeight} is false, the volume starts at {@link PolygonGraphics#height} and ends at this altitude. * If {@link PolygonGraphics#perPositionHeight} is true, the volume starts at the height of each {@link PolygonGraphics#hierarchy} position and ends at this altitude. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ extrudedHeight: createPropertyDescriptor("extrudedHeight"), /** * Gets or sets the Property specifying the extruded {@link HeightReference}. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ extrudedHeightReference: createPropertyDescriptor("extrudedHeightReference"), @@ -166,7 +173,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the numeric property specifying the rotation of the polygon texture counter-clockwise from north. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0 */ stRotation: createPropertyDescriptor("stRotation"), @@ -174,7 +181,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the numeric Property specifying the angular distance between points on the polygon. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default {CesiumMath.RADIANS_PER_DEGREE} */ granularity: createPropertyDescriptor("granularity"), @@ -182,7 +189,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the polygon is filled with the provided material. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -198,7 +205,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the Property specifying whether the polygon is outlined. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -206,7 +213,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -214,7 +221,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -224,28 +231,28 @@ Object.defineProperties(PolygonGraphics.prototype, { * If true, the shape will have non-uniform altitude defined by the height of each {@link PolygonGraphics#hierarchy} position. * If false, the shape will have a constant altitude as specified by {@link PolygonGraphics#height}. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ perPositionHeight: createPropertyDescriptor("perPositionHeight"), /** * Gets or sets a boolean specifying whether or not the top of an extruded polygon is included. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ closeTop: createPropertyDescriptor("closeTop"), /** * Gets or sets a boolean specifying whether or not the bottom of an extruded polygon is included. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ closeBottom: createPropertyDescriptor("closeBottom"), /** * Gets or sets the {@link ArcType} Property specifying the type of lines the polygon edges use. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ArcType.GEODESIC */ arcType: createPropertyDescriptor("arcType"), @@ -254,7 +261,7 @@ Object.defineProperties(PolygonGraphics.prototype, { * Get or sets the enum Property specifying whether the polygon * casts or receives shadows from light sources. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -262,7 +269,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this polygon will be displayed. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" @@ -271,7 +278,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the {@link ClassificationType} Property specifying whether this polygon will classify terrain, 3D Tiles, or both when on the ground. * @memberof PolygonGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ClassificationType.BOTH */ classificationType: createPropertyDescriptor("classificationType"), @@ -279,7 +286,7 @@ Object.defineProperties(PolygonGraphics.prototype, { /** * Gets or sets the zIndex Prperty specifying the ordering of ground geometry. Only has an effect if the polygon is constant and neither height or extrudedHeight are specified. * @memberof PolygonGraphics.prototype - * @type {ConstantProperty} + * @type {ConstantProperty|undefined} * @default 0 */ zIndex: createPropertyDescriptor("zIndex"), diff --git a/Source/DataSources/PolylineArrowMaterialProperty.js b/Source/DataSources/PolylineArrowMaterialProperty.js index dbb9477d794f..cd413dce829a 100644 --- a/Source/DataSources/PolylineArrowMaterialProperty.js +++ b/Source/DataSources/PolylineArrowMaterialProperty.js @@ -7,7 +7,7 @@ import Property from "./Property.js"; /** * A {@link MaterialProperty} that maps to PolylineArrow {@link Material} uniforms. * - * @param {Property} [color=Color.WHITE] The {@link Color} Property to be used. + * @param {Property|Color} [color=Color.WHITE] The {@link Color} Property to be used. * * @alias PolylineArrowMaterialProperty * @constructor @@ -51,7 +51,7 @@ Object.defineProperties(PolylineArrowMaterialProperty.prototype, { /** * Gets or sets the {@link Color} {@link Property}. * @memberof PolylineArrowMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.WHITE */ color: createPropertyDescriptor("color"), diff --git a/Source/DataSources/PolylineDashMaterialProperty.js b/Source/DataSources/PolylineDashMaterialProperty.js index 97ae8bff5505..4165440d47f1 100644 --- a/Source/DataSources/PolylineDashMaterialProperty.js +++ b/Source/DataSources/PolylineDashMaterialProperty.js @@ -16,10 +16,10 @@ var defaultDashPattern = 255.0; * @constructor * * @param {Object} [options] Object with the following properties: - * @param {Property} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line. - * @param {Property} [options.gapColor=Color.TRANSPARENT] A Property specifying the {@link Color} of the gaps in the line. - * @param {Property} [options.dashLength=16.0] A numeric Property specifying the length of the dash pattern in pixels. - * @param {Property} [options.dashPattern=255.0] A numeric Property specifying a 16 bit pattern for the dash + * @param {Property|Color} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line. + * @param {Property|Color} [options.gapColor=Color.TRANSPARENT] A Property specifying the {@link Color} of the gaps in the line. + * @param {Property|Number} [options.dashLength=16.0] A numeric Property specifying the length of the dash pattern in pixels. + * @param {Property|Number} [options.dashPattern=255.0] A numeric Property specifying a 16 bit pattern for the dash */ function PolylineDashMaterialProperty(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -74,28 +74,28 @@ Object.defineProperties(PolylineDashMaterialProperty.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the line. * @memberof PolylineDashMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} */ color: createPropertyDescriptor("color"), /** * Gets or sets the Property specifying the {@link Color} of the gaps in the line. * @memberof PolylineDashMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} */ gapColor: createPropertyDescriptor("gapColor"), /** * Gets or sets the numeric Property specifying the length of a dash cycle * @memberof PolylineDashMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} */ dashLength: createPropertyDescriptor("dashLength"), /** * Gets or sets the numeric Property specifying a dash pattern * @memberof PolylineDashMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} */ dashPattern: createPropertyDescriptor("dashPattern"), }); diff --git a/Source/DataSources/PolylineGeometryUpdater.js b/Source/DataSources/PolylineGeometryUpdater.js index b782858b1be8..96fc87575d61 100644 --- a/Source/DataSources/PolylineGeometryUpdater.js +++ b/Source/DataSources/PolylineGeometryUpdater.js @@ -616,6 +616,7 @@ PolylineGeometryUpdater.prototype._onEntityPropertyChanged = function ( * @returns {DynamicGeometryUpdater} The dynamic updater used to update the geometry each frame. * * @exception {DeveloperError} This instance does not represent dynamic geometry. + * @private */ PolylineGeometryUpdater.prototype.createDynamicUpdater = function ( primitives, diff --git a/Source/DataSources/PolylineGlowMaterialProperty.js b/Source/DataSources/PolylineGlowMaterialProperty.js index 6bc811ed0f83..cf92ae555b60 100644 --- a/Source/DataSources/PolylineGlowMaterialProperty.js +++ b/Source/DataSources/PolylineGlowMaterialProperty.js @@ -15,9 +15,9 @@ var defaultTaperPower = 1.0; * @constructor * * @param {Object} [options] Object with the following properties: - * @param {Property} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line. - * @param {Property} [options.glowPower=0.25] A numeric Property specifying the strength of the glow, as a percentage of the total line width. - * @param {Property} [options.taperPower=1.0] A numeric Property specifying the strength of the tapering effect, as a percentage of the total line length. If 1.0 or higher, no taper effect is used. + * @param {Property|Color} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line. + * @param {Property|Number} [options.glowPower=0.25] A numeric Property specifying the strength of the glow, as a percentage of the total line width. + * @param {Property|Number} [options.taperPower=1.0] A numeric Property specifying the strength of the tapering effect, as a percentage of the total line length. If 1.0 or higher, no taper effect is used. */ function PolylineGlowMaterialProperty(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -66,21 +66,21 @@ Object.defineProperties(PolylineGlowMaterialProperty.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the line. * @memberof PolylineGlowMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} */ color: createPropertyDescriptor("color"), /** * Gets or sets the numeric Property specifying the strength of the glow, as a percentage of the total line width (less than 1.0). * @memberof PolylineGlowMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} */ glowPower: createPropertyDescriptor("glowPower"), /** * Gets or sets the numeric Property specifying the strength of the tapering effect, as a percentage of the total line length. If 1.0 or higher, no taper effect is used. * @memberof PolylineGlowMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} */ taperPower: createPropertyDescriptor("taperPower"), }); diff --git a/Source/DataSources/PolylineGraphics.js b/Source/DataSources/PolylineGraphics.js index 11338241b749..90566a523341 100644 --- a/Source/DataSources/PolylineGraphics.js +++ b/Source/DataSources/PolylineGraphics.js @@ -5,6 +5,25 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} PolylineGraphics.ConstructorOptions + * + * Initialization options for the PolylineGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the polyline. + * @property {Property | Array} [positions] A Property specifying the array of {@link Cartesian3} positions that define the line strip. + * @property {Property | number} [width=1.0] A numeric Property specifying the width in pixels. + * @property {Property | number} [granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude if arcType is not ArcType.NONE. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to draw the polyline. + * @property {MaterialProperty | Color} [depthFailMaterial] A property specifying the material used to draw the polyline when it is below the terrain. + * @property {Property | ArcType} [arcType=ArcType.GEODESIC] The type of line the polyline segments must follow. + * @property {Property | boolean} [clampToGround=false] A boolean Property specifying whether the Polyline should be clamped to the ground. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the polyline casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this polyline will be displayed. + * @property {Property | ClassificationType} [classificationType=ClassificationType.BOTH] An enum Property specifying whether this polyline will classify terrain, 3D Tiles, or both when on the ground. + * @property {Property | number} [zIndex=0] A Property specifying the zIndex used for ordering ground geometry. Only has an effect if `clampToGround` is true and polylines on terrain is supported. + */ + /** * Describes a polyline. The first two positions define a line segment, * and each additional position defines a line segment from the previous position. The segments @@ -13,19 +32,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias PolylineGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the polyline. - * @param {Property} [options.positions] A Property specifying the array of {@link Cartesian3} positions that define the line strip. - * @param {Property} [options.width=1.0] A numeric Property specifying the width in pixels. - * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude if arcType is not ArcType.NONE. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to draw the polyline. - * @param {MaterialProperty} [options.depthFailMaterial] A property specifying the material used to draw the polyline when it is below the terrain. - * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of line the polyline segments must follow. - * @param {Property} [options.clampToGround=false] A boolean Property specifying whether the Polyline should be clamped to the ground. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the polyline casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this polyline will be displayed. - * @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this polyline will classify terrain, 3D Tiles, or both when on the ground. - * @param {Property} [options.zIndex=0] A Property specifying the zIndex used for ordering ground geometry. Only has an effect if `clampToGround` is true and polylines on terrain is supported. + * @param {PolylineGraphics.ConstructorOptions} [options] Object describing initialization options * * @see Entity * @demo {@link https://sandcastle.cesium.com/index.html?src=Polyline.html|Cesium Sandcastle Polyline Demo} @@ -77,7 +84,7 @@ Object.defineProperties(PolylineGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the polyline. * @memberof PolylineGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -86,14 +93,14 @@ Object.defineProperties(PolylineGraphics.prototype, { * Gets or sets the Property specifying the array of {@link Cartesian3} * positions that define the line strip. * @memberof PolylineGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ positions: createPropertyDescriptor("positions"), /** * Gets or sets the numeric Property specifying the width in pixels. * @memberof PolylineGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ width: createPropertyDescriptor("width"), @@ -101,7 +108,7 @@ Object.defineProperties(PolylineGraphics.prototype, { /** * Gets or sets the numeric Property specifying the angular distance between each latitude and longitude if arcType is not ArcType.NONE and clampToGround is false. * @memberof PolylineGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Cesium.Math.RADIANS_PER_DEGREE */ granularity: createPropertyDescriptor("granularity"), @@ -129,7 +136,7 @@ Object.defineProperties(PolylineGraphics.prototype, { /** * Gets or sets the {@link ArcType} Property specifying whether the line segments should be great arcs, rhumb lines or linearly connected. * @memberof PolylineGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ArcType.GEODESIC */ arcType: createPropertyDescriptor("arcType"), @@ -138,7 +145,7 @@ Object.defineProperties(PolylineGraphics.prototype, { * Gets or sets the boolean Property specifying whether the polyline * should be clamped to the ground. * @memberof PolylineGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ clampToGround: createPropertyDescriptor("clampToGround"), @@ -147,7 +154,7 @@ Object.defineProperties(PolylineGraphics.prototype, { * Get or sets the enum Property specifying whether the polyline * casts or receives shadows from light sources. * @memberof PolylineGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -155,7 +162,7 @@ Object.defineProperties(PolylineGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this polyline will be displayed. * @memberof PolylineGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" @@ -164,7 +171,7 @@ Object.defineProperties(PolylineGraphics.prototype, { /** * Gets or sets the {@link ClassificationType} Property specifying whether this polyline will classify terrain, 3D Tiles, or both when on the ground. * @memberof PolylineGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ClassificationType.BOTH */ classificationType: createPropertyDescriptor("classificationType"), @@ -172,7 +179,7 @@ Object.defineProperties(PolylineGraphics.prototype, { /** * Gets or sets the zIndex Property specifying the ordering of the polyline. Only has an effect if `clampToGround` is true and polylines on terrain is supported. * @memberof PolylineGraphics.prototype - * @type {ConstantProperty} + * @type {ConstantProperty|undefined} * @default 0 */ zIndex: createPropertyDescriptor("zIndex"), diff --git a/Source/DataSources/PolylineOutlineMaterialProperty.js b/Source/DataSources/PolylineOutlineMaterialProperty.js index b59dba3310a0..7f93571f9689 100644 --- a/Source/DataSources/PolylineOutlineMaterialProperty.js +++ b/Source/DataSources/PolylineOutlineMaterialProperty.js @@ -15,9 +15,9 @@ var defaultOutlineWidth = 1.0; * @constructor * * @param {Object} [options] Object with the following properties: - * @param {Property} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline, in pixels. + * @param {Property|Color} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line. + * @param {Property|Color} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @param {Property|Number} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline, in pixels. */ function PolylineOutlineMaterialProperty(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -70,7 +70,7 @@ Object.defineProperties(PolylineOutlineMaterialProperty.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the line. * @memberof PolylineOutlineMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.WHITE */ color: createPropertyDescriptor("color"), @@ -78,7 +78,7 @@ Object.defineProperties(PolylineOutlineMaterialProperty.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof PolylineOutlineMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -86,7 +86,7 @@ Object.defineProperties(PolylineOutlineMaterialProperty.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof PolylineOutlineMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), diff --git a/Source/DataSources/PolylineVolumeGraphics.js b/Source/DataSources/PolylineVolumeGraphics.js index 541e5b8892b7..103da05c7dad 100644 --- a/Source/DataSources/PolylineVolumeGraphics.js +++ b/Source/DataSources/PolylineVolumeGraphics.js @@ -5,6 +5,25 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} PolylineVolumeGraphics.ConstructorOptions + * + * Initialization options for the PolylineVolumeGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the volume. + * @property {Property | Array} [positions] A Property specifying the array of {@link Cartesian3} positions which define the line strip. + * @property {Property | Array} [shape] A Property specifying the array of {@link Cartesian2} positions which define the shape to be extruded. + * @property {Property | CornerType} [cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners. + * @property {Property | number} [granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude point. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the volume is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the volume. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the volume is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the volume casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this volume will be displayed. + */ + /** * Describes a polyline volume defined as a line strip and corresponding two dimensional shape which is extruded along it. * The resulting volume conforms to the curvature of the globe. @@ -12,19 +31,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias PolylineVolumeGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the volume. - * @param {Property} [options.positions] A Property specifying the array of {@link Cartesian3} positions which define the line strip. - * @param {Property} [options.shape] A Property specifying the array of {@link Cartesian2} positions which define the shape to be extruded. - * @param {Property} [options.cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners. - * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude point. - * @param {Property} [options.fill=true] A boolean Property specifying whether the volume is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the volume. - * @param {Property} [options.outline=false] A boolean Property specifying whether the volume is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the volume casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this volume will be displayed. + * @param {PolylineVolumeGraphics.ConstructorOptions} [options] Object describing initialization options * * @see Entity * @demo {@link https://sandcastle.cesium.com/index.html?src=Polyline%20Volume.html|Cesium Sandcastle Polyline Volume Demo} @@ -76,7 +83,7 @@ Object.defineProperties(PolylineVolumeGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the volume. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -84,21 +91,21 @@ Object.defineProperties(PolylineVolumeGraphics.prototype, { /** * Gets or sets the Property specifying the array of {@link Cartesian3} positions which define the line strip. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ positions: createPropertyDescriptor("positions"), /** * Gets or sets the Property specifying the array of {@link Cartesian2} positions which define the shape to be extruded. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ shape: createPropertyDescriptor("shape"), /** * Gets or sets the {@link CornerType} Property specifying the style of the corners. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default CornerType.ROUNDED */ cornerType: createPropertyDescriptor("cornerType"), @@ -106,7 +113,7 @@ Object.defineProperties(PolylineVolumeGraphics.prototype, { /** * Gets or sets the numeric Property specifying the angular distance between points on the volume. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default {CesiumMath.RADIANS_PER_DEGREE} */ granularity: createPropertyDescriptor("granularity"), @@ -114,7 +121,7 @@ Object.defineProperties(PolylineVolumeGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the volume is filled with the provided material. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -130,7 +137,7 @@ Object.defineProperties(PolylineVolumeGraphics.prototype, { /** * Gets or sets the Property specifying whether the volume is outlined. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -138,7 +145,7 @@ Object.defineProperties(PolylineVolumeGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -146,7 +153,7 @@ Object.defineProperties(PolylineVolumeGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -155,7 +162,7 @@ Object.defineProperties(PolylineVolumeGraphics.prototype, { * Get or sets the enum Property specifying whether the volume * casts or receives shadows from light sources. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -163,7 +170,7 @@ Object.defineProperties(PolylineVolumeGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this volume will be displayed. * @memberof PolylineVolumeGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" diff --git a/Source/DataSources/PositionPropertyArray.js b/Source/DataSources/PositionPropertyArray.js index b4c04259f138..1067d4914735 100644 --- a/Source/DataSources/PositionPropertyArray.js +++ b/Source/DataSources/PositionPropertyArray.js @@ -7,7 +7,7 @@ import ReferenceFrame from "../Core/ReferenceFrame.js"; import Property from "./Property.js"; /** - * A {@link PositionProperty} whose value is an array whose items are the computed value + * A {@link Property} whose value is an array whose items are the computed value * of other PositionProperty instances. * * @alias PositionPropertyArray diff --git a/Source/DataSources/PropertyBag.js b/Source/DataSources/PropertyBag.js index 4d356a462df2..688053f4c7ae 100644 --- a/Source/DataSources/PropertyBag.js +++ b/Source/DataSources/PropertyBag.js @@ -11,6 +11,7 @@ import Property from "./Property.js"; * * @alias PropertyBag * @constructor + * @implements {DictionaryLike} * * @param {Object} [value] An object, containing key-value mapping of property names to properties. * @param {Function} [createPropertyCallback] A function that will be called when the value of any of the properties in value are not a Property. diff --git a/Source/DataSources/RectangleGraphics.js b/Source/DataSources/RectangleGraphics.js index fa553282f7d2..d5423e713b87 100644 --- a/Source/DataSources/RectangleGraphics.js +++ b/Source/DataSources/RectangleGraphics.js @@ -5,6 +5,31 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} RectangleGraphics.ConstructorOptions + * + * Initialization options for the RectangleGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the rectangle. + * @property {Property | Rectangle} [coordinates] The Property specifying the {@link Rectangle}. + * @property {Property | number} [height=0] A numeric Property specifying the altitude of the rectangle relative to the ellipsoid surface. + * @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to. + * @property {Property | number} [extrudedHeight] A numeric Property specifying the altitude of the rectangle's extruded face relative to the ellipsoid surface. + * @property {Property | HeightReference} [extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to. + * @property {Property | number} [rotation=0.0] A numeric property specifying the rotation of the rectangle clockwise from north. + * @property {Property | number} [stRotation=0.0] A numeric property specifying the rotation of the rectangle texture counter-clockwise from north. + * @property {Property | number} [granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between points on the rectangle. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the rectangle is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the rectangle. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the rectangle is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the rectangle casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this rectangle will be displayed. + * @property {Property | ClassificationType} [classificationType=ClassificationType.BOTH] An enum Property specifying whether this rectangle will classify terrain, 3D Tiles, or both when on the ground. + * @property {Property | number} [zIndex=0] A Property specifying the zIndex used for ordering ground geometry. Only has an effect if the rectangle is constant and neither height or extrudedHeight are specified. + */ + /** * Describes graphics for a {@link Rectangle}. * The rectangle conforms to the curvature of the globe and can be placed on the surface or @@ -13,25 +38,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias RectangleGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the rectangle. - * @param {Property} [options.coordinates] The Property specifying the {@link Rectangle}. - * @param {Property} [options.height=0] A numeric Property specifying the altitude of the rectangle relative to the ellipsoid surface. - * @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to. - * @param {Property} [options.extrudedHeight] A numeric Property specifying the altitude of the rectangle's extruded face relative to the ellipsoid surface. - * @param {Property} [options.extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to. - * @param {Property} [options.rotation=0.0] A numeric property specifying the rotation of the rectangle clockwise from north. - * @param {Property} [options.stRotation=0.0] A numeric property specifying the rotation of the rectangle texture counter-clockwise from north. - * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between points on the rectangle. - * @param {Property} [options.fill=true] A boolean Property specifying whether the rectangle is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the rectangle. - * @param {Property} [options.outline=false] A boolean Property specifying whether the rectangle is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the rectangle casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this rectangle will be displayed. - * @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this rectangle will classify terrain, 3D Tiles, or both when on the ground. - * @param {Property} [options.zIndex=0] A Property specifying the zIndex used for ordering ground geometry. Only has an effect if the rectangle is constant and neither height or extrudedHeight are specified. + * @param {RectangleGraphics.ConstructorOptions} [options] Object describing initialization options * * @see Entity * @demo {@link https://sandcastle.cesium.com/index.html?src=Rectangle.html|Cesium Sandcastle Rectangle Demo} @@ -95,7 +102,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the rectangle. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -103,14 +110,14 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Rectangle}. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ coordinates: createPropertyDescriptor("coordinates"), /** * Gets or sets the numeric Property specifying the altitude of the rectangle. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.0 */ height: createPropertyDescriptor("height"), @@ -118,7 +125,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the Property specifying the {@link HeightReference}. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ heightReference: createPropertyDescriptor("heightReference"), @@ -127,14 +134,14 @@ Object.defineProperties(RectangleGraphics.prototype, { * Gets or sets the numeric Property specifying the altitude of the rectangle extrusion. * Setting this property creates volume starting at height and ending at this altitude. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ extrudedHeight: createPropertyDescriptor("extrudedHeight"), /** * Gets or sets the Property specifying the extruded {@link HeightReference}. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default HeightReference.NONE */ extrudedHeightReference: createPropertyDescriptor("extrudedHeightReference"), @@ -142,7 +149,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the numeric property specifying the rotation of the rectangle clockwise from north. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0 */ rotation: createPropertyDescriptor("rotation"), @@ -150,7 +157,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the numeric property specifying the rotation of the rectangle texture counter-clockwise from north. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 0 */ stRotation: createPropertyDescriptor("stRotation"), @@ -158,7 +165,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the numeric Property specifying the angular distance between points on the rectangle. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default {CesiumMath.RADIANS_PER_DEGREE} */ granularity: createPropertyDescriptor("granularity"), @@ -166,7 +173,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the rectangle is filled with the provided material. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -182,7 +189,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the Property specifying whether the rectangle is outlined. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -190,7 +197,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -198,7 +205,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -207,7 +214,7 @@ Object.defineProperties(RectangleGraphics.prototype, { * Get or sets the enum Property specifying whether the rectangle * casts or receives shadows from light sources. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -215,7 +222,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this rectangle will be displayed. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" @@ -224,7 +231,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the {@link ClassificationType} Property specifying whether this rectangle will classify terrain, 3D Tiles, or both when on the ground. * @memberof RectangleGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ClassificationType.BOTH */ classificationType: createPropertyDescriptor("classificationType"), @@ -232,7 +239,7 @@ Object.defineProperties(RectangleGraphics.prototype, { /** * Gets or sets the zIndex Property specifying the ordering of the rectangle. Only has an effect if the rectangle is constant and neither height or extrudedHeight are specified. * @memberof RectangleGraphics.prototype - * @type {ConstantProperty} + * @type {ConstantProperty|undefined} * @default 0 */ zIndex: createPropertyDescriptor("zIndex"), diff --git a/Source/DataSources/ReferenceProperty.js b/Source/DataSources/ReferenceProperty.js index 6800b16eb181..d658f1521e59 100644 --- a/Source/DataSources/ReferenceProperty.js +++ b/Source/DataSources/ReferenceProperty.js @@ -191,7 +191,7 @@ Object.defineProperties(ReferenceProperty.prototype, { /** * Gets the resolved instance of the underlying referenced property. * @memberof ReferenceProperty.prototype - * @type {Property} + * @type {Property|undefined} * @readonly */ resolvedProperty: { diff --git a/Source/DataSources/Rotation.js b/Source/DataSources/Rotation.js index 42aa8dbc8883..8273f8d1a3aa 100755 --- a/Source/DataSources/Rotation.js +++ b/Source/DataSources/Rotation.js @@ -9,7 +9,7 @@ import CesiumMath from "../Core/Math.js"; * but is instead passed to the constructor of {@link SampledProperty} * in order to represent a two-dimensional angle of rotation. * - * @exports Rotation + * @interface Rotation * * * @example @@ -87,7 +87,7 @@ var Rotation = { * @param {Number[]} packedArray The packed array. * @param {Number} [startingIndex=0] The index of the first element to be converted. * @param {Number} [lastIndex=packedArray.length] The index of the last element to be converted. - * @param {Number[]} result The object into which to store the result. + * @param {Number[]} [result] The object into which to store the result. */ convertPackedArrayForInterpolation: function ( packedArray, @@ -101,6 +101,10 @@ var Rotation = { } //>>includeEnd('debug'); + if (!defined(result)) { + result = []; + } + startingIndex = defaultValue(startingIndex, 0); lastIndex = defaultValue(lastIndex, packedArray.length); diff --git a/Source/DataSources/SampledPositionProperty.js b/Source/DataSources/SampledPositionProperty.js index e644b82d497d..9a239a6f94ab 100644 --- a/Source/DataSources/SampledPositionProperty.js +++ b/Source/DataSources/SampledPositionProperty.js @@ -108,8 +108,8 @@ Object.defineProperties(SampledPositionProperty.prototype, { * The number of derivatives contained by this property; i.e. 0 for just position, 1 for velocity, etc. * @memberof SampledPositionProperty.prototype * - * @type {Boolean} - * @default false + * @type {Number} + * @default 0 */ numberOfDerivatives: { get: function () { diff --git a/Source/DataSources/StripeMaterialProperty.js b/Source/DataSources/StripeMaterialProperty.js index 9da8226bb106..0bec4de51be6 100644 --- a/Source/DataSources/StripeMaterialProperty.js +++ b/Source/DataSources/StripeMaterialProperty.js @@ -18,11 +18,11 @@ var defaultRepeat = 1; * @constructor * * @param {Object} [options] Object with the following properties: - * @param {Property} [options.orientation=StripeOrientation.HORIZONTAL] A Property specifying the {@link StripeOrientation}. - * @param {Property} [options.evenColor=Color.WHITE] A Property specifying the first {@link Color}. - * @param {Property} [options.oddColor=Color.BLACK] A Property specifying the second {@link Color}. - * @param {Property} [options.offset=0] A numeric Property specifying how far into the pattern to start the material. - * @param {Property} [options.repeat=1] A numeric Property specifying how many times the stripes repeat. + * @param {Property|StripeOrientation} [options.orientation=StripeOrientation.HORIZONTAL] A Property specifying the {@link StripeOrientation}. + * @param {Property|Color} [options.evenColor=Color.WHITE] A Property specifying the first {@link Color}. + * @param {Property|Color} [options.oddColor=Color.BLACK] A Property specifying the second {@link Color}. + * @param {Property|Number} [options.offset=0] A numeric Property specifying how far into the pattern to start the material. + * @param {Property|Number} [options.repeat=1] A numeric Property specifying how many times the stripes repeat. */ function StripeMaterialProperty(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -84,7 +84,7 @@ Object.defineProperties(StripeMaterialProperty.prototype, { /** * Gets or sets the Property specifying the {@link StripeOrientation}/ * @memberof StripeMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default StripeOrientation.HORIZONTAL */ orientation: createPropertyDescriptor("orientation"), @@ -92,7 +92,7 @@ Object.defineProperties(StripeMaterialProperty.prototype, { /** * Gets or sets the Property specifying the first {@link Color}. * @memberof StripeMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.WHITE */ evenColor: createPropertyDescriptor("evenColor"), @@ -100,7 +100,7 @@ Object.defineProperties(StripeMaterialProperty.prototype, { /** * Gets or sets the Property specifying the second {@link Color}. * @memberof StripeMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ oddColor: createPropertyDescriptor("oddColor"), @@ -111,7 +111,7 @@ Object.defineProperties(StripeMaterialProperty.prototype, { * of the odd color, 2.0 being the even color again, and any multiple or fractional values * being in between. * @memberof StripeMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default 0.0 */ offset: createPropertyDescriptor("offset"), @@ -119,7 +119,7 @@ Object.defineProperties(StripeMaterialProperty.prototype, { /** * Gets or sets the numeric Property specifying how many times the stripes repeat. * @memberof StripeMaterialProperty.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ repeat: createPropertyDescriptor("repeat"), diff --git a/Source/DataSources/StripeOrientation.js b/Source/DataSources/StripeOrientation.js index aed7c398e134..c2da3b8f8810 100644 --- a/Source/DataSources/StripeOrientation.js +++ b/Source/DataSources/StripeOrientation.js @@ -1,7 +1,7 @@ /** * Defined the orientation of stripes in {@link StripeMaterialProperty}. * - * @exports StripeOrientation + * @enum {Number} */ var StripeOrientation = { /** diff --git a/Source/DataSources/TerrainOffsetProperty.js b/Source/DataSources/TerrainOffsetProperty.js index dc6d4d89f48d..ed9c22e13723 100644 --- a/Source/DataSources/TerrainOffsetProperty.js +++ b/Source/DataSources/TerrainOffsetProperty.js @@ -238,7 +238,7 @@ TerrainOffsetProperty.prototype.destroy = function () { /** * A function which creates one or more providers. - * @callback TerrainOffsetProperty~PositionFunction + * @callback TerrainOffsetProperty.PositionFunction * @param {JulianDate} time The clock time at which to retrieve the position * @param {Cartesian3} result The result position * @returns {Cartesian3} The position at which to do the terrain height check diff --git a/Source/DataSources/VelocityOrientationProperty.js b/Source/DataSources/VelocityOrientationProperty.js index 450b7864d7b4..78c49d7c647c 100644 --- a/Source/DataSources/VelocityOrientationProperty.js +++ b/Source/DataSources/VelocityOrientationProperty.js @@ -16,7 +16,7 @@ import VelocityVectorProperty from "./VelocityVectorProperty.js"; * @alias VelocityOrientationProperty * @constructor * - * @param {Property} [position] The position property used to compute the orientation. + * @param {PositionProperty} [position] The position property used to compute the orientation. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid used to determine which way is up. * * @example @@ -71,7 +71,7 @@ Object.defineProperties(VelocityOrientationProperty.prototype, { * Gets or sets the position property used to compute orientation. * @memberof VelocityOrientationProperty.prototype * - * @type {Property} + * @type {Property|undefined} */ position: { get: function () { @@ -85,7 +85,7 @@ Object.defineProperties(VelocityOrientationProperty.prototype, { * Gets or sets the ellipsoid used to determine which way is up. * @memberof VelocityOrientationProperty.prototype * - * @type {Property} + * @type {Property|undefined} */ ellipsoid: { get: function () { diff --git a/Source/DataSources/VelocityVectorProperty.js b/Source/DataSources/VelocityVectorProperty.js index f6c719369133..b5506059e849 100644 --- a/Source/DataSources/VelocityVectorProperty.js +++ b/Source/DataSources/VelocityVectorProperty.js @@ -13,7 +13,7 @@ import Property from "./Property.js"; * @alias VelocityVectorProperty * @constructor * - * @param {Property} [position] The position property used to compute the velocity. + * @param {PositionProperty} [position] The position property used to compute the velocity. * @param {Boolean} [normalize=true] Whether to normalize the computed velocity vector. * * @example @@ -66,7 +66,7 @@ Object.defineProperties(VelocityVectorProperty.prototype, { * Gets or sets the position property used to compute the velocity vector. * @memberof VelocityVectorProperty.prototype * - * @type {Property} + * @type {Property|undefined} */ position: { get: function () { diff --git a/Source/DataSources/WallGraphics.js b/Source/DataSources/WallGraphics.js index d0ce102b0a16..8ad9f13bcf8b 100644 --- a/Source/DataSources/WallGraphics.js +++ b/Source/DataSources/WallGraphics.js @@ -5,6 +5,25 @@ import Event from "../Core/Event.js"; import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js"; import createPropertyDescriptor from "./createPropertyDescriptor.js"; +/** + * @typedef {Object} WallGraphics.ConstructorOptions + * + * Initialization options for the WallGraphics constructor + * + * @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the wall. + * @property {Property | Array} [positions] A Property specifying the array of {@link Cartesian3} positions which define the top of the wall. + * @property {Property | Array} [minimumHeights] A Property specifying an array of heights to be used for the bottom of the wall instead of the globe surface. + * @property {Property | Array} [maximumHeights] A Property specifying an array of heights to be used for the top of the wall instead of the height of each position. + * @property {Property | number} [granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude point. + * @property {Property | boolean} [fill=true] A boolean Property specifying whether the wall is filled with the provided material. + * @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the wall. + * @property {Property | boolean} [outline=false] A boolean Property specifying whether the wall is outlined. + * @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. + * @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the wall casts or receives shadows from light sources. + * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this wall will be displayed. + */ + /** * Describes a two dimensional wall defined as a line strip and optional maximum and minimum heights. * The wall conforms to the curvature of the globe and can be placed along the surface or at altitude. @@ -12,19 +31,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js"; * @alias WallGraphics * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {Property} [options.show=true] A boolean Property specifying the visibility of the wall. - * @param {Property} [options.positions] A Property specifying the array of {@link Cartesian3} positions which define the top of the wall. - * @param {Property} [options.minimumHeights] A Property specifying an array of heights to be used for the bottom of the wall instead of the globe surface. - * @param {Property} [options.maximumHeights] A Property specifying an array of heights to be used for the top of the wall instead of the height of each position. - * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude point. - * @param {Property} [options.fill=true] A boolean Property specifying whether the wall is filled with the provided material. - * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the wall. - * @param {Property} [options.outline=false] A boolean Property specifying whether the wall is outlined. - * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. - * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. - * @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the wall casts or receives shadows from light sources. - * @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this wall will be displayed. + * @param {WallGraphics.ConstructorOptions} [options] Object describing initialization options * * @see Entity * @demo {@link https://sandcastle.cesium.com/index.html?src=Wall.html|Cesium Sandcastle Wall Demo} @@ -76,7 +83,7 @@ Object.defineProperties(WallGraphics.prototype, { /** * Gets or sets the boolean Property specifying the visibility of the wall. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ show: createPropertyDescriptor("show"), @@ -84,7 +91,7 @@ Object.defineProperties(WallGraphics.prototype, { /** * Gets or sets the Property specifying the array of {@link Cartesian3} positions which define the top of the wall. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ positions: createPropertyDescriptor("positions"), @@ -92,7 +99,7 @@ Object.defineProperties(WallGraphics.prototype, { * Gets or sets the Property specifying an array of heights to be used for the bottom of the wall instead of the surface of the globe. * If defined, the array must be the same length as {@link Wall#positions}. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ minimumHeights: createPropertyDescriptor("minimumHeights"), @@ -100,14 +107,14 @@ Object.defineProperties(WallGraphics.prototype, { * Gets or sets the Property specifying an array of heights to be used for the top of the wall instead of the height of each position. * If defined, the array must be the same length as {@link Wall#positions}. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ maximumHeights: createPropertyDescriptor("maximumHeights"), /** * Gets or sets the numeric Property specifying the angular distance between points on the wall. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default {CesiumMath.RADIANS_PER_DEGREE} */ granularity: createPropertyDescriptor("granularity"), @@ -115,7 +122,7 @@ Object.defineProperties(WallGraphics.prototype, { /** * Gets or sets the boolean Property specifying whether the wall is filled with the provided material. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default true */ fill: createPropertyDescriptor("fill"), @@ -131,7 +138,7 @@ Object.defineProperties(WallGraphics.prototype, { /** * Gets or sets the Property specifying whether the wall is outlined. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default false */ outline: createPropertyDescriptor("outline"), @@ -139,7 +146,7 @@ Object.defineProperties(WallGraphics.prototype, { /** * Gets or sets the Property specifying the {@link Color} of the outline. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default Color.BLACK */ outlineColor: createPropertyDescriptor("outlineColor"), @@ -147,7 +154,7 @@ Object.defineProperties(WallGraphics.prototype, { /** * Gets or sets the numeric Property specifying the width of the outline. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default 1.0 */ outlineWidth: createPropertyDescriptor("outlineWidth"), @@ -156,7 +163,7 @@ Object.defineProperties(WallGraphics.prototype, { * Get or sets the enum Property specifying whether the wall * casts or receives shadows from light sources. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} * @default ShadowMode.DISABLED */ shadows: createPropertyDescriptor("shadows"), @@ -164,7 +171,7 @@ Object.defineProperties(WallGraphics.prototype, { /** * Gets or sets the {@link DistanceDisplayCondition} Property specifying at what distance from the camera that this wall will be displayed. * @memberof WallGraphics.prototype - * @type {Property} + * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( "distanceDisplayCondition" diff --git a/Source/DataSources/exportKml.js b/Source/DataSources/exportKml.js index d251de4143b3..46c1fa16de9e 100644 --- a/Source/DataSources/exportKml.js +++ b/Source/DataSources/exportKml.js @@ -222,6 +222,19 @@ IdManager.prototype.get = function (id) { return id.toString() + "-" + ++ids[id]; }; +/** + * @typedef exportKmlResultKml + * @type {Object} + * @property {String} kml The generated KML. + * @property {Object.} externalFiles An object dictionary of external files + */ + +/** + * @typedef exportKmlResultKmz + * @type {Object} + * @property {Blob} kmz The generated kmz file. + */ + /** * Exports an EntityCollection as a KML document. Only Point, Billboard, Model, Path, Polygon, Polyline geometries * will be exported. Note that there is not a 1 to 1 mapping of Entity properties to KML Feature properties. For @@ -232,18 +245,18 @@ IdManager.prototype.get = function (id) { * as gx:Track Features. Not all Materials are representable in KML, so for more advanced Materials just the primary * color is used. Canvas objects are exported as PNG images. * - * @exports exportKml + * @function exportKml * * @param {Object} options An object with the following properties: * @param {EntityCollection} options.entities The EntityCollection to export as KML. * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid for the output file. - * @param {exportKml~ModelCallback} [options.modelCallback] A callback that will be called with a {@link ModelGraphics} instance and should return the URI to use in the KML. Required if a model exists in the entity collection. + * @param {exportKmlModelCallback} [options.modelCallback] A callback that will be called with a {@link ModelGraphics} instance and should return the URI to use in the KML. Required if a model exists in the entity collection. * @param {JulianDate} [options.time=entities.computeAvailability().start] The time value to use to get properties that are not time varying in KML. * @param {TimeInterval} [options.defaultAvailability=entities.computeAvailability()] The interval that will be sampled if an entity doesn't have an availability. * @param {Number} [options.sampleDuration=60] The number of seconds to sample properties that are varying in KML. * @param {Boolean} [options.kmz=false] If true KML and external files will be compressed into a kmz file. * - * @returns {Promise} A promise that resolved to an object containing the KML string and a dictionary of external file blobs, or a kmz file as a blob if options.kmz is true. + * @returns {Promise} A promise that resolved to an object containing the KML string and a dictionary of external file blobs, or a kmz file as a blob if options.kmz is true. * @demo {@link https://sandcastle.cesium.com/index.html?src=Export%20KML.html|Cesium Sandcastle KML Export Demo} * @example * Cesium.exportKml({ @@ -1503,7 +1516,7 @@ function colorToString(color) { * It can also be used to add additional files to the externalFiles object, which is the list of files embedded in the exported KMZ, * or otherwise returned with the KML string when exporting. * - * @callback exportKml~ModelCallback + * @callback exportKmlModelCallback * * @param {ModelGraphics} model The ModelGraphics instance for an Entity. * @param {JulianDate} time The time that any properties should use to get the value. diff --git a/Source/Renderer/AutomaticUniforms.js b/Source/Renderer/AutomaticUniforms.js index b4de4b7c7d94..e72cd6eddb2e 100644 --- a/Source/Renderer/AutomaticUniforms.js +++ b/Source/Renderer/AutomaticUniforms.js @@ -51,10 +51,6 @@ var AutomaticUniforms = { * and height properties in an vec4's x, y, z, * and w components, respectively. * - * @alias czm_viewport - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec4 czm_viewport; @@ -85,10 +81,6 @@ var AutomaticUniforms = { * The former transforms from normalized device coordinates to window coordinates; the later transforms * from window coordinates to clip coordinates, and is often used to assign to gl_Position. * - * @alias czm_viewportOrthographic - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_viewportOrthographic; @@ -124,10 +116,6 @@ var AutomaticUniforms = { * The former transforms from normalized device coordinates to window coordinates; the later transforms * from window coordinates to clip coordinates, and is often used to assign to gl_Position. * - * @alias czm_viewportTransformation - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_viewportTransformation; @@ -157,12 +145,6 @@ var AutomaticUniforms = { * after the globe pass and then updated after the 3D Tiles pass. * The depth is packed into an RGBA texture. * - * @private - * - * @alias czm_globeDepthTexture - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform sampler2D czm_globeDepthTexture; @@ -183,10 +165,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing a 4x4 model transformation matrix that * transforms model coordinates to world coordinates. * - * @alias czm_model - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_model; @@ -211,10 +189,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing a 4x4 model transformation matrix that * transforms world coordinates to model coordinates. * - * @alias czm_inverseModel - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_inverseModel; @@ -238,10 +212,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing a 4x4 view transformation matrix that * transforms world coordinates to eye coordinates. * - * @alias czm_view - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_view; @@ -271,10 +241,6 @@ var AutomaticUniforms = { * as if the camera were at an equivalent location in 3D mode. This is useful for lighting * 2D and Columbus View in the same way that 3D is lit. * - * @alias czm_view3D - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_view3D; @@ -297,10 +263,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing a 3x3 view rotation matrix that * transforms vectors in world coordinates to eye coordinates. * - * @alias czm_viewRotation - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat3 czm_viewRotation; @@ -328,10 +290,6 @@ var AutomaticUniforms = { * as if the camera were at an equivalent location in 3D mode. This is useful for lighting * 2D and Columbus View in the same way that 3D is lit. * - * @alias czm_viewRotation3D - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat3 czm_viewRotation3D; @@ -354,10 +312,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing a 4x4 transformation matrix that * transforms from eye coordinates to world coordinates. * - * @alias czm_inverseView - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_inverseView; @@ -384,10 +338,6 @@ var AutomaticUniforms = { * as if the camera were at an equivalent location in 3D mode. This is useful for lighting * 2D and Columbus View in the same way that 3D is lit. * - * @alias czm_inverseView3D - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_inverseView3D; @@ -410,10 +360,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing a 3x3 rotation matrix that * transforms vectors from eye coordinates to world coordinates. * - * @alias czm_inverseViewRotation - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat3 czm_inverseViewRotation; @@ -441,10 +387,6 @@ var AutomaticUniforms = { * as if the camera were at an equivalent location in 3D mode. This is useful for lighting * 2D and Columbus View in the same way that 3D is lit. * - * @alias czm_inverseViewRotation3D - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat3 czm_inverseViewRotation3D; @@ -468,10 +410,6 @@ var AutomaticUniforms = { * transforms eye coordinates to clip coordinates. Clip coordinates is the * coordinate system for a vertex shader's gl_Position output. * - * @alias czm_projection - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_projection; @@ -497,10 +435,6 @@ var AutomaticUniforms = { * transforms from clip coordinates to eye coordinates. Clip coordinates is the * coordinate system for a vertex shader's gl_Position output. * - * @alias czm_inverseProjection - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_inverseProjection; @@ -526,10 +460,6 @@ var AutomaticUniforms = { * in algorithms like shadow volumes and GPU ray casting with proxy geometry to ensure that triangles * are not clipped by the far plane. * - * @alias czm_infiniteProjection - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_infiniteProjection; @@ -556,10 +486,6 @@ var AutomaticUniforms = { * Positions should be transformed to eye coordinates using czm_modelView and * normals should be transformed using {@link czm_normal}. * - * @alias czm_modelView - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_modelView; @@ -594,10 +520,6 @@ var AutomaticUniforms = { * Positions should be transformed to eye coordinates using czm_modelView3D and * normals should be transformed using {@link czm_normal3D}. * - * @alias czm_modelView3D - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_modelView3D; @@ -624,10 +546,6 @@ var AutomaticUniforms = { * transforms model coordinates, relative to the eye, to eye coordinates. This is used * in conjunction with {@link czm_translateRelativeToEye}. * - * @alias czm_modelViewRelativeToEye - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_modelViewRelativeToEye; @@ -658,10 +576,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing a 4x4 transformation matrix that * transforms from eye coordinates to model coordinates. * - * @alias czm_inverseModelView - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_inverseModelView; @@ -687,10 +601,6 @@ var AutomaticUniforms = { * as if the camera were at an equivalent location in 3D mode. This is useful for lighting * 2D and Columbus View in the same way that 3D is lit. * - * @alias czm_inverseModelView3D - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_inverseModelView3D; @@ -715,10 +625,6 @@ var AutomaticUniforms = { * transforms world coordinates to clip coordinates. Clip coordinates is the * coordinate system for a vertex shader's gl_Position output. * - * @alias czm_viewProjection - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_viewProjection; @@ -748,10 +654,6 @@ var AutomaticUniforms = { * transforms clip coordinates to world coordinates. Clip coordinates is the * coordinate system for a vertex shader's gl_Position output. * - * @alias czm_inverseViewProjection - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_inverseViewProjection; @@ -775,10 +677,6 @@ var AutomaticUniforms = { * transforms model coordinates to clip coordinates. Clip coordinates is the * coordinate system for a vertex shader's gl_Position output. * - * @alias czm_modelViewProjection - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_modelViewProjection; @@ -811,10 +709,6 @@ var AutomaticUniforms = { * transforms clip coordinates to model coordinates. Clip coordinates is the * coordinate system for a vertex shader's gl_Position output. * - * @alias czm_inverseModelViewProjection - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_inverseModelViewProjection; @@ -839,10 +733,6 @@ var AutomaticUniforms = { * coordinate system for a vertex shader's gl_Position output. This is used in * conjunction with {@link czm_translateRelativeToEye}. * - * @alias czm_modelViewProjectionRelativeToEye - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_modelViewProjectionRelativeToEye; @@ -876,10 +766,6 @@ var AutomaticUniforms = { * the far plane at infinity. This is useful in algorithms like shadow volumes and GPU ray casting with * proxy geometry to ensure that triangles are not clipped by the far plane. * - * @alias czm_modelViewInfiniteProjection - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat4 czm_modelViewInfiniteProjection; @@ -907,9 +793,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform that indicates if the current camera is orthographic in 3D. * - * @alias czm_orthographicIn3D - * @namespace - * @glslUniform * @see UniformState#orthographicIn3D */ czm_orthographicIn3D: new AutomaticUniform({ @@ -927,10 +810,6 @@ var AutomaticUniforms = { * Positions should be transformed to eye coordinates using {@link czm_modelView} and * normals should be transformed using czm_normal. * - * @alias czm_normal - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat3 czm_normal; @@ -961,10 +840,6 @@ var AutomaticUniforms = { * Positions should be transformed to eye coordinates using {@link czm_modelView3D} and * normals should be transformed using czm_normal3D. * - * @alias czm_normal3D - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat3 czm_normal3D; @@ -988,10 +863,6 @@ var AutomaticUniforms = { * transforms normal vectors in eye coordinates to model coordinates. This is * the opposite of the transform provided by {@link czm_normal}. * - * @alias czm_inverseNormal - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat3 czm_inverseNormal; @@ -1021,10 +892,6 @@ var AutomaticUniforms = { * matrix as if the camera were at an equivalent location in 3D mode. This is useful for lighting * 2D and Columbus View in the same way that 3D is lit. * - * @alias czm_inverseNormal3D - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat3 czm_inverseNormal3D; @@ -1044,12 +911,23 @@ var AutomaticUniforms = { }), /** - * An automatic GLSL uniform containing height (x) and height squared (y) - * of the eye (camera) in the 2D scene in meters. + * An automatic GLSL uniform containing the height in meters of the + * eye (camera) above or below the ellipsoid. * - * @alias czm_eyeHeight2D - * @namespace - * @glslUniform + * @see UniformState#eyeHeight + */ + czm_eyeHeight: new AutomaticUniform({ + size: 1, + datatype: WebGLConstants.FLOAT, + getValue: function (uniformState) { + return uniformState.eyeHeight; + }, + }), + + /** + * An automatic GLSL uniform containing height (x) and height squared (y) + * in meters of the eye (camera) above the 2D world plane. This uniform is only valid + * when the {@link SceneMode} is SCENE2D. * * @see UniformState#eyeHeight2D */ @@ -1066,10 +944,6 @@ var AutomaticUniforms = { * of the frustum defined by the camera. This is the largest possible frustum, not an individual * frustum used for multi-frustum rendering. * - * @alias czm_entireFrustum - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec2 czm_entireFrustum; @@ -1093,10 +967,6 @@ var AutomaticUniforms = { * of the frustum defined by the camera. This is the individual * frustum used for multi-frustum rendering. * - * @alias czm_currentFrustum - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec2 czm_currentFrustum; @@ -1118,10 +988,6 @@ var AutomaticUniforms = { /** * The distances to the frustum planes. The top, bottom, left and right distances are * the x, y, z, and w components, respectively. - * - * @alias czm_frustumPlanes - * @namespace - * @glslUniform */ czm_frustumPlanes: new AutomaticUniform({ size: 1, @@ -1133,10 +999,6 @@ var AutomaticUniforms = { /** * Gets the far plane's distance from the near plane, plus 1.0. - * - * @alias czm_farDepthFromNearPlusOne - * @namespace - * @glslUniform */ czm_farDepthFromNearPlusOne: new AutomaticUniform({ size: 1, @@ -1148,10 +1010,6 @@ var AutomaticUniforms = { /** * Gets the log2 of {@link AutomaticUniforms#czm_farDepthFromNearPlusOne}. - * - * @alias czm_oneOverLog2FarDepthFromNearPlusOne - * @namespace - * @glslUniform */ czm_log2FarDepthFromNearPlusOne: new AutomaticUniform({ size: 1, @@ -1163,10 +1021,6 @@ var AutomaticUniforms = { /** * Gets 1.0 divided by {@link AutomaticUniforms#czm_log2FarDepthFromNearPlusOne}. - * - * @alias czm_oneOverLog2FarDepthFromNearPlusOne - * @namespace - * @glslUniform */ czm_oneOverLog2FarDepthFromNearPlusOne: new AutomaticUniform({ size: 1, @@ -1179,10 +1033,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform representing the sun position in world coordinates. * - * @alias czm_sunPositionWC - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_sunPositionWC; @@ -1202,10 +1052,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform representing the sun position in Columbus view world coordinates. * - * @alias czm_sunPositionColumbusView - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_sunPositionColumbusView; @@ -1224,10 +1070,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform representing the normalized direction to the sun in eye coordinates. * - * @alias czm_sunDirectionEC - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_sunDirectionEC; @@ -1250,10 +1092,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform representing the normalized direction to the sun in world coordinates. * - * @alias czm_sunDirectionWC - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_sunDirectionWC; @@ -1276,10 +1114,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform representing the normalized direction to the moon in eye coordinates. * - * @alias czm_moonDirectionEC - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_moonDirectionEC; @@ -1302,10 +1136,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing the normalized direction to the scene's light source in eye coordinates. * This is commonly used for directional lighting computations. * - * @alias czm_lightDirectionEC - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_lightDirectionEC; @@ -1328,10 +1158,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing the normalized direction to the scene's light source in world coordinates. * This is commonly used for directional lighting computations. * - * @alias czm_lightDirectionWC - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_lightDirectionWC; @@ -1355,10 +1181,6 @@ var AutomaticUniforms = { * is equivalent to the light color multiplied by the light intensity limited to a maximum luminance of 1.0 * suitable for non-HDR lighting. * - * @alias czm_lightColor - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_lightColor; @@ -1381,10 +1203,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform that represents the high dynamic range color of light emitted by the scene's light * source. This is equivalent to the light color multiplied by the light intensity suitable for HDR lighting. * - * @alias czm_lightColorHdr - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_lightColorHdr; @@ -1408,10 +1226,6 @@ var AutomaticUniforms = { * coordinates. This is used for GPU RTE to eliminate jittering artifacts when rendering * as described in {@link http://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm|Precisions, Precisions}. * - * @alias czm_encodedCameraPositionMCHigh - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_encodedCameraPositionMCHigh; @@ -1433,10 +1247,6 @@ var AutomaticUniforms = { * coordinates. This is used for GPU RTE to eliminate jittering artifacts when rendering * as described in {@linkhttp://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm|Precisions, Precisions}. * - * @alias czm_encodedCameraPositionMCLow - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_encodedCameraPositionMCLow; @@ -1456,10 +1266,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform representing the position of the viewer (camera) in world coordinates. * - * @alias czm_viewerPositionWC - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3 czm_viewerPositionWC; @@ -1479,10 +1285,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing the frame number. This uniform is automatically incremented * every frame. * - * @alias czm_frameNumber - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform float czm_frameNumber; @@ -1499,10 +1301,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing the current morph transition time between * 2D/Columbus View and 3D, with 0.0 being 2D or Columbus View and 1.0 being 3D. * - * @alias czm_morphTime - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform float czm_morphTime; @@ -1522,10 +1320,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing the current {@link SceneMode}, expressed * as a float. * - * @alias czm_sceneMode - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform float czm_sceneMode; @@ -1552,10 +1346,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform representing the current rendering pass. * - * @alias czm_pass - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform float czm_pass; @@ -1577,10 +1367,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform representing the current scene background color. * - * @alias czm_backgroundColor - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec4 czm_backgroundColor; @@ -1607,10 +1393,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform containing the BRDF look up texture used for image-based lighting computations. * - * @alias czm_brdfLut - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform sampler2D czm_brdfLut; @@ -1631,10 +1413,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform containing the environment map used within the scene. * - * @alias czm_environmentMap - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform samplerCube czm_environmentMap; @@ -1654,10 +1432,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform containing the specular environment map atlas used within the scene. * - * @alias czm_specularEnvironmentMaps - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform sampler2D czm_specularEnvironmentMaps; @@ -1673,10 +1447,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform containing the size of the specular environment map atlas used within the scene. * - * @alias czm_specularEnvironmentMapSize - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec2 czm_specularEnvironmentMapSize; @@ -1692,10 +1462,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform containing the maximum level-of-detail of the specular environment map atlas used within the scene. * - * @alias czm_specularEnvironmentMapsMaximumLOD - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform float czm_specularEnvironmentMapsMaximumLOD; @@ -1711,10 +1477,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform containing the spherical harmonic coefficients used within the scene. * - * @alias czm_sphericalHarmonicCoefficients - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform vec3[9] czm_sphericalHarmonicCoefficients; @@ -1731,10 +1493,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing a 3x3 rotation matrix that transforms * from True Equator Mean Equinox (TEME) axes to the pseudo-fixed axes at the current scene time. * - * @alias czm_temeToPseudoFixed - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform mat3 czm_temeToPseudoFixed; @@ -1756,10 +1514,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform representing the ratio of canvas coordinate space to canvas pixel space. * - * @alias czm_pixelRatio - * @namespace - * @glslUniform - * * @example * uniform float czm_pixelRatio; */ @@ -1774,10 +1528,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform scalar used to mix a color with the fog color based on the distance to the camera. * - * @alias czm_fogDensity - * @namespace - * @glslUniform - * * @see czm_fog */ czm_fogDensity: new AutomaticUniform({ @@ -1792,10 +1542,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing the splitter position to use when rendering imagery layers with a splitter. * This will be in pixel coordinates relative to the canvas. * - * @alias czm_imagerySplitPosition - * @namespace - * @glslUniform - * * @example * // GLSL declaration * uniform float czm_imagerySplitPosition; @@ -1810,10 +1556,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform scalar representing the geometric tolerance per meter - * - * @alias czm_geometricToleranceOverMeter - * @namespace - * @glslUniform */ czm_geometricToleranceOverMeter: new AutomaticUniform({ size: 1, @@ -1827,10 +1569,6 @@ var AutomaticUniforms = { * An automatic GLSL uniform representing the distance from the camera at which to disable the depth test of billboards, labels and points * to, for example, prevent clipping against terrain. When set to zero, the depth test should always be applied. When less than zero, * the depth test should never be applied. - * - * @alias czm_minimumDisableDepthTestDistance - * @namespace - * @glslUniform */ czm_minimumDisableDepthTestDistance: new AutomaticUniform({ size: 1, @@ -1842,10 +1580,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform that will be the highlight color of unclassified 3D Tiles. - * - * @alias czm_invertClassificationColor - * @namespace - * @glslUniform */ czm_invertClassificationColor: new AutomaticUniform({ size: 1, @@ -1857,9 +1591,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform that is used for gamma correction. - * - * @alias czm_gamma - * @glslUniform */ czm_gamma: new AutomaticUniform({ size: 1, @@ -1871,9 +1602,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform that stores the ellipsoid radii. - * - * @alias czm_ellipsoidRadii - * @glslUniform */ czm_ellipsoidRadii: new AutomaticUniform({ size: 1, @@ -1885,9 +1613,6 @@ var AutomaticUniforms = { /** * An automatic GLSL uniform that stores the ellipsoid inverse radii. - * - * @alias czm_ellipsoidRadii - * @glslUniform */ czm_ellipsoidInverseRadii: new AutomaticUniform({ size: 1, diff --git a/Source/Renderer/PixelDatatype.js b/Source/Renderer/PixelDatatype.js index e7f17f8404cd..e9238e94f5a8 100644 --- a/Source/Renderer/PixelDatatype.js +++ b/Source/Renderer/PixelDatatype.js @@ -1,7 +1,10 @@ import WebGLConstants from "../Core/WebGLConstants.js"; /** - * @private + * The data type of a pixel. + * + * @enum {Number} + * @see PostProcessStage */ var PixelDatatype = { UNSIGNED_BYTE: WebGLConstants.UNSIGNED_BYTE, @@ -13,45 +16,55 @@ var PixelDatatype = { UNSIGNED_SHORT_4_4_4_4: WebGLConstants.UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_5_5_5_1: WebGLConstants.UNSIGNED_SHORT_5_5_5_1, UNSIGNED_SHORT_5_6_5: WebGLConstants.UNSIGNED_SHORT_5_6_5, +}; - isPacked: function (pixelDatatype) { - return ( - pixelDatatype === PixelDatatype.UNSIGNED_INT_24_8 || - pixelDatatype === PixelDatatype.UNSIGNED_SHORT_4_4_4_4 || - pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_5_5_1 || - pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_6_5 - ); - }, +/** + @private +*/ +PixelDatatype.isPacked = function (pixelDatatype) { + return ( + pixelDatatype === PixelDatatype.UNSIGNED_INT_24_8 || + pixelDatatype === PixelDatatype.UNSIGNED_SHORT_4_4_4_4 || + pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_5_5_1 || + pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_6_5 + ); +}; - sizeInBytes: function (pixelDatatype) { - switch (pixelDatatype) { - case PixelDatatype.UNSIGNED_BYTE: - return 1; - case PixelDatatype.UNSIGNED_SHORT: - case PixelDatatype.UNSIGNED_SHORT_4_4_4_4: - case PixelDatatype.UNSIGNED_SHORT_5_5_5_1: - case PixelDatatype.UNSIGNED_SHORT_5_6_5: - case PixelDatatype.HALF_FLOAT: - return 2; - case PixelDatatype.UNSIGNED_INT: - case PixelDatatype.FLOAT: - case PixelDatatype.UNSIGNED_INT_24_8: - return 4; - } - }, +/** + @private +*/ +PixelDatatype.sizeInBytes = function (pixelDatatype) { + switch (pixelDatatype) { + case PixelDatatype.UNSIGNED_BYTE: + return 1; + case PixelDatatype.UNSIGNED_SHORT: + case PixelDatatype.UNSIGNED_SHORT_4_4_4_4: + case PixelDatatype.UNSIGNED_SHORT_5_5_5_1: + case PixelDatatype.UNSIGNED_SHORT_5_6_5: + case PixelDatatype.HALF_FLOAT: + return 2; + case PixelDatatype.UNSIGNED_INT: + case PixelDatatype.FLOAT: + case PixelDatatype.UNSIGNED_INT_24_8: + return 4; + } +}; - validate: function (pixelDatatype) { - return ( - pixelDatatype === PixelDatatype.UNSIGNED_BYTE || - pixelDatatype === PixelDatatype.UNSIGNED_SHORT || - pixelDatatype === PixelDatatype.UNSIGNED_INT || - pixelDatatype === PixelDatatype.FLOAT || - pixelDatatype === PixelDatatype.HALF_FLOAT || - pixelDatatype === PixelDatatype.UNSIGNED_INT_24_8 || - pixelDatatype === PixelDatatype.UNSIGNED_SHORT_4_4_4_4 || - pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_5_5_1 || - pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_6_5 - ); - }, +/** + @private +*/ +PixelDatatype.validate = function (pixelDatatype) { + return ( + pixelDatatype === PixelDatatype.UNSIGNED_BYTE || + pixelDatatype === PixelDatatype.UNSIGNED_SHORT || + pixelDatatype === PixelDatatype.UNSIGNED_INT || + pixelDatatype === PixelDatatype.FLOAT || + pixelDatatype === PixelDatatype.HALF_FLOAT || + pixelDatatype === PixelDatatype.UNSIGNED_INT_24_8 || + pixelDatatype === PixelDatatype.UNSIGNED_SHORT_4_4_4_4 || + pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_5_5_1 || + pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_6_5 + ); }; + export default Object.freeze(PixelDatatype); diff --git a/Source/Renderer/Texture.js b/Source/Renderer/Texture.js index d4d117da35e1..3ccdad327c82 100644 --- a/Source/Renderer/Texture.js +++ b/Source/Renderer/Texture.js @@ -633,10 +633,10 @@ Object.defineProperties(Texture.prototype, { }); /** - * Copy new image data into this texture, from a source {@link ImageData}, {@link Image}, {@link Canvas}, or {@link Video}. + * Copy new image data into this texture, from a source {@link ImageData}, {@link HTMLImageElement}, {@link HTMLCanvasElement}, or {@link HTMLVideoElement}. * or an object with width, height, and arrayBufferView properties. * - * @param {Object} source The source {@link ImageData}, {@link Image}, {@link Canvas}, or {@link Video}, + * @param {Object} source The source {@link ImageData}, {@link HTMLImageElement}, {@link HTMLCanvasElement}, or {@link HTMLVideoElement}, * or an object with width, height, and arrayBufferView properties. * @param {Number} [xOffset=0] The offset in the x direction within the texture to copy into. * @param {Number} [yOffset=0] The offset in the y direction within the texture to copy into. diff --git a/Source/Renderer/TextureMagnificationFilter.js b/Source/Renderer/TextureMagnificationFilter.js index 5103252b72ba..cc1b5a05a821 100644 --- a/Source/Renderer/TextureMagnificationFilter.js +++ b/Source/Renderer/TextureMagnificationFilter.js @@ -3,7 +3,7 @@ import WebGLConstants from "../Core/WebGLConstants.js"; /** * Enumerates all possible filters used when magnifying WebGL textures. * - * @exports TextureMagnificationFilter + * @enum {Number} * * @see TextureMinificationFilter */ @@ -22,20 +22,20 @@ var TextureMagnificationFilter = { * @constant */ LINEAR: WebGLConstants.LINEAR, +}; - /** - * Validates the given textureMinificationFilter with respect to the possible enum values. - * - * @private - * - * @param textureMagnificationFilter - * @returns {Boolean} true if textureMagnificationFilter is valid. - */ - validate: function (textureMagnificationFilter) { - return ( - textureMagnificationFilter === TextureMagnificationFilter.NEAREST || - textureMagnificationFilter === TextureMagnificationFilter.LINEAR - ); - }, +/** + * Validates the given textureMinificationFilter with respect to the possible enum values. + * @param textureMagnificationFilter + * @returns {Boolean} true if textureMagnificationFilter is valid. + * + * @private + */ +TextureMagnificationFilter.validate = function (textureMagnificationFilter) { + return ( + textureMagnificationFilter === TextureMagnificationFilter.NEAREST || + textureMagnificationFilter === TextureMagnificationFilter.LINEAR + ); }; + export default Object.freeze(TextureMagnificationFilter); diff --git a/Source/Renderer/TextureMinificationFilter.js b/Source/Renderer/TextureMinificationFilter.js index 2eb8929bd8f0..a7cc13fb2bde 100644 --- a/Source/Renderer/TextureMinificationFilter.js +++ b/Source/Renderer/TextureMinificationFilter.js @@ -3,7 +3,7 @@ import WebGLConstants from "../Core/WebGLConstants.js"; /** * Enumerates all possible filters used when minifying WebGL textures. * - * @exports TextureMinificationFilter + * @enum {Number} * * @see TextureMagnificationFilter */ @@ -67,28 +67,28 @@ var TextureMinificationFilter = { * @constant */ LINEAR_MIPMAP_LINEAR: WebGLConstants.LINEAR_MIPMAP_LINEAR, +}; - /** - * Validates the given textureMinificationFilter with respect to the possible enum values. - * - * @private - * - * @param textureMinificationFilter - * @returns {Boolean} true if textureMinificationFilter is valid. - */ - validate: function (textureMinificationFilter) { - return ( - textureMinificationFilter === TextureMinificationFilter.NEAREST || - textureMinificationFilter === TextureMinificationFilter.LINEAR || - textureMinificationFilter === - TextureMinificationFilter.NEAREST_MIPMAP_NEAREST || - textureMinificationFilter === - TextureMinificationFilter.LINEAR_MIPMAP_NEAREST || - textureMinificationFilter === - TextureMinificationFilter.NEAREST_MIPMAP_LINEAR || - textureMinificationFilter === - TextureMinificationFilter.LINEAR_MIPMAP_LINEAR - ); - }, +/** + * Validates the given textureMinificationFilter with respect to the possible enum values. + * + * @private + * + * @param textureMinificationFilter + * @returns {Boolean} true if textureMinificationFilter is valid. + */ +TextureMinificationFilter.validate = function (textureMinificationFilter) { + return ( + textureMinificationFilter === TextureMinificationFilter.NEAREST || + textureMinificationFilter === TextureMinificationFilter.LINEAR || + textureMinificationFilter === + TextureMinificationFilter.NEAREST_MIPMAP_NEAREST || + textureMinificationFilter === + TextureMinificationFilter.LINEAR_MIPMAP_NEAREST || + textureMinificationFilter === + TextureMinificationFilter.NEAREST_MIPMAP_LINEAR || + textureMinificationFilter === TextureMinificationFilter.LINEAR_MIPMAP_LINEAR + ); }; + export default Object.freeze(TextureMinificationFilter); diff --git a/Source/Renderer/UniformState.js b/Source/Renderer/UniformState.js index d456419789c0..7fc58612aec0 100644 --- a/Source/Renderer/UniformState.js +++ b/Source/Renderer/UniformState.js @@ -142,6 +142,7 @@ function UniformState() { this._cameraRight = new Cartesian3(); this._cameraUp = new Cartesian3(); this._frustum2DWidth = 0.0; + this._eyeHeight = 0.0; this._eyeHeight2D = new Cartesian2(); this._pixelRatio = 1.0; this._orthographicIn3D = false; @@ -672,9 +673,20 @@ Object.defineProperties(UniformState.prototype, { }, /** - * The the height (x) and the height squared (y) - * in meters of the camera above the 2D world plane. This uniform is only valid - * when the {@link SceneMode} equal to SCENE2D. + * The height in meters of the eye (camera) above or below the ellipsoid. + * @memberof UniformState.prototype + * @type {Number} + */ + eyeHeight: { + get: function () { + return this._eyeHeight; + }, + }, + + /** + * The height (x) and the height squared (y) + * in meters of the eye (camera) above the 2D world plane. This uniform is only valid + * when the {@link SceneMode} is SCENE2D. * @memberof UniformState.prototype * @type {Cartesian2} */ @@ -855,7 +867,7 @@ Object.defineProperties(UniformState.prototype, { /** * A scalar that represents the geometric tolerance per meter - * @memberof UniformStat.prototype + * @memberof UniformState.prototype * @type {Number} */ geometricToleranceOverMeter: { @@ -1060,6 +1072,14 @@ function setCamera(uniformState, camera) { Cartesian3.clone(camera.directionWC, uniformState._cameraDirection); Cartesian3.clone(camera.rightWC, uniformState._cameraRight); Cartesian3.clone(camera.upWC, uniformState._cameraUp); + + var positionCartographic = camera.positionCartographic; + if (!defined(positionCartographic)) { + uniformState._eyeHeight = -uniformState._ellipsoid.maximumRadius; + } else { + uniformState._eyeHeight = positionCartographic.height; + } + uniformState._encodedCameraPositionMCDirty = true; } @@ -1286,10 +1306,14 @@ UniformState.prototype.update = function (frameState) { var fov = camera.frustum.fov; var viewport = this._viewport; var pixelSizePerMeter; - if (viewport.height > viewport.width) { - pixelSizePerMeter = (Math.tan(0.5 * fov) * 2.0) / viewport.height; + if (defined(fov)) { + if (viewport.height > viewport.width) { + pixelSizePerMeter = (Math.tan(0.5 * fov) * 2.0) / viewport.height; + } else { + pixelSizePerMeter = (Math.tan(0.5 * fov) * 2.0) / viewport.width; + } } else { - pixelSizePerMeter = (Math.tan(0.5 * fov) * 2.0) / viewport.width; + pixelSizePerMeter = 1.0 / Math.max(viewport.width, viewport.height); } this._geometricToleranceOverMeter = diff --git a/Source/Renderer/loadCubeMap.js b/Source/Renderer/loadCubeMap.js index 70a30f5807bf..449f169a9853 100644 --- a/Source/Renderer/loadCubeMap.js +++ b/Source/Renderer/loadCubeMap.js @@ -9,7 +9,7 @@ import CubeMap from "./CubeMap.js"; * Asynchronously loads six images and creates a cube map. Returns a promise that * will resolve to a {@link CubeMap} once loaded, or reject if any image fails to load. * - * @exports loadCubeMap + * @function loadCubeMap * * @param {Context} context The context to use to create the cube map. * @param {Object} urls The source URL of each image. See the example below. diff --git a/Source/Scene/Appearance.js b/Source/Scene/Appearance.js index 26e507a2308b..88547f5a0b15 100644 --- a/Source/Scene/Appearance.js +++ b/Source/Scene/Appearance.js @@ -19,7 +19,7 @@ import CullFace from "./CullFace.js"; * @param {Material} [options.material=Material.ColorType] The material used to determine the fragment color. * @param {String} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader. * @param {String} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader. - * @param {RenderState} [options.renderState] Optional render state to override the default render state. + * @param {Object} [options.renderState] Optional render state to override the default render state. * * @see MaterialAppearance * @see EllipsoidSurfaceAppearance diff --git a/Source/Scene/ArcGisMapServerImageryProvider.js b/Source/Scene/ArcGisMapServerImageryProvider.js index 73e8f4d2523f..240154ae2e4b 100644 --- a/Source/Scene/ArcGisMapServerImageryProvider.js +++ b/Source/Scene/ArcGisMapServerImageryProvider.js @@ -21,16 +21,13 @@ import ImageryLayerFeatureInfo from "./ImageryLayerFeatureInfo.js"; import ImageryProvider from "./ImageryProvider.js"; /** - * Provides tiled imagery hosted by an ArcGIS MapServer. By default, the server's pre-cached tiles are - * used, if available. + * @typedef {Object} ArcGisMapServerImageryProvider.ConstructorOptions * - * @alias ArcGisMapServerImageryProvider - * @constructor + * Initialization options for the ArcGisMapServerImageryProvider constructor * - * @param {Object} options Object with the following properties: - * @param {Resource|String} options.url The URL of the ArcGIS MapServer service. - * @param {String} [options.token] The ArcGIS token used to authenticate with the ArcGIS MapServer service. - * @param {TileDiscardPolicy} [options.tileDiscardPolicy] The policy that determines if a tile + * @property {Resource|String} url The URL of the ArcGIS MapServer service. + * @property {String} [token] The ArcGIS token used to authenticate with the ArcGIS MapServer service. + * @property {TileDiscardPolicy} [tileDiscardPolicy] The policy that determines if a tile * is invalid and should be discarded. If this value is not specified, a default * {@link DiscardMissingTileImagePolicy} is used for tiled map servers, and a * {@link NeverTileDiscardPolicy} is used for non-tiled map servers. In the former case, @@ -41,27 +38,37 @@ import ImageryProvider from "./ImageryProvider.js"; * these defaults should be correct tile discarding for a standard ArcGIS Server. To ensure * that no tiles are discarded, construct and pass a {@link NeverTileDiscardPolicy} for this * parameter. - * @param {Boolean} [options.usePreCachedTilesIfAvailable=true] If true, the server's pre-cached + * @property {Boolean} [usePreCachedTilesIfAvailable=true] If true, the server's pre-cached * tiles are used if they are available. If false, any pre-cached tiles are ignored and the * 'export' service is used. - * @param {String} [options.layers] A comma-separated list of the layers to show, or undefined if all layers should be shown. - * @param {Boolean} [options.enablePickFeatures=true] If true, {@link ArcGisMapServerImageryProvider#pickFeatures} will invoke + * @property {String} [layers] A comma-separated list of the layers to show, or undefined if all layers should be shown. + * @property {Boolean} [enablePickFeatures=true] If true, {@link ArcGisMapServerImageryProvider#pickFeatures} will invoke * the Identify service on the MapServer and return the features included in the response. If false, * {@link ArcGisMapServerImageryProvider#pickFeatures} will immediately return undefined (indicating no pickable features) * without communicating with the server. Set this property to false if you don't want this provider's features to * be pickable. Can be overridden by setting the {@link ArcGisMapServerImageryProvider#enablePickFeatures} property on the object. - * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle of the layer. This parameter is ignored when accessing + * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle of the layer. This parameter is ignored when accessing * a tiled layer. - * @param {TilingScheme} [options.tilingScheme=new GeographicTilingScheme()] The tiling scheme to use to divide the world into tiles. + * @property {TilingScheme} [tilingScheme=new GeographicTilingScheme()] The tiling scheme to use to divide the world into tiles. * This parameter is ignored when accessing a tiled server. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If the tilingScheme is specified and used, + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If the tilingScheme is specified and used, * this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither * parameter is specified, the WGS84 ellipsoid is used. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. This parameter is ignored when accessing a tiled server. - * @param {Number} [options.tileWidth=256] The width of each tile in pixels. This parameter is ignored when accessing a tiled server. - * @param {Number} [options.tileHeight=256] The height of each tile in pixels. This parameter is ignored when accessing a tiled server. - * @param {Number} [options.maximumLevel] The maximum tile level to request, or undefined if there is no maximum. This parameter is ignored when accessing + * @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas. This parameter is ignored when accessing a tiled server. + * @property {Number} [tileWidth=256] The width of each tile in pixels. This parameter is ignored when accessing a tiled server. + * @property {Number} [tileHeight=256] The height of each tile in pixels. This parameter is ignored when accessing a tiled server. + * @property {Number} [maximumLevel] The maximum tile level to request, or undefined if there is no maximum. This parameter is ignored when accessing * a tiled server. + */ + +/** + * Provides tiled imagery hosted by an ArcGIS MapServer. By default, the server's pre-cached tiles are + * used, if available. + * + * @alias ArcGisMapServerImageryProvider + * @constructor + * + * @param {ArcGisMapServerImageryProvider.ConstructorOptions} options Object describing initialization options * * @see BingMapsImageryProvider * @see GoogleEarthEnterpriseMapsProvider @@ -90,6 +97,92 @@ function ArcGisMapServerImageryProvider(options) { } //>>includeEnd('debug'); + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + var resource = Resource.createIfNeeded(options.url); resource.appendForwardSlash(); @@ -449,7 +542,7 @@ Object.defineProperties(ArcGisMapServerImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link ArcGisMapServerImageryProvider#ready} returns true. * @memberof ArcGisMapServerImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -677,7 +770,7 @@ ArcGisMapServerImageryProvider.prototype.getTileCredits = function ( * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/AttributeType.js b/Source/Scene/AttributeType.js index 23c0772204d2..36c7cae8848f 100644 --- a/Source/Scene/AttributeType.js +++ b/Source/Scene/AttributeType.js @@ -1,7 +1,7 @@ /** * An enum describing the attribute type for glTF and 3D Tiles. * - * @exports AttributeType + * @enum {String} * * @private */ diff --git a/Source/Scene/Axis.js b/Source/Scene/Axis.js index 160e3fbe0ee2..1baeb4b8fcba 100644 --- a/Source/Scene/Axis.js +++ b/Source/Scene/Axis.js @@ -6,8 +6,7 @@ import Matrix4 from "../Core/Matrix4.js"; /** * An enum describing the x, y, and z axes and helper conversion functions. * - * @exports Axis - * @private + * @enum {Number} */ var Axis = { /** @@ -33,79 +32,80 @@ var Axis = { * @constant */ Z: 2, +}; - /** - * Matrix used to convert from y-up to z-up - * - * @type {Matrix4} - * @constant - */ - Y_UP_TO_Z_UP: Matrix4.fromRotationTranslation( - Matrix3.fromRotationX(CesiumMath.PI_OVER_TWO) - ), +/** + * Matrix used to convert from y-up to z-up + * + * @type {Matrix4} + * @constant + */ +Axis.Y_UP_TO_Z_UP = Matrix4.fromRotationTranslation( + Matrix3.fromRotationX(CesiumMath.PI_OVER_TWO) +); - /** - * Matrix used to convert from z-up to y-up - * - * @type {Matrix4} - * @constant - */ - Z_UP_TO_Y_UP: Matrix4.fromRotationTranslation( - Matrix3.fromRotationX(-CesiumMath.PI_OVER_TWO) - ), +/** + * Matrix used to convert from z-up to y-up + * + * @type {Matrix4} + * @constant + */ +Axis.Z_UP_TO_Y_UP = Matrix4.fromRotationTranslation( + Matrix3.fromRotationX(-CesiumMath.PI_OVER_TWO) +); - /** - * Matrix used to convert from x-up to z-up - * - * @type {Matrix4} - * @constant - */ - X_UP_TO_Z_UP: Matrix4.fromRotationTranslation( - Matrix3.fromRotationY(-CesiumMath.PI_OVER_TWO) - ), +/** + * Matrix used to convert from x-up to z-up + * + * @type {Matrix4} + * @constant + */ +Axis.X_UP_TO_Z_UP = Matrix4.fromRotationTranslation( + Matrix3.fromRotationY(-CesiumMath.PI_OVER_TWO) +); - /** - * Matrix used to convert from z-up to x-up - * - * @type {Matrix4} - * @constant - */ - Z_UP_TO_X_UP: Matrix4.fromRotationTranslation( - Matrix3.fromRotationY(CesiumMath.PI_OVER_TWO) - ), +/** + * Matrix used to convert from z-up to x-up + * + * @type {Matrix4} + * @constant + */ +Axis.Z_UP_TO_X_UP = Matrix4.fromRotationTranslation( + Matrix3.fromRotationY(CesiumMath.PI_OVER_TWO) +); - /** - * Matrix used to convert from x-up to y-up - * - * @type {Matrix4} - * @constant - */ - X_UP_TO_Y_UP: Matrix4.fromRotationTranslation( - Matrix3.fromRotationZ(CesiumMath.PI_OVER_TWO) - ), +/** + * Matrix used to convert from x-up to y-up + * + * @type {Matrix4} + * @constant + */ +Axis.X_UP_TO_Y_UP = Matrix4.fromRotationTranslation( + Matrix3.fromRotationZ(CesiumMath.PI_OVER_TWO) +); - /** - * Matrix used to convert from y-up to x-up - * - * @type {Matrix4} - * @constant - */ - Y_UP_TO_X_UP: Matrix4.fromRotationTranslation( - Matrix3.fromRotationZ(-CesiumMath.PI_OVER_TWO) - ), +/** + * Matrix used to convert from y-up to x-up + * + * @type {Matrix4} + * @constant + */ +Axis.Y_UP_TO_X_UP = Matrix4.fromRotationTranslation( + Matrix3.fromRotationZ(-CesiumMath.PI_OVER_TWO) +); - /** - * Gets the axis by name - * - * @param {String} name The name of the axis. - * @returns {Number} The axis enum. - */ - fromName: function (name) { - //>>includeStart('debug', pragmas.debug); - Check.typeOf.string("name", name); - //>>includeEnd('debug'); +/** + * Gets the axis by name + * + * @param {String} name The name of the axis. + * @returns {Number} The axis enum. + */ +Axis.fromName = function (name) { + //>>includeStart('debug', pragmas.debug); + Check.typeOf.string("name", name); + //>>includeEnd('debug'); - return Axis[name]; - }, + return Axis[name]; }; + export default Object.freeze(Axis); diff --git a/Source/Scene/BatchTable.js b/Source/Scene/BatchTable.js index a6b130ff334a..bd1b86df97d7 100644 --- a/Source/Scene/BatchTable.js +++ b/Source/Scene/BatchTable.js @@ -426,7 +426,7 @@ BatchTable.prototype.update = function (frameState) { /** * Gets a function that will update a uniform map to contain values for looking up values in the batch table. * - * @returns {BatchTable~updateUniformMapCallback} A callback for updating uniform maps. + * @returns {BatchTable.updateUniformMapCallback} A callback for updating uniform maps. */ BatchTable.prototype.getUniformMapCallback = function () { var that = this; @@ -569,7 +569,7 @@ function getGlslAttributeFunction(batchTable, attributeIndex) { /** * Gets a function that will update a vertex shader to contain functions for looking up values in the batch table. * - * @returns {BatchTable~updateVertexShaderSourceCallback} A callback for updating a vertex shader source. + * @returns {BatchTable.updateVertexShaderSourceCallback} A callback for updating a vertex shader source. */ BatchTable.prototype.getVertexShaderCallback = function () { var attributes = this._attributes; @@ -628,7 +628,7 @@ BatchTable.prototype.destroy = function () { /** * A callback for updating uniform maps. - * @callback BatchTable~updateUniformMapCallback + * @callback BatchTable.updateUniformMapCallback * * @param {Object} uniformMap The uniform map. * @returns {Object} The new uniform map with properties for retrieving values from the batch table. @@ -636,7 +636,7 @@ BatchTable.prototype.destroy = function () { /** * A callback for updating a vertex shader source. - * @callback BatchTable~updateVertexShaderSourceCallback + * @callback BatchTable.updateVertexShaderSourceCallback * * @param {String} vertexShaderSource The vertex shader source. * @returns {String} The new vertex shader source with the functions for retrieving batch table values injected. diff --git a/Source/Scene/Billboard.js b/Source/Scene/Billboard.js index 7584799377d9..38ed91290f7d 100644 --- a/Source/Scene/Billboard.js +++ b/Source/Scene/Billboard.js @@ -357,7 +357,7 @@ Object.defineProperties(Billboard.prototype, { /** * Gets or sets near and far scaling properties of a Billboard based on the billboard's distance from the camera. * A billboard's scale will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the billboard's scale remains clamped to the nearest bound. If undefined, * scaleByDistance will be disabled. @@ -400,7 +400,7 @@ Object.defineProperties(Billboard.prototype, { /** * Gets or sets near and far translucency properties of a Billboard based on the billboard's distance from the camera. * A billboard's translucency will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the billboard's translucency remains clamped to the nearest bound. If undefined, * translucencyByDistance will be disabled. @@ -446,7 +446,7 @@ Object.defineProperties(Billboard.prototype, { /** * Gets or sets near and far pixel offset scaling properties of a Billboard based on the billboard's distance from the camera. * A billboard's pixel offset will be scaled between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the billboard's pixel offset scale remains clamped to the nearest bound. If undefined, * pixelOffsetScaleByDistance will be disabled. @@ -1192,7 +1192,7 @@ Billboard.prototype._loadImage = function () { *

* * @param {String} id The id of the image. This can be any string that uniquely identifies the image. - * @param {Image|Canvas|String|Resource|Billboard~CreateImageCallback} image The image to load. This parameter + * @param {HTMLImageElement|HTMLCanvasElement|String|Resource|Billboard.CreateImageCallback} image The image to load. This parameter * can either be a loaded Image or Canvas, a URL which will be loaded as an Image automatically, * or a function which will be called to create the image if it hasn't been loaded already. * @example @@ -1528,8 +1528,8 @@ Billboard.prototype._destroy = function () { /** * A function that creates an image. - * @callback Billboard~CreateImageCallback + * @callback Billboard.CreateImageCallback * @param {String} id The identifier of the image to load. - * @returns {Image|Canvas|Promise} The image, or a promise that will resolve to an image. + * @returns {HTMLImageElement|HTMLCanvasElement|Promise} The image, or a promise that will resolve to an image. */ export default Billboard; diff --git a/Source/Scene/BillboardCollection.js b/Source/Scene/BillboardCollection.js index 5dc810544a1c..939ab16ec6c6 100644 --- a/Source/Scene/BillboardCollection.js +++ b/Source/Scene/BillboardCollection.js @@ -785,7 +785,7 @@ function createVAF( attributes.push({ index: attributeLocations.a_batchId, componentsPerAttribute: 1, - componentDatatyps: ComponentDatatype.FLOAT, + componentDatatype: ComponentDatatype.FLOAT, bufferUsage: BufferUsage.STATIC_DRAW, }); } @@ -815,7 +815,7 @@ var writePositionScratch = new EncodedCartesian3(); function writePositionScaleAndRotation( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -889,7 +889,7 @@ var UPPER_LEFT = 1.0; function writeCompressedAttrib0( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1038,7 +1038,7 @@ function writeCompressedAttrib0( function writeCompressedAttrib1( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1124,7 +1124,7 @@ function writeCompressedAttrib1( function writeCompressedAttrib2( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1133,7 +1133,7 @@ function writeCompressedAttrib2( var writer = vafWriters[attributeLocations.compressedAttribute2]; var color = billboard.color; var pickColor = !defined(billboardCollection._batchTable) - ? billboard.getPickId(context).color + ? billboard.getPickId(frameState.context).color : Color.WHITE; var sizeInMeters = billboard.sizeInMeters ? 1.0 : 0.0; var validAlignedAxis = @@ -1203,7 +1203,7 @@ function writeCompressedAttrib2( function writeEyeOffset( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1260,7 +1260,7 @@ function writeEyeOffset( function writeScaleByDistance( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1300,7 +1300,7 @@ function writeScaleByDistance( function writePixelOffsetScaleByDistance( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1340,7 +1340,7 @@ function writePixelOffsetScaleByDistance( function writeCompressedAttribute3( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1364,7 +1364,7 @@ function writeCompressedAttribute3( var disableDepthTestDistance = billboard.disableDepthTestDistance; var clampToGround = billboard.heightReference === HeightReference.CLAMP_TO_GROUND && - billboardCollection._scene.context.depthTexture; + frameState.context.depthTexture; if (!defined(disableDepthTestDistance)) { disableDepthTestDistance = clampToGround ? 5000.0 : 0.0; } @@ -1431,14 +1431,21 @@ function writeCompressedAttribute3( function writeTextureCoordinateBoundsOrLabelTranslate( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ) { if (billboard.heightReference === HeightReference.CLAMP_TO_GROUND) { + var scene = billboardCollection._scene; + var context = frameState.context; + var globeTranslucent = frameState.globeTranslucencyState.translucent; + var depthTestAgainstTerrain = + defined(scene.globe) && scene.globe.depthTestAgainstTerrain; + + // Only do manual depth test if the globe is opaque and writes depth billboardCollection._shaderClampToGround = - billboardCollection._scene.context.depthTexture; + context.depthTexture && !globeTranslucent && depthTestAgainstTerrain; } var i; var writer = @@ -1502,7 +1509,7 @@ function writeTextureCoordinateBoundsOrLabelTranslate( function writeBatchId( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1529,7 +1536,7 @@ function writeBatchId( function writeSDF( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1569,84 +1576,84 @@ function writeSDF( function writeBillboard( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ) { writePositionScaleAndRotation( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writeCompressedAttrib0( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writeCompressedAttrib1( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writeCompressedAttrib2( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writeEyeOffset( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writeScaleByDistance( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writePixelOffsetScaleByDistance( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writeCompressedAttribute3( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writeTextureCoordinateBoundsOrLabelTranslate( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writeBatchId( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard ); writeSDF( billboardCollection, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1878,7 +1885,7 @@ BillboardCollection.prototype.update = function (frameState) { billboard._dirty = false; // In case it needed an update. writeBillboard( this, - context, + frameState, textureAtlasCoordinates, vafWriters, billboard @@ -1971,7 +1978,7 @@ BillboardCollection.prototype.update = function (frameState) { b._dirty = false; for (var n = 0; n < numWriters; ++n) { - writers[n](this, context, textureAtlasCoordinates, vafWriters, b); + writers[n](this, frameState, textureAtlasCoordinates, vafWriters, b); } } this._vaf.commit(getIndexBuffer(context)); @@ -1981,7 +1988,7 @@ BillboardCollection.prototype.update = function (frameState) { bb._dirty = false; for (var o = 0; o < numWriters; ++o) { - writers[o](this, context, textureAtlasCoordinates, vafWriters, bb); + writers[o](this, frameState, textureAtlasCoordinates, vafWriters, bb); } if (this._instanced) { diff --git a/Source/Scene/BingMapsImageryProvider.js b/Source/Scene/BingMapsImageryProvider.js index fff7897960b6..16bedbb4bb3a 100644 --- a/Source/Scene/BingMapsImageryProvider.js +++ b/Source/Scene/BingMapsImageryProvider.js @@ -18,27 +18,34 @@ import DiscardEmptyTilePolicy from "./DiscardEmptyTileImagePolicy.js"; import ImageryProvider from "./ImageryProvider.js"; /** - * Provides tiled imagery using the Bing Maps Imagery REST API. + * @typedef {Object} BingMapsImageryProvider.ConstructorOptions * - * @alias BingMapsImageryProvider - * @constructor + * Initialization options for the BingMapsImageryProvider constructor * - * @param {Object} options Object with the following properties: - * @param {Resource|String} options.url The url of the Bing Maps server hosting the imagery. - * @param {String} [options.key] The Bing Maps key for your application, which can be + * @property {Resource|String} url The url of the Bing Maps server hosting the imagery. + * @property {String} [key] The Bing Maps key for your application, which can be * created at {@link https://www.bingmapsportal.com/}. * If this parameter is not provided, {@link BingMapsApi.defaultKey} is used, which is undefined by default. - * @param {String} [options.tileProtocol] The protocol to use when loading tiles, e.g. 'http' or 'https'. + * @property {String} [tileProtocol] The protocol to use when loading tiles, e.g. 'http' or 'https'. * By default, tiles are loaded using the same protocol as the page. - * @param {BingMapsStyle} [options.mapStyle=BingMapsStyle.AERIAL] The type of Bing Maps imagery to load. - * @param {String} [options.culture=''] The culture to use when requesting Bing Maps imagery. Not + * @property {BingMapsStyle} [mapStyle=BingMapsStyle.AERIAL] The type of Bing Maps imagery to load. + * @property {String} [culture=''] The culture to use when requesting Bing Maps imagery. Not * all cultures are supported. See {@link http://msdn.microsoft.com/en-us/library/hh441729.aspx} * for information on the supported cultures. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. - * @param {TileDiscardPolicy} [options.tileDiscardPolicy] The policy that determines if a tile + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + * @property {TileDiscardPolicy} [tileDiscardPolicy] The policy that determines if a tile * is invalid and should be discarded. By default, a {@link DiscardEmptyTileImagePolicy} * will be used, with the expectation that the Bing Maps server will send a zero-length response for missing tiles. * To ensure that no tiles are discarded, construct and pass a {@link NeverTileDiscardPolicy} for this parameter. + */ + +/** + * Provides tiled imagery using the Bing Maps Imagery REST API. + * + * @alias BingMapsImageryProvider + * @constructor + * + * @param {BingMapsImageryProvider.ConstructorOptions} options Object describing initialization options * * @see ArcGisMapServerImageryProvider * @see GoogleEarthEnterpriseMapsProvider @@ -69,6 +76,92 @@ function BingMapsImageryProvider(options) { } //>>includeEnd('debug'); + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default 1.0 + */ + this.defaultGamma = 1.0; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + this._key = BingMapsApi.getKey(options.key); this._resource = Resource.createIfNeeded(options.url); this._resource.appendForwardSlash(); @@ -88,16 +181,6 @@ function BingMapsImageryProvider(options) { '" title="Bing Imagery"/>' ); - /** - * The default {@link ImageryLayer#gamma} to use for imagery layers created for this provider. - * Changing this value after creating an {@link ImageryLayer} for this provider will have - * no effect. Instead, set the layer's {@link ImageryLayer#gamma} property. - * - * @type {Number} - * @default 1.0 - */ - this.defaultGamma = 1.0; - this._tilingScheme = new WebMercatorTilingScheme({ numberOfLevelZeroTilesX: 2, numberOfLevelZeroTilesY: 2, @@ -339,7 +422,7 @@ Object.defineProperties(BingMapsImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link BingMapsImageryProvider#ready} returns true. * @memberof BingMapsImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -550,7 +633,7 @@ BingMapsImageryProvider.prototype.getTileCredits = function (x, y, level) { * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/BingMapsStyle.js b/Source/Scene/BingMapsStyle.js index de1f0b35bccf..0923588f2dd6 100644 --- a/Source/Scene/BingMapsStyle.js +++ b/Source/Scene/BingMapsStyle.js @@ -1,7 +1,7 @@ /** * The types of imagery provided by Bing Maps. * - * @exports BingMapsStyle + * @enum {Number} * * @see BingMapsImageryProvider */ diff --git a/Source/Scene/BlendEquation.js b/Source/Scene/BlendEquation.js index 1d70ebaa957a..d2f49cbe4d8f 100644 --- a/Source/Scene/BlendEquation.js +++ b/Source/Scene/BlendEquation.js @@ -3,7 +3,7 @@ import WebGLConstants from "../Core/WebGLConstants.js"; /** * Determines how two pixels' values are combined. * - * @exports BlendEquation + * @enum {Number} */ var BlendEquation = { /** diff --git a/Source/Scene/BlendFunction.js b/Source/Scene/BlendFunction.js index 0b1d91d5847f..f0232d2ebb75 100644 --- a/Source/Scene/BlendFunction.js +++ b/Source/Scene/BlendFunction.js @@ -3,7 +3,7 @@ import WebGLConstants from "../Core/WebGLConstants.js"; /** * Determines how blending factors are computed. * - * @exports BlendFunction + * @enum {Number} */ var BlendFunction = { /** diff --git a/Source/Scene/BlendOption.js b/Source/Scene/BlendOption.js index 0dc6e060a5c3..0af43ae1d41e 100644 --- a/Source/Scene/BlendOption.js +++ b/Source/Scene/BlendOption.js @@ -1,7 +1,7 @@ /** * Determines how opaque and translucent parts of billboards, points, and labels are blended with the scene. * - * @exports BlendOption + * @enum {Number} */ var BlendOption = { /** diff --git a/Source/Scene/BlendingState.js b/Source/Scene/BlendingState.js index f697e0a9c8bd..f01f1f68180f 100644 --- a/Source/Scene/BlendingState.js +++ b/Source/Scene/BlendingState.js @@ -9,7 +9,7 @@ import BlendFunction from "./BlendFunction.js"; * This is a helper when using custom render states with {@link Appearance#renderState}. *

* - * @exports BlendingState + * @namespace */ var BlendingState = { /** diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index cbfedd8b73c8..d5927f7bf6d9 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -137,7 +137,7 @@ function Camera(scene) { /** * The region of space in view. * - * @type {Frustum} + * @type {PerspectiveFrustum|PerspectiveOffCenterFrustum|OrthographicFrustum} * @default PerspectiveFrustum() * * @see PerspectiveFrustum @@ -1145,6 +1145,7 @@ Camera.prototype._adjustOrthographicFrustum = function (zooming) { rayIntersection = globe.pickWorldCoordinates( ray, scene, + true, scratchRayIntersection ); @@ -2804,8 +2805,9 @@ function pickMapColumbusView(camera, windowPosition, projection, result) { * @param {Cartesian2} windowPosition The x and y coordinates of a pixel. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid to pick. * @param {Cartesian3} [result] The object onto which to store the result. - * @returns {Cartesian3} If the ellipsoid or map was picked, returns the point on the surface of the ellipsoid or map - * in world coordinates. If the ellipsoid or map was not picked, returns undefined. + * @returns {Cartesian3 | undefined} If the ellipsoid or map was picked, + * returns the point on the surface of the ellipsoid or map in world + * coordinates. If the ellipsoid or map was not picked, returns undefined. * * @example * var canvas = viewer.scene.canvas; @@ -3172,8 +3174,8 @@ var newOptions = { }; /** - * Cancels the current camera flight if one is in progress. - * The camera is left at it's current location. + * Cancels the current camera flight and leaves the camera at its current location. + * If no flight is in progress, this this function does nothing. */ Camera.prototype.cancelFlight = function () { if (defined(this._currentFlight)) { @@ -3182,6 +3184,38 @@ Camera.prototype.cancelFlight = function () { } }; +/** + * Completes the current camera flight and moves the camera immediately to its final destination. + * If no flight is in progress, this this function does nothing. + */ +Camera.prototype.completeFlight = function () { + if (defined(this._currentFlight)) { + this._currentFlight.cancelTween(); + + var options = { + destination: undefined, + orientation: { + heading: undefined, + pitch: undefined, + roll: undefined, + }, + }; + + options.destination = newOptions.destination; + options.orientation.heading = newOptions.heading; + options.orientation.pitch = newOptions.pitch; + options.orientation.roll = newOptions.roll; + + this.setView(options); + + if (defined(this._currentFlight.complete)) { + this._currentFlight.complete(); + } + + this._currentFlight = undefined; + } +}; + /** * Flies the camera from its current position to a new position. * @@ -3191,15 +3225,15 @@ Camera.prototype.cancelFlight = function () { * towards the center of the frame in 3D and in the negative z direction in Columbus view. The up direction will point towards local north in 3D and in the positive * y direction in Columbus view. Orientation is not used in 2D when in infinite scrolling mode. * @param {Number} [options.duration] The duration of the flight in seconds. If omitted, Cesium attempts to calculate an ideal duration based on the distance to be traveled by the flight. - * @param {Camera~FlightCompleteCallback} [options.complete] The function to execute when the flight is complete. - * @param {Camera~FlightCancelledCallback} [options.cancel] The function to execute if the flight is cancelled. + * @param {Camera.FlightCompleteCallback} [options.complete] The function to execute when the flight is complete. + * @param {Camera.FlightCancelledCallback} [options.cancel] The function to execute if the flight is cancelled. * @param {Matrix4} [options.endTransform] Transform matrix representing the reference frame the camera will be in when the flight is completed. * @param {Number} [options.maximumHeight] The maximum height at the peak of the flight. * @param {Number} [options.pitchAdjustHeight] If camera flyes higher than that value, adjust pitch duiring the flight to look down, and keep Earth in viewport. * @param {Number} [options.flyOverLongitude] There are always two ways between 2 points on globe. This option force camera to choose fight direction to fly over that longitude. * @param {Number} [options.flyOverLongitudeWeight] Fly over the lon specifyed via flyOverLongitude only if that way is not longer than short way times flyOverLongitudeWeight. * @param {Boolean} [options.convert] Whether to convert the destination from world coordinates to scene coordinates (only relevant when not using 3D). Defaults to true. - * @param {EasingFunction|EasingFunction~Callback} [options.easingFunction] Controls how the time is interpolated over the duration of the flight. + * @param {EasingFunction.Callback} [options.easingFunction] Controls how the time is interpolated over the duration of the flight. * * @exception {DeveloperError} If either direction or up is given, then both are required. * @@ -3459,14 +3493,14 @@ var scratchFlyToBoundingSphereMatrix3 = new Matrix3(); * @param {Object} [options] Object with the following properties: * @param {Number} [options.duration] The duration of the flight in seconds. If omitted, Cesium attempts to calculate an ideal duration based on the distance to be traveled by the flight. * @param {HeadingPitchRange} [options.offset] The offset from the target in the local east-north-up reference frame centered at the target. - * @param {Camera~FlightCompleteCallback} [options.complete] The function to execute when the flight is complete. - * @param {Camera~FlightCancelledCallback} [options.cancel] The function to execute if the flight is cancelled. + * @param {Camera.FlightCompleteCallback} [options.complete] The function to execute when the flight is complete. + * @param {Camera.FlightCancelledCallback} [options.cancel] The function to execute if the flight is cancelled. * @param {Matrix4} [options.endTransform] Transform matrix representing the reference frame the camera will be in when the flight is completed. * @param {Number} [options.maximumHeight] The maximum height at the peak of the flight. * @param {Number} [options.pitchAdjustHeight] If camera flyes higher than that value, adjust pitch duiring the flight to look down, and keep Earth in viewport. * @param {Number} [options.flyOverLongitude] There are always two ways between 2 points on globe. This option force camera to choose fight direction to fly over that longitude. * @param {Number} [options.flyOverLongitudeWeight] Fly over the lon specifyed via flyOverLongitude only if that way is not longer than short way times flyOverLongitudeWeight. - * @param {EasingFunction|EasingFunction~Callback} [options.easingFunction] Controls how the time is interpolated over the duration of the flight. + * @param {EasingFunction.Callback} [options.easingFunction] Controls how the time is interpolated over the duration of the flight. */ Camera.prototype.flyToBoundingSphere = function (boundingSphere, options) { //>>includeStart('debug', pragmas.debug); @@ -3852,11 +3886,11 @@ Camera.clone = function (camera, result) { /** * A function that will execute when a flight completes. - * @callback Camera~FlightCompleteCallback + * @callback Camera.FlightCompleteCallback */ /** * A function that will execute when a flight is cancelled. - * @callback Camera~FlightCancelledCallback + * @callback Camera.FlightCancelledCallback */ export default Camera; diff --git a/Source/Scene/CameraEventAggregator.js b/Source/Scene/CameraEventAggregator.js index cdaaa41bc083..364ffaa4f41f 100644 --- a/Source/Scene/CameraEventAggregator.js +++ b/Source/Scene/CameraEventAggregator.js @@ -296,7 +296,7 @@ function listenMouseMove(aggregator, modifier) { * @alias CameraEventAggregator * @constructor * - * @param {Canvas} [canvas=document] The element to handle events for. + * @param {HTMLCanvasElement} [canvas=document] The element to handle events for. * * @see ScreenSpaceEventHandler */ diff --git a/Source/Scene/CameraEventType.js b/Source/Scene/CameraEventType.js index 29e652544818..ec6ab41afed7 100644 --- a/Source/Scene/CameraEventType.js +++ b/Source/Scene/CameraEventType.js @@ -1,7 +1,7 @@ /** * Enumerates the available input for interacting with the camera. * - * @exports CameraEventType + * @enum {Number} */ var CameraEventType = { /** diff --git a/Source/Scene/Cesium3DTileColorBlendMode.js b/Source/Scene/Cesium3DTileColorBlendMode.js index 02e4bde25e00..3f096aafebb4 100644 --- a/Source/Scene/Cesium3DTileColorBlendMode.js +++ b/Source/Scene/Cesium3DTileColorBlendMode.js @@ -22,7 +22,7 @@ * } * * - * @exports Cesium3DTileColorBlendMode + * @enum {Number} */ var Cesium3DTileColorBlendMode = { /** diff --git a/Source/Scene/Cesium3DTileFeature.js b/Source/Scene/Cesium3DTileFeature.js index 2700ea5d3f82..a9d3436b2490 100644 --- a/Source/Scene/Cesium3DTileFeature.js +++ b/Source/Scene/Cesium3DTileFeature.js @@ -161,7 +161,7 @@ Cesium3DTileFeature.prototype.hasProperty = function (name) { * * @see {@link https://github.com/CesiumGS/3d-tiles/tree/master/extensions/3DTILES_batch_table_hierarchy} * - * @param {String[]} results An array into which to store the results. + * @param {String[]} [results] An array into which to store the results. * @returns {String[]} The names of the feature's properties. */ Cesium3DTileFeature.prototype.getPropertyNames = function (results) { diff --git a/Source/Scene/Cesium3DTileOptimizationHint.js b/Source/Scene/Cesium3DTileOptimizationHint.js index 9469838d0f91..0ee1d97145e8 100644 --- a/Source/Scene/Cesium3DTileOptimizationHint.js +++ b/Source/Scene/Cesium3DTileOptimizationHint.js @@ -1,7 +1,7 @@ /** * Hint defining optimization support for a 3D tile * - * @exports Cesium3DTileOptimizationHint + * @enum {Number} * * @private */ diff --git a/Source/Scene/Cesium3DTileOptimizations.js b/Source/Scene/Cesium3DTileOptimizations.js index 9117b6e931cb..98a288f6ffa6 100644 --- a/Source/Scene/Cesium3DTileOptimizations.js +++ b/Source/Scene/Cesium3DTileOptimizations.js @@ -7,7 +7,7 @@ import TileOrientedBoundingBox from "./TileOrientedBoundingBox.js"; /** * Utility functions for computing optimization hints for a {@link Cesium3DTileset}. * - * @exports Cesium3DTileOptimizations + * @namespace Cesium3DTileOptimizations * * @private */ diff --git a/Source/Scene/Cesium3DTilePointFeature.js b/Source/Scene/Cesium3DTilePointFeature.js index 5c8cb77300f1..79ee6de46456 100644 --- a/Source/Scene/Cesium3DTilePointFeature.js +++ b/Source/Scene/Cesium3DTilePointFeature.js @@ -731,7 +731,7 @@ Cesium3DTilePointFeature.prototype.hasProperty = function (name) { * * @see {@link https://github.com/CesiumGS/3d-tiles/tree/master/extensions/3DTILES_batch_table_hierarchy} * - * @param {String[]} results An array into which to store the results. + * @param {String[]} [results] An array into which to store the results. * @returns {String[]} The names of the feature's properties. */ Cesium3DTilePointFeature.prototype.getPropertyNames = function (results) { diff --git a/Source/Scene/Cesium3DTileRefine.js b/Source/Scene/Cesium3DTileRefine.js index c142ff7187d5..ade192c1ee03 100644 --- a/Source/Scene/Cesium3DTileRefine.js +++ b/Source/Scene/Cesium3DTileRefine.js @@ -5,7 +5,7 @@ * in the 3D Tiles spec. *

* - * @exports Cesium3DTileRefine + * @enum {Number} * * @private */ diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index b62777b5bca1..e87efcfe4cf9 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -1638,7 +1638,7 @@ Object.defineProperties(Cesium3DTileStyle.prototype, { * Gets the color shader function for this style. * * @param {String} functionName Name to give to the generated function. - * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes. + * @param {String} propertyNameMap Maps property variable names to shader attribute names. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent. * * @returns {String} The shader function. @@ -1647,7 +1647,7 @@ Object.defineProperties(Cesium3DTileStyle.prototype, { */ Cesium3DTileStyle.prototype.getColorShaderFunction = function ( functionName, - attributePrefix, + propertyNameMap, shaderState ) { if (this._colorShaderFunctionReady) { @@ -1660,7 +1660,7 @@ Cesium3DTileStyle.prototype.getColorShaderFunction = function ( this._colorShaderFunction = defined(this.color) ? this.color.getShaderFunction( functionName, - attributePrefix, + propertyNameMap, shaderState, "vec4" ) @@ -1673,7 +1673,7 @@ Cesium3DTileStyle.prototype.getColorShaderFunction = function ( * Gets the show shader function for this style. * * @param {String} functionName Name to give to the generated function. - * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes. + * @param {String} propertyNameMap Maps property variable names to shader attribute names. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent. * * @returns {String} The shader function. @@ -1682,7 +1682,7 @@ Cesium3DTileStyle.prototype.getColorShaderFunction = function ( */ Cesium3DTileStyle.prototype.getShowShaderFunction = function ( functionName, - attributePrefix, + propertyNameMap, shaderState ) { if (this._showShaderFunctionReady) { @@ -1694,7 +1694,7 @@ Cesium3DTileStyle.prototype.getShowShaderFunction = function ( this._showShaderFunction = defined(this.show) ? this.show.getShaderFunction( functionName, - attributePrefix, + propertyNameMap, shaderState, "bool" ) @@ -1706,7 +1706,7 @@ Cesium3DTileStyle.prototype.getShowShaderFunction = function ( * Gets the pointSize shader function for this style. * * @param {String} functionName Name to give to the generated function. - * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes. + * @param {String} propertyNameMap Maps property variable names to shader attribute names. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent. * * @returns {String} The shader function. @@ -1715,7 +1715,7 @@ Cesium3DTileStyle.prototype.getShowShaderFunction = function ( */ Cesium3DTileStyle.prototype.getPointSizeShaderFunction = function ( functionName, - attributePrefix, + propertyNameMap, shaderState ) { if (this._pointSizeShaderFunctionReady) { @@ -1727,7 +1727,7 @@ Cesium3DTileStyle.prototype.getPointSizeShaderFunction = function ( this._pointSizeShaderFunction = defined(this.pointSize) ? this.pointSize.getShaderFunction( functionName, - attributePrefix, + propertyNameMap, shaderState, "float" ) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 89370d7d43a4..45bfd2c01da9 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -72,7 +72,7 @@ import TileOrientedBoundingBox from "./TileOrientedBoundingBox.js"; * @param {Boolean} [options.foveatedScreenSpaceError=true] Optimization option. Prioritize loading tiles in the center of the screen by temporarily raising the screen space error for tiles around the edge of the screen. Screen space error returns to normal once all the tiles in the center of the screen as determined by the {@link Cesium3DTileset#foveatedConeSize} are loaded. * @param {Number} [options.foveatedConeSize=0.1] Optimization option. Used when {@link Cesium3DTileset#foveatedScreenSpaceError} is true to control the cone size that determines which tiles are deferred. Tiles that are inside this cone are loaded immediately. Tiles outside the cone are potentially deferred based on how far outside the cone they are and their screen space error. This is controlled by {@link Cesium3DTileset#foveatedInterpolationCallback} and {@link Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation}. Setting this to 0.0 means the cone will be the line formed by the camera position and its view direction. Setting this to 1.0 means the cone encompasses the entire field of view of the camera, disabling the effect. * @param {Number} [options.foveatedMinimumScreenSpaceErrorRelaxation=0.0] Optimization option. Used when {@link Cesium3DTileset#foveatedScreenSpaceError} is true to control the starting screen space error relaxation for tiles outside the foveated cone. The screen space error will be raised starting with tileset value up to {@link Cesium3DTileset#maximumScreenSpaceError} based on the provided {@link Cesium3DTileset#foveatedInterpolationCallback}. - * @param {Cesium3DTileset~foveatedInterpolationCallback} [options.foveatedInterpolationCallback=Math.lerp] Optimization option. Used when {@link Cesium3DTileset#foveatedScreenSpaceError} is true to control how much to raise the screen space error for tiles outside the foveated cone, interpolating between {@link Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation} and {@link Cesium3DTileset#maximumScreenSpaceError} + * @param {Cesium3DTileset.foveatedInterpolationCallback} [options.foveatedInterpolationCallback=Math.lerp] Optimization option. Used when {@link Cesium3DTileset#foveatedScreenSpaceError} is true to control how much to raise the screen space error for tiles outside the foveated cone, interpolating between {@link Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation} and {@link Cesium3DTileset#maximumScreenSpaceError} * @param {Number} [options.foveatedTimeDelay=0.2] Optimization option. Used when {@link Cesium3DTileset#foveatedScreenSpaceError} is true to control how long in seconds to wait after the camera stops moving before deferred tiles start loading in. This time delay prevents requesting tiles around the edges of the screen when the camera is moving. Setting this to 0.0 will immediately request all tiles in any given view. * @param {Boolean} [options.skipLevelOfDetail=false] Optimization option. Determines if level of detail skipping should be applied during the traversal. * @param {Number} [options.baseScreenSpaceError=1024] When skipLevelOfDetail is true, the screen space error that must be reached before skipping levels of detail. @@ -325,9 +325,10 @@ function Cesium3DTileset(options) { ); /** - * Gets a function that will update the foveated screen space error for a tile. + * Gets or sets a callback to control how much to raise the screen space error for tiles outside the foveated cone, + * interpolating between {@link Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation} and {@link Cesium3DTileset#maximumScreenSpaceError}. * - * @type {Cesium3DTileset~foveatedInterpolationCallback} A callback to control how much to raise the screen space error for tiles outside the foveated cone, interpolating between {@link Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation} and {@link Cesium3DTileset#maximumScreenSpaceError}. + * @type {Cesium3DTileset.foveatedInterpolationCallback} */ this.foveatedInterpolationCallback = defaultValue( options.foveatedInterpolationCallback, @@ -1202,7 +1203,7 @@ Object.defineProperties(Cesium3DTileset.prototype, { * * @memberof Cesium3DTileset.prototype * - * @type {Cesium3DTileStyle} + * @type {Cesium3DTileStyle|undefined} * * @default undefined * @@ -2219,7 +2220,7 @@ function updateTiles(tileset, frameState, passOptions) { tileset._backfaceCommands.trim(); if (bivariateVisibilityTest) { - /** + /* * Consider 'effective leaf' tiles as selected tiles that have no selected descendants. They may have children, * but they are currently our effective leaves because they do not have selected descendants. These tiles * are those where with tile._finalResolution === true. @@ -2618,7 +2619,7 @@ Cesium3DTileset.prototype.destroy = function () { * Optimization option. Used as a callback when {@link Cesium3DTileset#foveatedScreenSpaceError} is true to control how much to raise the screen space error for tiles outside the foveated cone, * interpolating between {@link Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation} and {@link Cesium3DTileset#maximumScreenSpaceError}. * - * @callback Cesium3DTileset~foveatedInterpolationCallback + * @callback Cesium3DTileset.foveatedInterpolationCallback * @default Math.lerp * * @param {Number} p The start value to interpolate. diff --git a/Source/Scene/ClassificationModel.js b/Source/Scene/ClassificationModel.js index e9af83fcb4e4..679fa24cd0b0 100644 --- a/Source/Scene/ClassificationModel.js +++ b/Source/Scene/ClassificationModel.js @@ -628,7 +628,7 @@ function createProgram(model) { uniformDecl + "void main() {\n" + computePosition + - " gl_Position = czm_depthClampFarPlane(positionInClipCoords);\n" + + " gl_Position = czm_depthClamp(positionInClipCoords);\n" + "}\n"; var fs = "#ifdef GL_EXT_frag_depth\n" + @@ -637,7 +637,7 @@ function createProgram(model) { "void main() \n" + "{ \n" + " gl_FragColor = vec4(1.0); \n" + - " czm_writeDepthClampedToFarPlane();\n" + + " czm_writeDepthClamp();\n" + "}\n"; if (model.extensionsUsed.WEB3D_quantized_attributes) { diff --git a/Source/Scene/ClassificationPrimitive.js b/Source/Scene/ClassificationPrimitive.js index 47012dac112a..a2e060b7d4ce 100644 --- a/Source/Scene/ClassificationPrimitive.js +++ b/Source/Scene/ClassificationPrimitive.js @@ -155,8 +155,6 @@ function ClassificationPrimitive(options) { this._spPick2D = undefined; // only derived if necessary this._spColor2D = undefined; // only derived if necessary - this._rsStencilPreloadPass = undefined; - this._rsStencilPreloadPass3DTiles = undefined; this._rsStencilDepthPass = undefined; this._rsStencilDepthPass3DTiles = undefined; this._rsColorPass = undefined; @@ -357,7 +355,7 @@ ClassificationPrimitive.isSupported = function (scene) { return scene.context.stencilBuffer; }; -function getStencilPreloadRenderState(enableStencil, mask3DTiles) { +function getStencilDepthRenderState(enableStencil, mask3DTiles) { var stencilFunction = mask3DTiles ? StencilFunction.EQUAL : StencilFunction.ALWAYS; @@ -374,49 +372,13 @@ function getStencilPreloadRenderState(enableStencil, mask3DTiles) { frontOperation: { fail: StencilOperation.KEEP, zFail: StencilOperation.DECREMENT_WRAP, - zPass: StencilOperation.DECREMENT_WRAP, + zPass: StencilOperation.KEEP, }, backFunction: stencilFunction, backOperation: { fail: StencilOperation.KEEP, zFail: StencilOperation.INCREMENT_WRAP, - zPass: StencilOperation.INCREMENT_WRAP, - }, - reference: StencilConstants.CESIUM_3D_TILE_MASK, - mask: StencilConstants.CESIUM_3D_TILE_MASK, - }, - stencilMask: StencilConstants.CLASSIFICATION_MASK, - depthTest: { - enabled: false, - }, - depthMask: false, - }; -} - -function getStencilDepthRenderState(enableStencil, mask3DTiles) { - var stencilFunction = mask3DTiles - ? StencilFunction.EQUAL - : StencilFunction.ALWAYS; - return { - colorMask: { - red: false, - green: false, - blue: false, - alpha: false, - }, - stencilTest: { - enabled: enableStencil, - frontFunction: stencilFunction, - frontOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.INCREMENT_WRAP, - }, - backFunction: stencilFunction, - backOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + zPass: StencilOperation.KEEP, }, reference: StencilConstants.CESIUM_3D_TILE_MASK, mask: StencilConstants.CESIUM_3D_TILE_MASK, @@ -436,15 +398,15 @@ function getColorRenderState(enableStencil) { enabled: enableStencil, frontFunction: StencilFunction.NOT_EQUAL, frontOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + fail: StencilOperation.ZERO, + zFail: StencilOperation.ZERO, + zPass: StencilOperation.ZERO, }, backFunction: StencilFunction.NOT_EQUAL, backOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + fail: StencilOperation.ZERO, + zFail: StencilOperation.ZERO, + zPass: StencilOperation.ZERO, }, reference: 0, mask: StencilConstants.CLASSIFICATION_MASK, @@ -454,7 +416,7 @@ function getColorRenderState(enableStencil) { enabled: false, }, depthMask: false, - blending: BlendingState.ALPHA_BLEND, + blending: BlendingState.PRE_MULTIPLIED_ALPHA_BLEND, }; } @@ -463,15 +425,15 @@ var pickRenderState = { enabled: true, frontFunction: StencilFunction.NOT_EQUAL, frontOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + fail: StencilOperation.ZERO, + zFail: StencilOperation.ZERO, + zPass: StencilOperation.ZERO, }, backFunction: StencilFunction.NOT_EQUAL, backOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + fail: StencilOperation.ZERO, + zFail: StencilOperation.ZERO, + zPass: StencilOperation.ZERO, }, reference: 0, mask: StencilConstants.CLASSIFICATION_MASK, @@ -489,17 +451,11 @@ function createRenderStates( appearance, twoPasses ) { - if (defined(classificationPrimitive._rsStencilPreloadPass)) { + if (defined(classificationPrimitive._rsStencilDepthPass)) { return; } var stencilEnabled = !classificationPrimitive.debugShowShadowVolume; - classificationPrimitive._rsStencilPreloadPass = RenderState.fromCache( - getStencilPreloadRenderState(stencilEnabled, false) - ); - classificationPrimitive._rsStencilPreloadPass3DTiles = RenderState.fromCache( - getStencilPreloadRenderState(stencilEnabled, true) - ); classificationPrimitive._rsStencilDepthPass = RenderState.fromCache( getStencilDepthRenderState(stencilEnabled, false) ); @@ -722,7 +678,7 @@ function createShaderProgram(classificationPrimitive, frameState) { function createColorCommands(classificationPrimitive, colorCommands) { var primitive = classificationPrimitive._primitive; - var length = primitive._va.length * 3; // each geometry (pack of vertex attributes) needs 3 commands: front/back stencils and fill + var length = primitive._va.length * 2; // each geometry (pack of vertex attributes) needs 2 commands: front/back stencils and fill colorCommands.length = length; var i; @@ -735,10 +691,10 @@ function createColorCommands(classificationPrimitive, colorCommands) { var needs2DShader = classificationPrimitive._needs2DShader; - for (i = 0; i < length; i += 3) { + for (i = 0; i < length; i += 2) { var vertexArray = primitive._va[vaIndex++]; - // Stencil preload command + // Stencil depth command command = colorCommands[i]; if (!defined(command)) { command = colorCommands[i] = new DrawCommand({ @@ -747,30 +703,6 @@ function createColorCommands(classificationPrimitive, colorCommands) { }); } - command.vertexArray = vertexArray; - command.renderState = classificationPrimitive._rsStencilPreloadPass; - command.shaderProgram = classificationPrimitive._sp; - command.uniformMap = uniformMap; - command.pass = Pass.TERRAIN_CLASSIFICATION; - - derivedCommand = DrawCommand.shallowClone( - command, - command.derivedCommands.tileset - ); - derivedCommand.renderState = - classificationPrimitive._rsStencilPreloadPass3DTiles; - derivedCommand.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION; - command.derivedCommands.tileset = derivedCommand; - - // Stencil depth command - command = colorCommands[i + 1]; - if (!defined(command)) { - command = colorCommands[i + 1] = new DrawCommand({ - owner: classificationPrimitive, - primitiveType: primitive._primitiveType, - }); - } - command.vertexArray = vertexArray; command.renderState = classificationPrimitive._rsStencilDepthPass; command.shaderProgram = classificationPrimitive._sp; @@ -787,9 +719,9 @@ function createColorCommands(classificationPrimitive, colorCommands) { command.derivedCommands.tileset = derivedCommand; // Color command - command = colorCommands[i + 2]; + command = colorCommands[i + 1]; if (!defined(command)) { - command = colorCommands[i + 2] = new DrawCommand({ + command = colorCommands[i + 1] = new DrawCommand({ owner: classificationPrimitive, primitiveType: primitive._primitiveType, }); @@ -839,9 +771,9 @@ function createColorCommands(classificationPrimitive, colorCommands) { var spStencil = classificationPrimitive._spStencil; var commandIndex = 0; - length = commandsIgnoreShow.length = (length / 3) * 2; + length = commandsIgnoreShow.length = length / 2; - for (var j = 0; j < length; j += 2) { + for (var j = 0; j < length; ++j) { var commandIgnoreShow = (commandsIgnoreShow[j] = DrawCommand.shallowClone( colorCommands[commandIndex], commandsIgnoreShow[j] @@ -849,14 +781,7 @@ function createColorCommands(classificationPrimitive, colorCommands) { commandIgnoreShow.shaderProgram = spStencil; commandIgnoreShow.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW; - commandIgnoreShow = commandsIgnoreShow[j + 1] = DrawCommand.shallowClone( - colorCommands[commandIndex + 1], - commandsIgnoreShow[j + 1] - ); - commandIgnoreShow.shaderProgram = spStencil; - commandIgnoreShow.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW; - - commandIndex += 3; + commandIndex += 2; } } @@ -864,7 +789,7 @@ function createPickCommands(classificationPrimitive, pickCommands) { var usePickOffsets = classificationPrimitive._usePickOffsets; var primitive = classificationPrimitive._primitive; - var length = primitive._va.length * 3; // each geometry (pack of vertex attributes) needs 3 commands: front/back stencils and fill + var length = primitive._va.length * 2; // each geometry (pack of vertex attributes) needs 2 commands: front/back stencils and fill // Fallback for batching same-color geometry instances var pickOffsets; @@ -872,7 +797,7 @@ function createPickCommands(classificationPrimitive, pickCommands) { var pickOffset; if (usePickOffsets) { pickOffsets = primitive._pickOffsets; - length = pickOffsets.length * 3; + length = pickOffsets.length * 2; } pickCommands.length = length; @@ -887,14 +812,14 @@ function createPickCommands(classificationPrimitive, pickCommands) { var needs2DShader = classificationPrimitive._needs2DShader; - for (j = 0; j < length; j += 3) { + for (j = 0; j < length; j += 2) { var vertexArray = primitive._va[vaIndex++]; if (usePickOffsets) { pickOffset = pickOffsets[pickIndex++]; vertexArray = primitive._va[pickOffset.index]; } - // Stencil preload command + // Stencil depth command command = pickCommands[j]; if (!defined(command)) { command = pickCommands[j] = new DrawCommand({ @@ -904,36 +829,6 @@ function createPickCommands(classificationPrimitive, pickCommands) { }); } - command.vertexArray = vertexArray; - command.renderState = classificationPrimitive._rsStencilPreloadPass; - command.shaderProgram = classificationPrimitive._sp; - command.uniformMap = uniformMap; - command.pass = Pass.TERRAIN_CLASSIFICATION; - if (usePickOffsets) { - command.offset = pickOffset.offset; - command.count = pickOffset.count; - } - - // Derive for 3D Tiles classification - derivedCommand = DrawCommand.shallowClone( - command, - command.derivedCommands.tileset - ); - derivedCommand.renderState = - classificationPrimitive._rsStencilPreloadPass3DTiles; - derivedCommand.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION; - command.derivedCommands.tileset = derivedCommand; - - // Stencil depth command - command = pickCommands[j + 1]; - if (!defined(command)) { - command = pickCommands[j + 1] = new DrawCommand({ - owner: classificationPrimitive, - primitiveType: primitive._primitiveType, - pickOnly: true, - }); - } - command.vertexArray = vertexArray; command.renderState = classificationPrimitive._rsStencilDepthPass; command.shaderProgram = classificationPrimitive._sp; @@ -955,9 +850,9 @@ function createPickCommands(classificationPrimitive, pickCommands) { command.derivedCommands.tileset = derivedCommand; // Pick color command - command = pickCommands[j + 2]; + command = pickCommands[j + 1]; if (!defined(command)) { - command = pickCommands[j + 2] = new DrawCommand({ + command = pickCommands[j + 1] = new DrawCommand({ owner: classificationPrimitive, primitiveType: primitive._primitiveType, pickOnly: true, @@ -1016,7 +911,7 @@ function createCommands( } function boundingVolumeIndex(commandIndex, length) { - return Math.floor((commandIndex % length) / 3); + return Math.floor((commandIndex % length) / 2); } function updateAndQueueRenderCommand( @@ -1119,7 +1014,7 @@ function updateAndQueueCommands( var ignoreShowCommands = classificationPrimitive._commandsIgnoreShow; var ignoreShowCommandsLength = ignoreShowCommands.length; for (i = 0; i < ignoreShowCommandsLength; ++i) { - boundingVolume = boundingVolumes[Math.floor(i / 2)]; + boundingVolume = boundingVolumes[i]; command = ignoreShowCommands[i]; updateAndQueueRenderCommand( command, @@ -1411,12 +1306,6 @@ ClassificationPrimitive.prototype.update = function (frameState) { this._ready ) { this._debugShowShadowVolume = true; - this._rsStencilPreloadPass = RenderState.fromCache( - getStencilPreloadRenderState(false, false) - ); - this._rsStencilPreloadPass3DTiles = RenderState.fromCache( - getStencilPreloadRenderState(false, true) - ); this._rsStencilDepthPass = RenderState.fromCache( getStencilDepthRenderState(false, false) ); @@ -1426,12 +1315,6 @@ ClassificationPrimitive.prototype.update = function (frameState) { this._rsColorPass = RenderState.fromCache(getColorRenderState(false)); } else if (!this.debugShowShadowVolume && this._debugShowShadowVolume) { this._debugShowShadowVolume = false; - this._rsStencilPreloadPass = RenderState.fromCache( - getStencilPreloadRenderState(true, false) - ); - this._rsStencilPreloadPass3DTiles = RenderState.fromCache( - getStencilPreloadRenderState(true, true) - ); this._rsStencilDepthPass = RenderState.fromCache( getStencilDepthRenderState(true, false) ); diff --git a/Source/Scene/ClassificationType.js b/Source/Scene/ClassificationType.js index 1989b2cd63c0..259ca16ec0b0 100644 --- a/Source/Scene/ClassificationType.js +++ b/Source/Scene/ClassificationType.js @@ -1,7 +1,7 @@ /** * Whether a classification affects terrain, 3D Tiles or both. * - * @exports ClassificationType + * @enum {Number} */ var ClassificationType = { /** @@ -25,9 +25,11 @@ var ClassificationType = { * @constant */ BOTH: 2, - /** - * @private - */ - NUMBER_OF_CLASSIFICATION_TYPES: 3, }; + +/** + * @private + */ +ClassificationType.NUMBER_OF_CLASSIFICATION_TYPES = 3; + export default Object.freeze(ClassificationType); diff --git a/Source/Scene/ColorBlendMode.js b/Source/Scene/ColorBlendMode.js index 95dbfed023ff..696c101a2c83 100644 --- a/Source/Scene/ColorBlendMode.js +++ b/Source/Scene/ColorBlendMode.js @@ -7,7 +7,7 @@ import CesiumMath from "../Core/Math.js"; * REPLACE replaces the source color with the target color * MIX blends the source color and target color together * - * @exports ColorBlendMode + * @enum {Number} * * @see Model.colorBlendMode */ diff --git a/Source/Scene/ConditionsExpression.js b/Source/Scene/ConditionsExpression.js index e3fa7f45bf56..37133d9e3f28 100644 --- a/Source/Scene/ConditionsExpression.js +++ b/Source/Scene/ConditionsExpression.js @@ -136,7 +136,7 @@ ConditionsExpression.prototype.evaluateColor = function (feature, result) { * Returns undefined if the shader function can't be generated from this expression. * * @param {String} functionName Name to give to the generated function. - * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes. + * @param {String} propertyNameMap Maps property variable names to shader attribute names. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent. * @param {String} returnType The return type of the generated function. * @@ -146,7 +146,7 @@ ConditionsExpression.prototype.evaluateColor = function (feature, result) { */ ConditionsExpression.prototype.getShaderFunction = function ( functionName, - attributePrefix, + propertyNameMap, shaderState, returnType ) { @@ -161,11 +161,11 @@ ConditionsExpression.prototype.getShaderFunction = function ( var statement = conditions[i]; var condition = statement.condition.getShaderExpression( - attributePrefix, + propertyNameMap, shaderState ); var expression = statement.expression.getShaderExpression( - attributePrefix, + propertyNameMap, shaderState ); diff --git a/Source/Scene/CullFace.js b/Source/Scene/CullFace.js index 7be2cb95c7d6..ecd2676270f1 100644 --- a/Source/Scene/CullFace.js +++ b/Source/Scene/CullFace.js @@ -3,7 +3,7 @@ import WebGLConstants from "../Core/WebGLConstants.js"; /** * Determines which triangles, if any, are culled. * - * @exports CullFace + * @enum {Number} */ var CullFace = { /** diff --git a/Source/Scene/DebugAppearance.js b/Source/Scene/DebugAppearance.js index c321a41d0302..fc2c720d9a78 100644 --- a/Source/Scene/DebugAppearance.js +++ b/Source/Scene/DebugAppearance.js @@ -20,7 +20,7 @@ import Appearance from "./Appearance.js"; * @param {String} [options.glslDatatype='vec3'] The GLSL datatype of the attribute. Supported datatypes are float, vec2, vec3, and vec4. * @param {String} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader. * @param {String} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader. - * @param {RenderState} [options.renderState] Optional render state to override the default render state. + * @param {Object} [options.renderState] Optional render state to override the default render state. * * @exception {DeveloperError} options.glslDatatype must be float, vec2, vec3, or vec4. * diff --git a/Source/Scene/DebugCameraPrimitive.js b/Source/Scene/DebugCameraPrimitive.js index fef7764854f3..e7c76410acba 100644 --- a/Source/Scene/DebugCameraPrimitive.js +++ b/Source/Scene/DebugCameraPrimitive.js @@ -25,6 +25,7 @@ import Primitive from "./Primitive.js"; * * @param {Object} options Object with the following properties: * @param {Camera} options.camera The camera. + * @param {Number[]} [options.frustumSplits] Distances to the near and far planes of the camera frustums. This overrides the camera's frustum near and far values. * @param {Color} [options.color=Color.CYAN] The color of the debug outline. * @param {Boolean} [options.updateOnChange=true] Whether the primitive updates when the underlying camera changes. * @param {Boolean} [options.show=true] Determines if this primitive will be shown. @@ -46,6 +47,7 @@ function DebugCameraPrimitive(options) { //>>includeEnd('debug'); this._camera = options.camera; + this._frustumSplits = options.frustumSplits; this._color = defaultValue(options.color, Color.CYAN); this._updateOnChange = defaultValue(options.updateOnChange, true); @@ -124,13 +126,16 @@ DebugCameraPrimitive.prototype.update = function (frameState) { } frustum = cameraFrustum.clone(frustum); - var frustumSplits = frameState.frustumSplits; - var numFrustums = frustumSplits.length - 1; - if (numFrustums <= 0) { - frustumSplits = scratchSplits; // Use near and far planes if no splits created + var numFrustums; + var frustumSplits = this._frustumSplits; + if (!defined(frustumSplits) || frustumSplits.length <= 1) { + // Use near and far planes if no splits created + frustumSplits = scratchSplits; frustumSplits[0] = this._camera.frustum.near; frustumSplits[1] = this._camera.frustum.far; numFrustums = 1; + } else { + numFrustums = frustumSplits.length - 1; } var position = camera.positionWC; diff --git a/Source/Scene/DepthFunction.js b/Source/Scene/DepthFunction.js index 75ca750a45cc..e84970b58ea7 100644 --- a/Source/Scene/DepthFunction.js +++ b/Source/Scene/DepthFunction.js @@ -3,7 +3,7 @@ import WebGLConstants from "../Core/WebGLConstants.js"; /** * Determines the function used to compare two depths for the depth test. * - * @exports DepthFunction + * @enum {Number} */ var DepthFunction = { /** diff --git a/Source/Scene/DepthPlane.js b/Source/Scene/DepthPlane.js index bf3f0cdbadf4..f5a37313f7ac 100644 --- a/Source/Scene/DepthPlane.js +++ b/Source/Scene/DepthPlane.js @@ -5,6 +5,7 @@ import defined from "../Core/defined.js"; import FeatureDetection from "../Core/FeatureDetection.js"; import Geometry from "../Core/Geometry.js"; import GeometryAttribute from "../Core/GeometryAttribute.js"; +import OrthographicFrustum from "../Core/OrthographicFrustum.js"; import PrimitiveType from "../Core/PrimitiveType.js"; import BufferUsage from "../Renderer/BufferUsage.js"; import DrawCommand from "../Renderer/DrawCommand.js"; @@ -36,69 +37,72 @@ var scratchCartesian1 = new Cartesian3(); var scratchCartesian2 = new Cartesian3(); var scratchCartesian3 = new Cartesian3(); var scratchCartesian4 = new Cartesian3(); +var scratchCartesian5 = new Cartesian3(); function computeDepthQuad(ellipsoid, frameState) { var radii = ellipsoid.radii; - var p = frameState.camera.positionWC; - - // Find the corresponding position in the scaled space of the ellipsoid. - var q = Cartesian3.multiplyComponents( - ellipsoid.oneOverRadii, - p, - scratchCartesian1 - ); - - var qMagnitude = Cartesian3.magnitude(q); - var qUnit = Cartesian3.normalize(q, scratchCartesian2); - - // Determine the east and north directions at q. - var eUnit = Cartesian3.normalize( - Cartesian3.cross(Cartesian3.UNIT_Z, q, scratchCartesian3), - scratchCartesian3 - ); - var nUnit = Cartesian3.normalize( - Cartesian3.cross(qUnit, eUnit, scratchCartesian4), - scratchCartesian4 - ); - - // Determine the radius of the 'limb' of the ellipsoid. - var wMagnitude = Math.sqrt(Cartesian3.magnitudeSquared(q) - 1.0); - - // Compute the center and offsets. - var center = Cartesian3.multiplyByScalar( - qUnit, - 1.0 / qMagnitude, - scratchCartesian1 - ); - var scalar = wMagnitude / qMagnitude; - var eastOffset = Cartesian3.multiplyByScalar( - eUnit, - scalar, - scratchCartesian2 - ); - var northOffset = Cartesian3.multiplyByScalar( - nUnit, - scalar, - scratchCartesian3 - ); + var camera = frameState.camera; + var center, eastOffset, northOffset; + + if (camera.frustum instanceof OrthographicFrustum) { + center = Cartesian3.ZERO; + eastOffset = camera.rightWC; + northOffset = camera.upWC; + } else { + var p = camera.positionWC; + + // Find the corresponding position in the scaled space of the ellipsoid. + var q = Cartesian3.multiplyComponents( + ellipsoid.oneOverRadii, + p, + scratchCartesian1 + ); + + var qUnit = Cartesian3.normalize(q, scratchCartesian2); + + // Determine the east and north directions at q. + var eUnit = Cartesian3.normalize( + Cartesian3.cross(Cartesian3.UNIT_Z, q, scratchCartesian3), + scratchCartesian3 + ); + var nUnit = Cartesian3.normalize( + Cartesian3.cross(qUnit, eUnit, scratchCartesian4), + scratchCartesian4 + ); + + var qMagnitude = Cartesian3.magnitude(q); + + // Determine the radius of the 'limb' of the ellipsoid. + var wMagnitude = Math.sqrt(qMagnitude * qMagnitude - 1.0); + + // Compute the center and offsets. + center = Cartesian3.multiplyByScalar( + qUnit, + 1.0 / qMagnitude, + scratchCartesian1 + ); + var scalar = wMagnitude / qMagnitude; + eastOffset = Cartesian3.multiplyByScalar(eUnit, scalar, scratchCartesian2); + northOffset = Cartesian3.multiplyByScalar(nUnit, scalar, scratchCartesian3); + } // A conservative measure for the longitudes would be to use the min/max longitudes of the bounding frustum. - var upperLeft = Cartesian3.add(center, northOffset, scratchCartesian4); + var upperLeft = Cartesian3.add(center, northOffset, scratchCartesian5); Cartesian3.subtract(upperLeft, eastOffset, upperLeft); Cartesian3.multiplyComponents(radii, upperLeft, upperLeft); Cartesian3.pack(upperLeft, depthQuadScratch, 0); - var lowerLeft = Cartesian3.subtract(center, northOffset, scratchCartesian4); + var lowerLeft = Cartesian3.subtract(center, northOffset, scratchCartesian5); Cartesian3.subtract(lowerLeft, eastOffset, lowerLeft); Cartesian3.multiplyComponents(radii, lowerLeft, lowerLeft); Cartesian3.pack(lowerLeft, depthQuadScratch, 3); - var upperRight = Cartesian3.add(center, northOffset, scratchCartesian4); + var upperRight = Cartesian3.add(center, northOffset, scratchCartesian5); Cartesian3.add(upperRight, eastOffset, upperRight); Cartesian3.multiplyComponents(radii, upperRight, upperRight); Cartesian3.pack(upperRight, depthQuadScratch, 6); - var lowerRight = Cartesian3.subtract(center, northOffset, scratchCartesian4); + var lowerRight = Cartesian3.subtract(center, northOffset, scratchCartesian5); Cartesian3.add(lowerRight, eastOffset, lowerRight); Cartesian3.multiplyComponents(radii, lowerRight, lowerRight); Cartesian3.pack(lowerRight, depthQuadScratch, 9); diff --git a/Source/Scene/DiscardEmptyTileImagePolicy.js b/Source/Scene/DiscardEmptyTileImagePolicy.js index 40d4322ba9aa..90fb289b678f 100644 --- a/Source/Scene/DiscardEmptyTileImagePolicy.js +++ b/Source/Scene/DiscardEmptyTileImagePolicy.js @@ -23,7 +23,7 @@ DiscardEmptyTileImagePolicy.prototype.isReady = function () { /** * Given a tile image, decide whether to discard that image. * - * @param {Image} image An image to test. + * @param {HTMLImageElement} image An image to test. * @returns {Boolean} True if the image should be discarded; otherwise, false. */ DiscardEmptyTileImagePolicy.prototype.shouldDiscardImage = function (image) { @@ -35,7 +35,7 @@ var emptyImage; Object.defineProperties(DiscardEmptyTileImagePolicy, { /** * Default value for representing an empty image. - * @type {Image} + * @type {HTMLImageElement} * @readonly * @memberof DiscardEmptyTileImagePolicy */ diff --git a/Source/Scene/DiscardMissingTileImagePolicy.js b/Source/Scene/DiscardMissingTileImagePolicy.js index ce7ce5dd17ac..66b5110124dc 100644 --- a/Source/Scene/DiscardMissingTileImagePolicy.js +++ b/Source/Scene/DiscardMissingTileImagePolicy.js @@ -104,7 +104,7 @@ DiscardMissingTileImagePolicy.prototype.isReady = function () { /** * Given a tile image, decide whether to discard that image. * - * @param {Image} image An image to test. + * @param {HTMLImageElement} image An image to test. * @returns {Boolean} True if the image should be discarded; otherwise, false. * * @exception {DeveloperError} shouldDiscardImage must not be called before the discard policy is ready. diff --git a/Source/Scene/EllipsoidSurfaceAppearance.js b/Source/Scene/EllipsoidSurfaceAppearance.js index 84f6836af07b..1457e7115551 100644 --- a/Source/Scene/EllipsoidSurfaceAppearance.js +++ b/Source/Scene/EllipsoidSurfaceAppearance.js @@ -24,7 +24,7 @@ import Material from "./Material.js"; * @param {Material} [options.material=Material.ColorType] The material used to determine the fragment color. * @param {String} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader. * @param {String} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader. - * @param {RenderState} [options.renderState] Optional render state to override the default render state. + * @param {Object} [options.renderState] Optional render state to override the default render state. * * @see {@link https://github.com/CesiumGS/cesium/wiki/Fabric|Fabric} * diff --git a/Source/Scene/Expression.js b/Source/Scene/Expression.js index 9f8582ff7f91..245238fa414f 100644 --- a/Source/Scene/Expression.js +++ b/Source/Scene/Expression.js @@ -171,7 +171,7 @@ Expression.prototype.evaluateColor = function (feature, result) { * Returns undefined if the shader function can't be generated from this expression. * * @param {String} functionName Name to give to the generated function. - * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes. + * @param {String} propertyNameMap Maps property variable names to shader attribute names. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent. * @param {String} returnType The return type of the generated function. * @@ -181,11 +181,11 @@ Expression.prototype.evaluateColor = function (feature, result) { */ Expression.prototype.getShaderFunction = function ( functionName, - attributePrefix, + propertyNameMap, shaderState, returnType ) { - var shaderExpression = this.getShaderExpression(attributePrefix, shaderState); + var shaderExpression = this.getShaderExpression(propertyNameMap, shaderState); shaderExpression = returnType + @@ -205,7 +205,7 @@ Expression.prototype.getShaderFunction = function ( * Gets the shader expression for this expression. * Returns undefined if the shader expression can't be generated from this expression. * - * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes. + * @param {String} propertyNameMap Maps property variable names to shader attribute names. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent. * * @returns {String} The shader expression. @@ -213,10 +213,10 @@ Expression.prototype.getShaderFunction = function ( * @private */ Expression.prototype.getShaderExpression = function ( - attributePrefix, + propertyNameMap, shaderState ) { - return this._runtimeAst.getShaderExpression(attributePrefix, shaderState); + return this._runtimeAst.getShaderExpression(propertyNameMap, shaderState); }; var unaryOperators = ["!", "-", "+"]; @@ -1967,12 +1967,12 @@ function colorToVec4(color) { return "vec4(" + r + ", " + g + ", " + b + ", " + a + ")"; } -function getExpressionArray(array, attributePrefix, shaderState, parent) { +function getExpressionArray(array, propertyNameMap, shaderState, parent) { var length = array.length; var expressions = new Array(length); for (var i = 0; i < length; ++i) { expressions[i] = array[i].getShaderExpression( - attributePrefix, + propertyNameMap, shaderState, parent ); @@ -1980,10 +1980,22 @@ function getExpressionArray(array, attributePrefix, shaderState, parent) { return expressions; } +function getVariableName(variableName, propertyNameMap) { + if (!defined(propertyNameMap[variableName])) { + throw new RuntimeError( + 'Style references a property "' + + variableName + + '" that does not exist or is not styleable.' + ); + } + + return propertyNameMap[variableName]; +} + var nullSentinel = "czm_infinity"; // null just needs to be some sentinel value that will cause "[expression] === null" to be false in nearly all cases. GLSL doesn't have a NaN constant so use czm_infinity. Node.prototype.getShaderExpression = function ( - attributePrefix, + propertyNameMap, shaderState, parent ) { @@ -1998,28 +2010,31 @@ Node.prototype.getShaderExpression = function ( if (defined(this._left)) { if (Array.isArray(this._left)) { // Left can be an array if the type is LITERAL_COLOR or LITERAL_VECTOR - left = getExpressionArray(this._left, attributePrefix, shaderState, this); + left = getExpressionArray(this._left, propertyNameMap, shaderState, this); } else { - left = this._left.getShaderExpression(attributePrefix, shaderState, this); + left = this._left.getShaderExpression(propertyNameMap, shaderState, this); } } if (defined(this._right)) { - right = this._right.getShaderExpression(attributePrefix, shaderState, this); + right = this._right.getShaderExpression(propertyNameMap, shaderState, this); } if (defined(this._test)) { - test = this._test.getShaderExpression(attributePrefix, shaderState, this); + test = this._test.getShaderExpression(propertyNameMap, shaderState, this); } if (Array.isArray(this._value)) { // For ARRAY type - value = getExpressionArray(this._value, attributePrefix, shaderState, this); + value = getExpressionArray(this._value, propertyNameMap, shaderState, this); } switch (type) { case ExpressionNodeType.VARIABLE: - return attributePrefix + value; + if (checkFeature(this)) { + return undefined; + } + return getVariableName(value, propertyNameMap); case ExpressionNodeType.UNARY: // Supported types: +, -, !, Boolean, Number if (value === "Boolean") { @@ -2071,6 +2086,9 @@ Node.prototype.getShaderExpression = function ( case ExpressionNodeType.CONDITIONAL: return "(" + test + " ? " + left + " : " + right + ")"; case ExpressionNodeType.MEMBER: + if (checkFeature(this._left)) { + return getVariableName(right, propertyNameMap); + } // This is intended for accessing the components of vector properties. String members aren't supported. // Check for 0.0 rather than 0 because all numbers are previously converted to decimals. if (right === "r" || right === "x" || right === "0.0") { @@ -2132,7 +2150,8 @@ Node.prototype.getShaderExpression = function ( value === "x" || value === "y" || value === "z" || - value === "w" + value === "w" || + checkFeature(parent._left) ) { return value; } diff --git a/Source/Scene/FrameState.js b/Source/Scene/FrameState.js index af2d537d7074..8c5e706a8bc5 100644 --- a/Source/Scene/FrameState.js +++ b/Source/Scene/FrameState.js @@ -135,6 +135,14 @@ function FrameState(context, creditDisplay, jobScheduler) { */ this.cameraUnderground = false; + /** + * The {@link GlobeTranslucencyState} object used by the scene. + * + * @type {GlobeTranslucencyState} + * @default undefined + */ + this.globeTranslucencyState = undefined; + /** * The culling volume. * @@ -169,40 +177,37 @@ function FrameState(context, creditDisplay, jobScheduler) { */ this.pixelRatio = 1.0; + /** + * @typedef FrameState.Passes + * @type {Object} + * @property {Boolean} render true if the primitive should update for a render pass, false otherwise. + * @property {Boolean} pick true if the primitive should update for a picking pass, false otherwise. + * @property {Boolean} depth true if the primitive should update for a depth only pass, false otherwise. + * @property {Boolean} postProcess true if the primitive should update for a per-feature post-process pass, false otherwise. + * @property {Boolean} offscreen true if the primitive should update for an offscreen pass, false otherwise. + */ + + /** + * @type {FrameState.Passes} + */ this.passes = { /** - * true if the primitive should update for a render pass, false otherwise. - * - * @type {Boolean} * @default false */ render: false, - /** - * true if the primitive should update for a picking pass, false otherwise. - * - * @type {Boolean} * @default false */ pick: false, - /** - * true if the primitive should update for a depth only pass, false otherwise. - * @type {Boolean} * @default false */ depth: false, - /** - * true if the primitive should update for a per-feature post-process pass, false otherwise. - * @type {Boolean} * @default false */ postProcess: false, - /** - * true if the primitive should update for an offscreen pass, false otherwise. - * @type {Boolean} * @default false */ offscreen: false, @@ -225,7 +230,7 @@ function FrameState(context, creditDisplay, jobScheduler) { * directly in update functions. *

* - * @type {FrameState~AfterRenderCallback[]} + * @type {FrameState.AfterRenderCallback[]} * * @example * frameState.afterRender.push(function() { @@ -242,33 +247,26 @@ function FrameState(context, creditDisplay, jobScheduler) { */ this.scene3DOnly = false; + /** + * @typedef FrameState.Fog + * @type {Object} + * @property {Boolean} enabled true if fog is enabled, false otherwise. + * @property {Number} density A positive number used to mix the color and fog color based on camera distance. + * @property {Number} sse A scalar used to modify the screen space error of geometry partially in fog. + * @property {Number} minimumBrightness The minimum brightness of terrain with fog applied. + */ + + /** + * @type {FrameState.Fog} + */ + this.fog = { /** - * true if fog is enabled, false otherwise. - * @type {Boolean} * @default false */ enabled: false, - /** - * A positive number used to mix the color and fog color based on camera distance. - * - * @type {Number} - * @default undefined - */ density: undefined, - /** - * A scalar used to modify the screen space error of geometry partially in fog. - * - * @type {Number} - * @default undefined - */ sse: undefined, - /** - * The minimum brightness of terrain with fog applied. - * - * @type {Number} - * @default undefined - */ minimumBrightness: undefined, }; @@ -279,57 +277,49 @@ function FrameState(context, creditDisplay, jobScheduler) { */ this.terrainExaggeration = 1.0; - this.shadowState = { - /** - * Whether there are any active shadow maps this frame. - * @type {Boolean} - */ - shadowsEnabled: true, + /** + * @typedef FrameState.ShadowState + * @type {Object} + * @property {Boolean} shadowsEnabled Whether there are any active shadow maps this frame. + * @property {Boolean} lightShadowsEnabled Whether there are any active shadow maps that originate from light sources. Does not include shadow maps that are used for analytical purposes. + * @property {ShadowMap[]} shadowMaps All shadow maps that are enabled this frame. + * @property {ShadowMap[]} lightShadowMaps Shadow maps that originate from light sources. Does not include shadow maps that are used for analytical purposes. Only these shadow maps will be used to generate receive shadows shaders. + * @property {Number} nearPlane The near plane of the scene's frustum commands. Used for fitting cascaded shadow maps. + * @property {Number} farPlane The far plane of the scene's frustum commands. Used for fitting cascaded shadow maps. + * @property {Number} closestObjectSize The size of the bounding volume that is closest to the camera. This is used to place more shadow detail near the object. + * @property {Number} lastDirtyTime The time when a shadow map was last dirty + * @property {Boolean} outOfView Whether the shadows maps are out of view this frame + */ - /** - * Whether there are any active shadow maps that originate from light sources. Does not - * include shadow maps that are used for analytical purposes. - */ - lightShadowsEnabled: true, + /** + * @type {FrameState.ShadowState} + */ + this.shadowState = { /** - * All shadow maps that are enabled this frame. + * @default true */ + shadowsEnabled: true, shadowMaps: [], - - /** - * Shadow maps that originate from light sources. Does not include shadow maps that are used for - * analytical purposes. Only these shadow maps will be used to generate receive shadows shaders. - */ lightShadowMaps: [], - /** - * The near plane of the scene's frustum commands. Used for fitting cascaded shadow maps. - * @type {Number} + * @default 1.0 */ nearPlane: 1.0, - /** - * The far plane of the scene's frustum commands. Used for fitting cascaded shadow maps. - * @type {Number} + * @default 5000.0 */ farPlane: 5000.0, - /** - * The size of the bounding volume that is closest to the camera. This is used to place more shadow detail near the object. - * @type {Number} + * @default 1000.0 */ closestObjectSize: 1000.0, - /** - * The time when a shadow map was last dirty - * @type {Number} + * @default 0 */ lastDirtyTime: 0, - /** - * Whether the shadows maps are out of view this frame - * @type {Boolean} + * @default true */ outOfView: true, }; @@ -412,6 +402,6 @@ function FrameState(context, creditDisplay, jobScheduler) { /** * A function that will be called at the end of the frame. * - * @callback FrameState~AfterRenderCallback + * @callback FrameState.AfterRenderCallback */ export default FrameState; diff --git a/Source/Scene/Globe.js b/Source/Scene/Globe.js index 39dbb29d9496..9d34422954c9 100644 --- a/Source/Scene/Globe.js +++ b/Source/Scene/Globe.js @@ -2,6 +2,7 @@ import BoundingSphere from "../Core/BoundingSphere.js"; import buildModuleUrl from "../Core/buildModuleUrl.js"; import Cartesian3 from "../Core/Cartesian3.js"; import Cartographic from "../Core/Cartographic.js"; +import Color from "../Core/Color.js"; import defaultValue from "../Core/defaultValue.js"; import defined from "../Core/defined.js"; import destroyObject from "../Core/destroyObject.js"; @@ -10,6 +11,7 @@ import Ellipsoid from "../Core/Ellipsoid.js"; import EllipsoidTerrainProvider from "../Core/EllipsoidTerrainProvider.js"; import Event from "../Core/Event.js"; import IntersectionTests from "../Core/IntersectionTests.js"; +import NearFarScalar from "../Core/NearFarScalar.js"; import Ray from "../Core/Ray.js"; import Rectangle from "../Core/Rectangle.js"; import Resource from "../Core/Resource.js"; @@ -21,6 +23,7 @@ import GroundAtmosphere from "../Shaders/GroundAtmosphere.js"; import when from "../ThirdParty/when.js"; import GlobeSurfaceShaderSet from "./GlobeSurfaceShaderSet.js"; import GlobeSurfaceTileProvider from "./GlobeSurfaceTileProvider.js"; +import GlobeTranslucency from "./GlobeTranslucency.js"; import ImageryLayerCollection from "./ImageryLayerCollection.js"; import QuadtreePrimitive from "./QuadtreePrimitive.js"; import SceneMode from "./SceneMode.js"; @@ -60,6 +63,16 @@ function Globe(ellipsoid) { this._terrainProvider = terrainProvider; this._terrainProviderChanged = new Event(); + this._undergroundColor = Color.clone(Color.BLACK); + this._undergroundColorAlphaByDistance = new NearFarScalar( + ellipsoid.maximumRadius / 1000.0, + 0.0, + ellipsoid.maximumRadius / 5.0, + 1.0 + ); + + this._translucency = new GlobeTranslucency(); + makeShadersDirty(this); /** @@ -271,7 +284,7 @@ function Globe(ellipsoid) { /** * Whether to show terrain skirts. Terrain skirts are geometry extending downwards from a tile's edges used to hide seams between neighboring tiles. - * It may be desirable to hide terrain skirts if terrain is translucent or when viewing terrain from below the surface. + * Skirts are always hidden when the camera is underground or translucency is enabled. * * @type {Boolean} * @default true @@ -279,7 +292,7 @@ function Globe(ellipsoid) { this.showSkirts = true; /** - * Whether to cull back-facing terrain. Set this to false when viewing terrain from below the surface. + * Whether to cull back-facing terrain. Back faces are not culled when the camera is underground or translucency is enabled. * * @type {Boolean} * @default true @@ -374,9 +387,9 @@ Object.defineProperties(Globe.prototype, { * A property specifying a {@link Rectangle} used to limit globe rendering to a cartographic area. * Defaults to the maximum extent of cartographic coordinates. * - * @member Globe.prototype + * @memberof Globe.prototype * @type {Rectangle} - * @default Rectangle.MAX_VALUE + * @default {@link Rectangle.MAX_VALUE} */ cartographicLimitRectangle: { get: function () { @@ -469,6 +482,75 @@ Object.defineProperties(Globe.prototype, { } }, }, + + /** + * The color to render the back side of the globe when the camera is underground or the globe is translucent, + * blended with the globe color based on the camera's distance. + *

+ * To disable underground coloring, set undergroundColor to undefined. + * + * @memberof Globe.prototype + * @type {Color} + * @default {@link Color.BLACK} + * + * @see Globe#undergroundColorAlphaByDistance + */ + undergroundColor: { + get: function () { + return this._undergroundColor; + }, + set: function (value) { + this._undergroundColor = Color.clone(value, this._undergroundColor); + }, + }, + + /** + * Gets or sets the near and far distance for blending {@link Globe#undergroundColor} with the globe color. + * The alpha will interpolate between the {@link NearFarScalar#nearValue} and + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds + * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. + * Outside of these ranges the alpha remains clamped to the nearest bound. If undefined, + * the underground color will not be blended with the globe color. + *

+ * When the camera is above the ellipsoid the distance is computed from the nearest + * point on the ellipsoid instead of the camera's position. + * + * @memberof Globe.prototype + * @type {NearFarScalar} + * + * @see Globe#undergroundColor + * + */ + undergroundColorAlphaByDistance: { + get: function () { + return this._undergroundColorAlphaByDistance; + }, + set: function (value) { + //>>includeStart('debug', pragmas.debug); + if (defined(value) && value.far < value.near) { + throw new DeveloperError( + "far distance must be greater than near distance." + ); + } + //>>includeEnd('debug'); + this._undergroundColorAlphaByDistance = NearFarScalar.clone( + value, + this._undergroundColorAlphaByDistance + ); + }, + }, + + /** + * Properties for controlling globe translucency. + * + * @memberof Globe.prototype + * @type {GlobeTranslucency} + */ + translucency: { + get: function () { + return this._translucency; + }, + }, }); function makeShadersDirty(globe) { @@ -486,9 +568,9 @@ function makeShadersDirty(globe) { ) { fragmentSources.push(globe._material.shaderSource); defines.push("APPLY_MATERIAL"); - globe._surface._tileProvider.uniformMap = globe._material._uniforms; + globe._surface._tileProvider.materialUniformMap = globe._material._uniforms; } else { - globe._surface._tileProvider.uniformMap = undefined; + globe._surface._tileProvider.materialUniformMap = undefined; } fragmentSources.push(GlobeFS); @@ -530,12 +612,18 @@ var scratchSphereIntersectionResult = { * * @param {Ray} ray The ray to test for intersection. * @param {Scene} scene The scene. + * @param {Boolean} [cullBackFaces=true] Set to true to not pick back faces. * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3|undefined} The intersection or undefined if none was found. The returned position is in projected coordinates for 2D and Columbus View. * * @private */ -Globe.prototype.pickWorldCoordinates = function (ray, scene, result) { +Globe.prototype.pickWorldCoordinates = function ( + ray, + scene, + cullBackFaces, + result +) { //>>includeStart('debug', pragmas.debug); if (!defined(ray)) { throw new DeveloperError("ray is required"); @@ -545,6 +633,8 @@ Globe.prototype.pickWorldCoordinates = function (ray, scene, result) { } //>>includeEnd('debug'); + cullBackFaces = defaultValue(cullBackFaces, true); + var mode = scene.mode; var projection = scene.mapProjection; @@ -609,7 +699,7 @@ Globe.prototype.pickWorldCoordinates = function (ray, scene, result) { ray, scene.mode, scene.mapProjection, - true, + cullBackFaces, result ); if (defined(intersection)) { @@ -635,7 +725,7 @@ var cartoScratch = new Cartographic(); * var intersection = globe.pick(ray, scene); */ Globe.prototype.pick = function (ray, scene, result) { - result = this.pickWorldCoordinates(ray, scene, result); + result = this.pickWorldCoordinates(ray, scene, true, result); if (defined(result) && scene.mode !== SceneMode.SCENE3D) { result = Cartesian3.fromElements(result.y, result.z, result.x, result); var carto = scene.mapProjection.unproject(result, cartoScratch); @@ -868,6 +958,8 @@ Globe.prototype.beginFrame = function (frameState) { tileProvider.fillHighlightColor = this.fillHighlightColor; tileProvider.showSkirts = this.showSkirts; tileProvider.backFaceCulling = this.backFaceCulling; + tileProvider.undergroundColor = this._undergroundColor; + tileProvider.undergroundColorAlphaByDistance = this._undergroundColorAlphaByDistance; surface.beginFrame(frameState); } }; diff --git a/Source/Scene/GlobeSurfaceShaderSet.js b/Source/Scene/GlobeSurfaceShaderSet.js index c96f89c2a6ac..df662a8f69c2 100644 --- a/Source/Scene/GlobeSurfaceShaderSet.js +++ b/Source/Scene/GlobeSurfaceShaderSet.js @@ -80,6 +80,7 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { var applySaturation = options.applySaturation; var applyGamma = options.applyGamma; var applyAlpha = options.applyAlpha; + var applyDayNightAlpha = options.applyDayNightAlpha; var applySplit = options.applySplit; var showReflectiveOcean = options.showReflectiveOcean; var showOceanWaves = options.showOceanWaves; @@ -99,6 +100,8 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { var colorCorrect = options.colorCorrect; var highlightFillTile = options.highlightFillTile; var colorToAlpha = options.colorToAlpha; + var showUndergroundColor = options.showUndergroundColor; + var translucent = options.translucent; var quantization = 0; var quantizationDefine = ""; @@ -151,7 +154,10 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { (imageryCutoutFlag << 22) | (colorCorrect << 23) | (highlightFillTile << 24) | - (colorToAlpha << 25); + (colorToAlpha << 25) | + (showUndergroundColor << 26) | + (translucent << 27) | + (applyDayNightAlpha << 28); var currentClippingShaderState = 0; if (defined(clippingPlanes) && clippingPlanes.length > 0) { @@ -217,6 +223,9 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { if (applyAlpha) { fs.defines.push("APPLY_ALPHA"); } + if (applyDayNightAlpha) { + fs.defines.push("APPLY_DAY_NIGHT_ALPHA"); + } if (showReflectiveOcean) { fs.defines.push("SHOW_REFLECTIVE_OCEAN"); vs.defines.push("SHOW_REFLECTIVE_OCEAN"); @@ -227,7 +236,14 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { if (colorToAlpha) { fs.defines.push("APPLY_COLOR_TO_ALPHA"); } - + if (showUndergroundColor) { + vs.defines.push("UNDERGROUND_COLOR"); + fs.defines.push("UNDERGROUND_COLOR"); + } + if (translucent) { + vs.defines.push("TRANSLUCENT"); + fs.defines.push("TRANSLUCENT"); + } if (enableLighting) { if (hasVertexNormals) { vs.defines.push("ENABLE_VERTEX_LIGHTING"); @@ -279,7 +295,7 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { var computeDayColor = "\ - vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates)\n\ + vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)\n\ {\n\ vec4 color = initialColor;\n"; @@ -322,6 +338,10 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { (applyAlpha ? "u_dayTextureAlpha[" + i + "]" : "1.0") + ",\n\ " + + (applyDayNightAlpha ? "u_dayTextureNightAlpha[" + i + "]" : "1.0") + + ",\n" + + (applyDayNightAlpha ? "u_dayTextureDayAlpha[" + i + "]" : "1.0") + + ",\n" + (applyBrightness ? "u_dayTextureBrightness[" + i + "]" : "0.0") + ",\n\ " + @@ -341,7 +361,8 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { ",\n\ " + (colorToAlpha ? "u_colorsToAlpha[" + i + "]" : "vec4(0.0)") + - "\n\ + ",\n\ + nightBlend\ );\n"; if (hasImageryLayerCutout) { computeDayColor += diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index 2f43ecd92c3a..fe9e2bc7eed9 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -19,6 +19,7 @@ import IndexDatatype from "../Core/IndexDatatype.js"; import Intersect from "../Core/Intersect.js"; import CesiumMath from "../Core/Math.js"; import Matrix4 from "../Core/Matrix4.js"; +import NearFarScalar from "../Core/NearFarScalar.js"; import OrientedBoundingBox from "../Core/OrientedBoundingBox.js"; import OrthographicFrustum from "../Core/OrthographicFrustum.js"; import PrimitiveType from "../Core/PrimitiveType.js"; @@ -104,6 +105,11 @@ function GlobeSurfaceTileProvider(options) { this.showSkirts = true; this.backFaceCulling = true; + this.undergroundColor = undefined; + this.undergroundColorAlphaByDistance = undefined; + + this.materialUniformMap = undefined; + this._materialUniformMap = undefined; this._quadtree = undefined; this._terrainProvider = options.terrainProvider; @@ -484,6 +490,20 @@ GlobeSurfaceTileProvider.prototype.endUpdate = function (frameState) { } }; +function pushCommand(command, frameState) { + var globeTranslucencyState = frameState.globeTranslucencyState; + if (globeTranslucencyState.translucent) { + var isBlendCommand = command.renderState.blending.enabled; + globeTranslucencyState.pushDerivedCommands( + command, + isBlendCommand, + frameState + ); + } else { + frameState.commandList.push(command); + } +} + /** * Adds draw commands for tiles rendered in the previous frame for a pick pass. * @@ -493,7 +513,7 @@ GlobeSurfaceTileProvider.prototype.updateForPick = function (frameState) { // Add the tile pick commands from the tiles drawn last frame. var drawCommands = this._drawCommands; for (var i = 0, length = this._usedDrawCommands; i < length; ++i) { - frameState.commandList.push(drawCommands[i]); + pushCommand(drawCommands[i], frameState); } }; @@ -599,6 +619,36 @@ function clipRectangleAntimeridian(tileRectangle, cartographicLimitRectangle) { return splitRectangle; } +function isUndergroundVisible(tileProvider, frameState) { + if (frameState.cameraUnderground) { + return true; + } + + if (frameState.globeTranslucencyState.translucent) { + return true; + } + + if (tileProvider.backFaceCulling) { + return false; + } + + var clippingPlanes = tileProvider._clippingPlanes; + if (defined(clippingPlanes) && clippingPlanes.enabled) { + return true; + } + + if ( + !Rectangle.equals( + tileProvider.cartographicLimitRectangle, + Rectangle.MAX_VALUE + ) + ) { + return true; + } + + return false; +} + /** * Determines the visibility of a given tile. The tile may be fully visible, partially visible, or not * visible at all. Tiles that are renderable and are at least partially visible will be shown by a call @@ -618,7 +668,9 @@ GlobeSurfaceTileProvider.prototype.computeTileVisibility = function ( var distance = this.computeDistanceToTile(tile, frameState); tile._distance = distance; - if (frameState.fog.enabled && !frameState.cameraUnderground) { + var undergroundVisible = isUndergroundVisible(this, frameState); + + if (frameState.fog.enabled && !undergroundVisible) { if (CesiumMath.fog(distance, frameState.fog.density) >= 1.0) { // Tile is completely in fog so return that it is not visible. return Visibility.NONE; @@ -713,7 +765,7 @@ GlobeSurfaceTileProvider.prototype.computeTileVisibility = function ( frameState.mode === SceneMode.SCENE3D && !ortho3D && defined(occluders) && - !frameState.cameraUnderground + !undergroundVisible ) { var occludeePointInScaledSpace = surfaceTile.occludeePointInScaledSpace; if (!defined(occludeePointInScaledSpace)) { @@ -925,6 +977,7 @@ var modifiedModelViewScratch = new Matrix4(); var modifiedModelViewProjectionScratch = new Matrix4(); var tileRectangleScratch = new Cartesian4(); var localizedCartographicLimitRectangleScratch = new Cartesian4(); +var localizedTranslucencyRectangleScratch = new Cartesian4(); var rtcScratch = new Cartesian3(); var centerEyeScratch = new Cartesian3(); var southwestScratch = new Cartesian3(); @@ -1507,6 +1560,12 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) { u_dayTextureAlpha: function () { return this.properties.dayTextureAlpha; }, + u_dayTextureNightAlpha: function () { + return this.properties.dayTextureNightAlpha; + }, + u_dayTextureDayAlpha: function () { + return this.properties.dayTextureDayAlpha; + }, u_dayTextureBrightness: function () { return this.properties.dayTextureBrightness; }, @@ -1584,6 +1643,21 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) { u_colorsToAlpha: function () { return this.properties.colorsToAlpha; }, + u_frontFaceAlphaByDistance: function () { + return this.properties.frontFaceAlphaByDistance; + }, + u_backFaceAlphaByDistance: function () { + return this.properties.backFaceAlphaByDistance; + }, + u_translucencyRectangle: function () { + return this.properties.localizedTranslucencyRectangle; + }, + u_undergroundColor: function () { + return this.properties.undergroundColor; + }, + u_undergroundColorAlphaByDistance: function () { + return this.properties.undergroundColorAlphaByDistance; + }, // make a separate object so that changes to the properties are seen on // derived commands that combine another uniform map with this one. @@ -1606,6 +1680,8 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) { dayTextureTexCoordsRectangle: [], dayTextureUseWebMercatorT: [], dayTextureAlpha: [], + dayTextureNightAlpha: [], + dayTextureDayAlpha: [], dayTextureBrightness: [], dayTextureContrast: [], dayTextureHue: [], @@ -1628,9 +1704,19 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) { clippingPlanesEdgeWidth: 0.0, localizedCartographicLimitRectangle: new Cartesian4(), + + frontFaceAlphaByDistance: new Cartesian4(), + backFaceAlphaByDistance: new Cartesian4(), + localizedTranslucencyRectangle: new Cartesian4(), + undergroundColor: Color.clone(Color.TRANSPARENT), + undergroundColorAlphaByDistance: new Cartesian4(), }, }; + if (defined(globeSurfaceTileProvider.materialUniformMap)) { + return combine(uniformMap, globeSurfaceTileProvider.materialUniformMap); + } + return uniformMap; } @@ -1802,6 +1888,7 @@ var surfaceShaderSetOptionsScratch = { applySaturation: undefined, applyGamma: undefined, applyAlpha: undefined, + applyDayNightAlpha: undefined, applySplit: undefined, showReflectiveOcean: undefined, showOceanWaves: undefined, @@ -1821,6 +1908,9 @@ var surfaceShaderSetOptionsScratch = { colorToAlpha: undefined, }; +var defaultUndergroundColor = Color.TRANSPARENT; +var defaultundergroundColorAlphaByDistance = new NearFarScalar(); + function addDrawCommandsForTile(tileProvider, tile, frameState) { var surfaceTile = tile.data; @@ -1860,6 +1950,28 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { var cameraUnderground = frameState.cameraUnderground; + var globeTranslucencyState = frameState.globeTranslucencyState; + var translucent = globeTranslucencyState.translucent; + var frontFaceAlphaByDistance = + globeTranslucencyState.frontFaceAlphaByDistance; + var backFaceAlphaByDistance = globeTranslucencyState.backFaceAlphaByDistance; + var translucencyRectangle = globeTranslucencyState.rectangle; + + var undergroundColor = defaultValue( + tileProvider.undergroundColor, + defaultUndergroundColor + ); + var undergroundColorAlphaByDistance = defaultValue( + tileProvider.undergroundColorAlphaByDistance, + defaultundergroundColorAlphaByDistance + ); + var showUndergroundColor = + isUndergroundVisible(tileProvider, frameState) && + frameState.mode === SceneMode.SCENE3D && + undergroundColor.alpha > 0.0 && + (undergroundColorAlphaByDistance.nearValue > 0.0 || + undergroundColorAlphaByDistance.farValue > 0.0); + var showReflectiveOcean = tileProvider.hasWaterMask && defined(waterMaskTexture); var oceanNormalMap = tileProvider.oceanNormalMap; @@ -1868,9 +1980,12 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { tileProvider.terrainProvider.ready && tileProvider.terrainProvider.hasVertexNormals; var enableFog = frameState.fog.enabled && !cameraUnderground; - var showGroundAtmosphere = tileProvider.showGroundAtmosphere; - var castShadows = ShadowMode.castShadows(tileProvider.shadows); - var receiveShadows = ShadowMode.receiveShadows(tileProvider.shadows); + var showGroundAtmosphere = + tileProvider.showGroundAtmosphere && frameState.mode === SceneMode.SCENE3D; + var castShadows = + ShadowMode.castShadows(tileProvider.shadows) && !translucent; + var receiveShadows = + ShadowMode.receiveShadows(tileProvider.shadows) && !translucent; var hueShift = tileProvider.hueShift; var saturationShift = tileProvider.saturationShift; @@ -1884,18 +1999,8 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { var perFragmentGroundAtmosphere = false; if (showGroundAtmosphere) { - var mode = frameState.mode; - var camera = frameState.camera; - var cameraDistance; - if (mode === SceneMode.SCENE2D || mode === SceneMode.COLUMBUS_VIEW) { - cameraDistance = camera.positionCartographic.height; - } else { - cameraDistance = Cartesian3.magnitude(camera.positionWC); - } + var cameraDistance = Cartesian3.magnitude(frameState.camera.positionWC); var fadeOutDistance = tileProvider.nightFadeOutDistance; - if (mode !== SceneMode.SCENE3D) { - fadeOutDistance -= frameState.mapProjection.ellipsoid.maximumRadius; - } perFragmentGroundAtmosphere = cameraDistance > fadeOutDistance; } @@ -1905,7 +2010,6 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { if (showOceanWaves) { --maxTextures; } - if ( defined(frameState.shadowState) && frameState.shadowState.shadowsEnabled @@ -1919,6 +2023,8 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { --maxTextures; } + maxTextures -= globeTranslucencyState.numberOfTextureUniforms; + var mesh = surfaceTile.renderedMesh; var rtc = mesh.center; var encoding = mesh.encoding; @@ -2016,8 +2122,10 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { var imageryIndex = 0; var imageryLen = tileImageryCollection.length; - var showSkirts = tileProvider.showSkirts && !cameraUnderground; - var backFaceCulling = tileProvider.backFaceCulling && !cameraUnderground; + var showSkirts = + tileProvider.showSkirts && !cameraUnderground && !translucent; + var backFaceCulling = + tileProvider.backFaceCulling && !cameraUnderground && !translucent; var firstPassRenderState = backFaceCulling ? tileProvider._renderState : tileProvider._disableCullingRenderState; @@ -2034,6 +2142,19 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { debugDestroyPrimitive(); } + var materialUniformMapChanged = + tileProvider._materialUniformMap !== tileProvider.materialUniformMap; + if (materialUniformMapChanged) { + tileProvider._materialUniformMap = tileProvider.materialUniformMap; + var drawCommandsLength = tileProvider._drawCommands.length; + for (var i = 0; i < drawCommandsLength; ++i) { + tileProvider._uniformMaps[i] = createTileUniformMap( + frameState, + tileProvider + ); + } + } + do { var numberOfDayTextures = 0; @@ -2087,6 +2208,39 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { uniformMapProperties.zoomedOutOceanSpecularIntensity = tileProvider.zoomedOutOceanSpecularIntensity; + var frontFaceAlphaByDistanceFinal = cameraUnderground + ? backFaceAlphaByDistance + : frontFaceAlphaByDistance; + var backFaceAlphaByDistanceFinal = cameraUnderground + ? frontFaceAlphaByDistance + : backFaceAlphaByDistance; + + if (defined(frontFaceAlphaByDistanceFinal)) { + Cartesian4.fromElements( + frontFaceAlphaByDistanceFinal.near, + frontFaceAlphaByDistanceFinal.nearValue, + frontFaceAlphaByDistanceFinal.far, + frontFaceAlphaByDistanceFinal.farValue, + uniformMapProperties.frontFaceAlphaByDistance + ); + Cartesian4.fromElements( + backFaceAlphaByDistanceFinal.near, + backFaceAlphaByDistanceFinal.nearValue, + backFaceAlphaByDistanceFinal.far, + backFaceAlphaByDistanceFinal.farValue, + uniformMapProperties.backFaceAlphaByDistance + ); + } + + Cartesian4.fromElements( + undergroundColorAlphaByDistance.near, + undergroundColorAlphaByDistance.nearValue, + undergroundColorAlphaByDistance.far, + undergroundColorAlphaByDistance.farValue, + uniformMapProperties.undergroundColorAlphaByDistance + ); + Color.clone(undergroundColor, uniformMapProperties.undergroundColor); + var highlightFillTile = !defined(surfaceTile.vertexArray) && defined(tileProvider.fillHighlightColor) && @@ -2114,6 +2268,12 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { tileProvider.cartographicLimitRectangle ); + var localizedTranslucencyRectangle = localizedTranslucencyRectangleScratch; + var clippedTranslucencyRectangle = clipRectangleAntimeridian( + tile.rectangle, + translucencyRectangle + ); + Cartesian3.fromElements( hueShift, saturationShift, @@ -2142,6 +2302,24 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { uniformMapProperties.localizedCartographicLimitRectangle ); + localizedTranslucencyRectangle.x = + (clippedTranslucencyRectangle.west - cartographicTileRectangle.west) * + inverseTileWidth; + localizedTranslucencyRectangle.y = + (clippedTranslucencyRectangle.south - cartographicTileRectangle.south) * + inverseTileHeight; + localizedTranslucencyRectangle.z = + (clippedTranslucencyRectangle.east - cartographicTileRectangle.west) * + inverseTileWidth; + localizedTranslucencyRectangle.w = + (clippedTranslucencyRectangle.north - cartographicTileRectangle.south) * + inverseTileHeight; + + Cartesian4.clone( + localizedTranslucencyRectangle, + uniformMapProperties.localizedTranslucencyRectangle + ); + // For performance, use fog in the shader only when the tile is in fog. var applyFog = enableFog && @@ -2155,6 +2333,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { var applySaturation = false; var applyGamma = false; var applyAlpha = false; + var applyDayNightAlpha = false; var applySplit = false; var applyCutout = false; var applyColorToAlpha = false; @@ -2211,6 +2390,18 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { applyAlpha || uniformMapProperties.dayTextureAlpha[numberOfDayTextures] !== 1.0; + uniformMapProperties.dayTextureNightAlpha[numberOfDayTextures] = + imageryLayer.nightAlpha; + applyDayNightAlpha = + applyDayNightAlpha || + uniformMapProperties.dayTextureNightAlpha[numberOfDayTextures] !== 1.0; + + uniformMapProperties.dayTextureDayAlpha[numberOfDayTextures] = + imageryLayer.dayAlpha; + applyDayNightAlpha = + applyDayNightAlpha || + uniformMapProperties.dayTextureDayAlpha[numberOfDayTextures] !== 1.0; + uniformMapProperties.dayTextureBrightness[numberOfDayTextures] = imageryLayer.brightness; applyBrightness = @@ -2351,10 +2542,6 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { uniformMapProperties.clippingPlanesEdgeWidth = clippingPlanes.edgeWidth; } - if (defined(tileProvider.uniformMap)) { - uniformMap = combine(uniformMap, tileProvider.uniformMap); - } - surfaceShaderSetOptions.numberOfDayTextures = numberOfDayTextures; surfaceShaderSetOptions.applyBrightness = applyBrightness; surfaceShaderSetOptions.applyContrast = applyContrast; @@ -2362,6 +2549,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { surfaceShaderSetOptions.applySaturation = applySaturation; surfaceShaderSetOptions.applyGamma = applyGamma; surfaceShaderSetOptions.applyAlpha = applyAlpha; + surfaceShaderSetOptions.applyDayNightAlpha = applyDayNightAlpha; surfaceShaderSetOptions.applySplit = applySplit; surfaceShaderSetOptions.enableFog = applyFog; surfaceShaderSetOptions.enableClippingPlanes = clippingPlanesEnabled; @@ -2370,6 +2558,8 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { surfaceShaderSetOptions.colorCorrect = colorCorrect; surfaceShaderSetOptions.highlightFillTile = highlightFillTile; surfaceShaderSetOptions.colorToAlpha = applyColorToAlpha; + surfaceShaderSetOptions.showUndergroundColor = showUndergroundColor; + surfaceShaderSetOptions.translucent = translucent; var count = surfaceTile.renderedMesh.indices.length; if (!showSkirts) { @@ -2436,7 +2626,12 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { } command.dirty = true; - frameState.commandList.push(command); + + if (translucent) { + globeTranslucencyState.updateDerivedCommands(command, frameState); + } + + pushCommand(command, frameState); renderState = otherPassesRenderState; initialColor = otherPassesInitialColor; diff --git a/Source/Scene/GlobeTranslucency.js b/Source/Scene/GlobeTranslucency.js new file mode 100644 index 000000000000..85a6db5bcbb2 --- /dev/null +++ b/Source/Scene/GlobeTranslucency.js @@ -0,0 +1,239 @@ +import Check from "../Core/Check.js"; +import defined from "../Core/defined.js"; +import DeveloperError from "../Core/DeveloperError.js"; +import NearFarScalar from "../Core/NearFarScalar.js"; +import Rectangle from "../Core/Rectangle.js"; + +/** + * Properties for controlling globe translucency. + * + * @alias GlobeTranslucency + * @constructor + */ +function GlobeTranslucency() { + this._enabled = false; + this._frontFaceAlpha = 1.0; + this._frontFaceAlphaByDistance = undefined; + this._backFaceAlpha = 1.0; + this._backFaceAlphaByDistance = undefined; + this._rectangle = Rectangle.clone(Rectangle.MAX_VALUE); +} + +Object.defineProperties(GlobeTranslucency.prototype, { + /** + * When true, the globe is rendered as a translucent surface. + *

+ * The alpha is computed by blending {@link Globe#material}, {@link Globe#imageryLayers}, + * and {@link Globe#baseColor}, all of which may contain translucency, and then multiplying by + * {@link GlobeTranslucency#frontFaceAlpha} and {@link GlobeTranslucency#frontFaceAlphaByDistance} for front faces and + * {@link GlobeTranslucency#backFaceAlpha} and {@link GlobeTranslucency#backFaceAlphaByDistance} for back faces. + * When the camera is underground back faces and front faces are swapped, i.e. back-facing geometry + * is considered front facing. + *

+ * Translucency is disabled by default. + * + * @memberof GlobeTranslucency.prototype + * + * @type {Boolean} + * @default false + * + * @see GlobeTranslucency#frontFaceAlpha + * @see GlobeTranslucency#frontFaceAlphaByDistance + * @see GlobeTranslucency#backFaceAlpha + * @see GlobeTranslucency#backFaceAlphaByDistance + */ + enabled: { + get: function () { + return this._enabled; + }, + set: function (value) { + //>>includeStart('debug', pragmas.debug); + Check.typeOf.bool("enabled", value); + //>>includeEnd('debug'); + this._enabled = value; + }, + }, + + /** + * A constant translucency to apply to front faces of the globe. + *

+ * {@link GlobeTranslucency#enabled} must be set to true for this option to take effect. + * + * @memberof GlobeTranslucency.prototype + * + * @type {Number} + * @default 1.0 + * + * @see GlobeTranslucency#enabled + * @see GlobeTranslucency#frontFaceAlphaByDistance + * + * @example + * // Set front face translucency to 0.5. + * globe.translucency.frontFaceAlpha = 0.5; + * globe.translucency.enabled = true; + */ + frontFaceAlpha: { + get: function () { + return this._frontFaceAlpha; + }, + set: function (value) { + //>>includeStart('debug', pragmas.debug); + Check.typeOf.number.greaterThanOrEquals("frontFaceAlpha", value, 0.0); + Check.typeOf.number.lessThanOrEquals("frontFaceAlpha", value, 1.0); + //>>includeEnd('debug'); + this._frontFaceAlpha = value; + }, + }, + /** + * Gets or sets near and far translucency properties of front faces of the globe based on the distance to the camera. + * The translucency will interpolate between the {@link NearFarScalar#nearValue} and + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds + * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. + * Outside of these ranges the translucency remains clamped to the nearest bound. If undefined, + * frontFaceAlphaByDistance will be disabled. + *

+ * {@link GlobeTranslucency#enabled} must be set to true for this option to take effect. + * + * @memberof GlobeTranslucency.prototype + * + * @type {NearFarScalar} + * @default undefined + * + * @see GlobeTranslucency#enabled + * @see GlobeTranslucency#frontFaceAlpha + * + * @example + * // Example 1. + * // Set front face translucency to 0.5 when the + * // camera is 1500 meters from the surface and 1.0 + * // as the camera distance approaches 8.0e6 meters. + * globe.translucency.frontFaceAlphaByDistance = new Cesium.NearFarScalar(1.5e2, 0.5, 8.0e6, 1.0); + * globe.translucency.enabled = true; + * + * @example + * // Example 2. + * // Disable front face translucency by distance + * globe.translucency.frontFaceAlphaByDistance = undefined; + */ + frontFaceAlphaByDistance: { + get: function () { + return this._frontFaceAlphaByDistance; + }, + set: function (value) { + //>>includeStart('debug', pragmas.debug); + if (defined(value) && value.far < value.near) { + throw new DeveloperError( + "far distance must be greater than near distance." + ); + } + //>>includeEnd('debug'); + this._frontFaceAlphaByDistance = NearFarScalar.clone( + value, + this._frontFaceAlphaByDistance + ); + }, + }, + + /** + * A constant translucency to apply to back faces of the globe. + *

+ * {@link GlobeTranslucency#enabled} must be set to true for this option to take effect. + * + * @memberof GlobeTranslucency.prototype + * + * @type {Number} + * @default 1.0 + * + * @see GlobeTranslucency#enabled + * @see GlobeTranslucency#backFaceAlphaByDistance + * + * @example + * // Set back face translucency to 0.5. + * globe.translucency.backFaceAlpha = 0.5; + * globe.translucency.enabled = true; + */ + backFaceAlpha: { + get: function () { + return this._backFaceAlpha; + }, + set: function (value) { + //>>includeStart('debug', pragmas.debug); + Check.typeOf.number.greaterThanOrEquals("backFaceAlpha", value, 0.0); + Check.typeOf.number.lessThanOrEquals("backFaceAlpha", value, 1.0); + //>>includeEnd('debug'); + this._backFaceAlpha = value; + }, + }, + /** + * Gets or sets near and far translucency properties of back faces of the globe based on the distance to the camera. + * The translucency will interpolate between the {@link NearFarScalar#nearValue} and + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds + * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. + * Outside of these ranges the translucency remains clamped to the nearest bound. If undefined, + * backFaceAlphaByDistance will be disabled. + *

+ * {@link GlobeTranslucency#enabled} must be set to true for this option to take effect. + * + * @memberof GlobeTranslucency.prototype + * + * @type {NearFarScalar} + * @default undefined + * + * @see GlobeTranslucency#enabled + * @see GlobeTranslucency#backFaceAlpha + * + * @example + * // Example 1. + * // Set back face translucency to 0.5 when the + * // camera is 1500 meters from the surface and 1.0 + * // as the camera distance approaches 8.0e6 meters. + * globe.translucency.backFaceAlphaByDistance = new Cesium.NearFarScalar(1.5e2, 0.5, 8.0e6, 1.0); + * globe.translucency.enabled = true; + * + * @example + * // Example 2. + * // Disable back face translucency by distance + * globe.translucency.backFaceAlphaByDistance = undefined; + */ + backFaceAlphaByDistance: { + get: function () { + return this._backFaceAlphaByDistance; + }, + set: function (value) { + //>>includeStart('debug', pragmas.debug); + if (defined(value) && value.far < value.near) { + throw new DeveloperError( + "far distance must be greater than near distance." + ); + } + //>>includeEnd('debug'); + this._backFaceAlphaByDistance = NearFarScalar.clone( + value, + this._backFaceAlphaByDistance + ); + }, + }, + + /** + * A property specifying a {@link Rectangle} used to limit translucency to a cartographic area. + * Defaults to the maximum extent of cartographic coordinates. + * + * @memberof GlobeTranslucency.prototype + * + * @type {Rectangle} + * @default {@link Rectangle.MAX_VALUE} + */ + rectangle: { + get: function () { + return this._rectangle; + }, + set: function (value) { + if (!defined(value)) { + value = Rectangle.clone(Rectangle.MAX_VALUE); + } + Rectangle.clone(value, this._rectangle); + }, + }, +}); + +export default GlobeTranslucency; diff --git a/Source/Scene/GlobeTranslucencyFramebuffer.js b/Source/Scene/GlobeTranslucencyFramebuffer.js new file mode 100644 index 000000000000..1d280dfc7215 --- /dev/null +++ b/Source/Scene/GlobeTranslucencyFramebuffer.js @@ -0,0 +1,259 @@ +import BoundingRectangle from "../Core/BoundingRectangle.js"; +import Color from "../Core/Color.js"; +import defined from "../Core/defined.js"; +import destroyObject from "../Core/destroyObject.js"; +import PixelFormat from "../Core/PixelFormat.js"; +import ClearCommand from "../Renderer/ClearCommand.js"; +import Framebuffer from "../Renderer/Framebuffer.js"; +import PixelDatatype from "../Renderer/PixelDatatype.js"; +import Renderbuffer from "../Renderer/Renderbuffer.js"; +import RenderbufferFormat from "../Renderer/RenderbufferFormat.js"; +import RenderState from "../Renderer/RenderState.js"; +import Sampler from "../Renderer/Sampler.js"; +import Texture from "../Renderer/Texture.js"; +import PassThroughDepth from "../Shaders/PostProcessStages/PassThroughDepth.js"; + +/** + * @private + */ +function GlobeTranslucencyFramebuffer() { + this._colorTexture = undefined; + this._depthStencilTexture = undefined; + this._depthStencilRenderbuffer = undefined; + this._framebuffer = undefined; + + this._packedDepthTexture = undefined; + this._packedDepthFramebuffer = undefined; + + this._renderState = undefined; + + this._packedDepthCommand = undefined; + this._clearCommand = undefined; + + this._viewport = new BoundingRectangle(); + this._useScissorTest = false; + this._scissorRectangle = undefined; + this._useHdr = undefined; +} + +Object.defineProperties(GlobeTranslucencyFramebuffer.prototype, { + classificationTexture: { + get: function () { + return this._colorTexture; + }, + }, + classificationFramebuffer: { + get: function () { + return this._framebuffer; + }, + }, +}); + +function destroyResources(globeTranslucency) { + globeTranslucency._colorTexture = + globeTranslucency._colorTexture && + !globeTranslucency._colorTexture.isDestroyed() && + globeTranslucency._colorTexture.destroy(); + globeTranslucency._depthStencilTexture = + globeTranslucency._depthStencilTexture && + !globeTranslucency._depthStencilTexture.isDestroyed() && + globeTranslucency._depthStencilTexture.destroy(); + globeTranslucency._depthStencilRenderbuffer = + globeTranslucency._depthStencilRenderbuffer && + !globeTranslucency._depthStencilRenderbuffer.isDestroyed() && + globeTranslucency._depthStencilRenderbuffer.destroy(); + globeTranslucency._framebuffer = + globeTranslucency._framebuffer && + !globeTranslucency._framebuffer.isDestroyed() && + globeTranslucency._framebuffer.destroy(); + globeTranslucency._packedDepthTexture = + globeTranslucency._packedDepthTexture && + !globeTranslucency._packedDepthTexture.isDestroyed() && + globeTranslucency._packedDepthTexture.destroy(); + globeTranslucency._packedDepthFramebuffer = + globeTranslucency._packedDepthFramebuffer && + !globeTranslucency._packedDepthFramebuffer.isDestroyed() && + globeTranslucency._packedDepthFramebuffer.destroy(); +} + +function createResources(globeTranslucency, context, width, height, hdr) { + var pixelDatatype = hdr + ? context.halfFloatingPointTexture + ? PixelDatatype.HALF_FLOAT + : PixelDatatype.FLOAT + : PixelDatatype.UNSIGNED_BYTE; + globeTranslucency._colorTexture = new Texture({ + context: context, + width: width, + height: height, + pixelFormat: PixelFormat.RGBA, + pixelDatatype: pixelDatatype, + sampler: Sampler.NEAREST, + }); + + if (context.depthTexture) { + globeTranslucency._depthStencilTexture = new Texture({ + context: context, + width: width, + height: height, + pixelFormat: PixelFormat.DEPTH_STENCIL, + pixelDatatype: PixelDatatype.UNSIGNED_INT_24_8, + }); + } else { + globeTranslucency._depthStencilRenderbuffer = new Renderbuffer({ + context: context, + width: width, + height: height, + format: RenderbufferFormat.DEPTH_STENCIL, + }); + } + + globeTranslucency._framebuffer = new Framebuffer({ + context: context, + colorTextures: [globeTranslucency._colorTexture], + depthStencilTexture: globeTranslucency._depthStencilTexture, + depthStencilRenderbuffer: globeTranslucency._depthStencilRenderbuffer, + destroyAttachments: false, + }); + + globeTranslucency._packedDepthTexture = new Texture({ + context: context, + width: width, + height: height, + pixelFormat: PixelFormat.RGBA, + pixelDatatype: PixelDatatype.UNSIGNED_BYTE, + sampler: Sampler.NEAREST, + }); + + globeTranslucency._packedDepthFramebuffer = new Framebuffer({ + context: context, + colorTextures: [globeTranslucency._packedDepthTexture], + destroyAttachments: false, + }); +} + +function updateResources(globeTranslucency, context, width, height, hdr) { + var colorTexture = globeTranslucency._colorTexture; + var textureChanged = + !defined(colorTexture) || + colorTexture.width !== width || + colorTexture.height !== height || + hdr !== globeTranslucency._useHdr; + if (textureChanged) { + destroyResources(globeTranslucency); + createResources(globeTranslucency, context, width, height, hdr); + } +} + +function updateCommands(globeTranslucency, context, width, height, passState) { + globeTranslucency._viewport.width = width; + globeTranslucency._viewport.height = height; + + var useScissorTest = !BoundingRectangle.equals( + globeTranslucency._viewport, + passState.viewport + ); + var updateScissor = useScissorTest !== globeTranslucency._useScissorTest; + globeTranslucency._useScissorTest = useScissorTest; + + if ( + !BoundingRectangle.equals( + globeTranslucency._scissorRectangle, + passState.viewport + ) + ) { + globeTranslucency._scissorRectangle = BoundingRectangle.clone( + passState.viewport, + globeTranslucency._scissorRectangle + ); + updateScissor = true; + } + + if ( + !defined(globeTranslucency._renderState) || + !BoundingRectangle.equals( + globeTranslucency._viewport, + globeTranslucency._renderState.viewport + ) || + updateScissor + ) { + globeTranslucency._renderState = RenderState.fromCache({ + viewport: globeTranslucency._viewport, + scissorTest: { + enabled: globeTranslucency._useScissorTest, + rectangle: globeTranslucency._scissorRectangle, + }, + }); + } + + if (!defined(globeTranslucency._packedDepthCommand)) { + globeTranslucency._packedDepthCommand = context.createViewportQuadCommand( + PassThroughDepth, + { + uniformMap: { + u_depthTexture: function () { + return globeTranslucency._depthStencilTexture; + }, + }, + owner: globeTranslucency, + } + ); + } + + if (!defined(globeTranslucency._clearCommand)) { + globeTranslucency._clearCommand = new ClearCommand({ + color: new Color(0.0, 0.0, 0.0, 0.0), + depth: 1.0, + stencil: 0.0, + owner: globeTranslucency, + }); + } + + globeTranslucency._packedDepthCommand.framebuffer = + globeTranslucency._packedDepthFramebuffer; + globeTranslucency._packedDepthCommand.renderState = + globeTranslucency._renderState; + globeTranslucency._clearCommand.framebuffer = globeTranslucency._framebuffer; + globeTranslucency._clearCommand.renderState = globeTranslucency._renderState; +} + +GlobeTranslucencyFramebuffer.prototype.updateAndClear = function ( + hdr, + viewport, + context, + passState +) { + var width = viewport.width; + var height = viewport.height; + + updateResources(this, context, width, height, hdr); + updateCommands(this, context, width, height, passState); + + this._useHdr = hdr; +}; + +GlobeTranslucencyFramebuffer.prototype.clearClassification = function ( + context, + passState +) { + this._clearCommand.execute(context, passState); +}; + +GlobeTranslucencyFramebuffer.prototype.packDepth = function ( + context, + passState +) { + this._packedDepthCommand.execute(context, passState); + return this._packedDepthTexture; +}; + +GlobeTranslucencyFramebuffer.prototype.isDestroyed = function () { + return false; +}; + +GlobeTranslucencyFramebuffer.prototype.destroy = function () { + destroyResources(this); + return destroyObject(this); +}; + +export default GlobeTranslucencyFramebuffer; diff --git a/Source/Scene/GlobeTranslucencyState.js b/Source/Scene/GlobeTranslucencyState.js new file mode 100644 index 000000000000..a5dadbf03c54 --- /dev/null +++ b/Source/Scene/GlobeTranslucencyState.js @@ -0,0 +1,1117 @@ +import combine from "../Core/combine.js"; +import defaultValue from "../Core/defaultValue.js"; +import defined from "../Core/defined.js"; +import NearFarScalar from "../Core/NearFarScalar.js"; +import Rectangle from "../Core/Rectangle.js"; +import DrawCommand from "../Renderer/DrawCommand.js"; +import Pass from "../Renderer/Pass.js"; +import RenderState from "../Renderer/RenderState.js"; +import ShaderSource from "../Renderer/ShaderSource.js"; +import BlendingState from "./BlendingState.js"; +import CullFace from "./CullFace.js"; +import SceneMode from "./SceneMode.js"; + +var DerivedCommandType = { + OPAQUE_FRONT_FACE: 0, + OPAQUE_BACK_FACE: 1, + DEPTH_ONLY_FRONT_FACE: 2, + DEPTH_ONLY_BACK_FACE: 3, + DEPTH_ONLY_FRONT_AND_BACK_FACE: 4, + TRANSLUCENT_FRONT_FACE: 5, + TRANSLUCENT_BACK_FACE: 6, + TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST: 7, + TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST: 8, + PICK_FRONT_FACE: 9, + PICK_BACK_FACE: 10, + DERIVED_COMMANDS_MAXIMUM_LENGTH: 11, +}; + +var derivedCommandsMaximumLength = + DerivedCommandType.DERIVED_COMMANDS_MAXIMUM_LENGTH; + +var DerivedCommandNames = [ + "opaqueFrontFaceCommand", + "opaqueBackFaceCommand", + "depthOnlyFrontFaceCommand", + "depthOnlyBackFaceCommand", + "depthOnlyFrontAndBackFaceCommand", + "translucentFrontFaceCommand", + "translucentBackFaceCommand", + "translucentFrontFaceManualDepthTestCommand", + "translucentBackFaceManualDepthTestCommand", + "pickFrontFaceCommand", + "pickBackFaceCommand", +]; + +/** + * @private + */ +function GlobeTranslucencyState() { + this._frontFaceAlphaByDistance = new NearFarScalar(0.0, 1.0, 0.0, 1.0); + this._backFaceAlphaByDistance = new NearFarScalar(0.0, 1.0, 0.0, 1.0); + + this._frontFaceTranslucent = false; + this._backFaceTranslucent = false; + this._requiresManualDepthTest = false; + this._sunVisibleThroughGlobe = false; + this._environmentVisible = false; + this._useDepthPlane = false; + this._numberOfTextureUniforms = 0; + this._globeTranslucencyFramebuffer = undefined; + this._rectangle = Rectangle.clone(Rectangle.MAX_VALUE); + + this._derivedCommandKey = 0; + this._derivedCommandsDirty = false; + this._derivedCommandPacks = undefined; + + this._derivedCommandTypes = new Array(derivedCommandsMaximumLength); + this._derivedBlendCommandTypes = new Array(derivedCommandsMaximumLength); + this._derivedPickCommandTypes = new Array(derivedCommandsMaximumLength); + this._derivedCommandTypesToUpdate = new Array(derivedCommandsMaximumLength); + + this._derivedCommandsLength = 0; + this._derivedBlendCommandsLength = 0; + this._derivedPickCommandsLength = 0; + this._derivedCommandsToUpdateLength = 0; +} + +Object.defineProperties(GlobeTranslucencyState.prototype, { + frontFaceAlphaByDistance: { + get: function () { + return this._frontFaceAlphaByDistance; + }, + }, + backFaceAlphaByDistance: { + get: function () { + return this._backFaceAlphaByDistance; + }, + }, + translucent: { + get: function () { + return this._frontFaceTranslucent; + }, + }, + sunVisibleThroughGlobe: { + get: function () { + return this._sunVisibleThroughGlobe; + }, + }, + environmentVisible: { + get: function () { + return this._environmentVisible; + }, + }, + useDepthPlane: { + get: function () { + return this._useDepthPlane; + }, + }, + numberOfTextureUniforms: { + get: function () { + return this._numberOfTextureUniforms; + }, + }, + rectangle: { + get: function () { + return this._rectangle; + }, + }, +}); + +GlobeTranslucencyState.prototype.update = function (scene) { + var globe = scene.globe; + if (!defined(globe) || !globe.show) { + this._frontFaceTranslucent = false; + this._backFaceTranslucent = false; + this._sunVisibleThroughGlobe = true; + this._environmentVisible = true; + this._useDepthPlane = false; + return; + } + + this._frontFaceAlphaByDistance = updateAlphaByDistance( + globe.translucency.enabled, + globe.translucency.frontFaceAlpha, + globe.translucency.frontFaceAlphaByDistance, + this._frontFaceAlphaByDistance + ); + this._backFaceAlphaByDistance = updateAlphaByDistance( + globe.translucency.enabled, + globe.translucency.backFaceAlpha, + globe.translucency.backFaceAlphaByDistance, + this._backFaceAlphaByDistance + ); + + this._frontFaceTranslucent = isFaceTranslucent( + globe.translucency.enabled, + this._frontFaceAlphaByDistance, + globe + ); + this._backFaceTranslucent = isFaceTranslucent( + globe.translucency.enabled, + this._backFaceAlphaByDistance, + globe + ); + + this._requiresManualDepthTest = requiresManualDepthTest(this, scene, globe); + + this._sunVisibleThroughGlobe = isSunVisibleThroughGlobe(this, scene); + this._environmentVisible = isEnvironmentVisible(this, scene); + this._useDepthPlane = useDepthPlane(this, scene); + this._numberOfTextureUniforms = getNumberOfTextureUniforms(this); + + this._rectangle = Rectangle.clone( + globe.translucency.rectangle, + this._rectangle + ); + + gatherDerivedCommandRequirements(this, scene); +}; + +function updateAlphaByDistance(enabled, alpha, alphaByDistance, result) { + if (!enabled) { + result.nearValue = 1.0; + result.farValue = 1.0; + return result; + } + + if (!defined(alphaByDistance)) { + result.nearValue = alpha; + result.farValue = alpha; + return result; + } + + NearFarScalar.clone(alphaByDistance, result); + result.nearValue *= alpha; + result.farValue *= alpha; + return result; +} + +function isFaceTranslucent(translucencyEnabled, alphaByDistance, globe) { + return ( + translucencyEnabled && + (globe.baseColor.alpha < 1.0 || + alphaByDistance.nearValue < 1.0 || + alphaByDistance.farValue < 1.0) + ); +} + +function isSunVisibleThroughGlobe(state, scene) { + // The sun is visible through the globe if the front and back faces are translucent when above ground + // or if front faces are translucent when below ground + var frontTranslucent = state._frontFaceTranslucent; + var backTranslucent = state._backFaceTranslucent; + return frontTranslucent && (scene.cameraUnderground || backTranslucent); +} + +function isEnvironmentVisible(state, scene) { + // The environment is visible if the camera is above ground or underground with translucency + return !scene.cameraUnderground || state._frontFaceTranslucent; +} + +function useDepthPlane(state, scene) { + // Use the depth plane when the camera is above ground and the globe is opaque + return !scene.cameraUnderground && !state._frontFaceTranslucent; +} + +function requiresManualDepthTest(state, scene, globe) { + return ( + state._frontFaceTranslucent && + !state._backFaceTranslucent && + !globe.depthTestAgainstTerrain && + scene.mode !== SceneMode.SCENE2D && + scene.context.depthTexture + ); +} + +function getNumberOfTextureUniforms(state) { + var numberOfTextureUniforms = 0; + + if (state._frontFaceTranslucent) { + ++numberOfTextureUniforms; // classification texture + } + + if (state._requiresManualDepthTest) { + ++numberOfTextureUniforms; // czm_globeDepthTexture for manual depth testing + } + + return numberOfTextureUniforms; +} + +function gatherDerivedCommandRequirements(state, scene) { + state._derivedCommandsLength = getDerivedCommandTypes( + state, + scene, + false, + false, + state._derivedCommandTypes + ); + + state._derivedBlendCommandsLength = getDerivedCommandTypes( + state, + scene, + true, + false, + state._derivedBlendCommandTypes + ); + + state._derivedPickCommandsLength = getDerivedCommandTypes( + state, + scene, + false, + true, + state._derivedPickCommandTypes + ); + + var i; + + var derivedCommandKey = 0; + for (i = 0; i < state._derivedCommandsLength; ++i) { + derivedCommandKey |= 1 << state._derivedCommandTypes[i]; + } + for (i = 0; i < state._derivedBlendCommandsLength; ++i) { + derivedCommandKey |= 1 << state._derivedBlendCommandTypes[i]; + } + for (i = 0; i < state._derivedPickCommandsLength; ++i) { + derivedCommandKey |= 1 << state._derivedPickCommandTypes[i]; + } + + var derivedCommandsToUpdateLength = 0; + for (i = 0; i < derivedCommandsMaximumLength; ++i) { + if ((derivedCommandKey & (1 << i)) > 0) { + state._derivedCommandTypesToUpdate[derivedCommandsToUpdateLength++] = i; + } + } + state._derivedCommandsToUpdateLength = derivedCommandsToUpdateLength; + + var derivedCommandsDirty = derivedCommandKey !== state._derivedCommandKey; + state._derivedCommandKey = derivedCommandKey; + state._derivedCommandsDirty = derivedCommandsDirty; + + if (!defined(state._derivedCommandPacks) && state._frontFaceTranslucent) { + state._derivedCommandPacks = createDerivedCommandPacks(); + } +} + +function getDerivedCommandTypes( + state, + scene, + isBlendCommand, + isPickCommand, + types +) { + var length = 0; + + var frontTranslucent = state._frontFaceTranslucent; + var backTranslucent = state._backFaceTranslucent; + + if (!frontTranslucent) { + // Don't use derived commands if the globe is opaque + return length; + } + + var cameraUnderground = scene.cameraUnderground; + var requiresManualDepthTest = state._requiresManualDepthTest; + + var translucentFrontFaceCommandType = isPickCommand + ? DerivedCommandType.PICK_FRONT_FACE + : requiresManualDepthTest + ? DerivedCommandType.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST + : DerivedCommandType.TRANSLUCENT_FRONT_FACE; + + var translucentBackFaceCommandType = isPickCommand + ? DerivedCommandType.PICK_BACK_FACE + : requiresManualDepthTest + ? DerivedCommandType.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST + : DerivedCommandType.TRANSLUCENT_BACK_FACE; + + if (scene.mode === SceneMode.SCENE2D) { + types[length++] = DerivedCommandType.DEPTH_ONLY_FRONT_FACE; + types[length++] = translucentFrontFaceCommandType; + return length; + } + + if (backTranslucent) { + // Push depth-only command for classification. Blend commands do not need to write depth. + // Push translucent commands for front and back faces. + if (!isBlendCommand) { + types[length++] = DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE; + } + if (cameraUnderground) { + types[length++] = translucentFrontFaceCommandType; + types[length++] = translucentBackFaceCommandType; + } else { + types[length++] = translucentBackFaceCommandType; + types[length++] = translucentFrontFaceCommandType; + } + } else { + // Push opaque command for the face that appears in back. + // Push depth-only command and translucent command for the face that appears in front. + // eslint-disable-next-line no-lonely-if + if (cameraUnderground) { + if (!isBlendCommand) { + types[length++] = DerivedCommandType.DEPTH_ONLY_BACK_FACE; + } + types[length++] = DerivedCommandType.OPAQUE_FRONT_FACE; + types[length++] = translucentBackFaceCommandType; + } else { + if (!isBlendCommand) { + types[length++] = DerivedCommandType.DEPTH_ONLY_FRONT_FACE; + } + types[length++] = DerivedCommandType.OPAQUE_BACK_FACE; + types[length++] = translucentFrontFaceCommandType; + } + } + + return length; +} + +function removeDefine(defines, defineToRemove) { + var index = defines.indexOf(defineToRemove); + if (index > -1) { + defines.splice(index, 1); + } +} + +function hasDefine(defines, define) { + return defines.indexOf(define) > -1; +} + +function getOpaqueFrontFaceShaderProgram(vs, fs) { + removeDefine(vs.defines, "TRANSLUCENT"); + removeDefine(fs.defines, "TRANSLUCENT"); +} + +function getOpaqueBackFaceShaderProgram(vs, fs) { + removeDefine(vs.defines, "GROUND_ATMOSPHERE"); + removeDefine(fs.defines, "GROUND_ATMOSPHERE"); + removeDefine(vs.defines, "FOG"); + removeDefine(fs.defines, "FOG"); + removeDefine(vs.defines, "TRANSLUCENT"); + removeDefine(fs.defines, "TRANSLUCENT"); +} + +function getDepthOnlyShaderProgram(vs, fs) { + if ( + hasDefine(fs.defines, "TILE_LIMIT_RECTANGLE") || + hasDefine(fs.defines, "ENABLE_CLIPPING_PLANES") + ) { + // Need to execute the full shader if discard is called + return; + } + + var depthOnlyShader = + "void main() \n" + "{ \n" + " gl_FragColor = vec4(1.0); \n" + "} \n"; + + fs.sources = [depthOnlyShader]; +} + +function getTranslucentShaderProgram(vs, fs) { + var sources = fs.sources; + var length = sources.length; + for (var i = 0; i < length; ++i) { + sources[i] = ShaderSource.replaceMain( + sources[i], + "czm_globe_translucency_main" + ); + } + + var globeTranslucencyMain = + "\n\n" + + "uniform sampler2D u_classificationTexture; \n" + + "void main() \n" + + "{ \n" + + " vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n" + + "#ifdef MANUAL_DEPTH_TEST \n" + + " float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st)); \n" + + " if (logDepthOrDepth != 0.0) \n" + + " { \n" + + " vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); \n" + + " float depthEC = eyeCoordinate.z / eyeCoordinate.w; \n" + + " if (v_positionEC.z < depthEC) \n" + + " { \n" + + " discard; \n" + + " } \n" + + " } \n" + + "#endif \n" + + " czm_globe_translucency_main(); \n" + + " vec4 classificationColor = texture2D(u_classificationTexture, st); \n" + + " if (classificationColor.a > 0.0) \n" + + " { \n" + + " // Reverse premultiplication process to get the correct composited result of the classification primitives \n" + + " classificationColor.rgb /= classificationColor.a; \n" + + " } \n" + + " gl_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + gl_FragColor * (1.0 - classificationColor.a); \n" + + "} \n"; + + sources.push(globeTranslucencyMain); +} + +function getTranslucentBackFaceShaderProgram(vs, fs) { + getTranslucentShaderProgram(vs, fs); + removeDefine(vs.defines, "GROUND_ATMOSPHERE"); + removeDefine(fs.defines, "GROUND_ATMOSPHERE"); + removeDefine(vs.defines, "FOG"); + removeDefine(fs.defines, "FOG"); +} + +function getTranslucentFrontFaceManualDepthTestShaderProgram(vs, fs) { + getTranslucentShaderProgram(vs, fs); + vs.defines.push("GENERATE_POSITION"); + fs.defines.push("MANUAL_DEPTH_TEST"); +} + +function getTranslucentBackFaceManualDepthTestShaderProgram(vs, fs) { + getTranslucentBackFaceShaderProgram(vs, fs); + vs.defines.push("GENERATE_POSITION"); + fs.defines.push("MANUAL_DEPTH_TEST"); +} + +function getPickShaderProgram(vs, fs) { + var pickShader = + "uniform sampler2D u_classificationTexture; \n" + + "void main() \n" + + "{ \n" + + " vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n" + + " vec4 pickColor = texture2D(u_classificationTexture, st); \n" + + " if (pickColor == vec4(0.0)) \n" + + " { \n" + + " discard; \n" + + " } \n" + + " gl_FragColor = pickColor; \n" + + "} \n"; + + fs.sources = [pickShader]; +} + +function getDerivedShaderProgram( + context, + shaderProgram, + derivedShaderProgram, + shaderProgramDirty, + getShaderProgramFunction, + cacheName +) { + if (!defined(getShaderProgramFunction)) { + return shaderProgram; + } + + if (!shaderProgramDirty && defined(derivedShaderProgram)) { + return derivedShaderProgram; + } + + var shader = context.shaderCache.getDerivedShaderProgram( + shaderProgram, + cacheName + ); + if (!defined(shader)) { + var attributeLocations = shaderProgram._attributeLocations; + var vs = shaderProgram.vertexShaderSource.clone(); + var fs = shaderProgram.fragmentShaderSource.clone(); + vs.defines = defined(vs.defines) ? vs.defines.slice(0) : []; + fs.defines = defined(fs.defines) ? fs.defines.slice(0) : []; + + getShaderProgramFunction(vs, fs); + + shader = context.shaderCache.createDerivedShaderProgram( + shaderProgram, + cacheName, + { + vertexShaderSource: vs, + fragmentShaderSource: fs, + attributeLocations: attributeLocations, + } + ); + } + + return shader; +} + +function getOpaqueFrontFaceRenderState(renderState) { + renderState.cull.face = CullFace.BACK; + renderState.cull.enabled = true; +} + +function getOpaqueBackFaceRenderState(renderState) { + renderState.cull.face = CullFace.FRONT; + renderState.cull.enabled = true; +} + +function getDepthOnlyFrontFaceRenderState(renderState) { + renderState.cull.face = CullFace.BACK; + renderState.cull.enabled = true; + renderState.colorMask = { + red: false, + green: false, + blue: false, + alpha: false, + }; +} + +function getDepthOnlyBackFaceRenderState(renderState) { + renderState.cull.face = CullFace.FRONT; + renderState.cull.enabled = true; + renderState.colorMask = { + red: false, + green: false, + blue: false, + alpha: false, + }; +} + +function getDepthOnlyFrontAndBackFaceRenderState(renderState) { + renderState.cull.enabled = false; + renderState.colorMask = { + red: false, + green: false, + blue: false, + alpha: false, + }; +} + +function getTranslucentFrontFaceRenderState(renderState) { + renderState.cull.face = CullFace.BACK; + renderState.cull.enabled = true; + renderState.depthMask = false; + renderState.blending = BlendingState.ALPHA_BLEND; +} + +function getTranslucentBackFaceRenderState(renderState) { + renderState.cull.face = CullFace.FRONT; + renderState.cull.enabled = true; + renderState.depthMask = false; + renderState.blending = BlendingState.ALPHA_BLEND; +} + +function getPickFrontFaceRenderState(renderState) { + renderState.cull.face = CullFace.BACK; + renderState.cull.enabled = true; + renderState.blending.enabled = false; +} + +function getPickBackFaceRenderState(renderState) { + renderState.cull.face = CullFace.FRONT; + renderState.cull.enabled = true; + renderState.blending.enabled = false; +} + +function getDerivedRenderState( + renderState, + derivedRenderState, + renderStateDirty, + getRenderStateFunction, + cache +) { + if (!defined(getRenderStateFunction)) { + return renderState; + } + + if (!renderStateDirty && defined(derivedRenderState)) { + return derivedRenderState; + } + + var cachedRenderState = cache[renderState.id]; + if (!defined(cachedRenderState)) { + var rs = RenderState.getState(renderState); + getRenderStateFunction(rs); + cachedRenderState = RenderState.fromCache(rs); + cache[renderState.id] = cachedRenderState; + } + + return cachedRenderState; +} + +function getTranslucencyUniformMap(state) { + return { + u_classificationTexture: function () { + return state._globeTranslucencyFramebuffer.classificationTexture; + }, + }; +} + +function getDerivedUniformMap( + state, + uniformMap, + derivedUniformMap, + uniformMapDirty, + getDerivedUniformMapFunction +) { + if (!defined(getDerivedUniformMapFunction)) { + return uniformMap; + } + + if (!uniformMapDirty && defined(derivedUniformMap)) { + return derivedUniformMap; + } + + return combine(uniformMap, getDerivedUniformMapFunction(state), false); +} + +function DerivedCommandPack(options) { + this.pass = options.pass; + this.pickOnly = options.pickOnly; + this.getShaderProgramFunction = options.getShaderProgramFunction; + this.getRenderStateFunction = options.getRenderStateFunction; + this.getUniformMapFunction = options.getUniformMapFunction; + this.renderStateCache = {}; +} + +function createDerivedCommandPacks() { + return [ + // opaqueFrontFaceCommand + new DerivedCommandPack({ + pass: Pass.GLOBE, + pickOnly: false, + getShaderProgramFunction: getOpaqueFrontFaceShaderProgram, + getRenderStateFunction: getOpaqueFrontFaceRenderState, + getUniformMapFunction: undefined, + }), + // opaqueBackFaceCommand + new DerivedCommandPack({ + pass: Pass.GLOBE, + pickOnly: false, + getShaderProgramFunction: getOpaqueBackFaceShaderProgram, + getRenderStateFunction: getOpaqueBackFaceRenderState, + getUniformMapFunction: undefined, + }), + // depthOnlyFrontFaceCommand + new DerivedCommandPack({ + pass: Pass.GLOBE, + pickOnly: false, + getShaderProgramFunction: getDepthOnlyShaderProgram, + getRenderStateFunction: getDepthOnlyFrontFaceRenderState, + getUniformMapFunction: undefined, + }), + // depthOnlyBackFaceCommand + new DerivedCommandPack({ + pass: Pass.GLOBE, + pickOnly: false, + getShaderProgramFunction: getDepthOnlyShaderProgram, + getRenderStateFunction: getDepthOnlyBackFaceRenderState, + getUniformMapFunction: undefined, + }), + // depthOnlyFrontAndBackFaceCommand + new DerivedCommandPack({ + pass: Pass.GLOBE, + pickOnly: false, + getShaderProgramFunction: getDepthOnlyShaderProgram, + getRenderStateFunction: getDepthOnlyFrontAndBackFaceRenderState, + getUniformMapFunction: undefined, + }), + // translucentFrontFaceCommand + new DerivedCommandPack({ + pass: Pass.TRANSLUCENT, + pickOnly: false, + getShaderProgramFunction: getTranslucentShaderProgram, + getRenderStateFunction: getTranslucentFrontFaceRenderState, + getUniformMapFunction: getTranslucencyUniformMap, + }), + // translucentBackFaceCommand + new DerivedCommandPack({ + pass: Pass.TRANSLUCENT, + pickOnly: false, + getShaderProgramFunction: getTranslucentBackFaceShaderProgram, + getRenderStateFunction: getTranslucentBackFaceRenderState, + getUniformMapFunction: getTranslucencyUniformMap, + }), + // translucentFrontFaceManualDepthTestCommand + new DerivedCommandPack({ + pass: Pass.TRANSLUCENT, + pickOnly: false, + getShaderProgramFunction: getTranslucentFrontFaceManualDepthTestShaderProgram, + getRenderStateFunction: getTranslucentFrontFaceRenderState, + getUniformMapFunction: getTranslucencyUniformMap, + }), + // translucentBackFaceManualDepthTestCommand + new DerivedCommandPack({ + pass: Pass.TRANSLUCENT, + pickOnly: false, + getShaderProgramFunction: getTranslucentBackFaceManualDepthTestShaderProgram, + getRenderStateFunction: getTranslucentBackFaceRenderState, + getUniformMapFunction: getTranslucencyUniformMap, + }), + // pickFrontFaceCommand + new DerivedCommandPack({ + pass: Pass.TRANSLUCENT, + pickOnly: true, + getShaderProgramFunction: getPickShaderProgram, + getRenderStateFunction: getPickFrontFaceRenderState, + getUniformMapFunction: getTranslucencyUniformMap, + }), + // pickBackFaceCommand + new DerivedCommandPack({ + pass: Pass.TRANSLUCENT, + pickOnly: true, + getShaderProgramFunction: getPickShaderProgram, + getRenderStateFunction: getPickBackFaceRenderState, + getUniformMapFunction: getTranslucencyUniformMap, + }), + ]; +} + +var derivedCommandNames = new Array(derivedCommandsMaximumLength); +var derivedCommandPacks = new Array(derivedCommandsMaximumLength); + +GlobeTranslucencyState.prototype.updateDerivedCommands = function ( + command, + frameState +) { + var derivedCommandTypes = this._derivedCommandTypesToUpdate; + var derivedCommandsLength = this._derivedCommandsToUpdateLength; + + if (derivedCommandsLength === 0) { + return; + } + + for (var i = 0; i < derivedCommandsLength; ++i) { + derivedCommandPacks[i] = this._derivedCommandPacks[derivedCommandTypes[i]]; + derivedCommandNames[i] = DerivedCommandNames[derivedCommandTypes[i]]; + } + + updateDerivedCommands( + this, + command, + derivedCommandsLength, + derivedCommandTypes, + derivedCommandNames, + derivedCommandPacks, + frameState + ); +}; + +function updateDerivedCommands( + state, + command, + derivedCommandsLength, + derivedCommandTypes, + derivedCommandNames, + derivedCommandPacks, + frameState +) { + var derivedCommandsObject = command.derivedCommands.globeTranslucency; + var derivedCommandsDirty = state._derivedCommandsDirty; + + if ( + command.dirty || + !defined(derivedCommandsObject) || + derivedCommandsDirty + ) { + command.dirty = false; + + if (!defined(derivedCommandsObject)) { + derivedCommandsObject = {}; + command.derivedCommands.globeTranslucency = derivedCommandsObject; + } + + var frameNumber = frameState.frameNumber; + + var uniformMapDirtyFrame = defaultValue( + derivedCommandsObject.uniformMapDirtyFrame, + 0 + ); + var shaderProgramDirtyFrame = defaultValue( + derivedCommandsObject.shaderProgramDirtyFrame, + 0 + ); + var renderStateDirtyFrame = defaultValue( + derivedCommandsObject.renderStateDirtyFrame, + 0 + ); + + var uniformMapDirty = + derivedCommandsObject.uniformMap !== command.uniformMap; + + var shaderProgramDirty = + derivedCommandsObject.shaderProgramId !== command.shaderProgram.id; + + var renderStateDirty = + derivedCommandsObject.renderStateId !== command.renderState.id; + + if (uniformMapDirty) { + derivedCommandsObject.uniformMapDirtyFrame = frameNumber; + } + if (shaderProgramDirty) { + derivedCommandsObject.shaderProgramDirtyFrame = frameNumber; + } + if (renderStateDirty) { + derivedCommandsObject.renderStateDirtyFrame = frameNumber; + } + + derivedCommandsObject.uniformMap = command.uniformMap; + derivedCommandsObject.shaderProgramId = command.shaderProgram.id; + derivedCommandsObject.renderStateId = command.renderState.id; + + for (var i = 0; i < derivedCommandsLength; ++i) { + var derivedCommandPack = derivedCommandPacks[i]; + var derivedCommandType = derivedCommandTypes[i]; + var derivedCommandName = derivedCommandNames[i]; + var derivedCommand = derivedCommandsObject[derivedCommandName]; + + var derivedUniformMap; + var derivedShaderProgram; + var derivedRenderState; + + if (defined(derivedCommand)) { + derivedUniformMap = derivedCommand.uniformMap; + derivedShaderProgram = derivedCommand.shaderProgram; + derivedRenderState = derivedCommand.renderState; + } else { + derivedUniformMap = undefined; + derivedShaderProgram = undefined; + derivedRenderState = undefined; + } + + derivedCommand = DrawCommand.shallowClone(command, derivedCommand); + derivedCommandsObject[derivedCommandName] = derivedCommand; + + var derivedUniformMapDirtyFrame = defaultValue( + derivedCommand.derivedCommands.uniformMapDirtyFrame, + 0 + ); + var derivedShaderProgramDirtyFrame = defaultValue( + derivedCommand.derivedCommands.shaderProgramDirtyFrame, + 0 + ); + var derivedRenderStateDirtyFrame = defaultValue( + derivedCommand.derivedCommands.renderStateDirtyFrame, + 0 + ); + + var derivedUniformMapDirty = + uniformMapDirty || derivedUniformMapDirtyFrame < uniformMapDirtyFrame; + var derivedShaderProgramDirty = + shaderProgramDirty || + derivedShaderProgramDirtyFrame < shaderProgramDirtyFrame; + var derivedRenderStateDirty = + renderStateDirty || + derivedRenderStateDirtyFrame < renderStateDirtyFrame; + + if (derivedUniformMapDirty) { + derivedCommand.derivedCommands.uniformMapDirtyFrame = frameNumber; + } + if (derivedShaderProgramDirty) { + derivedCommand.derivedCommands.shaderProgramDirtyFrame = frameNumber; + } + if (derivedRenderStateDirty) { + derivedCommand.derivedCommands.renderStateDirtyFrame = frameNumber; + } + + derivedCommand.derivedCommands.type = derivedCommandType; + derivedCommand.pass = derivedCommandPack.pass; + derivedCommand.pickOnly = derivedCommandPack.pickOnly; + derivedCommand.uniformMap = getDerivedUniformMap( + state, + command.uniformMap, + derivedUniformMap, + derivedUniformMapDirty, + derivedCommandPack.getUniformMapFunction + ); + derivedCommand.shaderProgram = getDerivedShaderProgram( + frameState.context, + command.shaderProgram, + derivedShaderProgram, + derivedShaderProgramDirty, + derivedCommandPack.getShaderProgramFunction, + derivedCommandName + ); + derivedCommand.renderState = getDerivedRenderState( + command.renderState, + derivedRenderState, + derivedRenderStateDirty, + derivedCommandPack.getRenderStateFunction, + derivedCommandPack.renderStateCache + ); + } + } +} + +GlobeTranslucencyState.prototype.pushDerivedCommands = function ( + command, + isBlendCommand, + frameState +) { + var picking = frameState.passes.pick; + if (picking && isBlendCommand) { + // No need to push blend commands in the pick pass + return; + } + + var derivedCommandTypes = this._derivedCommandTypes; + var derivedCommandsLength = this._derivedCommandsLength; + + if (picking) { + derivedCommandTypes = this._derivedPickCommandTypes; + derivedCommandsLength = this._derivedPickCommandsLength; + } else if (isBlendCommand) { + derivedCommandTypes = this._derivedBlendCommandTypes; + derivedCommandsLength = this._derivedBlendCommandsLength; + } + + if (derivedCommandsLength === 0) { + // No derived commands to push so just push the globe command + frameState.commandList.push(command); + return; + } + + // Push derived commands + var derivedCommands = command.derivedCommands.globeTranslucency; + for (var i = 0; i < derivedCommandsLength; ++i) { + var derivedCommandName = DerivedCommandNames[derivedCommandTypes[i]]; + frameState.commandList.push(derivedCommands[derivedCommandName]); + } +}; + +function executeCommandsMatchingType( + commands, + commandsLength, + executeCommandFunction, + scene, + context, + passState, + types +) { + for (var i = 0; i < commandsLength; ++i) { + var command = commands[i]; + var type = command.derivedCommands.type; + if (!defined(types) || types.indexOf(type) > -1) { + executeCommandFunction(command, scene, context, passState); + } + } +} + +function executeCommands( + commands, + commandsLength, + executeCommandFunction, + scene, + context, + passState +) { + for (var i = 0; i < commandsLength; ++i) { + executeCommandFunction(commands[i], scene, context, passState); + } +} + +var opaqueTypes = [ + DerivedCommandType.OPAQUE_FRONT_FACE, + DerivedCommandType.OPAQUE_BACK_FACE, +]; +var depthOnlyTypes = [ + DerivedCommandType.DEPTH_ONLY_FRONT_FACE, + DerivedCommandType.DEPTH_ONLY_BACK_FACE, + DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE, +]; + +GlobeTranslucencyState.prototype.executeGlobeCommands = function ( + frustumCommands, + executeCommandFunction, + globeTranslucencyFramebuffer, + scene, + passState +) { + var context = scene.context; + var globeCommands = frustumCommands.commands[Pass.GLOBE]; + var globeCommandsLength = frustumCommands.indices[Pass.GLOBE]; + + if (globeCommandsLength === 0) { + return; + } + + this._globeTranslucencyFramebuffer = globeTranslucencyFramebuffer; + globeTranslucencyFramebuffer.clearClassification(context, passState); + + // Render opaque commands like normal + executeCommandsMatchingType( + globeCommands, + globeCommandsLength, + executeCommandFunction, + scene, + context, + passState, + opaqueTypes + ); +}; + +GlobeTranslucencyState.prototype.executeGlobeClassificationCommands = function ( + frustumCommands, + executeCommandFunction, + globeTranslucencyFramebuffer, + scene, + passState +) { + var context = scene.context; + var globeCommands = frustumCommands.commands[Pass.GLOBE]; + var globeCommandsLength = frustumCommands.indices[Pass.GLOBE]; + var classificationCommands = + frustumCommands.commands[Pass.TERRAIN_CLASSIFICATION]; + var classificationCommandsLength = + frustumCommands.indices[Pass.TERRAIN_CLASSIFICATION]; + + if (globeCommandsLength === 0 || classificationCommandsLength === 0) { + return; + } + + var frontTranslucent = this._frontFaceTranslucent; + var backTranslucent = this._backFaceTranslucent; + + if (!frontTranslucent || !backTranslucent) { + // Render classification on opaque faces like normal + executeCommands( + classificationCommands, + classificationCommandsLength, + executeCommandFunction, + scene, + context, + passState + ); + } + + if (!frontTranslucent && !backTranslucent) { + // No translucent commands to render. Skip translucent classification. + return; + } + + this._globeTranslucencyFramebuffer = globeTranslucencyFramebuffer; + + var originalGlobeDepthTexture = context.uniformState.globeDepthTexture; + var originalFramebuffer = passState.framebuffer; + + // Render to internal framebuffer and get the first depth peel + passState.framebuffer = + globeTranslucencyFramebuffer.classificationFramebuffer; + + executeCommandsMatchingType( + globeCommands, + globeCommandsLength, + executeCommandFunction, + scene, + context, + passState, + depthOnlyTypes + ); + + if (context.depthTexture) { + // Pack depth into separate texture for ground polylines and textured ground primitives + var packedDepthTexture = globeTranslucencyFramebuffer.packDepth( + context, + passState + ); + context.uniformState.globeDepthTexture = packedDepthTexture; + } + + // Render classification on translucent faces + executeCommands( + classificationCommands, + classificationCommandsLength, + executeCommandFunction, + scene, + context, + passState + ); + + // Unset temporary state + context.uniformState.globeDepthTexture = originalGlobeDepthTexture; + passState.framebuffer = originalFramebuffer; +}; + +export default GlobeTranslucencyState; diff --git a/Source/Scene/GoogleEarthEnterpriseImageryProvider.js b/Source/Scene/GoogleEarthEnterpriseImageryProvider.js index 6104a29af1b9..54013f15f698 100644 --- a/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +++ b/Source/Scene/GoogleEarthEnterpriseImageryProvider.js @@ -16,6 +16,9 @@ import TileProviderError from "../Core/TileProviderError.js"; import protobuf from "../ThirdParty/protobuf-minimal.js"; import when from "../ThirdParty/when.js"; +/** + * @private + */ function GoogleEarthEnterpriseDiscardPolicy() { this._image = new Image(); } @@ -31,7 +34,7 @@ GoogleEarthEnterpriseDiscardPolicy.prototype.isReady = function () { /** * Given a tile image, decide whether to discard that image. * - * @param {Image} image An image to test. + * @param {HTMLImageElement} image An image to test. * @returns {Boolean} True if the image should be discarded; otherwise, false. */ GoogleEarthEnterpriseDiscardPolicy.prototype.shouldDiscardImage = function ( @@ -40,6 +43,20 @@ GoogleEarthEnterpriseDiscardPolicy.prototype.shouldDiscardImage = function ( return image === this._image; }; +/** + * @typedef {Object} GoogleEarthEnterpriseImageryProvider.ConstructorOptions + * + * Initialization options for the GoogleEarthEnterpriseImageryProvider constructor + * + * @property {Resource|String} url The url of the Google Earth Enterprise server hosting the imagery. + * @property {GoogleEarthEnterpriseMetadata} metadata A metadata object that can be used to share metadata requests with a GoogleEarthEnterpriseTerrainProvider. + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + * @property {TileDiscardPolicy} [tileDiscardPolicy] The policy that determines if a tile + * is invalid and should be discarded. If this value is not specified, a default + * is to discard tiles that fail to download. + * @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas. + */ + /** * Provides tiled imagery using the Google Earth Enterprise REST API. * @@ -49,14 +66,7 @@ GoogleEarthEnterpriseDiscardPolicy.prototype.shouldDiscardImage = function ( * @alias GoogleEarthEnterpriseImageryProvider * @constructor * - * @param {Object} options Object with the following properties: - * @param {Resource|String} options.url The url of the Google Earth Enterprise server hosting the imagery. - * @param {GoogleEarthEnterpriseMetadata} options.metadata A metadata object that can be used to share metadata requests with a GoogleEarthEnterpriseTerrainProvider. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. - * @param {TileDiscardPolicy} [options.tileDiscardPolicy] The policy that determines if a tile - * is invalid and should be discarded. If this value is not specified, a default - * is to discard tiles that fail to download. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. + * @param {GoogleEarthEnterpriseImageryProvider.ConstructorOptions} options Object describing initialization options * * @see GoogleEarthEnterpriseTerrainProvider * @see ArcGisMapServerImageryProvider @@ -86,6 +96,92 @@ function GoogleEarthEnterpriseImageryProvider(options) { } //>>includeEnd('debug'); + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + var metadata; if (defined(options.metadata)) { metadata = options.metadata; @@ -237,7 +333,7 @@ Object.defineProperties(GoogleEarthEnterpriseImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link GoogleEarthEnterpriseImageryProvider#ready} returns true. * @memberof GoogleEarthEnterpriseImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -451,7 +547,7 @@ GoogleEarthEnterpriseImageryProvider.prototype.getTileCredits = function ( * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/GoogleEarthEnterpriseMapsProvider.js b/Source/Scene/GoogleEarthEnterpriseMapsProvider.js index caed15af4bea..5ac25bf96b81 100644 --- a/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +++ b/Source/Scene/GoogleEarthEnterpriseMapsProvider.js @@ -15,26 +15,12 @@ import when from "../ThirdParty/when.js"; import ImageryProvider from "./ImageryProvider.js"; /** - * Provides tiled imagery using the Google Earth Imagery API. - * - * Notes: This imagery provider does not work with the public Google Earth servers. It works with the - * Google Earth Enterprise Server. - * - * By default the Google Earth Enterprise server does not set the - * {@link http://www.w3.org/TR/cors/|Cross-Origin Resource Sharing} headers. You can either - * use a proxy server which adds these headers, or in the /opt/google/gehttpd/conf/gehttpd.conf - * and add the 'Header set Access-Control-Allow-Origin "*"' option to the '<Directory />' and - * '<Directory "/opt/google/gehttpd/htdocs">' directives. - * - * This provider is for use with 2D Maps API as part of Google Earth Enterprise. For 3D Earth API uses, it - * is necessary to use {@link GoogleEarthEnterpriseImageryProvider} + * @typedef {Object} GoogleEarthEnterpriseMapsProvider.ConstructorOptions * - * @alias GoogleEarthEnterpriseMapsProvider - * @constructor + * Initialization options for the GoogleEarthEnterpriseMapsProvider constructor * - * @param {Object} options Object with the following properties: - * @param {Resource|String} options.url The url of the Google Earth server hosting the imagery. - * @param {Number} options.channel The channel (id) to be used when requesting data from the server. + * @property {Resource|String} url The url of the Google Earth server hosting the imagery. + * @property {Number} channel The channel (id) to be used when requesting data from the server. * The channel number can be found by looking at the json file located at: * earth.localdomain/default_map/query?request=Json&vars=geeServerDefs The /default_map path may * differ depending on your Google Earth Enterprise server configuration. Look for the "id" that @@ -52,13 +38,34 @@ import ImageryProvider from "./ImageryProvider.js"; * } * ] * } - * @param {String} [options.path="/default_map"] The path of the Google Earth server hosting the imagery. - * @param {Number} [options.maximumLevel] The maximum level-of-detail supported by the Google Earth + * @property {String} [path="/default_map"] The path of the Google Earth server hosting the imagery. + * @property {Number} [maximumLevel] The maximum level-of-detail supported by the Google Earth * Enterprise server, or undefined if there is no limit. - * @param {TileDiscardPolicy} [options.tileDiscardPolicy] The policy that determines if a tile + * @property {TileDiscardPolicy} [tileDiscardPolicy] The policy that determines if a tile * is invalid and should be discarded. To ensure that no tiles are discarded, construct and pass * a {@link NeverTileDiscardPolicy} for this parameter. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + */ + +/** + * Provides tiled imagery using the Google Earth Imagery API. + * + * Notes: This imagery provider does not work with the public Google Earth servers. It works with the + * Google Earth Enterprise Server. + * + * By default the Google Earth Enterprise server does not set the + * {@link http://www.w3.org/TR/cors/|Cross-Origin Resource Sharing} headers. You can either + * use a proxy server which adds these headers, or in the /opt/google/gehttpd/conf/gehttpd.conf + * and add the 'Header set Access-Control-Allow-Origin "*"' option to the '<Directory />' and + * '<Directory "/opt/google/gehttpd/htdocs">' directives. + * + * This provider is for use with 2D Maps API as part of Google Earth Enterprise. For 3D Earth API uses, it + * is necessary to use {@link GoogleEarthEnterpriseImageryProvider} + * + * @alias GoogleEarthEnterpriseMapsProvider + * @constructor + * + * @param {GoogleEarthEnterpriseMapsProvider.ConstructorOptions} options Object describing initialization options * * @exception {RuntimeError} Could not find layer with channel (id) of options.channel. * @exception {RuntimeError} Could not find a version in channel (id) options.channel. @@ -94,6 +101,92 @@ function GoogleEarthEnterpriseMapsProvider(options) { } //>>includeEnd('debug'); + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default 1.9 + */ + this.defaultGamma = 1.9; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + var url = options.url; var path = defaultValue(options.path, "/default_map"); @@ -116,16 +209,6 @@ function GoogleEarthEnterpriseMapsProvider(options) { '" title="Google Imagery"/>' ); - /** - * The default {@link ImageryLayer#gamma} to use for imagery layers created for this provider. - * By default, this is set to 1.9. Changing this value after creating an {@link ImageryLayer} for this provider will have - * no effect. Instead, set the layer's {@link ImageryLayer#gamma} property. - * - * @type {Number} - * @default 1.9 - */ - this.defaultGamma = 1.9; - this._tilingScheme = undefined; this._version = undefined; @@ -360,7 +443,7 @@ Object.defineProperties(GoogleEarthEnterpriseMapsProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link GoogleEarthEnterpriseMapsProvider#ready} returns true. * @memberof GoogleEarthEnterpriseMapsProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -598,7 +681,7 @@ GoogleEarthEnterpriseMapsProvider.prototype.getTileCredits = function ( * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/GridImageryProvider.js b/Source/Scene/GridImageryProvider.js index 7a89ae5379c1..1e780c0e6e15 100644 --- a/Source/Scene/GridImageryProvider.js +++ b/Source/Scene/GridImageryProvider.js @@ -9,30 +9,123 @@ var defaultColor = new Color(1.0, 1.0, 1.0, 0.4); var defaultGlowColor = new Color(0.0, 1.0, 0.0, 0.05); var defaultBackgroundColor = new Color(0.0, 0.5, 0.0, 0.2); +/** + * @typedef {Object} GridImageryProvider.ConstructorOptions + * + * Initialization options for the GridImageryProvider constructor + * + * @param {TilingScheme} [tilingScheme=new GeographicTilingScheme()] The tiling scheme for which to draw tiles. + * @param {Ellipsoid} [ellipsoid] The ellipsoid. If the tilingScheme is specified, + * this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither + * parameter is specified, the WGS84 ellipsoid is used. + * @param {Number} [cells=8] The number of grids cells. + * @param {Color} [color=Color(1.0, 1.0, 1.0, 0.4)] The color to draw grid lines. + * @param {Color} [glowColor=Color(0.0, 1.0, 0.0, 0.05)] The color to draw glow for grid lines. + * @param {Number} [glowWidth=6] The width of lines used for rendering the line glow effect. + * @param {Color} [backgroundColor=Color(0.0, 0.5, 0.0, 0.2)] Background fill color. + * @param {Number} [tileWidth=256] The width of the tile for level-of-detail selection purposes. + * @param {Number} [tileHeight=256] The height of the tile for level-of-detail selection purposes. + * @param {Number} [canvasSize=256] The size of the canvas used for rendering. + */ + /** * An {@link ImageryProvider} that draws a wireframe grid on every tile with controllable background and glow. * May be useful for custom rendering effects or debugging terrain. * * @alias GridImageryProvider * @constructor + * @param {GridImageryProvider.ConstructorOptions} options Object describing initialization options * - * @param {Object} [options] Object with the following properties: - * @param {TilingScheme} [options.tilingScheme=new GeographicTilingScheme()] The tiling scheme for which to draw tiles. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If the tilingScheme is specified, - * this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither - * parameter is specified, the WGS84 ellipsoid is used. - * @param {Number} [options.cells=8] The number of grids cells. - * @param {Color} [options.color=Color(1.0, 1.0, 1.0, 0.4)] The color to draw grid lines. - * @param {Color} [options.glowColor=Color(0.0, 1.0, 0.0, 0.05)] The color to draw glow for grid lines. - * @param {Number} [options.glowWidth=6] The width of lines used for rendering the line glow effect. - * @param {Color} [options.backgroundColor=Color(0.0, 0.5, 0.0, 0.2)] Background fill color. - * @param {Number} [options.tileWidth=256] The width of the tile for level-of-detail selection purposes. - * @param {Number} [options.tileHeight=256] The height of the tile for level-of-detail selection purposes. - * @param {Number} [options.canvasSize=256] The size of the canvas used for rendering. */ function GridImageryProvider(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + this._tilingScheme = defined(options.tilingScheme) ? options.tilingScheme : new GeographicTilingScheme({ ellipsoid: options.ellipsoid }); @@ -102,7 +195,7 @@ Object.defineProperties(GridImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link GridImageryProvider#ready} returns true. * @memberof GridImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -315,7 +408,7 @@ GridImageryProvider.prototype.getTileCredits = function (x, y, level) { * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/GroundPolylinePrimitive.js b/Source/Scene/GroundPolylinePrimitive.js index 7d42fc6e55da..9364a560423d 100644 --- a/Source/Scene/GroundPolylinePrimitive.js +++ b/Source/Scene/GroundPolylinePrimitive.js @@ -212,7 +212,7 @@ function GroundPolylinePrimitive(options) { depthTest: { enabled: true, }, - blending: BlendingState.ALPHA_BLEND, + blending: BlendingState.PRE_MULTIPLIED_ALPHA_BLEND, depthMask: false, }); } @@ -334,7 +334,7 @@ Object.defineProperties(GroundPolylinePrimitive.prototype, { * Initializes the minimum and maximum terrain heights. This only needs to be called if you are creating the * GroundPolylinePrimitive synchronously. * - * @returns {Promise} A promise that will resolve once the terrain heights have been loaded. + * @returns {Promise} A promise that will resolve once the terrain heights have been loaded. */ GroundPolylinePrimitive.initializeTerrainHeights = function () { return ApproximateTerrainHeights.initialize(); @@ -487,7 +487,7 @@ function getRenderState(mask3DTiles) { cull: { enabled: true, // prevent double-draw. Geometry is "inverted" (reversed winding order) so we're drawing backfaces. }, - blending: BlendingState.ALPHA_BLEND, + blending: BlendingState.PRE_MULTIPLIED_ALPHA_BLEND, depthMask: false, stencilTest: { enabled: mask3DTiles, diff --git a/Source/Scene/GroundPrimitive.js b/Source/Scene/GroundPrimitive.js index 943e508d9157..e07d256f54ab 100644 --- a/Source/Scene/GroundPrimitive.js +++ b/Source/Scene/GroundPrimitive.js @@ -505,7 +505,7 @@ function createBoundingVolume(groundPrimitive, frameState, geometry) { } function boundingVolumeIndex(commandIndex, length) { - return Math.floor((commandIndex % length) / 3); + return Math.floor((commandIndex % length) / 2); } function updateAndQueueRenderCommand( @@ -626,7 +626,7 @@ function updateAndQueueCommands( var ignoreShowCommands = classificationPrimitive._commandsIgnoreShow; var ignoreShowCommandsLength = ignoreShowCommands.length; for (i = 0; i < ignoreShowCommandsLength; ++i) { - boundingVolume = boundingVolumes[Math.floor(i / 2)]; + boundingVolume = boundingVolumes[i]; command = ignoreShowCommands[i]; updateAndQueueRenderCommand( groundPrimitive, @@ -685,7 +685,7 @@ function updateAndQueueCommands( * Initializes the minimum and maximum terrain heights. This only needs to be called if you are creating the * GroundPrimitive synchronously. * - * @returns {Promise} A promise that will resolve once the terrain heights have been loaded. + * @returns {Promise} A promise that will resolve once the terrain heights have been loaded. * */ GroundPrimitive.initializeTerrainHeights = function () { diff --git a/Source/Scene/HeightReference.js b/Source/Scene/HeightReference.js index 11788d5210b8..5fcd6f3ba874 100644 --- a/Source/Scene/HeightReference.js +++ b/Source/Scene/HeightReference.js @@ -1,7 +1,7 @@ /** * Represents the position relative to the terrain. * - * @exports HeightReference + * @enum {Number} */ var HeightReference = { /** diff --git a/Source/Scene/HorizontalOrigin.js b/Source/Scene/HorizontalOrigin.js index f98f12188e8d..ab46bf910222 100644 --- a/Source/Scene/HorizontalOrigin.js +++ b/Source/Scene/HorizontalOrigin.js @@ -8,7 +8,7 @@ *
* * - * @exports HorizontalOrigin + * @enum {Number} * * @see Billboard#horizontalOrigin * @see Label#horizontalOrigin diff --git a/Source/Scene/ImageryLayer.js b/Source/Scene/ImageryLayer.js index b8938689eff2..4cd1cb84b750 100644 --- a/Source/Scene/ImageryLayer.js +++ b/Source/Scene/ImageryLayer.js @@ -54,6 +54,18 @@ import TileImagery from "./TileImagery.js"; * current frame state, this layer, and the x, y, and level coordinates of the * imagery tile for which the alpha is required, and it is expected to return * the alpha value to use for the tile. + * @param {Number|Function} [options.nightAlpha=1.0] The alpha blending value of this layer on the night side of the globe, from 0.0 to 1.0. + * This can either be a simple number or a function with the signature + * function(frameState, layer, x, y, level). The function is passed the + * current frame state, this layer, and the x, y, and level coordinates of the + * imagery tile for which the alpha is required, and it is expected to return + * the alpha value to use for the tile. This only takes effect when enableLighting is true. + * @param {Number|Function} [options.dayAlpha=1.0] The alpha blending value of this layer on the day side of the globe, from 0.0 to 1.0. + * This can either be a simple number or a function with the signature + * function(frameState, layer, x, y, level). The function is passed the + * current frame state, this layer, and the x, y, and level coordinates of the + * imagery tile for which the alpha is required, and it is expected to return + * the alpha value to use for the tile. This only takes effect when enableLighting is true. * @param {Number|Function} [options.brightness=1.0] The brightness of this layer. 1.0 uses the unmodified imagery * color. Less than 1.0 makes the imagery darker while greater than 1.0 makes it brighter. * This can either be a simple number or a function with the signature @@ -131,6 +143,30 @@ function ImageryLayer(imageryProvider, options) { defaultValue(imageryProvider.defaultAlpha, 1.0) ); + /** + * The alpha blending value of this layer on the night side of the globe, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. This only takes effect when {@link Globe#enableLighting} is true. + * + * @type {Number} + * @default 1.0 + */ + this.nightAlpha = defaultValue( + options.nightAlpha, + defaultValue(imageryProvider.defaultNightAlpha, 1.0) + ); + + /** + * The alpha blending value of this layer on the day side of the globe, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. This only takes effect when {@link Globe#enableLighting} is true. + * + * @type {Number} + * @default 1.0 + */ + this.dayAlpha = defaultValue( + options.dayAlpha, + defaultValue(imageryProvider.defaultDayAlpha, 1.0) + ); + /** * The brightness of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 * makes the imagery darker while greater than 1.0 makes it brighter. diff --git a/Source/Scene/ImageryLayerCollection.js b/Source/Scene/ImageryLayerCollection.js index 0030cd8751d0..4184c37c92f6 100644 --- a/Source/Scene/ImageryLayerCollection.js +++ b/Source/Scene/ImageryLayerCollection.js @@ -74,7 +74,7 @@ Object.defineProperties(ImageryLayerCollection.prototype, { * * @param {ImageryLayer} layer the layer to add. * @param {Number} [index] the index to add the layer at. If omitted, the layer will - * added on top of all existing layers. + * be added on top of all existing layers. * * @exception {DeveloperError} index, if supplied, must be greater than or equal to zero and less than or equal to the number of the layers. */ diff --git a/Source/Scene/ImageryLayerFeatureInfo.js b/Source/Scene/ImageryLayerFeatureInfo.js index 90f89d3a485e..6536bcebd9ab 100644 --- a/Source/Scene/ImageryLayerFeatureInfo.js +++ b/Source/Scene/ImageryLayerFeatureInfo.js @@ -9,34 +9,34 @@ import defined from "../Core/defined.js"; function ImageryLayerFeatureInfo() { /** * Gets or sets the name of the feature. - * @type {String} + * @type {String|undefined} */ this.name = undefined; /** * Gets or sets an HTML description of the feature. The HTML is not trusted and should * be sanitized before display to the user. - * @type {String} + * @type {String|undefined} */ this.description = undefined; /** * Gets or sets the position of the feature, or undefined if the position is not known. * - * @type {Cartographic} + * @type {Cartographic|undefined} */ this.position = undefined; /** * Gets or sets the raw data describing the feature. The raw data may be in any * number of formats, such as GeoJSON, KML, etc. - * @type {Object} + * @type {Object|undefined} */ this.data = undefined; /** * Gets or sets the image layer of the feature. - * @type {Object} + * @type {Object|undefined} */ this.imageryLayer = undefined; } diff --git a/Source/Scene/ImageryProvider.js b/Source/Scene/ImageryProvider.js index 884a28d71ce2..77c53f6975a9 100644 --- a/Source/Scene/ImageryProvider.js +++ b/Source/Scene/ImageryProvider.js @@ -19,6 +19,7 @@ import Resource from "../Core/Resource.js"; * @see GoogleEarthEnterpriseImageryProvider * @see GoogleEarthEnterpriseMapsProvider * @see GridImageryProvider + * @see IonImageryProvider * @see MapboxImageryProvider * @see MapboxStyleImageryProvider * @see SingleTileImageryProvider @@ -35,16 +36,34 @@ function ImageryProvider() { * The default alpha blending value of this provider, with 0.0 representing fully transparent and * 1.0 representing fully opaque. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultAlpha = undefined; + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + /** * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 * makes the imagery darker while greater than 1.0 makes it brighter. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultBrightness = undefined; @@ -53,7 +72,7 @@ function ImageryProvider() { * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces * the contrast while greater than 1.0 increases it. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultContrast = undefined; @@ -61,7 +80,7 @@ function ImageryProvider() { /** * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultHue = undefined; @@ -70,7 +89,7 @@ function ImageryProvider() { * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the * saturation while greater than 1.0 increases it. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultSaturation = undefined; @@ -78,7 +97,7 @@ function ImageryProvider() { /** * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultGamma = undefined; @@ -160,7 +179,7 @@ Object.defineProperties(ImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link ImageryProvider#ready} returns true. * @memberof ImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -257,7 +276,6 @@ Object.defineProperties(ImageryProvider.prototype, { /** * Gets the credits to be displayed when a given tile is displayed. - * @function * * @param {Number} x The tile X coordinate. * @param {Number} y The tile Y coordinate. @@ -266,26 +284,28 @@ Object.defineProperties(ImageryProvider.prototype, { * * @exception {DeveloperError} getTileCredits must not be called before the imagery provider is ready. */ -ImageryProvider.prototype.getTileCredits = - DeveloperError.throwInstantiationError; +ImageryProvider.prototype.getTileCredits = function (x, y, level) { + DeveloperError.throwInstantiationError(); +}; /** * Requests the image for a given tile. This function should * not be called before {@link ImageryProvider#ready} returns true. - * @function * * @param {Number} x The tile X coordinate. * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. * * @exception {DeveloperError} requestImage must not be called before the imagery provider is ready. */ -ImageryProvider.prototype.requestImage = DeveloperError.throwInstantiationError; +ImageryProvider.prototype.requestImage = function (x, y, level, request) { + DeveloperError.throwInstantiationError(); +}; /** * Asynchronously determines what features, if any, are located at a given longitude and latitude within @@ -306,7 +326,15 @@ ImageryProvider.prototype.requestImage = DeveloperError.throwInstantiationError; * * @exception {DeveloperError} pickFeatures must not be called before the imagery provider is ready. */ -ImageryProvider.prototype.pickFeatures = DeveloperError.throwInstantiationError; +ImageryProvider.prototype.pickFeatures = function ( + x, + y, + level, + longitude, + latitude +) { + DeveloperError.throwInstantiationError(); +}; var ktxRegex = /\.ktx$/i; var crnRegex = /\.crn$/i; @@ -318,7 +346,7 @@ var crnRegex = /\.crn$/i; * * @param {ImageryProvider} imageryProvider The imagery provider for the URL. * @param {Resource|String} url The URL of the image. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/ImagerySplitDirection.js b/Source/Scene/ImagerySplitDirection.js index 84b6e4be79ce..0778b4021d01 100644 --- a/Source/Scene/ImagerySplitDirection.js +++ b/Source/Scene/ImagerySplitDirection.js @@ -1,7 +1,7 @@ /** * The direction to display an ImageryLayer relative to the {@link Scene#imagerySplitPosition}. * - * @exports ImagerySplitDirection + * @enum {Number} * * @see ImageryLayer#splitDirection */ diff --git a/Source/Scene/IonImageryProvider.js b/Source/Scene/IonImageryProvider.js index 806449949d30..d13495957e94 100644 --- a/Source/Scene/IonImageryProvider.js +++ b/Source/Scene/IonImageryProvider.js @@ -36,16 +36,23 @@ var ImageryProviderMapping = { WMTS: createFactory(WebMapTileServiceImageryProvider), }; +/** + * @typedef {Object} IonImageryProvider.ConstructorOptions + * + * Initialization options for the TileMapServiceImageryProvider constructor + * + * @property {Number} assetId An ion imagery asset ID + * @property {String} [accessToken=Ion.defaultAccessToken] The access token to use. + * @property {String|Resource} [server=Ion.defaultServer] The resource to the Cesium ion API server. + */ + /** * Provides tiled imagery using the Cesium ion REST API. * * @alias IonImageryProvider * @constructor * - * @param {Object} options Object with the following properties: - * @param {Number} options.assetId An ion imagery asset ID; - * @param {String} [options.accessToken=Ion.defaultAccessToken] The access token to use. - * @param {String|Resource} [options.server=Ion.defaultServer] The resource to the Cesium ion API server. + * @param {IonImageryProvider.ConstructorOptions} options Object describing initialization options * * @example * viewer.imageryLayers.addImageryProvider(new Cesium.IonImageryProvider({ assetId : 23489024 })); @@ -62,16 +69,34 @@ function IonImageryProvider(options) { * The default alpha blending value of this provider, with 0.0 representing fully transparent and * 1.0 representing fully opaque. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultAlpha = undefined; + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + /** * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 * makes the imagery darker while greater than 1.0 makes it brighter. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultBrightness = undefined; @@ -80,7 +105,7 @@ function IonImageryProvider(options) { * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces * the contrast while greater than 1.0 increases it. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultContrast = undefined; @@ -88,7 +113,7 @@ function IonImageryProvider(options) { /** * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultHue = undefined; @@ -97,7 +122,7 @@ function IonImageryProvider(options) { * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the * saturation while greater than 1.0 increases it. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultSaturation = undefined; @@ -105,7 +130,7 @@ function IonImageryProvider(options) { /** * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. * - * @type {Number} + * @type {Number|undefined} * @default undefined */ this.defaultGamma = undefined; @@ -282,7 +307,7 @@ Object.defineProperties(IonImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link IonImageryProvider#ready} returns true. * @memberof IonImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -420,6 +445,19 @@ Object.defineProperties(IonImageryProvider.prototype, { //>>includeEnd('debug'); return this._imageryProvider.hasAlphaChannel; }, + + /** + * Gets the proxy used by this provider. + * @memberof IonImageryProvider.prototype + * @type {Proxy} + * @readonly + * @default undefined + */ + proxy: { + get: function () { + return undefined; + }, + }, }, }); @@ -460,7 +498,7 @@ IonImageryProvider.prototype.getTileCredits = function (x, y, level) { * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/IonWorldImageryStyle.js b/Source/Scene/IonWorldImageryStyle.js index cf7b325c15de..824de2cb4fdd 100644 --- a/Source/Scene/IonWorldImageryStyle.js +++ b/Source/Scene/IonWorldImageryStyle.js @@ -3,7 +3,7 @@ /** * The types of imagery provided by {@link createWorldImagery}. * - * @exports IonWorldImageryStyle + * @enum {Number} */ var IonWorldImageryStyle = { /** diff --git a/Source/Scene/Label.js b/Source/Scene/Label.js index e86977c254c9..8108aa5a5669 100644 --- a/Source/Scene/Label.js +++ b/Source/Scene/Label.js @@ -621,7 +621,7 @@ Object.defineProperties(Label.prototype, { /** * Gets or sets near and far translucency properties of a Label based on the Label's distance from the camera. * A label's translucency will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the label's translucency remains clamped to the nearest bound. If undefined, * translucencyByDistance will be disabled. @@ -678,7 +678,7 @@ Object.defineProperties(Label.prototype, { /** * Gets or sets near and far pixel offset scaling properties of a Label based on the Label's distance from the camera. * A label's pixel offset will be scaled between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the label's pixel offset scaling remains clamped to the nearest bound. If undefined, * pixelOffsetScaleByDistance will be disabled. @@ -736,7 +736,7 @@ Object.defineProperties(Label.prototype, { /** * Gets or sets near and far scaling properties of a Label based on the label's distance from the camera. * A label's scale will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the label's scale remains clamped to the nearest bound. If undefined, * scaleByDistance will be disabled. diff --git a/Source/Scene/LabelStyle.js b/Source/Scene/LabelStyle.js index 4412141dc9d7..10517de8aff3 100644 --- a/Source/Scene/LabelStyle.js +++ b/Source/Scene/LabelStyle.js @@ -1,7 +1,7 @@ /** * Describes how to draw a label. * - * @exports LabelStyle + * @enum {Number} * * @see Label#style */ diff --git a/Source/Scene/MapMode2D.js b/Source/Scene/MapMode2D.js index 3663f43a68db..7e1d8b538dce 100644 --- a/Source/Scene/MapMode2D.js +++ b/Source/Scene/MapMode2D.js @@ -1,7 +1,7 @@ /** * Describes how the map will operate in 2D. * - * @exports MapMode2D + * @enum {Number} */ var MapMode2D = { /** diff --git a/Source/Scene/MapboxImageryProvider.js b/Source/Scene/MapboxImageryProvider.js index e27c0e8eb83d..79caf55821b6 100644 --- a/Source/Scene/MapboxImageryProvider.js +++ b/Source/Scene/MapboxImageryProvider.js @@ -12,24 +12,30 @@ var defaultCredit = new Credit( ); /** - * Provides tiled imagery hosted by Mapbox. + * @typedef {Object} MapboxImageryProvider.ConstructorOptions * - * @alias MapboxImageryProvider - * @constructor + * Initialization options for the MapboxImageryProvider constructor * - * @param {Object} [options] Object with the following properties: - * @param {String} [options.url='https://api.mapbox.com/v4/'] The Mapbox server url. - * @param {String} options.mapId The Mapbox Map ID. - * @param {String} [options.accessToken] The public access token for the imagery. - * @param {String} [options.format='png'] The format of the image request. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. - * @param {Number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying + * @property {String} [url='https://api.mapbox.com/v4/'] The Mapbox server url. + * @property {String} mapId The Mapbox Map ID. + * @property {String} [accessToken] The public access token for the imagery. + * @property {String} [format='png'] The format of the image request. + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + * @property {Number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely * to result in rendering problems. - * @param {Number} [options.maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. - * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. + * @property {Number} [maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. + * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. + * @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas. + */ + +/** + * Provides tiled imagery hosted by Mapbox. * + * @alias MapboxImageryProvider + * @constructor + * + * @param {MapboxImageryProvider.ConstructorOptions} options Object describing initialization options * * @example * // Mapbox tile provider @@ -50,6 +56,92 @@ function MapboxImageryProvider(options) { } //>>includeEnd('debug'); + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + var resource = Resource.createIfNeeded( defaultValue(options.url, "https://{s}.tiles.mapbox.com/v4/") ); @@ -179,7 +271,7 @@ Object.defineProperties(MapboxImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link MapboxImageryProvider#ready} returns true. * @memberof MapboxImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -314,7 +406,7 @@ MapboxImageryProvider.prototype.getTileCredits = function (x, y, level) { * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/MapboxStyleImageryProvider.js b/Source/Scene/MapboxStyleImageryProvider.js index a52b5972b4e3..6c51a414b32f 100644 --- a/Source/Scene/MapboxStyleImageryProvider.js +++ b/Source/Scene/MapboxStyleImageryProvider.js @@ -12,26 +12,32 @@ var defaultCredit = new Credit( ); /** - * Provides tiled imagery hosted by Mapbox. + * @typedef {Object} MapboxStyleImageryProvider.ConstructorOptions * - * @alias MapboxStyleImageryProvider - * @constructor + * Initialization options for the MapboxStyleImageryProvider constructor * - * @param {Object} [options] Object with the following properties: - * @param {Resource|String} [options.url='https://api.mapbox.com/styles/v1/'] The Mapbox server url. - * @param {String} [options.username='mapbox'] The username of the map account. - * @param {String} options.styleId The Mapbox Style ID. - * @param {String} [options.accessToken] The public access token for the imagery. - * @param {Number} [options.tilesize=512] The size of the image tiles. - * @param {Boolean} [options.scaleFactor] Determines if tiles are rendered at a @2x scale factor. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. - * @param {Number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying + * @property {Resource|String} [url='https://api.mapbox.com/styles/v1/'] The Mapbox server url. + * @property {String} [username='mapbox'] The username of the map account. + * @property {String} styleId The Mapbox Style ID. + * @property {String} [accessToken] The public access token for the imagery. + * @property {Number} [tilesize=512] The size of the image tiles. + * @property {Boolean} [scaleFactor] Determines if tiles are rendered at a @2x scale factor. + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + * @property {Number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely * to result in rendering problems. - * @param {Number} [options.maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. - * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. + * @property {Number} [maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. + * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. + * @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas. + */ + +/** + * Provides tiled imagery hosted by Mapbox. * + * @alias MapboxStyleImageryProvider + * @constructor + * + * @param {MapboxStyleImageryProvider.ConstructorOptions} options Object describing initialization options * * @example * // Mapbox style provider @@ -52,6 +58,92 @@ function MapboxStyleImageryProvider(options) { } //>>includeEnd('debug'); + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + var resource = Resource.createIfNeeded( defaultValue(options.url, "https://api.mapbox.com/styles/v1/") ); @@ -191,7 +283,7 @@ Object.defineProperties(MapboxStyleImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link MapboxStyleImageryProvider#ready} returns true. * @memberof MapboxStyleImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -326,7 +418,7 @@ MapboxStyleImageryProvider.prototype.getTileCredits = function (x, y, level) { * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/MaterialAppearance.js b/Source/Scene/MaterialAppearance.js index e5a69b513abc..e0770a047378 100644 --- a/Source/Scene/MaterialAppearance.js +++ b/Source/Scene/MaterialAppearance.js @@ -22,11 +22,11 @@ import Material from "./Material.js"; * @param {Boolean} [options.faceForward=!options.closed] When true, the fragment shader flips the surface normal as needed to ensure that the normal faces the viewer to avoid dark spots. This is useful when both sides of a geometry should be shaded like {@link WallGeometry}. * @param {Boolean} [options.translucent=true] When true, the geometry is expected to appear translucent so {@link MaterialAppearance#renderState} has alpha blending enabled. * @param {Boolean} [options.closed=false] When true, the geometry is expected to be closed so {@link MaterialAppearance#renderState} has backface culling enabled. - * @param {MaterialAppearance.MaterialSupport} [options.materialSupport=MaterialAppearance.MaterialSupport.TEXTURED] The type of materials that will be supported. + * @param {MaterialAppearance.MaterialSupportType} [options.materialSupport=MaterialAppearance.MaterialSupport.TEXTURED] The type of materials that will be supported. * @param {Material} [options.material=Material.ColorType] The material used to determine the fragment color. * @param {String} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader. * @param {String} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader. - * @param {RenderState} [options.renderState] Optional render state to override the default render state. + * @param {Object} [options.renderState] Optional render state to override the default render state. * * @see {@link https://github.com/CesiumGS/cesium/wiki/Fabric|Fabric} * @demo {@link https://sandcastle.cesium.com/index.html?src=Materials.html|Cesium Sandcastle Material Appearance Demo} @@ -177,7 +177,7 @@ Object.defineProperties(MaterialAppearance.prototype, { * * @memberof MaterialAppearance.prototype * - * @type {MaterialAppearance.MaterialSupport} + * @type {MaterialAppearance.MaterialSupportType} * @readonly * * @default {@link MaterialAppearance.MaterialSupport.TEXTURED} @@ -276,18 +276,27 @@ MaterialAppearance.prototype.isTranslucent = Appearance.prototype.isTranslucent; MaterialAppearance.prototype.getRenderState = Appearance.prototype.getRenderState; +/** + * @typedef MaterialAppearance.MaterialSupportType + * @type {Object} + * @property {VertexFormat} vertexFormat + * @property {String} vertexShaderSource + * @property {String} fragmentShaderSource + */ + /** * Determines the type of {@link Material} that is supported by a * {@link MaterialAppearance} instance. This is a trade-off between * flexibility (a wide array of materials) and memory/performance * (required vertex format and GLSL shader complexity. - * @exports MaterialAppearance.MaterialSupport + * @namespace */ MaterialAppearance.MaterialSupport = { /** * Only basic materials, which require just position and * normal vertex attributes, are supported. * + * @type {MaterialAppearance.MaterialSupportType} * @constant */ BASIC: Object.freeze({ @@ -300,6 +309,7 @@ MaterialAppearance.MaterialSupport = { * normal, and st vertex attributes, * are supported. The vast majority of materials fall into this category. * + * @type {MaterialAppearance.MaterialSupportType} * @constant */ TEXTURED: Object.freeze({ @@ -312,6 +322,7 @@ MaterialAppearance.MaterialSupport = { * This requires position, normal, st, * tangent, and bitangent vertex attributes. * + * @type {MaterialAppearance.MaterialSupportType} * @constant */ ALL: Object.freeze({ diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 6720690cb6db..f337048d58c4 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -4388,7 +4388,7 @@ function applySkins(model) { computedJointMatrices[m] ); if (defined(bindShapeMatrix)) { - // Optimization for when bind shape matrix is the identity. + // NOTE: bindShapeMatrix is glTF 1.0 only, removed in glTF 2.0. computedJointMatrices[m] = Matrix4.multiplyTransformation( computedJointMatrices[m], bindShapeMatrix, diff --git a/Source/Scene/ModelAnimationLoop.js b/Source/Scene/ModelAnimationLoop.js index cda8146ea601..3cb0a59948e9 100644 --- a/Source/Scene/ModelAnimationLoop.js +++ b/Source/Scene/ModelAnimationLoop.js @@ -1,7 +1,7 @@ /** * Determines if and how a glTF animation is looped. * - * @exports ModelAnimationLoop + * @enum {Number} * * @see ModelAnimationCollection#add */ diff --git a/Source/Scene/ModelOutlineLoader.js b/Source/Scene/ModelOutlineLoader.js index eb50d33f5889..d8561055255c 100644 --- a/Source/Scene/ModelOutlineLoader.js +++ b/Source/Scene/ModelOutlineLoader.js @@ -8,6 +8,10 @@ import TextureMinificationFilter from "../Renderer/TextureMinificationFilter.js" import TextureWrap from "../Renderer/TextureWrap.js"; import ForEach from "../ThirdParty/GltfPipeline/ForEach.js"; +// glTF does not allow an index value of 65535 because this is the primitive +// restart value in some APIs. +var MAX_GLTF_UINT16_INDEX = 65534; + /** * Creates face outlines for glTF primitives with the `CESIUM_primitive_outline` extension. * @private @@ -273,7 +277,10 @@ function addOutline( vertexCopies[unmatchableVertexIndex] = copy; } - if (copy >= 65536 && triangleIndices instanceof Uint16Array) { + if ( + copy > MAX_GLTF_UINT16_INDEX && + triangleIndices instanceof Uint16Array + ) { // We outgrew a 16-bit index buffer, switch to 32-bit. triangleIndices = new Uint32Array(triangleIndices); triangleIndexAccessorGltf.componentType = 5125; // UNSIGNED_INT @@ -295,6 +302,15 @@ function addOutline( 0, triangleIndices.byteLength ); + + // The index componentType is also squirreled away in ModelLoadResources. + // Hackily update it, or else we'll end up creating the wrong type + // of index buffer later. + loadResources.indexBuffersToCreate._array.forEach(function (toCreate) { + if (toCreate.id === triangleIndexAccessorGltf.bufferView) { + toCreate.componentType = triangleIndexAccessorGltf.componentType; + } + }); } if (unmatchableVertexIndex === i0) { diff --git a/Source/Scene/ModelUtility.js b/Source/Scene/ModelUtility.js index 1f41ba6356ab..44103a7c1878 100644 --- a/Source/Scene/ModelUtility.js +++ b/Source/Scene/ModelUtility.js @@ -70,13 +70,13 @@ ModelUtility.splitIncompatibleMaterials = function (gltf) { var jointAccessorId = primitive.attributes.JOINTS_0; var componentType; - var type; + var accessorType; if (defined(jointAccessorId)) { var jointAccessor = accessors[jointAccessorId]; componentType = jointAccessor.componentType; - type = jointAccessor.type; + accessorType = jointAccessor.type; } - var isSkinned = defined(jointAccessorId); + var isSkinned = defined(jointAccessorId) && accessorType === "VEC4"; var hasVertexColors = defined(primitive.attributes.COLOR_0); var hasMorphTargets = defined(primitive.targets); var hasNormals = defined(primitive.attributes.NORMAL); @@ -92,7 +92,6 @@ ModelUtility.splitIncompatibleMaterials = function (gltf) { skinning: { skinned: isSkinned, componentType: componentType, - type: type, }, hasVertexColors: hasVertexColors, hasMorphTargets: hasMorphTargets, @@ -103,7 +102,6 @@ ModelUtility.splitIncompatibleMaterials = function (gltf) { }; } else if ( primitiveInfo.skinning.skinned !== isSkinned || - primitiveInfo.skinning.type !== type || primitiveInfo.hasVertexColors !== hasVertexColors || primitiveInfo.hasMorphTargets !== hasMorphTargets || primitiveInfo.hasNormals !== hasNormals || @@ -124,7 +122,6 @@ ModelUtility.splitIncompatibleMaterials = function (gltf) { skinning: { skinned: isSkinned, componentType: componentType, - type: type, }, hasVertexColors: hasVertexColors, hasMorphTargets: hasMorphTargets, diff --git a/Source/Scene/NeverTileDiscardPolicy.js b/Source/Scene/NeverTileDiscardPolicy.js index 3bccb7882442..77b6035d8435 100644 --- a/Source/Scene/NeverTileDiscardPolicy.js +++ b/Source/Scene/NeverTileDiscardPolicy.js @@ -19,7 +19,7 @@ NeverTileDiscardPolicy.prototype.isReady = function () { /** * Given a tile image, decide whether to discard that image. * - * @param {Image} image An image to test. + * @param {HTMLImageElement} image An image to test. * @returns {Boolean} True if the image should be discarded; otherwise, false. */ NeverTileDiscardPolicy.prototype.shouldDiscardImage = function (image) { diff --git a/Source/Scene/OctahedralProjectedCubeMap.js b/Source/Scene/OctahedralProjectedCubeMap.js index 1a3f753e7b32..1de61027cc73 100644 --- a/Source/Scene/OctahedralProjectedCubeMap.js +++ b/Source/Scene/OctahedralProjectedCubeMap.js @@ -93,7 +93,7 @@ Object.defineProperties(OctahedralProjectedCubeMap.prototype, { /** * Gets a promise that resolves when the texture atlas is ready to use. * @memberof OctahedralProjectedCubeMap.prototype - * @type {Promise} + * @type {Promise} * @readonly */ readyPromise: { diff --git a/Source/Scene/OpenStreetMapImageryProvider.js b/Source/Scene/OpenStreetMapImageryProvider.js index 7f869ee5cae4..f5ca4bbdbf5a 100644 --- a/Source/Scene/OpenStreetMapImageryProvider.js +++ b/Source/Scene/OpenStreetMapImageryProvider.js @@ -11,6 +11,20 @@ var defaultCredit = new Credit( "MapQuest, Open Street Map and contributors, CC-BY-SA" ); +/** + * @typedef {Object} OpenStreetMapImageryProvider.ConstructorOptions + * + * Initialization options for the OpenStreetMapImageryProvider constructor + * + * @property {String} [url='https://a.tile.openstreetmap.org'] The OpenStreetMap server url. + * @property {String} [fileExtension='png'] The file extension for images on the server. + * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle of the layer. + * @property {Number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. + * @property {Number} [maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + * @property {Credit|String} [credit='MapQuest, Open Street Map and contributors, CC-BY-SA'] A credit for the data source, which is displayed on the canvas. + */ + /** * An imagery provider that provides tiled imagery hosted by OpenStreetMap * or another provider of Slippy tiles. The default url connects to OpenStreetMap's volunteer-run @@ -19,17 +33,9 @@ var defaultCredit = new Credit( * * @alias OpenStreetMapImageryProvider * @constructor + * @extends UrlTemplateImageryProvider * - * @param {Object} [options] Object with the following properties: - * @param {String} [options.url='https://a.tile.openstreetmap.org'] The OpenStreetMap server url. - * @param {String} [options.fileExtension='png'] The file extension for images on the server. - * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle of the layer. - * @param {Number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. - * @param {Number} [options.maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. - * @param {Credit|String} [options.credit='MapQuest, Open Street Map and contributors, CC-BY-SA'] A credit for the data source, which is displayed on the canvas. - * @returns {UrlTemplateImageryProvider} The imagery provider. - * + * @param {OpenStreetMapImageryProvider.ConstructorOptions} options Object describing initialization options * @exception {DeveloperError} The rectangle and minimumLevel indicate that there are more than four tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported. * * @see ArcGisMapServerImageryProvider @@ -41,7 +47,6 @@ var defaultCredit = new Credit( * @see WebMapTileServiceImageryProvider * @see UrlTemplateImageryProvider * - * * @example * var osm = new Cesium.OpenStreetMapImageryProvider({ * url : 'https://a.tile.openstreetmap.org/' diff --git a/Source/Scene/ParticleSystem.js b/Source/Scene/ParticleSystem.js index d18aff1c3a19..5169caa227f6 100644 --- a/Source/Scene/ParticleSystem.js +++ b/Source/Scene/ParticleSystem.js @@ -23,7 +23,7 @@ var defaultImageSize = new Cartesian2(1.0, 1.0); * * @param {Object} [options] Object with the following properties: * @param {Boolean} [options.show=true] Whether to display the particle system. - * @param {ParticleSystem~updateCallback} [options.updateCallback] The callback function to be called each frame to update a particle. + * @param {ParticleSystem.updateCallback} [options.updateCallback] The callback function to be called each frame to update a particle. * @param {ParticleEmitter} [options.emitter=new CircleEmitter(0.5)] The particle emitter for this system. * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The 4x4 transformation matrix that transforms the particle system from model to world coordinates. * @param {Matrix4} [options.emitterModelMatrix=Matrix4.IDENTITY] The 4x4 transformation matrix that transforms the particle system emitter within the particle systems local coordinate system. @@ -67,7 +67,7 @@ function ParticleSystem(options) { /** * An array of force callbacks. The callback is passed a {@link Particle} and the difference from the last time - * @type {ParticleSystem~updateCallback} + * @type {ParticleSystem.updateCallback} * @default undefined */ this.updateCallback = options.updateCallback; @@ -894,7 +894,7 @@ ParticleSystem.prototype.destroy = function () { * A function used to modify attributes of the particle at each time step. This can include force modifications, * color, sizing, etc. * - * @callback ParticleSystem~updateCallback + * @callback ParticleSystem.updateCallback * * @param {Particle} particle The particle being updated. * @param {Number} dt The time in seconds since the last update. diff --git a/Source/Scene/PerInstanceColorAppearance.js b/Source/Scene/PerInstanceColorAppearance.js index bcc1d7eb9f45..79fc05bceea8 100644 --- a/Source/Scene/PerInstanceColorAppearance.js +++ b/Source/Scene/PerInstanceColorAppearance.js @@ -21,7 +21,7 @@ import Appearance from "./Appearance.js"; * @param {Boolean} [options.closed=false] When true, the geometry is expected to be closed so {@link PerInstanceColorAppearance#renderState} has backface culling enabled. * @param {String} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader. * @param {String} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader. - * @param {RenderState} [options.renderState] Optional render state to override the default render state. + * @param {Object} [options.renderState] Optional render state to override the default render state. * * @example * // A solid white line segment diff --git a/Source/Scene/PointCloud.js b/Source/Scene/PointCloud.js index 0193c2d79444..cf49e1a873d0 100644 --- a/Source/Scene/PointCloud.js +++ b/Source/Scene/PointCloud.js @@ -3,6 +3,7 @@ import BoundingSphere from "../Core/BoundingSphere.js"; import Cartesian3 from "../Core/Cartesian3.js"; import Cartesian4 from "../Core/Cartesian4.js"; import Check from "../Core/Check.js"; +import clone from "../Core/clone.js"; import Color from "../Core/Color.js"; import combine from "../Core/combine.js"; import ComponentDatatype from "../Core/ComponentDatatype.js"; @@ -972,16 +973,27 @@ function createUniformMap(pointCloud, frameState) { pointCloud._drawCommand.uniformMap = uniformMap; } -var defaultProperties = ["POSITION", "COLOR", "NORMAL", "POSITION_ABSOLUTE"]; +function getStyleablePropertyIds(source, propertyIds) { + // Get all the property IDs used by this style + var regex = /czm_3dtiles_property_(\d+)/g; + var matches = regex.exec(source); + while (matches !== null) { + var id = parseInt(matches[1]); + if (propertyIds.indexOf(id) === -1) { + propertyIds.push(id); + } + matches = regex.exec(source); + } +} -function getStyleableProperties(source, properties) { - // Get all the properties used by this style - var regex = /czm_tiles3d_style_(\w+)/g; +function getBuiltinPropertyNames(source, propertyNames) { + // Get all the builtin property names used by this style + var regex = /czm_3dtiles_builtin_property_(\w+)/g; var matches = regex.exec(source); while (matches !== null) { var name = matches[1]; - if (properties.indexOf(name) === -1) { - properties.push(name); + if (propertyNames.indexOf(name) === -1) { + propertyNames.push(name); } matches = regex.exec(source); } @@ -997,24 +1009,24 @@ function getVertexAttribute(vertexArray, index) { } } -function modifyStyleFunction(source) { - // Replace occurrences of czm_tiles3d_style_DEFAULTPROPERTY - var length = defaultProperties.length; - for (var i = 0; i < length; ++i) { - var property = defaultProperties[i]; - var styleName = "czm_tiles3d_style_" + property; - var replaceName = property.toLowerCase(); - source = source.replace( - new RegExp(styleName + "(\\W)", "g"), - replaceName + "$1" - ); - } +var builtinPropertyNameMap = { + POSITION: "czm_3dtiles_builtin_property_POSITION", + POSITION_ABSOLUTE: "czm_3dtiles_builtin_property_POSITION_ABSOLUTE", + COLOR: "czm_3dtiles_builtin_property_COLOR", + NORMAL: "czm_3dtiles_builtin_property_NORMAL", +}; +function modifyStyleFunction(source) { // Edit the function header to accept the point position, color, and normal - return source.replace( - "()", - "(vec3 position, vec3 position_absolute, vec4 color, vec3 normal)" - ); + var functionHeader = + "(" + + "vec3 czm_3dtiles_builtin_property_POSITION, " + + "vec3 czm_3dtiles_builtin_property_POSITION_ABSOLUTE, " + + "vec4 czm_3dtiles_builtin_property_COLOR, " + + "vec3 czm_3dtiles_builtin_property_NORMAL" + + ")"; + + return source.replace("()", functionHeader); } function createShaders(pointCloud, frameState, style) { @@ -1044,23 +1056,34 @@ function createShaders(pointCloud, frameState, style) { var pointSizeStyleFunction; var styleTranslucent = isTranslucent; + var propertyNameMap = clone(builtinPropertyNameMap); + var propertyIdToAttributeMap = {}; + var styleableShaderAttributes = pointCloud._styleableShaderAttributes; + for (name in styleableShaderAttributes) { + if (styleableShaderAttributes.hasOwnProperty(name)) { + attribute = styleableShaderAttributes[name]; + propertyNameMap[name] = "czm_3dtiles_property_" + attribute.location; + propertyIdToAttributeMap[attribute.location] = attribute; + } + } + if (hasStyle) { var shaderState = { translucent: false, }; colorStyleFunction = style.getColorShaderFunction( "getColorFromStyle", - "czm_tiles3d_style_", + propertyNameMap, shaderState ); showStyleFunction = style.getShowShaderFunction( "getShowFromStyle", - "czm_tiles3d_style_", + propertyNameMap, shaderState ); pointSizeStyleFunction = style.getPointSizeShaderFunction( "getPointSizeFromStyle", - "czm_tiles3d_style_", + propertyNameMap, shaderState ); if (defined(colorStyleFunction) && shaderState.translucent) { @@ -1076,28 +1099,27 @@ function createShaders(pointCloud, frameState, style) { var hasClippedContent = pointCloud.isClipped; // Get the properties in use by the style - var styleableProperties = []; + var styleablePropertyIds = []; + var builtinPropertyNames = []; if (hasColorStyle) { - getStyleableProperties(colorStyleFunction, styleableProperties); + getStyleablePropertyIds(colorStyleFunction, styleablePropertyIds); + getBuiltinPropertyNames(colorStyleFunction, builtinPropertyNames); colorStyleFunction = modifyStyleFunction(colorStyleFunction); } if (hasShowStyle) { - getStyleableProperties(showStyleFunction, styleableProperties); + getStyleablePropertyIds(showStyleFunction, styleablePropertyIds); + getBuiltinPropertyNames(showStyleFunction, builtinPropertyNames); showStyleFunction = modifyStyleFunction(showStyleFunction); } if (hasPointSizeStyle) { - getStyleableProperties(pointSizeStyleFunction, styleableProperties); + getStyleablePropertyIds(pointSizeStyleFunction, styleablePropertyIds); + getBuiltinPropertyNames(pointSizeStyleFunction, builtinPropertyNames); pointSizeStyleFunction = modifyStyleFunction(pointSizeStyleFunction); } - var usesColorSemantic = styleableProperties.indexOf("COLOR") >= 0; - var usesNormalSemantic = styleableProperties.indexOf("NORMAL") >= 0; - - // Split default properties from user properties - var userProperties = styleableProperties.filter(function (property) { - return defaultProperties.indexOf(property) === -1; - }); + var usesColorSemantic = builtinPropertyNames.indexOf("COLOR") >= 0; + var usesNormalSemantic = builtinPropertyNames.indexOf("NORMAL") >= 0; if (usesNormalSemantic && !hasNormals) { throw new RuntimeError( @@ -1106,11 +1128,10 @@ function createShaders(pointCloud, frameState, style) { } // Disable vertex attributes that aren't used in the style, enable attributes that are - var styleableShaderAttributes = pointCloud._styleableShaderAttributes; for (name in styleableShaderAttributes) { if (styleableShaderAttributes.hasOwnProperty(name)) { attribute = styleableShaderAttributes[name]; - var enabled = userProperties.indexOf(name) >= 0; + var enabled = styleablePropertyIds.indexOf(attribute.location) >= 0; var vertexAttribute = getVertexAttribute(vertexArray, attribute.location); vertexAttribute.enabled = enabled; } @@ -1146,20 +1167,12 @@ function createShaders(pointCloud, frameState, style) { var attributeDeclarations = ""; - var length = userProperties.length; + var length = styleablePropertyIds.length; for (i = 0; i < length; ++i) { - name = userProperties[i]; - attribute = styleableShaderAttributes[name]; - if (!defined(attribute)) { - throw new RuntimeError( - 'Style references a property "' + - name + - '" that does not exist or is not styleable.' - ); - } - + var propertyId = styleablePropertyIds[i]; + attribute = propertyIdToAttributeMap[propertyId]; var componentCount = attribute.componentCount; - var attributeName = "czm_tiles3d_style_" + name; + var attributeName = "czm_3dtiles_property_" + propertyId; var attributeType; if (componentCount === 1) { attributeType = "float"; diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js index 56b88ac1ffeb..50ec733be009 100644 --- a/Source/Scene/PointCloud3DTileContent.js +++ b/Source/Scene/PointCloud3DTileContent.js @@ -40,10 +40,6 @@ function PointCloud3DTileContent( this._batchTable = undefined; // Used when feature table contains BATCH_ID semantic this._styleDirty = false; this._features = undefined; - - /** - * @inheritdoc Cesium3DTileContent#featurePropertiesDirty - */ this.featurePropertiesDirty = false; this._pointCloud = new PointCloud({ diff --git a/Source/Scene/PointPrimitive.js b/Source/Scene/PointPrimitive.js index 767b7c1b8caf..d69b11290147 100644 --- a/Source/Scene/PointPrimitive.js +++ b/Source/Scene/PointPrimitive.js @@ -194,7 +194,7 @@ Object.defineProperties(PointPrimitive.prototype, { /** * Gets or sets near and far scaling properties of a point based on the point's distance from the camera. * A point's scale will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the point's scale remains clamped to the nearest bound. This scale * multiplies the pixelSize and outlineWidth to affect the total size of the point. If undefined, @@ -238,7 +238,7 @@ Object.defineProperties(PointPrimitive.prototype, { /** * Gets or sets near and far translucency properties of a point based on the point's distance from the camera. * A point's translucency will interpolate between the {@link NearFarScalar#nearValue} and - * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds + * {@link NearFarScalar#farValue} while the camera distance falls within the lower and upper bounds * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}. * Outside of these ranges the point's translucency remains clamped to the nearest bound. If undefined, * translucencyByDistance will be disabled. diff --git a/Source/Scene/Polyline.js b/Source/Scene/Polyline.js index e37a0323b6be..bbc4a6d1d82a 100644 --- a/Source/Scene/Polyline.js +++ b/Source/Scene/Polyline.js @@ -17,7 +17,7 @@ import Material from "./Material.js"; * @internalConstructor * @class * - * @param {Object} [options] Object with the following properties: + * @param {Object} options Object with the following properties: * @param {Boolean} [options.show=true] true if this polyline will be shown; otherwise, false. * @param {Number} [options.width=1.0] The width of the polyline in pixels. * @param {Boolean} [options.loop=false] Whether a line segment will be added between the last and first line positions to make this line a loop. diff --git a/Source/Scene/PolylineColorAppearance.js b/Source/Scene/PolylineColorAppearance.js index aaf4c4b8ed41..f5055d3b469c 100644 --- a/Source/Scene/PolylineColorAppearance.js +++ b/Source/Scene/PolylineColorAppearance.js @@ -28,7 +28,7 @@ if (!FeatureDetection.isInternetExplorer()) { * @param {Boolean} [options.translucent=true] When true, the geometry is expected to appear translucent so {@link PolylineColorAppearance#renderState} has alpha blending enabled. * @param {String} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader. * @param {String} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader. - * @param {RenderState} [options.renderState] Optional render state to override the default render state. + * @param {Object} [options.renderState] Optional render state to override the default render state. * * @example * // A solid white line segment diff --git a/Source/Scene/PolylineMaterialAppearance.js b/Source/Scene/PolylineMaterialAppearance.js index ca2afd643a56..da555d65deb7 100644 --- a/Source/Scene/PolylineMaterialAppearance.js +++ b/Source/Scene/PolylineMaterialAppearance.js @@ -28,7 +28,7 @@ if (!FeatureDetection.isInternetExplorer()) { * @param {Material} [options.material=Material.ColorType] The material used to determine the fragment color. * @param {String} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader. * @param {String} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader. - * @param {RenderState} [options.renderState] Optional render state to override the default render state. + * @param {Object} [options.renderState] Optional render state to override the default render state. * * @see {@link https://github.com/CesiumGS/cesium/wiki/Fabric|Fabric} * diff --git a/Source/Scene/PostProcessStageLibrary.js b/Source/Scene/PostProcessStageLibrary.js index 3b779589bfd7..a455f76f25d6 100644 --- a/Source/Scene/PostProcessStageLibrary.js +++ b/Source/Scene/PostProcessStageLibrary.js @@ -30,7 +30,7 @@ import PostProcessStageSampleMode from "./PostProcessStageSampleMode.js"; /** * Contains functions for creating common post-process stages. * - * @exports PostProcessStageLibrary + * @namespace PostProcessStageLibrary */ var PostProcessStageLibrary = {}; diff --git a/Source/Scene/PostProcessStageSampleMode.js b/Source/Scene/PostProcessStageSampleMode.js index 2518c57e2aab..32caaf7bb475 100644 --- a/Source/Scene/PostProcessStageSampleMode.js +++ b/Source/Scene/PostProcessStageSampleMode.js @@ -1,7 +1,7 @@ /** * Determines how input texture to a {@link PostProcessStage} is sampled. * - * @exports PostProcessStageSampleMode + * @enum {Number} */ var PostProcessStageSampleMode = { /** diff --git a/Source/Scene/Primitive.js b/Source/Scene/Primitive.js index 16ce0c782d51..465362ea8836 100644 --- a/Source/Scene/Primitive.js +++ b/Source/Scene/Primitive.js @@ -1132,17 +1132,10 @@ function depthClampVS(vertexShaderSource) { vertexShaderSource, "czm_non_depth_clamp_main" ); - // The varying should be surround by #ifdef GL_EXT_frag_depth as an optimization. - // It is not to workaround an issue with Edge: - // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12120362/ modifiedVS += - "varying float v_WindowZ;\n" + "void main() {\n" + " czm_non_depth_clamp_main();\n" + - " vec4 position = gl_Position;\n" + - " v_WindowZ = (0.5 * (position.z / position.w) + 0.5) * position.w;\n" + - " position.z = min(position.z, position.w);\n" + - " gl_Position = position;\n" + + " gl_Position = czm_depthClamp(gl_Position);" + "}\n"; return modifiedVS; } @@ -1153,14 +1146,13 @@ function depthClampFS(fragmentShaderSource) { "czm_non_depth_clamp_main" ); modifiedFS += - "varying float v_WindowZ;\n" + "void main() {\n" + " czm_non_depth_clamp_main();\n" + "#if defined(GL_EXT_frag_depth)\n" + " #if defined(LOG_DEPTH)\n" + " czm_writeLogDepth();\n" + " #else\n" + - " gl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0);\n" + + " czm_writeDepthClamp();\n" + " #endif\n" + "#endif\n" + "}\n"; diff --git a/Source/Scene/QuadtreeTileLoadState.js b/Source/Scene/QuadtreeTileLoadState.js index dfce7d7b0328..e09deeeabd8a 100644 --- a/Source/Scene/QuadtreeTileLoadState.js +++ b/Source/Scene/QuadtreeTileLoadState.js @@ -1,6 +1,6 @@ /** * The state of a {@link QuadtreeTile} in the tile load pipeline. - * @exports QuadtreeTileLoadState + * @enum {Number} * @private */ var QuadtreeTileLoadState = { diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index ef5396234f48..43b2db6e23fa 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -51,6 +51,7 @@ import DeviceOrientationCameraController from "./DeviceOrientationCameraControll import Fog from "./Fog.js"; import FrameState from "./FrameState.js"; import GlobeDepth from "./GlobeDepth.js"; +import GlobeTranslucencyState from "./GlobeTranslucencyState.js"; import InvertClassification from "./InvertClassification.js"; import JobScheduler from "./JobScheduler.js"; import MapMode2D from "./MapMode2D.js"; @@ -125,7 +126,7 @@ var requestRenderAfterFrame = function (scene) { * @constructor * * @param {Object} [options] Object with the following properties: - * @param {Canvas} options.canvas The HTML canvas element to create the scene for. + * @param {HTMLCanvasElement} options.canvas The HTML canvas element to create the scene for. * @param {Object} [options.contextOptions] Context and WebGL creation properties. See details above. * @param {Element} [options.creditContainer] The HTML element in which the credits will be displayed. * @param {Element} [options.creditViewport] The HTML element in which to display the credit popup. If not specified, the viewport will be a added as a sibling of the canvas. @@ -206,9 +207,13 @@ function Scene(options) { this._context = context; this._computeEngine = new ComputeEngine(context); this._globe = undefined; + this._globeTranslucencyState = new GlobeTranslucencyState(); this._primitives = new PrimitiveCollection(); this._groundPrimitives = new PrimitiveCollection(); + this._globeHeight = undefined; + this._cameraUnderground = false; + this._logDepthBuffer = context.fragmentDepth; this._logDepthBufferDirty = true; @@ -785,7 +790,7 @@ Object.defineProperties(Scene.prototype, { * Gets the canvas element to which this scene is bound. * @memberof Scene.prototype * - * @type {Canvas} + * @type {HTMLCanvasElement} * @readonly */ canvas: { @@ -1647,6 +1652,15 @@ Object.defineProperties(Scene.prototype, { return 0.9999; }, }, + + /** + * @private + */ + globeHeight: { + get: function () { + return this._globeHeight; + }, + }, }); /** @@ -1831,7 +1845,8 @@ function getOccluder(scene) { scene._mode === SceneMode.SCENE3D && defined(globe) && globe.show && - !scene._cameraUnderground + !scene._cameraUnderground && + !scene._globeTranslucencyState.translucent ) { var ellipsoid = globe.ellipsoid; var minimumTerrainHeight = scene.frameState.minimumTerrainHeight; @@ -1898,6 +1913,7 @@ Scene.prototype.updateFrameState = function () { ); frameState.light = this.light; frameState.cameraUnderground = this._cameraUnderground; + frameState.globeTranslucencyState = this._globeTranslucencyState; if ( defined(this._specularEnvironmentMapAtlas) && @@ -2220,6 +2236,7 @@ function executeCommand(command, scene, context, passState, debugFramebuffer) { var passes = frameState.passes; if ( !passes.pick && + !passes.depth && scene._hdr && defined(command.derivedCommands) && defined(command.derivedCommands.hdr) @@ -2369,6 +2386,7 @@ var scratchOrthographicOffCenterFrustum = new OrthographicOffCenterFrustum(); function executeCommands(scene, passState) { var camera = scene.camera; var context = scene.context; + var frameState = scene.frameState; var us = context.uniformState; us.updateCamera(camera); @@ -2392,7 +2410,7 @@ function executeCommands(scene, passState) { us.updateFrustum(frustum); us.updatePass(Pass.ENVIRONMENT); - var passes = scene._frameState.passes; + var passes = frameState.passes; var picking = passes.pick; var environmentState = scene._environmentState; var view = scene._view; @@ -2471,6 +2489,9 @@ function executeCommands(scene, passState) { var clearGlobeDepth = environmentState.clearGlobeDepth; var useDepthPlane = environmentState.useDepthPlane; + var globeTranslucencyState = scene._globeTranslucencyState; + var globeTranslucent = globeTranslucencyState.translucent; + var globeTranslucencyFramebuffer = scene._view.globeTranslucencyFramebuffer; var separatePrimitiveFramebuffer = (environmentState.separatePrimitiveFramebuffer = false); var clearDepth = scene._depthClearCommand; var clearStencil = scene._stencilClearCommand; @@ -2492,7 +2513,7 @@ function executeCommands(scene, passState) { camera.position.z = height2D - frustumCommands.near + 1.0; frustum.far = Math.max(1.0, frustumCommands.far - frustumCommands.near); frustum.near = 1.0; - us.update(scene.frameState); + us.update(frameState); us.updateFrustum(frustum); } else { // Avoid tearing artifacts between adjacent frustums in the opaque passes @@ -2540,8 +2561,19 @@ function executeCommands(scene, passState) { us.updatePass(Pass.GLOBE); var commands = frustumCommands.commands[Pass.GLOBE]; var length = frustumCommands.indices[Pass.GLOBE]; - for (j = 0; j < length; ++j) { - executeCommand(commands[j], scene, context, passState); + + if (globeTranslucent) { + globeTranslucencyState.executeGlobeCommands( + frustumCommands, + executeCommand, + globeTranslucencyFramebuffer, + scene, + passState + ); + } else { + for (j = 0; j < length; ++j) { + executeCommand(commands[j], scene, context, passState); + } } if (defined(globeDepth) && environmentState.useGlobeDepthFramebuffer) { @@ -2557,11 +2589,24 @@ function executeCommands(scene, passState) { } // Draw terrain classification - us.updatePass(Pass.TERRAIN_CLASSIFICATION); - commands = frustumCommands.commands[Pass.TERRAIN_CLASSIFICATION]; - length = frustumCommands.indices[Pass.TERRAIN_CLASSIFICATION]; - for (j = 0; j < length; ++j) { - executeCommand(commands[j], scene, context, passState); + if (!environmentState.renderTranslucentDepthForPick) { + us.updatePass(Pass.TERRAIN_CLASSIFICATION); + commands = frustumCommands.commands[Pass.TERRAIN_CLASSIFICATION]; + length = frustumCommands.indices[Pass.TERRAIN_CLASSIFICATION]; + + if (globeTranslucent) { + globeTranslucencyState.executeGlobeClassificationCommands( + frustumCommands, + executeCommand, + globeTranslucencyFramebuffer, + scene, + passState + ); + } else { + for (j = 0; j < length; ++j) { + executeCommand(commands[j], scene, context, passState); + } + } } if (clearGlobeDepth) { @@ -2576,7 +2621,11 @@ function executeCommands(scene, passState) { passState.framebuffer = globeDepth.primitiveFramebuffer; } - if (!environmentState.useInvertClassification || picking) { + if ( + !environmentState.useInvertClassification || + picking || + environmentState.renderTranslucentDepthForPick + ) { // Common/fastest path. Draw 3D Tiles and classification normally. // Draw 3D Tiles @@ -2593,11 +2642,14 @@ function executeCommands(scene, passState) { } // Draw classifications. Modifies 3D Tiles color. - us.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION); - commands = frustumCommands.commands[Pass.CESIUM_3D_TILE_CLASSIFICATION]; - length = frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION]; - for (j = 0; j < length; ++j) { - executeCommand(commands[j], scene, context, passState); + if (!environmentState.renderTranslucentDepthForPick) { + us.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION); + commands = + frustumCommands.commands[Pass.CESIUM_3D_TILE_CLASSIFICATION]; + length = frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION]; + for (j = 0; j < length; ++j) { + executeCommand(commands[j], scene, context, passState); + } } } } else { @@ -2666,7 +2718,7 @@ function executeCommands(scene, passState) { // Fullscreen pass to copy classified fragments scene._invertClassification.executeClassified(context, passState); - if (scene.frameState.invertClassificationColor.alpha === 1.0) { + if (frameState.invertClassificationColor.alpha === 1.0) { // Fullscreen pass to copy unclassified fragments when alpha == 1.0 scene._invertClassification.executeUnclassified(context, passState); } @@ -2706,7 +2758,7 @@ function executeCommands(scene, passState) { if ( !picking && environmentState.useInvertClassification && - scene.frameState.invertClassificationColor.alpha < 1.0 + frameState.invertClassificationColor.alpha < 1.0 ) { // Fullscreen pass to copy unclassified fragments when alpha < 1.0. // Not executed when undefined. @@ -2767,8 +2819,19 @@ function executeCommands(scene, passState) { us.updatePass(Pass.GLOBE); commands = frustumCommands.commands[Pass.GLOBE]; length = frustumCommands.indices[Pass.GLOBE]; - for (j = 0; j < length; ++j) { - executeIdCommand(commands[j], scene, context, passState); + + if (globeTranslucent) { + globeTranslucencyState.executeGlobeCommands( + frustumCommands, + executeIdCommand, + globeTranslucencyFramebuffer, + scene, + passState + ); + } else { + for (j = 0; j < length; ++j) { + executeIdCommand(commands[j], scene, context, passState); + } } if (clearGlobeDepth) { @@ -3239,12 +3302,13 @@ Scene.prototype.updateEnvironment = function () { var offscreenPass = frameState.passes.offscreen; var skyAtmosphere = this.skyAtmosphere; var globe = this.globe; + var globeTranslucencyState = this._globeTranslucencyState; if ( !renderPass || (this._mode !== SceneMode.SCENE2D && view.camera.frustum instanceof OrthographicFrustum) || - this._cameraUnderground + !globeTranslucencyState.environmentVisible ) { environmentState.skyAtmosphereCommand = undefined; environmentState.skyBoxCommand = undefined; @@ -3262,7 +3326,10 @@ Scene.prototype.updateEnvironment = function () { environmentState.isReadyForAtmosphere || globe._surface._tilesToRender.length > 0; } - environmentState.skyAtmosphereCommand = skyAtmosphere.update(frameState); + environmentState.skyAtmosphereCommand = skyAtmosphere.update( + frameState, + globe + ); if (defined(environmentState.skyAtmosphereCommand)) { this.updateDerivedCommands(environmentState.skyAtmosphereCommand); } @@ -3289,11 +3356,12 @@ Scene.prototype.updateEnvironment = function () { var clearGlobeDepth = (environmentState.clearGlobeDepth = defined(globe) && + globe.show && (!globe.depthTestAgainstTerrain || this.mode === SceneMode.SCENE2D)); var useDepthPlane = (environmentState.useDepthPlane = clearGlobeDepth && this.mode === SceneMode.SCENE3D && - !this._cameraUnderground); + globeTranslucencyState.useDepthPlane); if (useDepthPlane) { // Update the depth plane that is rendered in 3D when the primitives are // not depth tested against terrain so primitives on the backface @@ -3306,7 +3374,10 @@ Scene.prototype.updateEnvironment = function () { this._useWebVR && this.mode !== SceneMode.SCENE2D && !offscreenPass; var occluder = - frameState.mode === SceneMode.SCENE3D ? frameState.occluder : undefined; + frameState.mode === SceneMode.SCENE3D && + !globeTranslucencyState.sunVisibleThroughGlobe + ? frameState.occluder + : undefined; var cullingVolume = frameState.cullingVolume; // get user culling volume minus the far plane. @@ -3356,6 +3427,7 @@ function updateDebugFrustumPlanes(scene) { scene._debugFrustumPlanes = new DebugCameraPrimitive({ camera: scene.camera, updateOnChange: false, + frustumSplits: frameState.frustumSplits, }); } else { scene._debugFrustumPlanes = @@ -3552,6 +3624,15 @@ function updateAndClearFramebuffers(scene, passState, clearColor) { environmentState.useInvertClassification = false; } } + + if (scene._globeTranslucencyState.translucent) { + view.globeTranslucencyFramebuffer.updateAndClear( + scene._hdr, + view.viewport, + context, + passState + ); + } } /** @@ -3632,6 +3713,16 @@ function callAfterRenderFunctions(scene) { functions.length = 0; } +function getGlobeHeight(scene) { + var globe = scene._globe; + var camera = scene.camera; + var cartographic = camera.positionCartographic; + if (defined(globe) && globe.show && defined(cartographic)) { + return globe.getHeight(cartographic); + } + return undefined; +} + function isCameraUnderground(scene) { var camera = scene.camera; var mode = scene._mode; @@ -3639,6 +3730,10 @@ function isCameraUnderground(scene) { var cameraController = scene._screenSpaceCameraController; var cartographic = camera.positionCartographic; + if (!defined(cartographic)) { + return false; + } + if (!cameraController.onMap() && cartographic.height < 0.0) { // The camera can go off the map while in Columbus View. // Make a best guess as to whether it's underground by checking if its height is less than zero. @@ -3654,17 +3749,8 @@ function isCameraUnderground(scene) { return false; } - if (cameraController.adjustedHeightForTerrain()) { - // The camera controller already adjusted the camera, no need to call globe.getHeight again - return false; - } - - var globeHeight = globe.getHeight(cartographic); - if (defined(globeHeight) && cartographic.height < globeHeight) { - return true; - } - - return false; + var globeHeight = scene._globeHeight; + return defined(globeHeight) && cartographic.height < globeHeight; } /** @@ -3680,6 +3766,10 @@ Scene.prototype.initializeFrame = function () { this._tweens.update(); + this._globeHeight = getGlobeHeight(this); + this._cameraUnderground = isCameraUnderground(this); + this._globeTranslucencyState.update(this); + this._screenSpaceCameraController.update(); if (defined(this._deviceOrientationCameraController)) { this._deviceOrientationCameraController.update(); @@ -3687,8 +3777,6 @@ Scene.prototype.initializeFrame = function () { this.camera.update(this._mode); this.camera._updateCameraChanged(); - - this._cameraUnderground = isCameraUnderground(this); }; function updateDebugShowFramesPerSecond(scene, renderedThisFrame) { @@ -3834,10 +3922,9 @@ function updateMostDetailedRayPicks(scene) { } /** - * Update and render the scene. + * Update and render the scene. It is usually not necessary to call this function + * directly because {@link CesiumWidget} or {@link Viewer} do it automatically. * @param {JulianDate} [time] The simulation time at which to render. - * - * @private */ Scene.prototype.render = function (time) { /** @@ -4049,7 +4136,7 @@ Scene.prototype.pickPosition = function (windowPosition, result) { * @param {Number} [limit] If supplied, stop drilling after collecting this many picks. * @param {Number} [width=3] Width of the pick rectangle. * @param {Number} [height=3] Height of the pick rectangle. - * @returns {Object[]} Array of objects, each containing 1 picked primitives. + * @returns {Array.<*>} Array of objects, each containing 1 picked primitives. * * @exception {DeveloperError} windowPosition is undefined. * diff --git a/Source/Scene/SceneMode.js b/Source/Scene/SceneMode.js index 14858ffd8604..a9eabb4caae0 100644 --- a/Source/Scene/SceneMode.js +++ b/Source/Scene/SceneMode.js @@ -1,8 +1,7 @@ /** * Indicates if the scene is viewed in 3D, 2D, or 2.5D Columbus view. * - * @exports SceneMode - * + * @enum {Number} * @see Scene#mode */ var SceneMode = { diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index 5db365f69572..d6eee52df206 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -15,7 +15,7 @@ import SceneMode from "./SceneMode.js"; /** * Functions that do scene-dependent transforms between rendering-related coordinate systems. * - * @exports SceneTransforms + * @namespace SceneTransforms */ var SceneTransforms = {}; diff --git a/Source/Scene/SceneTransitioner.js b/Source/Scene/SceneTransitioner.js index fbb892b6a683..d2789fd815c7 100644 --- a/Source/Scene/SceneTransitioner.js +++ b/Source/Scene/SceneTransitioner.js @@ -644,6 +644,7 @@ function morphFromColumbusViewTo2D(transitioner, duration) { var pickPos = globe.pickWorldCoordinates( ray, scene, + true, scratchCVTo2DPickPos ); if (defined(pickPos)) { @@ -773,6 +774,7 @@ function morphFrom3DTo2D(transitioner, duration, ellipsoid) { var pickedPos = globe.pickWorldCoordinates( ray, scene, + true, scratch3DTo2DPickPosition ); if (defined(pickedPos)) { diff --git a/Source/Scene/ScreenSpaceCameraController.js b/Source/Scene/ScreenSpaceCameraController.js index 92e50e9eac8a..9866dde783a2 100644 --- a/Source/Scene/ScreenSpaceCameraController.js +++ b/Source/Scene/ScreenSpaceCameraController.js @@ -231,7 +231,7 @@ function ScreenSpaceCameraController(scene) { this._minimumCollisionTerrainHeight = this.minimumCollisionTerrainHeight; /** * The minimum height the camera must be before switching from rotating a track ball to - * free look when clicks originate on the sky on in space. + * free look when clicks originate on the sky or in space. * @type {Number} * @default 7500000.0 */ @@ -255,6 +255,20 @@ function ScreenSpaceCameraController(scene) { this._lastInertiaTranslateMovement = undefined; this._lastInertiaTiltMovement = undefined; + // Zoom disables tilt, spin, and translate inertia + // Tilt disables spin and translate inertia + this._inertiaDisablers = { + _lastInertiaZoomMovement: [ + "_lastInertiaSpinMovement", + "_lastInertiaTranslateMovement", + "_lastInertiaTiltMovement", + ], + _lastInertiaTiltMovement: [ + "_lastInertiaSpinMovement", + "_lastInertiaTranslateMovement", + ], + }; + this._tweens = new TweenCollection(); this._tween = undefined; @@ -265,6 +279,8 @@ function ScreenSpaceCameraController(scene) { this._rotateMousePosition = new Cartesian2(-1.0, -1.0); this._rotateStartPosition = new Cartesian3(); this._strafeStartPosition = new Cartesian3(); + this._strafeMousePosition = new Cartesian2(); + this._strafeEndMousePosition = new Cartesian2(); this._zoomMouseStart = new Cartesian2(-1.0, -1.0); this._zoomWorldPosition = new Cartesian3(); this._useZoomWorldPosition = false; @@ -273,8 +289,10 @@ function ScreenSpaceCameraController(scene) { this._rotating = false; this._strafing = false; this._zoomingOnVector = false; + this._zoomingUnderground = false; this._rotatingZoom = false; this._adjustedHeightForTerrain = false; + this._cameraUnderground = false; var projection = scene.mapProjection; this._maxCoord = projection.project( @@ -289,6 +307,8 @@ function ScreenSpaceCameraController(scene) { this._minimumRotateRate = 1.0 / 5000.0; this._minimumZoomRate = 20.0; this._maximumZoomRate = 5906376272000.0; // distance from the Sun to Pluto in meters. + this._minimumUndergroundPickDistance = 2000.0; + this._maximumUndergroundPickDistance = 10000.0; } function decay(time, coefficient) { @@ -329,7 +349,7 @@ function maintainInertia( startPosition: new Cartesian2(), endPosition: new Cartesian2(), motion: new Cartesian2(), - active: false, + inertiaEnabled: true, }; } @@ -343,56 +363,35 @@ function maintainInertia( if (ts && tr && threshold < inertiaMaxClickTimeThreshold) { var d = decay(fromNow, decayCoef); - if (!movementState.active) { - var lastMovement = aggregator.getLastMovement(type, modifier); - if (!defined(lastMovement) || sameMousePosition(lastMovement)) { - return; - } - - movementState.motion.x = - (lastMovement.endPosition.x - lastMovement.startPosition.x) * 0.5; - movementState.motion.y = - (lastMovement.endPosition.y - lastMovement.startPosition.y) * 0.5; - - movementState.startPosition = Cartesian2.clone( - lastMovement.startPosition, - movementState.startPosition - ); - - movementState.endPosition = Cartesian2.multiplyByScalar( - movementState.motion, - d, - movementState.endPosition - ); - movementState.endPosition = Cartesian2.add( - movementState.startPosition, - movementState.endPosition, - movementState.endPosition - ); + var lastMovement = aggregator.getLastMovement(type, modifier); + if ( + !defined(lastMovement) || + sameMousePosition(lastMovement) || + !movementState.inertiaEnabled + ) { + return; + } - movementState.active = true; - } else { - movementState.startPosition = Cartesian2.clone( - movementState.endPosition, - movementState.startPosition - ); + movementState.motion.x = + (lastMovement.endPosition.x - lastMovement.startPosition.x) * 0.5; + movementState.motion.y = + (lastMovement.endPosition.y - lastMovement.startPosition.y) * 0.5; - movementState.endPosition = Cartesian2.multiplyByScalar( - movementState.motion, - d, - movementState.endPosition - ); - movementState.endPosition = Cartesian2.add( - movementState.startPosition, - movementState.endPosition, - movementState.endPosition - ); + movementState.startPosition = Cartesian2.clone( + lastMovement.startPosition, + movementState.startPosition + ); - movementState.motion = Cartesian2.clone( - Cartesian2.ZERO, - movementState.motion - ); - } + movementState.endPosition = Cartesian2.multiplyByScalar( + movementState.motion, + d, + movementState.endPosition + ); + movementState.endPosition = Cartesian2.add( + movementState.startPosition, + movementState.endPosition, + movementState.endPosition + ); // If value from the decreasing exponential function is close to zero, // the end coordinates may be NaN. @@ -404,7 +403,6 @@ function maintainInertia( movementState.endPosition ) < 0.5 ) { - movementState.active = false; return; } @@ -412,8 +410,27 @@ function maintainInertia( var startPosition = aggregator.getStartMousePosition(type, modifier); action(object, startPosition, movementState); } - } else { - movementState.active = false; + } +} + +function activateInertia(controller, inertiaStateName) { + if (defined(inertiaStateName)) { + // Re-enable inertia if it was disabled + var movementState = controller[inertiaStateName]; + if (defined(movementState)) { + movementState.inertiaEnabled = true; + } + // Disable inertia on other movements + var inertiasToDisable = controller._inertiaDisablers[inertiaStateName]; + if (defined(inertiasToDisable)) { + var length = inertiasToDisable.length; + for (var i = 0; i < length; ++i) { + movementState = controller[inertiasToDisable[i]]; + if (defined(movementState)) { + movementState.inertiaEnabled = false; + } + } + } } } @@ -452,6 +469,7 @@ function reactToInput( if (controller.enableInputs && enabled) { if (movement) { action(controller, startPosition, movement); + activateInertia(controller, inertiaStateName); } else if (inertiaConstant < 1.0) { maintainInertia( aggregator, @@ -531,18 +549,24 @@ function handleZoom( rangeWindowRatio = Math.min(rangeWindowRatio, object.maximumMovementRatio); var distance = zoomRate * rangeWindowRatio; - if (distance > 0.0 && Math.abs(distanceMeasure - minHeight) < 1.0) { - return; - } + if ( + object.enableCollisionDetection || + object.minimumZoomDistance === 0.0 || + !defined(object._globe) // look-at mode + ) { + if (distance > 0.0 && Math.abs(distanceMeasure - minHeight) < 1.0) { + return; + } - if (distance < 0.0 && Math.abs(distanceMeasure - maxHeight) < 1.0) { - return; - } + if (distance < 0.0 && Math.abs(distanceMeasure - maxHeight) < 1.0) { + return; + } - if (distanceMeasure - distance < minHeight) { - distance = distanceMeasure - minHeight - 1.0; - } else if (distanceMeasure - distance > maxHeight) { - distance = distanceMeasure - maxHeight; + if (distanceMeasure - distance < minHeight) { + distance = distanceMeasure - minHeight - 1.0; + } else if (distanceMeasure - distance > maxHeight) { + distance = distanceMeasure - maxHeight; + } } var scene = object._scene; @@ -601,6 +625,7 @@ function handleZoom( zoomingOnVector = object._zoomingOnVector = false; rotatingZoom = object._rotatingZoom = false; + object._zoomingUnderground = object._cameraUnderground; } if (!object._useZoomWorldPosition) { @@ -660,8 +685,11 @@ function handleZoom( scratchCameraPositionNormal ); if ( - camera.positionCartographic.height < 3000.0 && - Math.abs(Cartesian3.dot(camera.direction, cameraPositionNormal)) < 0.6 + object._cameraUnderground || + object._zoomingUnderground || + (camera.positionCartographic.height < 3000.0 && + Math.abs(Cartesian3.dot(camera.direction, cameraPositionNormal)) < + 0.6) ) { zoomOnVector = true; } else { @@ -900,7 +928,9 @@ function handleZoom( camera.zoomIn(distance); } - camera.setView(scratchZoomViewOptions); + if (!object._cameraUnderground) { + camera.setView(scratchZoomViewOptions); + } } var translate2DStart = new Ray(); @@ -1070,6 +1100,8 @@ function pickGlobe(controller, mousePosition, result) { return undefined; } + var cullBackFaces = !controller._cameraUnderground; + var depthIntersection; if (scene.pickPositionSupported) { depthIntersection = scene.pickPositionWorldCoordinates( @@ -1082,6 +1114,7 @@ function pickGlobe(controller, mousePosition, result) { var rayIntersection = globe.pickWorldCoordinates( ray, scene, + cullBackFaces, scratchRayIntersection ); @@ -1099,11 +1132,108 @@ function pickGlobe(controller, mousePosition, result) { return Cartesian3.clone(rayIntersection, result); } +var scratchDistanceCartographic = new Cartographic(); + +function getDistanceFromSurface(controller) { + var ellipsoid = controller._ellipsoid; + var scene = controller._scene; + var camera = scene.camera; + var mode = scene.mode; + + var height = 0.0; + if (mode === SceneMode.SCENE3D) { + var cartographic = ellipsoid.cartesianToCartographic( + camera.position, + scratchDistanceCartographic + ); + if (defined(cartographic)) { + height = cartographic.height; + } + } else { + height = camera.position.z; + } + var globeHeight = defaultValue(controller._scene.globeHeight, 0.0); + var distanceFromSurface = Math.abs(globeHeight - height); + return distanceFromSurface; +} + +var scratchSurfaceNormal = new Cartesian3(); + +function getZoomDistanceUnderground(controller, ray) { + var origin = ray.origin; + var direction = ray.direction; + var distanceFromSurface = getDistanceFromSurface(controller); + + // Weight zoom distance based on how strongly the pick ray is pointing inward. + // Geocentric normal is accurate enough for these purposes + var surfaceNormal = Cartesian3.normalize(origin, scratchSurfaceNormal); + var strength = Math.abs(Cartesian3.dot(surfaceNormal, direction)); + strength = Math.max(strength, 0.5) * 2.0; + return distanceFromSurface * strength; +} + +function getTiltCenterUnderground(controller, ray, pickedPosition, result) { + var distance = Cartesian3.distance(ray.origin, pickedPosition); + var distanceFromSurface = getDistanceFromSurface(controller); + + var maximumDistance = CesiumMath.clamp( + distanceFromSurface * 5.0, + controller._minimumUndergroundPickDistance, + controller._maximumUndergroundPickDistance + ); + + if (distance > maximumDistance) { + // Simulate look-at behavior by tilting around a small invisible sphere + distance = Math.min(distance, distanceFromSurface / 5.0); + distance = Math.max(distance, 100.0); + } + + return Ray.getPoint(ray, distance, result); +} + +function getStrafeStartPositionUnderground( + controller, + ray, + pickedPosition, + result +) { + var distance; + if (!defined(pickedPosition)) { + distance = getDistanceFromSurface(controller); + } else { + distance = Cartesian3.distance(ray.origin, pickedPosition); + if (distance > controller._maximumUndergroundPickDistance) { + // If the picked position is too far away set the strafe speed based on the + // camera's height from the globe surface + distance = getDistanceFromSurface(controller); + } + } + + return Ray.getPoint(ray, distance, result); +} + +var scratchInertialDelta = new Cartesian2(); + +function continueStrafing(controller, movement) { + // Update the end position continually based on the inertial delta + var originalEndPosition = movement.endPosition; + var inertialDelta = Cartesian2.subtract( + movement.endPosition, + movement.startPosition, + scratchInertialDelta + ); + var endPosition = controller._strafeEndMousePosition; + Cartesian2.add(endPosition, inertialDelta, endPosition); + movement.endPosition = endPosition; + strafe(controller, movement, controller._strafeStartPosition); + movement.endPosition = originalEndPosition; +} + var translateCVStartRay = new Ray(); var translateCVEndRay = new Ray(); var translateCVStartPos = new Cartesian3(); var translateCVEndPos = new Cartesian3(); -var translatCVDifference = new Cartesian3(); +var translateCVDifference = new Cartesian3(); var translateCVOrigin = new Cartesian3(); var translateCVPlane = new Plane(Cartesian3.UNIT_X, 0.0); var translateCVStartMouse = new Cartesian2(); @@ -1124,12 +1254,13 @@ function translateCV(controller, startPosition, movement) { } if (controller._strafing) { - strafe(controller, startPosition, movement); + continueStrafing(controller, movement); return; } var scene = controller._scene; var camera = scene.camera; + var cameraUnderground = controller._cameraUnderground; var startMouse = Cartesian2.clone( movement.startPosition, translateCVStartMouse @@ -1148,14 +1279,24 @@ function translateCV(controller, startPosition, movement) { } } - if (origin.x > camera.position.z && defined(globePos)) { - Cartesian3.clone(globePos, controller._strafeStartPosition); + if ( + cameraUnderground || + (origin.x > camera.position.z && defined(globePos)) + ) { + var pickPosition = globePos; + if (cameraUnderground) { + pickPosition = getStrafeStartPositionUnderground( + controller, + startRay, + globePos, + translateCVStartPos + ); + } + Cartesian2.clone(startPosition, controller._strafeMousePosition); + Cartesian2.clone(startPosition, controller._strafeEndMousePosition); + Cartesian3.clone(pickPosition, controller._strafeStartPosition); controller._strafing = true; - strafe(controller, startPosition, movement); - controller._strafeMousePosition = Cartesian2.clone( - startPosition, - controller._strafeMousePosition - ); + strafe(controller, movement, controller._strafeStartPosition); return; } @@ -1185,7 +1326,7 @@ function translateCV(controller, startPosition, movement) { var diff = Cartesian3.subtract( startPlanePos, endPlanePos, - translatCVDifference + translateCVDifference ); var temp = diff.x; diff.x = diff.y; @@ -1234,7 +1375,7 @@ function rotateCV(controller, startPosition, movement) { if ( controller._tiltCVOffMap || !controller.onMap() || - camera.position.z > controller._minimumPickingTerrainHeight + Math.abs(camera.position.z) > controller._minimumPickingTerrainHeight ) { controller._tiltCVOffMap = true; rotateCVOnPlane(controller, startPosition, movement); @@ -1309,6 +1450,7 @@ function rotateCVOnPlane(controller, startPosition, movement) { function rotateCVOnTerrain(controller, startPosition, movement) { var scene = controller._scene; var camera = scene.camera; + var cameraUnderground = controller._cameraUnderground; var center; var ray; @@ -1343,6 +1485,13 @@ function rotateCVOnTerrain(controller, startPosition, movement) { Cartesian3.add(position, center, center); } + if (cameraUnderground) { + if (!defined(ray)) { + ray = camera.getPickRay(startPosition, rotateCVWindowRay); + } + getTiltCenterUnderground(controller, ray, center, center); + } + Cartesian2.clone(startPosition, controller._tiltCenterMousePosition); Cartesian3.clone(center, controller._tiltCenter); } @@ -1420,7 +1569,12 @@ function rotateCVOnTerrain(controller, startPosition, movement) { camera._setTransform(verticalTransform); if (dot < 0.0) { - if (movement.startPosition.y > movement.endPosition.y) { + var movementDelta = movement.startPosition.y - movement.endPosition.y; + if ( + (cameraUnderground && movementDelta < 0.0) || + (!cameraUnderground && movementDelta > 0.0) + ) { + // Prevent camera from flipping past the up axis constrainedAxis = undefined; } @@ -1518,23 +1672,48 @@ function zoomCV(controller, startPosition, movement) { var camera = scene.camera; var canvas = scene.canvas; - var windowPosition = zoomCVWindowPos; - windowPosition.x = canvas.clientWidth / 2; - windowPosition.y = canvas.clientHeight / 2; + var cameraUnderground = controller._cameraUnderground; + + var windowPosition; + + if (cameraUnderground) { + windowPosition = startPosition; + } else { + windowPosition = zoomCVWindowPos; + windowPosition.x = canvas.clientWidth / 2; + windowPosition.y = canvas.clientHeight / 2; + } + var ray = camera.getPickRay(windowPosition, zoomCVWindowRay); + var position = ray.origin; + var direction = ray.direction; + var height = camera.position.z; var intersection; - if (camera.position.z < controller._minimumPickingTerrainHeight) { + if (height < controller._minimumPickingTerrainHeight) { intersection = pickGlobe(controller, windowPosition, zoomCVIntersection); } var distance; if (defined(intersection)) { - distance = Cartesian3.distance(ray.origin, intersection); - } else { + distance = Cartesian3.distance(position, intersection); + } + + if (cameraUnderground) { + var distanceUnderground = getZoomDistanceUnderground( + controller, + ray, + height + ); + if (defined(distance)) { + distance = Math.min(distance, distanceUnderground); + } else { + distance = distanceUnderground; + } + } + + if (!defined(distance)) { var normal = Cartesian3.UNIT_X; - var position = ray.origin; - var direction = ray.direction; distance = -Cartesian3.dot(normal, position) / Cartesian3.dot(normal, direction); } @@ -1609,10 +1788,6 @@ function updateCV(controller) { if ( !controller._aggregator.anyButtonDown && - (!defined(controller._lastInertiaZoomMovement) || - !controller._lastInertiaZoomMovement.active) && - (!defined(controller._lastInertiaTranslateMovement) || - !controller._lastInertiaTranslateMovement.active) && !tweens.contains(controller._tween) ) { var tween = camera.createCorrectPositionTween( @@ -1633,21 +1808,11 @@ var scratchStrafeIntersection = new Cartesian3(); var scratchStrafeDirection = new Cartesian3(); var scratchMousePos = new Cartesian3(); -function strafe(controller, startPosition, movement) { +function strafe(controller, movement, strafeStartPosition) { var scene = controller._scene; var camera = scene.camera; - var mouseStartPosition = pickGlobe( - controller, - movement.startPosition, - scratchMousePos - ); - if (!defined(mouseStartPosition)) { - return; - } - - var mousePosition = movement.endPosition; - var ray = camera.getPickRay(mousePosition, scratchStrafeRay); + var ray = camera.getPickRay(movement.endPosition, scratchStrafeRay); var direction = Cartesian3.clone(camera.direction, scratchStrafeDirection); if (scene.mode === SceneMode.COLUMBUS_VIEW) { @@ -1655,7 +1820,7 @@ function strafe(controller, startPosition, movement) { } var plane = Plane.fromPointNormal( - mouseStartPosition, + strafeStartPosition, direction, scratchStrafePlane ); @@ -1668,7 +1833,7 @@ function strafe(controller, startPosition, movement) { return; } - direction = Cartesian3.subtract(mouseStartPosition, intersection, direction); + direction = Cartesian3.subtract(strafeStartPosition, intersection, direction); if (scene.mode === SceneMode.COLUMBUS_VIEW) { Cartesian3.fromElements(direction.y, direction.z, direction.x, direction); } @@ -1681,10 +1846,13 @@ var scratchCartographic = new Cartographic(); var scratchRadii = new Cartesian3(); var scratchEllipsoid = new Ellipsoid(); var scratchLookUp = new Cartesian3(); +var scratchNormal = new Cartesian3(); function spin3D(controller, startPosition, movement) { var scene = controller._scene; var camera = scene.camera; + var cameraUnderground = controller._cameraUnderground; + var ellipsoid = controller._ellipsoid; if (!Matrix4.equals(camera.transform, Matrix4.IDENTITY)) { rotate3D(controller, startPosition, movement); @@ -1693,34 +1861,8 @@ function spin3D(controller, startPosition, movement) { var magnitude; var radii; - var ellipsoid; - var up = controller._ellipsoid.geodeticSurfaceNormal( - camera.position, - scratchLookUp - ); - - var height = controller._ellipsoid.cartesianToCartographic( - camera.positionWC, - scratchCartographic - ).height; - var globe = controller._globe; - - var mousePos; - var tangentPick = false; - if (defined(globe) && height < controller._minimumPickingTerrainHeight) { - mousePos = pickGlobe(controller, movement.startPosition, scratchMousePos); - if (defined(mousePos)) { - var ray = camera.getPickRay(movement.startPosition, pickGlobeScratchRay); - var normal = controller._ellipsoid.geodeticSurfaceNormal(mousePos); - tangentPick = Math.abs(Cartesian3.dot(ray.direction, normal)) < 0.05; - - if (tangentPick && !controller._looking) { - controller._rotating = false; - controller._strafing = true; - } - } - } + var up = ellipsoid.geodeticSurfaceNormal(camera.position, scratchLookUp); if (Cartesian2.equals(startPosition, controller._rotateMousePosition)) { if (controller._looking) { @@ -1728,9 +1870,15 @@ function spin3D(controller, startPosition, movement) { } else if (controller._rotating) { rotate3D(controller, startPosition, movement); } else if (controller._strafing) { - Cartesian3.clone(mousePos, controller._strafeStartPosition); - strafe(controller, startPosition, movement); + continueStrafing(controller, movement); } else { + if ( + Cartesian3.magnitude(camera.position) < + Cartesian3.magnitude(controller._rotateStartPosition) + ) { + // Pan action is no longer valid if camera moves below the pan ellipsoid + return; + } magnitude = Cartesian3.magnitude(controller._rotateStartPosition); radii = scratchRadii; radii.x = radii.y = radii.z = magnitude; @@ -1743,15 +1891,44 @@ function spin3D(controller, startPosition, movement) { controller._rotating = false; controller._strafing = false; + var height = ellipsoid.cartesianToCartographic( + camera.positionWC, + scratchCartographic + ).height; + var globe = controller._globe; + if (defined(globe) && height < controller._minimumPickingTerrainHeight) { + var mousePos = pickGlobe( + controller, + movement.startPosition, + scratchMousePos + ); if (defined(mousePos)) { - if ( - Cartesian3.magnitude(camera.position) < Cartesian3.magnitude(mousePos) - ) { - Cartesian3.clone(mousePos, controller._strafeStartPosition); + var strafing = false; + var ray = camera.getPickRay(movement.startPosition, pickGlobeScratchRay); + + if (cameraUnderground) { + strafing = true; + getStrafeStartPositionUnderground(controller, ray, mousePos, mousePos); + } else { + var normal = ellipsoid.geodeticSurfaceNormal(mousePos, scratchNormal); + var tangentPick = + Math.abs(Cartesian3.dot(ray.direction, normal)) < 0.05; + + if (tangentPick) { + strafing = true; + } else { + strafing = + Cartesian3.magnitude(camera.position) < + Cartesian3.magnitude(mousePos); + } + } + if (strafing) { + Cartesian2.clone(startPosition, controller._strafeEndMousePosition); + Cartesian3.clone(mousePos, controller._strafeStartPosition); controller._strafing = true; - strafe(controller, startPosition, movement); + strafe(controller, movement, controller._strafeStartPosition); } else { magnitude = Cartesian3.magnitude(mousePos); radii = scratchRadii; @@ -1974,9 +2151,18 @@ function zoom3D(controller, startPosition, movement) { var camera = scene.camera; var canvas = scene.canvas; - var windowPosition = zoomCVWindowPos; - windowPosition.x = canvas.clientWidth / 2; - windowPosition.y = canvas.clientHeight / 2; + var cameraUnderground = controller._cameraUnderground; + + var windowPosition; + + if (cameraUnderground) { + windowPosition = startPosition; + } else { + windowPosition = zoomCVWindowPos; + windowPosition.x = canvas.clientWidth / 2; + windowPosition.y = canvas.clientHeight / 2; + } + var ray = camera.getPickRay(windowPosition, zoomCVWindowRay); var intersection; @@ -1991,7 +2177,22 @@ function zoom3D(controller, startPosition, movement) { var distance; if (defined(intersection)) { distance = Cartesian3.distance(ray.origin, intersection); - } else { + } + + if (cameraUnderground) { + var distanceUnderground = getZoomDistanceUnderground( + controller, + ray, + height + ); + if (defined(distance)) { + distance = Math.min(distance, distanceUnderground); + } else { + distance = distanceUnderground; + } + } + + if (!defined(distance)) { distance = height; } @@ -2149,6 +2350,7 @@ function tilt3DOnTerrain(controller, startPosition, movement) { var ellipsoid = controller._ellipsoid; var scene = controller._scene; var camera = scene.camera; + var cameraUnderground = controller._cameraUnderground; var center; var ray; @@ -2181,6 +2383,13 @@ function tilt3DOnTerrain(controller, startPosition, movement) { center = Ray.getPoint(ray, intersection.start, tilt3DCenter); } + if (cameraUnderground) { + if (!defined(ray)) { + ray = camera.getPickRay(startPosition, tilt3DRay); + } + getTiltCenterUnderground(controller, ray, center, center); + } + Cartesian2.clone(startPosition, controller._tiltCenterMousePosition); Cartesian3.clone(center, controller._tiltCenter); } @@ -2242,7 +2451,12 @@ function tilt3DOnTerrain(controller, startPosition, movement) { camera._setTransform(verticalTransform); if (dot < 0.0) { - if (movement.startPosition.y > movement.endPosition.y) { + var movementDelta = movement.startPosition.y - movement.endPosition.y; + if ( + (cameraUnderground && movementDelta < 0.0) || + (!cameraUnderground && movementDelta > 0.0) + ) { + // Prevent camera from flipping past the up axis constrainedAxis = undefined; } @@ -2527,9 +2741,9 @@ function adjustHeightForTerrain(controller) { var heightUpdated = false; if (cartographic.height < controller._minimumCollisionTerrainHeight) { - var height = globe.getHeight(cartographic); - if (defined(height)) { - height += controller.minimumZoomDistance; + var globeHeight = controller._scene.globeHeight; + if (defined(globeHeight)) { + var height = globeHeight + controller.minimumZoomDistance; if (cartographic.height < height) { cartographic.height = height; if (mode === SceneMode.SCENE3D) { @@ -2584,23 +2798,29 @@ var scratchPreviousDirection = new Cartesian3(); * @private */ ScreenSpaceCameraController.prototype.update = function () { - var camera = this._scene.camera; + var scene = this._scene; + var camera = scene.camera; + var globe = scene.globe; + var mode = scene.mode; + if (!Matrix4.equals(camera.transform, Matrix4.IDENTITY)) { this._globe = undefined; this._ellipsoid = Ellipsoid.UNIT_SPHERE; } else { - this._globe = this._scene.globe; + this._globe = globe; this._ellipsoid = defined(this._globe) ? this._globe.ellipsoid - : this._scene.mapProjection.ellipsoid; + : scene.mapProjection.ellipsoid; } + this._cameraUnderground = scene.cameraUnderground && defined(this._globe); + this._minimumCollisionTerrainHeight = - this.minimumCollisionTerrainHeight * this._scene.terrainExaggeration; + this.minimumCollisionTerrainHeight * scene.terrainExaggeration; this._minimumPickingTerrainHeight = - this.minimumPickingTerrainHeight * this._scene.terrainExaggeration; + this.minimumPickingTerrainHeight * scene.terrainExaggeration; this._minimumTrackBallHeight = - this.minimumTrackBallHeight * this._scene.terrainExaggeration; + this.minimumTrackBallHeight * scene.terrainExaggeration; var radius = this._ellipsoid.maximumRadius; this._rotateFactor = 1.0 / radius; @@ -2616,8 +2836,6 @@ ScreenSpaceCameraController.prototype.update = function () { scratchPreviousDirection ); - var scene = this._scene; - var mode = scene.mode; if (mode === SceneMode.SCENE2D) { update2D(this); } else if (mode === SceneMode.COLUMBUS_VIEW) { @@ -2629,7 +2847,7 @@ ScreenSpaceCameraController.prototype.update = function () { } if (this.enableCollisionDetection && !this._adjustedHeightForTerrain) { - // Adjust the camera height if the camera moved at all (user input or intertia) and an action didn't already adjust the camera height + // Adjust the camera height if the camera moved at all (user input or inertia) and an action didn't already adjust the camera height var cameraChanged = !Cartesian3.equals(previousPosition, camera.positionWC) || !Cartesian3.equals(previousDirection, camera.directionWC); @@ -2641,13 +2859,6 @@ ScreenSpaceCameraController.prototype.update = function () { this._aggregator.reset(); }; -/** - * @private - */ -ScreenSpaceCameraController.prototype.adjustedHeightForTerrain = function () { - return this._adjustedHeightForTerrain; -}; - /** * Returns true if this object was destroyed; otherwise, false. *

diff --git a/Source/Scene/ShadowMode.js b/Source/Scene/ShadowMode.js index c8a326643949..95e49b843912 100644 --- a/Source/Scene/ShadowMode.js +++ b/Source/Scene/ShadowMode.js @@ -2,7 +2,7 @@ * Specifies whether the object casts or receives shadows from light sources when * shadows are enabled. * - * @exports ShadowMode + * @enum {Number} */ var ShadowMode = { /** @@ -36,13 +36,13 @@ var ShadowMode = { * @constant */ RECEIVE_ONLY: 3, - - /** - * @private - */ - NUMBER_OF_SHADOW_MODES: 4, }; +/** + * @private + */ +ShadowMode.NUMBER_OF_SHADOW_MODES = 4; + /** * @private */ @@ -74,4 +74,5 @@ ShadowMode.fromCastReceive = function (castShadows, receiveShadows) { } return ShadowMode.DISABLED; }; + export default Object.freeze(ShadowMode); diff --git a/Source/Scene/SingleTileImageryProvider.js b/Source/Scene/SingleTileImageryProvider.js index 8ad4aa8fe339..f78fe92e4649 100644 --- a/Source/Scene/SingleTileImageryProvider.js +++ b/Source/Scene/SingleTileImageryProvider.js @@ -11,6 +11,17 @@ import TileProviderError from "../Core/TileProviderError.js"; import when from "../ThirdParty/when.js"; import ImageryProvider from "./ImageryProvider.js"; +/** + * @typedef {Object} SingleTileImageryProvider.ConstructorOptions + * + * Initialization options for the SingleTileImageryProvider constructor + * + * @property {Resource|String} url The url for the tile. + * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. + * @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas. + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + */ + /** * Provides a single, top-level imagery tile. The single image is assumed to use a * {@link GeographicTilingScheme}. @@ -18,11 +29,7 @@ import ImageryProvider from "./ImageryProvider.js"; * @alias SingleTileImageryProvider * @constructor * - * @param {Object} options Object with the following properties: - * @param {Resource|String} options.url The url for the tile. - * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + * @param {SingleTileImageryProvider.ConstructorOptions} options Object describing initialization options * * @see ArcGisMapServerImageryProvider * @see BingMapsImageryProvider @@ -41,6 +48,92 @@ function SingleTileImageryProvider(options) { } //>>includeEnd('debug'); + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + var resource = Resource.createIfNeeded(options.url); var rectangle = defaultValue(options.rectangle, Rectangle.MAX_VALUE); @@ -174,7 +267,7 @@ Object.defineProperties(SingleTileImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link SingleTileImageryProvider#ready} returns true. * @memberof SingleTileImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -359,7 +452,7 @@ SingleTileImageryProvider.prototype.getTileCredits = function (x, y, level) { * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/SkyAtmosphere.js b/Source/Scene/SkyAtmosphere.js index d4b96ba67c7a..33c9904c4cd6 100644 --- a/Source/Scene/SkyAtmosphere.js +++ b/Source/Scene/SkyAtmosphere.js @@ -1,5 +1,4 @@ import Cartesian3 from "../Core/Cartesian3.js"; -import Cartesian4 from "../Core/Cartesian4.js"; import defaultValue from "../Core/defaultValue.js"; import defined from "../Core/defined.js"; import destroyObject from "../Core/destroyObject.js"; @@ -7,6 +6,7 @@ import Ellipsoid from "../Core/Ellipsoid.js"; import EllipsoidGeometry from "../Core/EllipsoidGeometry.js"; import GeometryPipeline from "../Core/GeometryPipeline.js"; import CesiumMath from "../Core/Math.js"; +import Matrix4 from "../Core/Matrix4.js"; import VertexFormat from "../Core/VertexFormat.js"; import BufferUsage from "../Renderer/BufferUsage.js"; import DrawCommand from "../Renderer/DrawCommand.js"; @@ -14,8 +14,10 @@ import RenderState from "../Renderer/RenderState.js"; import ShaderProgram from "../Renderer/ShaderProgram.js"; import ShaderSource from "../Renderer/ShaderSource.js"; import VertexArray from "../Renderer/VertexArray.js"; +import SkyAtmosphereCommon from "../Shaders/SkyAtmosphereCommon.js"; import SkyAtmosphereFS from "../Shaders/SkyAtmosphereFS.js"; import SkyAtmosphereVS from "../Shaders/SkyAtmosphereVS.js"; +import Axis from "./Axis.js"; import BlendingState from "./BlendingState.js"; import CullFace from "./CullFace.js"; import SceneMode from "./SceneMode.js"; @@ -51,15 +53,34 @@ function SkyAtmosphere(ellipsoid) { */ this.show = true; + /** + * Compute atmosphere per-fragment instead of per-vertex. + * This produces better looking atmosphere with a slight performance penalty. + * + * @type {Boolean} + * @default false + */ + this.perFragmentAtmosphere = false; + this._ellipsoid = ellipsoid; + + var outerEllipsoidScale = 1.025; + var scaleVector = Cartesian3.multiplyByScalar( + ellipsoid.radii, + outerEllipsoidScale, + new Cartesian3() + ); + this._scaleMatrix = Matrix4.fromScale(scaleVector); + this._modelMatrix = new Matrix4(); + this._command = new DrawCommand({ owner: this, + modelMatrix: this._modelMatrix, }); this._spSkyFromSpace = undefined; this._spSkyFromAtmosphere = undefined; - this._spSkyFromSpaceColorCorrect = undefined; - this._spSkyFromAtmosphereColorCorrect = undefined; + this._flags = undefined; /** * The hue shift to apply to the atmosphere. Defaults to 0.0 (no shift). @@ -87,23 +108,23 @@ function SkyAtmosphere(ellipsoid) { this._hueSaturationBrightness = new Cartesian3(); - // camera height, outer radius, inner radius, dynamic atmosphere color flag - var cameraAndRadiiAndDynamicAtmosphereColor = new Cartesian4(); + // outer radius, inner radius, dynamic atmosphere color flag + var radiiAndDynamicAtmosphereColor = new Cartesian3(); + + radiiAndDynamicAtmosphereColor.x = + ellipsoid.maximumRadius * outerEllipsoidScale; + radiiAndDynamicAtmosphereColor.y = ellipsoid.maximumRadius; // Toggles whether the sun position is used. 0 treats the sun as always directly overhead. - cameraAndRadiiAndDynamicAtmosphereColor.w = 0; - cameraAndRadiiAndDynamicAtmosphereColor.y = Cartesian3.maximumComponent( - Cartesian3.multiplyByScalar(ellipsoid.radii, 1.025, new Cartesian3()) - ); - cameraAndRadiiAndDynamicAtmosphereColor.z = ellipsoid.maximumRadius; + radiiAndDynamicAtmosphereColor.z = 0; - this._cameraAndRadiiAndDynamicAtmosphereColor = cameraAndRadiiAndDynamicAtmosphereColor; + this._radiiAndDynamicAtmosphereColor = radiiAndDynamicAtmosphereColor; var that = this; this._command.uniformMap = { - u_cameraAndRadiiAndDynamicAtmosphereColor: function () { - return that._cameraAndRadiiAndDynamicAtmosphereColor; + u_radiiAndDynamicAtmosphereColor: function () { + return that._radiiAndDynamicAtmosphereColor; }, u_hsbShift: function () { that._hueSaturationBrightness.x = that.hueShift; @@ -136,17 +157,16 @@ SkyAtmosphere.prototype.setDynamicAtmosphereColor = function ( enableLighting, useSunDirection ) { - this._cameraAndRadiiAndDynamicAtmosphereColor.w = enableLighting - ? useSunDirection - ? 2.0 - : 1.0 - : 0.0; + var lightEnum = enableLighting ? (useSunDirection ? 2.0 : 1.0) : 0.0; + this._radiiAndDynamicAtmosphereColor.z = lightEnum; }; +var scratchModelMatrix = new Matrix4(); + /** * @private */ -SkyAtmosphere.prototype.update = function (frameState) { +SkyAtmosphere.prototype.update = function (frameState, globe) { if (!this.show) { return undefined; } @@ -161,18 +181,38 @@ SkyAtmosphere.prototype.update = function (frameState) { return undefined; } + // Align the ellipsoid geometry so it always faces the same direction as the + // camera to reduce artifacts when rendering atmosphere per-vertex + var rotationMatrix = Matrix4.fromRotationTranslation( + frameState.context.uniformState.inverseViewRotation, + Cartesian3.ZERO, + scratchModelMatrix + ); + var rotationOffsetMatrix = Matrix4.multiplyTransformation( + rotationMatrix, + Axis.Y_UP_TO_Z_UP, + scratchModelMatrix + ); + var modelMatrix = Matrix4.multiply( + this._scaleMatrix, + rotationOffsetMatrix, + scratchModelMatrix + ); + Matrix4.clone(modelMatrix, this._modelMatrix); + + var context = frameState.context; + + var colorCorrect = hasColorCorrection(this); + var translucent = frameState.globeTranslucencyState.translucent; + var perFragmentAtmosphere = + this.perFragmentAtmosphere || translucent || !defined(globe) || !globe.show; + var command = this._command; if (!defined(command.vertexArray)) { - var context = frameState.context; - var geometry = EllipsoidGeometry.createGeometry( new EllipsoidGeometry({ - radii: Cartesian3.multiplyByScalar( - this._ellipsoid.radii, - 1.025, - new Cartesian3() - ), + radii: new Cartesian3(1.0, 1.0, 1.0), slicePartitions: 256, stackPartitions: 256, vertexFormat: VertexFormat.POSITION_ONLY, @@ -192,84 +232,75 @@ SkyAtmosphere.prototype.update = function (frameState) { blending: BlendingState.ALPHA_BLEND, depthMask: false, }); + } + + var flags = colorCorrect | (perFragmentAtmosphere << 2) | (translucent << 3); + + if (flags !== this._flags) { + this._flags = flags; + + var defines = []; + + if (colorCorrect) { + defines.push("COLOR_CORRECT"); + } + + if (perFragmentAtmosphere) { + defines.push("PER_FRAGMENT_ATMOSPHERE"); + } + + if (translucent) { + defines.push("GLOBE_TRANSLUCENT"); + } var vs = new ShaderSource({ - defines: ["SKY_FROM_SPACE"], - sources: [SkyAtmosphereVS], + defines: defines.concat("SKY_FROM_SPACE"), + sources: [SkyAtmosphereCommon, SkyAtmosphereVS], + }); + + var fs = new ShaderSource({ + defines: defines.concat("SKY_FROM_SPACE"), + sources: [SkyAtmosphereCommon, SkyAtmosphereFS], }); this._spSkyFromSpace = ShaderProgram.fromCache({ context: context, vertexShaderSource: vs, - fragmentShaderSource: SkyAtmosphereFS, + fragmentShaderSource: fs, }); vs = new ShaderSource({ - defines: ["SKY_FROM_ATMOSPHERE"], - sources: [SkyAtmosphereVS], + defines: defines.concat("SKY_FROM_ATMOSPHERE"), + sources: [SkyAtmosphereCommon, SkyAtmosphereVS], }); - this._spSkyFromAtmosphere = ShaderProgram.fromCache({ - context: context, - vertexShaderSource: vs, - fragmentShaderSource: SkyAtmosphereFS, - }); - } - // Compile the color correcting versions of the shader on demand - var useColorCorrect = colorCorrect(this); - if ( - useColorCorrect && - (!defined(this._spSkyFromSpaceColorCorrect) || - !defined(this._spSkyFromAtmosphereColorCorrect)) - ) { - var contextColorCorrect = frameState.context; - - var vsColorCorrect = new ShaderSource({ - defines: ["SKY_FROM_SPACE"], - sources: [SkyAtmosphereVS], - }); - var fsColorCorrect = new ShaderSource({ - defines: ["COLOR_CORRECT"], - sources: [SkyAtmosphereFS], + fs = new ShaderSource({ + defines: defines.concat("SKY_FROM_ATMOSPHERE"), + sources: [SkyAtmosphereCommon, SkyAtmosphereFS], }); - this._spSkyFromSpaceColorCorrect = ShaderProgram.fromCache({ - context: contextColorCorrect, - vertexShaderSource: vsColorCorrect, - fragmentShaderSource: fsColorCorrect, - }); - vsColorCorrect = new ShaderSource({ - defines: ["SKY_FROM_ATMOSPHERE"], - sources: [SkyAtmosphereVS], - }); - this._spSkyFromAtmosphereColorCorrect = ShaderProgram.fromCache({ - context: contextColorCorrect, - vertexShaderSource: vsColorCorrect, - fragmentShaderSource: fsColorCorrect, + this._spSkyFromAtmosphere = ShaderProgram.fromCache({ + context: context, + vertexShaderSource: vs, + fragmentShaderSource: fs, }); } var cameraPosition = frameState.camera.positionWC; - var cameraHeight = Cartesian3.magnitude(cameraPosition); - this._cameraAndRadiiAndDynamicAtmosphereColor.x = cameraHeight; - if (cameraHeight > this._cameraAndRadiiAndDynamicAtmosphereColor.y) { + if (cameraHeight > this._radiiAndDynamicAtmosphereColor.x) { // Camera in space - command.shaderProgram = useColorCorrect - ? this._spSkyFromSpaceColorCorrect - : this._spSkyFromSpace; + command.shaderProgram = this._spSkyFromSpace; } else { // Camera in atmosphere - command.shaderProgram = useColorCorrect - ? this._spSkyFromAtmosphereColorCorrect - : this._spSkyFromAtmosphere; + command.shaderProgram = this._spSkyFromAtmosphere; } return command; }; -function colorCorrect(skyAtmosphere) { +function hasColorCorrection(skyAtmosphere) { return !( CesiumMath.equalsEpsilon( skyAtmosphere.hueShift, @@ -325,12 +356,6 @@ SkyAtmosphere.prototype.destroy = function () { this._spSkyFromSpace = this._spSkyFromSpace && this._spSkyFromSpace.destroy(); this._spSkyFromAtmosphere = this._spSkyFromAtmosphere && this._spSkyFromAtmosphere.destroy(); - this._spSkyFromSpaceColorCorrect = - this._spSkyFromSpaceColorCorrect && - this._spSkyFromSpaceColorCorrect.destroy(); - this._spSkyFromAtmosphereColorCorrect = - this._spSkyFromAtmosphereColorCorrect && - this._spSkyFromAtmosphereColorCorrect.destroy(); return destroyObject(this); }; export default SkyAtmosphere; diff --git a/Source/Scene/StencilFunction.js b/Source/Scene/StencilFunction.js index 2a0fc199677a..f6affdf4a6b9 100644 --- a/Source/Scene/StencilFunction.js +++ b/Source/Scene/StencilFunction.js @@ -3,7 +3,7 @@ import WebGLConstants from "../Core/WebGLConstants.js"; /** * Determines the function used to compare stencil values for the stencil test. * - * @exports StencilFunction + * @enum {Number} */ var StencilFunction = { /** diff --git a/Source/Scene/StencilOperation.js b/Source/Scene/StencilOperation.js index b288b1d2edb2..aad78dcbd7be 100644 --- a/Source/Scene/StencilOperation.js +++ b/Source/Scene/StencilOperation.js @@ -3,7 +3,7 @@ import WebGLConstants from "../Core/WebGLConstants.js"; /** * Determines the action taken based on the result of the stencil test. * - * @exports StencilOperation + * @enum {Number} */ var StencilOperation = { /** diff --git a/Source/Scene/StyleExpression.js b/Source/Scene/StyleExpression.js index acbecdf78fc6..4e809a612587 100644 --- a/Source/Scene/StyleExpression.js +++ b/Source/Scene/StyleExpression.js @@ -55,7 +55,7 @@ StyleExpression.prototype.evaluateColor = function (feature, result) { * Returns undefined if the shader function can't be generated from this expression. * * @param {String} functionName Name to give to the generated function. - * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes. + * @param {String} propertyNameMap Maps property variable names to shader attribute names. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent. * @param {String} returnType The return type of the generated function. * @@ -65,7 +65,7 @@ StyleExpression.prototype.evaluateColor = function (feature, result) { */ StyleExpression.prototype.getShaderFunction = function ( functionName, - attributePrefix, + propertyNameMap, shaderState, returnType ) { diff --git a/Source/Scene/TextureAtlas.js b/Source/Scene/TextureAtlas.js index f640000377bd..446be3b0505e 100644 --- a/Source/Scene/TextureAtlas.js +++ b/Source/Scene/TextureAtlas.js @@ -354,7 +354,7 @@ function addImage(textureAtlas, image, index) { * the existing index is used. * * @param {String} id An identifier to detect whether the image already exists in the atlas. - * @param {Image|Canvas|String|Resource|Promise|TextureAtlas~CreateImageCallback} image An image or canvas to add to the texture atlas, + * @param {HTMLImageElement|HTMLCanvasElement|String|Resource|Promise|TextureAtlas.CreateImageCallback} image An image or canvas to add to the texture atlas, * or a URL to an Image, or a Promise for an image, or a function that creates an image. * @returns {Promise.} A Promise for the image index. */ @@ -494,8 +494,8 @@ TextureAtlas.prototype.destroy = function () { /** * A function that creates an image. - * @callback TextureAtlas~CreateImageCallback + * @callback TextureAtlas.CreateImageCallback * @param {String} id The identifier of the image to load. - * @returns {Image|Promise} The image, or a promise that will resolve to an image. + * @returns {HTMLImageElement|Promise} The image, or a promise that will resolve to an image. */ export default TextureAtlas; diff --git a/Source/Scene/TileBoundingVolume.js b/Source/Scene/TileBoundingVolume.js index 3a9093cd3c01..06d655078a81 100644 --- a/Source/Scene/TileBoundingVolume.js +++ b/Source/Scene/TileBoundingVolume.js @@ -4,6 +4,9 @@ import DeveloperError from "../Core/DeveloperError.js"; * Defines a bounding volume for a tile. This type describes an interface * and is not intended to be instantiated directly. * + * @alias TileBoundingVolume + * @constructor + * * @see TileBoundingRegion * @see TileBoundingSphere * @see TileOrientedBoundingBox @@ -15,8 +18,6 @@ function TileBoundingVolume() {} /** * The underlying bounding volume. * - * @memberof TileBoundingVolume.prototype - * * @type {Object} * @readonly */ @@ -25,8 +26,6 @@ TileBoundingVolume.prototype.boundingVolume = undefined; /** * The underlying bounding sphere. * - * @memberof TileBoundingVolume.prototype - * * @type {BoundingSphere} * @readonly */ diff --git a/Source/Scene/TileCoordinatesImageryProvider.js b/Source/Scene/TileCoordinatesImageryProvider.js index ee56a9b317bd..7194766bcefd 100644 --- a/Source/Scene/TileCoordinatesImageryProvider.js +++ b/Source/Scene/TileCoordinatesImageryProvider.js @@ -5,6 +5,20 @@ import Event from "../Core/Event.js"; import GeographicTilingScheme from "../Core/GeographicTilingScheme.js"; import when from "../ThirdParty/when.js"; +/** + * @typedef {Object} TileCoordinatesImageryProvider.ConstructorOptions + * + * Initialization options for the TileCoordinatesImageryProvider constructor + * + * @property {TilingScheme} [tilingScheme=new GeographicTilingScheme()] The tiling scheme for which to draw tiles. + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If the tilingScheme is specified, + * this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither + * parameter is specified, the WGS84 ellipsoid is used. + * @property {Color} [color=Color.YELLOW] The color to draw the tile box and label. + * @property {Number} [tileWidth=256] The width of the tile for level-of-detail selection purposes. + * @property {Number} [tileHeight=256] The height of the tile for level-of-detail selection purposes. + */ + /** * An {@link ImageryProvider} that draws a box around every rendered tile in the tiling scheme, and draws * a label inside it indicating the X, Y, Level coordinates of the tile. This is mostly useful for @@ -13,14 +27,7 @@ import when from "../ThirdParty/when.js"; * @alias TileCoordinatesImageryProvider * @constructor * - * @param {Object} [options] Object with the following properties: - * @param {TilingScheme} [options.tilingScheme=new GeographicTilingScheme()] The tiling scheme for which to draw tiles. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If the tilingScheme is specified, - * this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither - * parameter is specified, the WGS84 ellipsoid is used. - * @param {Color} [options.color=Color.YELLOW] The color to draw the tile box and label. - * @param {Number} [options.tileWidth=256] The width of the tile for level-of-detail selection purposes. - * @param {Number} [options.tileHeight=256] The height of the tile for level-of-detail selection purposes. + * @param {TileCoordinatesImageryProvider.ConstructorOptions} [options] Object describing initialization options */ function TileCoordinatesImageryProvider(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -33,6 +40,92 @@ function TileCoordinatesImageryProvider(options) { this._tileWidth = defaultValue(options.tileWidth, 256); this._tileHeight = defaultValue(options.tileHeight, 256); this._readyPromise = when.resolve(true); + + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; } Object.defineProperties(TileCoordinatesImageryProvider.prototype, { @@ -78,7 +171,7 @@ Object.defineProperties(TileCoordinatesImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link TileCoordinatesImageryProvider#ready} returns true. * @memberof TileCoordinatesImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -235,7 +328,7 @@ TileCoordinatesImageryProvider.prototype.getTileCredits = function ( * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/TileDiscardPolicy.js b/Source/Scene/TileDiscardPolicy.js index c50a02a8611e..1977b881fcac 100644 --- a/Source/Scene/TileDiscardPolicy.js +++ b/Source/Scene/TileDiscardPolicy.js @@ -26,7 +26,7 @@ TileDiscardPolicy.prototype.isReady = DeveloperError.throwInstantiationError; * Given a tile image, decide whether to discard that image. * @function * - * @param {Image} image An image to test. + * @param {HTMLImageElement} image An image to test. * @returns {Boolean} True if the image should be discarded; otherwise, false. */ TileDiscardPolicy.prototype.shouldDiscardImage = diff --git a/Source/Scene/TileMapServiceImageryProvider.js b/Source/Scene/TileMapServiceImageryProvider.js index 9f16e1e8392d..2f27b2c8d964 100644 --- a/Source/Scene/TileMapServiceImageryProvider.js +++ b/Source/Scene/TileMapServiceImageryProvider.js @@ -14,32 +14,39 @@ import when from "../ThirdParty/when.js"; import UrlTemplateImageryProvider from "./UrlTemplateImageryProvider.js"; /** - * An imagery provider that provides tiled imagery as generated by - * {@link http://www.maptiler.org/|MapTiler}, {@link http://www.klokan.cz/projects/gdal2tiles/|GDAL2Tiles}, etc. + * @typedef {Object} TileMapServiceImageryProvider.ConstructorOptions * - * @alias TileMapServiceImageryProvider - * @constructor + * Initialization options for the TileMapServiceImageryProvider constructor * - * @param {Object} [options] Object with the following properties: - * @param {Resource|String|Promise|Promise} [options.url='.'] Path to image tiles on server. - * @param {String} [options.fileExtension='png'] The file extension for images on the server. - * @param {Credit|String} [options.credit=''] A credit for the data source, which is displayed on the canvas. - * @param {Number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying + * @property {Resource|String|Promise|Promise} [url='.'] Path to image tiles on server. + * @property {String} [fileExtension='png'] The file extension for images on the server. + * @property {Credit|String} [credit=''] A credit for the data source, which is displayed on the canvas. + * @property {Number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely * to result in rendering problems. - * @param {Number} [options.maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. - * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. - * @param {TilingScheme} [options.tilingScheme] The tiling scheme specifying how the ellipsoidal + * @property {Number} [maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. + * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. + * @property {TilingScheme} [tilingScheme] The tiling scheme specifying how the ellipsoidal * surface is broken into tiles. If this parameter is not provided, a {@link WebMercatorTilingScheme} * is used. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If the tilingScheme is specified, + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If the tilingScheme is specified, * this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither * parameter is specified, the WGS84 ellipsoid is used. - * @param {Number} [options.tileWidth=256] Pixel width of image tiles. - * @param {Number} [options.tileHeight=256] Pixel height of image tiles. - * @param {Boolean} [options.flipXY] Older versions of gdal2tiles.py flipped X and Y values in tilemapresource.xml. + * @property {Number} [tileWidth=256] Pixel width of image tiles. + * @property {Number} [tileHeight=256] Pixel height of image tiles. + * @property {Boolean} [flipXY] Older versions of gdal2tiles.py flipped X and Y values in tilemapresource.xml. * Specifying this option will do the same, allowing for loading of these incorrect tilesets. - * @returns {UrlTemplateImageryProvider} The imagery provider. + */ + +/** + * An imagery provider that provides tiled imagery as generated by + * {@link http://www.maptiler.org/|MapTiler}, {@link http://www.klokan.cz/projects/gdal2tiles/|GDAL2Tiles}, etc. + * + * @alias TileMapServiceImageryProvider + * @constructor + * @extends UrlTemplateImageryProvider + * + * @param {TileMapServiceImageryProvider.ConstructorOptions} options Object describing initialization options * * @see ArcGisMapServerImageryProvider * @see BingMapsImageryProvider diff --git a/Source/Scene/TimeDynamicImagery.js b/Source/Scene/TimeDynamicImagery.js index 7afa8d904349..ef579f198928 100644 --- a/Source/Scene/TimeDynamicImagery.js +++ b/Source/Scene/TimeDynamicImagery.js @@ -111,7 +111,7 @@ Object.defineProperties(TimeDynamicImagery.prototype, { * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. * - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if the tile is not in the cache. */ TimeDynamicImagery.prototype.getFromCache = function (x, y, level, request) { diff --git a/Source/Scene/Tonemapper.js b/Source/Scene/Tonemapper.js index 4c34f7515f7f..2deefe17b20b 100644 --- a/Source/Scene/Tonemapper.js +++ b/Source/Scene/Tonemapper.js @@ -1,7 +1,7 @@ /** * A tonemapping algorithm when rendering with high dynamic range. * - * @exports Tonemapper + * @enum {Number} * @private */ var Tonemapper = { diff --git a/Source/Scene/TweenCollection.js b/Source/Scene/TweenCollection.js index ff1515276763..e27df7182912 100644 --- a/Source/Scene/TweenCollection.js +++ b/Source/Scene/TweenCollection.js @@ -45,7 +45,7 @@ function Tween( * The callback to call if the tween is canceled either because {@link Tween#cancelTween} * was called or because the tween was removed from the collection. * - * @type {TweenCollection~TweenCancelledCallback} + * @type {TweenCollection.TweenCancelledCallback} */ this.cancel = cancel; @@ -125,7 +125,7 @@ Object.defineProperties(Tween.prototype, { * The callback to call at each animation update (usually tied to the a rendered frame). * @memberof Tween.prototype * - * @type {TweenCollection~TweenUpdateCallback} + * @type {TweenCollection.TweenUpdateCallback} * @readonly */ update: { @@ -138,7 +138,7 @@ Object.defineProperties(Tween.prototype, { * The callback to call when the tween finishes animating. * @memberof Tween.prototype * - * @type {TweenCollection~TweenCompleteCallback} + * @type {TweenCollection.TweenCompleteCallback} * @readonly */ complete: { @@ -204,9 +204,9 @@ Object.defineProperties(TweenCollection.prototype, { * @param {Number} options.duration The duration, in seconds, for the tween. The tween is automatically removed from the collection when it stops. * @param {Number} [options.delay=0.0] The delay, in seconds, before the tween starts animating. * @param {EasingFunction} [options.easingFunction=EasingFunction.LINEAR_NONE] Determines the curve for animtion. - * @param {TweenCollection~TweenUpdateCallback} [options.update] The callback to call at each animation update (usually tied to the a rendered frame). - * @param {TweenCollection~TweenCompleteCallback} [options.complete] The callback to call when the tween finishes animating. - * @param {TweenCollection~TweenCancelledCallback} [options.cancel] The callback to call if the tween is canceled either because {@link Tween#cancelTween} was called or because the tween was removed from the collection. + * @param {TweenCollection.TweenUpdateCallback} [options.update] The callback to call at each animation update (usually tied to the a rendered frame). + * @param {TweenCollection.TweenCompleteCallback} [options.complete] The callback to call when the tween finishes animating. + * @param {TweenCollection.TweenCancelledCallback} [options.cancel] The callback to call if the tween is canceled either because {@link Tween#cancelTween} was called or because the tween was removed from the collection. * @returns {Tween} The tween. * * @exception {DeveloperError} options.duration must be positive. @@ -284,9 +284,9 @@ TweenCollection.prototype.add = function (options) { * @param {Number} [options.duration=3.0] The duration, in seconds, for the tween. The tween is automatically removed from the collection when it stops. * @param {Number} [options.delay=0.0] The delay, in seconds, before the tween starts animating. * @param {EasingFunction} [options.easingFunction=EasingFunction.LINEAR_NONE] Determines the curve for animtion. - * @param {TweenCollection~TweenUpdateCallback} [options.update] The callback to call at each animation update (usually tied to the a rendered frame). - * @param {TweenCollection~TweenCompleteCallback} [options.complete] The callback to call when the tween finishes animating. - * @param {TweenCollection~TweenCancelledCallback} [options.cancel] The callback to call if the tween is canceled either because {@link Tween#cancelTween} was called or because the tween was removed from the collection. + * @param {TweenCollection.TweenUpdateCallback} [options.update] The callback to call at each animation update (usually tied to the a rendered frame). + * @param {TweenCollection.TweenCompleteCallback} [options.complete] The callback to call when the tween finishes animating. + * @param {TweenCollection.TweenCancelledCallback} [options.cancel] The callback to call if the tween is canceled either because {@link Tween#cancelTween} was called or because the tween was removed from the collection. * @returns {Tween} The tween. * * @exception {DeveloperError} options.object must have the specified property. @@ -350,9 +350,9 @@ TweenCollection.prototype.addProperty = function (options) { * @param {Number} [options.duration=3.0] The duration, in seconds, for the tween. The tween is automatically removed from the collection when it stops. * @param {Number} [options.delay=0.0] The delay, in seconds, before the tween starts animating. * @param {EasingFunction} [options.easingFunction=EasingFunction.LINEAR_NONE] Determines the curve for animtion. - * @param {TweenCollection~TweenUpdateCallback} [options.update] The callback to call at each animation update (usually tied to the a rendered frame). - * @param {TweenCollection~TweenCompleteCallback} [options.complete] The callback to call when the tween finishes animating. - * @param {TweenCollection~TweenCancelledCallback} [options.cancel] The callback to call if the tween is canceled either because {@link Tween#cancelTween} was called or because the tween was removed from the collection. + * @param {TweenCollection.TweenUpdateCallback} [options.update] The callback to call at each animation update (usually tied to the a rendered frame). + * @param {TweenCollection.TweenCompleteCallback} [options.complete] The callback to call when the tween finishes animating. + * @param {TweenCollection.TweenCancelledCallback} [options.cancel] The callback to call if the tween is canceled either because {@link Tween#cancelTween} was called or because the tween was removed from the collection. * @returns {Tween} The tween. * * @exception {DeveloperError} material has no properties with alpha components. @@ -423,8 +423,8 @@ TweenCollection.prototype.addAlpha = function (options) { * @param {Number} [options.duration=3.0] The duration, in seconds, for the tween. The tween is automatically removed from the collection when it stops. * @param {Number} [options.delay=0.0] The delay, in seconds, before the tween starts animating. * @param {EasingFunction} [options.easingFunction=EasingFunction.LINEAR_NONE] Determines the curve for animtion. - * @param {TweenCollection~TweenUpdateCallback} [options.update] The callback to call at each animation update (usually tied to the a rendered frame). - * @param {TweenCollection~TweenCancelledCallback} [options.cancel] The callback to call if the tween is canceled either because {@link Tween#cancelTween} was called or because the tween was removed from the collection. + * @param {TweenCollection.TweenUpdateCallback} [options.update] The callback to call at each animation update (usually tied to the a rendered frame). + * @param {TweenCollection.TweenCancelledCallback} [options.cancel] The callback to call if the tween is canceled either because {@link Tween#cancelTween} was called or because the tween was removed from the collection. * @returns {Tween} The tween. * * @exception {DeveloperError} material.uniforms must have an offset property. @@ -573,16 +573,16 @@ TweenCollection.prototype.update = function (time) { /** * A function that will execute when a tween completes. - * @callback TweenCollection~TweenCompleteCallback + * @callback TweenCollection.TweenCompleteCallback */ /** * A function that will execute when a tween updates. - * @callback TweenCollection~TweenUpdateCallback + * @callback TweenCollection.TweenUpdateCallback */ /** * A function that will execute when a tween is cancelled. - * @callback TweenCollection~TweenCancelledCallback + * @callback TweenCollection.TweenCancelledCallback */ export default TweenCollection; diff --git a/Source/Scene/UrlTemplateImageryProvider.js b/Source/Scene/UrlTemplateImageryProvider.js index f8c49fc30c4e..3a8482c1f39a 100644 --- a/Source/Scene/UrlTemplateImageryProvider.js +++ b/Source/Scene/UrlTemplateImageryProvider.js @@ -50,13 +50,12 @@ var pickFeaturesTags = combine(tags, { }); /** - * Provides imagery by requesting tiles using a specified URL template. + * @typedef {Object} UrlTemplateImageryProvider.ConstructorOptions * - * @alias UrlTemplateImageryProvider - * @constructor + * Initialization options for the UrlTemplateImageryProvider constructor * - * @param {Promise.|Object} [options] Object with the following properties: - * @param {Resource|String} options.url The URL template to use to request tiles. It has the following keywords: + * @property {Promise.|Object} [options] Object with the following properties: + * @property {Resource|String} url The URL template to use to request tiles. It has the following keywords: *
    *
  • {z}: The level of the tile in the tiling scheme. Level zero is the root of the quadtree pyramid.
  • *
  • {x}: The tile X coordinate in the tiling scheme, where 0 is the Westernmost tile.
  • @@ -76,7 +75,7 @@ var pickFeaturesTags = combine(tags, { *
  • {width}: The width of each tile in pixels.
  • *
  • {height}: The height of each tile in pixels.
  • *
- * @param {Resource|String} [options.pickFeaturesUrl] The URL template to use to pick features. If this property is not specified, + * @property {Resource|String} [pickFeaturesUrl] The URL template to use to pick features. If this property is not specified, * {@link UrlTemplateImageryProvider#pickFeatures} will immediately returned undefined, indicating no * features picked. The URL template supports all of the keywords supported by the url * parameter, plus the following: @@ -91,7 +90,7 @@ var pickFeaturesTags = combine(tags, { *
  • {latitudeProjected}: The latitude of the picked position in the projected coordinates of the tiling scheme.
  • *
  • {format}: The format in which to get feature information, as specified in the {@link GetFeatureInfoFormat}.
  • * - * @param {Object} [options.urlSchemeZeroPadding] Gets the URL scheme zero padding for each tile coordinate. The format is '000' where + * @property {Object} [urlSchemeZeroPadding] Gets the URL scheme zero padding for each tile coordinate. The format is '000' where * each coordinate will be padded on the left with zeros to match the width of the passed string of zeros. e.g. Setting: * urlSchemeZeroPadding : { '{x}' : '0000'} * will cause an 'x' value of 12 to return the string '0012' for {x} in the generated URL. @@ -104,40 +103,48 @@ var pickFeaturesTags = combine(tags, { *
  • {reverseY}: The zero padding for the tile reverseY coordinate in the tiling scheme.
  • *
  • {reverseZ}: The zero padding for the reverseZ coordinate of the tile in the tiling scheme.
  • * - * @param {String|String[]} [options.subdomains='abc'] The subdomains to use for the {s} placeholder in the URL template. + * @property {String|String[]} [subdomains='abc'] The subdomains to use for the {s} placeholder in the URL template. * If this parameter is a single string, each character in the string is a subdomain. If it is * an array, each element in the array is a subdomain. - * @param {Credit|String} [options.credit=''] A credit for the data source, which is displayed on the canvas. - * @param {Number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying + * @property {Credit|String} [credit=''] A credit for the data source, which is displayed on the canvas. + * @property {Number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely * to result in rendering problems. - * @param {Number} [options.maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. - * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. - * @param {TilingScheme} [options.tilingScheme=WebMercatorTilingScheme] The tiling scheme specifying how the ellipsoidal + * @property {Number} [maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. + * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. + * @property {TilingScheme} [tilingScheme=WebMercatorTilingScheme] The tiling scheme specifying how the ellipsoidal * surface is broken into tiles. If this parameter is not provided, a {@link WebMercatorTilingScheme} * is used. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If the tilingScheme is specified, + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If the tilingScheme is specified, * this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither * parameter is specified, the WGS84 ellipsoid is used. - * @param {Number} [options.tileWidth=256] Pixel width of image tiles. - * @param {Number} [options.tileHeight=256] Pixel height of image tiles. - * @param {Boolean} [options.hasAlphaChannel=true] true if the images provided by this imagery provider + * @property {Number} [tileWidth=256] Pixel width of image tiles. + * @property {Number} [tileHeight=256] Pixel height of image tiles. + * @property {Boolean} [hasAlphaChannel=true] true if the images provided by this imagery provider * include an alpha channel; otherwise, false. If this property is false, an alpha channel, if * present, will be ignored. If this property is true, any images without an alpha channel will * be treated as if their alpha is 1.0 everywhere. When this property is false, memory usage * and texture upload time are potentially reduced. - * @param {GetFeatureInfoFormat[]} [options.getFeatureInfoFormats] The formats in which to get feature information at a + * @property {GetFeatureInfoFormat[]} [getFeatureInfoFormats] The formats in which to get feature information at a * specific location when {@link UrlTemplateImageryProvider#pickFeatures} is invoked. If this * parameter is not specified, feature picking is disabled. - * @param {Boolean} [options.enablePickFeatures=true] If true, {@link UrlTemplateImageryProvider#pickFeatures} will - * request the options.pickFeaturesUrl and attempt to interpret the features included in the response. If false, + * @property {Boolean} [enablePickFeatures=true] If true, {@link UrlTemplateImageryProvider#pickFeatures} will + * request the pickFeaturesUrl and attempt to interpret the features included in the response. If false, * {@link UrlTemplateImageryProvider#pickFeatures} will immediately return undefined (indicating no pickable * features) without communicating with the server. Set this property to false if you know your data * source does not support picking features or if you don't want this provider's features to be pickable. Note * that this can be dynamically overridden by modifying the {@link UriTemplateImageryProvider#enablePickFeatures} * property. - * @param {Object} [options.customTags] Allow to replace custom keywords in the URL template. The object must have strings as keys and functions as values. + * @property {Object} [customTags] Allow to replace custom keywords in the URL template. The object must have strings as keys and functions as values. + */ + +/** + * Provides imagery by requesting tiles using a specified URL template. * + * @alias UrlTemplateImageryProvider + * @constructor + * + * @param {UrlTemplateImageryProvider.ConstructorOptions} options Object describing initialization options * * @example * // Access Natural Earth II imagery, which uses a TMS tiling scheme and Geographic (EPSG:4326) project @@ -209,6 +216,92 @@ function UrlTemplateImageryProvider(options) { this._tags = undefined; this._pickFeaturesTags = undefined; + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + /** * Gets or sets a value indicating whether feature picking is enabled. If true, {@link UrlTemplateImageryProvider#pickFeatures} will * request the options.pickFeaturesUrl and attempt to interpret the features included in the response. If false, @@ -281,7 +374,7 @@ Object.defineProperties(UrlTemplateImageryProvider.prototype, { /** * Gets the URL template to use to use to pick features. If this property is not specified, - * {@link UrlTemplateImageryProvider#pickFeatures} will immediately returned undefined, indicating no + * {@link UrlTemplateImageryProvider#pickFeatures} will immediately return undefined, indicating no * features picked. The URL template supports all of the keywords supported by the * {@link UrlTemplateImageryProvider#url} property, plus the following: *
      @@ -364,7 +457,7 @@ Object.defineProperties(UrlTemplateImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested, or undefined if there is no limit. * This function should not be called before {@link UrlTemplateImageryProvider#ready} returns true. * @memberof UrlTemplateImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly * @default undefined */ @@ -660,7 +753,7 @@ UrlTemplateImageryProvider.prototype.getTileCredits = function (x, y, level) { * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/Vector3DTileGeometry.js b/Source/Scene/Vector3DTileGeometry.js index 89095aa3e9aa..63e8ca8b74b3 100644 --- a/Source/Scene/Vector3DTileGeometry.js +++ b/Source/Scene/Vector3DTileGeometry.js @@ -139,7 +139,7 @@ Object.defineProperties(Vector3DTileGeometry.prototype, { /** * Gets a promise that resolves when the primitive is ready to render. * @memberof Vector3DTileGeometry.prototype - * @type {Promise} + * @type {Promise} * @readonly */ readyPromise: { diff --git a/Source/Scene/Vector3DTilePoints.js b/Source/Scene/Vector3DTilePoints.js index 9d2c9d5951dd..b6cd9346dc90 100644 --- a/Source/Scene/Vector3DTilePoints.js +++ b/Source/Scene/Vector3DTilePoints.js @@ -92,7 +92,7 @@ Object.defineProperties(Vector3DTilePoints.prototype, { /** * Gets a promise that resolves when the primitive is ready to render. * @memberof Vector3DTilePoints.prototype - * @type {Promise} + * @type {Promise} * @readonly */ readyPromise: { diff --git a/Source/Scene/Vector3DTilePolygons.js b/Source/Scene/Vector3DTilePolygons.js index 50a1712ba549..afe4f440b18e 100644 --- a/Source/Scene/Vector3DTilePolygons.js +++ b/Source/Scene/Vector3DTilePolygons.js @@ -143,7 +143,7 @@ Object.defineProperties(Vector3DTilePolygons.prototype, { /** * Gets a promise that resolves when the primitive is ready to render. * @memberof Vector3DTilePolygons.prototype - * @type {Promise} + * @type {Promise} * @readonly */ readyPromise: { diff --git a/Source/Scene/Vector3DTilePolylines.js b/Source/Scene/Vector3DTilePolylines.js index 13c363a1056b..d9672ddd222b 100644 --- a/Source/Scene/Vector3DTilePolylines.js +++ b/Source/Scene/Vector3DTilePolylines.js @@ -121,7 +121,7 @@ Object.defineProperties(Vector3DTilePolylines.prototype, { /** * Gets a promise that resolves when the primitive is ready to render. * @memberof Vector3DTilePolylines.prototype - * @type {Promise} + * @type {Promise} * @readonly */ readyPromise: { diff --git a/Source/Scene/Vector3DTilePrimitive.js b/Source/Scene/Vector3DTilePrimitive.js index 142b351335d3..fdc3edce63bb 100644 --- a/Source/Scene/Vector3DTilePrimitive.js +++ b/Source/Scene/Vector3DTilePrimitive.js @@ -81,8 +81,6 @@ function Vector3DTilePrimitive(options) { // Only used with WebGL 2 to ping-pong ibos after copy. this._vaSwap = undefined; - this._rsStencilPreloadPass = undefined; - this._rsStencilPreloadPass3DTiles = undefined; this._rsStencilDepthPass = undefined; this._rsStencilDepthPass3DTiles = undefined; this._rsColorPass = undefined; @@ -369,7 +367,7 @@ function createShaders(primitive, context) { }); } -function getStencilPreloadRenderState(mask3DTiles) { +function getStencilDepthRenderState(mask3DTiles) { var stencilFunction = mask3DTiles ? StencilFunction.EQUAL : StencilFunction.ALWAYS; @@ -386,49 +384,13 @@ function getStencilPreloadRenderState(mask3DTiles) { frontOperation: { fail: StencilOperation.KEEP, zFail: StencilOperation.DECREMENT_WRAP, - zPass: StencilOperation.DECREMENT_WRAP, + zPass: StencilOperation.KEEP, }, backFunction: stencilFunction, backOperation: { fail: StencilOperation.KEEP, zFail: StencilOperation.INCREMENT_WRAP, - zPass: StencilOperation.INCREMENT_WRAP, - }, - reference: StencilConstants.CESIUM_3D_TILE_MASK, - mask: StencilConstants.CESIUM_3D_TILE_MASK, - }, - stencilMask: StencilConstants.CLASSIFICATION_MASK, - depthTest: { - enabled: false, - }, - depthMask: false, - }; -} - -function getStencilDepthRenderState(mask3DTiles) { - var stencilFunction = mask3DTiles - ? StencilFunction.EQUAL - : StencilFunction.ALWAYS; - return { - colorMask: { - red: false, - green: false, - blue: false, - alpha: false, - }, - stencilTest: { - enabled: true, - frontFunction: stencilFunction, - frontOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.INCREMENT_WRAP, - }, - backFunction: stencilFunction, - backOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + zPass: StencilOperation.KEEP, }, reference: StencilConstants.CESIUM_3D_TILE_MASK, mask: StencilConstants.CESIUM_3D_TILE_MASK, @@ -447,15 +409,15 @@ var colorRenderState = { enabled: true, frontFunction: StencilFunction.NOT_EQUAL, frontOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + fail: StencilOperation.ZERO, + zFail: StencilOperation.ZERO, + zPass: StencilOperation.ZERO, }, backFunction: StencilFunction.NOT_EQUAL, backOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + fail: StencilOperation.ZERO, + zFail: StencilOperation.ZERO, + zPass: StencilOperation.ZERO, }, reference: 0, mask: StencilConstants.CLASSIFICATION_MASK, @@ -473,15 +435,15 @@ var pickRenderState = { enabled: true, frontFunction: StencilFunction.NOT_EQUAL, frontOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + fail: StencilOperation.ZERO, + zFail: StencilOperation.ZERO, + zPass: StencilOperation.ZERO, }, backFunction: StencilFunction.NOT_EQUAL, backOperation: { - fail: StencilOperation.KEEP, - zFail: StencilOperation.KEEP, - zPass: StencilOperation.DECREMENT_WRAP, + fail: StencilOperation.ZERO, + zFail: StencilOperation.ZERO, + zPass: StencilOperation.ZERO, }, reference: 0, mask: StencilConstants.CLASSIFICATION_MASK, @@ -494,16 +456,10 @@ var pickRenderState = { }; function createRenderStates(primitive) { - if (defined(primitive._rsStencilPreloadPass)) { + if (defined(primitive._rsStencilDepthPass)) { return; } - primitive._rsStencilPreloadPass = RenderState.fromCache( - getStencilPreloadRenderState(false) - ); - primitive._rsStencilPreloadPass3DTiles = RenderState.fromCache( - getStencilPreloadRenderState(true) - ); primitive._rsStencilDepthPass = RenderState.fromCache( getStencilDepthRenderState(false) ); @@ -807,7 +763,7 @@ function createColorCommands(primitive, context) { var commands = primitive._commands; var batchedIndices = primitive._batchedIndices; var length = batchedIndices.length; - var commandsLength = length * 3; + var commandsLength = length * 2; if ( defined(commands) && @@ -829,36 +785,9 @@ function createColorCommands(primitive, context) { var offset = batchedIndices[j].offset; var count = batchedIndices[j].count; - var stencilPreloadCommand = commands[j * 3]; - if (!defined(stencilPreloadCommand)) { - stencilPreloadCommand = commands[j * 3] = new DrawCommand({ - owner: primitive, - }); - } - - stencilPreloadCommand.vertexArray = vertexArray; - stencilPreloadCommand.modelMatrix = modelMatrix; - stencilPreloadCommand.offset = offset; - stencilPreloadCommand.count = count; - stencilPreloadCommand.renderState = primitive._rsStencilPreloadPass; - stencilPreloadCommand.shaderProgram = sp; - stencilPreloadCommand.uniformMap = uniformMap; - stencilPreloadCommand.boundingVolume = bv; - stencilPreloadCommand.cull = false; - stencilPreloadCommand.pass = Pass.TERRAIN_CLASSIFICATION; - - var stencilPreloadDerivedCommand = DrawCommand.shallowClone( - stencilPreloadCommand, - stencilPreloadCommand.derivedCommands.tileset - ); - stencilPreloadDerivedCommand.renderState = - primitive._rsStencilPreloadPass3DTiles; - stencilPreloadDerivedCommand.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION; - stencilPreloadCommand.derivedCommands.tileset = stencilPreloadDerivedCommand; - - var stencilDepthCommand = commands[j * 3 + 1]; + var stencilDepthCommand = commands[j * 2]; if (!defined(stencilDepthCommand)) { - stencilDepthCommand = commands[j * 3 + 1] = new DrawCommand({ + stencilDepthCommand = commands[j * 2] = new DrawCommand({ owner: primitive, }); } @@ -883,9 +812,9 @@ function createColorCommands(primitive, context) { stencilDepthDerivedCommand.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION; stencilDepthCommand.derivedCommands.tileset = stencilDepthDerivedCommand; - var colorCommand = commands[j * 3 + 2]; + var colorCommand = commands[j * 2 + 1]; if (!defined(colorCommand)) { - colorCommand = commands[j * 3 + 2] = new DrawCommand({ + colorCommand = commands[j * 2 + 1] = new DrawCommand({ owner: primitive, }); } @@ -926,10 +855,10 @@ function createColorCommandsIgnoreShow(primitive, frameState) { var spStencil = primitive._spStencil; var commandsLength = commands.length; - var length = (commandsIgnoreShow.length = (commandsLength / 3) * 2); + var length = (commandsIgnoreShow.length = commandsLength / 2); var commandIndex = 0; - for (var j = 0; j < length; j += 2) { + for (var j = 0; j < length; ++j) { var commandIgnoreShow = (commandsIgnoreShow[j] = DrawCommand.shallowClone( commands[commandIndex], commandsIgnoreShow[j] @@ -937,14 +866,7 @@ function createColorCommandsIgnoreShow(primitive, frameState) { commandIgnoreShow.shaderProgram = spStencil; commandIgnoreShow.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW; - commandIgnoreShow = commandsIgnoreShow[j + 1] = DrawCommand.shallowClone( - commands[commandIndex + 1], - commandsIgnoreShow[j + 1] - ); - commandIgnoreShow.shaderProgram = spStencil; - commandIgnoreShow.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW; - - commandIndex += 3; + commandIndex += 2; } primitive._commandsDirty = false; @@ -957,7 +879,7 @@ function createPickCommands(primitive) { var length = primitive._indexOffsets.length; var pickCommands = primitive._pickCommands; - pickCommands.length = length * 3; + pickCommands.length = length * 2; var vertexArray = primitive._va; var spStencil = primitive._spStencil; @@ -972,36 +894,9 @@ function createPickCommands(primitive) { ? primitive._boundingVolumes[j] : primitive.boundingVolume; - var stencilPreloadCommand = pickCommands[j * 3]; - if (!defined(stencilPreloadCommand)) { - stencilPreloadCommand = pickCommands[j * 3] = new DrawCommand({ - owner: primitive, - pickOnly: true, - }); - } - - stencilPreloadCommand.vertexArray = vertexArray; - stencilPreloadCommand.modelMatrix = modelMatrix; - stencilPreloadCommand.offset = offset; - stencilPreloadCommand.count = count; - stencilPreloadCommand.renderState = primitive._rsStencilPreloadPass; - stencilPreloadCommand.shaderProgram = spStencil; - stencilPreloadCommand.uniformMap = uniformMap; - stencilPreloadCommand.boundingVolume = bv; - stencilPreloadCommand.pass = Pass.TERRAIN_CLASSIFICATION; - - var stencilPreloadDerivedCommand = DrawCommand.shallowClone( - stencilPreloadCommand, - stencilPreloadCommand.derivedCommands.tileset - ); - stencilPreloadDerivedCommand.renderState = - primitive._rsStencilPreloadPass3DTiles; - stencilPreloadDerivedCommand.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION; - stencilPreloadCommand.derivedCommands.tileset = stencilPreloadDerivedCommand; - - var stencilDepthCommand = pickCommands[j * 3 + 1]; + var stencilDepthCommand = pickCommands[j * 2]; if (!defined(stencilDepthCommand)) { - stencilDepthCommand = pickCommands[j * 3 + 1] = new DrawCommand({ + stencilDepthCommand = pickCommands[j * 2] = new DrawCommand({ owner: primitive, pickOnly: true, }); @@ -1026,9 +921,9 @@ function createPickCommands(primitive) { stencilDepthDerivedCommand.pass = Pass.CESIUM_3D_TILE_CLASSIFICATION; stencilDepthCommand.derivedCommands.tileset = stencilDepthDerivedCommand; - var colorCommand = pickCommands[j * 3 + 2]; + var colorCommand = pickCommands[j * 2 + 1]; if (!defined(colorCommand)) { - colorCommand = pickCommands[j * 3 + 2] = new DrawCommand({ + colorCommand = pickCommands[j * 2 + 1] = new DrawCommand({ owner: primitive, pickOnly: true, }); @@ -1284,8 +1179,8 @@ function queueCommands(primitive, frameState, commands, commandsIgnoreShow) { function queueWireframeCommands(frameState, commands) { var commandList = frameState.commandList; var commandLength = commands.length; - for (var i = 0; i < commandLength; i += 3) { - var command = commands[i + 2]; + for (var i = 0; i < commandLength; i += 2) { + var command = commands[i + 1]; command.pass = Pass.OPAQUE; commandList.push(command); } @@ -1316,8 +1211,8 @@ function updateWireframe(primitive) { var commands = primitive._commands; var commandLength = commands.length; - for (var i = 0; i < commandLength; i += 3) { - var command = commands[i + 2]; + for (var i = 0; i < commandLength; i += 2) { + var command = commands[i + 1]; command.renderState = rs; command.primitiveType = type; } diff --git a/Source/Scene/VerticalOrigin.js b/Source/Scene/VerticalOrigin.js index a86ab56be337..dfd99dc56e5c 100644 --- a/Source/Scene/VerticalOrigin.js +++ b/Source/Scene/VerticalOrigin.js @@ -8,7 +8,7 @@ *
      * * - * @exports VerticalOrigin + * @enum {Number} * * @see Billboard#verticalOrigin * @see Label#verticalOrigin diff --git a/Source/Scene/View.js b/Source/Scene/View.js index 51992969641e..b0c89cda68d2 100644 --- a/Source/Scene/View.js +++ b/Source/Scene/View.js @@ -12,6 +12,7 @@ import PassState from "../Renderer/PassState.js"; import Camera from "./Camera.js"; import FrustumCommands from "./FrustumCommands.js"; import GlobeDepth from "./GlobeDepth.js"; +import GlobeTranslucencyFramebuffer from "./GlobeTranslucencyFramebuffer.js"; import OIT from "./OIT.js"; import PickDepthFramebuffer from "./PickDepthFramebuffer.js"; import PickFramebuffer from "./PickFramebuffer.js"; @@ -70,6 +71,7 @@ function View(scene, camera, viewport) { this.pickDepthFramebuffer = new PickDepthFramebuffer(); this.sceneFramebuffer = new SceneFramebuffer(); this.globeDepth = globeDepth; + this.globeTranslucencyFramebuffer = new GlobeTranslucencyFramebuffer(); this.oit = oit; this.pickDepths = []; this.debugGlobeDepths = []; @@ -423,6 +425,9 @@ View.prototype.destroy = function () { this.sceneFramebuffer && this.sceneFramebuffer.destroy(); this.globeDepth = this.globeDepth && this.globeDepth.destroy(); this.oit = this.oit && this.oit.destroy(); + this.globeTranslucencyFramebuffer = + this.globeTranslucencyFramebuffer && + this.globeTranslucencyFramebuffer.destroy(); var i; var length; diff --git a/Source/Scene/WebMapServiceImageryProvider.js b/Source/Scene/WebMapServiceImageryProvider.js index 8cc2b28dff20..c529269da2a5 100644 --- a/Source/Scene/WebMapServiceImageryProvider.js +++ b/Source/Scene/WebMapServiceImageryProvider.js @@ -9,44 +9,51 @@ import TimeDynamicImagery from "./TimeDynamicImagery.js"; import UrlTemplateImageryProvider from "./UrlTemplateImageryProvider.js"; /** - * Provides tiled imagery hosted by a Web Map Service (WMS) server. + * @typedef {Object} WebMapServiceImageryProvider.ConstructorOptions * - * @alias WebMapServiceImageryProvider - * @constructor + * Initialization options for the WebMapServiceImageryProvider constructor * - * @param {Object} options Object with the following properties: - * @param {Resource|String} options.url The URL of the WMS service. The URL supports the same keywords as the {@link UrlTemplateImageryProvider}. - * @param {String} options.layers The layers to include, separated by commas. - * @param {Object} [options.parameters=WebMapServiceImageryProvider.DefaultParameters] Additional parameters to pass to the WMS server in the GetMap URL. - * @param {Object} [options.getFeatureInfoParameters=WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters] Additional parameters to pass to the WMS server in the GetFeatureInfo URL. - * @param {Boolean} [options.enablePickFeatures=true] If true, {@link WebMapServiceImageryProvider#pickFeatures} will invoke + * @property {Resource|String} url The URL of the WMS service. The URL supports the same keywords as the {@link UrlTemplateImageryProvider}. + * @property {String} layers The layers to include, separated by commas. + * @property {Object} [parameters=WebMapServiceImageryProvider.DefaultParameters] Additional parameters to pass to the WMS server in the GetMap URL. + * @property {Object} [getFeatureInfoParameters=WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters] Additional parameters to pass to the WMS server in the GetFeatureInfo URL. + * @property {Boolean} [enablePickFeatures=true] If true, {@link WebMapServiceImageryProvider#pickFeatures} will invoke * the GetFeatureInfo operation on the WMS server and return the features included in the response. If false, * {@link WebMapServiceImageryProvider#pickFeatures} will immediately return undefined (indicating no pickable features) * without communicating with the server. Set this property to false if you know your WMS server does not support * GetFeatureInfo or if you don't want this provider's features to be pickable. Note that this can be dynamically * overridden by modifying the WebMapServiceImageryProvider#enablePickFeatures property. - * @param {GetFeatureInfoFormat[]} [options.getFeatureInfoFormats=WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats] The formats + * @property {GetFeatureInfoFormat[]} [getFeatureInfoFormats=WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats] The formats * in which to try WMS GetFeatureInfo requests. - * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle of the layer. - * @param {TilingScheme} [options.tilingScheme=new GeographicTilingScheme()] The tiling scheme to use to divide the world into tiles. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If the tilingScheme is specified, + * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle of the layer. + * @property {TilingScheme} [tilingScheme=new GeographicTilingScheme()] The tiling scheme to use to divide the world into tiles. + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If the tilingScheme is specified, * this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither * parameter is specified, the WGS84 ellipsoid is used. - * @param {Number} [options.tileWidth=256] The width of each tile in pixels. - * @param {Number} [options.tileHeight=256] The height of each tile in pixels. - * @param {Number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when + * @property {Number} [tileWidth=256] The width of each tile in pixels. + * @property {Number} [tileHeight=256] The height of each tile in pixels. + * @property {Number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when * specifying this that the number of tiles at the minimum level is small, such as four or less. A larger number is * likely to result in rendering problems. - * @param {Number} [options.maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. + * @property {Number} [maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. * If not specified, there is no limit. - * @param {String} [options.crs] CRS specification, for use with WMS specification >= 1.3.0. - * @param {String} [options.srs] SRS specification, for use with WMS specification 1.1.0 or 1.1.1 - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. - * @param {String|String[]} [options.subdomains='abc'] The subdomains to use for the {s} placeholder in the URL template. + * @property {String} [crs] CRS specification, for use with WMS specification >= 1.3.0. + * @property {String} [srs] SRS specification, for use with WMS specification 1.1.0 or 1.1.1 + * @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas. + * @property {String|String[]} [subdomains='abc'] The subdomains to use for the {s} placeholder in the URL template. * If this parameter is a single string, each character in the string is a subdomain. If it is * an array, each element in the array is a subdomain. - * @param {Clock} [options.clock] A Clock instance that is used when determining the value for the time dimension. Required when options.times is specified. - * @param {TimeIntervalCollection} [options.times] TimeIntervalCollection with its data property being an object containing time dynamic dimension and their values. + * @property {Clock} [clock] A Clock instance that is used when determining the value for the time dimension. Required when `times` is specified. + * @property {TimeIntervalCollection} [times] TimeIntervalCollection with its data property being an object containing time dynamic dimension and their values. + */ + +/** + * Provides tiled imagery hosted by a Web Map Service (WMS) server. + * + * @alias WebMapServiceImageryProvider + * @constructor + * + * @param {WebMapServiceImageryProvider.ConstructorOptions} options Object describing initialization options * * @see ArcGisMapServerImageryProvider * @see BingMapsImageryProvider @@ -87,6 +94,92 @@ function WebMapServiceImageryProvider(options) { ); } + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + var resource = Resource.createIfNeeded(options.url); var pickFeatureResource = resource.clone(); @@ -293,7 +386,7 @@ Object.defineProperties(WebMapServiceImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link WebMapServiceImageryProvider#ready} returns true. * @memberof WebMapServiceImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -494,7 +587,7 @@ WebMapServiceImageryProvider.prototype.getTileCredits = function (x, y, level) { * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/WebMapTileServiceImageryProvider.js b/Source/Scene/WebMapTileServiceImageryProvider.js index 54e66417b684..2b3c14755ca6 100644 --- a/Source/Scene/WebMapTileServiceImageryProvider.js +++ b/Source/Scene/WebMapTileServiceImageryProvider.js @@ -17,6 +17,33 @@ var defaultParameters = Object.freeze({ request: "GetTile", }); +/** + * @typedef {Object} WebMapTileServiceImageryProvider.ConstructorOptions + * + * Initialization options for the WebMapTileServiceImageryProvider constructor + * + * @property {Resource|String} url The base URL for the WMTS GetTile operation (for KVP-encoded requests) or the tile-URL template (for RESTful requests). The tile-URL template should contain the following variables: {style}, {TileMatrixSet}, {TileMatrix}, {TileRow}, {TileCol}. The first two are optional if actual values are hardcoded or not required by the server. The {s} keyword may be used to specify subdomains. + * @property {String} [format='image/jpeg'] The MIME type for images to retrieve from the server. + * @property {String} layer The layer name for WMTS requests. + * @property {String} style The style name for WMTS requests. + * @property {String} tileMatrixSetID The identifier of the TileMatrixSet to use for WMTS requests. + * @property {Array} [tileMatrixLabels] A list of identifiers in the TileMatrix to use for WMTS requests, one per TileMatrix level. + * @property {Clock} [clock] A Clock instance that is used when determining the value for the time dimension. Required when `times` is specified. + * @property {TimeIntervalCollection} [times] TimeIntervalCollection with its data property being an object containing time dynamic dimension and their values. + * @property {Object} [dimensions] A object containing static dimensions and their values. + * @property {Number} [tileWidth=256] The tile width in pixels. + * @property {Number} [tileHeight=256] The tile height in pixels. + * @property {TilingScheme} [tilingScheme] The tiling scheme corresponding to the organization of the tiles in the TileMatrixSet. + * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle covered by the layer. + * @property {Number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. + * @property {Number} [maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. + * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. + * @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas. + * @property {String|String[]} [subdomains='abc'] The subdomains to use for the {s} placeholder in the URL template. + * If this parameter is a single string, each character in the string is a subdomain. If it is + * an array, each element in the array is a subdomain. + */ + /** * Provides tiled imagery served by {@link http://www.opengeospatial.org/standards/wmts|WMTS 1.0.0} compliant servers. * This provider supports HTTP KVP-encoded and RESTful GetTile requests, but does not yet support the SOAP encoding. @@ -24,27 +51,7 @@ var defaultParameters = Object.freeze({ * @alias WebMapTileServiceImageryProvider * @constructor * - * @param {Object} options Object with the following properties: - * @param {Resource|String} options.url The base URL for the WMTS GetTile operation (for KVP-encoded requests) or the tile-URL template (for RESTful requests). The tile-URL template should contain the following variables: {style}, {TileMatrixSet}, {TileMatrix}, {TileRow}, {TileCol}. The first two are optional if actual values are hardcoded or not required by the server. The {s} keyword may be used to specify subdomains. - * @param {String} [options.format='image/jpeg'] The MIME type for images to retrieve from the server. - * @param {String} options.layer The layer name for WMTS requests. - * @param {String} options.style The style name for WMTS requests. - * @param {String} options.tileMatrixSetID The identifier of the TileMatrixSet to use for WMTS requests. - * @param {Array} [options.tileMatrixLabels] A list of identifiers in the TileMatrix to use for WMTS requests, one per TileMatrix level. - * @param {Clock} [options.clock] A Clock instance that is used when determining the value for the time dimension. Required when options.times is specified. - * @param {TimeIntervalCollection} [options.times] TimeIntervalCollection with its data property being an object containing time dynamic dimension and their values. - * @param {Object} [options.dimensions] A object containing static dimensions and their values. - * @param {Number} [options.tileWidth=256] The tile width in pixels. - * @param {Number} [options.tileHeight=256] The tile height in pixels. - * @param {TilingScheme} [options.tilingScheme] The tiling scheme corresponding to the organization of the tiles in the TileMatrixSet. - * @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle covered by the layer. - * @param {Number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. - * @param {Number} [options.maximumLevel] The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. - * @param {Ellipsoid} [options.ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used. - * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas. - * @param {String|String[]} [options.subdomains='abc'] The subdomains to use for the {s} placeholder in the URL template. - * If this parameter is a single string, each character in the string is a subdomain. If it is - * an array, each element in the array is a subdomain. + * @param {WebMapTileServiceImageryProvider.ConstructorOptions} options Object describing initialization options * * @demo {@link https://sandcastle.cesium.com/index.html?src=Web%20Map%20Tile%20Service%20with%20Time.html|Cesium Sandcastle Web Map Tile Service with Time Demo} * @@ -130,6 +137,92 @@ function WebMapTileServiceImageryProvider(options) { } //>>includeEnd('debug'); + /** + * The default alpha blending value of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultAlpha = undefined; + + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultDayAlpha = undefined; + + /** + * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 + * makes the imagery darker while greater than 1.0 makes it brighter. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultBrightness = undefined; + + /** + * The default contrast of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces + * the contrast while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultContrast = undefined; + + /** + * The default hue of this provider in radians. 0.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultHue = undefined; + + /** + * The default saturation of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the + * saturation while greater than 1.0 increases it. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultSaturation = undefined; + + /** + * The default gamma correction to apply to this provider. 1.0 uses the unmodified imagery color. + * + * @type {Number|undefined} + * @default undefined + */ + this.defaultGamma = undefined; + + /** + * The default texture minification filter to apply to this provider. + * + * @type {TextureMinificationFilter} + * @default undefined + */ + this.defaultMinificationFilter = undefined; + + /** + * The default texture magnification filter to apply to this provider. + * + * @type {TextureMagnificationFilter} + * @default undefined + */ + this.defaultMagnificationFilter = undefined; + var resource = Resource.createIfNeeded(options.url); var style = options.style; @@ -339,7 +432,7 @@ Object.defineProperties(WebMapTileServiceImageryProvider.prototype, { * Gets the maximum level-of-detail that can be requested. This function should * not be called before {@link WebMapTileServiceImageryProvider#ready} returns true. * @memberof WebMapTileServiceImageryProvider.prototype - * @type {Number} + * @type {Number|undefined} * @readonly */ maximumLevel: { @@ -552,7 +645,7 @@ WebMapTileServiceImageryProvider.prototype.getTileCredits = function ( * @param {Number} y The tile Y coordinate. * @param {Number} level The tile level. * @param {Request} [request] The request object. Intended for internal use only. - * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or + * @returns {Promise.|undefined} A promise for the image that will resolve when the image is available, or * undefined if there are too many active requests to the server, and the request * should be retried later. The resolved image may be either an * Image or a Canvas DOM object. diff --git a/Source/Scene/createBillboardPointCallback.js b/Source/Scene/createBillboardPointCallback.js index 24453e9af971..65718192d807 100644 --- a/Source/Scene/createBillboardPointCallback.js +++ b/Source/Scene/createBillboardPointCallback.js @@ -1,12 +1,12 @@ /** - * Creates a {@link createBillboardPointCallback~CanvasFunction} that will create a canvas with a point. + * Creates a {@link createBillboardPointCallback.CanvasFunction} that will create a canvas with a point. * * @param {Number} centerAlpha The alpha of the center of the point. The value must be in the range [0.0, 1.0]. * @param {String} cssColor The CSS color string. * @param {String} cssOutlineColor The CSS color of the point outline. * @param {Number} cssOutlineWidth The width of the outline in pixels. * @param {Number} pixelSize The size of the point in pixels. - * @return {createBillboardPointCallback~CanvasFunction} The function that will return a canvas with the point drawn on it. + * @return {createBillboardPointCallback.CanvasFunction} The function that will return a canvas with the point drawn on it. * * @private */ @@ -64,7 +64,7 @@ function createBillboardPointCallback( /** * A function that returns a canvas containing an image of a point. - * @callback createBillboardPointCallback~CanvasFunction + * @callback createBillboardPointCallback.CanvasFunction * @returns {HTMLCanvasElement} The result of the calculation. */ export default createBillboardPointCallback; diff --git a/Source/Scene/createOsmBuildings.js b/Source/Scene/createOsmBuildings.js index a692281fae11..d515ac6a4dd3 100644 --- a/Source/Scene/createOsmBuildings.js +++ b/Source/Scene/createOsmBuildings.js @@ -8,19 +8,19 @@ import Cesium3DTileStyle from "./Cesium3DTileStyle.js"; /** * Creates a {@link Cesium3DTileset} instance for the - * {@link https://cesium.com/content/#cesium-osm-buildings|Cesium OSM Buildings} + * {@link https://cesium.com/content/cesium-osm-buildings/|Cesium OSM Buildings} * tileset. * - * @exports createOsmBuildings + * @function * * @param {Object} [options] Construction options. Any options allowed by the {@link Cesium3DTileset} constructor * may be specified here. In addition to those, the following properties are supported: * @param {Color} [options.defaultColor=Color.WHITE] The default color to use for buildings - * that do not have a color. This parameter is ignored if `options.style` is specified. + * that do not have a color. This parameter is ignored if options.style is specified. * @param {Cesium3DTileStyle} [options.style] The style to use with the tileset. If not * specified, a default style is used which gives each building or building part a - * color inferred from its OpenStreetMap `tags`. If no color can be inferred, - * `options.defaultColor` is used. + * color inferred from its OpenStreetMap tags. If no color can be inferred, + * options.defaultColor is used. * @returns {Cesium3DTileset} * * @see Ion diff --git a/Source/Scene/createTangentSpaceDebugPrimitive.js b/Source/Scene/createTangentSpaceDebugPrimitive.js index fe809e7c1163..78f6436322f8 100644 --- a/Source/Scene/createTangentSpaceDebugPrimitive.js +++ b/Source/Scene/createTangentSpaceDebugPrimitive.js @@ -14,7 +14,7 @@ import Primitive from "./Primitive.js"; * is red; tangent is green; and bitangent is blue. If an attribute is not * present, it is not drawn. * - * @exports createTangentSpaceDebugPrimitive + * @function * * @param {Object} options Object with the following properties: * @param {Geometry} options.geometry The Geometry instance with the attribute. diff --git a/Source/Scene/createWorldImagery.js b/Source/Scene/createWorldImagery.js index bb00d364a3be..460d4c7ffeaa 100644 --- a/Source/Scene/createWorldImagery.js +++ b/Source/Scene/createWorldImagery.js @@ -5,7 +5,7 @@ import IonWorldImageryStyle from "./IonWorldImageryStyle.js"; /** * Creates an {@link IonImageryProvider} instance for ion's default global base imagery layer, currently Bing Maps. * - * @exports createWorldImagery + * @function * * @param {Object} [options] Object with the following properties: * @param {IonWorldImageryStyle} [options.style=IonWorldImageryStyle] The style of base imagery, only AERIAL, AERIAL_WITH_LABELS, and ROAD are currently supported. diff --git a/Source/Scene/processModelMaterialsCommon.js b/Source/Scene/processModelMaterialsCommon.js index 03832771b990..5ce0bf0f226a 100644 --- a/Source/Scene/processModelMaterialsCommon.js +++ b/Source/Scene/processModelMaterialsCommon.js @@ -5,7 +5,6 @@ import webGLConstantToGlslType from "../Core/webGLConstantToGlslType.js"; import addToArray from "../ThirdParty/GltfPipeline/addToArray.js"; import ForEach from "../ThirdParty/GltfPipeline/ForEach.js"; import hasExtension from "../ThirdParty/GltfPipeline/hasExtension.js"; -import numberOfComponentsForType from "../ThirdParty/GltfPipeline/numberOfComponentsForType.js"; import ModelUtility from "./ModelUtility.js"; /** @@ -389,44 +388,12 @@ function generateTechnique( // Add attributes with semantics var vertexShaderMain = ""; if (hasSkinning) { - var i, j; - var numberOfComponents = numberOfComponentsForType(skinningInfo.type); - var matrix = false; - if (skinningInfo.type.indexOf("MAT") === 0) { - matrix = true; - numberOfComponents = Math.sqrt(numberOfComponents); - } - if (!matrix) { - for (i = 0; i < numberOfComponents; i++) { - if (i === 0) { - vertexShaderMain += " mat4 skinMat = "; - } else { - vertexShaderMain += " skinMat += "; - } - vertexShaderMain += - "a_weight[" + i + "] * u_jointMatrix[int(a_joint[" + i + "])];\n"; - } - } else { - for (i = 0; i < numberOfComponents; i++) { - for (j = 0; j < numberOfComponents; j++) { - if (i === 0 && j === 0) { - vertexShaderMain += " mat4 skinMat = "; - } else { - vertexShaderMain += " skinMat += "; - } - vertexShaderMain += - "a_weight[" + - i + - "][" + - j + - "] * u_jointMatrix[int(a_joint[" + - i + - "][" + - j + - "])];\n"; - } - } - } + vertexShaderMain += + " mat4 skinMatrix =\n" + + " a_weight.x * u_jointMatrix[int(a_joint.x)] +\n" + + " a_weight.y * u_jointMatrix[int(a_joint.y)] +\n" + + " a_weight.z * u_jointMatrix[int(a_joint.z)] +\n" + + " a_weight.w * u_jointMatrix[int(a_joint.w)];\n"; } // Add position always @@ -439,7 +406,7 @@ function generateTechnique( vertexShader += "varying vec3 v_positionEC;\n"; if (hasSkinning) { vertexShaderMain += - " vec4 pos = u_modelViewMatrix * skinMat * vec4(a_position,1.0);\n"; + " vec4 pos = u_modelViewMatrix * skinMatrix * vec4(a_position,1.0);\n"; } else { vertexShaderMain += " vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n"; @@ -457,7 +424,7 @@ function generateTechnique( vertexShader += "varying vec3 v_normal;\n"; if (hasSkinning) { vertexShaderMain += - " v_normal = u_normalMatrix * mat3(skinMat) * a_normal;\n"; + " v_normal = u_normalMatrix * mat3(skinMatrix) * a_normal;\n"; } else { vertexShaderMain += " v_normal = u_normalMatrix * a_normal;\n"; } @@ -481,16 +448,15 @@ function generateTechnique( } if (hasSkinning) { - var attributeType = ModelUtility.getShaderVariable(skinningInfo.type); techniqueAttributes.a_joint = { - semantic: "JOINT", + semantic: "JOINTS_0", }; techniqueAttributes.a_weight = { - semantic: "WEIGHT", + semantic: "WEIGHTS_0", }; - vertexShader += "attribute " + attributeType + " a_joint;\n"; - vertexShader += "attribute " + attributeType + " a_weight;\n"; + vertexShader += "attribute vec4 a_joint;\n"; + vertexShader += "attribute vec4 a_weight;\n"; } if (hasVertexColors) { @@ -676,8 +642,7 @@ function generateTechnique( if (hasNormals) { fragmentShader += " vec3 normal = normalize(v_normal);\n"; if (khrMaterialsCommon.doubleSided) { - // !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/CesiumGS/cesium/pull/8494. - fragmentShader += " if (gl_FrontFacing == false)\n"; + fragmentShader += " if (czm_backFacing())\n"; fragmentShader += " {\n"; fragmentShader += " normal = -normal;\n"; fragmentShader += " }\n"; diff --git a/Source/Scene/processPbrMaterials.js b/Source/Scene/processPbrMaterials.js index b38298c42d59..163ee5731a55 100644 --- a/Source/Scene/processPbrMaterials.js +++ b/Source/Scene/processPbrMaterials.js @@ -5,7 +5,6 @@ import webGLConstantToGlslType from "../Core/webGLConstantToGlslType.js"; import addToArray from "../ThirdParty/GltfPipeline/addToArray.js"; import ForEach from "../ThirdParty/GltfPipeline/ForEach.js"; import hasExtension from "../ThirdParty/GltfPipeline/hasExtension.js"; -import numberOfComponentsForType from "../ThirdParty/GltfPipeline/numberOfComponentsForType.js"; import ModelUtility from "./ModelUtility.js"; /** @@ -374,44 +373,12 @@ function generateTechnique( // Add attributes with semantics var vertexShaderMain = ""; if (hasSkinning) { - var i, j; - var numberOfComponents = numberOfComponentsForType(skinningInfo.type); - var matrix = false; - if (skinningInfo.type.indexOf("MAT") === 0) { - matrix = true; - numberOfComponents = Math.sqrt(numberOfComponents); - } - if (!matrix) { - for (i = 0; i < numberOfComponents; i++) { - if (i === 0) { - vertexShaderMain += " mat4 skinMatrix = "; - } else { - vertexShaderMain += " skinMatrix += "; - } - vertexShaderMain += - "a_weight[" + i + "] * u_jointMatrix[int(a_joint[" + i + "])];\n"; - } - } else { - for (i = 0; i < numberOfComponents; i++) { - for (j = 0; j < numberOfComponents; j++) { - if (i === 0 && j === 0) { - vertexShaderMain += " mat4 skinMatrix = "; - } else { - vertexShaderMain += " skinMatrix += "; - } - vertexShaderMain += - "a_weight[" + - i + - "][" + - j + - "] * u_jointMatrix[int(a_joint[" + - i + - "][" + - j + - "])];\n"; - } - } - } + vertexShaderMain += + " mat4 skinMatrix =\n" + + " a_weight.x * u_jointMatrix[int(a_joint.x)] +\n" + + " a_weight.y * u_jointMatrix[int(a_joint.y)] +\n" + + " a_weight.z * u_jointMatrix[int(a_joint.z)] +\n" + + " a_weight.w * u_jointMatrix[int(a_joint.w)];\n"; } // Add position always @@ -619,7 +586,6 @@ function generateTechnique( // Add skinning information if available if (hasSkinning) { - var attributeType = ModelUtility.getShaderVariable(skinningInfo.type); techniqueAttributes.a_joint = { semantic: "JOINTS_0", }; @@ -627,8 +593,8 @@ function generateTechnique( semantic: "WEIGHTS_0", }; - vertexShader += "attribute " + attributeType + " a_joint;\n"; - vertexShader += "attribute " + attributeType + " a_weight;\n"; + vertexShader += "attribute vec4 a_joint;\n"; + vertexShader += "attribute vec4 a_weight;\n"; } if (hasVertexColors) { @@ -801,8 +767,7 @@ function generateTechnique( fragmentShader += " vec3 n = ng;\n"; } if (material.doubleSided) { - // !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/CesiumGS/cesium/pull/8494. - fragmentShader += " if (gl_FrontFacing == false)\n"; + fragmentShader += " if (czm_backFacing())\n"; fragmentShader += " {\n"; fragmentShader += " n = -n;\n"; fragmentShader += " }\n"; diff --git a/Source/Shaders/Builtin/Functions/backFacing.glsl b/Source/Shaders/Builtin/Functions/backFacing.glsl new file mode 100644 index 000000000000..701244a81546 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/backFacing.glsl @@ -0,0 +1,13 @@ +/** + * Determines if the fragment is back facing + * + * @name czm_backFacing + * @glslFunction + * + * @returns {bool} true if the fragment is back facing; otherwise, false. + */ +bool czm_backFacing() +{ + // !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/CesiumGS/cesium/pull/8494. + return gl_FrontFacing == false; +} diff --git a/Source/Shaders/Builtin/Functions/depthClamp.glsl b/Source/Shaders/Builtin/Functions/depthClamp.glsl new file mode 100644 index 000000000000..f83356a1b56d --- /dev/null +++ b/Source/Shaders/Builtin/Functions/depthClamp.glsl @@ -0,0 +1,27 @@ +// emulated noperspective +#ifndef LOG_DEPTH +varying float v_WindowZ; +#endif + +/** + * Clamps a vertex to the near and far planes. + * + * @name czm_depthClamp + * @glslFunction + * + * @param {vec4} coords The vertex in clip coordinates. + * @returns {vec4} The vertex clipped to the near and far planes. + * + * @example + * gl_Position = czm_depthClamp(czm_modelViewProjection * vec4(position, 1.0)); + * + * @see czm_writeDepthClamp + */ +vec4 czm_depthClamp(vec4 coords) +{ +#ifndef LOG_DEPTH + v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w; + coords.z = clamp(coords.z, -coords.w, +coords.w); +#endif + return coords; +} diff --git a/Source/Shaders/Builtin/Functions/depthClampFarPlane.glsl b/Source/Shaders/Builtin/Functions/depthClampFarPlane.glsl deleted file mode 100644 index bec295024033..000000000000 --- a/Source/Shaders/Builtin/Functions/depthClampFarPlane.glsl +++ /dev/null @@ -1,27 +0,0 @@ -// emulated noperspective -#ifndef LOG_DEPTH -varying float v_WindowZ; -#endif - -/** - * Clamps a vertex to the far plane. - * - * @name czm_depthClampFarPlane - * @glslFunction - * - * @param {vec4} coords The vertex in clip coordinates. - * @returns {vec4} The vertex clipped to the far plane. - * - * @example - * gl_Position = czm_depthClampFarPlane(czm_modelViewProjection * vec4(position, 1.0)); - * - * @see czm_writeDepthClampedToFarPlane - */ -vec4 czm_depthClampFarPlane(vec4 coords) -{ -#ifndef LOG_DEPTH - v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w; - coords.z = min(coords.z, coords.w); -#endif - return coords; -} diff --git a/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.glsl b/Source/Shaders/Builtin/Functions/writeDepthClamp.glsl similarity index 62% rename from Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.glsl rename to Source/Shaders/Builtin/Functions/writeDepthClamp.glsl index bf8cf3209b45..9006fe0a1c99 100644 --- a/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.glsl +++ b/Source/Shaders/Builtin/Functions/writeDepthClamp.glsl @@ -8,18 +8,18 @@ varying float v_WindowZ; * The shader must enable the GL_EXT_frag_depth extension. *

      * - * @name czm_writeDepthClampedToFarPlane + * @name czm_writeDepthClamp * @glslFunction * * @example * gl_FragColor = color; - * czm_writeDepthClampedToFarPlane(); + * czm_writeDepthClamp(); * - * @see czm_depthClampFarPlane + * @see czm_depthClamp */ -void czm_writeDepthClampedToFarPlane() +void czm_writeDepthClamp() { #if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH) - gl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0); + gl_FragDepthEXT = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0); #endif } diff --git a/Source/Shaders/DepthPlaneFS.glsl b/Source/Shaders/DepthPlaneFS.glsl index 10c3ca2a0722..c6a9602ca1eb 100644 --- a/Source/Shaders/DepthPlaneFS.glsl +++ b/Source/Shaders/DepthPlaneFS.glsl @@ -2,8 +2,23 @@ varying vec4 positionEC; void main() { - vec3 direction = normalize(positionEC.xyz); - czm_ray ray = czm_ray(vec3(0.0), direction); + vec3 position; + vec3 direction; + if (czm_orthographicIn3D == 1.0) + { + vec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw; + vec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y); // left, bottom + vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x); // right, top + position = vec3(mix(minPlane, maxPlane, uv), 0.0); + direction = vec3(0.0, 0.0, -1.0); + } + else + { + position = vec3(0.0); + direction = normalize(positionEC.xyz); + } + + czm_ray ray = czm_ray(position, direction); vec3 ellipsoid_center = czm_view[3].xyz; diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index 2485ade22955..10a5c29fc3f4 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -9,6 +9,11 @@ uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS]; uniform float u_dayTextureAlpha[TEXTURE_UNITS]; #endif +#ifdef APPLY_DAY_NIGHT_ALPHA +uniform float u_dayTextureNightAlpha[TEXTURE_UNITS]; +uniform float u_dayTextureDayAlpha[TEXTURE_UNITS]; +#endif + #ifdef APPLY_SPLIT uniform float u_dayTextureSplit[TEXTURE_UNITS]; #endif @@ -84,6 +89,17 @@ uniform vec3 u_hsbShift; // Hue, saturation, brightness uniform vec4 u_fillHighlightColor; #endif +#ifdef TRANSLUCENT +uniform vec4 u_frontFaceAlphaByDistance; +uniform vec4 u_backFaceAlphaByDistance; +uniform vec4 u_translucencyRectangle; +#endif + +#ifdef UNDERGROUND_COLOR +uniform vec4 u_undergroundColor; +uniform vec4 u_undergroundColorAlphaByDistance; +#endif + varying vec3 v_positionMC; varying vec3 v_positionEC; varying vec3 v_textureCoordinates; @@ -96,8 +112,11 @@ varying float v_slope; varying float v_aspect; #endif -#if defined(FOG) || defined(GROUND_ATMOSPHERE) +#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) varying float v_distance; +#endif + +#if defined(FOG) || defined(GROUND_ATMOSPHERE) varying vec3 v_fogRayleighColor; varying vec3 v_fogMieColor; #endif @@ -107,6 +126,36 @@ varying vec3 v_rayleighColor; varying vec3 v_mieColor; #endif +#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) +float interpolateByDistance(vec4 nearFarScalar, float distance) +{ + float startDistance = nearFarScalar.x; + float startValue = nearFarScalar.y; + float endDistance = nearFarScalar.z; + float endValue = nearFarScalar.w; + float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0); + return mix(startValue, endValue, t); +} +#endif + +#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL) +vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor) +{ + return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a); +} +#endif + +#ifdef TRANSLUCENT +bool inTranslucencyRectangle() +{ + return + v_textureCoordinates.x > u_translucencyRectangle.x && + v_textureCoordinates.x < u_translucencyRectangle.z && + v_textureCoordinates.y > u_translucencyRectangle.y && + v_textureCoordinates.y < u_translucencyRectangle.w; +} +#endif + vec4 sampleAndBlend( vec4 previousColor, sampler2D textureToSample, @@ -114,13 +163,16 @@ vec4 sampleAndBlend( vec4 textureCoordinateRectangle, vec4 textureCoordinateTranslationAndScale, float textureAlpha, + float textureNightAlpha, + float textureDayAlpha, float textureBrightness, float textureContrast, float textureHue, float textureSaturation, float textureOneOverGamma, float split, - vec4 colorToAlpha) + vec4 colorToAlpha, + float nightBlend) { // This crazy step stuff sets the alpha to 0.0 if this following condition is true: // tileTextureCoordinates.s < textureCoordinateRectangle.s || @@ -135,6 +187,10 @@ vec4 sampleAndBlend( alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates); textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y; +#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING) + textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend); +#endif + vec2 translation = textureCoordinateTranslationAndScale.xy; vec2 scale = textureCoordinateTranslationAndScale.zw; vec2 textureCoordinates = tileTextureCoordinates * scale + translation; @@ -225,9 +281,15 @@ vec3 colorCorrect(vec3 rgb) { return rgb; } -vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates); +vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend); vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade); +#ifdef GROUND_ATMOSPHERE +vec3 computeGroundAtmosphereColor(vec3 fogColor, vec4 finalColor, vec3 atmosphereLightDirection, float cameraDist); +#endif + +const float fExposure = 2.0; + void main() { #ifdef TILE_LIMIT_RECTANGLE @@ -242,11 +304,22 @@ void main() float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix); #endif +#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR) + vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates + vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordiantes +#endif + +#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING) + float nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0); +#else + float nightBlend = 0.0; +#endif + // The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0 // where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the // fragments on the edges of tiles even though the vertex shader is outputting // coordinates strictly in the 0-1 range. - vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0)); + vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend); #ifdef SHOW_TILE_BOUNDARIES if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) || @@ -256,11 +329,6 @@ void main() } #endif -#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR) - vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates - vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordiantes -#endif - #if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE) float cameraDist; if (czm_sceneMode == czm_sceneMode2D) @@ -317,7 +385,8 @@ void main() materialInput.height = v_height; materialInput.aspect = v_aspect; czm_material material = czm_getMaterial(materialInput); - color.xyz = mix(color.xyz, material.diffuse, material.alpha); + vec4 materialColor = vec4(material.diffuse, material.alpha); + color = alphaBlend(materialColor, color); #endif #ifdef ENABLE_VERTEX_LIGHTING @@ -349,7 +418,6 @@ void main() #if defined(FOG) || defined(GROUND_ATMOSPHERE) vec3 fogColor = colorCorrect(v_fogMieColor) + finalColor.rgb * colorCorrect(v_fogRayleighColor); #ifndef HDR - const float fExposure = 2.0; fogColor = vec3(1.0) - exp(-fExposure * fogColor); #endif #endif @@ -375,12 +443,38 @@ void main() #endif #ifdef GROUND_ATMOSPHERE - if (czm_sceneMode != czm_sceneMode3D) + if (!czm_backFacing()) { - gl_FragColor = finalColor; - return; + vec3 groundAtmosphereColor = computeGroundAtmosphereColor(fogColor, finalColor, atmosphereLightDirection, cameraDist); + finalColor = vec4(mix(finalColor.rgb, groundAtmosphereColor, fade), finalColor.a); } +#endif +#ifdef UNDERGROUND_COLOR + if (czm_backFacing()) + { + float distanceFromEllipsoid = max(czm_eyeHeight, 0.0); + float distance = max(v_distance - distanceFromEllipsoid, 0.0); + float blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance); + vec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount); + finalColor = alphaBlend(undergroundColor, finalColor); + } +#endif + +#ifdef TRANSLUCENT + if (inTranslucencyRectangle()) + { + vec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance; + finalColor.a *= interpolateByDistance(alphaByDistance, v_distance); + } +#endif + + gl_FragColor = finalColor; +} + +#ifdef GROUND_ATMOSPHERE +vec3 computeGroundAtmosphereColor(vec3 fogColor, vec4 finalColor, vec3 atmosphereLightDirection, float cameraDist) +{ #if defined(PER_FRAGMENT_GROUND_ATMOSPHERE) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING)) float mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0); vec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0); @@ -402,8 +496,8 @@ void main() groundAtmosphereColor = vec3(1.0) - exp(-fExposure * groundAtmosphereColor); #endif - fadeInDist = u_nightFadeDistance.x; - fadeOutDist = u_nightFadeDistance.y; + float fadeInDist = u_nightFadeDistance.x; + float fadeOutDist = u_nightFadeDistance.y; float sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0); @@ -422,11 +516,9 @@ void main() groundAtmosphereColor = czm_saturation(groundAtmosphereColor, 1.6); #endif - finalColor = vec4(mix(finalColor.rgb, groundAtmosphereColor, fade), finalColor.a); -#endif - - gl_FragColor = finalColor; + return groundAtmosphereColor; } +#endif #ifdef SHOW_REFLECTIVE_OCEAN diff --git a/Source/Shaders/GlobeVS.glsl b/Source/Shaders/GlobeVS.glsl index c0d6aa757d5d..e233638f8008 100644 --- a/Source/Shaders/GlobeVS.glsl +++ b/Source/Shaders/GlobeVS.glsl @@ -28,8 +28,11 @@ varying float v_aspect; varying float v_height; #endif -#if defined(FOG) || defined(GROUND_ATMOSPHERE) +#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) varying float v_distance; +#endif + +#if defined(FOG) || defined(GROUND_ATMOSPHERE) varying vec3 v_fogMieColor; varying vec3 v_fogRayleighColor; #endif @@ -172,6 +175,9 @@ void main() AtmosphereColor atmosFogColor = computeGroundAtmosphereFromSpace(position3DWC, false, vec3(0.0)); v_fogMieColor = atmosFogColor.mie; v_fogRayleighColor = atmosFogColor.rayleigh; +#endif + +#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz); #endif diff --git a/Source/Shaders/PolylineShadowVolumeFS.glsl b/Source/Shaders/PolylineShadowVolumeFS.glsl index d8b65a80fd0e..b571272aa339 100644 --- a/Source/Shaders/PolylineShadowVolumeFS.glsl +++ b/Source/Shaders/PolylineShadowVolumeFS.glsl @@ -83,5 +83,8 @@ void main(void) gl_FragColor = vec4(material.diffuse + material.emission, material.alpha); #endif // PER_INSTANCE_COLOR - czm_writeDepthClampedToFarPlane(); + // Premultiply alpha. Required for classification primitives on translucent globe. + gl_FragColor.rgb *= gl_FragColor.a; + + czm_writeDepthClamp(); } diff --git a/Source/Shaders/PolylineShadowVolumeVS.glsl b/Source/Shaders/PolylineShadowVolumeVS.glsl index 9d17be9312d2..61c9f04ed625 100644 --- a/Source/Shaders/PolylineShadowVolumeVS.glsl +++ b/Source/Shaders/PolylineShadowVolumeVS.glsl @@ -157,7 +157,7 @@ void main() #endif positionEC.xyz += width * normalEC; - gl_Position = czm_depthClampFarPlane(czm_projection * positionEC); + gl_Position = czm_depthClamp(czm_projection * positionEC); #ifdef ANGLE_VARYING // Approximate relative screen space direction of the line. diff --git a/Source/Shaders/ShadowVolumeAppearanceFS.glsl b/Source/Shaders/ShadowVolumeAppearanceFS.glsl index 1231a8b0cbae..51496c9ccf8c 100644 --- a/Source/Shaders/ShadowVolumeAppearanceFS.glsl +++ b/Source/Shaders/ShadowVolumeAppearanceFS.glsl @@ -73,7 +73,7 @@ void main(void) #ifdef CULL_FRAGMENTS if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0) { gl_FragColor.a = 1.0; // 0.0 alpha leads to discard from ShaderSource.createPickFragmentShaderSource - czm_writeDepthClampedToFarPlane(); + czm_writeDepthClamp(); } #else // CULL_FRAGMENTS gl_FragColor.a = 1.0; @@ -110,6 +110,9 @@ void main(void) gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC); #endif // FLAT + // Premultiply alpha. Required for classification primitives on translucent globe. + gl_FragColor.rgb *= gl_FragColor.a; + #else // PER_INSTANCE_COLOR // Material support. @@ -146,7 +149,10 @@ void main(void) gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC); #endif // FLAT + // Premultiply alpha. Required for classification primitives on translucent globe. + gl_FragColor.rgb *= gl_FragColor.a; + #endif // PER_INSTANCE_COLOR - czm_writeDepthClampedToFarPlane(); + czm_writeDepthClamp(); #endif // PICK } diff --git a/Source/Shaders/ShadowVolumeAppearanceVS.glsl b/Source/Shaders/ShadowVolumeAppearanceVS.glsl index 0f2b1c456a3b..8938a0447469 100644 --- a/Source/Shaders/ShadowVolumeAppearanceVS.glsl +++ b/Source/Shaders/ShadowVolumeAppearanceVS.glsl @@ -97,5 +97,5 @@ void main() v_color = czm_batchTable_color(batchId); #endif - gl_Position = czm_depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position); + gl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position); } diff --git a/Source/Shaders/ShadowVolumeFS.glsl b/Source/Shaders/ShadowVolumeFS.glsl index b1af3c3ff493..267d55b6fa87 100644 --- a/Source/Shaders/ShadowVolumeFS.glsl +++ b/Source/Shaders/ShadowVolumeFS.glsl @@ -13,5 +13,5 @@ void main(void) #else gl_FragColor = vec4(1.0); #endif - czm_writeDepthClampedToFarPlane(); + czm_writeDepthClamp(); } diff --git a/Source/Shaders/SkyAtmosphereCommon.glsl b/Source/Shaders/SkyAtmosphereCommon.glsl new file mode 100644 index 000000000000..53e4ec271140 --- /dev/null +++ b/Source/Shaders/SkyAtmosphereCommon.glsl @@ -0,0 +1,287 @@ +/** + * @license + * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the project nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Modifications made by Cesium GS, Inc. + */ + + // Code: http://sponeil.net/ + // GPU Gems 2 Article: https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter16.html + +const float Kr = 0.0025; +const float Kr4PI = Kr * 4.0 * czm_pi; +const float Km = 0.0015; +const float Km4PI = Km * 4.0 * czm_pi; +const float ESun = 15.0; +const float KmESun = Km * ESun; +const float KrESun = Kr * ESun; +const vec3 InvWavelength = vec3( + 5.60204474633241, // Red = 1.0 / Math.pow(0.650, 4.0) + 9.473284437923038, // Green = 1.0 / Math.pow(0.570, 4.0) + 19.643802610477206); // Blue = 1.0 / Math.pow(0.475, 4.0) +const float rayleighScaleDepth = 0.25; + +const int nSamples = 2; +const float fSamples = 2.0; + +const float g = -0.95; +const float g2 = g * g; + +#ifdef COLOR_CORRECT +uniform vec3 u_hsbShift; // Hue, saturation, brightness +#endif + +uniform vec3 u_radiiAndDynamicAtmosphereColor; // outer radius, inner radius, dynamic atmosphere color flag + +float scale(float cosAngle) +{ + float x = 1.0 - cosAngle; + return rayleighScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25)))); +} + +vec3 getLightDirection(vec3 positionWC) +{ + float lightEnum = u_radiiAndDynamicAtmosphereColor.z; + vec3 lightDirection = + positionWC * float(lightEnum == 0.0) + + czm_lightDirectionWC * float(lightEnum == 1.0) + + czm_sunDirectionWC * float(lightEnum == 2.0); + return normalize(lightDirection); +} + +void calculateRayScatteringFromSpace(in vec3 positionWC, in vec3 ray, in float innerRadius, in float outerRadius, inout float far, out vec3 start, out float startOffset) +{ + // Calculate the closest intersection of the ray with the outer atmosphere (which is the near point of the ray passing through the atmosphere) + float cameraHeight = length(positionWC); + float B = 2.0 * dot(positionWC, ray); + float C = cameraHeight * cameraHeight - outerRadius * outerRadius; + float det = max(0.0, B * B - 4.0 * C); + float near = 0.5 * (-B - sqrt(det)); + + // Calculate the ray's starting position, then calculate its scattering offset + start = positionWC + ray * near; + far -= near; + float startAngle = dot(ray, start) / outerRadius; + float startDepth = exp(-1.0 / rayleighScaleDepth); + startOffset = startDepth * scale(startAngle); +} + +void calculateRayScatteringFromGround(in vec3 positionWC, in vec3 ray, in float atmosphereScale, in float innerRadius, out vec3 start, out float startOffset) +{ + // Calculate the ray's starting position, then calculate its scattering offset + float cameraHeight = length(positionWC); + start = positionWC; + float height = length(start); + float depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - cameraHeight)); + float startAngle = dot(ray, start) / height; + startOffset = depth*scale(startAngle); +} + +czm_raySegment rayEllipsoidIntersection(czm_ray ray, vec3 inverseRadii) +{ + vec3 o = inverseRadii * (czm_inverseView * vec4(ray.origin, 1.0)).xyz; + vec3 d = inverseRadii * (czm_inverseView * vec4(ray.direction, 0.0)).xyz; + + float a = dot(d, d); + float b = dot(d, o); + float c = dot(o, o) - 1.0; + float discriminant = b * b - a * c; + if (discriminant < 0.0) + { + return czm_emptyRaySegment; + } + discriminant = sqrt(discriminant); + float t1 = (-b - discriminant) / a; + float t2 = (-b + discriminant) / a; + + if (t1 < 0.0 && t2 < 0.0) + { + return czm_emptyRaySegment; + } + + if (t1 < 0.0 && t2 >= 0.0) + { + t1 = 0.0; + } + + return czm_raySegment(t1, t2); +} + +vec3 getAdjustedPosition(vec3 positionWC, float innerRadius) +{ + // Adjust the camera position so that atmosphere color looks the same wherever the eye height is the same + float cameraHeight = czm_eyeHeight + innerRadius; + return normalize(positionWC) * cameraHeight; +} + +vec3 getTranslucentPosition(vec3 positionWC, vec3 outerPositionWC, float innerRadius, out bool intersectsEllipsoid) +{ + vec3 directionWC = normalize(outerPositionWC - positionWC); + vec3 directionEC = czm_viewRotation * directionWC; + czm_ray viewRay = czm_ray(vec3(0.0), directionEC); + czm_raySegment raySegment = rayEllipsoidIntersection(viewRay, czm_ellipsoidInverseRadii); + intersectsEllipsoid = raySegment.start >= 0.0; + + if (intersectsEllipsoid) + { + return positionWC + raySegment.stop * directionWC; + } + + return getAdjustedPosition(positionWC, innerRadius); +} + +void calculateMieColorAndRayleighColor(vec3 outerPositionWC, out vec3 mieColor, out vec3 rayleighColor) +{ + // Unpack attributes + float outerRadius = u_radiiAndDynamicAtmosphereColor.x; + float innerRadius = u_radiiAndDynamicAtmosphereColor.y; + +#ifdef GLOBE_TRANSLUCENT + bool intersectsEllipsoid = false; + vec3 startPositionWC = getTranslucentPosition(czm_viewerPositionWC, outerPositionWC, innerRadius, intersectsEllipsoid); +#else + vec3 startPositionWC = getAdjustedPosition(czm_viewerPositionWC, innerRadius); +#endif + + vec3 lightDirection = getLightDirection(startPositionWC); + + // Get the ray from the start position to the outer position and its length (which is the far point of the ray passing through the atmosphere) + vec3 ray = outerPositionWC - startPositionWC; + float far = length(ray); + ray /= far; + + float atmosphereScale = 1.0 / (outerRadius - innerRadius); + + vec3 start; + float startOffset; + +#ifdef SKY_FROM_SPACE +#ifdef GLOBE_TRANSLUCENT + if (intersectsEllipsoid) + { + calculateRayScatteringFromGround(startPositionWC, ray, atmosphereScale, innerRadius, start, startOffset); + } + else + { + calculateRayScatteringFromSpace(startPositionWC, ray, innerRadius, outerRadius, far, start, startOffset); + } +#else + calculateRayScatteringFromSpace(startPositionWC, ray, innerRadius, outerRadius, far, start, startOffset); +#endif +#else + calculateRayScatteringFromGround(startPositionWC, ray, atmosphereScale, innerRadius, start, startOffset); +#endif + + // Initialize the scattering loop variables + float sampleLength = far / fSamples; + float scaledLength = sampleLength * atmosphereScale; + vec3 sampleRay = ray * sampleLength; + vec3 samplePoint = start + sampleRay * 0.5; + + // Now loop through the sample rays + vec3 frontColor = vec3(0.0, 0.0, 0.0); + + for (int i = 0; i czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness + // Convert shifted hsb back to rgb + rgb = czm_HSBToRGB(hsb); +#endif + + float outerRadius = u_radiiAndDynamicAtmosphereColor.x; + float innerRadius = u_radiiAndDynamicAtmosphereColor.y; + float lightEnum = u_radiiAndDynamicAtmosphereColor.z; + + float cameraHeight = czm_eyeHeight + innerRadius; + + // Alter alpha based on how close the viewer is to the ground (1.0 = on ground, 0.0 = at edge of atmosphere) + float atmosphereAlpha = clamp((outerRadius - cameraHeight) / (outerRadius - innerRadius), 0.0, 1.0); + + // Alter alpha based on time of day (0.0 = night , 1.0 = day) + float nightAlpha = (lightEnum != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0; + atmosphereAlpha *= pow(nightAlpha, 0.5); + + vec4 finalColor = vec4(rgb, mix(clamp(rgbExposure.b, 0.0, 1.0), 1.0, atmosphereAlpha) * smoothstep(0.0, 1.0, czm_morphTime)); + + if (mieColor.b > 1.0) + { + // Fade atmosphere below the ellipsoid. As the camera zooms further away from the ellipsoid draw + // a larger atmosphere ring to cover empty space of lower LOD globe tiles. + float strength = mieColor.b; + float minDistance = outerRadius; + float maxDistance = outerRadius * 3.0; + float maxStrengthLerp = 1.0 - clamp((maxDistance - cameraHeight) / (maxDistance - minDistance), 0.0, 1.0); + float maxStrength = mix(100.0, 10000.0, maxStrengthLerp); + strength = min(strength, maxStrength); + float alpha = 1.0 - (strength / maxStrength); + finalColor.a = alpha; + } + + return finalColor; +} diff --git a/Source/Shaders/SkyAtmosphereFS.glsl b/Source/Shaders/SkyAtmosphereFS.glsl index 9c5625299b81..b80e54cd43c0 100644 --- a/Source/Shaders/SkyAtmosphereFS.glsl +++ b/Source/Shaders/SkyAtmosphereFS.glsl @@ -1,90 +1,23 @@ -/** - * @license - * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the project nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Modifications made by Analytical Graphics, Inc. - */ +varying vec3 v_outerPositionWC; - // Code: http://sponeil.net/ - // GPU Gems 2 Article: https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter16.html - -#ifdef COLOR_CORRECT -uniform vec3 u_hsbShift; // Hue, saturation, brightness -#endif - -uniform vec4 u_cameraAndRadiiAndDynamicAtmosphereColor; // Camera height, outer radius, inner radius, dynamic atmosphere color flag - -const float g = -0.95; -const float g2 = g * g; - -varying vec3 v_rayleighColor; +#ifndef PER_FRAGMENT_ATMOSPHERE varying vec3 v_mieColor; -varying vec3 v_toCamera; -varying vec3 v_positionEC; +varying vec3 v_rayleighColor; +#endif void main (void) { - float lightEnum = u_cameraAndRadiiAndDynamicAtmosphereColor.w; - vec3 lightDirection = - czm_viewerPositionWC * float(lightEnum == 0.0) + - czm_lightDirectionWC * float(lightEnum == 1.0) + - czm_sunDirectionWC * float(lightEnum == 2.0); - lightDirection = normalize(lightDirection); - - // Extra normalize added for Android - float cosAngle = dot(lightDirection, normalize(v_toCamera)) / length(v_toCamera); - float rayleighPhase = 0.75 * (1.0 + cosAngle * cosAngle); - float miePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + cosAngle * cosAngle) / pow(1.0 + g2 - 2.0 * g * cosAngle, 1.5); - - vec3 rgb = rayleighPhase * v_rayleighColor + miePhase * v_mieColor; - -#ifndef HDR - const float exposure = 2.0; - rgb = vec3(1.0) - exp(-exposure * rgb); + vec3 toCamera = czm_viewerPositionWC - v_outerPositionWC; + vec3 lightDirection = getLightDirection(czm_viewerPositionWC); + vec3 mieColor; + vec3 rayleighColor; + +#ifdef PER_FRAGMENT_ATMOSPHERE + calculateMieColorAndRayleighColor(v_outerPositionWC, mieColor, rayleighColor); +#else + mieColor = v_mieColor; + rayleighColor = v_rayleighColor; #endif -#ifdef COLOR_CORRECT - // Convert rgb color to hsb - vec3 hsb = czm_RGBToHSB(rgb); - // Perform hsb shift - hsb.x += u_hsbShift.x; // hue - hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0); // saturation - hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness - // Convert shifted hsb back to rgb - rgb = czm_HSBToRGB(hsb); -#endif - - // Alter alpha based on how close the viewer is to the ground (1.0 = on ground, 0.0 = at edge of atmosphere) - float atmosphereAlpha = clamp((u_cameraAndRadiiAndDynamicAtmosphereColor.y - u_cameraAndRadiiAndDynamicAtmosphereColor.x) / (u_cameraAndRadiiAndDynamicAtmosphereColor.y - u_cameraAndRadiiAndDynamicAtmosphereColor.z), 0.0, 1.0); - - // Alter alpha based on time of day (0.0 = night , 1.0 = day) - float nightAlpha = (lightEnum != 0.0) ? clamp(dot(normalize(czm_viewerPositionWC), lightDirection), 0.0, 1.0) : 1.0; - atmosphereAlpha *= pow(nightAlpha, 0.5); - - gl_FragColor = vec4(rgb, mix(rgb.b, 1.0, atmosphereAlpha) * smoothstep(0.0, 1.0, czm_morphTime)); + gl_FragColor = calculateFinalColor(czm_viewerPositionWC, toCamera, lightDirection, mieColor, rayleighColor); } diff --git a/Source/Shaders/SkyAtmosphereVS.glsl b/Source/Shaders/SkyAtmosphereVS.glsl index bfb0bad8922f..3c66fd31b37d 100644 --- a/Source/Shaders/SkyAtmosphereVS.glsl +++ b/Source/Shaders/SkyAtmosphereVS.glsl @@ -1,135 +1,19 @@ -/** - * @license - * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the project nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Modifications made by Analytical Graphics, Inc. - */ - - // Code: http://sponeil.net/ - // GPU Gems 2 Article: https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter16.html - attribute vec4 position; -uniform vec4 u_cameraAndRadiiAndDynamicAtmosphereColor; // Camera height, outer radius, inner radius, dynamic atmosphere color flag - -const float Kr = 0.0025; -const float Kr4PI = Kr * 4.0 * czm_pi; -const float Km = 0.0015; -const float Km4PI = Km * 4.0 * czm_pi; -const float ESun = 15.0; -const float KmESun = Km * ESun; -const float KrESun = Kr * ESun; -const vec3 InvWavelength = vec3( - 5.60204474633241, // Red = 1.0 / Math.pow(0.650, 4.0) - 9.473284437923038, // Green = 1.0 / Math.pow(0.570, 4.0) - 19.643802610477206); // Blue = 1.0 / Math.pow(0.475, 4.0) -const float rayleighScaleDepth = 0.25; +varying vec3 v_outerPositionWC; -const int nSamples = 2; -const float fSamples = 2.0; - -varying vec3 v_rayleighColor; +#ifndef PER_FRAGMENT_ATMOSPHERE varying vec3 v_mieColor; -varying vec3 v_toCamera; - -float scale(float cosAngle) -{ - float x = 1.0 - cosAngle; - return rayleighScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25)))); -} +varying vec3 v_rayleighColor; +#endif void main(void) { - // Unpack attributes - float cameraHeight = u_cameraAndRadiiAndDynamicAtmosphereColor.x; - float outerRadius = u_cameraAndRadiiAndDynamicAtmosphereColor.y; - float innerRadius = u_cameraAndRadiiAndDynamicAtmosphereColor.z; - - // Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere) - vec3 positionV3 = position.xyz; - vec3 ray = positionV3 - czm_viewerPositionWC; - float far = length(ray); - ray /= far; - float atmosphereScale = 1.0 / (outerRadius - innerRadius); + vec4 positionWC = czm_model * position; -#ifdef SKY_FROM_SPACE - // Calculate the closest intersection of the ray with the outer atmosphere (which is the near point of the ray passing through the atmosphere) - float B = 2.0 * dot(czm_viewerPositionWC, ray); - float C = cameraHeight * cameraHeight - outerRadius * outerRadius; - float det = max(0.0, B*B - 4.0 * C); - float near = 0.5 * (-B - sqrt(det)); - - // Calculate the ray's starting position, then calculate its scattering offset - vec3 start = czm_viewerPositionWC + ray * near; - far -= near; - float startAngle = dot(ray, start) / outerRadius; - float startDepth = exp(-1.0 / rayleighScaleDepth ); - float startOffset = startDepth*scale(startAngle); -#else // SKY_FROM_ATMOSPHERE - // Calculate the ray's starting position, then calculate its scattering offset - vec3 start = czm_viewerPositionWC; - float height = length(start); - float depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - cameraHeight)); - float startAngle = dot(ray, start) / height; - float startOffset = depth*scale(startAngle); +#ifndef PER_FRAGMENT_ATMOSPHERE + calculateMieColorAndRayleighColor(positionWC.xyz, v_mieColor, v_rayleighColor); #endif - - float lightEnum = u_cameraAndRadiiAndDynamicAtmosphereColor.w; - vec3 lightDirection = - czm_viewerPositionWC * float(lightEnum == 0.0) + - czm_lightDirectionWC * float(lightEnum == 1.0) + - czm_sunDirectionWC * float(lightEnum == 2.0); - lightDirection = normalize(lightDirection); - - // Initialize the scattering loop variables - float sampleLength = far / fSamples; - float scaledLength = sampleLength * atmosphereScale; - vec3 sampleRay = ray * sampleLength; - vec3 samplePoint = start + sampleRay * 0.5; - - // Now loop through the sample rays - vec3 frontColor = vec3(0.0, 0.0, 0.0); - - for(int i=0; i>includeStart('debug', pragmas.debug); diff --git a/Source/Widgets/CesiumWidget/CesiumWidget.js b/Source/Widgets/CesiumWidget/CesiumWidget.js index bc1add14f2f8..22dd5ff3ad3f 100644 --- a/Source/Widgets/CesiumWidget/CesiumWidget.js +++ b/Source/Widgets/CesiumWidget/CesiumWidget.js @@ -126,15 +126,15 @@ function configureCameraFrustum(widget) { * @param {Element|String} container The DOM element or ID that will contain the widget. * @param {Object} [options] Object with the following properties: * @param {Clock} [options.clock=new Clock()] The clock to use to control current time. - * @param {ImageryProvider} [options.imageryProvider=createWorldImagery()] The imagery provider to serve as the base layer. If set to false, no imagery provider will be added. + * @param {ImageryProvider | false} [options.imageryProvider=createWorldImagery()] The imagery provider to serve as the base layer. If set to false, no imagery provider will be added. * @param {TerrainProvider} [options.terrainProvider=new EllipsoidTerrainProvider] The terrain provider. - * @param {SkyBox} [options.skyBox] The skybox used to render the stars. When undefined, the default stars are used. If set to false, no skyBox, Sun, or Moon will be added. - * @param {SkyAtmosphere} [options.skyAtmosphere] Blue sky, and the glow around the Earth's limb. Set to false to turn it off. + * @param {SkyBox| false} [options.skyBox] The skybox used to render the stars. When undefined, the default stars are used. If set to false, no skyBox, Sun, or Moon will be added. + * @param {SkyAtmosphere | false} [options.skyAtmosphere] Blue sky, and the glow around the Earth's limb. Set to false to turn it off. * @param {SceneMode} [options.sceneMode=SceneMode.SCENE3D] The initial scene mode. * @param {Boolean} [options.scene3DOnly=false] When true, each geometry instance will only be rendered in 3D to save GPU memory. * @param {Boolean} [options.orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency. * @param {MapProjection} [options.mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes. - * @param {Globe} [options.globe=new Globe(mapProjection.ellipsoid)] The globe to use in the scene. If set to false, no globe will be added. + * @param {Globe | false} [options.globe=new Globe(mapProjection.ellipsoid)] The globe to use in the scene. If set to false, no globe will be added. * @param {Boolean} [options.useDefaultRenderLoop=true] True if this widget should control the render loop, false otherwise. * @param {Boolean} [options.useBrowserRecommendedResolution=true] If true, render at the browser's recommended resolution and ignore window.devicePixelRatio. * @param {Number} [options.targetFrameRate] The target frame rate when using the default render loop. @@ -393,6 +393,7 @@ Object.defineProperties(CesiumWidget.prototype, { * @memberof CesiumWidget.prototype * * @type {Element} + * @readonly */ container: { get: function () { @@ -404,7 +405,8 @@ Object.defineProperties(CesiumWidget.prototype, { * Gets the canvas. * @memberof CesiumWidget.prototype * - * @type {Canvas} + * @type {HTMLCanvasElement} + * @readonly */ canvas: { get: function () { @@ -417,6 +419,7 @@ Object.defineProperties(CesiumWidget.prototype, { * @memberof CesiumWidget.prototype * * @type {Element} + * @readonly */ creditContainer: { get: function () { @@ -429,6 +432,7 @@ Object.defineProperties(CesiumWidget.prototype, { * @memberof CesiumWidget.prototype * * @type {Element} + * @readonly */ creditViewport: { get: function () { @@ -441,6 +445,7 @@ Object.defineProperties(CesiumWidget.prototype, { * @memberof CesiumWidget.prototype * * @type {Scene} + * @readonly */ scene: { get: function () { @@ -494,6 +499,7 @@ Object.defineProperties(CesiumWidget.prototype, { * @memberof CesiumWidget.prototype * * @type {Clock} + * @readonly */ clock: { get: function () { @@ -506,6 +512,7 @@ Object.defineProperties(CesiumWidget.prototype, { * @memberof CesiumWidget.prototype * * @type {ScreenSpaceEventHandler} + * @readonly */ screenSpaceEventHandler: { get: function () { diff --git a/Source/Widgets/Geocoder/Geocoder.js b/Source/Widgets/Geocoder/Geocoder.js index 390a3b879ea1..943d52b1e6dd 100644 --- a/Source/Widgets/Geocoder/Geocoder.js +++ b/Source/Widgets/Geocoder/Geocoder.js @@ -24,7 +24,7 @@ var stopSearchPath = * @param {GeocoderService[]} [options.geocoderServices] The geocoder services to be used * @param {Boolean} [options.autoComplete = true] True if the geocoder should query as the user types to autocomplete * @param {Number} [options.flightDuration=1.5] The duration of the camera flight to an entered location, in seconds. - * @param {Geocoder~DestinationFoundFunction} [options.destinationFound=GeocoderViewModel.flyToDestination] A callback function that is called after a successful geocode. If not supplied, the default behavior is to fly the camera to the result destination. + * @param {Geocoder.DestinationFoundFunction} [options.destinationFound=GeocoderViewModel.flyToDestination] A callback function that is called after a successful geocode. If not supplied, the default behavior is to fly the camera to the result destination. */ function Geocoder(options) { //>>includeStart('debug', pragmas.debug); @@ -224,7 +224,7 @@ Geocoder.prototype.destroy = function () { /** * A function that handles the result of a successful geocode. - * @callback Geocoder~DestinationFoundFunction + * @callback Geocoder.DestinationFoundFunction * @param {GeocoderViewModel} viewModel The view model. * @param {Cartesian3|Rectangle} destination The destination result of the geocode. */ diff --git a/Source/Widgets/Geocoder/GeocoderViewModel.js b/Source/Widgets/Geocoder/GeocoderViewModel.js index b704825c6786..b384fcb853de 100644 --- a/Source/Widgets/Geocoder/GeocoderViewModel.js +++ b/Source/Widgets/Geocoder/GeocoderViewModel.js @@ -29,7 +29,7 @@ var DEFAULT_HEIGHT = 1000; * If more than one are supplied, suggestions will be gathered for the geocoders that support it, * and if no suggestion is selected the result from the first geocoder service wil be used. * @param {Number} [options.flightDuration] The duration of the camera flight to an entered location, in seconds. - * @param {Geocoder~DestinationFoundFunction} [options.destinationFound=GeocoderViewModel.flyToDestination] A callback function that is called after a successful geocode. If not supplied, the default behavior is to fly the camera to the result destination. + * @param {Geocoder.DestinationFoundFunction} [options.destinationFound=GeocoderViewModel.flyToDestination] A callback function that is called after a successful geocode. If not supplied, the default behavior is to fly the camera to the result destination. */ function GeocoderViewModel(options) { //>>includeStart('debug', pragmas.debug); @@ -157,7 +157,7 @@ function GeocoderViewModel(options) { /** * Gets and sets the command called when a geocode destination is found - * @type {Geocoder~DestinationFoundFunction} + * @type {Geocoder.DestinationFoundFunction} */ this.destinationFound = defaultValue( options.destinationFound, @@ -547,7 +547,7 @@ function updateSearchSuggestions(viewModel) { /** * A function to fly to the destination found by a successful geocode. - * @type {Geocoder~DestinationFoundFunction} + * @type {Geocoder.DestinationFoundFunction} */ GeocoderViewModel.flyToDestination = flyToDestination; diff --git a/Source/Widgets/SelectionIndicator/SelectionIndicatorViewModel.js b/Source/Widgets/SelectionIndicator/SelectionIndicatorViewModel.js index 08cee4b730f6..83ee0ce9a240 100644 --- a/Source/Widgets/SelectionIndicator/SelectionIndicatorViewModel.js +++ b/Source/Widgets/SelectionIndicator/SelectionIndicatorViewModel.js @@ -87,7 +87,7 @@ function SelectionIndicatorViewModel( * Gets or sets the function for converting the world position of the object to the screen space position. * * @member - * @type {SelectionIndicatorViewModel~ComputeScreenSpacePosition} + * @type {SelectionIndicatorViewModel.ComputeScreenSpacePosition} * @default SceneTransforms.wgs84ToWindowCoordinates * * @example @@ -205,7 +205,7 @@ Object.defineProperties(SelectionIndicatorViewModel.prototype, { /** * A function that converts the world position of an object to a screen space position. - * @callback SelectionIndicatorViewModel~ComputeScreenSpacePosition + * @callback SelectionIndicatorViewModel.ComputeScreenSpacePosition * @param {Cartesian3} position The position in WGS84 (world) coordinates. * @param {Cartesian2} result An object to return the input position transformed to window coordinates. * @returns {Cartesian2} The modified result parameter. diff --git a/Source/Widgets/SvgPathBindingHandler.js b/Source/Widgets/SvgPathBindingHandler.js index e57e6429efc5..cba2bd5f3cb7 100644 --- a/Source/Widgets/SvgPathBindingHandler.js +++ b/Source/Widgets/SvgPathBindingHandler.js @@ -16,7 +16,7 @@ var svgClassName = "cesium-svgPath-svg"; *
    • css: Optional. A string containing additional CSS classes to apply to the SVG. 'cesium-svgPath-svg' is always applied.
    • *
    * - * @exports SvgPathBindingHandler + * @namespace SvgPathBindingHandler * * @example * // Create an SVG as a child of a div @@ -29,6 +29,9 @@ var svgClassName = "cesium-svgPath-svg"; *
    */ var SvgPathBindingHandler = { + /** + * @function + */ register: function (knockout) { knockout.bindingHandlers.cesiumSvgPath = { init: function (element, valueAccessor) { diff --git a/Source/Widgets/Viewer/Viewer.js b/Source/Widgets/Viewer/Viewer.js index c54f7d9cdfb0..c03cc73ef83f 100644 --- a/Source/Widgets/Viewer/Viewer.js +++ b/Source/Widgets/Viewer/Viewer.js @@ -209,6 +209,58 @@ function enableVRUI(viewer, enabled) { } } +/** + * @typedef {Object} Viewer.ConstructorOptions + * + * Initialization options for the Viewer constructor + * + * @property {Boolean} [animation=true] If set to false, the Animation widget will not be created. + * @property {Boolean} [baseLayerPicker=true] If set to false, the BaseLayerPicker widget will not be created. + * @property {Boolean} [fullscreenButton=true] If set to false, the FullscreenButton widget will not be created. + * @property {Boolean} [vrButton=false] If set to true, the VRButton widget will be created. + * @property {Boolean|GeocoderService[]} [geocoder=true] If set to false, the Geocoder widget will not be created. + * @property {Boolean} [homeButton=true] If set to false, the HomeButton widget will not be created. + * @property {Boolean} [infoBox=true] If set to false, the InfoBox widget will not be created. + * @property {Boolean} [sceneModePicker=true] If set to false, the SceneModePicker widget will not be created. + * @property {Boolean} [selectionIndicator=true] If set to false, the SelectionIndicator widget will not be created. + * @property {Boolean} [timeline=true] If set to false, the Timeline widget will not be created. + * @property {Boolean} [navigationHelpButton=true] If set to false, the navigation help button will not be created. + * @property {Boolean} [navigationInstructionsInitiallyVisible=true] True if the navigation instructions should initially be visible, or false if the should not be shown until the user explicitly clicks the button. + * @property {Boolean} [scene3DOnly=false] When true, each geometry instance will only be rendered in 3D to save GPU memory. + * @property {Boolean} [shouldAnimate=false] true if the clock should attempt to advance simulation time by default, false otherwise. This option takes precedence over setting {@link Viewer#clockViewModel}. + * @property {ClockViewModel} [clockViewModel=new ClockViewModel(clock)] The clock view model to use to control current time. + * @property {ProviderViewModel} [selectedImageryProviderViewModel] The view model for the current base imagery layer, if not supplied the first available base layer is used. This value is only valid if `baseLayerPicker` is set to true. + * @property {ProviderViewModel[]} [imageryProviderViewModels=createDefaultImageryProviderViewModels()] The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if `baseLayerPicker` is set to true. + * @property {ProviderViewModel} [selectedTerrainProviderViewModel] The view model for the current base terrain layer, if not supplied the first available base layer is used. This value is only valid if `baseLayerPicker` is set to true. + * @property {ProviderViewModel[]} [terrainProviderViewModels=createDefaultTerrainProviderViewModels()] The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if `baseLayerPicker` is set to true. + * @property {ImageryProvider} [imageryProvider=createWorldImagery()] The imagery provider to use. This value is only valid if `baseLayerPicker` is set to false. + * @property {TerrainProvider} [terrainProvider=new EllipsoidTerrainProvider()] The terrain provider to use + * @property {SkyBox|false} [skyBox] The skybox used to render the stars. When undefined, the default stars are used. If set to false, no skyBox, Sun, or Moon will be added. + * @property {SkyAtmosphere|false} [skyAtmosphere] Blue sky, and the glow around the Earth's limb. Set to false to turn it off. + * @property {Element|String} [fullscreenElement=document.body] The element or id to be placed into fullscreen mode when the full screen button is pressed. + * @property {Boolean} [useDefaultRenderLoop=true] True if this widget should control the render loop, false otherwise. + * @property {Number} [targetFrameRate] The target frame rate when using the default render loop. + * @property {Boolean} [showRenderLoopErrors=true] If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs. + * @property {Boolean} [useBrowserRecommendedResolution=true] If true, render at the browser's recommended resolution and ignore window.devicePixelRatio. + * @property {Boolean} [automaticallyTrackDataSourceClocks=true] If true, this widget will automatically track the clock settings of newly added DataSources, updating if the DataSource's clock changes. Set this to false if you want to configure the clock independently. + * @property {Object} [contextOptions] Context and WebGL creation properties corresponding to options passed to {@link Scene}. + * @property {SceneMode} [sceneMode=SceneMode.SCENE3D] The initial scene mode. + * @property {MapProjection} [mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes. + * @property {Globe} [globe=new Globe(mapProjection.ellipsoid)] The globe to use in the scene. If set to false, no globe will be added. + * @property {Boolean} [orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency. + * @property {Element|String} [creditContainer] The DOM element or ID that will contain the {@link CreditDisplay}. If not specified, the credits are added to the bottom of the widget itself. + * @property {Element|String} [creditViewport] The DOM element or ID that will contain the credit pop up created by the {@link CreditDisplay}. If not specified, it will appear over the widget itself. + * @property {DataSourceCollection} [dataSources=new DataSourceCollection()] The collection of data sources visualized by the widget. If this parameter is provided, + * the instance is assumed to be owned by the caller and will not be destroyed when the viewer is destroyed. + * @property {Number} [terrainExaggeration=1.0] A scalar used to exaggerate the terrain. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid. + * @property {Boolean} [shadows=false] Determines if shadows are cast by light sources. + * @property {ShadowMode} [terrainShadows=ShadowMode.RECEIVE_ONLY] Determines if the terrain casts or receives shadows from light sources. + * @property {MapMode2D} [mapMode2D=MapMode2D.INFINITE_SCROLL] Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction. + * @property {Boolean} [projectionPicker=false] If set to true, the ProjectionPicker widget will be created. + * @property {Boolean} [requestRenderMode=false] If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling reduces the CPU/GPU usage of your application and uses less battery on mobile, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}. + * @property {Number} [maximumRenderTimeChange=0.0] If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}. + */ + /** * A base widget for building applications. It composites all of the standard Cesium widgets into one reusable package. * The widget can always be extended by using mixins, which add functionality useful for a variety of applications. @@ -217,52 +269,7 @@ function enableVRUI(viewer, enabled) { * @constructor * * @param {Element|String} container The DOM element or ID that will contain the widget. - * @param {Object} [options] Object with the following properties: - * @param {Boolean} [options.animation=true] If set to false, the Animation widget will not be created. - * @param {Boolean} [options.baseLayerPicker=true] If set to false, the BaseLayerPicker widget will not be created. - * @param {Boolean} [options.fullscreenButton=true] If set to false, the FullscreenButton widget will not be created. - * @param {Boolean} [options.vrButton=false] If set to true, the VRButton widget will be created. - * @param {Boolean|GeocoderService[]} [options.geocoder=true] If set to false, the Geocoder widget will not be created. - * @param {Boolean} [options.homeButton=true] If set to false, the HomeButton widget will not be created. - * @param {Boolean} [options.infoBox=true] If set to false, the InfoBox widget will not be created. - * @param {Boolean} [options.sceneModePicker=true] If set to false, the SceneModePicker widget will not be created. - * @param {Boolean} [options.selectionIndicator=true] If set to false, the SelectionIndicator widget will not be created. - * @param {Boolean} [options.timeline=true] If set to false, the Timeline widget will not be created. - * @param {Boolean} [options.navigationHelpButton=true] If set to false, the navigation help button will not be created. - * @param {Boolean} [options.navigationInstructionsInitiallyVisible=true] True if the navigation instructions should initially be visible, or false if the should not be shown until the user explicitly clicks the button. - * @param {Boolean} [options.scene3DOnly=false] When true, each geometry instance will only be rendered in 3D to save GPU memory. - * @param {Boolean} [options.shouldAnimate=false] true if the clock should attempt to advance simulation time by default, false otherwise. This option takes precedence over setting {@link Viewer#clockViewModel}. - * @param {ClockViewModel} [options.clockViewModel=new ClockViewModel(options.clock)] The clock view model to use to control current time. - * @param {ProviderViewModel} [options.selectedImageryProviderViewModel] The view model for the current base imagery layer, if not supplied the first available base layer is used. This value is only valid if options.baseLayerPicker is set to true. - * @param {ProviderViewModel[]} [options.imageryProviderViewModels=createDefaultImageryProviderViewModels()] The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if options.baseLayerPicker is set to true. - * @param {ProviderViewModel} [options.selectedTerrainProviderViewModel] The view model for the current base terrain layer, if not supplied the first available base layer is used. This value is only valid if options.baseLayerPicker is set to true. - * @param {ProviderViewModel[]} [options.terrainProviderViewModels=createDefaultTerrainProviderViewModels()] The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if options.baseLayerPicker is set to true. - * @param {ImageryProvider} [options.imageryProvider=createWorldImagery()] The imagery provider to use. This value is only valid if options.baseLayerPicker is set to false. - * @param {TerrainProvider} [options.terrainProvider=new EllipsoidTerrainProvider()] The terrain provider to use - * @param {SkyBox} [options.skyBox] The skybox used to render the stars. When undefined, the default stars are used. - * @param {SkyAtmosphere} [options.skyAtmosphere] Blue sky, and the glow around the Earth's limb. Set to false to turn it off. - * @param {Element|String} [options.fullscreenElement=document.body] The element or id to be placed into fullscreen mode when the full screen button is pressed. - * @param {Boolean} [options.useDefaultRenderLoop=true] True if this widget should control the render loop, false otherwise. - * @param {Number} [options.targetFrameRate] The target frame rate when using the default render loop. - * @param {Boolean} [options.showRenderLoopErrors=true] If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs. - * @param {Boolean} [options.useBrowserRecommendedResolution=true] If true, render at the browser's recommended resolution and ignore window.devicePixelRatio. - * @param {Boolean} [options.automaticallyTrackDataSourceClocks=true] If true, this widget will automatically track the clock settings of newly added DataSources, updating if the DataSource's clock changes. Set this to false if you want to configure the clock independently. - * @param {Object} [options.contextOptions] Context and WebGL creation properties corresponding to options passed to {@link Scene}. - * @param {SceneMode} [options.sceneMode=SceneMode.SCENE3D] The initial scene mode. - * @param {MapProjection} [options.mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes. - * @param {Globe} [options.globe=new Globe(mapProjection.ellipsoid)] The globe to use in the scene. If set to false, no globe will be added. - * @param {Boolean} [options.orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency. - * @param {Element|String} [options.creditContainer] The DOM element or ID that will contain the {@link CreditDisplay}. If not specified, the credits are added to the bottom of the widget itself. - * @param {Element|String} [options.creditViewport] The DOM element or ID that will contain the credit pop up created by the {@link CreditDisplay}. If not specified, it will appear over the widget itself. - * @param {DataSourceCollection} [options.dataSources=new DataSourceCollection()] The collection of data sources visualized by the widget. If this parameter is provided, - * the instance is assumed to be owned by the caller and will not be destroyed when the viewer is destroyed. - * @param {Number} [options.terrainExaggeration=1.0] A scalar used to exaggerate the terrain. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid. - * @param {Boolean} [options.shadows=false] Determines if shadows are cast by light sources. - * @param {ShadowMode} [options.terrainShadows=ShadowMode.RECEIVE_ONLY] Determines if the terrain casts or receives shadows from light sources. - * @param {MapMode2D} [options.mapMode2D=MapMode2D.INFINITE_SCROLL] Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction. - * @param {Boolean} [options.projectionPicker=false] If set to true, the ProjectionPicker widget will be created. - * @param {Boolean} [options.requestRenderMode=false] If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling reduces the CPU/GPU usage of your application and uses less battery on mobile, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}. - * @param {Number} [options.maximumRenderTimeChange=0.0] If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}. + * @param {Viewer.ConstructorOptions} [options] Object describing initialization options * * @exception {DeveloperError} Element with id "container" does not exist in the document. * @exception {DeveloperError} options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget, specify options.imageryProvider instead. @@ -1065,7 +1072,7 @@ Object.defineProperties(Viewer.prototype, { /** * Gets the canvas. * @memberof Viewer.prototype - * @type {Canvas} + * @type {HTMLCanvasElement} * @readonly */ canvas: { @@ -1321,7 +1328,7 @@ Object.defineProperties(Viewer.prototype, { /** * Gets or sets the Entity instance currently being tracked by the camera. * @memberof Viewer.prototype - * @type {Entity} + * @type {Entity | undefined} */ trackedEntity: { get: function () { @@ -1370,7 +1377,7 @@ Object.defineProperties(Viewer.prototype, { /** * Gets or sets the object instance for which to display a selection indicator. * @memberof Viewer.prototype - * @type {Entity} + * @type {Entity | undefined} */ selectedEntity: { get: function () { @@ -1439,7 +1446,7 @@ Object.defineProperties(Viewer.prototype, { * A mixin may add additional properties, functions, or other behavior * to the provided viewer instance. * - * @param {Viewer~ViewerMixin} mixin The Viewer mixin to add to this instance. + * @param {Viewer.ViewerMixin} mixin The Viewer mixin to add to this instance. * @param {Object} [options] The options object to be passed to the mixin function. * * @see viewerDragDropMixin @@ -2311,7 +2318,7 @@ function updateTrackedEntity(viewer) { /** * A function that augments a Viewer instance with additional functionality. - * @callback Viewer~ViewerMixin + * @callback Viewer.ViewerMixin * @param {Viewer} viewer The viewer instance. * @param {Object} options Options object to be passed to the mixin function. * diff --git a/Source/Widgets/Viewer/viewerCesium3DTilesInspectorMixin.js b/Source/Widgets/Viewer/viewerCesium3DTilesInspectorMixin.js index ce0a01a079c9..c4bb1761429f 100644 --- a/Source/Widgets/Viewer/viewerCesium3DTilesInspectorMixin.js +++ b/Source/Widgets/Viewer/viewerCesium3DTilesInspectorMixin.js @@ -5,7 +5,7 @@ import Cesium3DTilesInspector from "../Cesium3DTilesInspector/Cesium3DTilesInspe * A mixin which adds the {@link Cesium3DTilesInspector} widget to the {@link Viewer} widget. * Rather than being called directly, this function is normally passed as * a parameter to {@link Viewer#extend}, as shown in the example below. - * @exports viewerCesium3DTilesInspectorMixin + * @function * * @param {Viewer} viewer The viewer instance. * diff --git a/Source/Widgets/Viewer/viewerCesiumInspectorMixin.js b/Source/Widgets/Viewer/viewerCesiumInspectorMixin.js index a7413fb3c225..de8518f1c60f 100644 --- a/Source/Widgets/Viewer/viewerCesiumInspectorMixin.js +++ b/Source/Widgets/Viewer/viewerCesiumInspectorMixin.js @@ -6,7 +6,7 @@ import CesiumInspector from "../CesiumInspector/CesiumInspector.js"; * A mixin which adds the CesiumInspector widget to the Viewer widget. * Rather than being called directly, this function is normally passed as * a parameter to {@link Viewer#extend}, as shown in the example below. - * @exports viewerCesiumInspectorMixin + * @function * * @param {Viewer} viewer The viewer instance. * diff --git a/Source/Widgets/Viewer/viewerDragDropMixin.js b/Source/Widgets/Viewer/viewerDragDropMixin.js index d111f7cdef42..5130fb1e164c 100644 --- a/Source/Widgets/Viewer/viewerDragDropMixin.js +++ b/Source/Widgets/Viewer/viewerDragDropMixin.js @@ -12,15 +12,15 @@ import getElement from "../getElement.js"; * A mixin which adds default drag and drop support for CZML files to the Viewer widget. * Rather than being called directly, this function is normally passed as * a parameter to {@link Viewer#extend}, as shown in the example below. - * @exports viewerDragDropMixin - * @namespace + * @function viewerDragDropMixin + * @param {Viewer} viewer The viewer instance. * @param {Object} [options] Object with the following properties: * @param {Element|String} [options.dropTarget=viewer.container] The DOM element which will serve as the drop target. * @param {Boolean} [options.clearOnDrop=true] When true, dropping files will clear all existing data sources first, when false, new data sources will be loaded after the existing ones. * @param {Boolean} [options.flyToOnDrop=true] When true, dropping files will fly to the data source once it is loaded. * @param {Boolean} [options.clampToGround=true] When true, datasources are clamped to the ground. - * @param {DefaultProxy} [options.proxy] The proxy to be used for KML network links. + * @param {Proxy} [options.proxy] The proxy to be used for KML network links. * * @exception {DeveloperError} Element with id does not exist in the document. * @exception {DeveloperError} dropTarget is already defined by another mixin. @@ -164,7 +164,7 @@ function viewerDragDropMixin(viewer, options) { /** * Gets or sets the proxy to be used for KML. * @memberof viewerDragDropMixin.prototype - * @type {DefaultProxy} + * @type {Proxy} */ proxy: { get: function () { diff --git a/Source/Widgets/Viewer/viewerPerformanceWatchdogMixin.js b/Source/Widgets/Viewer/viewerPerformanceWatchdogMixin.js index 589277ad44e6..c0cbb78c517c 100644 --- a/Source/Widgets/Viewer/viewerPerformanceWatchdogMixin.js +++ b/Source/Widgets/Viewer/viewerPerformanceWatchdogMixin.js @@ -7,7 +7,7 @@ import PerformanceWatchdog from "../PerformanceWatchdog/PerformanceWatchdog.js"; * A mixin which adds the {@link PerformanceWatchdog} widget to the {@link Viewer} widget. * Rather than being called directly, this function is normally passed as * a parameter to {@link Viewer#extend}, as shown in the example below. - * @exports viewerPerformanceWatchdogMixin + * @function * * @param {Viewer} viewer The viewer instance. * @param {Object} [options] An object with properties. diff --git a/Source/Widgets/createCommand.js b/Source/Widgets/createCommand.js index 88a0aec3a735..27e761f234fd 100644 --- a/Source/Widgets/createCommand.js +++ b/Source/Widgets/createCommand.js @@ -12,7 +12,7 @@ import knockout from "../ThirdParty/knockout.js"; * value of canExecute and throw if false. It also provides events for when * a command has been or is about to be executed. * - * @exports createCommand + * @function * * @param {Function} func The function to execute. * @param {Boolean} [canExecute=true] A boolean indicating whether the function can currently be executed. diff --git a/Source/Widgets/subscribeAndEvaluate.js b/Source/Widgets/subscribeAndEvaluate.js index 700240f76b12..768829eef8b7 100644 --- a/Source/Widgets/subscribeAndEvaluate.js +++ b/Source/Widgets/subscribeAndEvaluate.js @@ -6,7 +6,7 @@ import knockout from "../ThirdParty/knockout.js"; * * @private * - * @exports subscribeAndEvaluate + * @function subscribeAndEvaluate * * @param {Object} owner The object containing the observable property. * @param {String} observablePropertyName The name of the observable property. diff --git a/Source/WorkersES6/createTaskProcessorWorker.js b/Source/WorkersES6/createTaskProcessorWorker.js index 55a699a3012c..2b6f49308d8d 100644 --- a/Source/WorkersES6/createTaskProcessorWorker.js +++ b/Source/WorkersES6/createTaskProcessorWorker.js @@ -21,11 +21,11 @@ function callAndWrap(workerFunction, parameters, transferableObjects) { * Creates an adapter function to allow a calculation function to operate as a Web Worker, * paired with TaskProcessor, to receive tasks and return results. * - * @exports createTaskProcessorWorker + * @function createTaskProcessorWorker * - * @param {createTaskProcessorWorker~WorkerFunction} workerFunction The calculation function, + * @param {createTaskProcessorWorker.WorkerFunction} workerFunction The calculation function, * which takes parameters and returns a result. - * @returns {createTaskProcessorWorker~TaskProcessorWorkerFunction} A function that adapts the + * @returns {createTaskProcessorWorker.TaskProcessorWorkerFunction} A function that adapts the * calculation function to work as a Web Worker onmessage listener with TaskProcessor. * * @@ -101,7 +101,7 @@ function createTaskProcessorWorker(workerFunction) { /** * A function that performs a calculation in a Web Worker. - * @callback createTaskProcessorWorker~WorkerFunction + * @callback createTaskProcessorWorker.WorkerFunction * * @param {Object} parameters Parameters to the calculation. * @param {Array} transferableObjects An array that should be filled with references to objects inside @@ -125,7 +125,7 @@ function createTaskProcessorWorker(workerFunction) { /** * A Web Worker message event handler function that handles the interaction with TaskProcessor, * specifically, task ID management and posting a response message containing the result. - * @callback createTaskProcessorWorker~TaskProcessorWorkerFunction + * @callback createTaskProcessorWorker.TaskProcessorWorkerFunction * * @param {Object} event The onmessage event object. */ diff --git a/Specs/Core/Cartesian2Spec.js b/Specs/Core/Cartesian2Spec.js index 95d5d2c573f3..591d66f99f5d 100644 --- a/Specs/Core/Cartesian2Spec.js +++ b/Specs/Core/Cartesian2Spec.js @@ -860,12 +860,6 @@ describe("Core/Cartesian2", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws with no epsilon", function () { - expect(function () { - Cartesian2.equalsEpsilon(new Cartesian2(), new Cartesian2(), undefined); - }).toThrowDeveloperError(); - }); - it("fromElements returns a cartesian2 with corrrect coordinates", function () { var cartesian2 = Cartesian2.fromElements(2, 2); var expectedResult = new Cartesian2(2, 2); diff --git a/Specs/Core/Cartesian3Spec.js b/Specs/Core/Cartesian3Spec.js index b00b85e7e4f0..338e05fa27e1 100644 --- a/Specs/Core/Cartesian3Spec.js +++ b/Specs/Core/Cartesian3Spec.js @@ -1031,12 +1031,6 @@ describe("Core/Cartesian3", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws with no epsilon", function () { - expect(function () { - Cartesian3.equalsEpsilon(new Cartesian3(), new Cartesian3(), undefined); - }).toThrowDeveloperError(); - }); - it("cross throw with no left paramater", function () { var right = new Cartesian3(4, 3, 6); expect(function () { diff --git a/Specs/Core/Cartesian4Spec.js b/Specs/Core/Cartesian4Spec.js index f153832e553f..813007d128e0 100644 --- a/Specs/Core/Cartesian4Spec.js +++ b/Specs/Core/Cartesian4Spec.js @@ -1011,12 +1011,6 @@ describe("Core/Cartesian4", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws with no epsilon", function () { - expect(function () { - Cartesian4.equalsEpsilon(new Cartesian4(), new Cartesian4(), undefined); - }).toThrowDeveloperError(); - }); - it("minimumByComponent throws with no result", function () { expect(function () { Cartesian4.minimumByComponent(new Cartesian4(), new Cartesian4()); diff --git a/Specs/Core/CartographicSpec.js b/Specs/Core/CartographicSpec.js index 8c662bde0cf0..358907e22867 100644 --- a/Specs/Core/CartographicSpec.js +++ b/Specs/Core/CartographicSpec.js @@ -216,10 +216,4 @@ describe("Core/Cartographic", function () { it("clone returns undefined without cartographic parameter", function () { expect(Cartographic.clone(undefined)).toBeUndefined(); }); - - it("equalsEpsilon throws without numeric epsilon", function () { - expect(function () { - Cartographic.equalsEpsilon(new Cartographic(), new Cartographic(), {}); - }).toThrowDeveloperError(); - }); }); diff --git a/Specs/Core/ColorSpec.js b/Specs/Core/ColorSpec.js index ba0a0cf21171..911d06b12e01 100644 --- a/Specs/Core/ColorSpec.js +++ b/Specs/Core/ColorSpec.js @@ -184,7 +184,19 @@ describe("Core/Color", function () { expect(Color.fromCssColorString("#00F")).toEqual(Color.BLUE); }); - it("fromCssColorString supports the #rrggbb", function () { + it("fromCssColorString supports the #rgba format", function () { + expect(Color.fromCssColorString("#369c")).toEqual( + new Color(0.2, 0.4, 0.6, 0.8) + ); + }); + + it("fromCssColorString supports the #rgba format with uppercase", function () { + expect(Color.fromCssColorString("#369C")).toEqual( + new Color(0.2, 0.4, 0.6, 0.8) + ); + }); + + it("fromCssColorString supports the #rrggbb format", function () { expect(Color.fromCssColorString("#336699")).toEqual( new Color(0.2, 0.4, 0.6, 1.0) ); @@ -202,6 +214,18 @@ describe("Core/Color", function () { expect(Color.fromCssColorString("#0000FF")).toEqual(Color.BLUE); }); + it("fromCssColorString supports the #rrggbbaa format", function () { + expect(Color.fromCssColorString("#336699cc")).toEqual( + new Color(0.2, 0.4, 0.6, 0.8) + ); + }); + + it("fromCssColorString supports the #rrggbbaa format with uppercase", function () { + expect(Color.fromCssColorString("#336699CC")).toEqual( + new Color(0.2, 0.4, 0.6, 0.8) + ); + }); + it("fromCssColorString supports the rgb() format with absolute values", function () { expect(Color.fromCssColorString("rgb(255, 0, 0)")).toEqual(Color.RED); expect(Color.fromCssColorString("rgb(0, 255, 0)")).toEqual(Color.LIME); diff --git a/Specs/Core/MathSpec.js b/Specs/Core/MathSpec.js index 7c38c87ac2e8..d065817d3afd 100644 --- a/Specs/Core/MathSpec.js +++ b/Specs/Core/MathSpec.js @@ -339,12 +339,6 @@ describe("Core/Math", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws for undefined relativeEpsilon", function () { - expect(function () { - CesiumMath.equalsEpsilon(1.0, 5.0, undefined); - }).toThrowDeveloperError(); - }); - it("equalsEpsilon throws for undefined", function () { expect(function () { CesiumMath.equalsEpsilon(); diff --git a/Specs/Core/Matrix2Spec.js b/Specs/Core/Matrix2Spec.js index 975b25d1c4a2..d1f9666e0b31 100644 --- a/Specs/Core/Matrix2Spec.js +++ b/Specs/Core/Matrix2Spec.js @@ -740,12 +740,6 @@ describe("Core/Matrix2", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws with non-number parameter", function () { - expect(function () { - Matrix2.equalsEpsilon(new Matrix2(), new Matrix2(), {}); - }).toThrowDeveloperError(); - }); - it("getColumn throws without result parameter", function () { expect(function () { Matrix2.getColumn(new Matrix2(), 1); diff --git a/Specs/Core/Matrix3Spec.js b/Specs/Core/Matrix3Spec.js index b6dc75eafcdd..bfd75f43f763 100644 --- a/Specs/Core/Matrix3Spec.js +++ b/Specs/Core/Matrix3Spec.js @@ -1373,12 +1373,6 @@ describe("Core/Matrix3", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws with non-number parameter", function () { - expect(function () { - Matrix3.equalsEpsilon(new Matrix3(), new Matrix3(), {}); - }).toThrowDeveloperError(); - }); - it("getColumn throws without result parameter", function () { expect(function () { Matrix3.getColumn(new Matrix3(), 2); diff --git a/Specs/Core/Matrix4Spec.js b/Specs/Core/Matrix4Spec.js index da2c3e55af50..6fad177a2d8d 100644 --- a/Specs/Core/Matrix4Spec.js +++ b/Specs/Core/Matrix4Spec.js @@ -4306,12 +4306,6 @@ describe("Core/Matrix4", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws with non-number parameter", function () { - expect(function () { - Matrix4.equalsEpsilon(new Matrix4(), new Matrix4(), {}); - }).toThrowDeveloperError(); - }); - it("getTranslation throws without matrix parameter", function () { expect(function () { Matrix4.getTranslation(undefined); @@ -4566,21 +4560,6 @@ describe("Core/Matrix4", function () { }).toThrowDeveloperError(); }); - it("computeViewportTransformation works", function () { - expect(function () { - Matrix4.computeViewportTransformation( - { - x: 0, - y: 0, - width: 4.0, - height: 6.0, - }, - 0.0, - 2.0 - ); - }).toThrowDeveloperError(); - }); - it("Matrix4 objects can be used as array like objects", function () { var matrix = new Matrix4( 1, diff --git a/Specs/Core/PixelFormatSpec.js b/Specs/Core/PixelFormatSpec.js new file mode 100644 index 000000000000..1c9e7ebb0c51 --- /dev/null +++ b/Specs/Core/PixelFormatSpec.js @@ -0,0 +1,38 @@ +import { PixelDatatype } from "../../Source/Cesium.js"; +import { PixelFormat } from "../../Source/Cesium.js"; + +describe("Core/PixelFormat", function () { + it("flipY works", function () { + var width = 1; + var height = 2; + var values = [255, 0, 0, 0, 255, 0]; + var expectedValues = [0, 255, 0, 255, 0, 0]; + var dataBuffer = new Uint8Array(values); + var expectedDataBuffer = new Uint8Array(expectedValues); + + var flipped = PixelFormat.flipY( + dataBuffer, + PixelFormat.RGB, + PixelDatatype.UNSIGNED_BYTE, + width, + height + ); + expect(flipped).toEqual(expectedDataBuffer); + }); + + it("flipY returns early if height is 1", function () { + var width = 1; + var height = 1; + var values = [255, 255, 255]; + var dataBuffer = new Uint8Array(values); + + var flipped = PixelFormat.flipY( + dataBuffer, + PixelFormat.RGB, + PixelDatatype.UNSIGNED_BYTE, + width, + height + ); + expect(flipped).toBe(dataBuffer); + }); +}); diff --git a/Specs/Core/QuaternionSpec.js b/Specs/Core/QuaternionSpec.js index 45ec1c8d2d69..d330f5905009 100644 --- a/Specs/Core/QuaternionSpec.js +++ b/Specs/Core/QuaternionSpec.js @@ -1152,12 +1152,6 @@ describe("Core/Quaternion", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws with no epsilon", function () { - expect(function () { - Quaternion.equalsEpsilon(new Quaternion(), new Quaternion(), undefined); - }).toThrowDeveloperError(); - }); - it("conjugate throws with no result", function () { expect(function () { Quaternion.conjugate(new Quaternion()); diff --git a/Specs/Core/RectangleSpec.js b/Specs/Core/RectangleSpec.js index 4b18f74f707a..36db8a65726d 100644 --- a/Specs/Core/RectangleSpec.js +++ b/Specs/Core/RectangleSpec.js @@ -1014,14 +1014,6 @@ describe("Core/Rectangle", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws with no epsilon", function () { - var rectangle = new Rectangle(west, south, east, north); - var other = new Rectangle(); - expect(function () { - rectangle.equalsEpsilon(other, undefined); - }).toThrowDeveloperError(); - }); - it("intersection throws with no rectangle", function () { expect(function () { Rectangle.intersection(undefined); diff --git a/Specs/Core/ResourceSpec.js b/Specs/Core/ResourceSpec.js index 10310b831ef4..5c971aa08381 100644 --- a/Specs/Core/ResourceSpec.js +++ b/Specs/Core/ResourceSpec.js @@ -59,6 +59,9 @@ describe("Core/Resource", function () { expect(resource.url).toEqual( proxy.getURL("http://test.com/tileset?key1=value1&key2=value2") ); + expect(String(resource)).toEqual( + proxy.getURL("http://test.com/tileset?key1=value1&key2=value2") + ); expect(resource.queryParameters).toEqual({ key1: "value1", key2: "value2", @@ -81,6 +84,7 @@ describe("Core/Resource", function () { var url = "http://invalid.domain.com/tileset"; var resource = new Resource(url); expect(resource.url).toEqual(url); + expect(String(resource)).toEqual(url); expect(resource.queryParameters).toEqual({}); expect(resource.templateValues).toEqual({}); expect(resource.headers).toEqual({}); diff --git a/Specs/Core/TimeIntervalSpec.js b/Specs/Core/TimeIntervalSpec.js index 2ada0a768700..2de525dc7623 100644 --- a/Specs/Core/TimeIntervalSpec.js +++ b/Specs/Core/TimeIntervalSpec.js @@ -633,14 +633,6 @@ describe("Core/TimeInterval", function () { }).toThrowDeveloperError(); }); - it("equalsEpsilon throws without epsilon.", function () { - var left = new TimeInterval(); - var right = new TimeInterval(); - expect(function () { - TimeInterval.equalsEpsilon(left, right, undefined); - }).toThrowDeveloperError(); - }); - it("intersect throws without left.", function () { var right = new TimeInterval(); var result = new TimeInterval(); @@ -649,14 +641,6 @@ describe("Core/TimeInterval", function () { }).toThrowDeveloperError(); }); - it("intersect throws without result.", function () { - var left = new TimeInterval(); - var right = new TimeInterval(); - expect(function () { - TimeInterval.intersect(left, right, undefined); - }).toThrowDeveloperError(); - }); - it("contains throws without interval.", function () { var date = new JulianDate(); expect(function () { diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index fdcb883fb128..7abad2f543dd 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -1716,6 +1716,59 @@ describe("Core/Transforms", function () { expect(returnedResult).toEqualEpsilon(expected, CesiumMath.EPSILON12); }); + it("rotationMatrixFromPositionVelocity works without a result parameter", function () { + var matrix = Transforms.rotationMatrixFromPositionVelocity( + Cartesian3.UNIT_X, + Cartesian3.UNIT_Y + ); + var expected = new Matrix3(0, 0, 1, 1, 0, 0, 0, 1, 0); + expect(matrix).toEqualEpsilon(expected, CesiumMath.EPSILON14); + + matrix = Transforms.rotationMatrixFromPositionVelocity( + Cartesian3.UNIT_X, + Cartesian3.UNIT_Z + ); + expected = new Matrix3(0, 0, 1, 0, -1, 0, 1, 0, 0); + expect(matrix).toEqualEpsilon(expected, CesiumMath.EPSILON14); + + matrix = Transforms.rotationMatrixFromPositionVelocity( + Cartesian3.UNIT_Y, + Cartesian3.UNIT_Z + ); + expected = new Matrix3(0, 1, 0, 0, 0, 1, 1, 0, 0); + expect(matrix).toEqualEpsilon(expected, CesiumMath.EPSILON14); + }); + + it("rotationMatrixFromPositionVelocity works with a result parameter", function () { + var result = new Matrix3(); + Transforms.rotationMatrixFromPositionVelocity( + Cartesian3.UNIT_X, + Cartesian3.UNIT_Y, + Ellipsoid.WGS84, + result + ); + var expected = new Matrix3(0, 0, 1, 1, 0, 0, 0, 1, 0); + expect(result).toEqualEpsilon(expected, CesiumMath.EPSILON14); + + Transforms.rotationMatrixFromPositionVelocity( + Cartesian3.UNIT_X, + Cartesian3.UNIT_Z, + Ellipsoid.WGS84, + result + ); + expected = new Matrix3(0, 0, 1, 0, -1, 0, 1, 0, 0); + expect(result).toEqualEpsilon(expected, CesiumMath.EPSILON14); + + Transforms.rotationMatrixFromPositionVelocity( + Cartesian3.UNIT_Y, + Cartesian3.UNIT_Z, + Ellipsoid.WGS84, + result + ); + expected = new Matrix3(0, 1, 0, 0, 0, 1, 1, 0, 0); + expect(result).toEqualEpsilon(expected, CesiumMath.EPSILON14); + }); + it("basisTo2D projects translation", function () { var ellipsoid = Ellipsoid.WGS84; var projection = new GeographicProjection(ellipsoid); diff --git a/Specs/Core/buildModuleUrlSpec.js b/Specs/Core/buildModuleUrlSpec.js index 73f23163f133..ef480b38dae4 100644 --- a/Specs/Core/buildModuleUrlSpec.js +++ b/Specs/Core/buildModuleUrlSpec.js @@ -17,12 +17,25 @@ describe("Core/buildModuleUrl", function () { var r = buildModuleUrl._cesiumScriptRegex; expect(r.exec("Cesium.js")[1]).toEqual(""); + expect(r.exec("Cesium.js?v=1.7")[1]).toEqual(""); expect(r.exec("assets/foo/Cesium.js")[1]).toEqual("assets/foo/"); + expect(r.exec("assets/foo/Cesium.js?v=1.7")[1]).toEqual("assets/foo/"); expect( r.exec("http://example.invalid/Cesium/assets/foo/Cesium.js")[1] ).toEqual("http://example.invalid/Cesium/assets/foo/"); + expect( + r.exec("http://example.invalid/Cesium/assets/foo/Cesium.js?v=1.7")[1] + ).toEqual("http://example.invalid/Cesium/assets/foo/"); + expect(r.exec("cesium.js")).toBeNull(); + expect(r.exec("Cesium.js%20")).toBeNull(); + expect(r.exec("Cesium.min.js")).toBeNull(); + expect(r.exec("CesiumSomething.js")).toBeNull(); + expect(r.exec("CesiumSomething.js?v=1.7")).toBeNull(); expect(r.exec("assets/foo/bar.cesium.js")).toBeNull(); + expect(r.exec("assets/foo/bar.cesium.js?v=1.7")).toBeNull(); + expect(r.exec("assets/foo/CesiumSomething.js")).toBeNull(); + expect(r.exec("assets/foo/CesiumSomething.js?v=1.7")).toBeNull(); }); it("CESIUM_BASE_URL works with trailing slash", function () { diff --git a/Specs/Data/Cesium3DTiles/PointCloud/PointCloudWithUnicodePropertyNames/pointCloudWithUnicodePropertyNames.pnts b/Specs/Data/Cesium3DTiles/PointCloud/PointCloudWithUnicodePropertyNames/pointCloudWithUnicodePropertyNames.pnts new file mode 100644 index 000000000000..10038a2586de Binary files /dev/null and b/Specs/Data/Cesium3DTiles/PointCloud/PointCloudWithUnicodePropertyNames/pointCloudWithUnicodePropertyNames.pnts differ diff --git a/Specs/Data/Cesium3DTiles/PointCloud/PointCloudWithUnicodePropertyNames/tileset.json b/Specs/Data/Cesium3DTiles/PointCloud/PointCloudWithUnicodePropertyNames/tileset.json new file mode 100644 index 000000000000..02bdf5115813 --- /dev/null +++ b/Specs/Data/Cesium3DTiles/PointCloud/PointCloudWithUnicodePropertyNames/tileset.json @@ -0,0 +1,40 @@ +{ + "asset": { + "version": "1.0" + }, + "extensions": {}, + "geometricError": 17.32, + "root": { + "transform": [ + 0.968635634376879, + 0.24848542777253735, + 0, + 0, + -0.15986460794399626, + 0.6231776137472074, + 0.7655670897127491, + 0, + 0.190232265775849, + -0.7415555636019701, + 0.6433560687121489, + 0, + 1215012.8828876738, + -4736313.051199594, + 4081605.22126042, + 1 + ], + "refine": "ADD", + "boundingVolume": { + "sphere": [ + 0, + 0, + 0, + 5 + ] + }, + "geometricError": 0, + "content": { + "uri": "pointCloudWithUnicodePropertyNames.pnts" + } + } +} diff --git a/Specs/MockTerrainProvider.js b/Specs/MockTerrainProvider.js index c44d2d4d0471..3688a8b39663 100644 --- a/Specs/MockTerrainProvider.js +++ b/Specs/MockTerrainProvider.js @@ -16,6 +16,7 @@ function MockTerrainProvider() { this.tilingScheme.getNumberOfXTilesAtLevel(0) ); this.ready = true; + this.readyPromise = when.resolve(); this.hasWaterMask = true; this._tileDataAvailable = {}; diff --git a/Specs/Renderer/AutomaticUniformSpec.js b/Specs/Renderer/AutomaticUniformSpec.js index c795dbba7ae3..c7cea212aae4 100644 --- a/Specs/Renderer/AutomaticUniformSpec.js +++ b/Specs/Renderer/AutomaticUniformSpec.js @@ -1,5 +1,6 @@ import { Cartesian2 } from "../../Source/Cesium.js"; import { Cartesian3 } from "../../Source/Cesium.js"; +import { Cartographic } from "../../Source/Cesium.js"; import { Color } from "../../Source/Cesium.js"; import { defaultValue } from "../../Source/Cesium.js"; import { DirectionalLight } from "../../Source/Cesium.js"; @@ -73,6 +74,7 @@ describe( ), rightWC: defaultValue(right, Cartesian3.clone(Cartesian3.UNIT_X)), upWC: defaultValue(up, Cartesian3.clone(Cartesian3.UNIT_Y)), + positionCartographic: new Cartographic(0.0, 0.0, 10.0), }; } @@ -1945,6 +1947,20 @@ describe( }).contextToRender(); }); + it("has czm_eyeHeight", function () { + var frameState = createFrameState(context, createMockCamera()); + context.uniformState.update(frameState); + + var fs = + "void main() { " + + " gl_FragColor = vec4(czm_eyeHeight == 10.0); " + + "}"; + expect({ + context: context, + fragmentShader: fs, + }).contextToRender(); + }); + it("has czm_eyeHeight2D == 0,0 in Scene3D", function () { var fs = "void main() { " + diff --git a/Specs/Scene/CameraSpec.js b/Specs/Scene/CameraSpec.js index 34f1c857c97f..7dcb39f01bc4 100644 --- a/Specs/Scene/CameraSpec.js +++ b/Specs/Scene/CameraSpec.js @@ -3494,6 +3494,7 @@ describe("Scene/Camera", function () { startObject: {}, stopObject: {}, duration: 0.001, + complete: jasmine.createSpy("complete"), cancelTween: jasmine.createSpy("cancelTween"), }); @@ -3509,9 +3510,43 @@ describe("Scene/Camera", function () { camera.cancelFlight(); expect(createdTween.cancelTween).toHaveBeenCalled(); + expect(createdTween.complete).not.toHaveBeenCalled(); expect(camera._currentFlight).toBeUndefined(); }); + it("can complete a flight", function () { + spyOn(CameraFlightPath, "createTween").and.returnValue({ + startObject: {}, + stopObject: {}, + duration: 0.001, + complete: jasmine.createSpy("complete"), + cancelTween: jasmine.createSpy("cancelTween"), + }); + + spyOn(camera, "setView"); + + var options = { + destination: Cartesian3.fromDegrees(-117.16, 32.71, 15000.0), + orientation: { + heading: 1, + pitch: 2, + roll: 3, + }, + }; + camera.flyTo(options); + + expect(camera._currentFlight).toBeDefined(); + + var createdTween = camera._currentFlight; + spyOn(createdTween, "cancelTween"); + camera.completeFlight(); + + expect(createdTween.cancelTween).toHaveBeenCalled(); + expect(createdTween.complete).toHaveBeenCalled(); + expect(camera._currentFlight).toBeUndefined(); + expect(camera.setView).toHaveBeenCalledWith(options); + }); + it("flyTo with heading, pitch and roll", function () { scene.mode = SceneMode.SCENE3D; diff --git a/Specs/Scene/Cesium3DTileStyleSpec.js b/Specs/Scene/Cesium3DTileStyleSpec.js index 585dabf29891..67375afa1da3 100644 --- a/Specs/Scene/Cesium3DTileStyleSpec.js +++ b/Specs/Scene/Cesium3DTileStyleSpec.js @@ -4121,11 +4121,11 @@ describe("Scene/Cesium3DTileStyle", function () { // The default color style is white, the default show style is true, and the default pointSize is 1.0, // but the generated generated shader functions should just be undefined. We don't want all the points to be white. var style = new Cesium3DTileStyle({}); - var colorFunction = style.getColorShaderFunction("getColor", "", {}); - var showFunction = style.getShowShaderFunction("getShow", "", {}); + var colorFunction = style.getColorShaderFunction("getColor", {}, {}); + var showFunction = style.getShowShaderFunction("getShow", {}, {}); var pointSizeFunction = style.getPointSizeShaderFunction( "getPointSize", - "", + {}, {} ); expect(colorFunction).toBeUndefined(); diff --git a/Specs/Scene/ConditionsExpressionSpec.js b/Specs/Scene/ConditionsExpressionSpec.js index 3a7cdca7c9d6..5b648895ac92 100644 --- a/Specs/Scene/ConditionsExpressionSpec.js +++ b/Specs/Scene/ConditionsExpressionSpec.js @@ -95,20 +95,23 @@ describe("Scene/ConditionsExpression", function () { it("gets shader function", function () { var expression = new ConditionsExpression(jsonExp); + var properyNameMap = { + Height: "a_height", + }; var shaderFunction = expression.getShaderFunction( "getColor", - "", + properyNameMap, {}, "vec4" ); var expected = "vec4 getColor() \n" + "{ \n" + - " if ((Height > 100.0)) \n" + + " if ((a_height > 100.0)) \n" + " { \n" + " return vec4(vec3(0.0, 0.0, 1.0), 1.0); \n" + " } \n" + - " else if ((Height > 50.0)) \n" + + " else if ((a_height > 50.0)) \n" + " { \n" + " return vec4(vec3(1.0, 0.0, 0.0), 1.0); \n" + " } \n" + @@ -125,7 +128,7 @@ describe("Scene/ConditionsExpression", function () { var expression = new ConditionsExpression([]); var shaderFunction = expression.getShaderFunction( "getColor", - "", + {}, {}, "vec4" ); diff --git a/Specs/Scene/DebugCameraPrimitiveSpec.js b/Specs/Scene/DebugCameraPrimitiveSpec.js index 661473f20d0c..8c81ed2707bc 100644 --- a/Specs/Scene/DebugCameraPrimitiveSpec.js +++ b/Specs/Scene/DebugCameraPrimitiveSpec.js @@ -55,6 +55,7 @@ describe( it("constructs with options", function () { var p = new DebugCameraPrimitive({ camera: camera, + frustumSplits: [0.1, 1000.0], color: Color.YELLOW, updateOnChange: false, show: false, diff --git a/Specs/Scene/ExpressionSpec.js b/Specs/Scene/ExpressionSpec.js index f603d03ebbf0..ef1cabe1ff2a 100644 --- a/Specs/Scene/ExpressionSpec.js +++ b/Specs/Scene/ExpressionSpec.js @@ -3417,7 +3417,7 @@ describe("Scene/Expression", function () { var expression = new Expression("true"); var shaderFunction = expression.getShaderFunction( "getShow", - "", + {}, {}, "bool" ); @@ -3428,169 +3428,194 @@ describe("Scene/Expression", function () { it("gets shader expression for variable", function () { var expression = new Expression("${property}"); - var shaderExpression = expression.getShaderExpression("prefix_", {}); - var expected = "prefix_property"; + var propertyNameMap = { + property: "a_property", + }; + var shaderExpression = expression.getShaderExpression(propertyNameMap, {}); + var expected = "a_property"; + expect(shaderExpression).toEqual(expected); + }); + + it("gets shader expression for feature variable with bracket notation", function () { + var expression = new Expression("${feature['property']}"); + var propertyNameMap = { + property: "a_property", + }; + var shaderExpression = expression.getShaderExpression(propertyNameMap, {}); + var expected = "a_property"; + expect(shaderExpression).toEqual(expected); + }); + + it("gets shader expression for feature variable with dot notation", function () { + var expression = new Expression("${feature.property}"); + var propertyNameMap = { + property: "a_property", + }; + var shaderExpression = expression.getShaderExpression(propertyNameMap, {}); + var expected = "a_property"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for unary not", function () { var expression = new Expression("!true"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "!true"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for unary negative", function () { var expression = new Expression("-5.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "-5.0"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for unary positive", function () { var expression = new Expression("+5.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "+5.0"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for converting to literal boolean", function () { var expression = new Expression("Boolean(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "bool(1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for converting to literal number", function () { var expression = new Expression("Number(true)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "float(true)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary addition", function () { var expression = new Expression("1.0 + 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 + 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary subtraction", function () { var expression = new Expression("1.0 - 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 - 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary multiplication", function () { var expression = new Expression("1.0 * 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 * 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary division", function () { var expression = new Expression("1.0 / 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 / 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary modulus", function () { var expression = new Expression("1.0 % 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "mod(1.0, 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary equals strict", function () { var expression = new Expression("1.0 === 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 == 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary not equals strict", function () { var expression = new Expression("1.0 !== 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 != 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary less than", function () { var expression = new Expression("1.0 < 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 < 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary less than or equals", function () { var expression = new Expression("1.0 <= 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 <= 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary greater than", function () { var expression = new Expression("1.0 > 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 > 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for binary greater than or equals", function () { var expression = new Expression("1.0 >= 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 >= 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for logical and", function () { var expression = new Expression("true && false"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(true && false)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for logical or", function () { var expression = new Expression("true || false"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(true || false)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for ternary conditional", function () { var expression = new Expression("true ? 1.0 : 2.0"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(true ? 1.0 : 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for array indexing", function () { + var propertyNameMap = { property: "property" }; + var expression = new Expression("${property[0]}"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression(propertyNameMap, {}); var expected = "property[0]"; expect(shaderExpression).toEqual(expected); expression = new Expression("${property[4 / 2]}"); - shaderExpression = expression.getShaderExpression("", {}); + shaderExpression = expression.getShaderExpression(propertyNameMap, {}); expected = "property[int((4.0 / 2.0))]"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for array", function () { var expression = new Expression("[1.0, 2.0]"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "vec2(1.0, 2.0)"; expect(shaderExpression).toEqual(expected); expression = new Expression("[1.0, 2.0, 3.0]"); - shaderExpression = expression.getShaderExpression("", {}); + shaderExpression = expression.getShaderExpression({}, {}); expected = "vec3(1.0, 2.0, 3.0)"; expect(shaderExpression).toEqual(expected); expression = new Expression("[1.0, 2.0, 3.0, 4.0]"); - shaderExpression = expression.getShaderExpression("", {}); + shaderExpression = expression.getShaderExpression({}, {}); expected = "vec4(1.0, 2.0, 3.0, 4.0)"; expect(shaderExpression).toEqual(expected); }); @@ -3598,136 +3623,179 @@ describe("Scene/Expression", function () { it("throws when getting shader expression for array of invalid length", function () { var expression = new Expression("[]"); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); expression = new Expression("[1.0]"); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); expression = new Expression("[1.0, 2.0, 3.0, 4.0, 5.0]"); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("gets shader expression for boolean", function () { var expression = new Expression("true || false"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(true || false)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for integer", function () { var expression = new Expression("1"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "1.0"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for float", function () { var expression = new Expression("1.02"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "1.02"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for color", function () { + var propertyNameMap = { property: "property" }; var shaderState = { translucent: false }; var expression = new Expression("color()"); - var shaderExpression = expression.getShaderExpression("", shaderState); + var shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); var expected = "vec4(1.0)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(false); shaderState = { translucent: false }; expression = new Expression('color("red")'); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(vec3(1.0, 0.0, 0.0), 1.0)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(false); shaderState = { translucent: false }; expression = new Expression('color("#FFF")'); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(vec3(1.0, 1.0, 1.0), 1.0)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(false); shaderState = { translucent: false }; expression = new Expression('color("#FF0000")'); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(vec3(1.0, 0.0, 0.0), 1.0)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(false); shaderState = { translucent: false }; expression = new Expression('color("rgb(255, 0, 0)")'); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(vec3(1.0, 0.0, 0.0), 1.0)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(false); shaderState = { translucent: false }; expression = new Expression('color("red", 0.5)'); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(vec3(1.0, 0.0, 0.0), 0.5)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(true); shaderState = { translucent: false }; expression = new Expression("rgb(255, 0, 0)"); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(1.0, 0.0, 0.0, 1.0)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(false); shaderState = { translucent: false }; expression = new Expression("rgb(255, ${property}, 0)"); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(255.0 / 255.0, property / 255.0, 0.0 / 255.0, 1.0)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(false); shaderState = { translucent: false }; expression = new Expression("rgba(255, 0, 0, 0.5)"); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(1.0, 0.0, 0.0, 0.5)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(true); shaderState = { translucent: false }; expression = new Expression("rgba(255, ${property}, 0, 0.5)"); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(255.0 / 255.0, property / 255.0, 0.0 / 255.0, 0.5)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(true); shaderState = { translucent: false }; expression = new Expression("hsl(1.0, 0.5, 0.5)"); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(0.75, 0.25, 0.25, 1.0)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(false); shaderState = { translucent: false }; expression = new Expression("hsla(1.0, 0.5, 0.5, 0.5)"); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(0.75, 0.25, 0.25, 0.5)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(true); shaderState = { translucent: false }; expression = new Expression("hsl(1.0, ${property}, 0.5)"); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(czm_HSLToRGB(vec3(1.0, property, 0.5)), 1.0)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(false); shaderState = { translucent: false }; expression = new Expression("hsla(1.0, ${property}, 0.5, 0.5)"); - shaderExpression = expression.getShaderExpression("", shaderState); + shaderExpression = expression.getShaderExpression( + propertyNameMap, + shaderState + ); expected = "vec4(czm_HSLToRGB(vec3(1.0, property, 0.5)), 0.5)"; expect(shaderExpression).toEqual(expected); expect(shaderState.translucent).toBe(true); @@ -3738,7 +3806,7 @@ describe("Scene/Expression", function () { var expression = new Expression( "color().r + color().g + color().b + color().a" ); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(((vec4(1.0)[0] + vec4(1.0)[1]) + vec4(1.0)[2]) + vec4(1.0)[3])"; expect(shaderExpression).toEqual(expected); @@ -3747,34 +3815,38 @@ describe("Scene/Expression", function () { expression = new Expression( "color().x + color().y + color().z + color().w" ); - shaderExpression = expression.getShaderExpression("", {}); + shaderExpression = expression.getShaderExpression({}, {}); expect(shaderExpression).toEqual(expected); // [0], [1], [2], [3] expression = new Expression( "color()[0] + color()[1] + color()[2] + color()[3]" ); - shaderExpression = expression.getShaderExpression("", {}); + shaderExpression = expression.getShaderExpression({}, {}); expect(shaderExpression).toEqual(expected); }); it("gets shader expression for vector", function () { + var propertyNameMap = { + property: "property", + }; + var expression = new Expression("vec4(1, 2, 3, 4)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression(propertyNameMap, {}); expect(shaderExpression).toEqual("vec4(1.0, 2.0, 3.0, 4.0)"); expression = new Expression("vec4(1) + vec4(2)"); - shaderExpression = expression.getShaderExpression("", {}); + shaderExpression = expression.getShaderExpression(propertyNameMap, {}); expect(shaderExpression).toEqual("(vec4(1.0) + vec4(2.0))"); expression = new Expression("vec4(1, ${property}, vec2(1, 2).x, 0)"); - shaderExpression = expression.getShaderExpression("", {}); + shaderExpression = expression.getShaderExpression(propertyNameMap, {}); expect(shaderExpression).toEqual( "vec4(1.0, property, vec2(1.0, 2.0)[0], 0.0)" ); expression = new Expression("vec4(vec3(2), 1.0)"); - shaderExpression = expression.getShaderExpression("", {}); + shaderExpression = expression.getShaderExpression(propertyNameMap, {}); expect(shaderExpression).toEqual("vec4(vec3(2.0), 1.0)"); }); @@ -3783,7 +3855,7 @@ describe("Scene/Expression", function () { var expression = new Expression( "vec4(1).x + vec4(1).y + vec4(1).z + vec4(1).w" ); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(((vec4(1.0)[0] + vec4(1.0)[1]) + vec4(1.0)[2]) + vec4(1.0)[3])"; expect(shaderExpression).toEqual(expected); @@ -3792,202 +3864,202 @@ describe("Scene/Expression", function () { expression = new Expression( "vec4(1)[0] + vec4(1)[1] + vec4(1)[2] + vec4(1)[3]" ); - shaderExpression = expression.getShaderExpression("", {}); + shaderExpression = expression.getShaderExpression({}, {}); expect(shaderExpression).toEqual(expected); }); it("gets shader expression for tiles3d_tileset_time", function () { var expression = new Expression("${tiles3d_tileset_time}"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "u_time"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for abs", function () { var expression = new Expression("abs(-1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "abs(-1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for cos", function () { var expression = new Expression("cos(0.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "cos(0.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for sin", function () { var expression = new Expression("sin(0.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "sin(0.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for tan", function () { var expression = new Expression("tan(0.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "tan(0.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for acos", function () { var expression = new Expression("acos(0.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "acos(0.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for asin", function () { var expression = new Expression("asin(0.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "asin(0.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for atan", function () { var expression = new Expression("atan(0.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "atan(0.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for sqrt", function () { var expression = new Expression("sqrt(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "sqrt(1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for sign", function () { var expression = new Expression("sign(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "sign(1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for floor", function () { var expression = new Expression("floor(1.5)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "floor(1.5)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for ceil", function () { var expression = new Expression("ceil(1.2)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "ceil(1.2)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for round", function () { var expression = new Expression("round(1.2)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "floor(1.2 + 0.5)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for exp", function () { var expression = new Expression("exp(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "exp(1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for exp2", function () { var expression = new Expression("exp2(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "exp2(1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for log", function () { var expression = new Expression("log(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "log(1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for log2", function () { var expression = new Expression("log2(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "log2(1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for fract", function () { var expression = new Expression("fract(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "fract(1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for clamp", function () { var expression = new Expression("clamp(50.0, 0.0, 100.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "clamp(50.0, 0.0, 100.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for mix", function () { var expression = new Expression("mix(0.0, 2.0, 0.5)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "mix(0.0, 2.0, 0.5)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for atan2", function () { var expression = new Expression("atan2(0.0,1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "atan(0.0, 1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for pow", function () { var expression = new Expression("pow(2.0,2.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "pow(2.0, 2.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for min", function () { var expression = new Expression("min(3.0,5.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "min(3.0, 5.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for max", function () { var expression = new Expression("max(3.0,5.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "max(3.0, 5.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for length", function () { var expression = new Expression("length(3.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "length(3.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for normalize", function () { var expression = new Expression("normalize(3.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "normalize(3.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for distance", function () { var expression = new Expression("distance(0.0, 1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "distance(0.0, 1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for dot", function () { var expression = new Expression("dot(1.0, 2.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "dot(1.0, 2.0)"; expect(shaderExpression).toEqual(expected); }); @@ -3996,35 +4068,35 @@ describe("Scene/Expression", function () { var expression = new Expression( "cross(vec3(1.0, 1.0, 1.0), vec3(2.0, 2.0, 2.0))" ); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "cross(vec3(1.0, 1.0, 1.0), vec3(2.0, 2.0, 2.0))"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for isNaN", function () { var expression = new Expression("isNaN(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(1.0 != 1.0)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for isFinite", function () { var expression = new Expression("isFinite(1.0)"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "(abs(1.0) < czm_infinity)"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for null", function () { var expression = new Expression("null"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "czm_infinity"; expect(shaderExpression).toEqual(expected); }); it("gets shader expression for undefined", function () { var expression = new Expression("undefined"); - var shaderExpression = expression.getShaderExpression("", {}); + var shaderExpression = expression.getShaderExpression({}, {}); var expected = "czm_infinity"; expect(shaderExpression).toEqual(expected); }); @@ -4032,85 +4104,85 @@ describe("Scene/Expression", function () { it("throws when getting shader expression for regex", function () { var expression = new Expression('regExp("a").test("abc")'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); expression = new Expression('regExp("a(.)", "i").exec("Abc")'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); expression = new Expression('regExp("a") =~ "abc"'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); expression = new Expression('regExp("a") !~ "abc"'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("throws when getting shader expression for member expression with dot", function () { var expression = new Expression("${property.name}"); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("throws when getting shader expression for string member expression with brackets", function () { var expression = new Expression('${property["name"]}'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("throws when getting shader expression for String", function () { var expression = new Expression("String(1.0)"); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("throws when getting shader expression for toString", function () { var expression = new Expression('color("red").toString()'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("throws when getting shader expression for literal string", function () { var expression = new Expression('"name"'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("throws when getting shader expression for variable in string", function () { var expression = new Expression('"${property}"'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("throws when getting shader expression for isExactClass", function () { var expression = new Expression('isExactClass("door")'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("throws when getting shader expression for isClass", function () { var expression = new Expression('isClass("door")'); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); it("throws when getting shader expression for getExactClassName", function () { var expression = new Expression("getExactClassName()"); expect(function () { - return expression.getShaderExpression("", {}); + return expression.getShaderExpression({}, {}); }).toThrowRuntimeError(); }); }); diff --git a/Specs/Scene/GlobeSpec.js b/Specs/Scene/GlobeSpec.js index fae9596de8a0..c0088821a015 100644 --- a/Specs/Scene/GlobeSpec.js +++ b/Specs/Scene/GlobeSpec.js @@ -3,6 +3,10 @@ import { Rectangle } from "../../Source/Cesium.js"; import { Resource } from "../../Source/Cesium.js"; import { Globe } from "../../Source/Cesium.js"; import { SingleTileImageryProvider } from "../../Source/Cesium.js"; +import { Color } from "../../Source/Cesium.js"; +import { Cartesian3 } from "../../Source/Cesium.js"; +import { HeadingPitchRoll } from "../../Source/Cesium.js"; +import { NearFarScalar } from "../../Source/Cesium.js"; import createScene from "../createScene.js"; import pollToPromise from "../pollToPromise.js"; @@ -412,6 +416,78 @@ describe( ); }); }); + + it("gets underground color", function () { + expect(globe.undergroundColor).toEqual(Color.BLACK); + }); + + it("sets underground color", function () { + globe.undergroundColor = Color.RED; + + scene.camera.setView({ + destination: new Cartesian3( + -524251.65918537375, + -5316355.5357514685, + 3400179.253223899 + ), + orientation: new HeadingPitchRoll( + 0.22779127099032603, + -0.7030060668670961, + 0.0024147223687949193 + ), + }); + + return updateUntilDone(globe).then(function () { + expect(scene).toRender([255, 0, 0, 255]); + }); + }); + + it("gets underground color by distance", function () { + expect(globe.undergroundColorAlphaByDistance).toBeDefined(); + }); + + it("sets underground color by distance", function () { + globe.baseColor = Color.BLACK; + globe.undergroundColor = Color.RED; + var radius = globe.ellipsoid.maximumRadius; + globe.undergroundColorAlphaByDistance = new NearFarScalar( + radius * 0.25, + 0.0, + radius * 2.0, + 1.0 + ); + + scene.camera.setView({ + destination: new Cartesian3( + -524251.65918537375, + -5316355.5357514685, + 3400179.253223899 + ), + orientation: new HeadingPitchRoll( + 0.24245689061958142, + -0.445653254172905, + 0.0024147223687949193 + ), + }); + + return updateUntilDone(globe).then(function () { + expect(scene).toRenderAndCall(function (rgba) { + expect(rgba[0]).toBeGreaterThan(0); + expect(rgba[0]).toBeLessThan(255); + }); + }); + }); + + it("throws if underground color by distance far is less than near", function () { + expect(function () { + globe.undergroundColorAlphaByDistance = new NearFarScalar( + 1.0, + 0.0, + 0.0, + 1.0 + ); + }).toThrowDeveloperError(); + }); }, "WebGL" ); diff --git a/Specs/Scene/GlobeSurfaceTileProviderSpec.js b/Specs/Scene/GlobeSurfaceTileProviderSpec.js index d615b23fc2b7..d81a3f01b372 100644 --- a/Specs/Scene/GlobeSurfaceTileProviderSpec.js +++ b/Specs/Scene/GlobeSurfaceTileProviderSpec.js @@ -622,6 +622,8 @@ describe( ); layer.alpha = 0.123; + layer.nightAlpha = 0.658; + layer.dayAlpha = 0.356; layer.brightness = 0.456; layer.contrast = 0.654; layer.gamma = 0.321; @@ -651,6 +653,8 @@ describe( ++tileCommandCount; expect(uniforms.u_dayTextureAlpha()).toEqual([0.123]); + expect(uniforms.u_dayTextureNightAlpha()).toEqual([0.658]); + expect(uniforms.u_dayTextureDayAlpha()).toEqual([0.356]); expect(uniforms.u_dayTextureBrightness()).toEqual([0.456]); expect(uniforms.u_dayTextureContrast()).toEqual([0.654]); expect(uniforms.u_dayTextureOneOverGamma()).toEqual([1.0 / 0.321]); diff --git a/Specs/Scene/GlobeTranslucencyFramebufferSpec.js b/Specs/Scene/GlobeTranslucencyFramebufferSpec.js new file mode 100644 index 000000000000..d2dfeda2d2fb --- /dev/null +++ b/Specs/Scene/GlobeTranslucencyFramebufferSpec.js @@ -0,0 +1,110 @@ +import { BoundingRectangle } from "../../Source/Cesium.js"; +import { Framebuffer } from "../../Source/Cesium.js"; +import { GlobeTranslucencyFramebuffer } from "../../Source/Cesium.js"; +import { PassState } from "../../Source/Cesium.js"; +import { PixelDatatype } from "../../Source/Cesium.js"; +import { Texture } from "../../Source/Cesium.js"; +import createScene from "../createScene.js"; + +describe("Scene/GlobeTranslucencyFramebuffer", function () { + var scene; + + beforeAll(function () { + scene = createScene(); + }); + + afterAll(function () { + scene.destroyForSpecs(); + }); + + it("creates resources", function () { + var globeTranslucency = new GlobeTranslucencyFramebuffer(); + var context = scene.context; + var viewport = new BoundingRectangle(0, 0, 100, 100); + var passState = new PassState(context); + globeTranslucency.updateAndClear(false, viewport, context, passState); + expect(globeTranslucency._colorTexture).toBeDefined(); + expect(globeTranslucency._framebuffer).toBeDefined(); + expect(globeTranslucency._packedDepthTexture).toBeDefined(); + expect(globeTranslucency._packedDepthFramebuffer).toBeDefined(); + + if (context.depthTexture) { + expect(globeTranslucency._depthStencilTexture).toBeDefined(); + } else { + expect(globeTranslucency._depthStencilRenderbuffer).toBeDefined(); + } + + expect(globeTranslucency._packedDepthCommand).toBeDefined(); + expect(globeTranslucency._clearCommand).toBeDefined(); + }); + + it("recreates resources when viewport changes", function () { + var globeTranslucency = new GlobeTranslucencyFramebuffer(); + var frameState = scene.frameState; + var context = frameState.context; + var viewport = new BoundingRectangle(0, 0, 100, 100); + var passState = new PassState(context); + globeTranslucency.updateAndClear(false, viewport, context, passState); + var firstColorTexture = globeTranslucency._colorTexture; + var firstFramebuffer = globeTranslucency._framebuffer; + var firstPackedDepthFramebuffer = globeTranslucency._packedDepthFramebuffer; + expect(globeTranslucency._clearCommand.framebuffer).toBe(firstFramebuffer); + expect(globeTranslucency._packedDepthCommand.framebuffer).toBe( + firstPackedDepthFramebuffer + ); + + viewport.width = 50; + globeTranslucency.updateAndClear(false, viewport, context, passState); + expect(firstColorTexture.isDestroyed()).toBe(true); + expect(globeTranslucency._colorTexture).not.toBe(firstColorTexture); + expect(globeTranslucency._clearCommand.framebuffer).not.toBe( + firstFramebuffer + ); + expect(globeTranslucency._packedDepthCommand.framebuffer).not.toBe( + firstPackedDepthFramebuffer + ); + }); + + it("recreates resources when HDR changes", function () { + if (!scene.highDynamicRangeSupported) { + return; + } + + var frameState = scene.frameState; + var context = frameState.context; + var globeTranslucency = new GlobeTranslucencyFramebuffer(); + var viewport = new BoundingRectangle(0, 0, 100, 100); + var passState = new PassState(context); + globeTranslucency.updateAndClear(false, viewport, context, passState); + var firstColorTexture = globeTranslucency._colorTexture; + + var expectedPixelDatatype = context.halfFloatingPointTexture + ? PixelDatatype.HALF_FLOAT + : PixelDatatype.FLOAT; + globeTranslucency.updateAndClear(true, viewport, context, passState); + expect(firstColorTexture.isDestroyed()).toBe(true); + expect(globeTranslucency._colorTexture).not.toBe(firstColorTexture); + expect(globeTranslucency._colorTexture.pixelDatatype).toBe( + expectedPixelDatatype + ); + }); + + it("destroys", function () { + var globeTranslucency = new GlobeTranslucencyFramebuffer(); + var frameState = scene.frameState; + var context = frameState.context; + var viewport = new BoundingRectangle(0, 0, 100, 100); + var passState = new PassState(context); + + globeTranslucency.updateAndClear(false, viewport, context, passState); + + spyOn(Texture.prototype, "destroy").and.callThrough(); + spyOn(Framebuffer.prototype, "destroy").and.callThrough(); + + globeTranslucency.destroy(); + + expect(globeTranslucency.isDestroyed()).toBe(true); + expect(Texture.prototype.destroy).toHaveBeenCalled(); + expect(Framebuffer.prototype.destroy).toHaveBeenCalled(); + }); +}); diff --git a/Specs/Scene/GlobeTranslucencyStateSpec.js b/Specs/Scene/GlobeTranslucencyStateSpec.js new file mode 100644 index 000000000000..ffae30855719 --- /dev/null +++ b/Specs/Scene/GlobeTranslucencyStateSpec.js @@ -0,0 +1,719 @@ +import { Color } from "../../Source/Cesium.js"; +import { DrawCommand } from "../../Source/Cesium.js"; +import { FrustumCommands } from "../../Source/Cesium.js"; +import { Globe } from "../../Source/Cesium.js"; +import { GlobeTranslucencyFramebuffer } from "../../Source/Cesium.js"; +import { GlobeTranslucencyState } from "../../Source/Cesium.js"; +import { NearFarScalar } from "../../Source/Cesium.js"; +import { Pass } from "../../Source/Cesium.js"; +import { PassState } from "../../Source/Cesium.js"; +import { RenderState } from "../../Source/Cesium.js"; +import { SceneMode } from "../../Source/Cesium.js"; +import { ShaderProgram } from "../../Source/Cesium.js"; +import { ShaderSource } from "../../Source/Cesium.js"; +import createScene from "../createScene.js"; + +var scene; +var globe; +var frameState; +var state; +var framebuffer; + +function reset() { + scene._globe = globe; + + globe.show = true; + globe.translucency.enabled = false; + globe.translucency.frontFaceAlpha = 1.0; + globe.translucency.frontFaceAlphaByDistance = undefined; + globe.translucency.backFaceAlpha = 1.0; + globe.translucency.backFaceAlphaByDistance = undefined; + globe.baseColor = Color.WHITE; + globe.depthTestAgainstTerrain = false; + + frameState.commandList.length = 0; + frameState.passes.pick = false; + frameState.frameNumber = 0; + + scene._cameraUnderground = false; + scene._mode = SceneMode.SCENE3D; +} + +function createShaderProgram(colorString) { + var vs = "void main() { gl_Position = vec4(0.0, 0.0, 0.0, 1.0); }"; + var fs = "void main() { gl_FragColor = vec4(" + colorString + "); }"; + + var vertexShaderSource = new ShaderSource({ + sources: [vs], + }); + + var fragmentShaderSource = new ShaderSource({ + sources: [fs], + }); + + return ShaderProgram.fromCache({ + context: scene.context, + vertexShaderSource: vertexShaderSource, + fragmentShaderSource: fragmentShaderSource, + }); +} + +function createDrawCommand() { + var uniformMap = {}; + var shaderProgram = createShaderProgram("0.0"); + + var renderState = RenderState.fromCache({ + depthMask: true, + cull: { + enabled: true, + }, + }); + + var drawCommand = new DrawCommand({ + shaderProgram: shaderProgram, + uniformMap: uniformMap, + renderState: renderState, + }); + + return drawCommand; +} + +describe("Scene/GlobeTranslucencyState", function () { + beforeAll(function () { + scene = createScene(); + scene.globe = new Globe(); + globe = scene.globe; + frameState = scene.frameState; + state = new GlobeTranslucencyState(); + framebuffer = new GlobeTranslucencyFramebuffer(); + }); + + afterAll(function () { + scene.destroyForSpecs(); + }); + + beforeEach(function () { + reset(); + }); + + it("gets front face alpha by distance", function () { + // Opaque + reset(); + state.update(scene); + var frontFaceAlphaByDistance = state.frontFaceAlphaByDistance; + var backFaceAlphaByDistance = state.backFaceAlphaByDistance; + expect(frontFaceAlphaByDistance.nearValue).toBe(1.0); + expect(frontFaceAlphaByDistance.farValue).toBe(1.0); + expect(backFaceAlphaByDistance.nearValue).toBe(1.0); + expect(backFaceAlphaByDistance.farValue).toBe(1.0); + + // Front and back translucent + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.translucency.backFaceAlpha = 0.25; + state.update(scene); + expect(frontFaceAlphaByDistance.nearValue).toBe(0.5); + expect(frontFaceAlphaByDistance.farValue).toBe(0.5); + expect(backFaceAlphaByDistance.nearValue).toBe(0.25); + expect(backFaceAlphaByDistance.farValue).toBe(0.25); + + // Front and back translucent with alpha by distance + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.translucency.backFaceAlpha = 0.25; + globe.translucency.frontFaceAlphaByDistance = new NearFarScalar( + 0.0, + 0.5, + 1.0, + 0.75 + ); + state.update(scene); + expect(frontFaceAlphaByDistance.nearValue).toBe(0.25); + expect(frontFaceAlphaByDistance.farValue).toBe(0.375); + expect(backFaceAlphaByDistance.nearValue).toBe(0.25); + expect(backFaceAlphaByDistance.farValue).toBe(0.25); + }); + + it("detects if globe is translucent", function () { + // Returns false when globe is undefined + reset(); + scene._globe = undefined; + state.update(scene); + expect(state.translucent).toBe(false); + + // Returns false when globe.show is false + reset(); + globe.show = false; + state.update(scene); + expect(state.translucent).toBe(false); + + // Returns false for default globe + reset(); + state.update(scene); + expect(state.translucent).toBe(false); + + // Returns true when base color is translucent + reset(); + globe.translucency.enabled = true; + globe.baseColor = Color.TRANSPARENT; + state.update(scene); + expect(state.translucent).toBe(true); + + // Returns true when front face alpha is less than 1.0 + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + state.update(scene); + expect(state.translucent).toBe(true); + }); + + it("detects if sun is visible through globe", function () { + // Returns true when globe is undefined + reset(); + scene._globe = undefined; + state.update(scene); + expect(state.sunVisibleThroughGlobe).toBe(true); + + // Returns true when globe.show is false + reset(); + globe.show = false; + state.update(scene); + expect(state.sunVisibleThroughGlobe).toBe(true); + + // Returns false for default globe + reset(); + state.update(scene); + expect(state.sunVisibleThroughGlobe).toBe(false); + + // Returns true if front face and back face are translucent and camera is above ground + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.translucency.backFaceAlpha = 0.5; + state.update(scene); + expect(state.sunVisibleThroughGlobe).toBe(true); + + // Returns false if front face is translucent and back face is opaque and camera is above ground + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + state.update(scene); + expect(state.sunVisibleThroughGlobe).toBe(false); + + // Returns true if front face is translucent and camera is underground + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + scene._cameraUnderground = true; + state.update(scene); + expect(state.sunVisibleThroughGlobe).toBe(true); + }); + + it("detects if environment is visible", function () { + // Returns true when globe is undefined + reset(); + scene._globe = undefined; + state.update(scene); + expect(state.environmentVisible).toBe(true); + + // Returns true when globe.show is false + reset(); + globe.show = false; + state.update(scene); + expect(state.environmentVisible).toBe(true); + + // Returns true for default globe + reset(); + state.update(scene); + expect(state.environmentVisible).toBe(true); + + // Returns false if globe is opaque and camera is underground + reset(); + scene._cameraUnderground = true; + state.update(scene); + expect(state.environmentVisible).toBe(false); + + // Returns true if front faces are translucent and camera is underground + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + scene._cameraUnderground = true; + state.update(scene); + expect(state.environmentVisible).toBe(true); + }); + + it("detects whether to use depth plane", function () { + // Returns false when globe is undefined + reset(); + scene._globe = undefined; + state.update(scene); + expect(state.useDepthPlane).toBe(false); + + // Returns false when globe.show is false + reset(); + globe.show = false; + state.update(scene); + expect(state.useDepthPlane).toBe(false); + + // Returns false if camera is underground + reset(); + scene._cameraUnderground = true; + state.update(scene); + expect(state.useDepthPlane).toBe(false); + + // Return false when globe is translucent + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + state.update(scene); + expect(state.useDepthPlane).toBe(false); + }); + + it("gets number of texture uniforms required", function () { + // Returns zero if globe is opaque + reset(); + state.update(scene); + expect(state.numberOfTextureUniforms).toBe(0); + + // Returns two when globe is translucent and manual depth testing is required + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + state.update(scene); + expect(state.numberOfTextureUniforms).toBe(1 + scene.context.depthTexture); + + // Returns one when globe is translucent and manual depth testing is not required + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + expect(state.numberOfTextureUniforms).toBe(1); + }); + + function checkTypes(state, typeArrays) { + var derivedCommandTypes = state._derivedCommandTypes; + var derivedBlendCommandTypes = state._derivedBlendCommandTypes; + var derivedPickCommandTypes = state._derivedPickCommandTypes; + var derivedCommandTypesToUpdate = state._derivedCommandTypesToUpdate; + + var length = state._derivedCommandsLength; + var blendLength = state._derivedBlendCommandsLength; + var pickLength = state._derivedPickCommandsLength; + var updateLength = state._derivedCommandsToUpdateLength; + + var types = derivedCommandTypes.slice(0, length); + var blendTypes = derivedBlendCommandTypes.slice(0, blendLength); + var pickTypes = derivedPickCommandTypes.slice(0, pickLength); + var updateTypes = derivedCommandTypesToUpdate.slice(0, updateLength); + + expect(types).toEqual(typeArrays[0]); + expect(blendTypes).toEqual(typeArrays[1]); + expect(pickTypes).toEqual(typeArrays[2]); + expect(updateTypes).toEqual(typeArrays[3]); + } + + it("gets derived commands to update", function () { + // Front opaque + reset(); + state.update(scene); + checkTypes(state, [[], [], [], []]); + + // Front translucent, back opaque + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + checkTypes(state, [ + [2, 1, 5], + [1, 5], + [2, 1, 9], + [1, 2, 5, 9], + ]); + + // Front translucent, back opaque, manual depth test + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + state.update(scene); + + if (frameState.context.depthTexture) { + checkTypes(state, [ + [2, 1, 7], + [1, 7], + [2, 1, 9], + [1, 2, 7, 9], + ]); + } else { + checkTypes(state, [ + [2, 1, 5], + [1, 5], + [2, 1, 9], + [1, 2, 5, 9], + ]); + } + + // Front translucent, back opaque, manual depth test, camera underground + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + scene._cameraUnderground = true; + state.update(scene); + if (frameState.context.depthTexture) { + checkTypes(state, [ + [3, 0, 8], + [0, 8], + [3, 0, 10], + [0, 3, 8, 10], + ]); + } else { + checkTypes(state, [ + [3, 0, 6], + [0, 6], + [3, 0, 10], + [0, 3, 6, 10], + ]); + } + + // Front translucent, back translucent + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.translucency.backFaceAlpha = 0.5; + state.update(scene); + checkTypes(state, [ + [4, 6, 5], + [6, 5], + [4, 10, 9], + [4, 5, 6, 9, 10], + ]); + + // Front translucent, back translucent, camera underground + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.translucency.backFaceAlpha = 0.5; + scene._cameraUnderground = true; + state.update(scene); + checkTypes(state, [ + [4, 5, 6], + [5, 6], + [4, 9, 10], + [4, 5, 6, 9, 10], + ]); + + // Translucent, 2D + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + scene._mode = SceneMode.SCENE2D; + state.update(scene); + checkTypes(state, [ + [2, 5], + [2, 5], + [2, 9], + [2, 5, 9], + ]); + }); + + it("detects when derived command requirements have changed", function () { + // Front opaque + reset(); + state.update(scene); + + // Front translucent, back opaque + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + expect(state._derivedCommandsDirty).toBe(true); + + // Same state + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + expect(state._derivedCommandsDirty).toBe(false); + }); + + it("does not update derived commands when globe is opaque", function () { + var command = createDrawCommand(); + + reset(); + state.update(scene); + state.updateDerivedCommands(command, frameState); + var derivedCommands = command.derivedCommands.globeTranslucency; + expect(derivedCommands).toBeUndefined(); + }); + + it("updates derived commands", function () { + var command = createDrawCommand(); + var uniformMap = command.uniformMap; + var shaderProgram = command.shaderProgram; + var renderState = command.renderState; + + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + state.updateDerivedCommands(command, frameState); + var derivedCommands = command.derivedCommands.globeTranslucency; + expect(derivedCommands).toBeDefined(); + expect(derivedCommands.opaqueBackFaceCommand).toBeDefined(); + expect(derivedCommands.depthOnlyFrontFaceCommand).toBeDefined(); + expect(derivedCommands.translucentFrontFaceCommand).toBeDefined(); + expect(derivedCommands.pickFrontFaceCommand).toBeDefined(); + expect(derivedCommands.pickBackFaceCommand).toBeUndefined(); + + var derivedCommand = derivedCommands.translucentFrontFaceCommand; + var derivedUniformMap = derivedCommand.uniformMap; + var derivedShaderProgram = derivedCommand.shaderProgram; + var derivedRenderState = derivedCommand.renderState; + + expect(derivedUniformMap).not.toBe(uniformMap); + expect(derivedShaderProgram).not.toBe(shaderProgram); + expect(derivedRenderState).not.toBe(renderState); + + // Check that the derived commands get updated when the command changes + command.uniformMap = {}; + command.shaderProgram = createShaderProgram("1.0"); + command.renderState = RenderState.fromCache({ + colorMask: { + red: false, + }, + }); + + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + state.updateDerivedCommands(command, frameState); + derivedCommands = command.derivedCommands.globeTranslucency; + derivedCommand = derivedCommands.translucentFrontFaceCommand; + + expect(derivedCommand.uniformMap).not.toBe(derivedUniformMap); + expect(derivedCommand.shaderProgram).not.toBe(derivedShaderProgram); + expect(derivedCommand.renderState).not.toBe(derivedRenderState); + expect(derivedCommand.uniformMap).not.toBe(uniformMap); + expect(derivedCommand.shaderProgram).not.toBe(shaderProgram); + expect(derivedCommand.renderState).not.toBe(renderState); + + // Check that cached shader programs and render states are used + command.uniformMap = uniformMap; + command.shaderProgram = shaderProgram; + command.renderState = renderState; + + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + state.updateDerivedCommands(command, frameState); + derivedCommands = command.derivedCommands.globeTranslucency; + derivedCommand = derivedCommands.translucentFrontFaceCommand; + + expect(derivedCommand.uniformMap).not.toBe(derivedUniformMap); + expect(derivedCommand.shaderProgram).toBe(derivedShaderProgram); + expect(derivedCommand.renderState).toBe(derivedRenderState); + }); + + it("does not push derived commands when blend command is in the pick pass", function () { + var command = createDrawCommand(); + + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + frameState.passes.pick = true; + state.update(scene); + state.updateDerivedCommands(command, frameState); + state.pushDerivedCommands(command, true, frameState); + + expect(frameState.commandList.length).toBe(0); + }); + + it("pushes globe command when globe is opaque", function () { + var command = createDrawCommand(); + + reset(); + state.update(scene); + state.updateDerivedCommands(command, frameState); + state.pushDerivedCommands(command, false, frameState); + + expect(frameState.commandList.length).toBe(1); + expect(frameState.commandList[0]).toBe(command); + }); + + it("pushes derived commands when globe is translucent", function () { + var command = createDrawCommand(); + + // isBlendCommand = false + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + state.updateDerivedCommands(command, frameState); + state.pushDerivedCommands(command, false, frameState); + + var derivedCommands = command.derivedCommands.globeTranslucency; + expect(frameState.commandList).toEqual([ + derivedCommands.depthOnlyFrontFaceCommand, + derivedCommands.opaqueBackFaceCommand, + derivedCommands.translucentFrontFaceCommand, + ]); + + // isBlendCommand = true + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + state.updateDerivedCommands(command, frameState); + state.pushDerivedCommands(command, true, frameState); + + expect(frameState.commandList).toEqual([ + derivedCommands.opaqueBackFaceCommand, + derivedCommands.translucentFrontFaceCommand, + ]); + + // picking + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + frameState.passes.pick = true; + state.update(scene); + state.updateDerivedCommands(command, frameState); + state.pushDerivedCommands(command, false, frameState); + + expect(frameState.commandList).toEqual([ + derivedCommands.depthOnlyFrontFaceCommand, + derivedCommands.opaqueBackFaceCommand, + derivedCommands.pickFrontFaceCommand, + ]); + }); + + it("executes globe commands", function () { + var context = frameState.context; + var passState = new PassState(context); + var command = createDrawCommand(); + + var executeCommand = jasmine.createSpy("executeCommand"); + spyOn(GlobeTranslucencyFramebuffer.prototype, "clearClassification"); + + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + state.updateDerivedCommands(command, frameState); + state.pushDerivedCommands(command, false, frameState); + + var globeCommands = frameState.commandList; + + var frustumCommands = new FrustumCommands(); + frustumCommands.commands[Pass.GLOBE] = globeCommands; + frustumCommands.indices[Pass.GLOBE] = globeCommands.length; + + state.executeGlobeCommands( + frustumCommands, + executeCommand, + framebuffer, + scene, + passState + ); + + expect(executeCommand).toHaveBeenCalledWith( + command.derivedCommands.globeTranslucency.opaqueBackFaceCommand, + scene, + context, + passState + ); + expect( + GlobeTranslucencyFramebuffer.prototype.clearClassification + ).toHaveBeenCalled(); + }); + + it("does not execute globe commands if there are no commands", function () { + var frameState = scene.frameState; + var context = frameState.context; + var passState = new PassState(context); + + var frustumCommands = new FrustumCommands(); + + var executeCommand = jasmine.createSpy("executeCommand"); + state.executeGlobeCommands( + frustumCommands, + executeCommand, + framebuffer, + scene, + passState + ); + + expect(executeCommand).not.toHaveBeenCalled(); + }); + + it("executes classification commands", function () { + var context = frameState.context; + var passState = new PassState(context); + var command = createDrawCommand(); + + var executeCommand = jasmine.createSpy("executeCommand"); + spyOn(GlobeTranslucencyFramebuffer.prototype, "packDepth"); + spyOn(GlobeTranslucencyFramebuffer.prototype, "clearClassification"); + + reset(); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + globe.depthTestAgainstTerrain = true; + state.update(scene); + state.updateDerivedCommands(command, frameState); + state.pushDerivedCommands(command, false, frameState); + + var classificationCommand = createDrawCommand(); + var globeCommands = frameState.commandList; + var classificationCommands = [classificationCommand]; + var frustumCommands = new FrustumCommands(); + frustumCommands.commands[Pass.GLOBE] = globeCommands; + frustumCommands.indices[Pass.GLOBE] = globeCommands.length; + frustumCommands.commands[ + Pass.TERRAIN_CLASSIFICATION + ] = classificationCommands; + frustumCommands.indices[Pass.TERRAIN_CLASSIFICATION] = + classificationCommands.length; + + state.executeGlobeClassificationCommands( + frustumCommands, + executeCommand, + framebuffer, + scene, + passState + ); + + expect(executeCommand).toHaveBeenCalledWith( + classificationCommand, + scene, + context, + passState + ); + expect(executeCommand).toHaveBeenCalledWith( + command.derivedCommands.globeTranslucency.depthOnlyFrontFaceCommand, + scene, + context, + passState + ); + + if (context.depthTexture) { + expect( + GlobeTranslucencyFramebuffer.prototype.packDepth + ).toHaveBeenCalled(); + } + }); +}); diff --git a/Specs/Scene/ModelOutlineLoaderSpec.js b/Specs/Scene/ModelOutlineLoaderSpec.js index 4ca993cd6c29..49dce0d2f111 100644 --- a/Specs/Scene/ModelOutlineLoaderSpec.js +++ b/Specs/Scene/ModelOutlineLoaderSpec.js @@ -499,13 +499,21 @@ describe( }); }); - it("switches to 32-bit indices if more than 65536 vertices are required", function () { + it("switches to 32-bit indices if more than 65535 vertices are required", function () { + if (!scene.context.elementIndexUint) { + // This extension is supported everywhere these days, except possibly + // in our mocked WebGL context used in the tests on Travis. Consistent + // with the approach in ModelSpec.js, `loads a gltf with uint32 indices`, + // we'll just give this test a pass if uint indices aren't supported. + return; + } + var vertices = []; var indices = []; var edges = []; // Tricky model is 9 vertices. Add copies of it until we're just under 65636 vertices. - for (var i = 0; vertices.length / 7 + 9 <= 65536; ++i) { + for (var i = 0; vertices.length / 7 + 9 <= 65535; ++i) { createTrickyModel(vertices, indices, edges, 2, true, true, true); } @@ -575,6 +583,10 @@ describe( } } + var rendererIndexBuffer = + model._rendererResources.buffers[triangleIndexAccessor.bufferView]; + expect(rendererIndexBuffer.bytesPerIndex).toBe(4); + builder.destroy(); }); }); diff --git a/Specs/Scene/PointCloud3DTileContentSpec.js b/Specs/Scene/PointCloud3DTileContentSpec.js index accbed387171..4f391defe678 100644 --- a/Specs/Scene/PointCloud3DTileContentSpec.js +++ b/Specs/Scene/PointCloud3DTileContentSpec.js @@ -58,6 +58,8 @@ describe( "./Data/Cesium3DTiles/PointCloud/PointCloudBatched/tileset.json"; var pointCloudWithPerPointPropertiesUrl = "./Data/Cesium3DTiles/PointCloud/PointCloudWithPerPointProperties/tileset.json"; + var pointCloudWithUnicodePropertyNamesUrl = + "./Data/Cesium3DTiles/PointCloud/PointCloudWithUnicodePropertyNames/tileset.json"; var pointCloudWithTransformUrl = "./Data/Cesium3DTiles/PointCloud/PointCloudWithTransform/tileset.json"; var pointCloudTilesetUrl = @@ -789,6 +791,24 @@ describe( }); }); + it("applies shader style with unicode property names", function () { + return Cesium3DTilesTester.loadTileset( + scene, + pointCloudWithUnicodePropertyNamesUrl + ).then(function (tileset) { + tileset.style = new Cesium3DTileStyle({ + color: "color() * ${feature['temperature ℃']}", + }); + expect(scene).toRenderAndCall(function (rgba) { + // Pixel color is some shade of gray + expect(rgba[0]).toBe(rgba[1]); + expect(rgba[0]).toBe(rgba[2]); + expect(rgba[0]).toBeGreaterThan(0); + expect(rgba[0]).toBeLessThan(255); + }); + }); + }); + it("rebuilds shader style when expression changes", function () { return Cesium3DTilesTester.loadTileset(scene, pointCloudTilesetUrl).then( function (tileset) { diff --git a/Specs/Scene/QuadtreePrimitiveSpec.js b/Specs/Scene/QuadtreePrimitiveSpec.js index 78162ab71599..b97ef4142a0b 100644 --- a/Specs/Scene/QuadtreePrimitiveSpec.js +++ b/Specs/Scene/QuadtreePrimitiveSpec.js @@ -12,6 +12,7 @@ import { Rectangle } from "../../Source/Cesium.js"; import { Visibility } from "../../Source/Cesium.js"; import { Camera } from "../../Source/Cesium.js"; import { GlobeSurfaceTileProvider } from "../../Source/Cesium.js"; +import { GlobeTranslucencyState } from "../../Source/Cesium.js"; import { ImageryLayerCollection } from "../../Source/Cesium.js"; import { QuadtreePrimitive } from "../../Source/Cesium.js"; import { QuadtreeTileLoadState } from "../../Source/Cesium.js"; @@ -62,6 +63,7 @@ describe("Scene/QuadtreePrimitive", function () { ]), afterRender: [], pixelRatio: 1.0, + globeTranslucencyState: new GlobeTranslucencyState(), }; frameState.cullingVolume.computeVisibility.and.returnValue( diff --git a/Specs/Scene/SceneSpec.js b/Specs/Scene/SceneSpec.js index 9ed339c2928d..65ba5488ea1d 100644 --- a/Specs/Scene/SceneSpec.js +++ b/Specs/Scene/SceneSpec.js @@ -40,6 +40,10 @@ import { SceneTransforms } from "../../Source/Cesium.js"; import { ScreenSpaceCameraController } from "../../Source/Cesium.js"; import { SunLight } from "../../Source/Cesium.js"; import { TweenCollection } from "../../Source/Cesium.js"; +import { Sun } from "../../Source/Cesium.js"; +import { GroundPrimitive } from "../../Source/Cesium.js"; +import { PerInstanceColorAppearance } from "../../Source/Cesium.js"; +import { ColorGeometryInstanceAttribute } from "../../Source/Cesium.js"; import createCanvas from "../createCanvas.js"; import createScene from "../createScene.js"; import pollToPromise from "../pollToPromise.js"; @@ -64,6 +68,8 @@ describe( }), }); simpleRenderState = new RenderState(); + + return GroundPrimitive.initializeTerrainHeights(); }); afterEach(function () { @@ -2058,22 +2064,6 @@ describe( }); }); - it("detects that camera is above ground if screen space camera controller adjusted height for terrain", function () { - var scene = createScene(); - var globe = new Globe(); - scene.globe = globe; - - spyOn( - ScreenSpaceCameraController.prototype, - "adjustedHeightForTerrain" - ).and.returnValue(true); - - return updateGlobeUntilDone(scene).then(function () { - expect(scene.cameraUnderground).toBe(false); - scene.destroyForSpecs(); - }); - }); - it("detects that camera is above ground if globe is undefined", function () { var scene = createScene(); scene.renderForSpecs(); @@ -2174,6 +2164,211 @@ describe( scene.destroyForSpecs(); }); }); + + it("does not occlude primitives when the globe is translucent", function () { + var scene = createScene(); + var globe = new Globe(); + scene.globe = globe; + + // A primitive at height -25000.0 is less than the minor axis for WGS84 and will get culled unless the globe is translucent + var center = Cartesian3.fromRadians( + 2.3929070618374535, + -0.07149851443375346, + -25000.0, + globe.ellipsoid + ); + var radius = 10.0; + + var command = new DrawCommand({ + shaderProgram: simpleShaderProgram, + renderState: simpleRenderState, + pass: Pass.OPAQUE, + boundingVolume: new BoundingSphere(center, radius), + }); + + scene.primitives.add(new CommandMockPrimitive(command)); + + spyOn(DrawCommand.prototype, "execute"); // Don't execute any commands, just watch what gets added to the frustum commands list + + scene.renderForSpecs(); + expect(getFrustumCommandsLength(scene, Pass.OPAQUE)).toBe(0); + + scene.globe.translucency.enabled = true; + scene.globe.translucency.frontFaceAlpha = 0.5; + + scene.renderForSpecs(); + expect(getFrustumCommandsLength(scene, Pass.OPAQUE)).toBe(1); + + scene.destroyForSpecs(); + }); + + it("does not render environment when camera is underground and translucency is disabled", function () { + var scene = createScene(); + var globe = new Globe(); + scene.globe = globe; + scene.sun = new Sun(); + + // Look underground at the sun + scene.camera.setView({ + destination: new Cartesian3( + 2838477.9315700866, + -4939120.816857662, + 1978094.4576285738 + ), + orientation: new HeadingPitchRoll( + 5.955798516387474, + -1.0556025616093283, + 0.39098563693868016 + ), + }); + + return updateGlobeUntilDone(scene).then(function () { + var time = JulianDate.fromIso8601( + "2020-04-25T03:07:26.04924034334544558Z" + ); + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + scene.renderForSpecs(time); + + expect(scene.environmentState.isSunVisible).toBe(true); + globe.translucency.enabled = false; + scene.renderForSpecs(time); + expect(scene.environmentState.isSunVisible).toBe(false); + scene.destroyForSpecs(time); + }); + }); + + it("renders globe with translucency", function () { + var scene = createScene(); + var globe = new Globe(); + scene.globe = globe; + + scene.camera.setView({ + destination: new Cartesian3( + 2764681.3022502237, + -20999839.371941473, + 14894754.464869803 + ), + orientation: new HeadingPitchRoll( + 6.283185307179586, + -1.5687983447998315, + 0 + ), + }); + + return updateGlobeUntilDone(scene).then(function () { + var opaqueColor; + expect(scene).toRenderAndCall(function (rgba) { + opaqueColor = rgba; + }); + + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + + expect(scene).toRenderAndCall(function (rgba) { + expect(rgba).not.toEqual(opaqueColor); + }); + }); + }); + + it("renders ground primitive on translucent globe", function () { + var scene = createScene(); + var globe = new Globe(); + scene.globe = globe; + globe.baseColor = Color.BLACK; + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + + scene.camera.setView({ + destination: new Cartesian3( + -557278.4840232887, + -6744284.200717078, + 2794079.461722868 + ), + orientation: new HeadingPitchRoll( + 6.283185307179586, + -1.5687983448015541, + 0 + ), + }); + + var redRectangleInstance = new GeometryInstance({ + geometry: new RectangleGeometry({ + rectangle: Rectangle.fromDegrees(-110.0, 20.0, -80.0, 25.0), + vertexFormat: PerInstanceColorAppearance.VERTEX_FORMAT, + }), + attributes: { + color: ColorGeometryInstanceAttribute.fromColor( + new Color(1.0, 0.0, 0.0, 0.5) + ), + }, + }); + + scene.primitives.add( + new GroundPrimitive({ + geometryInstances: [redRectangleInstance], + appearance: new PerInstanceColorAppearance({ + closed: true, + }), + asynchronous: false, + }) + ); + + return updateGlobeUntilDone(scene).then(function () { + expect(scene).toRenderAndCall(function (rgba) { + expect(rgba[0]).toBeGreaterThan(0); + }); + }); + }); + + it("picks ground primitive on translucent globe", function () { + var scene = createScene(); + var globe = new Globe(); + scene.globe = globe; + globe.baseColor = Color.BLACK; + globe.translucency.enabled = true; + globe.translucency.frontFaceAlpha = 0.5; + + scene.camera.setView({ + destination: new Cartesian3( + -557278.4840232887, + -6744284.200717078, + 2794079.461722868 + ), + orientation: new HeadingPitchRoll( + 6.283185307179586, + -1.5687983448015541, + 0 + ), + }); + + var redRectangleInstance = new GeometryInstance({ + geometry: new RectangleGeometry({ + rectangle: Rectangle.fromDegrees(-110.0, 20.0, -80.0, 25.0), + vertexFormat: PerInstanceColorAppearance.VERTEX_FORMAT, + }), + attributes: { + color: ColorGeometryInstanceAttribute.fromColor( + new Color(1.0, 0.0, 0.0, 0.5) + ), + }, + }); + + var primitive = scene.primitives.add( + new GroundPrimitive({ + geometryInstances: [redRectangleInstance], + appearance: new PerInstanceColorAppearance({ + closed: true, + }), + asynchronous: false, + }) + ); + + return updateGlobeUntilDone(scene).then(function () { + expect(scene).toPickPrimitive(primitive); + }); + }); }, + "WebGL" ); diff --git a/Specs/Scene/ScreenSpaceCameraControllerSpec.js b/Specs/Scene/ScreenSpaceCameraControllerSpec.js index cc0ea14890db..4881111f4d22 100644 --- a/Specs/Scene/ScreenSpaceCameraControllerSpec.js +++ b/Specs/Scene/ScreenSpaceCameraControllerSpec.js @@ -34,6 +34,8 @@ describe("Scene/ScreenSpaceCameraController", function () { this.mapProjection = new GeographicProjection(ellipsoid); this.terrainExaggeration = 1.0; this.screenSpaceCameraController = undefined; + this.cameraUnderground = false; + this.globeHeight = 0.0; } function MockGlobe(ellipsoid) { @@ -55,6 +57,7 @@ describe("Scene/ScreenSpaceCameraController", function () { tilesWaitingForChildren: 0, }, }; + this.show = true; } beforeAll(function () { usePointerEvents = FeatureDetection.supportsPointerEvents(); @@ -183,6 +186,8 @@ describe("Scene/ScreenSpaceCameraController", function () { mapProjection: scene.mapProjection, }; + scene.cameraUnderground = false; + var maxRadii = ellipsoid.maximumRadius; var frustum = new OrthographicOffCenterFrustum(); frustum.right = maxRadii * Math.PI; @@ -210,6 +215,9 @@ describe("Scene/ScreenSpaceCameraController", function () { mapProjection: scene.mapProjection, }; + scene.cameraUnderground = false; + controller.enableCollisionDetection = true; + var maxRadii = ellipsoid.maximumRadius; camera.position = new Cartesian3(0.0, 0.0, maxRadii); camera.direction = Cartesian3.negate(Cartesian3.UNIT_Z, new Cartesian3()); @@ -217,6 +225,31 @@ describe("Scene/ScreenSpaceCameraController", function () { camera.right = Cartesian3.clone(Cartesian3.UNIT_X); } + function setUpCVUnderground() { + scene.mode = SceneMode.COLUMBUS_VIEW; + + var ellipsoid = Ellipsoid.WGS84; + scene.globe = new MockGlobe(ellipsoid); + scene.mapProjection = new GeographicProjection(ellipsoid); + + scene.frameState = { + mode: scene.mode, + mapProjection: scene.mapProjection, + }; + + scene.cameraUnderground = true; + controller.enableCollisionDetection = false; + + camera.position = new Cartesian3(0.0, 0.0, -100.0); + camera.direction = Cartesian3.clone(Cartesian3.UNIT_Z); + camera.up = Cartesian3.clone(Cartesian3.UNIT_Y); + camera.right = Cartesian3.cross( + camera.direction, + camera.up, + new Cartesian3() + ); + } + function setUp3D() { scene.mode = SceneMode.SCENE3D; @@ -227,6 +260,21 @@ describe("Scene/ScreenSpaceCameraController", function () { mode: scene.mode, mapProjection: scene.mapProjection, }; + + scene.cameraUnderground = false; + controller.enableCollisionDetection = true; + } + + function setUp3DUnderground() { + setUp3D(); + scene.globe = new MockGlobe(scene.mapProjection.ellipsoid); + scene.cameraUnderground = true; + controller.enableCollisionDetection = false; + + camera.setView({ destination: Camera.DEFAULT_VIEW_RECTANGLE }); + var positionCart = Ellipsoid.WGS84.cartesianToCartographic(camera.position); + positionCart.height = -100.0; + camera.position = Ellipsoid.WGS84.cartographicToCartesian(positionCart); } it("constructor throws without a scene", function () { @@ -718,6 +766,26 @@ describe("Scene/ScreenSpaceCameraController", function () { expect(position.z).toEqual(camera.position.z); }); + it("translates in Columbus view when camera is underground", function () { + setUpCVUnderground(); + + var position = Cartesian3.clone(camera.position); + var startPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 4 + ); + var endPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 2 + ); + + moveMouse(MouseButtons.LEFT, startPosition, endPosition); + updateController(); + expect(position.x).toEqual(camera.position.x); + expect(position.y).not.toEqual(camera.position.y); + expect(position.z).toEqual(camera.position.z); + }); + it("looks in Columbus view", function () { setUpCV(); var position = Cartesian3.clone(camera.position); @@ -804,6 +872,24 @@ describe("Scene/ScreenSpaceCameraController", function () { expect(position.z).toBeLessThan(camera.position.z); }); + it("zoom in Columbus view when camera is underground", function () { + setUpCVUnderground(); + + var position = Cartesian3.clone(camera.position); + var startPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 4 + ); + var endPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 2 + ); + + moveMouse(MouseButtons.RIGHT, startPosition, endPosition); + updateController(); + expect(position.z).toBeLessThan(camera.position.z); + }); + it("rotates in Columbus view", function () { setUpCV(); var startPosition = new Cartesian2( @@ -869,6 +955,25 @@ describe("Scene/ScreenSpaceCameraController", function () { ).toEqualEpsilon(camera.up, CesiumMath.EPSILON14); }); + it("rotates in Columbus view when camera is underground", function () { + setUpCVUnderground(); + camera.position.y = -100.0; + + var position = Cartesian3.clone(camera.position); + var startPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 2 + ); + var endPosition = new Cartesian2( + (3 * canvas.clientWidth) / 8, + (3 * canvas.clientHeight) / 8 + ); + + moveMouse(MouseButtons.MIDDLE, startPosition, endPosition); + updateController(); + expect(camera.position).not.toEqual(position); + }); + it("zooms in Columus view with camera transform set", function () { setUpCV(); @@ -988,6 +1093,28 @@ describe("Scene/ScreenSpaceCameraController", function () { ).toEqualEpsilon(camera.up, CesiumMath.EPSILON14); }); + it("strafes in 3D when camera is underground", function () { + setUp3DUnderground(); + + var position = Cartesian3.clone(camera.position); + var direction = Cartesian3.clone(camera.direction); + + var startPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 2 + ); + var endPosition = new Cartesian2( + (3 * canvas.clientWidth) / 8, + (3 * canvas.clientHeight) / 8 + ); + + moveMouse(MouseButtons.LEFT, startPosition, endPosition); + updateController(); + + expect(camera.position).not.toEqual(position); + expect(camera.direction).toEqual(direction); + }); + it("rotates in 3D", function () { setUp3D(); var position = Cartesian3.clone(camera.position); @@ -1225,6 +1352,34 @@ describe("Scene/ScreenSpaceCameraController", function () { expect(frustumWidth).toBeLessThan(camera.frustum.width); }); + it("zoom in 3D when camera is underground", function () { + setUp3DUnderground(); + + var position = Cartesian3.clone(camera.position); + var direction = Cartesian3.clone(camera.direction); + + var startPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 4 + ); + var endPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 2 + ); + + moveMouse(MouseButtons.RIGHT, startPosition, endPosition); + updateController(); + var vector = Cartesian3.subtract( + camera.position, + position, + new Cartesian3() + ); + var normalizedVector = Cartesian3.normalize(vector, vector); + + expect(normalizedVector).toEqualEpsilon(direction, CesiumMath.EPSILON2); + expect(camera.direction).toEqualEpsilon(direction, CesiumMath.EPSILON6); + }); + it("tilts in 3D", function () { setUp3D(); var position = Cartesian3.clone(camera.position); @@ -1319,6 +1474,27 @@ describe("Scene/ScreenSpaceCameraController", function () { ).toEqualEpsilon(camera.up, CesiumMath.EPSILON14); }); + it("tilts in 3D when camera is underground", function () { + setUp3DUnderground(); + + var position = Cartesian3.clone(camera.position); + var direction = Cartesian3.clone(camera.direction); + + var startPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 2 + ); + var endPosition = new Cartesian2( + canvas.clientWidth / 2, + canvas.clientHeight / 4 + ); + + moveMouse(MouseButtons.MIDDLE, startPosition, endPosition); + updateController(); + expect(camera.position).not.toEqual(position); + expect(camera.direction).not.toEqual(direction); + }); + it("looks in 3D", function () { setUp3D(); var position = Cartesian3.clone(camera.position); diff --git a/Specs/Scene/ShadowVolumeAppearanceSpec.js b/Specs/Scene/ShadowVolumeAppearanceSpec.js index fd5e69eff2a0..deba2c4feb9b 100644 --- a/Specs/Scene/ShadowVolumeAppearanceSpec.js +++ b/Specs/Scene/ShadowVolumeAppearanceSpec.js @@ -21,7 +21,7 @@ describe("Scene/ShadowVolumeAppearance", function () { "attribute float batchId;\n" + "void main() {\n" + " vec4 position = czm_computePosition();\n" + - " gl_Position = czm_depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position);\n" + + " gl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);\n" + "}\n"; var unitSphereEllipsoid = Ellipsoid.UNIT_SPHERE; diff --git a/Specs/Scene/SkyAtmosphereSpec.js b/Specs/Scene/SkyAtmosphereSpec.js index 71b98e38971f..016f32779427 100644 --- a/Specs/Scene/SkyAtmosphereSpec.js +++ b/Specs/Scene/SkyAtmosphereSpec.js @@ -57,7 +57,7 @@ describe( var command = s.update(scene.frameState); expect(command).toBeDefined(); - expect(s._cameraAndRadiiAndDynamicAtmosphereColor.w).toBe(1); + expect(s._radiiAndDynamicAtmosphereColor.z).toBe(1); command.execute(scene.context); // Not reliable enough across browsers to test pixels s.destroy(); @@ -72,7 +72,7 @@ describe( var command = s.update(scene.frameState); expect(command).toBeDefined(); - expect(s._cameraAndRadiiAndDynamicAtmosphereColor.w).toBe(2); + expect(s._radiiAndDynamicAtmosphereColor.z).toBe(2); command.execute(scene.context); // Not reliable enough across browsers to test pixels s.destroy(); @@ -87,7 +87,7 @@ describe( var command = s.update(scene.frameState); expect(command).toBeDefined(); - expect(s._cameraAndRadiiAndDynamicAtmosphereColor.w).toBe(0); + expect(s._radiiAndDynamicAtmosphereColor.z).toBe(0); command.execute(scene.context); // Not reliable enough across browsers to test pixels s.destroy(); diff --git a/Specs/Scene/computeFlyToLocationForRectangleSpec.js b/Specs/Scene/computeFlyToLocationForRectangleSpec.js index 24c4069c14ab..872c84c1a628 100644 --- a/Specs/Scene/computeFlyToLocationForRectangleSpec.js +++ b/Specs/Scene/computeFlyToLocationForRectangleSpec.js @@ -1,10 +1,10 @@ -import { EllipsoidTerrainProvider } from "../../Source/Cesium.js"; import { Rectangle } from "../../Source/Cesium.js"; import { computeFlyToLocationForRectangle } from "../../Source/Cesium.js"; import { Globe } from "../../Source/Cesium.js"; import { SceneMode } from "../../Source/Cesium.js"; import createScene from "../createScene.js"; import { when } from "../../Source/Cesium.js"; +import MockTerrainProvider from "../MockTerrainProvider.js"; describe("Scene/computeFlyToLocationForRectangle", function () { var scene; @@ -19,7 +19,7 @@ describe("Scene/computeFlyToLocationForRectangle", function () { function sampleTest(sceneMode) { //Pretend we have terrain with availability. - var terrainProvider = new EllipsoidTerrainProvider(); + var terrainProvider = new MockTerrainProvider(); terrainProvider.availability = {}; scene.globe = new Globe(); @@ -86,7 +86,7 @@ describe("Scene/computeFlyToLocationForRectangle", function () { }); it("returns height above ellipsoid when in 2D", function () { - var terrainProvider = new EllipsoidTerrainProvider(); + var terrainProvider = new MockTerrainProvider(); terrainProvider.availability = {}; scene.globe = new Globe(); @@ -111,7 +111,7 @@ describe("Scene/computeFlyToLocationForRectangle", function () { it("returns height above ellipsoid when terrain not available", function () { scene.globe = new Globe(); - scene.terrainProvider = new EllipsoidTerrainProvider(); + scene.terrainProvider = new MockTerrainProvider(); var rectangle = new Rectangle(0.2, 0.4, 0.6, 0.8); spyOn(computeFlyToLocationForRectangle, "_sampleTerrainMostDetailed"); @@ -130,7 +130,7 @@ describe("Scene/computeFlyToLocationForRectangle", function () { }); it("waits for terrain to become ready", function () { - var terrainProvider = new EllipsoidTerrainProvider(); + var terrainProvider = new MockTerrainProvider(); spyOn(terrainProvider.readyPromise, "then").and.callThrough(); scene.globe = new Globe(); diff --git a/Specs/TypeScript/index.ts b/Specs/TypeScript/index.ts new file mode 100644 index 000000000000..97f13e0a3e3e --- /dev/null +++ b/Specs/TypeScript/index.ts @@ -0,0 +1,379 @@ +import { + ArcGisMapServerImageryProvider, + ArcGISTiledElevationTerrainProvider, + BingMapsImageryProvider, + BoxGeometry, + BoxOutlineGeometry, + CallbackProperty, + Camera, + Cartesian3, + CesiumTerrainProvider, + CheckerboardMaterialProperty, + CircleGeometry, + CircleOutlineGeometry, + ColorMaterialProperty, + CompositeMaterialProperty, + CompositePositionProperty, + CompositeProperty, + ConstantPositionProperty, + ConstantProperty, + CoplanarPolygonGeometry, + CoplanarPolygonOutlineGeometry, + CorridorGeometry, + CorridorOutlineGeometry, + CustomDataSource, + CylinderGeometry, + CylinderOutlineGeometry, + CzmlDataSource, + DataSource, + EllipseGeometry, + EllipseOutlineGeometry, + EllipsoidGeometry, + EllipsoidOutlineGeometry, + EllipsoidTerrainProvider, + EntityCollection, + FrustumGeometry, + FrustumOutlineGeometry, + GeoJsonDataSource, + GeometryInstance, + GoogleEarthEnterpriseImageryProvider, + GoogleEarthEnterpriseMapsProvider, + GoogleEarthEnterpriseMetadata, + GoogleEarthEnterpriseTerrainProvider, + GridImageryProvider, + GridMaterialProperty, + GroundPolylineGeometry, + ImageMaterialProperty, + ImageryProvider, + IonImageryProvider, + KmlDataSource, + MapboxImageryProvider, + MapboxStyleImageryProvider, + MaterialProperty, + NodeTransformationProperty, + OpenStreetMapImageryProvider, + OrthographicFrustum, + PlaneGeometry, + PlaneOutlineGeometry, + PolygonGeometry, + PolygonHierarchy, + PolygonOutlineGeometry, + PolylineArrowMaterialProperty, + PolylineDashMaterialProperty, + PolylineGeometry, + PolylineGlowMaterialProperty, + PolylineOutlineMaterialProperty, + PolylineVolumeGeometry, + PolylineVolumeOutlineGeometry, + PositionProperty, + PositionPropertyArray, + Property, + PropertyArray, + PropertyBag, + Quaternion, + Rectangle, + RectangleGeometry, + RectangleOutlineGeometry, + ReferenceProperty, + SampledPositionProperty, + SampledProperty, + Scene, + SimplePolylineGeometry, + SingleTileImageryProvider, + SphereGeometry, + SphereOutlineGeometry, + StripeMaterialProperty, + TerrainProvider, + TileCoordinatesImageryProvider, + TileMapServiceImageryProvider, + TimeIntervalCollectionPositionProperty, + TimeIntervalCollectionProperty, + UrlTemplateImageryProvider, + VelocityOrientationProperty, + VelocityVectorProperty, + VRTheWorldTerrainProvider, + WallGeometry, + WallOutlineGeometry, + WebMapServiceImageryProvider, + WebMapTileServiceImageryProvider, +} from "cesium"; + +// Verify ImageryProvider instances conform to the expected interface +let imageryProvider: ImageryProvider; +imageryProvider = new WebMapServiceImageryProvider({ url: "", layers: "0" }); +imageryProvider = new BingMapsImageryProvider({ url: "" }); +imageryProvider = new ArcGisMapServerImageryProvider({ url: "" }); +imageryProvider = new BingMapsImageryProvider({ url: "" }); +imageryProvider = new OpenStreetMapImageryProvider({ url: "" }); +imageryProvider = new TileMapServiceImageryProvider({ url: "" }); +imageryProvider = new GridImageryProvider({ url: "" }); +imageryProvider = new IonImageryProvider({ assetId: 2 }); +imageryProvider = new MapboxImageryProvider({ mapId: "" }); +imageryProvider = new MapboxStyleImageryProvider({ styleId: "" }); +imageryProvider = new SingleTileImageryProvider({ url: "" }); +imageryProvider = new TileCoordinatesImageryProvider(); +imageryProvider = new UrlTemplateImageryProvider({ url: "" }); +imageryProvider = new WebMapServiceImageryProvider({ url: "", layers: "" }); +imageryProvider = new GoogleEarthEnterpriseImageryProvider({ + url: "", + metadata: new GoogleEarthEnterpriseMetadata(""), +}); +imageryProvider = new GoogleEarthEnterpriseMapsProvider({ + url: "", + channel: 1, +}); +imageryProvider = new WebMapTileServiceImageryProvider({ + url: "", + layer: "", + style: "", + tileMatrixSetID: "", +}); + +// Verify TerrainProvider instances conform to the expected interface +let terrainProvider: TerrainProvider; +terrainProvider = new ArcGISTiledElevationTerrainProvider({ url: "" }); +terrainProvider = new CesiumTerrainProvider({ url: "" }); +terrainProvider = new EllipsoidTerrainProvider(); +terrainProvider = new VRTheWorldTerrainProvider({ url: "" }); +terrainProvider = new GoogleEarthEnterpriseTerrainProvider({ + url: "", + metadata: new GoogleEarthEnterpriseMetadata(""), +}); + +// Verify DataSource instances conform to the expected interface +let dataSource: DataSource; +dataSource = new CzmlDataSource(); +dataSource = new GeoJsonDataSource(); +dataSource = new KmlDataSource({ + canvas: document.createElement("canvas"), + camera: new Camera(new Scene()), +}); +dataSource = new CustomDataSource(); + +// Verify Property instances conform to the expected interface +let property: Property; +property = new CallbackProperty(() => 0, false); +property = new ConstantProperty(1); +property = new TimeIntervalCollectionProperty(); +property = new CompositeProperty(); +property = new SampledProperty(Cartesian3); +property = new PropertyBag(); +property = new PropertyArray(); +property = new PositionProperty(); +property = new MaterialProperty(); +property = new VelocityVectorProperty(); +property = new VelocityOrientationProperty(); +property = new PositionPropertyArray(); +property = new NodeTransformationProperty(); +property = new ReferenceProperty(new EntityCollection(), "object1", [ + "billboard", + "scale", +]); + +// Verify PositionProperty instances conform to the expected PositionProperty and Property interfaces +let positionProperty: PositionProperty; +property = positionProperty = new SampledPositionProperty(); +property = positionProperty = new CompositePositionProperty(); +property = positionProperty = new ConstantPositionProperty(); +property = positionProperty = new TimeIntervalCollectionPositionProperty(); +property = positionProperty = new ReferenceProperty( + new EntityCollection(), + "object1", + ["billboard", "scale"] +); + +// Verify MaterialProperty instances conform to the expected MaterialProperty and Property interfaces +let materialProperty: MaterialProperty; +property = materialProperty = new ColorMaterialProperty(); +property = materialProperty = new CompositeMaterialProperty(); +property = materialProperty = new GridMaterialProperty(); +property = materialProperty = new ImageMaterialProperty(); +property = materialProperty = new PolylineGlowMaterialProperty(); +property = materialProperty = new PolylineOutlineMaterialProperty(); +property = materialProperty = new StripeMaterialProperty(); +property = materialProperty = new CheckerboardMaterialProperty(); +property = materialProperty = new PolylineDashMaterialProperty(); +property = materialProperty = new PolylineArrowMaterialProperty(); + +// Verify GeometryInstance can be take XXXGeometry objects. +let geometryInstance: GeometryInstance; + +geometryInstance = new GeometryInstance({ + geometry: new BoxGeometry({ + minimum: new Cartesian3(0, 0, 0), + maximum: new Cartesian3(1, 1, 1), + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new BoxOutlineGeometry({ + minimum: new Cartesian3(0, 0, 0), + maximum: new Cartesian3(1, 1, 1), + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new CircleGeometry({ + center: new Cartesian3(0, 0, 0), + radius: 10, + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new CircleOutlineGeometry({ + center: new Cartesian3(0, 0, 0), + radius: 10, + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new CoplanarPolygonGeometry({ + polygonHierarchy: new PolygonHierarchy(), + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new CoplanarPolygonOutlineGeometry({ + polygonHierarchy: new PolygonHierarchy(), + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new CorridorGeometry({ positions: [], width: 1 }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new CorridorOutlineGeometry({ positions: [], width: 1 }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new CylinderGeometry({ + bottomRadius: 10, + length: 10, + topRadius: 10, + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new CylinderOutlineGeometry({ + bottomRadius: 10, + length: 10, + topRadius: 10, + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new EllipseGeometry({ + center: Cartesian3.ZERO, + semiMajorAxis: 1, + semiMinorAxis: 10, + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new EllipseOutlineGeometry({ + center: Cartesian3.ZERO, + semiMajorAxis: 1, + semiMinorAxis: 10, + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new EllipsoidGeometry(), +}); + +geometryInstance = new GeometryInstance({ + geometry: new EllipsoidOutlineGeometry(), +}); + +geometryInstance = new GeometryInstance({ + geometry: new FrustumGeometry({ + frustum: new OrthographicFrustum(), + orientation: new Quaternion(), + origin: Cartesian3.ZERO, + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new FrustumOutlineGeometry({ + frustum: new OrthographicFrustum(), + orientation: new Quaternion(), + origin: Cartesian3.ZERO, + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new GroundPolylineGeometry({ positions: [] }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new PlaneGeometry(), +}); + +geometryInstance = new GeometryInstance({ + geometry: new PlaneOutlineGeometry(), +}); + +geometryInstance = new GeometryInstance({ + geometry: new PolygonGeometry({ polygonHierarchy: new PolygonHierarchy() }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new PolygonOutlineGeometry({ + polygonHierarchy: new PolygonHierarchy(), + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new PolylineGeometry({ + positions: [], + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new PolylineVolumeGeometry({ + polylinePositions: [], + shapePositions: [], + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new PolylineVolumeOutlineGeometry({ + polylinePositions: [], + shapePositions: [], + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new RectangleGeometry({ rectangle: Rectangle.MAX_VALUE }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new RectangleOutlineGeometry({ rectangle: Rectangle.MAX_VALUE }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new SimplePolylineGeometry({ + positions: [], + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new SphereGeometry(), +}); + +geometryInstance = new GeometryInstance({ + geometry: new SphereOutlineGeometry(), +}); + +geometryInstance = new GeometryInstance({ + geometry: new WallGeometry({ + positions: [], + }), +}); + +geometryInstance = new GeometryInstance({ + geometry: new WallOutlineGeometry({ + positions: [], + }), +}); diff --git a/Specs/TypeScript/tsconfig.json b/Specs/TypeScript/tsconfig.json new file mode 100644 index 000000000000..1b1b0d541573 --- /dev/null +++ b/Specs/TypeScript/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "noEmit": true, + "types": [], + "strict": true + }, + "include": [ + "index.ts", + "../../Source/Cesium.d.ts" + ] +} \ No newline at end of file diff --git a/Tools/jsdoc/cesium_template/publish.js b/Tools/jsdoc/cesium_template/publish.js index dd7d1163c5e8..1cd1c6960ec8 100644 --- a/Tools/jsdoc/cesium_template/publish.js +++ b/Tools/jsdoc/cesium_template/publish.js @@ -120,7 +120,7 @@ function addAttribs(f) { attrib + '">' + htmlsafe(attrib) + - "" + " " ); }) .join(""); @@ -217,6 +217,7 @@ function buildNav(members) { var items = members.modules .concat(members.classes) + .concat(members.globals) .concat(members.namespaces) .sort(function (a, b) { return a.longname.toLowerCase().localeCompare(b.longname.toLowerCase()); @@ -436,6 +437,7 @@ exports.publish = function (taffyData, opts, tutorials) { var classes = taffy(members.classes); var modules = taffy(members.modules); var namespaces = taffy(members.namespaces); + var globals = taffy(members.globals); var typesJson = {}; @@ -450,6 +452,10 @@ exports.publish = function (taffyData, opts, tutorials) { items = helper.find(namespaces, { longname: longname }); } + if (!items.length) { + items = helper.find(globals, { longname: longname }); + } + if (items.length) { var title = items[0].name; var filename = helper.longnameToUrl[longname]; diff --git a/Tools/jsdoc/cesium_template/static/javascript/cesiumDoc.js b/Tools/jsdoc/cesium_template/static/javascript/cesiumDoc.js index b6ba444a5a9c..ecff98ccacbf 100644 --- a/Tools/jsdoc/cesium_template/static/javascript/cesiumDoc.js +++ b/Tools/jsdoc/cesium_template/static/javascript/cesiumDoc.js @@ -47,8 +47,11 @@ for (var i = 0; i < links.length; i++) { var link = links[i]; var prefix = link.href.split("?")[0]; + var parts = prefix.split("#"); link.href = - prefix + (searchTerm === "" ? "" : "?classFilter=" + searchTerm); + parts[0] + + (searchTerm === "" ? "" : "?classFilter=" + searchTerm) + + (parts[1] ? "#" + parts[1] : ""); } } diff --git a/Tools/jsdoc/cesium_template/static/styles/jsdoc-default.css b/Tools/jsdoc/cesium_template/static/styles/jsdoc-default.css index e28aab65849e..7bbda2ddc887 100644 --- a/Tools/jsdoc/cesium_template/static/styles/jsdoc-default.css +++ b/Tools/jsdoc/cesium_template/static/styles/jsdoc-default.css @@ -603,7 +603,6 @@ span.attribute-constant { color: #fff; font-size: 0.7em; padding: 2px 4px; - margin-right: 8px; margin-bottom: 1px; position: relative; top: -1px; diff --git a/Tools/jsdoc/conf.json b/Tools/jsdoc/conf.json index 84d69edfb90c..f775c5099463 100644 --- a/Tools/jsdoc/conf.json +++ b/Tools/jsdoc/conf.json @@ -3,12 +3,19 @@ "allowUnknownTags": false }, "source": { - "include": ["Source"], - "exclude": ["Source/ThirdParty", "Source/Workers"], + "include": [ + "Source" + ], + "exclude": [ + "Source/ThirdParty", + "Source/Workers" + ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" }, - "plugins": ["./Tools/jsdoc/cesiumTags"], + "plugins": [ + "./Tools/jsdoc/cesiumTags" + ], "templates": { "cleverLinks": true, "default": { @@ -21,4 +28,4 @@ "template": "./Tools/jsdoc/cesium_template", "recurse": true } -} +} \ No newline at end of file diff --git a/Tools/jsdoc/ts-conf.json b/Tools/jsdoc/ts-conf.json new file mode 100644 index 000000000000..22c743f44ba5 --- /dev/null +++ b/Tools/jsdoc/ts-conf.json @@ -0,0 +1,33 @@ +{ + "tags": { + "allowUnknownTags": false + }, + "source": { + "include": [ + "Source" + ], + "exclude": [ + "Source/ThirdParty", + "Source/Workers" + ], + "includePattern": ".+\\.js(doc)?$", + "excludePattern": "(^|\\/|\\\\)_" + }, + "plugins": [ + "./Tools/jsdoc/cesiumTags", + "tsd-jsdoc/dist/plugin" + ], + "templates": { + "cleverLinks": true, + "default": { + "outputSourceFiles": false + }, + "sourceUrl": "https://github.com/CesiumGS/cesium/blob/{version}/Source/{filename}" + }, + "opts": { + "destination": "Source", + "template": "tsd-jsdoc/dist", + "outFile": "Cesium.d.ts", + "recurse": true + } +} diff --git a/Tools/jsdoc/tsconfig.json b/Tools/jsdoc/tsconfig.json new file mode 100644 index 000000000000..2cd41ea62053 --- /dev/null +++ b/Tools/jsdoc/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "noEmit": true, + "types": [] + }, + "files": [ + "../../Source/Cesium.d.ts" + ] +} diff --git a/gulpfile.cjs b/gulpfile.cjs index 6ae377e8d828..4e159b3c826c 100644 --- a/gulpfile.cjs +++ b/gulpfile.cjs @@ -1,1446 +1,1889 @@ /*eslint-env node*/ -'use strict'; - -var fs = require('fs'); -var path = require('path'); -var os = require('os'); -var child_process = require('child_process'); -var crypto = require('crypto'); -var zlib = require('zlib'); -var readline = require('readline'); -var request = require('request'); - -var globby = require('globby'); -var gulpTap = require('gulp-tap'); -var gulpUglify = require('gulp-uglify'); -var open = require('open'); -var rimraf = require('rimraf'); -var glslStripComments = require('glsl-strip-comments'); -var mkdirp = require('mkdirp'); -var mergeStream = require('merge-stream'); -var streamToPromise = require('stream-to-promise'); -var gulp = require('gulp'); -var gulpInsert = require('gulp-insert'); -var gulpZip = require('gulp-zip'); -var gulpRename = require('gulp-rename'); -var gulpReplace = require('gulp-replace'); -var Promise = require('bluebird'); -var Karma = require('karma'); -var yargs = require('yargs'); -var AWS = require('aws-sdk'); -var mime = require('mime'); -var rollup = require('rollup'); -var rollupPluginStripPragma = require('rollup-plugin-strip-pragma'); -var rollupPluginExternalGlobals = require('rollup-plugin-external-globals'); -var rollupPluginUglify = require('rollup-plugin-uglify'); -var cleanCSS = require('gulp-clean-css'); - -var packageJson = require('./package.json'); +"use strict"; + +var fs = require("fs"); +var path = require("path"); +var os = require("os"); +var child_process = require("child_process"); +var crypto = require("crypto"); +var zlib = require("zlib"); +var readline = require("readline"); +var request = require("request"); + +var globby = require("globby"); +var gulpTap = require("gulp-tap"); +var gulpUglify = require("gulp-uglify"); +var open = require("open"); +var rimraf = require("rimraf"); +var glslStripComments = require("glsl-strip-comments"); +var mkdirp = require("mkdirp"); +var mergeStream = require("merge-stream"); +var streamToPromise = require("stream-to-promise"); +var gulp = require("gulp"); +var gulpInsert = require("gulp-insert"); +var gulpZip = require("gulp-zip"); +var gulpRename = require("gulp-rename"); +var gulpReplace = require("gulp-replace"); +var Promise = require("bluebird"); +var Karma = require("karma"); +var yargs = require("yargs"); +var AWS = require("aws-sdk"); +var mime = require("mime"); +var rollup = require("rollup"); +var rollupPluginStripPragma = require("rollup-plugin-strip-pragma"); +var rollupPluginExternalGlobals = require("rollup-plugin-external-globals"); +var rollupPluginUglify = require("rollup-plugin-uglify"); +var cleanCSS = require("gulp-clean-css"); +var typescript = require("typescript"); + +var packageJson = require("./package.json"); var version = packageJson.version; if (/\.0$/.test(version)) { - version = version.substring(0, version.length - 2); + version = version.substring(0, version.length - 2); } -var karmaConfigFile = path.join(__dirname, 'Specs/karma.conf.js'); -var travisDeployUrl = 'http://cesium-dev.s3-website-us-east-1.amazonaws.com/cesium/'; +var karmaConfigFile = path.join(__dirname, "Specs/karma.conf.js"); +var travisDeployUrl = + "http://cesium-dev.s3-website-us-east-1.amazonaws.com/cesium/"; //Gulp doesn't seem to have a way to get the currently running tasks for setting //per-task variables. We use the command line argument here to detect which task is being run. var taskName = process.argv[2]; -var noDevelopmentGallery = taskName === 'release' || taskName === 'makeZipFile'; -var minifyShaders = taskName === 'minify' || taskName === 'minifyRelease' || taskName === 'release' || taskName === 'makeZipFile' || taskName === 'buildApps'; +var noDevelopmentGallery = taskName === "release" || taskName === "makeZipFile"; +var minifyShaders = + taskName === "minify" || + taskName === "minifyRelease" || + taskName === "release" || + taskName === "makeZipFile" || + taskName === "buildApps"; var verbose = yargs.argv.verbose; var concurrency = yargs.argv.concurrency; if (!concurrency) { - concurrency = os.cpus().length; + concurrency = os.cpus().length; } -var sourceFiles = ['Source/**/*.js', - '!Source/*.js', - '!Source/Workers/**', - '!Source/WorkersES6/**', - 'Source/WorkersES6/createTaskProcessorWorker.js', - '!Source/ThirdParty/Workers/**', - '!Source/ThirdParty/google-earth-dbroot-parser.js', - '!Source/ThirdParty/pako_inflate.js', - '!Source/ThirdParty/crunch.js']; - -var watchedFiles = ['Source/**/*.js', - '!Source/Cesium.js', - '!Source/Build/**', - '!Source/Shaders/**/*.js', - 'Source/Shaders/**/*.glsl', - '!Source/ThirdParty/Shaders/*.js', - 'Source/ThirdParty/Shaders/*.glsl', - '!Source/Workers/**', - 'Source/Workers/cesiumWorkerBootstrapper.js', - 'Source/Workers/transferTypedArrayTest.js', - '!Specs/SpecList.js']; - -var filesToClean = ['Source/Cesium.js', - 'Source/Shaders/**/*.js', - 'Source/Workers/**', - '!Source/Workers/cesiumWorkerBootstrapper.js', - '!Source/Workers/transferTypedArrayTest.js', - 'Source/ThirdParty/Shaders/*.js', - 'Specs/SpecList.js', - 'Apps/Sandcastle/jsHintOptions.js', - 'Apps/Sandcastle/gallery/gallery-index.js', - 'Apps/Sandcastle/templates/bucket.css', - 'Cesium-*.zip', - 'cesium-*.tgz']; - -var filesToConvertES6 = ['Source/**/*.js', - 'Specs/**/*.js', - '!Source/ThirdParty/**', - '!Source/Cesium.js', - '!Source/copyrightHeader.js', - '!Source/Shaders/**', - '!Source/Workers/cesiumWorkerBootstrapper.js', - '!Source/Workers/transferTypedArrayTest.js', - '!Specs/karma-main.js', - '!Specs/karma.conf.js', - '!Specs/spec-main.js', - '!Specs/SpecList.js', - '!Specs/TestWorkers/**' - ]; +var sourceFiles = [ + "Source/**/*.js", + "!Source/*.js", + "!Source/Workers/**", + "!Source/WorkersES6/**", + "Source/WorkersES6/createTaskProcessorWorker.js", + "!Source/ThirdParty/Workers/**", + "!Source/ThirdParty/google-earth-dbroot-parser.js", + "!Source/ThirdParty/pako_inflate.js", + "!Source/ThirdParty/crunch.js", +]; + +var watchedFiles = [ + "Source/**/*.js", + "!Source/Cesium.js", + "!Source/Build/**", + "!Source/Shaders/**/*.js", + "Source/Shaders/**/*.glsl", + "!Source/ThirdParty/Shaders/*.js", + "Source/ThirdParty/Shaders/*.glsl", + "!Source/Workers/**", + "Source/Workers/cesiumWorkerBootstrapper.js", + "Source/Workers/transferTypedArrayTest.js", + "!Specs/SpecList.js", +]; + +var filesToClean = [ + "Source/Cesium.js", + "Source/Shaders/**/*.js", + "Source/Workers/**", + "!Source/Workers/cesiumWorkerBootstrapper.js", + "!Source/Workers/transferTypedArrayTest.js", + "Source/ThirdParty/Shaders/*.js", + "Specs/SpecList.js", + "Apps/Sandcastle/jsHintOptions.js", + "Apps/Sandcastle/gallery/gallery-index.js", + "Apps/Sandcastle/templates/bucket.css", + "Cesium-*.zip", + "cesium-*.tgz", +]; + +var filesToConvertES6 = [ + "Source/**/*.js", + "Specs/**/*.js", + "!Source/ThirdParty/**", + "!Source/Cesium.js", + "!Source/copyrightHeader.js", + "!Source/Shaders/**", + "!Source/Workers/cesiumWorkerBootstrapper.js", + "!Source/Workers/transferTypedArrayTest.js", + "!Specs/karma-main.js", + "!Specs/karma.conf.js", + "!Specs/spec-main.js", + "!Specs/SpecList.js", + "!Specs/TestWorkers/**", +]; function rollupWarning(message) { - // Ignore eval warnings in third-party code we don't have control over - if (message.code === 'EVAL' && /(protobuf-minimal|crunch)\.js$/.test(message.loc.file)) { - return; - } - console.log(message); + // Ignore eval warnings in third-party code we don't have control over + if ( + message.code === "EVAL" && + /(protobuf-minimal|crunch)\.js$/.test(message.loc.file) + ) { + return; + } + console.log(message); } -var copyrightHeader = fs.readFileSync(path.join('Source', 'copyrightHeader.js'), "utf8"); +var copyrightHeader = fs.readFileSync( + path.join("Source", "copyrightHeader.js"), + "utf8" +); function createWorkers() { - rimraf.sync('Build/createWorkers'); - - globby.sync([ - 'Source/Workers/**', - '!Source/Workers/cesiumWorkerBootstrapper.js', - '!Source/Workers/transferTypedArrayTest.js' - ]).forEach(function(file) { - rimraf.sync(file); + rimraf.sync("Build/createWorkers"); + + globby + .sync([ + "Source/Workers/**", + "!Source/Workers/cesiumWorkerBootstrapper.js", + "!Source/Workers/transferTypedArrayTest.js", + ]) + .forEach(function (file) { + rimraf.sync(file); }); - var workers = globby.sync([ - 'Source/WorkersES6/**' - ]); - - return rollup.rollup({ - input: workers, - onwarn: rollupWarning - }).then(function(bundle) { - return bundle.write({ - dir: 'Build/createWorkers', - banner: '/* This file is automatically rebuilt by the Cesium build process. */', - format: 'amd' - }); - }).then(function(){ - return streamToPromise( - gulp.src('Build/createWorkers/**').pipe(gulp.dest('Source/Workers')) - ); - }).then(function() { - rimraf.sync('Build/createWorkers'); + var workers = globby.sync(["Source/WorkersES6/**"]); + + return rollup + .rollup({ + input: workers, + onwarn: rollupWarning, + }) + .then(function (bundle) { + return bundle.write({ + dir: "Build/createWorkers", + banner: + "/* This file is automatically rebuilt by the Cesium build process. */", + format: "amd", + }); + }) + .then(function () { + return streamToPromise( + gulp.src("Build/createWorkers/**").pipe(gulp.dest("Source/Workers")) + ); + }) + .then(function () { + rimraf.sync("Build/createWorkers"); }); } -gulp.task('build', function() { - mkdirp.sync('Build'); - fs.writeFileSync('Build/package.json', JSON.stringify({ - type: 'commonjs' - }), "utf8"); - glslToJavaScript(minifyShaders, 'Build/minifyShaders.state'); - createCesiumJs(); - createSpecList(); - createJsHintOptions(); - return Promise.join(createWorkers(), createGalleryList()); +gulp.task("build", function () { + mkdirp.sync("Build"); + fs.writeFileSync( + "Build/package.json", + JSON.stringify({ + type: "commonjs", + }), + "utf8" + ); + glslToJavaScript(minifyShaders, "Build/minifyShaders.state"); + createCesiumJs(); + createSpecList(); + createJsHintOptions(); + return Promise.join(createWorkers(), createGalleryList()); }); -gulp.task('build-watch', function() { - return gulp.watch(watchedFiles, gulp.series('build')); +gulp.task("build-watch", function () { + return gulp.watch(watchedFiles, gulp.series("build")); }); -gulp.task('buildApps', function() { - return Promise.join( - buildCesiumViewer(), - buildSandcastle() - ); +gulp.task("build-ts", function () { + createTypeScriptDefinitions(); + return Promise.resolve(); }); -gulp.task('build-specs', function buildSpecs() { - var externalCesium = rollupPluginExternalGlobals({ - '../Source/Cesium.js': 'Cesium', - '../../Source/Cesium.js': 'Cesium', - '../../../Source/Cesium.js': 'Cesium', - '../../../../Source/Cesium.js': 'Cesium' - }); - - var removePragmas = rollupPluginStripPragma({ - pragmas: ['debug'] - }); +gulp.task("buildApps", function () { + return Promise.join(buildCesiumViewer(), buildSandcastle()); +}); - var promise = Promise.join( - rollup.rollup({ - input: 'Specs/SpecList.js', - plugins: [externalCesium], - onwarn: rollupWarning - }).then(function(bundle) { +gulp.task("build-specs", function buildSpecs() { + var externalCesium = rollupPluginExternalGlobals({ + "../Source/Cesium.js": "Cesium", + "../../Source/Cesium.js": "Cesium", + "../../../Source/Cesium.js": "Cesium", + "../../../../Source/Cesium.js": "Cesium", + }); + + var removePragmas = rollupPluginStripPragma({ + pragmas: ["debug"], + }); + + var promise = Promise.join( + rollup + .rollup({ + input: "Specs/SpecList.js", + plugins: [externalCesium], + onwarn: rollupWarning, + }) + .then(function (bundle) { + return bundle.write({ + file: "Build/Specs/Specs.js", + format: "iife", + }); + }) + .then(function () { + return rollup + .rollup({ + input: "Specs/spec-main.js", + plugins: [removePragmas, externalCesium], + }) + .then(function (bundle) { return bundle.write({ - file: 'Build/Specs/Specs.js', - format: 'iife' + file: "Build/Specs/spec-main.js", + format: "iife", }); - }).then(function(){ - return rollup.rollup({ - input: 'Specs/spec-main.js', - plugins: [removePragmas, externalCesium] - }).then(function(bundle) { - return bundle.write({ - file: 'Build/Specs/spec-main.js', - format: 'iife' - }); - }); - }).then(function(){ - return rollup.rollup({ - input: 'Specs/karma-main.js', - plugins: [removePragmas, externalCesium], - onwarn: rollupWarning - }).then(function(bundle) { - return bundle.write({ - file: 'Build/Specs/karma-main.js', - name: 'karmaMain', - format: 'iife' - }); + }); + }) + .then(function () { + return rollup + .rollup({ + input: "Specs/karma-main.js", + plugins: [removePragmas, externalCesium], + onwarn: rollupWarning, + }) + .then(function (bundle) { + return bundle.write({ + file: "Build/Specs/karma-main.js", + name: "karmaMain", + format: "iife", }); - }) - ); + }); + }) + ); - return promise; + return promise; }); -gulp.task('clean', function(done) { - rimraf.sync('Build'); - globby.sync(filesToClean).forEach(function(file) { - rimraf.sync(file); - }); - done(); +gulp.task("clean", function (done) { + rimraf.sync("Build"); + globby.sync(filesToClean).forEach(function (file) { + rimraf.sync(file); + }); + done(); }); function cloc() { - var cmdLine; - var clocPath = path.join('node_modules', 'cloc', 'lib', 'cloc'); - - //Run cloc on primary Source files only - var source = new Promise(function(resolve, reject) { - cmdLine = 'perl ' + clocPath + ' --quiet --progress-rate=0' + - ' Source/ --exclude-dir=Assets,ThirdParty,Workers --not-match-f=copyrightHeader.js'; - - child_process.exec(cmdLine, function(error, stdout, stderr) { - if (error) { - console.log(stderr); - return reject(error); - } - console.log('Source:'); - console.log(stdout); - resolve(); - }); + var cmdLine; + + //Run cloc on primary Source files only + var source = new Promise(function (resolve, reject) { + cmdLine = + "npx cloc" + + " --quiet --progress-rate=0" + + " Source/ --exclude-dir=Assets,ThirdParty,Workers --not-match-f=copyrightHeader.js"; + + child_process.exec(cmdLine, function (error, stdout, stderr) { + if (error) { + console.log(stderr); + return reject(error); + } + console.log("Source:"); + console.log(stdout); + resolve(); }); - - //If running cloc on source succeeded, also run it on the tests. - return source.then(function() { - return new Promise(function(resolve, reject) { - cmdLine = 'perl ' + clocPath + ' --quiet --progress-rate=0' + - ' Specs/ --exclude-dir=Data'; - child_process.exec(cmdLine, function(error, stdout, stderr) { - if (error) { - console.log(stderr); - return reject(error); - } - console.log('Specs:'); - console.log(stdout); - resolve(); - }); - }); + }); + + //If running cloc on source succeeded, also run it on the tests. + return source.then(function () { + return new Promise(function (resolve, reject) { + cmdLine = + "npx cloc" + + " --quiet --progress-rate=0" + + " Specs/ --exclude-dir=Data"; + child_process.exec(cmdLine, function (error, stdout, stderr) { + if (error) { + console.log(stderr); + return reject(error); + } + console.log("Specs:"); + console.log(stdout); + resolve(); + }); }); + }); } -gulp.task('cloc', gulp.series('clean', cloc)); +gulp.task("cloc", gulp.series("clean", cloc)); function combine() { - var outputDirectory = path.join('Build', 'CesiumUnminified'); - return combineJavaScript({ - removePragmas: false, - optimizer: 'none', - outputDirectory: outputDirectory - }); + var outputDirectory = path.join("Build", "CesiumUnminified"); + return combineJavaScript({ + removePragmas: false, + optimizer: "none", + outputDirectory: outputDirectory, + }); } -gulp.task('combine', gulp.series('build', combine)); -gulp.task('default', gulp.series('combine')); +gulp.task("combine", gulp.series("build", combine)); +gulp.task("default", gulp.series("combine")); function combineRelease() { - var outputDirectory = path.join('Build', 'CesiumUnminified'); - return combineJavaScript({ - removePragmas: true, - optimizer: 'none', - outputDirectory: outputDirectory - }); + var outputDirectory = path.join("Build", "CesiumUnminified"); + return combineJavaScript({ + removePragmas: true, + optimizer: "none", + outputDirectory: outputDirectory, + }); } -gulp.task('combineRelease', gulp.series('build', combineRelease)); +gulp.task("combineRelease", gulp.series("build", combineRelease)); //Builds the documentation function generateDocumentation() { - var envPathSeperator = os.platform() === 'win32' ? ';' : ':'; + child_process.execSync("npx jsdoc --configure Tools/jsdoc/conf.json", { + stdio: "inherit", + env: Object.assign({}, process.env, { CESIUM_VERSION: version }), + }); - return new Promise(function(resolve, reject) { - child_process.exec('jsdoc --configure Tools/jsdoc/conf.json', { - env : { - PATH : process.env.PATH + envPathSeperator + 'node_modules/.bin', - CESIUM_VERSION : version - } - }, function(error, stdout, stderr) { - if (error) { - console.log(stderr); - return reject(error); - } - console.log(stdout); - var stream = gulp.src('Documentation/Images/**').pipe(gulp.dest('Build/Documentation/Images')); - return streamToPromise(stream).then(resolve); - }); - }); + var stream = gulp + .src("Documentation/Images/**") + .pipe(gulp.dest("Build/Documentation/Images")); + + return streamToPromise(stream); } -gulp.task('generateDocumentation', generateDocumentation); +gulp.task("generateDocumentation", generateDocumentation); -gulp.task('generateDocumentation-watch', function() { - return generateDocumentation().done(function() { - console.log('Listening for changes in documentation...'); - return gulp.watch(sourceFiles, gulp.series('generateDocumentation')); - }); +gulp.task("generateDocumentation-watch", function () { + return generateDocumentation().done(function () { + console.log("Listening for changes in documentation..."); + return gulp.watch(sourceFiles, gulp.series("generateDocumentation")); + }); }); -gulp.task('release', gulp.series('build', combine, minifyRelease, generateDocumentation)); - -gulp.task('makeZipFile', gulp.series('release', function() { +gulp.task( + "release", + gulp.series( + "build", + "build-ts", + combine, + minifyRelease, + generateDocumentation + ) +); + +gulp.task( + "makeZipFile", + gulp.series("release", function () { //For now we regenerate the JS glsl to force it to be unminified in the release zip //See https://github.com/CesiumGS/cesium/pull/3106#discussion_r42793558 for discussion. - glslToJavaScript(false, 'Build/minifyShaders.state'); - - var builtSrc = gulp.src([ - 'Build/Cesium/**', - 'Build/CesiumUnminified/**', - 'Build/Documentation/**' - ], { - base : '.' - }); + glslToJavaScript(false, "Build/minifyShaders.state"); + + var builtSrc = gulp.src( + [ + "Build/Cesium/**", + "Build/CesiumUnminified/**", + "Build/Documentation/**", + ], + { + base: ".", + } + ); - var staticSrc = gulp.src([ - 'Apps/**', - '!Apps/Sandcastle/gallery/development/**', - 'Source/**', - 'Specs/**', - 'ThirdParty/**', - 'favicon.ico', - 'gulpfile.cjs', - 'server.cjs', - 'package.json', - 'LICENSE.md', - 'CHANGES.md', - 'README.md', - 'web.config' - ], { - base : '.' - }); + var staticSrc = gulp.src( + [ + "Apps/**", + "!Apps/Sandcastle/gallery/development/**", + "Source/**", + "Specs/**", + "ThirdParty/**", + "favicon.ico", + "gulpfile.cjs", + "server.cjs", + "package.json", + "LICENSE.md", + "CHANGES.md", + "README.md", + "web.config", + ], + { + base: ".", + } + ); - var indexSrc = gulp.src('index.release.html').pipe(gulpRename('index.html')); + var indexSrc = gulp + .src("index.release.html") + .pipe(gulpRename("index.html")); return mergeStream(builtSrc, staticSrc, indexSrc) - .pipe(gulpTap(function(file) { - // Work around an issue with gulp-zip where archives generated on Windows do - // not properly have their directory executable mode set. - // see https://github.com/sindresorhus/gulp-zip/issues/64#issuecomment-205324031 - if (file.isDirectory()) { - file.stat.mode = parseInt('40777', 8); - } - })) - .pipe(gulpZip('Cesium-' + version + '.zip')) - .pipe(gulp.dest('.')); -})); - -gulp.task('minify', gulp.series('build', function() { + .pipe( + gulpTap(function (file) { + // Work around an issue with gulp-zip where archives generated on Windows do + // not properly have their directory executable mode set. + // see https://github.com/sindresorhus/gulp-zip/issues/64#issuecomment-205324031 + if (file.isDirectory()) { + file.stat.mode = parseInt("40777", 8); + } + }) + ) + .pipe(gulpZip("Cesium-" + version + ".zip")) + .pipe(gulp.dest(".")); + }) +); + +gulp.task( + "minify", + gulp.series("build", function () { return combineJavaScript({ - removePragmas : false, - optimizer : 'uglify2', - outputDirectory : path.join('Build', 'Cesium') + removePragmas: false, + optimizer: "uglify2", + outputDirectory: path.join("Build", "Cesium"), }); -})); + }) +); function minifyRelease() { - return combineJavaScript({ - removePragmas: true, - optimizer: 'uglify2', - outputDirectory: path.join('Build', 'Cesium') - }); + return combineJavaScript({ + removePragmas: true, + optimizer: "uglify2", + outputDirectory: path.join("Build", "Cesium"), + }); } -gulp.task('minifyRelease', gulp.series('build', minifyRelease)); +gulp.task("minifyRelease", gulp.series("build", minifyRelease)); function isTravisPullRequest() { - return process.env.TRAVIS_PULL_REQUEST !== undefined && process.env.TRAVIS_PULL_REQUEST !== 'false'; + return ( + process.env.TRAVIS_PULL_REQUEST !== undefined && + process.env.TRAVIS_PULL_REQUEST !== "false" + ); } -gulp.task('deploy-s3', function(done) { - if (isTravisPullRequest()) { - console.log('Skipping deployment for non-pull request.'); - done(); - return; - } - - var argv = yargs.usage('Usage: deploy-s3 -b [Bucket Name] -d [Upload Directory]') - .demand(['b', 'd']).argv; - - var uploadDirectory = argv.d; - var bucketName = argv.b; - var cacheControl = argv.c ? argv.c : 'max-age=3600'; - - if (argv.confirm) { - // skip prompt for travis +gulp.task("deploy-s3", function (done) { + if (isTravisPullRequest()) { + console.log("Skipping deployment for non-pull request."); + done(); + return; + } + + var argv = yargs + .usage("Usage: deploy-s3 -b [Bucket Name] -d [Upload Directory]") + .demand(["b", "d"]).argv; + + var uploadDirectory = argv.d; + var bucketName = argv.b; + var cacheControl = argv.c ? argv.c : "max-age=3600"; + + if (argv.confirm) { + // skip prompt for travis + deployCesium(bucketName, uploadDirectory, cacheControl, done); + return; + } + + var iface = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }); + + // prompt for confirmation + iface.question( + "Files from your computer will be published to the " + + bucketName + + " bucket. Continue? [y/n] ", + function (answer) { + iface.close(); + if (answer === "y") { deployCesium(bucketName, uploadDirectory, cacheControl, done); - return; + } else { + console.log("Deploy aborted by user."); + done(); + } } - - var iface = readline.createInterface({ - input: process.stdin, - output: process.stdout - }); - - // prompt for confirmation - iface.question('Files from your computer will be published to the ' + bucketName + ' bucket. Continue? [y/n] ', function(answer) { - iface.close(); - if (answer === 'y') { - deployCesium(bucketName, uploadDirectory, cacheControl, done); - } else { - console.log('Deploy aborted by user.'); - done(); - } - }); - + ); }); // Deploy cesium to s3 function deployCesium(bucketName, uploadDirectory, cacheControl, done) { - var readFile = Promise.promisify(fs.readFile); - var gzip = Promise.promisify(zlib.gzip); - var concurrencyLimit = 2000; - - var s3 = new AWS.S3({ - maxRetries : 10, - retryDelayOptions : { - base : 500 + var readFile = Promise.promisify(fs.readFile); + var gzip = Promise.promisify(zlib.gzip); + var concurrencyLimit = 2000; + + var s3 = new AWS.S3({ + maxRetries: 10, + retryDelayOptions: { + base: 500, + }, + }); + + var existingBlobs = []; + var totalFiles = 0; + var uploaded = 0; + var skipped = 0; + var errors = []; + + var prefix = uploadDirectory + "/"; + return listAll(s3, bucketName, prefix, existingBlobs) + .then(function () { + return globby( + [ + "Apps/**", + "Build/**", + "Source/**", + "Specs/**", + "ThirdParty/**", + "*.md", + "favicon.ico", + "gulpfile.cjs", + "index.html", + "package.json", + "server.cjs", + "web.config", + "*.zip", + "*.tgz", + ], + { + dot: true, // include hidden files } - }); - - var existingBlobs = []; - var totalFiles = 0; - var uploaded = 0; - var skipped = 0; - var errors = []; - - var prefix = uploadDirectory + '/'; - return listAll(s3, bucketName, prefix, existingBlobs) - .then(function() { - return globby([ - 'Apps/**', - 'Build/**', - 'Source/**', - 'Specs/**', - 'ThirdParty/**', - '*.md', - 'favicon.ico', - 'gulpfile.cjs', - 'index.html', - 'package.json', - 'server.cjs', - 'web.config', - '*.zip', - '*.tgz' - ], { - dot : true // include hidden files - }); - }).then(function(files) { - return Promise.map(files, function(file) { - var blobName = uploadDirectory + '/' + file; - var mimeLookup = getMimeType(blobName); - var contentType = mimeLookup.type; - var compress = mimeLookup.compress; - var contentEncoding = compress ? 'gzip' : undefined; - var etag; - - totalFiles++; - - return readFile(file) - .then(function(content) { - if (!compress) { - return content; - } - - var alreadyCompressed = (content[0] === 0x1f) && (content[1] === 0x8b); - if (alreadyCompressed) { - console.log('Skipping compressing already compressed file: ' + file); - return content; - } - - return gzip(content); + ); + }) + .then(function (files) { + return Promise.map( + files, + function (file) { + var blobName = uploadDirectory + "/" + file; + var mimeLookup = getMimeType(blobName); + var contentType = mimeLookup.type; + var compress = mimeLookup.compress; + var contentEncoding = compress ? "gzip" : undefined; + var etag; + + totalFiles++; + + return readFile(file) + .then(function (content) { + if (!compress) { + return content; + } + + var alreadyCompressed = + content[0] === 0x1f && content[1] === 0x8b; + if (alreadyCompressed) { + console.log( + "Skipping compressing already compressed file: " + file + ); + return content; + } + + return gzip(content); + }) + .then(function (content) { + // compute hash and etag + var hash = crypto.createHash("md5").update(content).digest("hex"); + etag = crypto.createHash("md5").update(content).digest("base64"); + + var index = existingBlobs.indexOf(blobName); + if (index <= -1) { + return content; + } + + // remove files as we find them on disk + existingBlobs.splice(index, 1); + + // get file info + return s3 + .headObject({ + Bucket: bucketName, + Key: blobName, }) - .then(function(content) { - // compute hash and etag - var hash = crypto.createHash('md5').update(content).digest('hex'); - etag = crypto.createHash('md5').update(content).digest('base64'); - - var index = existingBlobs.indexOf(blobName); - if (index <= -1) { - return content; - } - - // remove files as we find them on disk - existingBlobs.splice(index, 1); - - // get file info - return s3.headObject({ - Bucket: bucketName, - Key: blobName - }).promise().then(function(data) { - if (data.ETag !== ('"' + hash + '"') || - data.CacheControl !== cacheControl || - data.ContentType !== contentType || - data.ContentEncoding !== contentEncoding) { - return content; - } - - // We don't need to upload this file again - skipped++; - return undefined; - }) - .catch(function(error) { - errors.push(error); - }); + .promise() + .then(function (data) { + if ( + data.ETag !== '"' + hash + '"' || + data.CacheControl !== cacheControl || + data.ContentType !== contentType || + data.ContentEncoding !== contentEncoding + ) { + return content; + } + + // We don't need to upload this file again + skipped++; + return undefined; }) - .then(function(content) { - if (!content) { - return; - } - - if (verbose) { - console.log('Uploading ' + blobName + '...'); - } - var params = { - Bucket : bucketName, - Key : blobName, - Body : content, - ContentMD5 : etag, - ContentType : contentType, - ContentEncoding : contentEncoding, - CacheControl : cacheControl - }; - - return s3.putObject(params).promise() - .then(function() { - uploaded++; - }) - .catch(function(error) { - errors.push(error); - }); + .catch(function (error) { + errors.push(error); }); - }, {concurrency : concurrencyLimit}); - }).then(function() { - console.log('Skipped ' + skipped + ' files and successfully uploaded ' + uploaded + ' files of ' + (totalFiles - skipped) + ' files.'); - if (existingBlobs.length === 0) { + }) + .then(function (content) { + if (!content) { return; - } - - var objectsToDelete = []; - existingBlobs.forEach(function(file) { - //Don't delete generate zip files. - if (!/\.(zip|tgz)$/.test(file)) { - objectsToDelete.push({Key : file}); - } + } + + if (verbose) { + console.log("Uploading " + blobName + "..."); + } + var params = { + Bucket: bucketName, + Key: blobName, + Body: content, + ContentMD5: etag, + ContentType: contentType, + ContentEncoding: contentEncoding, + CacheControl: cacheControl, + }; + + return s3 + .putObject(params) + .promise() + .then(function () { + uploaded++; + }) + .catch(function (error) { + errors.push(error); + }); }); + }, + { concurrency: concurrencyLimit } + ); + }) + .then(function () { + console.log( + "Skipped " + + skipped + + " files and successfully uploaded " + + uploaded + + " files of " + + (totalFiles - skipped) + + " files." + ); + if (existingBlobs.length === 0) { + return; + } + + var objectsToDelete = []; + existingBlobs.forEach(function (file) { + //Don't delete generate zip files. + if (!/\.(zip|tgz)$/.test(file)) { + objectsToDelete.push({ Key: file }); + } + }); - if (objectsToDelete.length > 0) { - console.log('Cleaning ' + objectsToDelete.length + ' files...'); + if (objectsToDelete.length > 0) { + console.log("Cleaning " + objectsToDelete.length + " files..."); - // If more than 1000 files, we must issue multiple requests - var batches = []; - while (objectsToDelete.length > 1000) { - batches.push(objectsToDelete.splice(0, 1000)); + // If more than 1000 files, we must issue multiple requests + var batches = []; + while (objectsToDelete.length > 1000) { + batches.push(objectsToDelete.splice(0, 1000)); + } + batches.push(objectsToDelete); + + return Promise.map( + batches, + function (objects) { + return s3 + .deleteObjects({ + Bucket: bucketName, + Delete: { + Objects: objects, + }, + }) + .promise() + .then(function () { + if (verbose) { + console.log("Cleaned " + objects.length + " files."); } - batches.push(objectsToDelete); - - return Promise.map(batches, function(objects) { - return s3.deleteObjects({ - Bucket: bucketName, - Delete: { - Objects: objects - } - }).promise().then(function() { - if (verbose) { - console.log('Cleaned ' + objects.length + ' files.'); - } - }); - }, {concurrency : concurrency}); - } - }).catch(function(error) { - errors.push(error); - }).then(function() { - if (errors.length === 0) { - done(); - return; - } + }); + }, + { concurrency: concurrency } + ); + } + }) + .catch(function (error) { + errors.push(error); + }) + .then(function () { + if (errors.length === 0) { + done(); + return; + } - console.log('Errors: '); - errors.map(function(e) { - console.log(e); - }); - done(1); - }); + console.log("Errors: "); + errors.map(function (e) { + console.log(e); + }); + done(1); + }); } function getMimeType(filename) { - var mimeType = mime.getType(filename); - if (mimeType) { - //Compress everything except zipfiles, binary images, and video - var compress = !/^(image\/|video\/|application\/zip|application\/gzip)/i.test(mimeType); - if (mimeType === 'image/svg+xml') { - compress = true; - } - return { type: mimeType, compress: compress }; - } - - //Non-standard mime types not handled by mime - if (/\.(glsl|LICENSE|config|state)$/i.test(filename)) { - return { type: 'text/plain', compress: true }; - } else if (/\.(czml|topojson)$/i.test(filename)) { - return { type: 'application/json', compress: true }; - } else if (/\.(crn|tgz)$/i.test(filename)) { - return { type: 'application/octet-stream', compress: false }; - } - - // Handle dotfiles, such as .jshintrc - var baseName = path.basename(filename); - if (baseName[0] === '.' || baseName.indexOf('.') === -1) { - return { type: 'text/plain', compress: true }; - } - - // Everything else can be octet-stream compressed but print a warning - // if we introduce a type we aren't specifically handling. - if (!/\.(terrain|b3dm|geom|pnts|vctr|cmpt|i3dm|metadata)$/i.test(filename)) { - console.log('Unknown mime type for ' + filename); + var mimeType = mime.getType(filename); + if (mimeType) { + //Compress everything except zipfiles, binary images, and video + var compress = !/^(image\/|video\/|application\/zip|application\/gzip)/i.test( + mimeType + ); + if (mimeType === "image/svg+xml") { + compress = true; } - - return { type: 'application/octet-stream', compress: true }; + return { type: mimeType, compress: compress }; + } + + //Non-standard mime types not handled by mime + if (/\.(glsl|LICENSE|config|state)$/i.test(filename)) { + return { type: "text/plain", compress: true }; + } else if (/\.(czml|topojson)$/i.test(filename)) { + return { type: "application/json", compress: true }; + } else if (/\.(crn|tgz)$/i.test(filename)) { + return { type: "application/octet-stream", compress: false }; + } + + // Handle dotfiles, such as .jshintrc + var baseName = path.basename(filename); + if (baseName[0] === "." || baseName.indexOf(".") === -1) { + return { type: "text/plain", compress: true }; + } + + // Everything else can be octet-stream compressed but print a warning + // if we introduce a type we aren't specifically handling. + if (!/\.(terrain|b3dm|geom|pnts|vctr|cmpt|i3dm|metadata)$/i.test(filename)) { + console.log("Unknown mime type for " + filename); + } + + return { type: "application/octet-stream", compress: true }; } // get all files currently in bucket asynchronously function listAll(s3, bucketName, prefix, files, marker) { - return s3.listObjects({ - Bucket: bucketName, - MaxKeys: 1000, - Prefix: prefix, - Marker: marker - }).promise().then(function(data) { - var items = data.Contents; - for (var i = 0; i < items.length; i++) { - files.push(items[i].Key); - } + return s3 + .listObjects({ + Bucket: bucketName, + MaxKeys: 1000, + Prefix: prefix, + Marker: marker, + }) + .promise() + .then(function (data) { + var items = data.Contents; + for (var i = 0; i < items.length; i++) { + files.push(items[i].Key); + } - if (data.IsTruncated) { - // get next page of results - return listAll(s3, bucketName, prefix, files, files[files.length - 1]); - } + if (data.IsTruncated) { + // get next page of results + return listAll(s3, bucketName, prefix, files, files[files.length - 1]); + } }); } -gulp.task('deploy-set-version', function(done) { - var buildVersion = yargs.argv.buildVersion; - if (buildVersion) { - // NPM versions can only contain alphanumeric and hyphen characters - packageJson.version += '-' + buildVersion.replace(/[^[0-9A-Za-z-]/g, ''); - fs.writeFileSync('package.json', JSON.stringify(packageJson, undefined, 2)); - } - done(); +gulp.task("deploy-set-version", function (done) { + var buildVersion = yargs.argv.buildVersion; + if (buildVersion) { + // NPM versions can only contain alphanumeric and hyphen characters + packageJson.version += "-" + buildVersion.replace(/[^[0-9A-Za-z-]/g, ""); + fs.writeFileSync("package.json", JSON.stringify(packageJson, undefined, 2)); + } + done(); }); -gulp.task('deploy-status', function() { - if (isTravisPullRequest()) { - console.log('Skipping deployment status for non-pull request.'); - return Promise.resolve(); - } - - var status = yargs.argv.status; - var message = yargs.argv.message; - - var deployUrl = travisDeployUrl + process.env.TRAVIS_BRANCH + '/'; - var zipUrl = deployUrl + 'Cesium-' + packageJson.version + '.zip'; - var npmUrl = deployUrl + 'cesium-' + packageJson.version + '.tgz'; - var coverageUrl = travisDeployUrl + process.env.TRAVIS_BRANCH + '/Build/Coverage/index.html'; - - return Promise.join( - setStatus(status, deployUrl, message, 'deployment'), - setStatus(status, zipUrl, message, 'zip file'), - setStatus(status, npmUrl, message, 'npm package'), - setStatus(status, coverageUrl, message, 'coverage results') - ); +gulp.task("deploy-status", function () { + if (isTravisPullRequest()) { + console.log("Skipping deployment status for non-pull request."); + return Promise.resolve(); + } + + var status = yargs.argv.status; + var message = yargs.argv.message; + + var deployUrl = travisDeployUrl + process.env.TRAVIS_BRANCH + "/"; + var zipUrl = deployUrl + "Cesium-" + packageJson.version + ".zip"; + var npmUrl = deployUrl + "cesium-" + packageJson.version + ".tgz"; + var coverageUrl = + travisDeployUrl + process.env.TRAVIS_BRANCH + "/Build/Coverage/index.html"; + + return Promise.join( + setStatus(status, deployUrl, message, "deployment"), + setStatus(status, zipUrl, message, "zip file"), + setStatus(status, npmUrl, message, "npm package"), + setStatus(status, coverageUrl, message, "coverage results") + ); }); function setStatus(state, targetUrl, description, context) { - // skip if the environment does not have the token - if (!process.env.TOKEN) { - return; - } - - var requestPost = Promise.promisify(request.post); - return requestPost({ - url: 'https://api.github.com/repos/' + process.env.TRAVIS_REPO_SLUG + '/statuses/' + process.env.TRAVIS_COMMIT, - json: true, - headers: { - 'Authorization': 'token ' + process.env.TOKEN, - 'User-Agent': 'Cesium' - }, - body: { - state: state, - target_url: targetUrl, - description: description, - context: context - } - }); + // skip if the environment does not have the token + if (!process.env.TOKEN) { + return; + } + + var requestPost = Promise.promisify(request.post); + return requestPost({ + url: + "https://api.github.com/repos/" + + process.env.TRAVIS_REPO_SLUG + + "/statuses/" + + process.env.TRAVIS_COMMIT, + json: true, + headers: { + Authorization: "token " + process.env.TOKEN, + "User-Agent": "Cesium", + }, + body: { + state: state, + target_url: targetUrl, + description: description, + context: context, + }, + }); } -gulp.task('coverage', function(done) { - var argv = yargs.argv; - var webglStub = argv.webglStub ? argv.webglStub : false; - var suppressPassed = argv.suppressPassed ? argv.suppressPassed : false; - var failTaskOnError = argv.failTaskOnError ? argv.failTaskOnError : false; - - var folders = []; - var browsers = ['Chrome']; - if (argv.browsers) { - browsers = argv.browsers.split(','); - } - - var karma = new Karma.Server({ - configFile: karmaConfigFile, - browsers: browsers, - specReporter: { - suppressErrorSummary: false, - suppressFailed: false, - suppressPassed: suppressPassed, - suppressSkipped: true - }, - preprocessors: { - 'Source/Core/**/*.js': ['karma-coverage-istanbul-instrumenter'], - 'Source/DataSources/**/*.js': ['karma-coverage-istanbul-instrumenter'], - 'Source/Renderer/**/*.js': ['karma-coverage-istanbul-instrumenter'], - 'Source/Scene/**/*.js': ['karma-coverage-istanbul-instrumenter'], - 'Source/Shaders/**/*.js': ['karma-coverage-istanbul-instrumenter'], - 'Source/Widgets/**/*.js': ['karma-coverage-istanbul-instrumenter'], - 'Source/Workers/**/*.js': ['karma-coverage-istanbul-instrumenter'] +gulp.task("coverage", function (done) { + var argv = yargs.argv; + var webglStub = argv.webglStub ? argv.webglStub : false; + var suppressPassed = argv.suppressPassed ? argv.suppressPassed : false; + var failTaskOnError = argv.failTaskOnError ? argv.failTaskOnError : false; + + var folders = []; + var browsers = ["Chrome"]; + if (argv.browsers) { + browsers = argv.browsers.split(","); + } + + var karma = new Karma.Server( + { + configFile: karmaConfigFile, + browsers: browsers, + specReporter: { + suppressErrorSummary: false, + suppressFailed: false, + suppressPassed: suppressPassed, + suppressSkipped: true, + }, + preprocessors: { + "Source/Core/**/*.js": ["karma-coverage-istanbul-instrumenter"], + "Source/DataSources/**/*.js": ["karma-coverage-istanbul-instrumenter"], + "Source/Renderer/**/*.js": ["karma-coverage-istanbul-instrumenter"], + "Source/Scene/**/*.js": ["karma-coverage-istanbul-instrumenter"], + "Source/Shaders/**/*.js": ["karma-coverage-istanbul-instrumenter"], + "Source/Widgets/**/*.js": ["karma-coverage-istanbul-instrumenter"], + "Source/Workers/**/*.js": ["karma-coverage-istanbul-instrumenter"], + }, + coverageIstanbulInstrumenter: { + esModules: true, + }, + reporters: ["spec", "coverage"], + coverageReporter: { + dir: "Build/Coverage", + subdir: function (browserName) { + folders.push(browserName); + return browserName; }, - coverageIstanbulInstrumenter: { - esModules: true - }, - reporters: ['spec', 'coverage'], - coverageReporter: { - dir: 'Build/Coverage', - subdir: function(browserName) { - folders.push(browserName); - return browserName; - }, - includeAllSources: true - }, - client: { - captureConsole: verbose, - args: [undefined, undefined, undefined, webglStub, undefined] - } - }, function(e) { - var html = '
      '; - folders.forEach(function(folder) { - html += '
    • ' + folder + '
    • '; + includeAllSources: true, + }, + client: { + captureConsole: verbose, + args: [undefined, undefined, undefined, webglStub, undefined], + }, + }, + function (e) { + var html = "
        "; + folders.forEach(function (folder) { + html += + '
      • ' + + folder + + "
      • "; + }); + html += "
      "; + fs.writeFileSync("Build/Coverage/index.html", html); + + if (!process.env.TRAVIS) { + folders.forEach(function (dir) { + open("Build/Coverage/" + dir + "/index.html"); }); - html += '
    '; - fs.writeFileSync('Build/Coverage/index.html', html); - - if (!process.env.TRAVIS) { - folders.forEach(function(dir) { - open('Build/Coverage/' + dir + '/index.html'); - }); - } - return done(failTaskOnError ? e : undefined); - }); - karma.start(); -}); - -gulp.task('test', function(done) { - var argv = yargs.argv; - - var enableAllBrowsers = argv.all ? true : false; - var includeCategory = argv.include ? argv.include : ''; - var excludeCategory = argv.exclude ? argv.exclude : ''; - var webglValidation = argv.webglValidation ? argv.webglValidation : false; - var webglStub = argv.webglStub ? argv.webglStub : false; - var release = argv.release ? argv.release : false; - var failTaskOnError = argv.failTaskOnError ? argv.failTaskOnError : false; - var suppressPassed = argv.suppressPassed ? argv.suppressPassed : false; - - var browsers = ['Chrome']; - if (argv.browsers) { - browsers = argv.browsers.split(','); + } + return done(failTaskOnError ? e : undefined); } + ); + karma.start(); +}); - var files = [ - { pattern: 'Specs/karma-main.js', included: true, type: 'module' }, - { pattern: 'Source/**', included: false, type: 'module' }, - { pattern: 'Specs/*.js', included: true, type: 'module' }, - { pattern: 'Specs/Core/**', included: true, type: 'module' }, - { pattern: 'Specs/Data/**', included: false }, - { pattern: 'Specs/DataSources/**', included: true, type: 'module' }, - { pattern: 'Specs/Renderer/**', included: true, type: 'module' }, - { pattern: 'Specs/Scene/**', included: true, type: 'module' }, - { pattern: 'Specs/ThirdParty/**', included: true, type: 'module' }, - { pattern: 'Specs/Widgets/**', included: true, type: 'module' }, - { pattern: 'Specs/TestWorkers/**', included: false } +gulp.task("test", function (done) { + var argv = yargs.argv; + + var enableAllBrowsers = argv.all ? true : false; + var includeCategory = argv.include ? argv.include : ""; + var excludeCategory = argv.exclude ? argv.exclude : ""; + var webglValidation = argv.webglValidation ? argv.webglValidation : false; + var webglStub = argv.webglStub ? argv.webglStub : false; + var release = argv.release ? argv.release : false; + var failTaskOnError = argv.failTaskOnError ? argv.failTaskOnError : false; + var suppressPassed = argv.suppressPassed ? argv.suppressPassed : false; + + var browsers = ["Chrome"]; + if (argv.browsers) { + browsers = argv.browsers.split(","); + } + + var files = [ + { pattern: "Specs/karma-main.js", included: true, type: "module" }, + { pattern: "Source/**", included: false, type: "module" }, + { pattern: "Specs/*.js", included: true, type: "module" }, + { pattern: "Specs/Core/**", included: true, type: "module" }, + { pattern: "Specs/Data/**", included: false }, + { pattern: "Specs/DataSources/**", included: true, type: "module" }, + { pattern: "Specs/Renderer/**", included: true, type: "module" }, + { pattern: "Specs/Scene/**", included: true, type: "module" }, + { pattern: "Specs/ThirdParty/**", included: true, type: "module" }, + { pattern: "Specs/Widgets/**", included: true, type: "module" }, + { pattern: "Specs/TestWorkers/**", included: false }, + ]; + + if (release) { + files = [ + { pattern: "Specs/Data/**", included: false }, + { pattern: "Specs/ThirdParty/**", included: true, type: "module" }, + { pattern: "Specs/TestWorkers/**", included: false }, + { pattern: "Build/Cesium/Cesium.js", included: true }, + { pattern: "Build/Cesium/**", included: false }, + { pattern: "Build/Specs/karma-main.js", included: true }, + { pattern: "Build/Specs/Specs.js", included: true }, ]; - - if (release) { - files = [ - { pattern: 'Specs/Data/**', included: false }, - { pattern: 'Specs/ThirdParty/**', included: true, type: 'module' }, - { pattern: 'Specs/TestWorkers/**', included: false }, - { pattern: 'Build/Cesium/Cesium.js', included: true }, - { pattern: 'Build/Cesium/**', included: false }, - { pattern: 'Build/Specs/karma-main.js', included: true }, - { pattern: 'Build/Specs/Specs.js', included: true } - ]; + } + + var karma = new Karma.Server( + { + configFile: karmaConfigFile, + browsers: browsers, + specReporter: { + suppressErrorSummary: false, + suppressFailed: false, + suppressPassed: suppressPassed, + suppressSkipped: true, + }, + detectBrowsers: { + enabled: enableAllBrowsers, + }, + logLevel: verbose ? Karma.constants.LOG_INFO : Karma.constants.LOG_ERROR, + files: files, + client: { + captureConsole: verbose, + args: [ + includeCategory, + excludeCategory, + webglValidation, + webglStub, + release, + ], + }, + }, + function (e) { + return done(failTaskOnError ? e : undefined); } - - var karma = new Karma.Server({ - configFile: karmaConfigFile, - browsers: browsers, - specReporter: { - suppressErrorSummary: false, - suppressFailed: false, - suppressPassed: suppressPassed, - suppressSkipped: true - }, - detectBrowsers: { - enabled: enableAllBrowsers - }, - logLevel: verbose ? Karma.constants.LOG_INFO : Karma.constants.LOG_ERROR, - files: files, - client: { - captureConsole: verbose, - args: [includeCategory, excludeCategory, webglValidation, webglStub, release] - } - }, function(e) { - return done(failTaskOnError ? e : undefined); - }); - karma.start(); + ); + karma.start(); }); -gulp.task('convertToModules', function() { - var requiresRegex = /([\s\S]*?(define|defineSuite|require)\((?:{[\s\S]*}, )?\[)([\S\s]*?)]([\s\S]*?function\s*)\(([\S\s]*?)\) {([\s\S]*)/; - var noModulesRegex = /([\s\S]*?(define|defineSuite|require)\((?:{[\s\S]*}, )?\[?)([\S\s]*?)]?([\s\S]*?function\s*)\(([\S\s]*?)\) {([\s\S]*)/; - var splitRegex = /,\s*/; +gulp.task("convertToModules", function () { + var requiresRegex = /([\s\S]*?(define|defineSuite|require)\((?:{[\s\S]*}, )?\[)([\S\s]*?)]([\s\S]*?function\s*)\(([\S\s]*?)\) {([\s\S]*)/; + var noModulesRegex = /([\s\S]*?(define|defineSuite|require)\((?:{[\s\S]*}, )?\[?)([\S\s]*?)]?([\s\S]*?function\s*)\(([\S\s]*?)\) {([\s\S]*)/; + var splitRegex = /,\s*/; - var fsReadFile = Promise.promisify(fs.readFile); - var fsWriteFile = Promise.promisify(fs.writeFile); + var fsReadFile = Promise.promisify(fs.readFile); + var fsWriteFile = Promise.promisify(fs.writeFile); - var files = globby.sync(filesToConvertES6); + var files = globby.sync(filesToConvertES6); - return Promise.map(files, function(file) { - return fsReadFile(file).then(function(contents) { - contents = contents.toString(); - if (contents.startsWith('import')) { - return; - } + return Promise.map(files, function (file) { + return fsReadFile(file).then(function (contents) { + contents = contents.toString(); + if (contents.startsWith("import")) { + return; + } - var result = requiresRegex.exec(contents); + var result = requiresRegex.exec(contents); - if (result === null) { - result = noModulesRegex.exec(contents); - if (result === null) { - return; - } - } + if (result === null) { + result = noModulesRegex.exec(contents); + if (result === null) { + return; + } + } - var names = result[3].split(splitRegex); - if (names.length === 1 && names[0].trim() === '') { - names.length = 0; - } + var names = result[3].split(splitRegex); + if (names.length === 1 && names[0].trim() === "") { + names.length = 0; + } - var i; - for (i = 0; i < names.length; ++i) { - if (names[i].indexOf('//') >= 0 || names[i].indexOf('/*') >= 0) { - console.log(file + ' contains comments in the require list. Skipping so nothing gets broken.'); - return; - } - } + var i; + for (i = 0; i < names.length; ++i) { + if (names[i].indexOf("//") >= 0 || names[i].indexOf("/*") >= 0) { + console.log( + file + + " contains comments in the require list. Skipping so nothing gets broken." + ); + return; + } + } - var identifiers = result[5].split(splitRegex); - if (identifiers.length === 1 && identifiers[0].trim() === '') { - identifiers.length = 0; - } + var identifiers = result[5].split(splitRegex); + if (identifiers.length === 1 && identifiers[0].trim() === "") { + identifiers.length = 0; + } - for (i = 0; i < identifiers.length; ++i) { - if (identifiers[i].indexOf('//') >= 0 || identifiers[i].indexOf('/*') >= 0) { - console.log(file + ' contains comments in the require list. Skipping so nothing gets broken.'); - return; - } - } + for (i = 0; i < identifiers.length; ++i) { + if ( + identifiers[i].indexOf("//") >= 0 || + identifiers[i].indexOf("/*") >= 0 + ) { + console.log( + file + + " contains comments in the require list. Skipping so nothing gets broken." + ); + return; + } + } - var requires = []; + var requires = []; - for (i = 0; i < names.length && i < identifiers.length; ++i) { - requires.push({ - name : names[i].trim(), - identifier : identifiers[i].trim() - }); - } + for (i = 0; i < names.length && i < identifiers.length; ++i) { + requires.push({ + name: names[i].trim(), + identifier: identifiers[i].trim(), + }); + } - // Convert back to separate lists for the names and identifiers, and add - // any additional names or identifiers that don't have a corresponding pair. - var sortedNames = requires.map(function(item) { - return item.name.slice(0, -1) + '.js\''; - }); - for (i = sortedNames.length; i < names.length; ++i) { - sortedNames.push(names[i].trim()); - } + // Convert back to separate lists for the names and identifiers, and add + // any additional names or identifiers that don't have a corresponding pair. + var sortedNames = requires.map(function (item) { + return item.name.slice(0, -1) + ".js'"; + }); + for (i = sortedNames.length; i < names.length; ++i) { + sortedNames.push(names[i].trim()); + } - var sortedIdentifiers = requires.map(function(item) { - return item.identifier; - }); - for (i = sortedIdentifiers.length; i < identifiers.length; ++i) { - sortedIdentifiers.push(identifiers[i].trim()); - } + var sortedIdentifiers = requires.map(function (item) { + return item.identifier; + }); + for (i = sortedIdentifiers.length; i < identifiers.length; ++i) { + sortedIdentifiers.push(identifiers[i].trim()); + } - contents = ''; - if (sortedNames.length > 0) { - for (var q = 0; q < sortedNames.length; q++) { - var modulePath = sortedNames[q]; - if (file.startsWith('Specs')) { - modulePath = modulePath.substring(1, modulePath.length - 1); - var sourceDir = path.dirname(file); - - if (modulePath.startsWith('Specs') || modulePath.startsWith('.')) { - var importPath = modulePath; - if (modulePath.startsWith('Specs')) { - importPath = path.relative(sourceDir, modulePath); - if (importPath[0] !== '.') { - importPath = './' + importPath; - } - } - modulePath = '\'' + importPath + '\''; - contents += 'import ' + sortedIdentifiers[q] + ' from ' + modulePath + ';' + os.EOL; - } else { - modulePath = '\'' + path.relative(sourceDir, 'Source') + '/Cesium.js' + '\''; - if (sortedIdentifiers[q] === 'CesiumMath') { - contents += 'import { Math as CesiumMath } from ' + modulePath + ';' + os.EOL; - } else { - contents += 'import { ' + sortedIdentifiers[q] + ' } from ' + modulePath + ';' + os.EOL; - } - } - } else { - contents += 'import ' + sortedIdentifiers[q] + ' from ' + modulePath + ';' + os.EOL; - } + contents = ""; + if (sortedNames.length > 0) { + for (var q = 0; q < sortedNames.length; q++) { + var modulePath = sortedNames[q]; + if (file.startsWith("Specs")) { + modulePath = modulePath.substring(1, modulePath.length - 1); + var sourceDir = path.dirname(file); + + if (modulePath.startsWith("Specs") || modulePath.startsWith(".")) { + var importPath = modulePath; + if (modulePath.startsWith("Specs")) { + importPath = path.relative(sourceDir, modulePath); + if (importPath[0] !== ".") { + importPath = "./" + importPath; } - } - - var code; - var codeAndReturn = result[6]; - if (file.endsWith('Spec.js')) { - var indi = codeAndReturn.lastIndexOf('});'); - code = codeAndReturn.slice(0, indi); - code = code.trim().replace("'use strict';" + os.EOL, ''); - contents += code + os.EOL; + } + modulePath = "'" + importPath + "'"; + contents += + "import " + + sortedIdentifiers[q] + + " from " + + modulePath + + ";" + + os.EOL; } else { - var returnIndex = codeAndReturn.lastIndexOf('return'); - - code = codeAndReturn.slice(0, returnIndex); - code = code.trim().replace("'use strict';" + os.EOL, ''); - contents += code + os.EOL; - - var returnStatement = codeAndReturn.slice(returnIndex); - contents += returnStatement.split(';')[0].replace('return ', 'export default ') + ';' + os.EOL; + modulePath = + "'" + path.relative(sourceDir, "Source") + "/Cesium.js" + "'"; + if (sortedIdentifiers[q] === "CesiumMath") { + contents += + "import { Math as CesiumMath } from " + + modulePath + + ";" + + os.EOL; + } else { + contents += + "import { " + + sortedIdentifiers[q] + + " } from " + + modulePath + + ";" + + os.EOL; + } } + } else { + contents += + "import " + + sortedIdentifiers[q] + + " from " + + modulePath + + ";" + + os.EOL; + } + } + } - return fsWriteFile(file, contents); - }); + var code; + var codeAndReturn = result[6]; + if (file.endsWith("Spec.js")) { + var indi = codeAndReturn.lastIndexOf("});"); + code = codeAndReturn.slice(0, indi); + code = code.trim().replace("'use strict';" + os.EOL, ""); + contents += code + os.EOL; + } else { + var returnIndex = codeAndReturn.lastIndexOf("return"); + + code = codeAndReturn.slice(0, returnIndex); + code = code.trim().replace("'use strict';" + os.EOL, ""); + contents += code + os.EOL; + + var returnStatement = codeAndReturn.slice(returnIndex); + contents += + returnStatement.split(";")[0].replace("return ", "export default ") + + ";" + + os.EOL; + } + + return fsWriteFile(file, contents); }); + }); }); function combineCesium(debug, optimizer, combineOutput) { - var plugins = []; + var plugins = []; - if (!debug) { - plugins.push(rollupPluginStripPragma({ - pragmas: ['debug'] - })); - } - if (optimizer === 'uglify2') { - plugins.push(rollupPluginUglify.uglify()); - } - - return rollup.rollup({ - input: 'Source/Cesium.js', - plugins: plugins, - onwarn: rollupWarning - }).then(function(bundle) { - return bundle.write({ - format: 'umd', - name: 'Cesium', - file: path.join(combineOutput, 'Cesium.js'), - sourcemap: debug, - banner: copyrightHeader - }); + if (!debug) { + plugins.push( + rollupPluginStripPragma({ + pragmas: ["debug"], + }) + ); + } + if (optimizer === "uglify2") { + plugins.push(rollupPluginUglify.uglify()); + } + + return rollup + .rollup({ + input: "Source/Cesium.js", + plugins: plugins, + onwarn: rollupWarning, + }) + .then(function (bundle) { + return bundle.write({ + format: "umd", + name: "Cesium", + file: path.join(combineOutput, "Cesium.js"), + sourcemap: debug, + banner: copyrightHeader, + }); }); } function combineWorkers(debug, optimizer, combineOutput) { - //This is done waterfall style for concurrency reasons. - // Copy files that are already minified - return globby(['Source/ThirdParty/Workers/draco*.js']) - .then(function(files) { - var stream = gulp.src(files, { base: 'Source' }) - .pipe(gulp.dest(combineOutput)); - return streamToPromise(stream); - }) - .then(function () { - return globby(['Source/Workers/cesiumWorkerBootstrapper.js', - 'Source/Workers/transferTypedArrayTest.js', - 'Source/ThirdParty/Workers/*.js', - // Files are already minified, don't optimize - '!Source/ThirdParty/Workers/draco*.js']); - }) - .then(function(files) { - return Promise.map(files, function(file) { - return streamToPromise(gulp.src(file) - .pipe(gulpUglify()) - .pipe(gulp.dest(path.dirname(path.join(combineOutput, path.relative('Source', file)))))); - }, {concurrency : concurrency}); - }) - .then(function() { - return globby(['Source/WorkersES6/*.js']); - }) - .then(function(files) { - var plugins = []; - - if (!debug) { - plugins.push(rollupPluginStripPragma({ - pragmas: ['debug'] - })); - } - if (optimizer === 'uglify2') { - plugins.push(rollupPluginUglify.uglify()); - } + //This is done waterfall style for concurrency reasons. + // Copy files that are already minified + return globby(["Source/ThirdParty/Workers/draco*.js"]) + .then(function (files) { + var stream = gulp + .src(files, { base: "Source" }) + .pipe(gulp.dest(combineOutput)); + return streamToPromise(stream); + }) + .then(function () { + return globby([ + "Source/Workers/cesiumWorkerBootstrapper.js", + "Source/Workers/transferTypedArrayTest.js", + "Source/ThirdParty/Workers/*.js", + // Files are already minified, don't optimize + "!Source/ThirdParty/Workers/draco*.js", + ]); + }) + .then(function (files) { + return Promise.map( + files, + function (file) { + return streamToPromise( + gulp + .src(file) + .pipe(gulpUglify()) + .pipe( + gulp.dest( + path.dirname( + path.join(combineOutput, path.relative("Source", file)) + ) + ) + ) + ); + }, + { concurrency: concurrency } + ); + }) + .then(function () { + return globby(["Source/WorkersES6/*.js"]); + }) + .then(function (files) { + var plugins = []; + + if (!debug) { + plugins.push( + rollupPluginStripPragma({ + pragmas: ["debug"], + }) + ); + } + if (optimizer === "uglify2") { + plugins.push(rollupPluginUglify.uglify()); + } - return rollup.rollup({ - input: files, - plugins: plugins, - onwarn: rollupWarning - }).then(function(bundle) { - return bundle.write({ - dir: path.join(combineOutput, 'Workers'), - format: 'amd', - sourcemap: debug, - banner: copyrightHeader - }); - }); + return rollup + .rollup({ + input: files, + plugins: plugins, + onwarn: rollupWarning, + }) + .then(function (bundle) { + return bundle.write({ + dir: path.join(combineOutput, "Workers"), + format: "amd", + sourcemap: debug, + banner: copyrightHeader, + }); }); + }); } function minifyCSS(outputDirectory) { - streamToPromise( - gulp.src('Source/**/*.css') - .pipe(cleanCSS()) - .pipe(gulp.dest(outputDirectory)) - ); + streamToPromise( + gulp + .src("Source/**/*.css") + .pipe(cleanCSS()) + .pipe(gulp.dest(outputDirectory)) + ); } function minifyModules(outputDirectory) { - return streamToPromise(gulp.src('Source/ThirdParty/google-earth-dbroot-parser.js') - .pipe(gulpUglify()) - .pipe(gulp.dest(outputDirectory + '/ThirdParty/'))); + return streamToPromise( + gulp + .src("Source/ThirdParty/google-earth-dbroot-parser.js") + .pipe(gulpUglify()) + .pipe(gulp.dest(outputDirectory + "/ThirdParty/")) + ); } function combineJavaScript(options) { - var optimizer = options.optimizer; - var outputDirectory = options.outputDirectory; - var removePragmas = options.removePragmas; + var optimizer = options.optimizer; + var outputDirectory = options.outputDirectory; + var removePragmas = options.removePragmas; - var combineOutput = path.join('Build', 'combineOutput', optimizer); + var combineOutput = path.join("Build", "combineOutput", optimizer); - var promise = Promise.join( - combineCesium(!removePragmas, optimizer, combineOutput), - combineWorkers(!removePragmas, optimizer, combineOutput), - minifyModules(outputDirectory) - ); + var promise = Promise.join( + combineCesium(!removePragmas, optimizer, combineOutput), + combineWorkers(!removePragmas, optimizer, combineOutput), + minifyModules(outputDirectory) + ); - return promise.then(function() { - var promises = []; + return promise.then(function () { + var promises = []; - //copy to build folder with copyright header added at the top - var stream = gulp.src([combineOutput + '/**']) - .pipe(gulp.dest(outputDirectory)); + //copy to build folder with copyright header added at the top + var stream = gulp + .src([combineOutput + "/**"]) + .pipe(gulp.dest(outputDirectory)); - promises.push(streamToPromise(stream)); + promises.push(streamToPromise(stream)); - var everythingElse = ['Source/**', '!**/*.js', '!**/*.glsl']; - if (optimizer === 'uglify2') { - promises.push(minifyCSS(outputDirectory)); - everythingElse.push('!**/*.css'); - } + var everythingElse = ["Source/**", "!**/*.js", "!**/*.glsl"]; + if (optimizer === "uglify2") { + promises.push(minifyCSS(outputDirectory)); + everythingElse.push("!**/*.css"); + } - stream = gulp.src(everythingElse, { nodir: true }).pipe(gulp.dest(outputDirectory)); - promises.push(streamToPromise(stream)); + stream = gulp + .src(everythingElse, { nodir: true }) + .pipe(gulp.dest(outputDirectory)); + promises.push(streamToPromise(stream)); - return Promise.all(promises).then(function() { - rimraf.sync(combineOutput); - }); + return Promise.all(promises).then(function () { + rimraf.sync(combineOutput); }); + }); } function glslToJavaScript(minify, minifyStateFilePath) { - fs.writeFileSync(minifyStateFilePath, minify); - var minifyStateFileLastModified = fs.existsSync(minifyStateFilePath) ? fs.statSync(minifyStateFilePath).mtime.getTime() : 0; + fs.writeFileSync(minifyStateFilePath, minify.toString()); + var minifyStateFileLastModified = fs.existsSync(minifyStateFilePath) + ? fs.statSync(minifyStateFilePath).mtime.getTime() + : 0; + + // collect all currently existing JS files into a set, later we will remove the ones + // we still are using from the set, then delete any files remaining in the set. + var leftOverJsFiles = {}; + + globby + .sync(["Source/Shaders/**/*.js", "Source/ThirdParty/Shaders/*.js"]) + .forEach(function (file) { + leftOverJsFiles[path.normalize(file)] = true; + }); -// collect all currently existing JS files into a set, later we will remove the ones -// we still are using from the set, then delete any files remaining in the set. - var leftOverJsFiles = {}; + var builtinFunctions = []; + var builtinConstants = []; + var builtinStructs = []; + + var glslFiles = globby.sync([ + "Source/Shaders/**/*.glsl", + "Source/ThirdParty/Shaders/*.glsl", + ]); + glslFiles.forEach(function (glslFile) { + glslFile = path.normalize(glslFile); + var baseName = path.basename(glslFile, ".glsl"); + var jsFile = path.join(path.dirname(glslFile), baseName) + ".js"; + + // identify built in functions, structs, and constants + var baseDir = path.join("Source", "Shaders", "Builtin"); + if ( + glslFile.indexOf(path.normalize(path.join(baseDir, "Functions"))) === 0 + ) { + builtinFunctions.push(baseName); + } else if ( + glslFile.indexOf(path.normalize(path.join(baseDir, "Constants"))) === 0 + ) { + builtinConstants.push(baseName); + } else if ( + glslFile.indexOf(path.normalize(path.join(baseDir, "Structs"))) === 0 + ) { + builtinStructs.push(baseName); + } - globby.sync(['Source/Shaders/**/*.js', 'Source/ThirdParty/Shaders/*.js']).forEach(function(file) { - leftOverJsFiles[path.normalize(file)] = true; - }); + delete leftOverJsFiles[jsFile]; - var builtinFunctions = []; - var builtinConstants = []; - var builtinStructs = []; + var jsFileExists = fs.existsSync(jsFile); + var jsFileModified = jsFileExists ? fs.statSync(jsFile).mtime.getTime() : 0; + var glslFileModified = fs.statSync(glslFile).mtime.getTime(); - var glslFiles = globby.sync(['Source/Shaders/**/*.glsl', 'Source/ThirdParty/Shaders/*.glsl']); - glslFiles.forEach(function(glslFile) { - glslFile = path.normalize(glslFile); - var baseName = path.basename(glslFile, '.glsl'); - var jsFile = path.join(path.dirname(glslFile), baseName) + '.js'; + if ( + jsFileExists && + jsFileModified > glslFileModified && + jsFileModified > minifyStateFileLastModified + ) { + return; + } - // identify built in functions, structs, and constants - var baseDir = path.join('Source', 'Shaders', 'Builtin'); - if (glslFile.indexOf(path.normalize(path.join(baseDir, 'Functions'))) === 0) { - builtinFunctions.push(baseName); - } - else if (glslFile.indexOf(path.normalize(path.join(baseDir, 'Constants'))) === 0) { - builtinConstants.push(baseName); - } - else if (glslFile.indexOf(path.normalize(path.join(baseDir, 'Structs'))) === 0) { - builtinStructs.push(baseName); - } + var contents = fs.readFileSync(glslFile, "utf8"); + contents = contents.replace(/\r\n/gm, "\n"); - delete leftOverJsFiles[jsFile]; + var copyrightComments = ""; + var extractedCopyrightComments = contents.match( + /\/\*\*(?:[^*\/]|\*(?!\/)|\n)*?@license(?:.|\n)*?\*\//gm + ); + if (extractedCopyrightComments) { + copyrightComments = extractedCopyrightComments.join("\n") + "\n"; + } - var jsFileExists = fs.existsSync(jsFile); - var jsFileModified = jsFileExists ? fs.statSync(jsFile).mtime.getTime() : 0; - var glslFileModified = fs.statSync(glslFile).mtime.getTime(); + if (minify) { + contents = glslStripComments(contents); + contents = contents + .replace(/\s+$/gm, "") + .replace(/^\s+/gm, "") + .replace(/\n+/gm, "\n"); + contents += "\n"; + } - if (jsFileExists && jsFileModified > glslFileModified && jsFileModified > minifyStateFileLastModified) { - return; - } + contents = contents.split('"').join('\\"').replace(/\n/gm, "\\n\\\n"); + contents = + copyrightComments + + '\ +//This file is automatically rebuilt by the Cesium build process.\n\ +export default "' + + contents + + '";\n'; + + fs.writeFileSync(jsFile, contents); + }); + + // delete any left over JS files from old shaders + Object.keys(leftOverJsFiles).forEach(function (filepath) { + rimraf.sync(filepath); + }); + + var generateBuiltinContents = function (contents, builtins, path) { + for (var i = 0; i < builtins.length; i++) { + var builtin = builtins[i]; + contents.imports.push( + "import czm_" + builtin + " from './" + path + "/" + builtin + ".js'" + ); + contents.builtinLookup.push("czm_" + builtin + " : " + "czm_" + builtin); + } + }; + + //generate the JS file for Built-in GLSL Functions, Structs, and Constants + var contents = { + imports: [], + builtinLookup: [], + }; + generateBuiltinContents(contents, builtinConstants, "Constants"); + generateBuiltinContents(contents, builtinStructs, "Structs"); + generateBuiltinContents(contents, builtinFunctions, "Functions"); + + var fileContents = + "//This file is automatically rebuilt by the Cesium build process.\n" + + contents.imports.join("\n") + + "\n\nexport default {\n " + + contents.builtinLookup.join(",\n ") + + "\n};\n"; + + fs.writeFileSync( + path.join("Source", "Shaders", "Builtin", "CzmBuiltins.js"), + fileContents + ); +} - var contents = fs.readFileSync(glslFile, 'utf8'); - contents = contents.replace(/\r\n/gm, '\n'); +function createCesiumJs() { + var contents = `export var VERSION = '${version}';\n`; + globby.sync(sourceFiles).forEach(function (file) { + file = path.relative("Source", file); - var copyrightComments = ''; - var extractedCopyrightComments = contents.match(/\/\*\*(?:[^*\/]|\*(?!\/)|\n)*?@license(?:.|\n)*?\*\//gm); - if (extractedCopyrightComments) { - copyrightComments = extractedCopyrightComments.join('\n') + '\n'; - } + var moduleId = file; + moduleId = filePathToModuleId(moduleId); - if (minify) { - contents = glslStripComments(contents); - contents = contents.replace(/\s+$/gm, '').replace(/^\s+/gm, '').replace(/\n+/gm, '\n'); - contents += '\n'; - } + var assignmentName = path.basename(file, path.extname(file)); + if (moduleId.indexOf("Shaders/") === 0) { + assignmentName = "_shaders" + assignmentName; + } + assignmentName = assignmentName.replace(/(\.|-)/g, "_"); + contents += + "export { default as " + + assignmentName + + " } from './" + + moduleId + + ".js';" + + os.EOL; + }); + + fs.writeFileSync("Source/Cesium.js", contents); +} - contents = contents.split('"').join('\\"').replace(/\n/gm, '\\n\\\n'); - contents = copyrightComments + '\ -//This file is automatically rebuilt by the Cesium build process.\n\ -export default "' + contents + '";\n'; +function createTypeScriptDefinitions() { + // Run jsdoc with tsd-jsdoc to generate an initial Cesium.d.ts file. + child_process.execSync("npx jsdoc --configure Tools/jsdoc/ts-conf.json", { + stdio: "inherit", + }); + + var source = fs.readFileSync("Source/Cesium.d.ts").toString(); + + // All of our enum assignments that alias to WebGLConstants, such as PixelDatatype.js + // end up as enum strings instead of actually mapping values to WebGLConstants. + // We fix this with a simple regex replace later on, but it means the + // WebGLConstants constants enum needs to be defined in the file before it can + // be used. This block of code reads in the TS file, finds the WebGLConstants + // declaration, and then writes the file back out (in memory to source) with + // WebGLConstants being the first module. + const node = typescript.createSourceFile( + "Source/Cesium.d.ts", + source, + typescript.ScriptTarget.Latest + ); + let firstNode; + node.forEachChild((child) => { + if ( + typescript.SyntaxKind[child.kind] === "EnumDeclaration" && + child.name.escapedText === "WebGLConstants" + ) { + firstNode = child; + } + }); + + const printer = typescript.createPrinter({ + removeComments: false, + newLine: typescript.NewLineKind.LineFeed, + }); + + let newSource = ""; + newSource += printer.printNode( + typescript.EmitHint.Unspecified, + firstNode, + node + ); + node.forEachChild((child) => { + if ( + typescript.SyntaxKind[child.kind] !== "EnumDeclaration" || + child.name.escapedText !== "WebGLConstants" + ) { + newSource += printer.printNode( + typescript.EmitHint.Unspecified, + child, + node + ); + newSource += "\n\n"; + } + }); + source = newSource; + + // The next step is to find the list of Cesium modules exported by the Cesium API + // So that we can map these modules with a link back to their original source file. + + var regex = /^declare (function|class|namespace|enum) (.+)/gm; + var matches; + var publicModules = new Set(); + //eslint-disable-next-line no-cond-assign + while ((matches = regex.exec(source))) { + const moduleName = matches[2].match(/([^\s|\(]+)/); + publicModules.add(moduleName[1]); + } + + // Math shows up as "Math" because of it's aliasing from CesiumMath and namespace collision with actual Math + // It fails the above regex so just add it directly here. + publicModules.add("Math"); + + // Fix up the output to match what we need + // declare => export since we are wrapping everything in a namespace + // CesiumMath => Math (because no CesiumJS build step would be complete without special logic for the Math class) + // Fix up the WebGLConstants aliasing we mentioned above by simply unquoting the strings. + source = source + .replace(/^declare /gm, "export ") + .replace(/module "Math"/gm, "namespace Math") + .replace(/CesiumMath/gm, "Math") + .replace(/Number\[]/gm, "number[]") // Workaround https://github.com/englercj/tsd-jsdoc/issues/117 + .replace(/String\[]/gm, "string[]") + .replace(/Boolean\[]/gm, "boolean[]") + .replace(/Object\[]/gm, "object[]") + .replace(//gm, "") + .replace(//gm, "") + .replace(//gm, "") + .replace(//gm, "") + .replace( + /= "WebGLConstants\.(.+)"/gm, + (match, p1) => `= WebGLConstants.${p1}` + ); - fs.writeFileSync(jsFile, contents); - }); + // Wrap the source to actually be inside of a declared cesium module + // and add any workaround and private utility types. + source = `declare module "cesium" { - // delete any left over JS files from old shaders - Object.keys(leftOverJsFiles).forEach(function(filepath) { - rimraf.sync(filepath); - }); +/** + * Private interfaces to support PropertyBag being a dictionary-like object. + */ +interface DictionaryLike { + [index: string]: any; +} - var generateBuiltinContents = function(contents, builtins, path) { - for (var i = 0; i < builtins.length; i++) { - var builtin = builtins[i]; - contents.imports.push('import czm_' + builtin + ' from \'./' + path + '/' + builtin + '.js\''); - contents.builtinLookup.push('czm_' + builtin + ' : ' + 'czm_' + builtin); - } - }; +${source} +} - //generate the JS file for Built-in GLSL Functions, Structs, and Constants - var contents = { - imports : [], - builtinLookup: [] - }; - generateBuiltinContents(contents, builtinConstants, 'Constants'); - generateBuiltinContents(contents, builtinStructs, 'Structs'); - generateBuiltinContents(contents, builtinFunctions, 'Functions'); +`; - var fileContents = '//This file is automatically rebuilt by the Cesium build process.\n' + - contents.imports.join('\n') + - '\n\nexport default {\n ' + contents.builtinLookup.join(',\n ') + '\n};\n'; + // Map individual modules back to their source file so that TS still works + // when importing individual files instead of the entire cesium module. + globby.sync(sourceFiles).forEach(function (file) { + file = path.relative("Source", file); - fs.writeFileSync(path.join('Source', 'Shaders', 'Builtin', 'CzmBuiltins.js'), fileContents); -} + var moduleId = file; + moduleId = filePathToModuleId(moduleId); -function createCesiumJs() { - var contents = `export var VERSION = '${version}';\n`; - globby.sync(sourceFiles).forEach(function(file) { - file = path.relative('Source', file); + var assignmentName = path.basename(file, path.extname(file)); + if (publicModules.has(assignmentName)) { + publicModules.delete(assignmentName); + source += `declare module "cesium/Source/${moduleId}" { import { ${assignmentName} } from 'cesium'; export default ${assignmentName}; }\n`; + } + }); - var moduleId = file; - moduleId = filePathToModuleId(moduleId); + // Write the final source file back out + fs.writeFileSync("Source/Cesium.d.ts", source); - var assignmentName = path.basename(file, path.extname(file)); - if (moduleId.indexOf('Shaders/') === 0) { - assignmentName = '_shaders' + assignmentName; - } - assignmentName = assignmentName.replace(/(\.|-)/g, '_'); - contents += 'export { default as ' + assignmentName + " } from './" + moduleId + ".js';" + os.EOL; - }); + // Use tsc to compile it and make sure it is valid + child_process.execSync("npx tsc -p Tools/jsdoc/tsconfig.json", { + stdio: "inherit", + }); + + // Also compile our smokescreen to make sure interfaces work as expected. + child_process.execSync("npx tsc -p Specs/TypeScript/tsconfig.json", { + stdio: "inherit", + }); - fs.writeFileSync('Source/Cesium.js', contents); + // Below is a sanity check to make sure we didn't leave anything out that + // we don't already know about + + // Intentionally ignored nested items + publicModules.delete("KmlFeatureData"); + publicModules.delete("MaterialAppearance"); + + if (publicModules.size !== 0) { + throw new Error( + "Unexpected unexposed modules: " + + Array.from(publicModules.values()).join(", ") + ); + } } function createSpecList() { - var specFiles = globby.sync(['Specs/**/*Spec.js']); + var specFiles = globby.sync(["Specs/**/*Spec.js"]); - var contents = ''; - specFiles.forEach(function(file) { - contents += "import './" + filePathToModuleId(file).replace('Specs/', '') + ".js';\n"; - }); + var contents = ""; + specFiles.forEach(function (file) { + contents += + "import './" + filePathToModuleId(file).replace("Specs/", "") + ".js';\n"; + }); - fs.writeFileSync(path.join('Specs', 'SpecList.js'), contents); + fs.writeFileSync(path.join("Specs", "SpecList.js"), contents); } function createGalleryList() { - var demoObjects = []; - var demoJSONs = []; - var output = path.join('Apps', 'Sandcastle', 'gallery', 'gallery-index.js'); + var demoObjects = []; + var demoJSONs = []; + var output = path.join("Apps", "Sandcastle", "gallery", "gallery-index.js"); + + var fileList = ["Apps/Sandcastle/gallery/**/*.html"]; + if (noDevelopmentGallery) { + fileList.push("!Apps/Sandcastle/gallery/development/**/*.html"); + } + + // On travis, the version is set to something like '1.43.0-branch-name-travisBuildNumber' + // We need to extract just the Major.Minor version + var majorMinor = packageJson.version.match(/^(.*)\.(.*)\./); + var major = majorMinor[1]; + var minor = Number(majorMinor[2]) - 1; // We want the last release, not current release + var tagVersion = major + "." + minor; + + // Get an array of demos that were added since the last release. + // This includes newly staged local demos as well. + var newDemos = []; + try { + newDemos = child_process + .execSync( + "git diff --name-only --diff-filter=A " + + tagVersion + + " Apps/Sandcastle/gallery/*.html", + { stdio: ["pipe", "pipe", "ignore"] } + ) + .toString() + .trim() + .split("\n"); + } catch (e) { + // On a Cesium fork, tags don't exist so we can't generate the list. + } + + var helloWorld; + globby.sync(fileList).forEach(function (file) { + var demo = filePathToModuleId( + path.relative("Apps/Sandcastle/gallery", file) + ); - var fileList = ['Apps/Sandcastle/gallery/**/*.html']; - if (noDevelopmentGallery) { - fileList.push('!Apps/Sandcastle/gallery/development/**/*.html'); - } + var demoObject = { + name: demo, + isNew: newDemos.includes(file), + }; - // On travis, the version is set to something like '1.43.0-branch-name-travisBuildNumber' - // We need to extract just the Major.Minor version - var majorMinor = packageJson.version.match(/^(.*)\.(.*)\./); - var major = majorMinor[1]; - var minor = Number(majorMinor[2]) - 1; // We want the last release, not current release - var tagVersion = major + '.' + minor; - - // Get an array of demos that were added since the last release. - // This includes newly staged local demos as well. - var newDemos = []; - try { - newDemos = child_process.execSync('git diff --name-only --diff-filter=A ' + tagVersion + ' Apps/Sandcastle/gallery/*.html', { stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim().split('\n'); - } catch (e) { - // On a Cesium fork, tags don't exist so we can't generate the list. + if (fs.existsSync(file.replace(".html", "") + ".jpg")) { + demoObject.img = demo + ".jpg"; } - var helloWorld; - globby.sync(fileList).forEach(function(file) { - var demo = filePathToModuleId(path.relative('Apps/Sandcastle/gallery', file)); + demoObjects.push(demoObject); - var demoObject = { - name : demo, - isNew: newDemos.includes(file) - }; - - if (fs.existsSync(file.replace('.html', '') + '.jpg')) { - demoObject.img = demo + '.jpg'; - } - - demoObjects.push(demoObject); - - if (demo === 'Hello World') { - helloWorld = demoObject; - } - }); - - demoObjects.sort(function(a, b) { - if (a.name < b.name) { - return -1; - } else if (a.name > b.name) { - return 1; - } - return 0; - }); - - var helloWorldIndex = Math.max(demoObjects.indexOf(helloWorld), 0); + if (demo === "Hello World") { + helloWorld = demoObject; + } + }); - var i; - for (i = 0; i < demoObjects.length; ++i) { - demoJSONs[i] = JSON.stringify(demoObjects[i], null, 2); + demoObjects.sort(function (a, b) { + if (a.name < b.name) { + return -1; + } else if (a.name > b.name) { + return 1; } + return 0; + }); - var contents = '\ -// This file is automatically rebuilt by the Cesium build process.\n\ -var hello_world_index = ' + helloWorldIndex + ';\n\ -var VERSION = \'' + version + '\';\n\ -var gallery_demos = [' + demoJSONs.join(', ') + '];\n\ -var has_new_gallery_demos = ' + (newDemos.length > 0 ? 'true;' : 'false;') + '\n'; + var helloWorldIndex = Math.max(demoObjects.indexOf(helloWorld), 0); - fs.writeFileSync(output, contents); + var i; + for (i = 0; i < demoObjects.length; ++i) { + demoJSONs[i] = JSON.stringify(demoObjects[i], null, 2); + } - // Compile CSS for Sandcastle - return streamToPromise(gulp.src(path.join('Apps', 'Sandcastle', 'templates', 'bucketRaw.css')) - .pipe(cleanCSS()) - .pipe(gulpRename('bucket.css')) - .pipe(gulpInsert.prepend('/* This file is automatically rebuilt by the Cesium build process. */\n')) - .pipe(gulp.dest(path.join('Apps', 'Sandcastle', 'templates')))); + var contents = + "\ +// This file is automatically rebuilt by the Cesium build process.\n\ +var hello_world_index = " + + helloWorldIndex + + ";\n\ +var VERSION = '" + + version + + "';\n\ +var gallery_demos = [" + + demoJSONs.join(", ") + + "];\n\ +var has_new_gallery_demos = " + + (newDemos.length > 0 ? "true;" : "false;") + + "\n"; + + fs.writeFileSync(output, contents); + + // Compile CSS for Sandcastle + return streamToPromise( + gulp + .src(path.join("Apps", "Sandcastle", "templates", "bucketRaw.css")) + .pipe(cleanCSS()) + .pipe(gulpRename("bucket.css")) + .pipe( + gulpInsert.prepend( + "/* This file is automatically rebuilt by the Cesium build process. */\n" + ) + ) + .pipe(gulp.dest(path.join("Apps", "Sandcastle", "templates"))) + ); } function createJsHintOptions() { - var primary = JSON.parse(fs.readFileSync(path.join('Apps', '.jshintrc'), 'utf8')); - var gallery = JSON.parse(fs.readFileSync(path.join('Apps', 'Sandcastle', '.jshintrc'), 'utf8')); - primary.jasmine = false; - primary.predef = gallery.predef; - primary.unused = gallery.unused; - primary.esversion = gallery.esversion; - - var contents = '\ + var primary = JSON.parse( + fs.readFileSync(path.join("Apps", ".jshintrc"), "utf8") + ); + var gallery = JSON.parse( + fs.readFileSync(path.join("Apps", "Sandcastle", ".jshintrc"), "utf8") + ); + primary.jasmine = false; + primary.predef = gallery.predef; + primary.unused = gallery.unused; + primary.esversion = gallery.esversion; + + var contents = + "\ // This file is automatically rebuilt by the Cesium build process.\n\ -var sandcastleJsHintOptions = ' + JSON.stringify(primary, null, 4) + ';\n'; - - fs.writeFileSync(path.join('Apps', 'Sandcastle', 'jsHintOptions.js'), contents); +var sandcastleJsHintOptions = " + + JSON.stringify(primary, null, 4) + + ";\n"; + + fs.writeFileSync( + path.join("Apps", "Sandcastle", "jsHintOptions.js"), + contents + ); } function buildSandcastle() { - var appStream = gulp.src([ - 'Apps/Sandcastle/**', - '!Apps/Sandcastle/load-cesium-es6.js', - '!Apps/Sandcastle/standalone.html', - '!Apps/Sandcastle/images/**', - '!Apps/Sandcastle/gallery/**.jpg' - ]) - // Remove dev-only ES6 module loading for unbuilt Cesium - .pipe(gulpReplace(' ', '')) - .pipe(gulpReplace('nomodule', '')) - // Fix relative paths for new location - .pipe(gulpReplace('../../../Build', '../../..')) - .pipe(gulpReplace('../../Source', '../../../Source')) - .pipe(gulpReplace('../../ThirdParty', '../../../ThirdParty')) - .pipe(gulpReplace('../../SampleData', '../../../../Apps/SampleData')) - .pipe(gulpReplace('Build/Documentation', 'Documentation')) - .pipe(gulp.dest('Build/Apps/Sandcastle')); - - var imageStream = gulp.src([ - 'Apps/Sandcastle/gallery/**.jpg', - 'Apps/Sandcastle/images/**' - ], { - base: 'Apps/Sandcastle', - buffer: false - }) - .pipe(gulp.dest('Build/Apps/Sandcastle')); - - var standaloneStream = gulp.src([ - 'Apps/Sandcastle/standalone.html' - ]) - .pipe(gulpReplace(' ', '')) - .pipe(gulpReplace('nomodule', '')) - .pipe(gulpReplace('../../Build', '../..')) - .pipe(gulp.dest('Build/Apps/Sandcastle')); - - return streamToPromise(mergeStream(appStream, imageStream, standaloneStream)); + var appStream = gulp + .src([ + "Apps/Sandcastle/**", + "!Apps/Sandcastle/load-cesium-es6.js", + "!Apps/Sandcastle/standalone.html", + "!Apps/Sandcastle/images/**", + "!Apps/Sandcastle/gallery/**.jpg", + ]) + // Remove dev-only ES6 module loading for unbuilt Cesium + .pipe( + gulpReplace( + ' ', + "" + ) + ) + .pipe(gulpReplace("nomodule", "")) + // Fix relative paths for new location + .pipe(gulpReplace("../../../Build", "../../..")) + .pipe(gulpReplace("../../Source", "../../../Source")) + .pipe(gulpReplace("../../ThirdParty", "../../../ThirdParty")) + .pipe(gulpReplace("../../SampleData", "../../../../Apps/SampleData")) + .pipe(gulpReplace("Build/Documentation", "Documentation")) + .pipe(gulp.dest("Build/Apps/Sandcastle")); + + var imageStream = gulp + .src(["Apps/Sandcastle/gallery/**.jpg", "Apps/Sandcastle/images/**"], { + base: "Apps/Sandcastle", + buffer: false, + }) + .pipe(gulp.dest("Build/Apps/Sandcastle")); + + var standaloneStream = gulp + .src(["Apps/Sandcastle/standalone.html"]) + .pipe( + gulpReplace( + ' ', + "" + ) + ) + .pipe(gulpReplace("nomodule", "")) + .pipe(gulpReplace("../../Build", "../..")) + .pipe(gulp.dest("Build/Apps/Sandcastle")); + + return streamToPromise(mergeStream(appStream, imageStream, standaloneStream)); } function buildCesiumViewer() { - var cesiumViewerOutputDirectory = 'Build/Apps/CesiumViewer'; - mkdirp.sync(cesiumViewerOutputDirectory); - - var promise = Promise.join( - rollup.rollup({ - input: 'Apps/CesiumViewer/CesiumViewer.js', - treeshake: { - moduleSideEffects: false - }, - plugins: [ - rollupPluginStripPragma({ - pragmas: ['debug'] - }), - rollupPluginUglify.uglify() - ], - onwarn: rollupWarning - }).then(function(bundle) { - return bundle.write({ - file: 'Build/Apps/CesiumViewer/CesiumViewer.js', - format: 'iife' - }); - }) - ); + var cesiumViewerOutputDirectory = "Build/Apps/CesiumViewer"; + mkdirp.sync(cesiumViewerOutputDirectory); + + var promise = Promise.join( + rollup + .rollup({ + input: "Apps/CesiumViewer/CesiumViewer.js", + treeshake: { + moduleSideEffects: false, + }, + plugins: [ + rollupPluginStripPragma({ + pragmas: ["debug"], + }), + rollupPluginUglify.uglify(), + ], + onwarn: rollupWarning, + }) + .then(function (bundle) { + return bundle.write({ + file: "Build/Apps/CesiumViewer/CesiumViewer.js", + format: "iife", + }); + }) + ); + + promise = promise.then(function () { + var stream = mergeStream( + gulp + .src("Build/Apps/CesiumViewer/CesiumViewer.js") + .pipe(gulpInsert.prepend(copyrightHeader)) + .pipe(gulpReplace("../../Source", ".")) + .pipe(gulp.dest(cesiumViewerOutputDirectory)), + + gulp + .src("Apps/CesiumViewer/CesiumViewer.css") + .pipe(cleanCSS()) + .pipe(gulpReplace("../../Source", ".")) + .pipe(gulp.dest(cesiumViewerOutputDirectory)), + + gulp + .src("Apps/CesiumViewer/index.html") + .pipe(gulpReplace('type="module"', "")) + .pipe(gulp.dest(cesiumViewerOutputDirectory)), + + gulp.src([ + "Apps/CesiumViewer/**", + "!Apps/CesiumViewer/index.html", + "!Apps/CesiumViewer/**/*.js", + "!Apps/CesiumViewer/**/*.css", + ]), + + gulp.src( + [ + "Build/Cesium/Assets/**", + "Build/Cesium/Workers/**", + "Build/Cesium/ThirdParty/**", + "Build/Cesium/Widgets/**", + "!Build/Cesium/Widgets/**/*.css", + ], + { + base: "Build/Cesium", + nodir: true, + } + ), - promise = promise.then(function() { - var stream = mergeStream( - gulp.src('Build/Apps/CesiumViewer/CesiumViewer.js') - .pipe(gulpInsert.prepend(copyrightHeader)) - .pipe(gulpReplace('../../Source', '.')) - .pipe(gulp.dest(cesiumViewerOutputDirectory)), - - gulp.src('Apps/CesiumViewer/CesiumViewer.css') - .pipe(cleanCSS()) - .pipe(gulpReplace('../../Source', '.')) - .pipe(gulp.dest(cesiumViewerOutputDirectory)), - - gulp.src('Apps/CesiumViewer/index.html') - .pipe(gulpReplace('type="module"', '')) - .pipe(gulp.dest(cesiumViewerOutputDirectory)), - - gulp.src(['Apps/CesiumViewer/**', - '!Apps/CesiumViewer/index.html', - '!Apps/CesiumViewer/**/*.js', - '!Apps/CesiumViewer/**/*.css']), - - gulp.src(['Build/Cesium/Assets/**', - 'Build/Cesium/Workers/**', - 'Build/Cesium/ThirdParty/**', - 'Build/Cesium/Widgets/**', - '!Build/Cesium/Widgets/**/*.css'], - { - base : 'Build/Cesium', - nodir : true - }), - - gulp.src(['Build/Cesium/Widgets/InfoBox/InfoBoxDescription.css'], { - base : 'Build/Cesium' - }), - - gulp.src(['web.config']) - ); + gulp.src(["Build/Cesium/Widgets/InfoBox/InfoBoxDescription.css"], { + base: "Build/Cesium", + }), - return streamToPromise(stream.pipe(gulp.dest(cesiumViewerOutputDirectory))); - }); + gulp.src(["web.config"]) + ); + + return streamToPromise(stream.pipe(gulp.dest(cesiumViewerOutputDirectory))); + }); - return promise; + return promise; } function filePathToModuleId(moduleId) { - return moduleId.substring(0, moduleId.lastIndexOf('.')).replace(/\\/g, '/'); + return moduleId.substring(0, moduleId.lastIndexOf(".")).replace(/\\/g, "/"); } diff --git a/index.cjs b/index.cjs index fcae39adb52a..0fcc8a7a5513 100644 --- a/index.cjs +++ b/index.cjs @@ -1,12 +1,12 @@ /*eslint-env node*/ -'use strict'; +"use strict"; -var path = require('path'); +var path = require("path"); // If in 'production' mode, use the combined/minified/optimized version of Cesium -if (process.env.NODE_ENV === 'production') { - module.exports = require(path.join(__dirname, 'Build/Cesium/Cesium')); - return; +if (process.env.NODE_ENV === "production") { + module.exports = require(path.join(__dirname, "Build/Cesium/Cesium")); + return; } -module.exports = require(path.join(__dirname, 'Build/CesiumUnminified/Cesium')); +module.exports = require(path.join(__dirname, "Build/CesiumUnminified/Cesium")); diff --git a/package.json b/package.json index 2b1ec9a26936..da71fe951649 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cesium", - "version": "1.69.0", + "version": "1.70.1", "description": "CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.", "homepage": "http://cesium.com/cesiumjs/", "license": "Apache-2.0", @@ -31,6 +31,7 @@ }, "main": "index.cjs", "module": "./Source/Cesium.js", + "types": "./Source/Cesium.d.ts", "exports": { "require": "./index.cjs", "import": "./Source/Cesium.js" @@ -83,6 +84,8 @@ "rollup-plugin-strip-pragma": "^1.0.0", "rollup-plugin-uglify": "^6.0.3", "stream-to-promise": "^2.2.0", + "tsd-jsdoc": "^2.5.0", + "typescript": "^3.9.2", "yargs": "^15.0.1" }, "husky": { @@ -96,6 +99,7 @@ "startPublic": "node server.cjs --public", "build": "gulp build", "build-watch": "gulp build-watch", + "build-ts": "gulp build-ts", "buildApps": "gulp buildApps", "clean": "gulp clean", "cloc": "gulp cloc", diff --git a/server.cjs b/server.cjs index 59fa98628478..2c48004c1d44 100644 --- a/server.cjs +++ b/server.cjs @@ -1,202 +1,244 @@ /*eslint-env node*/ -'use strict'; -(function() { - var express = require('express'); - var compression = require('compression'); - var fs = require('fs'); - var url = require('url'); - var request = require('request'); - - var gzipHeader = Buffer.from('1F8B08', 'hex'); - - var yargs = require('yargs').options({ - 'port' : { - 'default' : 8080, - 'description' : 'Port to listen on.' - }, - 'public' : { - 'type' : 'boolean', - 'description' : 'Run a public server that listens on all interfaces.' - }, - 'upstream-proxy' : { - 'description' : 'A standard proxy server that will be used to retrieve data. Specify a URL including port, e.g. "http://proxy:8000".' - }, - 'bypass-upstream-proxy-hosts' : { - 'description' : 'A comma separated list of hosts that will bypass the specified upstream_proxy, e.g. "lanhost1,lanhost2"' - }, - 'help' : { - 'alias' : 'h', - 'type' : 'boolean', - 'description' : 'Show this help.' - } +"use strict"; +(function () { + var express = require("express"); + var compression = require("compression"); + var fs = require("fs"); + var url = require("url"); + var request = require("request"); + + var gzipHeader = Buffer.from("1F8B08", "hex"); + + var yargs = require("yargs").options({ + port: { + default: 8080, + description: "Port to listen on.", + }, + public: { + type: "boolean", + description: "Run a public server that listens on all interfaces.", + }, + "upstream-proxy": { + description: + 'A standard proxy server that will be used to retrieve data. Specify a URL including port, e.g. "http://proxy:8000".', + }, + "bypass-upstream-proxy-hosts": { + description: + 'A comma separated list of hosts that will bypass the specified upstream_proxy, e.g. "lanhost1,lanhost2"', + }, + help: { + alias: "h", + type: "boolean", + description: "Show this help.", + }, + }); + var argv = yargs.argv; + + if (argv.help) { + return yargs.showHelp(); + } + + // eventually this mime type configuration will need to change + // https://github.com/visionmedia/send/commit/d2cb54658ce65948b0ed6e5fb5de69d022bef941 + // *NOTE* Any changes you make here must be mirrored in web.config. + var mime = express.static.mime; + mime.define( + { + "application/json": ["czml", "json", "geojson", "topojson"], + "application/wasm": ["wasm"], + "image/crn": ["crn"], + "image/ktx": ["ktx"], + "model/gltf+json": ["gltf"], + "model/gltf-binary": ["bgltf", "glb"], + "application/octet-stream": [ + "b3dm", + "pnts", + "i3dm", + "cmpt", + "geom", + "vctr", + ], + "text/plain": ["glsl"], + }, + true + ); + + var app = express(); + app.use(compression()); + app.use(function (req, res, next) { + res.header("Access-Control-Allow-Origin", "*"); + res.header( + "Access-Control-Allow-Headers", + "Origin, X-Requested-With, Content-Type, Accept" + ); + next(); + }); + + function checkGzipAndNext(req, res, next) { + var reqUrl = url.parse(req.url, true); + var filePath = reqUrl.pathname.substring(1); + + var readStream = fs.createReadStream(filePath, { start: 0, end: 2 }); + readStream.on("error", function (err) { + next(); }); - var argv = yargs.argv; - if (argv.help) { - return yargs.showHelp(); + readStream.on("data", function (chunk) { + if (chunk.equals(gzipHeader)) { + res.header("Content-Encoding", "gzip"); + } + next(); + }); + } + + var knownTilesetFormats = [ + /\.b3dm/, + /\.pnts/, + /\.i3dm/, + /\.cmpt/, + /\.glb/, + /\.geom/, + /\.vctr/, + /tileset.*\.json$/, + ]; + app.get(knownTilesetFormats, checkGzipAndNext); + + app.use(express.static(__dirname)); + + function getRemoteUrlFromParam(req) { + var remoteUrl = req.params[0]; + if (remoteUrl) { + // add http:// to the URL if no protocol is present + if (!/^https?:\/\//.test(remoteUrl)) { + remoteUrl = "http://" + remoteUrl; + } + remoteUrl = url.parse(remoteUrl); + // copy query string + remoteUrl.search = url.parse(req.url).search; } - - // eventually this mime type configuration will need to change - // https://github.com/visionmedia/send/commit/d2cb54658ce65948b0ed6e5fb5de69d022bef941 - // *NOTE* Any changes you make here must be mirrored in web.config. - var mime = express.static.mime; - mime.define({ - 'application/json' : ['czml', 'json', 'geojson', 'topojson'], - 'application/wasm' : ['wasm'], - 'image/crn' : ['crn'], - 'image/ktx' : ['ktx'], - 'model/gltf+json' : ['gltf'], - 'model/gltf-binary' : ['bgltf', 'glb'], - 'application/octet-stream' : ['b3dm', 'pnts', 'i3dm', 'cmpt', 'geom', 'vctr'], - 'text/plain' : ['glsl'] - }, true); - - var app = express(); - app.use(compression()); - app.use(function(req, res, next) { - res.header('Access-Control-Allow-Origin', '*'); - res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); - next(); + return remoteUrl; + } + + var dontProxyHeaderRegex = /^(?:Host|Proxy-Connection|Connection|Keep-Alive|Transfer-Encoding|TE|Trailer|Proxy-Authorization|Proxy-Authenticate|Upgrade)$/i; + + function filterHeaders(req, headers) { + var result = {}; + // filter out headers that are listed in the regex above + Object.keys(headers).forEach(function (name) { + if (!dontProxyHeaderRegex.test(name)) { + result[name] = headers[name]; + } }); - - function checkGzipAndNext(req, res, next) { - var reqUrl = url.parse(req.url, true); - var filePath = reqUrl.pathname.substring(1); - - var readStream = fs.createReadStream(filePath, { start: 0, end: 2 }); - readStream.on('error', function(err) { - next(); - }); - - readStream.on('data', function(chunk) { - if (chunk.equals(gzipHeader)) { - res.header('Content-Encoding', 'gzip'); - } - next(); - }); + return result; + } + + var upstreamProxy = argv["upstream-proxy"]; + var bypassUpstreamProxyHosts = {}; + if (argv["bypass-upstream-proxy-hosts"]) { + argv["bypass-upstream-proxy-hosts"].split(",").forEach(function (host) { + bypassUpstreamProxyHosts[host.toLowerCase()] = true; + }); + } + + app.get("/proxy/*", function (req, res, next) { + // look for request like http://localhost:8080/proxy/http://example.com/file?query=1 + var remoteUrl = getRemoteUrlFromParam(req); + if (!remoteUrl) { + // look for request like http://localhost:8080/proxy/?http%3A%2F%2Fexample.com%2Ffile%3Fquery%3D1 + remoteUrl = Object.keys(req.query)[0]; + if (remoteUrl) { + remoteUrl = url.parse(remoteUrl); + } } - var knownTilesetFormats = [/\.b3dm/, /\.pnts/, /\.i3dm/, /\.cmpt/, /\.glb/, /\.geom/, /\.vctr/, /tileset.*\.json$/]; - app.get(knownTilesetFormats, checkGzipAndNext); - - app.use(express.static(__dirname)); - - function getRemoteUrlFromParam(req) { - var remoteUrl = req.params[0]; - if (remoteUrl) { - // add http:// to the URL if no protocol is present - if (!/^https?:\/\//.test(remoteUrl)) { - remoteUrl = 'http://' + remoteUrl; - } - remoteUrl = url.parse(remoteUrl); - // copy query string - remoteUrl.search = url.parse(req.url).search; - } - return remoteUrl; + if (!remoteUrl) { + return res.status(400).send("No url specified."); } - var dontProxyHeaderRegex = /^(?:Host|Proxy-Connection|Connection|Keep-Alive|Transfer-Encoding|TE|Trailer|Proxy-Authorization|Proxy-Authenticate|Upgrade)$/i; - - function filterHeaders(req, headers) { - var result = {}; - // filter out headers that are listed in the regex above - Object.keys(headers).forEach(function(name) { - if (!dontProxyHeaderRegex.test(name)) { - result[name] = headers[name]; - } - }); - return result; + if (!remoteUrl.protocol) { + remoteUrl.protocol = "http:"; } - var upstreamProxy = argv['upstream-proxy']; - var bypassUpstreamProxyHosts = {}; - if (argv['bypass-upstream-proxy-hosts']) { - argv['bypass-upstream-proxy-hosts'].split(',').forEach(function(host) { - bypassUpstreamProxyHosts[host.toLowerCase()] = true; - }); + var proxy; + if (upstreamProxy && !(remoteUrl.host in bypassUpstreamProxyHosts)) { + proxy = upstreamProxy; } - app.get('/proxy/*', function(req, res, next) { - // look for request like http://localhost:8080/proxy/http://example.com/file?query=1 - var remoteUrl = getRemoteUrlFromParam(req); - if (!remoteUrl) { - // look for request like http://localhost:8080/proxy/?http%3A%2F%2Fexample.com%2Ffile%3Fquery%3D1 - remoteUrl = Object.keys(req.query)[0]; - if (remoteUrl) { - remoteUrl = url.parse(remoteUrl); - } - } - - if (!remoteUrl) { - return res.status(400).send('No url specified.'); + // encoding : null means "body" passed to the callback will be raw bytes + + request.get( + { + url: url.format(remoteUrl), + headers: filterHeaders(req, req.headers), + encoding: null, + proxy: proxy, + }, + function (error, response, body) { + var code = 500; + + if (response) { + code = response.statusCode; + res.header(filterHeaders(req, response.headers)); } - if (!remoteUrl.protocol) { - remoteUrl.protocol = 'http:'; - } - - var proxy; - if (upstreamProxy && !(remoteUrl.host in bypassUpstreamProxyHosts)) { - proxy = upstreamProxy; - } - - // encoding : null means "body" passed to the callback will be raw bytes - - request.get({ - url : url.format(remoteUrl), - headers : filterHeaders(req, req.headers), - encoding : null, - proxy : proxy - }, function(error, response, body) { - var code = 500; - - if (response) { - code = response.statusCode; - res.header(filterHeaders(req, response.headers)); - } - - res.status(code).send(body); - }); - }); - - var server = app.listen(argv.port, argv.public ? undefined : 'localhost', function() { - if (argv.public) { - console.log('Cesium development server running publicly. Connect to http://localhost:%d/', server.address().port); - } else { - console.log('Cesium development server running locally. Connect to http://localhost:%d/', server.address().port); - } - }); - - server.on('error', function (e) { - if (e.code === 'EADDRINUSE') { - console.log('Error: Port %d is already in use, select a different port.', argv.port); - console.log('Example: node server.cjs --port %d', argv.port + 1); - } else if (e.code === 'EACCES') { - console.log('Error: This process does not have permission to listen on port %d.', argv.port); - if (argv.port < 1024) { - console.log('Try a port number higher than 1024.'); - } - } - console.log(e); - process.exit(1); - }); - - server.on('close', function() { - console.log('Cesium development server stopped.'); - }); - - var isFirstSig = true; - process.on('SIGINT', function() { - if (isFirstSig) { - console.log('Cesium development server shutting down.'); - server.close(function() { - process.exit(0); - }); - isFirstSig = false; - } else { - console.log('Cesium development server force kill.'); - process.exit(1); - } - }); - + res.status(code).send(body); + } + ); + }); + + var server = app.listen( + argv.port, + argv.public ? undefined : "localhost", + function () { + if (argv.public) { + console.log( + "Cesium development server running publicly. Connect to http://localhost:%d/", + server.address().port + ); + } else { + console.log( + "Cesium development server running locally. Connect to http://localhost:%d/", + server.address().port + ); + } + } + ); + + server.on("error", function (e) { + if (e.code === "EADDRINUSE") { + console.log( + "Error: Port %d is already in use, select a different port.", + argv.port + ); + console.log("Example: node server.cjs --port %d", argv.port + 1); + } else if (e.code === "EACCES") { + console.log( + "Error: This process does not have permission to listen on port %d.", + argv.port + ); + if (argv.port < 1024) { + console.log("Try a port number higher than 1024."); + } + } + console.log(e); + process.exit(1); + }); + + server.on("close", function () { + console.log("Cesium development server stopped."); + }); + + var isFirstSig = true; + process.on("SIGINT", function () { + if (isFirstSig) { + console.log("Cesium development server shutting down."); + server.close(function () { + process.exit(0); + }); + isFirstSig = false; + } else { + console.log("Cesium development server force kill."); + process.exit(1); + } + }); })();