1 |
- {"ast":null,"code":"import { NodeMaterialBlock } from \"../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\n/**\n * Block used to get the refracted vector from a direction and a normal\n */\nexport class RefractBlock extends NodeMaterialBlock {\n /**\n * Creates a new RefractBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"incident\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"normal\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"ior\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.Vector3);\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Vector4 | NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Color4);\n this._inputs[1].addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Vector4 | NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Color4);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"RefractBlock\";\n }\n /**\n * Gets the incident component\n */\n get incident() {\n return this._inputs[0];\n }\n /**\n * Gets the normal component\n */\n get normal() {\n return this._inputs[1];\n }\n /**\n * Gets the index of refraction component\n */\n get ior() {\n return this._inputs[2];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const output = this._outputs[0];\n state.compilationString += state._declareOutput(output) + ` = refract(${this.incident.associatedVariableName}.xyz, ${this.normal.associatedVariableName}.xyz, ${this.ior.associatedVariableName});\\n`;\n return this;\n }\n}\nRegisterClass(\"BABYLON.RefractBlock\", RefractBlock);","map":{"version":3,"names":["NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","RefractBlock","constructor","name","Neutral","registerInput","AutoDetect","Float","registerOutput","Vector3","_inputs","addExcludedConnectionPointFromAllowedTypes","Vector4","Color3","Color4","getClassName","incident","normal","ior","output","_outputs","_buildBlock","state","compilationString","_declareOutput","associatedVariableName"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/refractBlock.js"],"sourcesContent":["import { NodeMaterialBlock } from \"../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\n/**\n * Block used to get the refracted vector from a direction and a normal\n */\nexport class RefractBlock extends NodeMaterialBlock {\n /**\n * Creates a new RefractBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"incident\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"normal\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"ior\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.Vector3);\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Vector3 |\n NodeMaterialBlockConnectionPointTypes.Vector4 |\n NodeMaterialBlockConnectionPointTypes.Color3 |\n NodeMaterialBlockConnectionPointTypes.Color4);\n this._inputs[1].addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Vector3 |\n NodeMaterialBlockConnectionPointTypes.Vector4 |\n NodeMaterialBlockConnectionPointTypes.Color3 |\n NodeMaterialBlockConnectionPointTypes.Color4);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"RefractBlock\";\n }\n /**\n * Gets the incident component\n */\n get incident() {\n return this._inputs[0];\n }\n /**\n * Gets the normal component\n */\n get normal() {\n return this._inputs[1];\n }\n /**\n * Gets the index of refraction component\n */\n get ior() {\n return this._inputs[2];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const output = this._outputs[0];\n state.compilationString +=\n state._declareOutput(output) +\n ` = refract(${this.incident.associatedVariableName}.xyz, ${this.normal.associatedVariableName}.xyz, ${this.ior.associatedVariableName});\\n`;\n return this;\n }\n}\nRegisterClass(\"BABYLON.RefractBlock\", RefractBlock);\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,qCAAqC,QAAQ,mDAAmD;AACzG,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,aAAa,QAAQ,4BAA4B;AAC1D;AACA;AACA;AACA,OAAO,MAAMC,YAAY,SAASJ,iBAAiB,CAAC;EAChD;AACJ;AACA;AACA;EACIK,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,EAAEJ,wBAAwB,CAACK,OAAO,CAAC;IAC7C,IAAI,CAACC,aAAa,CAAC,UAAU,EAAEP,qCAAqC,CAACQ,UAAU,CAAC;IAChF,IAAI,CAACD,aAAa,CAAC,QAAQ,EAAEP,qCAAqC,CAACQ,UAAU,CAAC;IAC9E,IAAI,CAACD,aAAa,CAAC,KAAK,EAAEP,qCAAqC,CAACS,KAAK,CAAC;IACtE,IAAI,CAACC,cAAc,CAAC,QAAQ,EAAEV,qCAAqC,CAACW,OAAO,CAAC;IAC5E,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC,CAACC,0CAA0C,CAACb,qCAAqC,CAACW,OAAO,GACpGX,qCAAqC,CAACc,OAAO,GAC7Cd,qCAA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