MCPcopy
hub / github.com/CesiumGS/cesium / Scene

Function Scene

packages/engine/Source/Scene/Scene.js:130–777  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

128 * });
129 */
130function 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;

Callers

nothing calls this directly

Calls 10

cloneFunction · 0.85
createGuidFunction · 0.85
requestRenderAfterFrameFunction · 0.85
updateFrameNumberFunction · 0.85
addEventListenerMethod · 0.80
nowMethod · 0.80
definedFunction · 0.50
cloneMethod · 0.45
equalsMethod · 0.45
fromDegreesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…