| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { NodeMaterialBlock } from '../nodeMaterialBlock';
- import { NodeMaterialBlockConnectionPointTypes } from '../Enums/nodeMaterialBlockConnectionPointTypes';
- import { NodeMaterialBuildState } from '../nodeMaterialBuildState';
- import { NodeMaterialConnectionPoint } from '../nodeMaterialBlockConnectionPoint';
- import { NodeMaterialBlockTargets } from '../Enums/nodeMaterialBlockTargets';
- import { _TypeStore } from '../../../Misc/typeStore';
- /**
- * Block used to get the value of the first parameter raised to the power of the second
- */
- export class PowBlock extends NodeMaterialBlock {
- /**
- * Creates a new PowBlock
- * @param name defines the block name
- */
- public constructor(name: string) {
- super(name, NodeMaterialBlockTargets.Neutral);
- this.registerInput("value", NodeMaterialBlockConnectionPointTypes.Float);
- this.registerInput("power", NodeMaterialBlockConnectionPointTypes.Float);
- this.registerOutput("output", NodeMaterialBlockConnectionPointTypes.Float);
- }
- /**
- * Gets the current class name
- * @returns the class name
- */
- public getClassName() {
- return "PowBlock";
- }
- /**
- * Gets the value operand input component
- */
- public get value(): NodeMaterialConnectionPoint {
- return this._inputs[0];
- }
- /**
- * Gets the power operand input component
- */
- public get power(): NodeMaterialConnectionPoint {
- return this._inputs[1];
- }
- /**
- * Gets the output component
- */
- public get output(): NodeMaterialConnectionPoint {
- return this._outputs[0];
- }
- protected _buildBlock(state: NodeMaterialBuildState) {
- super._buildBlock(state);
- let output = this._outputs[0];
- state.compilationString += this._declareOutput(output, state) + ` = pow(${this.value.associatedVariableName}, ${this.power.associatedVariableName});\r\n`;
- return this;
- }
- }
- _TypeStore.RegisteredTypes["BABYLON.PowBlock"] = PowBlock;
|