{"ast":null,"code":"import { Vector3 } from \"../Maths/math.vector.js\";\nimport { StandardMaterial } from \"../Materials/standardMaterial.js\";\nimport { AxisDragGizmo } from \"../Gizmos/axisDragGizmo.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n/**\n * The Axes viewer will show 3 axes in a specific point in space\n * @see https://doc.babylonjs.com/toolsAndResources/utilities/World_Axes\n */\nexport class AxesViewer {\n /**\n * Gets or sets a number used to scale line length\n */\n get scaleLines() {\n return this._scaleLines;\n }\n set scaleLines(value) {\n this._scaleLines = value;\n this._xAxis.scaling.setAll(this._scaleLines * this._scaleLinesFactor);\n this._yAxis.scaling.setAll(this._scaleLines * this._scaleLinesFactor);\n this._zAxis.scaling.setAll(this._scaleLines * this._scaleLinesFactor);\n }\n /** Gets the node hierarchy used to render x-axis */\n get xAxis() {\n return this._xAxis;\n }\n /** Gets the node hierarchy used to render y-axis */\n get yAxis() {\n return this._yAxis;\n }\n /** Gets the node hierarchy used to render z-axis */\n get zAxis() {\n return this._zAxis;\n }\n /**\n * Creates a new AxesViewer\n * @param scene defines the hosting scene\n * @param scaleLines defines a number used to scale line length (1 by default)\n * @param renderingGroupId defines a number used to set the renderingGroupId of the meshes (2 by default)\n * @param xAxis defines the node hierarchy used to render the x-axis\n * @param yAxis defines the node hierarchy used to render the y-axis\n * @param zAxis defines the node hierarchy used to render the z-axis\n * @param lineThickness The line thickness to use when creating the arrow. defaults to 1.\n */\n constructor(scene, scaleLines = 1, renderingGroupId = 2, xAxis, yAxis, zAxis, lineThickness = 1) {\n this._scaleLinesFactor = 4;\n this._instanced = false;\n /**\n * Gets the hosting scene\n */\n this.scene = null;\n this._scaleLines = 1;\n scene = scene || EngineStore.LastCreatedScene;\n if (!scene) {\n return;\n }\n if (!xAxis) {\n const redColoredMaterial = new StandardMaterial(\"xAxisMaterial\", scene);\n redColoredMaterial.disableLighting = true;\n redColoredMaterial.emissiveColor = Color3.Red().scale(0.5);\n xAxis = AxisDragGizmo._CreateArrow(scene, redColoredMaterial, lineThickness);\n }\n if (!yAxis) {\n const greenColoredMaterial = new StandardMaterial(\"yAxisMaterial\", scene);\n greenColoredMaterial.disableLighting = true;\n greenColoredMaterial.emissiveColor = Color3.Green().scale(0.5);\n yAxis = AxisDragGizmo._CreateArrow(scene, greenColoredMaterial, lineThickness);\n }\n if (!zAxis) {\n const blueColoredMaterial = new StandardMaterial(\"zAxisMaterial\", scene);\n blueColoredMaterial.disableLighting = true;\n blueColoredMaterial.emissiveColor = Color3.Blue().scale(0.5);\n zAxis = AxisDragGizmo._CreateArrow(scene, blueColoredMaterial, lineThickness);\n }\n this._xAxis = xAxis;\n this._yAxis = yAxis;\n this._zAxis = zAxis;\n this.scaleLines = scaleLines;\n if (renderingGroupId != null) {\n AxesViewer._SetRenderingGroupId(this._xAxis, renderingGroupId);\n AxesViewer._SetRenderingGroupId(this._yAxis, renderingGroupId);\n AxesViewer._SetRenderingGroupId(this._zAxis, renderingGroupId);\n }\n this.scene = scene;\n this.update(new Vector3(), Vector3.Right(), Vector3.Up(), Vector3.Forward());\n }\n /**\n * Force the viewer to update\n * @param position defines the position of the viewer\n * @param xaxis defines the x axis of the viewer\n * @param yaxis defines the y axis of the viewer\n * @param zaxis defines the z axis of the viewer\n */\n update(position, xaxis, yaxis, zaxis) {\n this._xAxis.position.copyFrom(position);\n this._xAxis.setDirection(xaxis);\n this._yAxis.position.copyFrom(position);\n this._yAxis.setDirection(yaxis);\n this._zAxis.position.copyFrom(position);\n this._zAxis.setDirection(zaxis);\n }\n /**\n * Creates an instance of this axes viewer.\n * @returns a new axes viewer with instanced meshes\n */\n createInstance() {\n const xAxis = AxisDragGizmo._CreateArrowInstance(this.scene, this._xAxis);\n const yAxis = AxisDragGizmo._CreateArrowInstance(this.scene, this._yAxis);\n const zAxis = AxisDragGizmo._CreateArrowInstance(this.scene, this._zAxis);\n const axesViewer = new AxesViewer(this.scene, this.scaleLines, null, xAxis, yAxis, zAxis);\n axesViewer._instanced = true;\n return axesViewer;\n }\n /** Releases resources */\n dispose() {\n if (this._xAxis) {\n this._xAxis.dispose(false, !this._instanced);\n }\n if (this._yAxis) {\n this._yAxis.dispose(false, !this._instanced);\n }\n if (this._zAxis) {\n this._zAxis.dispose(false, !this._instanced);\n }\n this.scene = null;\n }\n static _SetRenderingGroupId(node, id) {\n node.getChildMeshes().forEach(mesh => {\n mesh.renderingGroupId = id;\n });\n }\n}","map":{"version":3,"names":["Vector3","StandardMaterial","AxisDragGizmo","Color3","EngineStore","AxesViewer","scaleLines","_scaleLines","value","_xAxis","scaling","setAll","_scaleLinesFactor","_yAxis","_zAxis","xAxis","yAxis","zAxis","constructor","scene","renderingGroupId","lineThickness","_instanced","LastCreatedScene","redColoredMaterial","disableLighting","emissiveColor","Red","scale","_CreateArrow","greenColoredMaterial","Green","blueColoredMaterial","Blue","_SetRenderingGroupId","update","Right","Up","Forward","position","xaxis","yaxis","zaxis","copyFrom","setDirection","createInstance","_CreateArrowInstance","axesViewer","dispose","node","id","getChildMeshes","forEach","mesh"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Debug/axesViewer.js"],"sourcesContent":["import { Vector3 } from \"../Maths/math.vector.js\";\nimport { StandardMaterial } from \"../Materials/standardMaterial.js\";\nimport { AxisDragGizmo } from \"../Gizmos/axisDragGizmo.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n/**\n * The Axes viewer will show 3 axes in a specific point in space\n * @see https://doc.babylonjs.com/toolsAndResources/utilities/World_Axes\n */\nexport class AxesViewer {\n /**\n * Gets or sets a number used to scale line length\n */\n get scaleLines() {\n return this._scaleLines;\n }\n set scaleLines(value) {\n this._scaleLines = value;\n this._xAxis.scaling.setAll(this._scaleLines * this._scaleLinesFactor);\n this._yAxis.scaling.setAll(this._scaleLines * this._scaleLinesFactor);\n this._zAxis.scaling.setAll(this._scaleLines * this._scaleLinesFactor);\n }\n /** Gets the node hierarchy used to render x-axis */\n get xAxis() {\n return this._xAxis;\n }\n /** Gets the node hierarchy used to render y-axis */\n get yAxis() {\n return this._yAxis;\n }\n /** Gets the node hierarchy used to render z-axis */\n get zAxis() {\n return this._zAxis;\n }\n /**\n * Creates a new AxesViewer\n * @param scene defines the hosting scene\n * @param scaleLines defines a number used to scale line length (1 by default)\n * @param renderingGroupId defines a number used to set the renderingGroupId of the meshes (2 by default)\n * @param xAxis defines the node hierarchy used to render the x-axis\n * @param yAxis defines the node hierarchy used to render the y-axis\n * @param zAxis defines the node hierarchy used to render the z-axis\n * @param lineThickness The line thickness to use when creating the arrow. defaults to 1.\n */\n constructor(scene, scaleLines = 1, renderingGroupId = 2, xAxis, yAxis, zAxis, lineThickness = 1) {\n this._scaleLinesFactor = 4;\n this._instanced = false;\n /**\n * Gets the hosting scene\n */\n this.scene = null;\n this._scaleLines = 1;\n scene = scene || EngineStore.LastCreatedScene;\n if (!scene) {\n return;\n }\n if (!xAxis) {\n const redColoredMaterial = new StandardMaterial(\"xAxisMaterial\", scene);\n redColoredMaterial.disableLighting = true;\n redColoredMaterial.emissiveColor = Color3.Red().scale(0.5);\n xAxis = AxisDragGizmo._CreateArrow(scene, redColoredMaterial, lineThickness);\n }\n if (!yAxis) {\n const greenColoredMaterial = new StandardMaterial(\"yAxisMaterial\", scene);\n greenColoredMaterial.disableLighting = true;\n greenColoredMaterial.emissiveColor = Color3.Green().scale(0.5);\n yAxis = AxisDragGizmo._CreateArrow(scene, greenColoredMaterial, lineThickness);\n }\n if (!zAxis) {\n const blueColoredMaterial = new StandardMaterial(\"zAxisMaterial\", scene);\n blueColoredMaterial.disableLighting = true;\n blueColoredMaterial.emissiveColor = Color3.Blue().scale(0.5);\n zAxis = AxisDragGizmo._CreateArrow(scene, blueColoredMaterial, lineThickness);\n }\n this._xAxis = xAxis;\n this._yAxis = yAxis;\n this._zAxis = zAxis;\n this.scaleLines = scaleLines;\n if (renderingGroupId != null) {\n AxesViewer._SetRenderingGroupId(this._xAxis, renderingGroupId);\n AxesViewer._SetRenderingGroupId(this._yAxis, renderingGroupId);\n AxesViewer._SetRenderingGroupId(this._zAxis, renderingGroupId);\n }\n this.scene = scene;\n this.update(new Vector3(), Vector3.Right(), Vector3.Up(), Vector3.Forward());\n }\n /**\n * Force the viewer to update\n * @param position defines the position of the viewer\n * @param xaxis defines the x axis of the viewer\n * @param yaxis defines the y axis of the viewer\n * @param zaxis defines the z axis of the viewer\n */\n update(position, xaxis, yaxis, zaxis) {\n this._xAxis.position.copyFrom(position);\n this._xAxis.setDirection(xaxis);\n this._yAxis.position.copyFrom(position);\n this._yAxis.setDirection(yaxis);\n this._zAxis.position.copyFrom(position);\n this._zAxis.setDirection(zaxis);\n }\n /**\n * Creates an instance of this axes viewer.\n * @returns a new axes viewer with instanced meshes\n */\n createInstance() {\n const xAxis = AxisDragGizmo._CreateArrowInstance(this.scene, this._xAxis);\n const yAxis = AxisDragGizmo._CreateArrowInstance(this.scene, this._yAxis);\n const zAxis = AxisDragGizmo._CreateArrowInstance(this.scene, this._zAxis);\n const axesViewer = new AxesViewer(this.scene, this.scaleLines, null, xAxis, yAxis, zAxis);\n axesViewer._instanced = true;\n return axesViewer;\n }\n /** Releases resources */\n dispose() {\n if (this._xAxis) {\n this._xAxis.dispose(false, !this._instanced);\n }\n if (this._yAxis) {\n this._yAxis.dispose(false, !this._instanced);\n }\n if (this._zAxis) {\n this._zAxis.dispose(false, !this._instanced);\n }\n this.scene = null;\n }\n static _SetRenderingGroupId(node, id) {\n node.getChildMeshes().forEach((mesh) => {\n mesh.renderingGroupId = id;\n });\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,yBAAyB;AACjD,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,WAAW,QAAQ,2BAA2B;AACvD;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,CAAC;EAC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