cd1c93a18292e7c8074a47b465d27456a46595804c1f60d9bc9ffefb894961b3.json 9.9 KB

1
  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\";\nimport { InputBlock } from \"./Input/inputBlock.js\";\nimport { Vector4 } from \"../../../Maths/math.vector.js\";\n/**\n * Block used to build a matrix from 4 Vector4\n */\nexport class MatrixBuilderBlock extends NodeMaterialBlock {\n /**\n * Creates a new MatrixBuilder\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"row0\", NodeMaterialBlockConnectionPointTypes.Vector4);\n this.registerInput(\"row1\", NodeMaterialBlockConnectionPointTypes.Vector4);\n this.registerInput(\"row2\", NodeMaterialBlockConnectionPointTypes.Vector4);\n this.registerInput(\"row3\", NodeMaterialBlockConnectionPointTypes.Vector4);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.Matrix);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"MatrixBuilder\";\n }\n /**\n * Gets the row0 vector\n */\n get row0() {\n return this._inputs[0];\n }\n /**\n * Gets the row1 vector\n */\n get row1() {\n return this._inputs[1];\n }\n /**\n * Gets the row2 vector\n */\n get row2() {\n return this._inputs[2];\n }\n /**\n * Gets the row3 vector\n */\n get row3() {\n return this._inputs[3];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n autoConfigure() {\n if (!this.row0.isConnected) {\n const row0Input = new InputBlock(\"row0\");\n row0Input.value = new Vector4(1, 0, 0, 0);\n row0Input.output.connectTo(this.row0);\n }\n if (!this.row1.isConnected) {\n const row1Input = new InputBlock(\"row1\");\n row1Input.value = new Vector4(0, 1, 0, 0);\n row1Input.output.connectTo(this.row1);\n }\n if (!this.row2.isConnected) {\n const row2Input = new InputBlock(\"row2\");\n row2Input.value = new Vector4(0, 0, 1, 0);\n row2Input.output.connectTo(this.row2);\n }\n if (!this.row3.isConnected) {\n const row3Input = new InputBlock(\"row3\");\n row3Input.value = new Vector4(0, 0, 0, 1);\n row3Input.output.connectTo(this.row3);\n }\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const output = this._outputs[0];\n const row0 = this.row0;\n const row1 = this.row1;\n const row2 = this.row2;\n const row3 = this.row3;\n const mat4 = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? \"mat4x4f\" : \"mat4\";\n state.compilationString += state._declareOutput(output) + ` = ${mat4}(${row0.associatedVariableName}, ${row1.associatedVariableName}, ${row2.associatedVariableName}, ${row3.associatedVariableName});\\n`;\n return this;\n }\n}\nRegisterClass(\"BABYLON.MatrixBuilder\", MatrixBuilderBlock);","map":{"version":3,"names":["NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","InputBlock","Vector4","MatrixBuilderBlock","constructor","name","Neutral","registerInput","registerOutput","Matrix","getClassName","row0","_inputs","row1","row2","row3","output","_outputs","autoConfigure","isConnected","row0Input","value","connectTo","row1Input","row2Input","row3Input","_buildBlock","state","mat4","shaderLanguage","compilationString","_declareOutput","associatedVariableName"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/matrixBuilderBlock.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\";\nimport { InputBlock } from \"./Input/inputBlock.js\";\nimport { Vector4 } from \"../../../Maths/math.vector.js\";\n/**\n * Block used to build a matrix from 4 Vector4\n */\nexport class MatrixBuilderBlock extends NodeMaterialBlock {\n /**\n * Creates a new MatrixBuilder\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"row0\", NodeMaterialBlockConnectionPointTypes.Vector4);\n this.registerInput(\"row1\", NodeMaterialBlockConnectionPointTypes.Vector4);\n this.registerInput(\"row2\", NodeMaterialBlockConnectionPointTypes.Vector4);\n this.registerInput(\"row3\", NodeMaterialBlockConnectionPointTypes.Vector4);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.Matrix);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"MatrixBuilder\";\n }\n /**\n * Gets the row0 vector\n */\n get row0() {\n return this._inputs[0];\n }\n /**\n * Gets the row1 vector\n */\n get row1() {\n return this._inputs[1];\n }\n /**\n * Gets the row2 vector\n */\n get row2() {\n return this._inputs[2];\n }\n /**\n * Gets the row3 vector\n */\n get row3() {\n return this._inputs[3];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n autoConfigure() {\n if (!this.row0.isConnected) {\n const row0Input = new InputBlock(\"row0\");\n row0Input.value = new Vector4(1, 0, 0, 0);\n row0Input.output.connectTo(this.row0);\n }\n if (!this.row1.isConnected) {\n const row1Input = new InputBlock(\"row1\");\n row1Input.value = new Vector4(0, 1, 0, 0);\n row1Input.output.connectTo(this.row1);\n }\n if (!this.row2.isConnected) {\n const row2Input = new InputBlock(\"row2\");\n row2Input.value = new Vector4(0, 0, 1, 0);\n row2Input.output.connectTo(this.row2);\n }\n if (!this.row3.isConnected) {\n const row3Input = new InputBlock(\"row3\");\n row3Input.value = new Vector4(0, 0, 0, 1);\n row3Input.output.connectTo(this.row3);\n }\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const output = this._outputs[0];\n const row0 = this.row0;\n const row1 = this.row1;\n const row2 = this.row2;\n const row3 = this.row3;\n const mat4 = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? \"mat4x4f\" : \"mat4\";\n state.compilationString +=\n state._declareOutput(output) +\n ` = ${mat4}(${row0.associatedVariableName}, ${row1.associatedVariableName}, ${row2.associatedVariableName}, ${row3.associatedVariableName});\\n`;\n return this;\n }\n}\nRegisterClass(\"BABYLON.MatrixBuilder\", MatrixBuilderBlock);\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,qCAAqC,QAAQ,mDAAmD;AACzG,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,OAAO,QAAQ,+BAA+B;AACvD;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,SAASN,iBAAiB,CAAC;EACtD;AACJ;AACA;AACA;EACIO,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,EAAEN,wBAAwB,CAACO,OAAO,CAAC;IAC7C,IAAI,CAACC,aAAa,CAAC,MAAM,EAAET,qCAAqC,CAACI,OAAO,CAAC;IACzE,IAAI,CAACK,aAAa,CAAC,MAAM,EAAET,qCAAqC,CAACI,OAAO,CAAC;IACzE,IAAI,CAACK,aAAa,CAAC,MAAM,EAAET,qCAAqC,CAACI,OAAO,CAAC;IACzE,IAAI,CAACK,aAAa,CAAC,MAAM,EAAET,qCAAqC,CAACI,OAAO,CAAC;IACzE,IAAI,CAACM,cAAc,CAAC,QAAQ,EAAEV,qCAAqC,CAACW,MAAM,CAAC;EAC/E;EACA;AACJ;AACA;AACA;EACIC,YAAYA,CAAA,EAAG;IACX,OAAO,eAAe;EAC1B;EACA;AACJ;AACA;EACI,IAAIC,IAAIA,CAAA,EAAG;IACP,OAAO,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC;EAC1B;EACA;AACJ;AACA;EACI,IAAIC,IAAIA,CAAA,EAAG;IACP,OAAO,IAAI,CAACD,OAAO,CAAC,CAAC,CAAC;EAC1B;EACA;AACJ;AACA;EACI,IAAI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