1 |
- {"ast":null,"code":"import { FlowGraphBlock } from \"../../flowGraphBlock.js\";\nimport { RichTypeAny, RichTypeVector3 } from \"../../flowGraphRichTypes.js\";\nimport { TmpVectors, Vector3 } from \"../../../Maths/math.vector.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\n/**\n * @experimental\n * This blocks transforms a vector from one coordinate system to another.\n */\nexport class FlowGraphCoordinateTransformBlock extends FlowGraphBlock {\n /**\n * Creates a new FlowGraphCoordinateTransformBlock\n * @param config optional configuration for this block\n */\n constructor(config) {\n super(config);\n this.sourceSystem = this.registerDataInput(\"sourceSystem\", RichTypeAny);\n this.destinationSystem = this.registerDataInput(\"destinationSystem\", RichTypeAny);\n this.inputCoordinates = this.registerDataInput(\"inputCoordinates\", RichTypeVector3);\n this.outputCoordinates = this.registerDataOutput(\"outputCoordinates\", RichTypeVector3);\n }\n _updateOutputs(_context) {\n const sourceSystemValue = this.sourceSystem.getValue(_context);\n const destinationSystemValue = this.destinationSystem.getValue(_context);\n const inputCoordinatesValue = this.inputCoordinates.getValue(_context);\n // takes coordinates from source space to world space\n const sourceWorld = sourceSystemValue.getWorldMatrix();\n // takes coordinates from destination space to world space\n const destinationWorld = destinationSystemValue.getWorldMatrix();\n const destinationWorldInverse = TmpVectors.Matrix[0].copyFrom(destinationWorld);\n // takes coordinates from world space to destination space\n destinationWorldInverse.invert();\n const sourceToDestination = TmpVectors.Matrix[1];\n // takes coordinates from source space to world space to destination space\n destinationWorldInverse.multiplyToRef(sourceWorld, sourceToDestination);\n const outputCoordinatesValue = this.outputCoordinates.getValue(_context);\n Vector3.TransformCoordinatesToRef(inputCoordinatesValue, sourceToDestination, outputCoordinatesValue);\n }\n /**\n * Gets the class name of this block\n * @returns the class name\n */\n getClassName() {\n return \"FGCoordinateTransformBlock\";\n }\n}\nRegisterClass(\"FGCoordinateTransformBlock\", FlowGraphCoordinateTransformBlock);","map":{"version":3,"names":["FlowGraphBlock","RichTypeAny","RichTypeVector3","TmpVectors","Vector3","RegisterClass","FlowGraphCoordinateTransformBlock","constructor","config","sourceSystem","registerDataInput","destinationSystem","inputCoordinates","outputCoordinates","registerDataOutput","_updateOutputs","_context","sourceSystemValue","getValue","destinationSystemValue","inputCoordinatesValue","sourceWorld","getWorldMatrix","destinationWorld","destinationWorldInverse","Matrix","copyFrom","invert","sourceToDestination","multiplyToRef","outputCoordinatesValue","TransformCoordinatesToRef","getClassName"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js"],"sourcesContent":["import { FlowGraphBlock } from \"../../flowGraphBlock.js\";\nimport { RichTypeAny, RichTypeVector3 } from \"../../flowGraphRichTypes.js\";\nimport { TmpVectors, Vector3 } from \"../../../Maths/math.vector.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\n/**\n * @experimental\n * This blocks transforms a vector from one coordinate system to another.\n */\nexport class FlowGraphCoordinateTransformBlock extends FlowGraphBlock {\n /**\n * Creates a new FlowGraphCoordinateTransformBlock\n * @param config optional configuration for this block\n */\n constructor(config) {\n super(config);\n this.sourceSystem = this.registerDataInput(\"sourceSystem\", RichTypeAny);\n this.destinationSystem = this.registerDataInput(\"destinationSystem\", RichTypeAny);\n this.inputCoordinates = this.registerDataInput(\"inputCoordinates\", RichTypeVector3);\n this.outputCoordinates = this.registerDataOutput(\"outputCoordinates\", RichTypeVector3);\n }\n _updateOutputs(_context) {\n const sourceSystemValue = this.sourceSystem.getValue(_context);\n const destinationSystemValue = this.destinationSystem.getValue(_context);\n const inputCoordinatesValue = this.inputCoordinates.getValue(_context);\n // takes coordinates from source space to world space\n const sourceWorld = sourceSystemValue.getWorldMatrix();\n // takes coordinates from destination space to world space\n const destinationWorld = destinationSystemValue.getWorldMatrix();\n const destinationWorldInverse = TmpVectors.Matrix[0].copyFrom(destinationWorld);\n // takes coordinates from world space to destination space\n destinationWorldInverse.invert();\n const sourceToDestination = TmpVectors.Matrix[1];\n // takes coordinates from source space to world space to destination space\n destinationWorldInverse.multiplyToRef(sourceWorld, sourceToDestination);\n const outputCoordinatesValue = this.outputCoordinates.getValue(_context);\n Vector3.TransformCoordinatesToRef(inputCoordinatesValue, sourceToDestination, outputCoordinatesValue);\n }\n /**\n * Gets the class name of this block\n * @returns the class name\n */\n getClassName() {\n return \"FGCoordinateTransformBlock\";\n }\n}\nRegisterClass(\"FGCoordinateTransformBlock\", FlowGraphCoordinateTransformBlock);\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,yBAAyB;AACxD,SAASC,WAAW,EAAEC,eAAe,QAAQ,6BAA6B;AAC1E,SAASC,UAAU,EAAEC,OAAO,QAAQ,+BAA+B;AACnE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D;AACA;AACA;AACA;AACA,OAAO,MAAMC,iCAAiC,SAASN,cAAc,CAAC;EAClE;AACJ;AACA;AACA;EACIO,WAAWA,CAACC,MAAM,EAAE;IAChB,KAAK,CAACA,MAAM,CAAC;IACb,IAAI,CAACC,YAAY,GAAG,IAAI,CAACC,iBAAiB,CAAC,cAAc,EAAET,WAAW,CAAC;IACvE,IAAI,CAACU,iBAAiB,GAAG,IAAI,CAACD,iBAAiB,CAAC,mBAAmB,EAAET,WAAW,CAAC;IACjF,IAAI,CAACW,gBAAgB,GAAG,IAAI,CAACF,iBAAiB,CAAC,kBAAkB,EAAER,eAAe,CAAC;IACnF,IAAI,CAACW,iBAAiB,GAAG,IAAI,CAACC,kBAAkB,CAAC,mBAAmB,EAAEZ,eAAe,CAAC;EAC1F;EACAa,cAAcA,CAACC,QAAQ,EAAE;IACrB,MAAMC,iBAAiB,GAAG,IAAI,CAACR,YAAY,CAACS,QAAQ,CAACF,QAAQ,CAAC;IAC9D,MAAMG,sBAAsB,GAAG,IAAI,CAACR,iBAAiB,CAACO,QAAQ,CAACF,QAAQ,CAAC;IACxE,MAAMI,qBAAqB,GAAG,IAAI,CAACR,gBAAgB,CAACM,QAAQ,CAACF,QAAQ,CAAC;IACtE;IAC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