1 |
- {"ast":null,"code":"import { Vector3, Matrix } from \"../Maths/math.vector.js\";\n/**\n * Class containing a set of static utilities functions for managing Pivots\n * @internal\n */\nexport class PivotTools {\n /**\n * @internal\n */\n static _RemoveAndStorePivotPoint(mesh) {\n if (mesh && PivotTools._PivotCached === 0) {\n // Save old pivot and set pivot to 0,0,0\n mesh.getPivotPointToRef(PivotTools._OldPivotPoint);\n PivotTools._PivotPostMultiplyPivotMatrix = mesh._postMultiplyPivotMatrix;\n if (!PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0)) {\n mesh.setPivotMatrix(Matrix.IdentityReadOnly);\n PivotTools._OldPivotPoint.subtractToRef(mesh.getPivotPoint(), PivotTools._PivotTranslation);\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\n mesh.position.addInPlace(PivotTools._PivotTmpVector);\n }\n }\n PivotTools._PivotCached++;\n }\n /**\n * @internal\n */\n static _RestorePivotPoint(mesh) {\n if (mesh && !PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0) && PivotTools._PivotCached === 1) {\n mesh.setPivotPoint(PivotTools._OldPivotPoint);\n mesh._postMultiplyPivotMatrix = PivotTools._PivotPostMultiplyPivotMatrix;\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\n mesh.position.subtractInPlace(PivotTools._PivotTmpVector);\n }\n this._PivotCached--;\n }\n}\n// Stores the state of the pivot cache (_oldPivotPoint, _pivotTranslation)\n// store/remove pivot point should only be applied during their outermost calls\nPivotTools._PivotCached = 0;\nPivotTools._OldPivotPoint = new Vector3();\nPivotTools._PivotTranslation = new Vector3();\nPivotTools._PivotTmpVector = new Vector3();\nPivotTools._PivotPostMultiplyPivotMatrix = false;","map":{"version":3,"names":["Vector3","Matrix","PivotTools","_RemoveAndStorePivotPoint","mesh","_PivotCached","getPivotPointToRef","_OldPivotPoint","_PivotPostMultiplyPivotMatrix","_postMultiplyPivotMatrix","equalsToFloats","setPivotMatrix","IdentityReadOnly","subtractToRef","getPivotPoint","_PivotTranslation","_PivotTmpVector","copyFromFloats","subtractInPlace","scaling","multiplyInPlace","position","addInPlace","_RestorePivotPoint","setPivotPoint"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Misc/pivotTools.js"],"sourcesContent":["import { Vector3, Matrix } from \"../Maths/math.vector.js\";\n/**\n * Class containing a set of static utilities functions for managing Pivots\n * @internal\n */\nexport class PivotTools {\n /**\n * @internal\n */\n static _RemoveAndStorePivotPoint(mesh) {\n if (mesh && PivotTools._PivotCached === 0) {\n // Save old pivot and set pivot to 0,0,0\n mesh.getPivotPointToRef(PivotTools._OldPivotPoint);\n PivotTools._PivotPostMultiplyPivotMatrix = mesh._postMultiplyPivotMatrix;\n if (!PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0)) {\n mesh.setPivotMatrix(Matrix.IdentityReadOnly);\n PivotTools._OldPivotPoint.subtractToRef(mesh.getPivotPoint(), PivotTools._PivotTranslation);\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\n mesh.position.addInPlace(PivotTools._PivotTmpVector);\n }\n }\n PivotTools._PivotCached++;\n }\n /**\n * @internal\n */\n static _RestorePivotPoint(mesh) {\n if (mesh && !PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0) && PivotTools._PivotCached === 1) {\n mesh.setPivotPoint(PivotTools._OldPivotPoint);\n mesh._postMultiplyPivotMatrix = PivotTools._PivotPostMultiplyPivotMatrix;\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\n mesh.position.subtractInPlace(PivotTools._PivotTmpVector);\n }\n this._PivotCached--;\n }\n}\n// Stores the state of the pivot cache (_oldPivotPoint, _pivotTranslation)\n// store/remove pivot point should only be applied during their outermost calls\nPivotTools._PivotCached = 0;\nPivotTools._OldPivotPoint = new Vector3();\nPivotTools._PivotTranslation = new Vector3();\nPivotTools._PivotTmpVector = new Vector3();\nPivotTools._PivotPostMultiplyPivotMatrix = false;\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,MAAM,QAAQ,yBAAyB;AACzD;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,CAAC;EACpB;AACJ;AACA;EACI,OAAOC,yBAAyBA,CAACC,IAAI,EAAE;IACnC,IAAIA,IAAI,IAAIF,UAAU,CAACG,YAAY,KAAK,CAAC,EAAE;MACvC;MACAD,IAAI,CAACE,kBAAkB,CAACJ,UAAU,CAACK,cAAc,CAAC;MAClDL,UAAU,CAACM,6BAA6B,GAAGJ,IAAI,CAACK,wBAAwB;MACxE,IAAI,CAACP,UAAU,CAACK,cAAc,CAACG,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;QACpDN,IAAI,CAACO,cAAc,CAACV,MAAM,CAACW,gBAAgB,CAAC;QAC5CV,UAAU,CAACK,cAAc,CAACM,aAAa,CAACT,IAAI,CAACU,aAAa,CAAC,CAAC,EAAEZ,UAAU,CAACa,iBAAiB,CAAC;QAC3Fb,UAAU,CAACc,eAAe,CAACC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAClDf,UAAU,CAACc,eAAe,CAACE,eAAe,CAACd,IAAI,CAACe,OAAO,CAAC;QACxDjB,UAAU,CAACc,eAAe,CAACI,eAAe,CAAClB,UAAU,CAACa,iBAAiB,CAAC;QACxEX,IAAI,CAACiB,QAAQ,CAACC,UAAU,CAACpB,UAAU,CAACc,eAAe,CAAC;MACxD;IACJ;IACAd,UAAU,CAACG,YAAY,EAAE;EAC7B;EACA;AACJ;AACA;EACI,OAAOkB,kBAAkBA,CAACnB,IAAI,EAAE;IAC5B,IAAIA,IAAI,IAAI,CAACF,UAAU,CAACK,cAAc,CAACG,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,IAAIR,UAAU,CAACG,YAAY,KAAK,CAAC,EAAE;MAC7FD,IAAI,CAACoB,aAAa,CAACtB,UAAU,CAACK,cAAc,CAAC;MAC7CH,IAAI,CAACK,wBAAwB,GAAGP,UAAU,CAACM,6BAA6B;MACxEN,UAAU,CAACc,eAAe,CAACC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;MAClDf,UAAU,CAACc,eAAe,CAACE,eAAe,CAACd,IAAI,CAACe,OAAO,CAAC;MACxDjB,UAAU,CAACc,eAAe,CAACI,eAAe,CAAClB,UAAU,CAACa,iBAAiB,CAAC;MACxEX,IAAI,CAACiB,QAAQ,CAACH,eAAe,CAAChB,UAAU,CAACc,eAAe,CAAC;IAC7D;IACA,IAAI,CAACX,YAAY,EAAE;EACvB;AACJ;AACA;AACA;AACAH,UAAU,CAACG,YAAY,GAAG,CAAC;AAC3BH,UAAU,CAACK,cAAc,GAAG,IAAIP,OAAO,CAAC,CAAC;AACzCE,UAAU,CAACa,iBAAiB,GAAG,IAAIf,OAAO,CAAC,CAAC;AAC5CE,UAAU,CAACc,eAAe,GAAG,IAAIhB,OAAO,CAAC,CAAC;AAC1CE,UAAU,CAACM,6BAA6B,GAAG,KAAK","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|