@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
35 lines • 1.09 kB
JavaScript
import { FrameGraphTask } from "../../frameGraphTask.js";
/**
* Task used to execute a custom function.
*/
export class FrameGraphExecuteTask extends FrameGraphTask {
isReady() {
return !this.customIsReady || this.customIsReady();
}
/**
* Creates a new execute task.
* @param name The name of the task.
* @param frameGraph The frame graph the task belongs to.
*/
constructor(name, frameGraph) {
super(name, frameGraph);
}
getClassName() {
return "FrameGraphExecuteTask";
}
record() {
if (!this.func) {
throw new Error("FrameGraphExecuteTask: Execute task must have a function.");
}
const pass = this._frameGraph.addPass(this.name);
pass.setExecuteFunc((context) => {
this.func(context);
});
const passDisabled = this._frameGraph.addPass(this.name + "_disabled", true);
passDisabled.setExecuteFunc((context) => {
this.funcDisabled?.(context);
});
return pass;
}
}
//# sourceMappingURL=executeTask.js.map