Skip to content
Snippets Groups Projects
Commit 96aff392 authored by David Sehnal's avatar David Sehnal
Browse files

Canvas3d: tick manualDraw option

parent 6ad80bf6
No related branches found
No related tags found
No related merge requests found
......@@ -54,7 +54,7 @@ export class Mp4Encoder {
for (let i = 0; i < N; i++) {
const t = i * dt;
await loop.tick(t, true);
await loop.tick(t, { isSynchronous: true, manualDraw: true });
const image = pass.getImageData(w, h);
if (i === 0) canvasCtx.putImageData(image, 0, 0);
......
......@@ -100,7 +100,7 @@ interface Canvas3D {
* Funcion for external "animation" control
* Calls commit.
*/
tick(t: now.Timestamp, isSynchronous?: boolean): void
tick(t: now.Timestamp, options?: { isSynchronous?: boolean, manualDraw?: boolean }): void
update(repr?: Representation.Any, keepBoundingSphere?: boolean): void
clear(): void
syncVisibility(): void
......@@ -330,11 +330,15 @@ namespace Canvas3D {
let animationFrameHandle = 0;
function tick(t: now.Timestamp, isSynchronous?: boolean) {
function tick(t: now.Timestamp, options?: { isSynchronous?: boolean, manualDraw?: boolean }) {
currentTime = t;
commit(isSynchronous);
commit(options?.isSynchronous);
camera.transition.tick(currentTime);
if (options?.manualDraw) {
return;
}
draw(false);
if (!camera.transition.inTransition && !webgl.isContextLost) {
interactionHelper.tick(currentTime);
......
......@@ -11,13 +11,13 @@ export class PluginAnimationLoop {
private currentFrame: any = void 0;
private _isAnimating = false;
tick(t: number, isSynchronous?: boolean) {
this.plugin.canvas3d?.tick(t as now.Timestamp, isSynchronous);
return this.plugin.managers.animation.tick(t, isSynchronous);
tick(t: number, options?: { isSynchronous?: boolean, manualDraw?: boolean }) {
this.plugin.canvas3d?.tick(t as now.Timestamp, options);
return this.plugin.managers.animation.tick(t, options?.isSynchronous);
}
private frame = () => {
this.tick(now(), false);
this.tick(now());
if (this._isAnimating) {
this.currentFrame = requestAnimationFrame(this.frame);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment