Skip to content

Commit 89eee79

Browse files
authored
Merge pull request #12841 from CesiumGS/polyline-request-render-draft-0001
Drafts for polyline requestRender handling
2 parents ecf0050 + 278df2c commit 89eee79

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Materials loaded from type now respect submaterials present in the referenced material type. [#10566](https://github.com/CesiumGS/cesium/issues/10566)
1010
- Reverts `createImageBitmap` options update to continue support for older browsers [#12846](https://github.com/CesiumGS/cesium/issues/12846)
1111
- Fix flickering artifact in Gaussian splat models caused by incorrect sorting results. [#12662](https://github.com/CesiumGS/cesium/issues/12662)
12+
- Fix rendering for geometry entities when `requestRenderMode` is enabled. [#12841](https://github.com/CesiumGS/cesium/pull/12841)
1213
- Improved performance and reduced memory usage of `Event` class. [#12896](https://github.com/CesiumGS/cesium/pull/12896)
1314
- Fixes vertical misalignment of glyphs in labels with small fonts [#8474](https://github.com/CesiumGS/cesium/issues/8474)
1415
- Prevent runtime errors for certain forms of invalid PNTS files [#12872](https://github.com/CesiumGS/cesium/issues/12872)

packages/engine/Source/Scene/Primitive.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,10 +2489,16 @@ Primitive.prototype.destroy = function () {
24892489
function setReady(primitive, frameState, state, error) {
24902490
primitive._error = error;
24912491
primitive._state = state;
2492+
24922493
frameState.afterRender.push(function () {
24932494
primitive._ready =
24942495
primitive._state === PrimitiveState.COMPLETE ||
24952496
primitive._state === PrimitiveState.FAILED;
2497+
2498+
// Returning 'true' here will ensure that another rendering pass is
2499+
// triggered after the primitive actually became ready, to make sure
2500+
// that it is in fact rendered even in "request render mode"
2501+
return true;
24962502
});
24972503
}
24982504
export default Primitive;
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,136 @@
11
/**
2+
* The states that describe the lifecycle of a <code>Primitive</code>, as
3+
* represented by the <code>primitive._state</code>.
4+
*
5+
* The state transitions are triggered by calls to the <code>update</code>
6+
* function, but the actual state changes may happen asynchronously if the
7+
* <code>asynchronous</code> flag of the primitive was set to
8+
* <code>true</code>.
9+
*
210
* @private
311
*/
412
const PrimitiveState = {
13+
/**
14+
* The initial state of a primitive.
15+
*
16+
* Note that this does NOT mean that the primitive is "ready", as indicated
17+
* by the <code>_ready</code> property. It means the opposite: Nothing was
18+
* done with the primitive at all.
19+
*
20+
* For primitives that are created with the <code>asynchronous:true</code>
21+
* setting and that are in this state, the <code>update</code> call starts
22+
* the creation of the geometry using web workers, and the primitive goes
23+
* into the <code>CREATING</code> state.
24+
*
25+
* For synchronously created primitives, this state never matters. They will
26+
* go into the COMBINED (or FAILED) state directly due to a call to the
27+
* <code>update</code> function, if they are not yet FAILED, COMBINED,
28+
* or COMPLETE.
29+
*/
530
READY: 0,
31+
32+
/**
33+
* The process of creating the primitive geometry is ongoing.
34+
*
35+
* A primitive can only ever be in this state when it was created
36+
* with the <code>asynchronous:true</code> setting.
37+
*
38+
* It means that web workers are currently creating the geometry
39+
* of the primitive.
40+
*
41+
* When the geometry creation succeeds, then the primitive will go
42+
* into the CREATED state. Otherwise, it will go into the FAILED
43+
* state. Both will happen asynchronously.
44+
*
45+
* The <code>update</code> function has to be called regularly
46+
* until either of these states is reached.
47+
*/
648
CREATING: 1,
49+
50+
/**
51+
* The geometry for the primitive has been created.
52+
*
53+
* A primitive can only ever be in this state when it was created
54+
* with the <code>asynchronous:true</code> setting.
55+
*
56+
* It means that web workers have (asynchronously) finished the
57+
* creation of the geometry, but further (asynchronous) processing
58+
* is necessary: If a primitive is determined to be in this state
59+
* during a call to <code>update</code>, an asynchronous process
60+
* is triggered to "combine" the geometry, meaning that the primitive
61+
* will go into the COMBINING state.
62+
*/
763
CREATED: 2,
64+
65+
/**
66+
* The asynchronous creation of the geometry has been finished, but the
67+
* asynchronous process of combining the geometry has not finished yet.
68+
*
69+
* A primitive can only ever be in this state when it was created
70+
* with the <code>asynchronous:true</code> setting.
71+
*
72+
* It means that whatever is done with
73+
* <code>PrimitivePipeline.packCombineGeometryParameters</code> has
74+
* not finished yet. When combining the geometry succeeds, the
75+
* primitive will go into the COMBINED state. Otherwise, it will
76+
* go into the FAILED state.
77+
*/
878
COMBINING: 3,
79+
80+
/**
81+
* The geometry data is in a form that can be uploaded to the GPU.
82+
*
83+
* For <i>synchronous</i> primitives, this means that the geometry
84+
* has been created (synchronously) due to the first call to the
85+
* <code>update</code> function.
86+
*
87+
* For <i>asynchronous</i> primitives, this means that the asynchronous
88+
* creation of the geometry and the asynchronous combination of the
89+
* geometry have both finished.
90+
*
91+
* The <code>update</code> function has to be called regularly until
92+
* this state is reached. When it is reached, the <code>update</code>
93+
* call will cause the transition into the COMPLETE state.
94+
*/
995
COMBINED: 4,
96+
97+
/**
98+
* The geometry has been created and uploaded to the GPU.
99+
*
100+
* When this state is reached, it eventually causes the <code>_ready</code>
101+
* flag of the primitive to become <code>true</code>.
102+
*
103+
* Note: Setting the <code>ready</code> flag does NOT happen in the
104+
* <code>update</code> call: It only happens after rendering the next
105+
* frame!
106+
*
107+
* Note: This state does not mean that nothing has to be done
108+
* anymore (so the work is not "complete"). When the primitive is in
109+
* this state, the <code>update</code> function still has to be
110+
* called regularly.
111+
*/
10112
COMPLETE: 5,
113+
114+
/**
115+
* The creation of the primitive failed.
116+
*
117+
* When this state is reached, it eventually causes the <code>_ready</code>
118+
* flag of the primitive to become <code>true</code>.
119+
*
120+
* Note: Setting the <code>ready</code> flag does NOT happen in the
121+
* <code>update</code> call: It only happens after rendering the next
122+
* frame!
123+
*
124+
* This state can be reached when the (synchronous or asynchronous)
125+
* creation of the geometry, or the (asynchronous) combination of
126+
* the geometry caused any form of error.
127+
*
128+
* It may or may not imply the presence of the <code>_error</code> property.
129+
* When the <code>_error</code> property is present on a FAILED primitive,
130+
* this error will be thrown during the <code>update</code> call. When it
131+
* is not present for a FAILED primitive, then the <code>update</code> call
132+
* will do nothing.
133+
*/
11134
FAILED: 6,
12135
};
13136
export default Object.freeze(PrimitiveState);

0 commit comments

Comments
 (0)