You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1.0">
  6. <title>dc-example</title>
  7. <script src='/libs/dc-sdk/dc.min.js'></script>
  8. <script src="../dat.gui.min.js"></script>
  9. <link href='/libs/dc-sdk/dc.min.css' type='text/css' rel='stylesheet'>
  10. <link href='../index.css' type='text/css' rel='stylesheet'>
  11. </head>
  12. <body>
  13. <div id="viewer-container" class="viewer-container"></div>
  14. <script>
  15. let viewer = undefined
  16. function initViewer() {
  17. viewer = new DC.Viewer('viewer-container')
  18. addGuiController() // add controller
  19. }
  20. function addGuiController(){
  21. let controls = {
  22. show :true,
  23. showGroundAtmosphere :true,
  24. enableLighting:false,
  25. depthTestAgainstTerrain :false,
  26. tileCacheSize:100,
  27. preloadSiblings:false,
  28. showSkirts:true,
  29. baseColor:'#00c',
  30. }
  31. let gui = new dat.GUI();
  32. gui.add(controls,'show',).onChange(value=>{
  33. viewer.setOptions({
  34. globe:{
  35. show: value
  36. }
  37. })
  38. })
  39. gui.add(controls,'showGroundAtmosphere',).onChange(value=>{
  40. viewer.setOptions({
  41. globe:{
  42. showGroundAtmosphere: value
  43. }
  44. })
  45. })
  46. gui.add(controls,'enableLighting',).onChange(value=>{
  47. viewer.setOptions({
  48. globe:{
  49. enableLighting: value
  50. }
  51. })
  52. })
  53. gui.add(controls,'depthTestAgainstTerrain',).onChange(value=>{
  54. viewer.setOptions({
  55. globe:{
  56. depthTestAgainstTerrain: value
  57. }
  58. })
  59. })
  60. gui.add(controls,'tileCacheSize',100).onChange(value=>{
  61. viewer.setOptions({
  62. globe:{
  63. tileCacheSize: value
  64. }
  65. })
  66. })
  67. gui.add(controls,'preloadSiblings').onChange(value=>{
  68. viewer.setOptions({
  69. globe:{
  70. preloadSiblings: value
  71. }
  72. })
  73. })
  74. gui.add(controls,'showSkirts').onChange(value=>{
  75. viewer.setOptions({
  76. globe:{
  77. showSkirts: value
  78. }
  79. })
  80. })
  81. gui.addColor(controls,'baseColor').onChange(value=>{
  82. viewer.setOptions({
  83. globe:{
  84. baseColor: DC.Color.fromCssColorString(value)
  85. }
  86. })
  87. })
  88. }
  89. DC.ready({
  90. baseUrl:'../libs/dc-sdk/resources/'
  91. }).then(initViewer)
  92. </script>