@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
57 lines (53 loc) • 2.1 kB
JavaScript
import { d as RichTypeNumber } from './declarationMapper-CqO08-WM.esm.js';
import { c as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-CEwUaqxQ.esm.js';
import { u as RegisterClass } from './index-MZPybX0H.esm.js';
import './objectModelMapping-De5EKNEZ.esm.js';
import './spotLight.pure-CRdZC6Ci.esm.js';
/** This file must only contain pure code and pure imports */
/**
* A block that counts the number of times it has been called.
* Afterwards it activates its out signal.
*/
class FlowGraphCallCounterBlock extends FlowGraphExecutionBlockWithOutSignal {
constructor(config) {
super(config);
this.count = this.registerDataOutput("count", RichTypeNumber);
this.reset = this._registerSignalInput("reset");
}
_execute(context, callingSignal) {
if (callingSignal === this.reset) {
context._setExecutionVariable(this, "count", 0);
this.count.setValue(0, context);
return;
}
const countValue = context._getExecutionVariable(this, "count", 0) + 1;
context._setExecutionVariable(this, "count", countValue);
this.count.setValue(countValue, context);
this.out._activateSignal(context);
}
/**
* @returns class name of the block.
*/
getClassName() {
return "FlowGraphCallCounterBlock" /* FlowGraphBlockNames.CallCounter */;
}
}
let _Registered = false;
/**
* Register side effects for flowGraphCounterBlock.
* Safe to call multiple times; only the first call has an effect.
*/
function RegisterFlowGraphCounterBlock() {
if (_Registered) {
return;
}
_Registered = true;
RegisterClass("FlowGraphCallCounterBlock" /* FlowGraphBlockNames.CallCounter */, FlowGraphCallCounterBlock);
}
/**
* Re-exports pure implementation and applies runtime side effects.
* Import flowGraphCounterBlock.pure for tree-shakeable, side-effect-free usage.
*/
RegisterFlowGraphCounterBlock();
export { FlowGraphCallCounterBlock, RegisterFlowGraphCounterBlock };
//# sourceMappingURL=flowGraphCounterBlock-XaBTZUSR.esm.js.map