* The container for all 3D graphical objects and state in a Cesium virtual scene. Generally, * a scene is not created directly; instead, it is implicitly created by CesiumWidget. * * @alias Scene * @constructor * * @param {object} options Object with the following properties: * @para
(options)
| 128 | * }); |
| 129 | */ |
| 130 | function Scene(options) { |
| 131 | options = options ?? Frozen.EMPTY_OBJECT; |
| 132 | const canvas = options.canvas; |
| 133 | let creditContainer = options.creditContainer; |
| 134 | let creditViewport = options.creditViewport; |
| 135 | |
| 136 | //>>includeStart('debug', pragmas.debug); |
| 137 | if (!defined(canvas)) { |
| 138 | throw new DeveloperError("options and options.canvas are required."); |
| 139 | } |
| 140 | //>>includeEnd('debug'); |
| 141 | |
| 142 | const countReferences = options.contextOptions instanceof SharedContext; |
| 143 | if (countReferences) { |
| 144 | this._context = options.contextOptions.createSceneContext(canvas); |
| 145 | } else { |
| 146 | const contextOptions = clone(options.contextOptions); |
| 147 | this._context = new Context(canvas, contextOptions); |
| 148 | } |
| 149 | const context = this._context; |
| 150 | |
| 151 | const hasCreditContainer = defined(creditContainer); |
| 152 | if (!hasCreditContainer) { |
| 153 | creditContainer = document.createElement("div"); |
| 154 | creditContainer.style.position = "absolute"; |
| 155 | creditContainer.style.bottom = "0"; |
| 156 | creditContainer.style["text-shadow"] = "0 0 2px #000000"; |
| 157 | creditContainer.style.color = "#ffffff"; |
| 158 | creditContainer.style["font-size"] = "10px"; |
| 159 | creditContainer.style["padding-right"] = "5px"; |
| 160 | canvas.parentNode.appendChild(creditContainer); |
| 161 | } |
| 162 | if (!defined(creditViewport)) { |
| 163 | creditViewport = canvas.parentNode; |
| 164 | } |
| 165 | |
| 166 | this._id = createGuid(); |
| 167 | this._jobScheduler = new JobScheduler(); |
| 168 | this._frameState = new FrameState( |
| 169 | context, |
| 170 | new CreditDisplay(creditContainer, "•", creditViewport), |
| 171 | this._jobScheduler, |
| 172 | ); |
| 173 | this._frameState.scene3DOnly = options.scene3DOnly ?? false; |
| 174 | this._removeCreditContainer = !hasCreditContainer; |
| 175 | this._creditContainer = creditContainer; |
| 176 | |
| 177 | this._canvas = canvas; |
| 178 | this._computeEngine = new ComputeEngine(context); |
| 179 | |
| 180 | this._ellipsoid = options.ellipsoid ?? Ellipsoid.default; |
| 181 | this._globe = undefined; |
| 182 | this._globeTranslucencyState = new GlobeTranslucencyState(); |
| 183 | this._primitives = new PrimitiveCollection({ countReferences }); |
| 184 | this._groundPrimitives = new PrimitiveCollection({ countReferences }); |
| 185 | |
| 186 | this._globeHeight = undefined; |
| 187 | this._globeHeightDirty = true; |
nothing calls this directly
no test coverage detected
searching dependent graphs…