|
@@ -96,6 +96,11 @@ interface Canvas3D {
|
|
* This function must be called if animate() is not set up so that add/remove actions take place.
|
|
* This function must be called if animate() is not set up so that add/remove actions take place.
|
|
*/
|
|
*/
|
|
commit(isSynchronous?: boolean): void
|
|
commit(isSynchronous?: boolean): void
|
|
|
|
+ /**
|
|
|
|
+ * Funcion for external "animation" control
|
|
|
|
+ * Calls commit.
|
|
|
|
+ */
|
|
|
|
+ tick(t: now.Timestamp, isSynchronous?: boolean): void
|
|
update(repr?: Representation.Any, keepBoundingSphere?: boolean): void
|
|
update(repr?: Representation.Any, keepBoundingSphere?: boolean): void
|
|
clear(): void
|
|
clear(): void
|
|
syncVisibility(): void
|
|
syncVisibility(): void
|
|
@@ -108,6 +113,7 @@ interface Canvas3D {
|
|
mark(loci: Representation.Loci, action: MarkerAction): void
|
|
mark(loci: Representation.Loci, action: MarkerAction): void
|
|
getLoci(pickingId: PickingId | undefined): Representation.Loci
|
|
getLoci(pickingId: PickingId | undefined): Representation.Loci
|
|
|
|
|
|
|
|
+ notifyDidDraw: boolean,
|
|
readonly didDraw: BehaviorSubject<now.Timestamp>
|
|
readonly didDraw: BehaviorSubject<now.Timestamp>
|
|
readonly reprCount: BehaviorSubject<number>
|
|
readonly reprCount: BehaviorSubject<number>
|
|
|
|
|
|
@@ -231,6 +237,8 @@ namespace Canvas3D {
|
|
let nextCameraResetDuration: number | undefined = void 0;
|
|
let nextCameraResetDuration: number | undefined = void 0;
|
|
let nextCameraResetSnapshot: Partial<Camera.Snapshot> | undefined = void 0;
|
|
let nextCameraResetSnapshot: Partial<Camera.Snapshot> | undefined = void 0;
|
|
|
|
|
|
|
|
+ let notifyDidDraw = true;
|
|
|
|
+
|
|
function getLoci(pickingId: PickingId | undefined) {
|
|
function getLoci(pickingId: PickingId | undefined) {
|
|
let loci: Loci = EmptyLoci;
|
|
let loci: Loci = EmptyLoci;
|
|
let repr: Representation.Any = Representation.Empty;
|
|
let repr: Representation.Any = Representation.Empty;
|
|
@@ -305,7 +313,7 @@ namespace Canvas3D {
|
|
let currentTime = 0;
|
|
let currentTime = 0;
|
|
|
|
|
|
function draw(force?: boolean) {
|
|
function draw(force?: boolean) {
|
|
- if (render(!!force || forceNextDraw)) {
|
|
|
|
|
|
+ if (render(!!force || forceNextDraw) && notifyDidDraw) {
|
|
didDraw.next(now() - startTime as now.Timestamp);
|
|
didDraw.next(now() - startTime as now.Timestamp);
|
|
}
|
|
}
|
|
forceNextDraw = false;
|
|
forceNextDraw = false;
|
|
@@ -320,15 +328,19 @@ namespace Canvas3D {
|
|
|
|
|
|
let animationFrameHandle = 0;
|
|
let animationFrameHandle = 0;
|
|
|
|
|
|
- function _animate() {
|
|
|
|
- currentTime = now();
|
|
|
|
- commit();
|
|
|
|
|
|
+ function tick(t: now.Timestamp, isSynchronous?: boolean) {
|
|
|
|
+ currentTime = t;
|
|
|
|
+ commit(isSynchronous);
|
|
camera.transition.tick(currentTime);
|
|
camera.transition.tick(currentTime);
|
|
|
|
|
|
draw(false);
|
|
draw(false);
|
|
if (!camera.transition.inTransition && !webgl.isContextLost) {
|
|
if (!camera.transition.inTransition && !webgl.isContextLost) {
|
|
interactionHelper.tick(currentTime);
|
|
interactionHelper.tick(currentTime);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function _animate() {
|
|
|
|
+ tick(now());
|
|
animationFrameHandle = requestAnimationFrame(_animate);
|
|
animationFrameHandle = requestAnimationFrame(_animate);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -553,6 +565,7 @@ namespace Canvas3D {
|
|
},
|
|
},
|
|
|
|
|
|
requestDraw,
|
|
requestDraw,
|
|
|
|
+ tick,
|
|
animate,
|
|
animate,
|
|
pause,
|
|
pause,
|
|
setCurrentTime: t => currentTime = t,
|
|
setCurrentTime: t => currentTime = t,
|
|
@@ -573,6 +586,8 @@ namespace Canvas3D {
|
|
},
|
|
},
|
|
camera,
|
|
camera,
|
|
boundingSphere: scene.boundingSphere,
|
|
boundingSphere: scene.boundingSphere,
|
|
|
|
+ get notifyDidDraw() { return notifyDidDraw; },
|
|
|
|
+ set notifyDidDraw(v: boolean) { notifyDidDraw = v; },
|
|
didDraw,
|
|
didDraw,
|
|
reprCount,
|
|
reprCount,
|
|
setProps: (properties, doNotRequestDraw = false) => {
|
|
setProps: (properties, doNotRequestDraw = false) => {
|