feat: add snapshot feature for devkit, this is for android

This commit is contained in:
pengfei.zhou
2021-07-09 17:16:30 +08:00
committed by osborn
parent 35b9d67de6
commit dbe94165b9
19 changed files with 500 additions and 7 deletions

View File

@@ -168,8 +168,29 @@ export abstract class Panel {
}
}, undefined)
}
private snapshotEnabled = false
private renderSnapshots: Model[] = []
@NativeCall
private __renderSnapshotDepth__() {
return this.renderSnapshots.length
}
@NativeCall
private __restoreRenderSnapshot__(idx: number) {
return [...this.renderSnapshots].slice(0, idx)
}
@NativeCall
private __enableSnapshot__() {
this.snapshotEnabled = true
}
private nativeRender(model: Model) {
if (this.snapshotEnabled) {
this.renderSnapshots.push(JSON.parse(JSON.stringify(model)))
}
return this.context.callNative("shader", "render", model)
}