@babylonjs/core 6.26.0 → 6.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Behaviors/Meshes/attachToBoxBehavior.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Collisions/intersectionInfo.js.map +1 -1
- package/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js.map +1 -1
- package/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js.map +1 -1
- package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +3 -4
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +5 -6
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +22 -0
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +26 -0
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +3 -5
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +5 -6
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +3 -4
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +5 -6
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +1 -1
- package/FlowGraph/flowGraphConnection.js +2 -1
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +10 -0
- package/FlowGraph/flowGraphContext.js +14 -0
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.js +1 -0
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Loading/loadingScreen.js.map +1 -1
- package/Materials/Background/backgroundMaterial.d.ts +16 -0
- package/Materials/Background/backgroundMaterial.js +44 -0
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +0 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +6 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +10 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +27 -5
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +16 -4
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/Interfaces/nodeGeometryExecutionContext.d.ts +5 -0
- package/Meshes/Node/Interfaces/nodeGeometryExecutionContext.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +3 -0
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/csg.js.map +1 -1
- package/Meshes/geodesicMesh.js.map +1 -1
- package/Meshes/meshSimplification.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/Misc/fileTools.js.map +1 -1
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/v1/Plugins/cannonJSPlugin.js.map +1 -1
- package/Physics/v1/Plugins/oimoJSPlugin.js.map +1 -1
- package/Physics/v1/physicsEngine.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsEngine.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/bloomEffect.js.map +1 -1
- package/Rendering/boundingBoxRenderer.js +6 -2
- package/Rendering/boundingBoxRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/backgroundFragmentDeclaration.js +3 -0
- package/Shaders/ShadersInclude/backgroundFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/backgroundUboDeclaration.js +1 -8
- package/Shaders/ShadersInclude/backgroundUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrHelperFunctions.js +1 -3
- package/Shaders/ShadersInclude/pbrHelperFunctions.js.map +1 -1
- package/Shaders/background.fragment.js +11 -1
- package/Shaders/background.fragment.js.map +1 -1
- package/Shaders/default.fragment.js +0 -1
- package/Shaders/default.fragment.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRMeshDetector.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRPlaneDetector.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.js.map +1 -1
- package/XR/native/nativeXRRenderTarget.js.map +1 -1
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRWebGLLayer.js.map +1 -1
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLineBaseMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineBaseMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAGlG;;;GAGG;AACH,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACnC,yGAAsB,CAAA;IACtB,uGAAqB,CAAA;AACzB,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,iHAA2B,CAAA;IAC3B,yJAA+C,CAAA;IAC/C,iHAA2B,CAAA;AAC/B,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,kCAKX;AALD,WAAY,kCAAkC;IAC1C,uJAAsC,CAAA;IACtC,qJAAqC,CAAA;IACrC,mIAA4B,CAAA;IAC5B,4HAAyB,CAAA;AAC7B,CAAC,EALW,kCAAkC,KAAlC,kCAAkC,QAK7C;AAsFD;;GAEG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,IAAI;IAkBlD,YAA4B,IAAY,EAAE,KAAY,EAAY,QAAgC;;QAC9F,KAAK,CAA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IAAI,CAAC,IAAI,CAAC;QAC3B,IAAI,cAAc,EAAE;YAChB,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;YACxB,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;SACvF;QACD,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,oBAAoB,CAAC,OAAiB;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAEvC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { IGreasedLineMaterial } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport type { Engine } from \"../../Engines/engine\";\r\n\r\n/**\r\n * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.\r\n * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.\r\n */\r\nexport enum GreasedLineRibbonPointsMode {\r\n POINTS_MODE_POINTS = 0,\r\n POINTS_MODE_PATHS = 1,\r\n}\r\n\r\n/**\r\n * FACES_MODE_SINGLE_SIDED single sided with back face culling. Default value.\r\n * FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING single sided without back face culling. Sets backFaceCulling = false on the material so it affects all line ribbons added to the line ribbon instance.\r\n * FACES_MODE_DOUBLE_SIDED extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\nexport enum GreasedLineRibbonFacesMode {\r\n FACES_MODE_SINGLE_SIDED = 0,\r\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\r\n FACES_MODE_DOUBLE_SIDED = 2,\r\n}\r\n\r\n/**\r\n * Only with POINTS_MODE_PATHS.\r\n * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.\r\n * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.\r\n * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.\r\n * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.\r\n */\r\nexport enum GreasedLineRibbonAutoDirectionMode {\r\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\r\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\r\n AUTO_DIRECTIONS_ENHANCED = 2,\r\n AUTO_DIRECTIONS_NONE = 99,\r\n}\r\n\r\nexport type GreasedLineRibbonOptions = {\r\n /**\r\n * Defines how the points are processed.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_POINTS every array of points will become the center of the ribbon. The ribbon will be expanded by width/2 to +direction and -direction as well.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_PATHS every array of points is one path. These will be used to buuid one ribbon.\r\n */\r\n pointsMode?: GreasedLineRibbonPointsMode;\r\n /**\r\n * Normalized directions of the slopes of the non camera facing lines.\r\n */\r\n directions?: Vector3[] | Vector3;\r\n /**\r\n * Defines the calculation mode of the directions which the line will be thickened to.\r\n */\r\n directionsAutoMode?: GreasedLineRibbonAutoDirectionMode;\r\n /**\r\n * Width of the ribbon.\r\n */\r\n width?: number;\r\n /**\r\n * Controls how the faces are created.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED = single sided with back face culling. Default value.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = single sided without back face culling\r\n * GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED = extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\n facesMode?: GreasedLineRibbonFacesMode;\r\n /**\r\n * If true, the path will be closed.\r\n */\r\n closePath?: boolean;\r\n /**\r\n * If true, normals will be computed when creating the vertex buffers.\r\n * This results to smooth shading of the mesh.\r\n */\r\n smoothShading?: boolean;\r\n};\r\n\r\nexport type GreasedLinePoints = Vector3[] | Vector3[][] | Float32Array | Float32Array[] | number[][] | number[];\r\n\r\n/**\r\n * Options for creating a GreasedLineMesh\r\n */\r\nexport interface GreasedLineMeshOptions {\r\n /**\r\n * Points of the line.\r\n */\r\n points: GreasedLinePoints;\r\n /**\r\n * Each line segmment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.\r\n * Defaults to empty array.\r\n */\r\n widths?: number[];\r\n /**\r\n * If instance is specified, lines are added to the specified instance.\r\n * Defaults to undefined.\r\n */\r\n instance?: GreasedLineBaseMesh;\r\n /**\r\n * You can manually set the color pointers so you can control which segment/part\r\n * will use which color from the colors material option\r\n */\r\n colorPointers?: number[];\r\n /**\r\n * UVs for the mesh\r\n */\r\n uvs?: number[];\r\n /**\r\n * If true, offsets and widths are updatable.\r\n * Defaults to false.\r\n */\r\n updatable?: boolean;\r\n /**\r\n * Use when @see instance is specified.\r\n * If true, the line will be rendered only after calling instance.updateLazy(). If false, line will be rerendered after every call to @see CreateGreasedLine\r\n * Defaults to false.\r\n */\r\n lazy?: boolean;\r\n /**\r\n * The options for the ribbon which will be used as a line.\r\n * If this option is set the line switches automatically to a non camera facing mode.\r\n */\r\n ribbonOptions?: GreasedLineRibbonOptions;\r\n}\r\n\r\n/**\r\n * GreasedLineBaseMesh\r\n */\r\nexport abstract class GreasedLineBaseMesh extends Mesh {\r\n protected _vertexPositions: number[];\r\n protected _indices: number[];\r\n protected _uvs: number[];\r\n protected _points: number[][];\r\n protected _offsets: number[];\r\n protected _colorPointers: number[];\r\n protected _widths: number[];\r\n\r\n protected _offsetsBuffer?: Buffer;\r\n protected _widthsBuffer?: Buffer;\r\n protected _colorPointersBuffer?: Buffer;\r\n\r\n protected _lazy = false;\r\n protected _updatable = false;\r\n\r\n protected _engine: Engine;\r\n\r\n constructor(public readonly name: string, scene: Scene, protected _options: GreasedLineMeshOptions) {\r\n super(name, scene, null, null, false, false);\r\n\r\n this._engine = scene.getEngine();\r\n\r\n this._lazy = _options.lazy ?? false;\r\n this._updatable = _options.updatable ?? false;\r\n\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n this._points = [];\r\n this._colorPointers = _options.colorPointers ?? [];\r\n this._widths = _options.widths ?? new Array(_options.points.length).fill(1);\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected abstract _setPoints(points: number[][], options?: GreasedLineMeshOptions): void;\r\n protected abstract _updateColorPointers(): void;\r\n protected abstract _updateWidths(): void;\r\n\r\n protected _updateWidthsWithValue(defaulValue: number) {\r\n let pointCount = 0;\r\n for (const points of this._points) {\r\n pointCount += points.length;\r\n }\r\n const countDiff = (pointCount / 3) * 2 - this._widths.length;\r\n for (let i = 0; i < countDiff; i++) {\r\n this._widths.push(defaulValue);\r\n }\r\n }\r\n\r\n /**\r\n * Updated a lazy line. Rerenders the line and updates boundinfo as well.\r\n */\r\n public updateLazy() {\r\n this._setPoints(this._points);\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n this.refreshBoundingInfo();\r\n\r\n this.greasedLineMaterial?.updateLazy();\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n */\r\n public addPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n for (const p of points) {\r\n this._points.push(p);\r\n }\r\n\r\n if (!this._lazy) {\r\n this.setPoints(this._points, options);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the line and it's resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n }\r\n\r\n /**\r\n *\r\n * @returns true if the mesh was created in lazy mode\r\n */\r\n public isLazy(): boolean {\r\n return this._lazy;\r\n }\r\n\r\n /**\r\n * Return the the points offsets\r\n */\r\n get offsets() {\r\n return this._offsets;\r\n }\r\n\r\n /**\r\n * Sets point offests\r\n * @param offsets offset table [x,y,z, x,y,z, ....]\r\n */\r\n set offsets(offsets: number[]) {\r\n this._offsets = offsets;\r\n if (!this._offsetsBuffer) {\r\n this._createOffsetsBuffer(offsets);\r\n } else {\r\n this._offsetsBuffer.update(offsets);\r\n }\r\n }\r\n\r\n /**\r\n * Gets widths at each line point like [widthLower, widthUpper, widthLower, widthUpper, ...]\r\n */\r\n get widths() {\r\n return this._widths;\r\n }\r\n\r\n /**\r\n * Sets widths at each line point\r\n * @param widths width table [widthLower, widthUpper, widthLower, widthUpper ...]\r\n */\r\n set widths(widths: number[]) {\r\n this._widths = widths;\r\n if (!this._lazy) {\r\n this._widthsBuffer && this._widthsBuffer.update(widths);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color pointer. Each vertex need a color pointer. These color pointers points to the colors in the color table @see colors\r\n */\r\n get colorPointers() {\r\n return this._colorPointers;\r\n }\r\n\r\n /**\r\n * Sets the color pointer\r\n * @param colorPointers array of color pointer in the colors array. One pointer for every vertex is needed.\r\n */\r\n set colorPointers(colorPointers: number[]) {\r\n this._colorPointers = colorPointers;\r\n if (!this._lazy) {\r\n this._colorPointersBuffer && this._colorPointersBuffer.update(colorPointers);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the pluginMaterial associated with line\r\n */\r\n get greasedLineMaterial(): IGreasedLineMaterial | undefined {\r\n if (this.material && this.material instanceof GreasedLineSimpleMaterial) {\r\n return this.material;\r\n }\r\n const materialPlugin = this.material?.pluginManager?.getPlugin(GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME);\r\n if (materialPlugin) {\r\n return <GreasedLinePluginMaterial>materialPlugin;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * Return copy the points.\r\n */\r\n get points() {\r\n const pointsCopy: number[][] = [];\r\n DeepCopier.DeepCopy(this._points, pointsCopy);\r\n return pointsCopy;\r\n }\r\n\r\n /**\r\n * Sets line points and rerenders the line.\r\n * @param points points table\r\n */\r\n public setPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n this._points = points;\r\n this._updateWidths();\r\n if (!options?.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._setPoints(points, options);\r\n }\r\n\r\n protected _initGreasedLine() {\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n }\r\n\r\n protected _createLineOptions() {\r\n const lineOptions: GreasedLineMeshOptions = {\r\n points: this._points,\r\n colorPointers: this._colorPointers,\r\n lazy: this._lazy,\r\n updatable: this._updatable,\r\n uvs: this._uvs,\r\n widths: this._widths,\r\n ribbonOptions: this._options.ribbonOptions,\r\n };\r\n return lineOptions;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n protected _createVertexBuffers(computeNormals = false) {\r\n const vertexData = new VertexData();\r\n vertexData.positions = this._vertexPositions;\r\n vertexData.indices = this._indices;\r\n vertexData.uvs = this._uvs;\r\n if (computeNormals) {\r\n vertexData.normals = [];\r\n VertexData.ComputeNormals(this._vertexPositions, this._indices, vertexData.normals);\r\n }\r\n vertexData.applyToMesh(this, this._options.updatable);\r\n return vertexData;\r\n }\r\n\r\n protected _createOffsetsBuffer(offsets: number[]) {\r\n const engine = this._scene.getEngine();\r\n\r\n const offsetBuffer = new Buffer(engine, offsets, this._updatable, 3);\r\n this.setVerticesBuffer(offsetBuffer.createVertexBuffer(\"grl_offsets\", 0, 3));\r\n this._offsetsBuffer = offsetBuffer;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLineBaseMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineBaseMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAGlG;;;GAGG;AACH,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACnC,yGAAsB,CAAA;IACtB,uGAAqB,CAAA;AACzB,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,iHAA2B,CAAA;IAC3B,yJAA+C,CAAA;IAC/C,iHAA2B,CAAA;AAC/B,CAAC,EAJW,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,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAE/C,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAChE,CAAC;IAES,oBAAoB,CAAC,cAAc,GAAG,KAAK;QACjD,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QACpC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC7C,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QACnC,UAAU,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3B,IAAI,cAAc,EAAE;YAChB,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;YACxB,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;SACvF;QACD,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,oBAAoB,CAAC,OAAiB;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAEvC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { IGreasedLineMaterial } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport type { Engine } from \"../../Engines/engine\";\r\n\r\n/**\r\n * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.\r\n * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.\r\n */\r\nexport enum GreasedLineRibbonPointsMode {\r\n POINTS_MODE_POINTS = 0,\r\n POINTS_MODE_PATHS = 1,\r\n}\r\n\r\n/**\r\n * FACES_MODE_SINGLE_SIDED single sided with back face culling. Default value.\r\n * FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING single sided without back face culling. Sets backFaceCulling = false on the material so it affects all line ribbons added to the line ribbon instance.\r\n * FACES_MODE_DOUBLE_SIDED extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\nexport enum GreasedLineRibbonFacesMode {\r\n FACES_MODE_SINGLE_SIDED = 0,\r\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\r\n FACES_MODE_DOUBLE_SIDED = 2,\r\n}\r\n\r\n/**\r\n * Only with POINTS_MODE_PATHS.\r\n * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.\r\n * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.\r\n * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.\r\n * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.\r\n */\r\nexport enum GreasedLineRibbonAutoDirectionMode {\r\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\r\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\r\n AUTO_DIRECTIONS_ENHANCED = 2,\r\n AUTO_DIRECTIONS_NONE = 99,\r\n}\r\n\r\nexport type GreasedLineRibbonOptions = {\r\n /**\r\n * Defines how the points are processed.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_POINTS every array of points will become the center of the ribbon. The ribbon will be expanded by width/2 to +direction and -direction as well.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_PATHS every array of points is one path. These will be used to buuid one ribbon.\r\n */\r\n pointsMode?: GreasedLineRibbonPointsMode;\r\n /**\r\n * Normalized directions of the slopes of the non camera facing lines.\r\n */\r\n directions?: Vector3[] | Vector3;\r\n /**\r\n * Defines the calculation mode of the directions which the line will be thickened to.\r\n */\r\n directionsAutoMode?: GreasedLineRibbonAutoDirectionMode;\r\n /**\r\n * Width of the ribbon.\r\n */\r\n width?: number;\r\n /**\r\n * Controls how the faces are created.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED = single sided with back face culling. Default value.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = single sided without back face culling\r\n * GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED = extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\n facesMode?: GreasedLineRibbonFacesMode;\r\n /**\r\n * If true, the path will be closed.\r\n */\r\n closePath?: boolean;\r\n /**\r\n * If true, normals will be computed when creating the vertex buffers.\r\n * This results to smooth shading of the mesh.\r\n */\r\n smoothShading?: boolean;\r\n};\r\n\r\nexport type GreasedLinePoints = Vector3[] | Vector3[][] | Float32Array | Float32Array[] | number[][] | number[];\r\n\r\n/**\r\n * Options for creating a GreasedLineMesh\r\n */\r\nexport interface GreasedLineMeshOptions {\r\n /**\r\n * Points of the line.\r\n */\r\n points: GreasedLinePoints;\r\n /**\r\n * Each line segmment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.\r\n * Defaults to empty array.\r\n */\r\n widths?: number[];\r\n /**\r\n * If instance is specified, lines are added to the specified instance.\r\n * Defaults to undefined.\r\n */\r\n instance?: GreasedLineBaseMesh;\r\n /**\r\n * You can manually set the color pointers so you can control which segment/part\r\n * will use which color from the colors material option\r\n */\r\n colorPointers?: number[];\r\n /**\r\n * UVs for the mesh\r\n */\r\n uvs?: number[];\r\n /**\r\n * If true, offsets and widths are updatable.\r\n * Defaults to false.\r\n */\r\n updatable?: boolean;\r\n /**\r\n * Use when @see instance is specified.\r\n * If true, the line will be rendered only after calling instance.updateLazy(). If false, line will be rerendered after every call to @see CreateGreasedLine\r\n * Defaults to false.\r\n */\r\n lazy?: boolean;\r\n /**\r\n * The options for the ribbon which will be used as a line.\r\n * If this option is set the line switches automatically to a non camera facing mode.\r\n */\r\n ribbonOptions?: GreasedLineRibbonOptions;\r\n}\r\n\r\n/**\r\n * GreasedLineBaseMesh\r\n */\r\nexport abstract class GreasedLineBaseMesh extends Mesh {\r\n protected _vertexPositions: number[];\r\n protected _indices: number[];\r\n protected _uvs: number[];\r\n protected _points: number[][];\r\n protected _offsets: number[];\r\n protected _colorPointers: number[];\r\n protected _widths: number[];\r\n\r\n protected _offsetsBuffer?: Buffer;\r\n protected _widthsBuffer?: Buffer;\r\n protected _colorPointersBuffer?: Buffer;\r\n\r\n protected _lazy = false;\r\n protected _updatable = false;\r\n\r\n protected _engine: Engine;\r\n\r\n constructor(\r\n public readonly name: string,\r\n scene: Scene,\r\n protected _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, null, null, false, false);\r\n\r\n this._engine = scene.getEngine();\r\n\r\n this._lazy = _options.lazy ?? false;\r\n this._updatable = _options.updatable ?? false;\r\n\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n this._points = [];\r\n this._colorPointers = _options.colorPointers ?? [];\r\n this._widths = _options.widths ?? new Array(_options.points.length).fill(1);\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected abstract _setPoints(points: number[][], options?: GreasedLineMeshOptions): void;\r\n protected abstract _updateColorPointers(): void;\r\n protected abstract _updateWidths(): void;\r\n\r\n protected _updateWidthsWithValue(defaulValue: number) {\r\n let pointCount = 0;\r\n for (const points of this._points) {\r\n pointCount += points.length;\r\n }\r\n const countDiff = (pointCount / 3) * 2 - this._widths.length;\r\n for (let i = 0; i < countDiff; i++) {\r\n this._widths.push(defaulValue);\r\n }\r\n }\r\n\r\n /**\r\n * Updated a lazy line. Rerenders the line and updates boundinfo as well.\r\n */\r\n public updateLazy() {\r\n this._setPoints(this._points);\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n this.refreshBoundingInfo();\r\n\r\n this.greasedLineMaterial?.updateLazy();\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n */\r\n public addPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n for (const p of points) {\r\n this._points.push(p);\r\n }\r\n\r\n if (!this._lazy) {\r\n this.setPoints(this._points, options);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the line and it's resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n }\r\n\r\n /**\r\n *\r\n * @returns true if the mesh was created in lazy mode\r\n */\r\n public isLazy(): boolean {\r\n return this._lazy;\r\n }\r\n\r\n /**\r\n * Return the the points offsets\r\n */\r\n get offsets() {\r\n return this._offsets;\r\n }\r\n\r\n /**\r\n * Sets point offests\r\n * @param offsets offset table [x,y,z, x,y,z, ....]\r\n */\r\n set offsets(offsets: number[]) {\r\n this._offsets = offsets;\r\n if (!this._offsetsBuffer) {\r\n this._createOffsetsBuffer(offsets);\r\n } else {\r\n this._offsetsBuffer.update(offsets);\r\n }\r\n }\r\n\r\n /**\r\n * Gets widths at each line point like [widthLower, widthUpper, widthLower, widthUpper, ...]\r\n */\r\n get widths() {\r\n return this._widths;\r\n }\r\n\r\n /**\r\n * Sets widths at each line point\r\n * @param widths width table [widthLower, widthUpper, widthLower, widthUpper ...]\r\n */\r\n set widths(widths: number[]) {\r\n this._widths = widths;\r\n if (!this._lazy) {\r\n this._widthsBuffer && this._widthsBuffer.update(widths);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color pointer. Each vertex need a color pointer. These color pointers points to the colors in the color table @see colors\r\n */\r\n get colorPointers() {\r\n return this._colorPointers;\r\n }\r\n\r\n /**\r\n * Sets the color pointer\r\n * @param colorPointers array of color pointer in the colors array. One pointer for every vertex is needed.\r\n */\r\n set colorPointers(colorPointers: number[]) {\r\n this._colorPointers = colorPointers;\r\n if (!this._lazy) {\r\n this._colorPointersBuffer && this._colorPointersBuffer.update(colorPointers);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the pluginMaterial associated with line\r\n */\r\n get greasedLineMaterial(): IGreasedLineMaterial | undefined {\r\n if (this.material && this.material instanceof GreasedLineSimpleMaterial) {\r\n return this.material;\r\n }\r\n const materialPlugin = this.material?.pluginManager?.getPlugin(GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME);\r\n if (materialPlugin) {\r\n return <GreasedLinePluginMaterial>materialPlugin;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * Return copy the points.\r\n */\r\n get points() {\r\n const pointsCopy: number[][] = [];\r\n DeepCopier.DeepCopy(this._points, pointsCopy);\r\n return pointsCopy;\r\n }\r\n\r\n /**\r\n * Sets line points and rerenders the line.\r\n * @param points points table\r\n */\r\n public setPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n this._points = points;\r\n this._updateWidths();\r\n if (!options?.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._setPoints(points, options);\r\n }\r\n\r\n protected _initGreasedLine() {\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n }\r\n\r\n protected _createLineOptions() {\r\n const lineOptions: GreasedLineMeshOptions = {\r\n points: this._points,\r\n colorPointers: this._colorPointers,\r\n lazy: this._lazy,\r\n updatable: this._updatable,\r\n uvs: this._uvs,\r\n widths: this._widths,\r\n ribbonOptions: this._options.ribbonOptions,\r\n };\r\n return lineOptions;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n protected _createVertexBuffers(computeNormals = false) {\r\n const vertexData = new VertexData();\r\n vertexData.positions = this._vertexPositions;\r\n vertexData.indices = this._indices;\r\n vertexData.uvs = this._uvs;\r\n if (computeNormals) {\r\n vertexData.normals = [];\r\n VertexData.ComputeNormals(this._vertexPositions, this._indices, vertexData.normals);\r\n }\r\n vertexData.applyToMesh(this, this._options.updatable);\r\n return vertexData;\r\n }\r\n\r\n protected _createOffsetsBuffer(offsets: number[]) {\r\n const engine = this._scene.getEngine();\r\n\r\n const offsetBuffer = new Buffer(engine, offsets, this._updatable, 3);\r\n this.setVerticesBuffer(offsetBuffer.createVertexBuffer(\"grl_offsets\", 0, 3));\r\n this._offsetsBuffer = offsetBuffer;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLineMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,OAAO,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AAE,AAAhB,CAAiB","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { Ray, TrianglePickingPredicate } from \"../../Culling/ray\";\r\nimport { Buffer, VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh } from \"./greasedLineBaseMesh\";\r\n\r\nMesh._GreasedLineMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineMesh extends GreasedLineBaseMesh {\r\n private _previousAndSide: number[];\r\n private _nextAndCounters: number[];\r\n\r\n private static _V_START = new Vector3();\r\n private static _V_END = new Vector3();\r\n private static _V_OFFSET_START = new Vector3();\r\n private static _V_OFFSET_END = new Vector3();\r\n\r\n /**\r\n * Treshold used to pick the mesh\r\n */\r\n public intersectionThreshold = 0.1;\r\n\r\n /**\r\n * GreasedLineMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n */\r\n constructor(public readonly name: string, scene: Scene, _options: GreasedLineMeshOptions) {\r\n super(name, scene, _options);\r\n\r\n this._previousAndSide = [];\r\n this._nextAndCounters = [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points));\r\n }\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n this._points.forEach((p) => {\r\n for (let jj = 0; jj < p.length; jj += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n });\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(0);\r\n }\r\n\r\n protected _setPoints(points: number[][]) {\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n\r\n points.forEach((p) => {\r\n const counters: number[] = [];\r\n const positions: number[] = [];\r\n const indices: number[] = [];\r\n\r\n const totalLength = GreasedLineTools.GetLineLength(p);\r\n for (let j = 0, jj = 0; jj < p.length; j++, jj += 3) {\r\n const partialLine = p.slice(0, jj + 3);\r\n const partialLineLength = GreasedLineTools.GetLineLength(partialLine);\r\n const c = partialLineLength / totalLength;\r\n\r\n positions.push(p[jj], p[jj + 1], p[jj + 2]);\r\n positions.push(p[jj], p[jj + 1], p[jj + 2]);\r\n counters.push(c);\r\n counters.push(c);\r\n\r\n if (jj < p.length - 3) {\r\n const n = j * 2 + indiceOffset;\r\n indices.push(n, n + 1, n + 2);\r\n indices.push(n + 2, n + 1, n + 3);\r\n }\r\n }\r\n\r\n indiceOffset += (p.length / 3) * 2;\r\n\r\n const previous: number[] = [];\r\n const next: number[] = [];\r\n const side: number[] = [];\r\n let uvs: number[] = [];\r\n\r\n this._preprocess(positions, previous, next, side, uvs);\r\n\r\n for (const vp of positions) {\r\n this._vertexPositions.push(vp);\r\n }\r\n\r\n for (const i of indices) {\r\n this._indices.push(i);\r\n }\r\n\r\n for (let i = 0; i < side.length; i++) {\r\n this._previousAndSide.push(previous[i * 3], previous[i * 3 + 1], previous[i * 3 + 2], side[i]);\r\n this._nextAndCounters.push(next[i * 3], next[i * 3 + 1], next[i * 3 + 2], counters[i]);\r\n }\r\n\r\n uvs = this._options.uvs ?? uvs;\r\n for (const uv of uvs) {\r\n this._uvs.push(uv);\r\n }\r\n });\r\n\r\n if (!this._lazy) {\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers();\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions = {};\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"]);\r\n\r\n const cloned = new GreasedLineMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineMesh\r\n * @param parsedMesh the serialized GreasedLineMesh\r\n * @param scene the scene to create the GreasedLineMesh in\r\n * @returns the created GreasedLineMesh\r\n */\r\n public static Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const result = new GreasedLineMesh(name, scene, lineOptions);\r\n return result;\r\n }\r\n\r\n protected _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._previousAndSide = [];\r\n this._nextAndCounters = [];\r\n }\r\n /**\r\n * Checks whether a ray is intersecting this GreasedLineMesh\r\n * @param ray ray to check the intersection of this mesh with\r\n * @param fastCheck not supported\r\n * @param trianglePredicate not supported\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param worldToUse not supported\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @returns the picking info\r\n */\r\n public intersects(\r\n ray: Ray,\r\n fastCheck?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate,\r\n onlyBoundingInfo = false,\r\n worldToUse?: Matrix,\r\n skipBoundingInfo = false\r\n ): PickingInfo {\r\n const pickingInfo = new PickingInfo();\r\n const intersections = this.findAllIntersections(ray, fastCheck, trianglePredicate, onlyBoundingInfo, worldToUse, skipBoundingInfo, true);\r\n if (intersections?.length === 1) {\r\n const intersection = intersections[0];\r\n pickingInfo.hit = true;\r\n pickingInfo.distance = intersection.distance;\r\n pickingInfo.ray = ray;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.pickedPoint = intersection.point;\r\n }\r\n return pickingInfo;\r\n }\r\n\r\n /**\r\n * Gets all intersections of a ray and the line\r\n * @param ray Ray to check the intersection of this mesh with\r\n * @param _fastCheck not supported\r\n * @param _trianglePredicate not supported\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param _worldToUse not supported\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @param firstOnly If true, the first and only intersection is immediatelly returned if found\r\n * @returns intersection(s)\r\n */\r\n public findAllIntersections(\r\n ray: Ray,\r\n _fastCheck?: boolean,\r\n _trianglePredicate?: TrianglePickingPredicate,\r\n onlyBoundingInfo = false,\r\n _worldToUse?: Matrix,\r\n skipBoundingInfo = false,\r\n firstOnly = false\r\n ): { distance: number; point: Vector3 }[] | undefined {\r\n if (onlyBoundingInfo && !skipBoundingInfo && ray.intersectsSphere(this._boundingSphere, this.intersectionThreshold) === false) {\r\n return;\r\n }\r\n\r\n const indices = this.getIndices();\r\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n const widths = this._widths;\r\n\r\n const lineWidth = this.greasedLineMaterial?.width ?? 1;\r\n\r\n const intersects = [];\r\n if (indices && positions && widths) {\r\n let i = 0,\r\n l = 0;\r\n for (i = 0, l = indices.length - 1; i < l; i += 3) {\r\n const a = indices[i];\r\n const b = indices[i + 1];\r\n\r\n GreasedLineMesh._V_START.fromArray(positions, a * 3);\r\n GreasedLineMesh._V_END.fromArray(positions, b * 3);\r\n\r\n if (this._offsets) {\r\n GreasedLineMesh._V_OFFSET_START.fromArray(this._offsets, a * 3);\r\n GreasedLineMesh._V_OFFSET_END.fromArray(this._offsets, b * 3);\r\n GreasedLineMesh._V_START.addInPlace(GreasedLineMesh._V_OFFSET_START);\r\n GreasedLineMesh._V_END.addInPlace(GreasedLineMesh._V_OFFSET_END);\r\n }\r\n\r\n const iFloored = Math.floor(i / 3);\r\n const width = widths[iFloored] !== undefined ? widths[iFloored] : 1;\r\n const precision = (this.intersectionThreshold * (lineWidth * width)) / 2;\r\n\r\n const distance = ray.intersectionSegment(GreasedLineMesh._V_START, GreasedLineMesh._V_END, precision);\r\n if (distance !== -1) {\r\n intersects.push({\r\n distance: distance,\r\n point: ray.direction.normalize().multiplyByFloats(distance, distance, distance).add(ray.origin),\r\n });\r\n if (firstOnly) {\r\n return intersects;\r\n }\r\n }\r\n }\r\n i = l;\r\n }\r\n\r\n return intersects;\r\n }\r\n\r\n private get _boundingSphere() {\r\n return this.getBoundingInfo().boundingSphere;\r\n }\r\n\r\n private static _CompareV3(positionIdx1: number, positionIdx2: number, positions: number[]) {\r\n const arrayIdx1 = positionIdx1 * 6;\r\n const arrayIdx2 = positionIdx2 * 6;\r\n return positions[arrayIdx1] === positions[arrayIdx2] && positions[arrayIdx1 + 1] === positions[arrayIdx2 + 1] && positions[arrayIdx1 + 2] === positions[arrayIdx2 + 2];\r\n }\r\n\r\n private static _CopyV3(positionIdx: number, positions: number[]) {\r\n const arrayIdx = positionIdx * 6;\r\n return [positions[arrayIdx], positions[arrayIdx + 1], positions[arrayIdx + 2]];\r\n }\r\n\r\n private _preprocess(positions: number[], previous: number[], next: number[], side: number[], uvs: number[]) {\r\n const l = positions.length / 6;\r\n\r\n let v: number[] = [];\r\n\r\n if (GreasedLineMesh._CompareV3(0, l - 1, positions)) {\r\n v = GreasedLineMesh._CopyV3(l - 2, positions);\r\n } else {\r\n v = GreasedLineMesh._CopyV3(0, positions);\r\n }\r\n previous.push(v[0], v[1], v[2]);\r\n previous.push(v[0], v[1], v[2]);\r\n\r\n for (let j = 0; j < l; j++) {\r\n side.push(1);\r\n side.push(-1);\r\n\r\n // uvs\r\n if (!this._options.uvs) {\r\n uvs.push(j / (l - 1), 0);\r\n uvs.push(j / (l - 1), 1);\r\n }\r\n\r\n if (j < l - 1) {\r\n v = GreasedLineMesh._CopyV3(j, positions);\r\n previous.push(v[0], v[1], v[2]);\r\n previous.push(v[0], v[1], v[2]);\r\n }\r\n if (j > 0) {\r\n v = GreasedLineMesh._CopyV3(j, positions);\r\n next.push(v[0], v[1], v[2]);\r\n next.push(v[0], v[1], v[2]);\r\n }\r\n }\r\n\r\n if (GreasedLineMesh._CompareV3(l - 1, 0, positions)) {\r\n v = GreasedLineMesh._CopyV3(1, positions);\r\n } else {\r\n v = GreasedLineMesh._CopyV3(l - 1, positions);\r\n }\r\n next.push(v[0], v[1], v[2]);\r\n next.push(v[0], v[1], v[2]);\r\n\r\n return {\r\n previous,\r\n next,\r\n uvs,\r\n side,\r\n };\r\n }\r\n\r\n protected _createVertexBuffers() {\r\n const vertexData = super._createVertexBuffers();\r\n\r\n const engine = this._scene.getEngine();\r\n\r\n const previousAndSideBuffer = new Buffer(engine, this._previousAndSide, false, 4);\r\n this.setVerticesBuffer(previousAndSideBuffer.createVertexBuffer(\"grl_previousAndSide\", 0, 4));\r\n\r\n const nextAndCountersBuffer = new Buffer(engine, this._nextAndCounters, false, 4);\r\n this.setVerticesBuffer(nextAndCountersBuffer.createVertexBuffer(\"grl_nextAndCounters\", 0, 4));\r\n\r\n const widthBuffer = new Buffer(engine, this._widths, this._updatable, 1);\r\n this.setVerticesBuffer(widthBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthBuffer;\r\n\r\n const colorPointersBuffer = new Buffer(engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n this._colorPointersBuffer = colorPointersBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLineMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,IAAI,CAAC,sBAAsB,GAAG,CAAC,UAAe,EAAE,KAAY,EAAQ,EAAE;IAClE,OAAO,eAAe,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,mBAAmB;IAcpD;;;;;OAKG;IACH,YACoB,IAAY,EAC5B,KAAY,EACZ,QAAgC;QAEhC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAJb,SAAI,GAAJ,IAAI,CAAQ;QAZhC;;WAEG;QACI,0BAAqB,GAAG,GAAG,CAAC;QAe/B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC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kB,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3E,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC;QAEjC,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1F,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAC;QAEhD,OAAO,UAAU,CAAC;IACtB,CAAC;;AA3Wc,wBAAQ,GAAG,IAAI,OAAO,EAAE,AAAhB,CAAiB;AACzB,sBAAM,GAAG,IAAI,OAAO,EAAE,AAAhB,CAAiB;AACvB,+BAAe,GAAG,IAAI,OAAO,EAAE,AAAhB,CAAiB;AAChC,6BAAa,GAAG,IAAI,OAAO,EAAE,AAAhB,CAAiB","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { Ray, TrianglePickingPredicate } from \"../../Culling/ray\";\r\nimport { Buffer, VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh } from \"./greasedLineBaseMesh\";\r\n\r\nMesh._GreasedLineMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineMesh extends GreasedLineBaseMesh {\r\n private _previousAndSide: number[];\r\n private _nextAndCounters: number[];\r\n\r\n private static _V_START = new Vector3();\r\n private static _V_END = new Vector3();\r\n private static _V_OFFSET_START = new Vector3();\r\n private static _V_OFFSET_END = new Vector3();\r\n\r\n /**\r\n * Treshold used to pick the mesh\r\n */\r\n public intersectionThreshold = 0.1;\r\n\r\n /**\r\n * GreasedLineMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n */\r\n constructor(\r\n public readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, _options);\r\n\r\n this._previousAndSide = [];\r\n this._nextAndCounters = [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points));\r\n }\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n this._points.forEach((p) => {\r\n for (let jj = 0; jj < p.length; jj += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n });\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(0);\r\n }\r\n\r\n protected _setPoints(points: number[][]) {\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n\r\n points.forEach((p) => {\r\n const counters: number[] = [];\r\n const positions: number[] = [];\r\n const indices: number[] = [];\r\n\r\n const totalLength = GreasedLineTools.GetLineLength(p);\r\n for (let j = 0, jj = 0; jj < p.length; j++, jj += 3) {\r\n const partialLine = p.slice(0, jj + 3);\r\n const partialLineLength = GreasedLineTools.GetLineLength(partialLine);\r\n const c = partialLineLength / totalLength;\r\n\r\n positions.push(p[jj], p[jj + 1], p[jj + 2]);\r\n positions.push(p[jj], p[jj + 1], p[jj + 2]);\r\n counters.push(c);\r\n counters.push(c);\r\n\r\n if (jj < p.length - 3) {\r\n const n = j * 2 + indiceOffset;\r\n indices.push(n, n + 1, n + 2);\r\n indices.push(n + 2, n + 1, n + 3);\r\n }\r\n }\r\n\r\n indiceOffset += (p.length / 3) * 2;\r\n\r\n const previous: number[] = [];\r\n const next: number[] = [];\r\n const side: number[] = [];\r\n let uvs: number[] = [];\r\n\r\n this._preprocess(positions, previous, next, side, uvs);\r\n\r\n for (const vp of positions) {\r\n this._vertexPositions.push(vp);\r\n }\r\n\r\n for (const i of indices) {\r\n this._indices.push(i);\r\n }\r\n\r\n for (let i = 0; i < side.length; i++) {\r\n this._previousAndSide.push(previous[i * 3], previous[i * 3 + 1], previous[i * 3 + 2], side[i]);\r\n this._nextAndCounters.push(next[i * 3], next[i * 3 + 1], next[i * 3 + 2], counters[i]);\r\n }\r\n\r\n uvs = this._options.uvs ?? uvs;\r\n for (const uv of uvs) {\r\n this._uvs.push(uv);\r\n }\r\n });\r\n\r\n if (!this._lazy) {\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers();\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions = {};\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"]);\r\n\r\n const cloned = new GreasedLineMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineMesh\r\n * @param parsedMesh the serialized GreasedLineMesh\r\n * @param scene the scene to create the GreasedLineMesh in\r\n * @returns the created GreasedLineMesh\r\n */\r\n public static Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const result = new GreasedLineMesh(name, scene, lineOptions);\r\n return result;\r\n }\r\n\r\n protected _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._previousAndSide = [];\r\n this._nextAndCounters = [];\r\n }\r\n /**\r\n * Checks whether a ray is intersecting this GreasedLineMesh\r\n * @param ray ray to check the intersection of this mesh with\r\n * @param fastCheck not supported\r\n * @param trianglePredicate not supported\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param worldToUse not supported\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @returns the picking info\r\n */\r\n public intersects(\r\n ray: Ray,\r\n fastCheck?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate,\r\n onlyBoundingInfo = false,\r\n worldToUse?: Matrix,\r\n skipBoundingInfo = false\r\n ): PickingInfo {\r\n const pickingInfo = new PickingInfo();\r\n const intersections = this.findAllIntersections(ray, fastCheck, trianglePredicate, onlyBoundingInfo, worldToUse, skipBoundingInfo, true);\r\n if (intersections?.length === 1) {\r\n const intersection = intersections[0];\r\n pickingInfo.hit = true;\r\n pickingInfo.distance = intersection.distance;\r\n pickingInfo.ray = ray;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.pickedPoint = intersection.point;\r\n }\r\n return pickingInfo;\r\n }\r\n\r\n /**\r\n * Gets all intersections of a ray and the line\r\n * @param ray Ray to check the intersection of this mesh with\r\n * @param _fastCheck not supported\r\n * @param _trianglePredicate not supported\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param _worldToUse not supported\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @param firstOnly If true, the first and only intersection is immediatelly returned if found\r\n * @returns intersection(s)\r\n */\r\n public findAllIntersections(\r\n ray: Ray,\r\n _fastCheck?: boolean,\r\n _trianglePredicate?: TrianglePickingPredicate,\r\n onlyBoundingInfo = false,\r\n _worldToUse?: Matrix,\r\n skipBoundingInfo = false,\r\n firstOnly = false\r\n ): { distance: number; point: Vector3 }[] | undefined {\r\n if (onlyBoundingInfo && !skipBoundingInfo && ray.intersectsSphere(this._boundingSphere, this.intersectionThreshold) === false) {\r\n return;\r\n }\r\n\r\n const indices = this.getIndices();\r\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n const widths = this._widths;\r\n\r\n const lineWidth = this.greasedLineMaterial?.width ?? 1;\r\n\r\n const intersects = [];\r\n if (indices && positions && widths) {\r\n let i = 0,\r\n l = 0;\r\n for (i = 0, l = indices.length - 1; i < l; i += 3) {\r\n const a = indices[i];\r\n const b = indices[i + 1];\r\n\r\n GreasedLineMesh._V_START.fromArray(positions, a * 3);\r\n GreasedLineMesh._V_END.fromArray(positions, b * 3);\r\n\r\n if (this._offsets) {\r\n GreasedLineMesh._V_OFFSET_START.fromArray(this._offsets, a * 3);\r\n GreasedLineMesh._V_OFFSET_END.fromArray(this._offsets, b * 3);\r\n GreasedLineMesh._V_START.addInPlace(GreasedLineMesh._V_OFFSET_START);\r\n GreasedLineMesh._V_END.addInPlace(GreasedLineMesh._V_OFFSET_END);\r\n }\r\n\r\n const iFloored = Math.floor(i / 3);\r\n const width = widths[iFloored] !== undefined ? widths[iFloored] : 1;\r\n const precision = (this.intersectionThreshold * (lineWidth * width)) / 2;\r\n\r\n const distance = ray.intersectionSegment(GreasedLineMesh._V_START, GreasedLineMesh._V_END, precision);\r\n if (distance !== -1) {\r\n intersects.push({\r\n distance: distance,\r\n point: ray.direction.normalize().multiplyByFloats(distance, distance, distance).add(ray.origin),\r\n });\r\n if (firstOnly) {\r\n return intersects;\r\n }\r\n }\r\n }\r\n i = l;\r\n }\r\n\r\n return intersects;\r\n }\r\n\r\n private get _boundingSphere() {\r\n return this.getBoundingInfo().boundingSphere;\r\n }\r\n\r\n private static _CompareV3(positionIdx1: number, positionIdx2: number, positions: number[]) {\r\n const arrayIdx1 = positionIdx1 * 6;\r\n const arrayIdx2 = positionIdx2 * 6;\r\n return positions[arrayIdx1] === positions[arrayIdx2] && positions[arrayIdx1 + 1] === positions[arrayIdx2 + 1] && positions[arrayIdx1 + 2] === positions[arrayIdx2 + 2];\r\n }\r\n\r\n private static _CopyV3(positionIdx: number, positions: number[]) {\r\n const arrayIdx = positionIdx * 6;\r\n return [positions[arrayIdx], positions[arrayIdx + 1], positions[arrayIdx + 2]];\r\n }\r\n\r\n private _preprocess(positions: number[], previous: number[], next: number[], side: number[], uvs: number[]) {\r\n const l = positions.length / 6;\r\n\r\n let v: number[] = [];\r\n\r\n if (GreasedLineMesh._CompareV3(0, l - 1, positions)) {\r\n v = GreasedLineMesh._CopyV3(l - 2, positions);\r\n } else {\r\n v = GreasedLineMesh._CopyV3(0, positions);\r\n }\r\n previous.push(v[0], v[1], v[2]);\r\n previous.push(v[0], v[1], v[2]);\r\n\r\n for (let j = 0; j < l; j++) {\r\n side.push(1);\r\n side.push(-1);\r\n\r\n // uvs\r\n if (!this._options.uvs) {\r\n uvs.push(j / (l - 1), 0);\r\n uvs.push(j / (l - 1), 1);\r\n }\r\n\r\n if (j < l - 1) {\r\n v = GreasedLineMesh._CopyV3(j, positions);\r\n previous.push(v[0], v[1], v[2]);\r\n previous.push(v[0], v[1], v[2]);\r\n }\r\n if (j > 0) {\r\n v = GreasedLineMesh._CopyV3(j, positions);\r\n next.push(v[0], v[1], v[2]);\r\n next.push(v[0], v[1], v[2]);\r\n }\r\n }\r\n\r\n if (GreasedLineMesh._CompareV3(l - 1, 0, positions)) {\r\n v = GreasedLineMesh._CopyV3(1, positions);\r\n } else {\r\n v = GreasedLineMesh._CopyV3(l - 1, positions);\r\n }\r\n next.push(v[0], v[1], v[2]);\r\n next.push(v[0], v[1], v[2]);\r\n\r\n return {\r\n previous,\r\n next,\r\n uvs,\r\n side,\r\n };\r\n }\r\n\r\n protected _createVertexBuffers() {\r\n const vertexData = super._createVertexBuffers();\r\n\r\n const engine = this._scene.getEngine();\r\n\r\n const previousAndSideBuffer = new Buffer(engine, this._previousAndSide, false, 4);\r\n this.setVerticesBuffer(previousAndSideBuffer.createVertexBuffer(\"grl_previousAndSide\", 0, 4));\r\n\r\n const nextAndCountersBuffer = new Buffer(engine, this._nextAndCounters, false, 4);\r\n this.setVerticesBuffer(nextAndCountersBuffer.createVertexBuffer(\"grl_nextAndCounters\", 0, 4));\r\n\r\n const widthBuffer = new Buffer(engine, this._widths, this._updatable, 1);\r\n this.setVerticesBuffer(widthBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthBuffer;\r\n\r\n const colorPointersBuffer = new Buffer(engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n this._colorPointersBuffer = colorPointersBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLineRibbonMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineRibbonMesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,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C;AAEnB,2DAAqC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACjH,0DAAoC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,yBAAyB,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/G,6CAAuB,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpG;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,2DAA2D;AAC3H;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,UAAU,CAAC;AAChD;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,YAAY,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Quaternion, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions, GreasedLineRibbonOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"./greasedLineBaseMesh\";\r\n\r\nMesh._GreasedLineRibbonMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineRibbonMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineRibbonMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineRibbonMesh extends GreasedLineBaseMesh {\r\n /**\r\n * Default line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _RightHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);\r\n\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XY plane\r\n */\r\n public static DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XZ plane\r\n */\r\n public static DIRECTION_XZ = Vector3.UpReadOnly;\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the YZ plane\r\n */\r\n public static DIRECTION_YZ = Vector3.LeftReadOnly;\r\n\r\n private _paths: Vector3[][];\r\n private _pathsOptions: { options: GreasedLineMeshOptions; pathCount: number }[];\r\n private _vSegmentLengths: number[][];\r\n private _uSegmentLengths: number[][];\r\n private _vTotalLengths: number[];\r\n private _uTotalLengths: number[];\r\n\r\n private _counters: number[];\r\n private _slopes: number[];\r\n private _ribbonWidths: number[];\r\n\r\n /**\r\n * GreasedLineRibbonMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh\r\n */\r\n constructor(public readonly name: string, scene: Scene, _options: GreasedLineMeshOptions, _pathOptions?: { options: GreasedLineMeshOptions; pathCount: number }[]) {\r\n super(name, scene, _options);\r\n\r\n if (!_options.ribbonOptions) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptions' is not set.\";\r\n }\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._widths = _options.widths ?? [];\r\n this._ribbonWidths = [];\r\n this._pathsOptions = _pathOptions ?? [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);\r\n }\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n */\r\n public override addPoints(points: number[][], options: GreasedLineMeshOptions, hasPathOptions = false) {\r\n if (!options.ribbonOptions) {\r\n throw \"addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.\";\r\n }\r\n\r\n if (!hasPathOptions) {\r\n this._pathsOptions.push({ options, pathCount: points.length });\r\n }\r\n\r\n super.addPoints(points, options);\r\n }\r\n\r\n /**\r\n * \"GreasedLineRibbonMesh\"\r\n * @returns \"GreasedLineRibbonMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GreasedLineRibbonMesh\";\r\n }\r\n\r\n /**\r\n * Return true if the line was created from two edge paths or one points path.\r\n * In this case the line is always flat.\r\n */\r\n public get isFlatLine() {\r\n return this._paths.length < 3;\r\n }\r\n\r\n /**\r\n * Returns the slopes of the line at each point relative to the center of the line\r\n */\r\n get slopes() {\r\n return this._slopes;\r\n }\r\n\r\n /**\r\n * Set the slopes of the line at each point relative to the center of the line\r\n */\r\n set slopes(slopes: number[]) {\r\n this._slopes = slopes;\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n for (let i = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const points = this._points[i];\r\n\r\n if (pathOptions.ribbonOptions!.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n for (let k = 0; k < pathCount; k++) {\r\n for (let j = 0; j < points.length; j += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n }\r\n } else {\r\n for (let j = 0; j < points.length; j += 3) {\r\n for (let k = 0; k < pathCount; k++) {\r\n this._colorPointers.push(colorPointer);\r\n }\r\n colorPointer++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(1);\r\n }\r\n\r\n protected _setPoints(points: number[][], _options: GreasedLineMeshOptions) {\r\n if (!this._options.ribbonOptions) {\r\n throw \"No 'GreasedLineMeshOptions.ribbonOptions' provided.\";\r\n }\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let directionPlanes: Vector3[];\r\n for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const subPoints = points.slice(c, c + pathCount);\r\n c += pathCount;\r\n if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {\r\n indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints) as Vector3[][], indiceOffset, pathOptions);\r\n } else {\r\n if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {\r\n if (!pathOptions.ribbonOptions!.directions) {\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.\";\r\n }\r\n directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions!.directions);\r\n }\r\n subPoints.forEach((p, idx) => {\r\n const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(\r\n p,\r\n pathOptions.ribbonOptions!,\r\n this._scene.useRightHandedSystem,\r\n directionPlanes ? directionPlanes[idx] : directionPlanes\r\n );\r\n indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);\r\n });\r\n }\r\n }\r\n\r\n if (!this._lazy) {\r\n this._createVertexBuffers();\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n private static _GetDirectionPlanesFromDirectionsOption(count: number, directions: Vector3 | Vector3[]) {\r\n if (Array.isArray(directions)) {\r\n return directions;\r\n }\r\n\r\n return new Array(count).fill(directions) as Vector3[];\r\n }\r\n\r\n private static _CreateRibbonVertexData(pathArray: Vector3[][], options: GreasedLineMeshOptions) {\r\n const numOfPaths = pathArray.length;\r\n if (numOfPaths < 2) {\r\n throw \"Minimum of two paths are required to create a GreasedLineRibbonMesh.\";\r\n }\r\n\r\n const positions = [];\r\n const indices = [];\r\n\r\n const path = pathArray[0];\r\n for (let i = 0; i < path.length; i++) {\r\n for (let pi = 0; pi < pathArray.length; pi++) {\r\n const v = pathArray[pi][i];\r\n positions.push(v.x, v.y, v.z);\r\n }\r\n }\r\n\r\n const v: number[] = [1, 0, numOfPaths];\r\n const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED ?? false;\r\n\r\n const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;\r\n if (numOfPaths > 2) {\r\n for (let i = 0; i < path.length - 1; i++) {\r\n v[0] = 1 + numOfPaths * i;\r\n v[1] = numOfPaths * i;\r\n v[2] = (i + 1) * numOfPaths;\r\n for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {\r\n if (pi % 2 !== 0) {\r\n v[2] += 1;\r\n }\r\n if (pi % 2 === 0 && pi > 0) {\r\n v[0] += 1;\r\n v[1] += 1;\r\n }\r\n indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);\r\n if (doubleSided) {\r\n indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < positions.length / 3 - 3; i += 2) {\r\n indices.push(i, i + 1, i + 2);\r\n indices.push(i + 2, i + 1, i + 3);\r\n if (doubleSided) {\r\n indices.push(i + 1, i, i + 2);\r\n indices.push(i + 1, i + 2, i + 3);\r\n }\r\n }\r\n }\r\n if (closePath) {\r\n let lastIndice = numOfPaths * (path.length - 1);\r\n for (let pi = 0; pi < numOfPaths - 1; pi++) {\r\n indices.push(lastIndice, pi + 1, pi);\r\n indices.push(lastIndice + 1, pi + 1, lastIndice);\r\n if (doubleSided) {\r\n indices.push(pi, pi + 1, lastIndice);\r\n indices.push(lastIndice, pi + 1, lastIndice + 1);\r\n }\r\n lastIndice++;\r\n }\r\n }\r\n\r\n return {\r\n positions,\r\n indices,\r\n };\r\n }\r\n\r\n private _preprocess(pathArray: Vector3[][], indiceOffset: number, options: GreasedLineMeshOptions) {\r\n this._paths = pathArray;\r\n\r\n const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);\r\n\r\n const positions = ribbonVertexData.positions;\r\n\r\n if (!this._options.widths) {\r\n throw \"No 'GreasedLineMeshOptions.widths' table is specified.\";\r\n }\r\n\r\n for (const p of positions) {\r\n this._vertexPositions.push(p);\r\n }\r\n\r\n let pathArrayCopy = pathArray;\r\n if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {\r\n pathArrayCopy = [];\r\n for (let i = 0; i < pathArray.length; i++) {\r\n const pathCopy = pathArray[i].slice();\r\n pathCopy.push(pathArray[i][0].clone());\r\n pathArrayCopy.push(pathCopy);\r\n }\r\n }\r\n\r\n this._calculateSegmentLengths(pathArrayCopy);\r\n\r\n const pathArrayLength = pathArrayCopy.length;\r\n const previousCounters = new Array(pathArrayLength).fill(0);\r\n for (let i = 0; i < pathArrayCopy[0].length; i++) {\r\n let v = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];\r\n this._counters.push(counter);\r\n this._uvs.push(counter, v);\r\n\r\n previousCounters[pi] = counter;\r\n v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];\r\n }\r\n }\r\n\r\n for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {\r\n const widthLower = this._uSegmentLengths[i][0] / 2;\r\n const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);\r\n for (let pi = 0; pi < pathArrayLength - 2; pi++) {\r\n this._ribbonWidths.push(0);\r\n }\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);\r\n }\r\n\r\n const slopes =\r\n options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS\r\n ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)\r\n : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);\r\n for (const s of slopes) {\r\n this._slopes.push(s);\r\n }\r\n\r\n if (ribbonVertexData.indices) {\r\n for (let i = 0; i < ribbonVertexData.indices.length; i++) {\r\n this._indices.push(ribbonVertexData.indices[i] + indiceOffset);\r\n }\r\n }\r\n indiceOffset += positions.length / 3;\r\n\r\n return indiceOffset;\r\n }\r\n\r\n private static _ConvertToRibbonPath(points: number[], ribbonInfo: GreasedLineRibbonOptions, rightHandedSystem: boolean, directionPlane?: Vector3) {\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.\";\r\n }\r\n const path1 = [];\r\n const path2 = [];\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n const width = ribbonInfo.width! / 2;\r\n const pointVectors = GreasedLineTools.ToVector3Array(points) as Vector3[];\r\n let direction: Nullable<Vector3> = null;\r\n let fatDirection: Nullable<Vector3> = null;\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {\r\n // set the direction plane from the first line segment for the whole line\r\n directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);\r\n }\r\n\r\n for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {\r\n const p1 = pointVectors[i];\r\n const p2 = pointVectors[i + 1];\r\n\r\n if (directionPlane) {\r\n direction = <Vector3>directionPlane;\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {\r\n direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);\r\n } else {\r\n // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED\r\n const directionTemp = p2.subtract(p1);\r\n directionTemp.applyRotationQuaternionInPlace(\r\n directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z\r\n ? rightHandedSystem\r\n ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftReadOnlyQuaternion\r\n );\r\n direction = directionTemp.normalize();\r\n }\r\n\r\n fatDirection = direction.multiplyByFloats(width, width, width);\r\n path1.push(p1.add(fatDirection));\r\n path2.push(p1.subtract(fatDirection));\r\n }\r\n if (!directionPlane) {\r\n path1.push(pointVectors[pointVectors.length - 1].add(fatDirection!));\r\n path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection!));\r\n }\r\n }\r\n return [path1, path2];\r\n }\r\n\r\n private static _GetDirectionFromPoints(p1: Vector3, p2: Vector3, previousDirection: Nullable<Vector3>) {\r\n // handle straight lines\r\n if (p1.x === p2.x && (!previousDirection || previousDirection?.x === 1)) {\r\n return GreasedLineRibbonMesh.DIRECTION_YZ;\r\n }\r\n\r\n if (p1.y === p2.y) {\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n if (p1.z === p2.z) {\r\n return GreasedLineRibbonMesh.DIRECTION_XY;\r\n }\r\n\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineRibbonMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions: any = {};\r\n const pathOptionsCloned: any = [];\r\n DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned);\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"]);\r\n\r\n const cloned = new GreasedLineRibbonMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions, pathOptionsCloned);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineRibbonMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n serializationObject.pathsOptions = this._pathsOptions;\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineRibbonMesh\r\n * @param parsedMesh the serialized GreasedLineRibbonMesh\r\n * @param scene the scene to create the GreasedLineRibbonMesh in\r\n * @returns the created GreasedLineRibbonMesh\r\n */\r\n public static Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const pathOptions = parsedMesh.pathOptions;\r\n const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);\r\n return result;\r\n }\r\n\r\n protected _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._ribbonWidths = [];\r\n }\r\n\r\n private _calculateSegmentLengths(pathArray: Vector3[][]) {\r\n const pathArrayLength = pathArray.length;\r\n this._vSegmentLengths = new Array(pathArrayLength);\r\n this._vTotalLengths = new Array(pathArrayLength);\r\n let length = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const points = pathArray[pi];\r\n this._vSegmentLengths[pi] = [0]; // first point has 0 distance\r\n length = 0;\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here\r\n length += l;\r\n this._vSegmentLengths[pi].push(l);\r\n }\r\n this._vTotalLengths[pi] = length;\r\n }\r\n\r\n const positionsLength = pathArray[0].length;\r\n this._uSegmentLengths = new Array(positionsLength).fill([]);\r\n this._uTotalLengths = new Array(positionsLength).fill([]);\r\n const uLength = new Vector3();\r\n for (let i = 0; i < positionsLength; i++) {\r\n length = 0;\r\n for (let pi = 1; pi < pathArrayLength; pi++) {\r\n pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);\r\n const l = uLength.length(); // must be length()\r\n length += l;\r\n this._uSegmentLengths[i].push(l);\r\n }\r\n this._uTotalLengths[i] = length;\r\n }\r\n }\r\n\r\n private static _CalculateSlopes(paths: Vector3[][]) {\r\n const points1 = paths[0];\r\n const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];\r\n const slopes: number[] = [];\r\n\r\n const slope = new Vector3();\r\n for (let i = 0; i < points1.length; i++) {\r\n for (let pi = 0; pi < paths.length; pi++) {\r\n if (pi === 0 || pi === paths.length - 1) {\r\n points1[i].subtract(points2[i]).normalizeToRef(slope);\r\n slopes.push(slope.x, slope.y, slope.z);\r\n slopes.push(-slope.x, -slope.y, -slope.z);\r\n } else {\r\n slopes.push(0, 0, 0, 0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n return slopes;\r\n }\r\n\r\n protected _createVertexBuffers() {\r\n this._uvs = this._options.uvs ?? this._uvs;\r\n const vertexData = super._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n\r\n const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);\r\n this.setVerticesBuffer(countersBuffer.createVertexBuffer(\"grl_counters\", 0, 1));\r\n\r\n const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n\r\n const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);\r\n this.setVerticesBuffer(slopesBuffer.createVertexBuffer(\"grl_slopes\", 0, 3));\r\n\r\n const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);\r\n this.setVerticesBuffer(widthsBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthsBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLineRibbonMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineRibbonMesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,kCAAkC,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEzJ,IAAI,CAAC,4BAA4B,GAAG,CAAC,UAAe,EAAE,KAAY,EAAQ,EAAE;IACxE,OAAO,qBAAqB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,mBAAmB;IAkC1D;;;;;;OAMG;IACH,YACoB,IAAY,EAC5B,KAAY,EACZ,QAAgC,EAChC,YAAuE;;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;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,YAAY,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Quaternion, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions, GreasedLineRibbonOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"./greasedLineBaseMesh\";\r\n\r\nMesh._GreasedLineRibbonMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineRibbonMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineRibbonMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineRibbonMesh extends GreasedLineBaseMesh {\r\n /**\r\n * Default line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _RightHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);\r\n\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XY plane\r\n */\r\n public static DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XZ plane\r\n */\r\n public static DIRECTION_XZ = Vector3.UpReadOnly;\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the YZ plane\r\n */\r\n public static DIRECTION_YZ = Vector3.LeftReadOnly;\r\n\r\n private _paths: Vector3[][];\r\n private _pathsOptions: { options: GreasedLineMeshOptions; pathCount: number }[];\r\n private _vSegmentLengths: number[][];\r\n private _uSegmentLengths: number[][];\r\n private _vTotalLengths: number[];\r\n private _uTotalLengths: number[];\r\n\r\n private _counters: number[];\r\n private _slopes: number[];\r\n private _ribbonWidths: number[];\r\n\r\n /**\r\n * GreasedLineRibbonMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh\r\n */\r\n constructor(\r\n public readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions,\r\n _pathOptions?: { options: GreasedLineMeshOptions; pathCount: number }[]\r\n ) {\r\n super(name, scene, _options);\r\n\r\n if (!_options.ribbonOptions) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptions' is not set.\";\r\n }\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._widths = _options.widths ?? [];\r\n this._ribbonWidths = [];\r\n this._pathsOptions = _pathOptions ?? [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);\r\n }\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n */\r\n public override addPoints(points: number[][], options: GreasedLineMeshOptions, hasPathOptions = false) {\r\n if (!options.ribbonOptions) {\r\n throw \"addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.\";\r\n }\r\n\r\n if (!hasPathOptions) {\r\n this._pathsOptions.push({ options, pathCount: points.length });\r\n }\r\n\r\n super.addPoints(points, options);\r\n }\r\n\r\n /**\r\n * \"GreasedLineRibbonMesh\"\r\n * @returns \"GreasedLineRibbonMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GreasedLineRibbonMesh\";\r\n }\r\n\r\n /**\r\n * Return true if the line was created from two edge paths or one points path.\r\n * In this case the line is always flat.\r\n */\r\n public get isFlatLine() {\r\n return this._paths.length < 3;\r\n }\r\n\r\n /**\r\n * Returns the slopes of the line at each point relative to the center of the line\r\n */\r\n get slopes() {\r\n return this._slopes;\r\n }\r\n\r\n /**\r\n * Set the slopes of the line at each point relative to the center of the line\r\n */\r\n set slopes(slopes: number[]) {\r\n this._slopes = slopes;\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n for (let i = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const points = this._points[i];\r\n\r\n if (pathOptions.ribbonOptions!.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n for (let k = 0; k < pathCount; k++) {\r\n for (let j = 0; j < points.length; j += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n }\r\n } else {\r\n for (let j = 0; j < points.length; j += 3) {\r\n for (let k = 0; k < pathCount; k++) {\r\n this._colorPointers.push(colorPointer);\r\n }\r\n colorPointer++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(1);\r\n }\r\n\r\n protected _setPoints(points: number[][], _options: GreasedLineMeshOptions) {\r\n if (!this._options.ribbonOptions) {\r\n throw \"No 'GreasedLineMeshOptions.ribbonOptions' provided.\";\r\n }\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let directionPlanes: Vector3[];\r\n for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const subPoints = points.slice(c, c + pathCount);\r\n c += pathCount;\r\n if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {\r\n indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints) as Vector3[][], indiceOffset, pathOptions);\r\n } else {\r\n if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {\r\n if (!pathOptions.ribbonOptions!.directions) {\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.\";\r\n }\r\n directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions!.directions);\r\n }\r\n subPoints.forEach((p, idx) => {\r\n const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(\r\n p,\r\n pathOptions.ribbonOptions!,\r\n this._scene.useRightHandedSystem,\r\n directionPlanes ? directionPlanes[idx] : directionPlanes\r\n );\r\n indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);\r\n });\r\n }\r\n }\r\n\r\n if (!this._lazy) {\r\n this._createVertexBuffers();\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n private static _GetDirectionPlanesFromDirectionsOption(count: number, directions: Vector3 | Vector3[]) {\r\n if (Array.isArray(directions)) {\r\n return directions;\r\n }\r\n\r\n return new Array(count).fill(directions) as Vector3[];\r\n }\r\n\r\n private static _CreateRibbonVertexData(pathArray: Vector3[][], options: GreasedLineMeshOptions) {\r\n const numOfPaths = pathArray.length;\r\n if (numOfPaths < 2) {\r\n throw \"Minimum of two paths are required to create a GreasedLineRibbonMesh.\";\r\n }\r\n\r\n const positions = [];\r\n const indices = [];\r\n\r\n const path = pathArray[0];\r\n for (let i = 0; i < path.length; i++) {\r\n for (let pi = 0; pi < pathArray.length; pi++) {\r\n const v = pathArray[pi][i];\r\n positions.push(v.x, v.y, v.z);\r\n }\r\n }\r\n\r\n const v: number[] = [1, 0, numOfPaths];\r\n const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED ?? false;\r\n\r\n const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;\r\n if (numOfPaths > 2) {\r\n for (let i = 0; i < path.length - 1; i++) {\r\n v[0] = 1 + numOfPaths * i;\r\n v[1] = numOfPaths * i;\r\n v[2] = (i + 1) * numOfPaths;\r\n for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {\r\n if (pi % 2 !== 0) {\r\n v[2] += 1;\r\n }\r\n if (pi % 2 === 0 && pi > 0) {\r\n v[0] += 1;\r\n v[1] += 1;\r\n }\r\n indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);\r\n if (doubleSided) {\r\n indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < positions.length / 3 - 3; i += 2) {\r\n indices.push(i, i + 1, i + 2);\r\n indices.push(i + 2, i + 1, i + 3);\r\n if (doubleSided) {\r\n indices.push(i + 1, i, i + 2);\r\n indices.push(i + 1, i + 2, i + 3);\r\n }\r\n }\r\n }\r\n if (closePath) {\r\n let lastIndice = numOfPaths * (path.length - 1);\r\n for (let pi = 0; pi < numOfPaths - 1; pi++) {\r\n indices.push(lastIndice, pi + 1, pi);\r\n indices.push(lastIndice + 1, pi + 1, lastIndice);\r\n if (doubleSided) {\r\n indices.push(pi, pi + 1, lastIndice);\r\n indices.push(lastIndice, pi + 1, lastIndice + 1);\r\n }\r\n lastIndice++;\r\n }\r\n }\r\n\r\n return {\r\n positions,\r\n indices,\r\n };\r\n }\r\n\r\n private _preprocess(pathArray: Vector3[][], indiceOffset: number, options: GreasedLineMeshOptions) {\r\n this._paths = pathArray;\r\n\r\n const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);\r\n\r\n const positions = ribbonVertexData.positions;\r\n\r\n if (!this._options.widths) {\r\n throw \"No 'GreasedLineMeshOptions.widths' table is specified.\";\r\n }\r\n\r\n for (const p of positions) {\r\n this._vertexPositions.push(p);\r\n }\r\n\r\n let pathArrayCopy = pathArray;\r\n if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {\r\n pathArrayCopy = [];\r\n for (let i = 0; i < pathArray.length; i++) {\r\n const pathCopy = pathArray[i].slice();\r\n pathCopy.push(pathArray[i][0].clone());\r\n pathArrayCopy.push(pathCopy);\r\n }\r\n }\r\n\r\n this._calculateSegmentLengths(pathArrayCopy);\r\n\r\n const pathArrayLength = pathArrayCopy.length;\r\n const previousCounters = new Array(pathArrayLength).fill(0);\r\n for (let i = 0; i < pathArrayCopy[0].length; i++) {\r\n let v = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];\r\n this._counters.push(counter);\r\n this._uvs.push(counter, v);\r\n\r\n previousCounters[pi] = counter;\r\n v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];\r\n }\r\n }\r\n\r\n for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {\r\n const widthLower = this._uSegmentLengths[i][0] / 2;\r\n const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);\r\n for (let pi = 0; pi < pathArrayLength - 2; pi++) {\r\n this._ribbonWidths.push(0);\r\n }\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);\r\n }\r\n\r\n const slopes =\r\n options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS\r\n ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)\r\n : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);\r\n for (const s of slopes) {\r\n this._slopes.push(s);\r\n }\r\n\r\n if (ribbonVertexData.indices) {\r\n for (let i = 0; i < ribbonVertexData.indices.length; i++) {\r\n this._indices.push(ribbonVertexData.indices[i] + indiceOffset);\r\n }\r\n }\r\n indiceOffset += positions.length / 3;\r\n\r\n return indiceOffset;\r\n }\r\n\r\n private static _ConvertToRibbonPath(points: number[], ribbonInfo: GreasedLineRibbonOptions, rightHandedSystem: boolean, directionPlane?: Vector3) {\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.\";\r\n }\r\n const path1 = [];\r\n const path2 = [];\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n const width = ribbonInfo.width! / 2;\r\n const pointVectors = GreasedLineTools.ToVector3Array(points) as Vector3[];\r\n let direction: Nullable<Vector3> = null;\r\n let fatDirection: Nullable<Vector3> = null;\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {\r\n // set the direction plane from the first line segment for the whole line\r\n directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);\r\n }\r\n\r\n for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {\r\n const p1 = pointVectors[i];\r\n const p2 = pointVectors[i + 1];\r\n\r\n if (directionPlane) {\r\n direction = <Vector3>directionPlane;\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {\r\n direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);\r\n } else {\r\n // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED\r\n const directionTemp = p2.subtract(p1);\r\n directionTemp.applyRotationQuaternionInPlace(\r\n directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z\r\n ? rightHandedSystem\r\n ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftReadOnlyQuaternion\r\n );\r\n direction = directionTemp.normalize();\r\n }\r\n\r\n fatDirection = direction.multiplyByFloats(width, width, width);\r\n path1.push(p1.add(fatDirection));\r\n path2.push(p1.subtract(fatDirection));\r\n }\r\n if (!directionPlane) {\r\n path1.push(pointVectors[pointVectors.length - 1].add(fatDirection!));\r\n path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection!));\r\n }\r\n }\r\n return [path1, path2];\r\n }\r\n\r\n private static _GetDirectionFromPoints(p1: Vector3, p2: Vector3, previousDirection: Nullable<Vector3>) {\r\n // handle straight lines\r\n if (p1.x === p2.x && (!previousDirection || previousDirection?.x === 1)) {\r\n return GreasedLineRibbonMesh.DIRECTION_YZ;\r\n }\r\n\r\n if (p1.y === p2.y) {\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n if (p1.z === p2.z) {\r\n return GreasedLineRibbonMesh.DIRECTION_XY;\r\n }\r\n\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineRibbonMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions: any = {};\r\n const pathOptionsCloned: any = [];\r\n DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned);\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"]);\r\n\r\n const cloned = new GreasedLineRibbonMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions, pathOptionsCloned);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineRibbonMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n serializationObject.pathsOptions = this._pathsOptions;\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineRibbonMesh\r\n * @param parsedMesh the serialized GreasedLineRibbonMesh\r\n * @param scene the scene to create the GreasedLineRibbonMesh in\r\n * @returns the created GreasedLineRibbonMesh\r\n */\r\n public static Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const pathOptions = parsedMesh.pathOptions;\r\n const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);\r\n return result;\r\n }\r\n\r\n protected _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._ribbonWidths = [];\r\n }\r\n\r\n private _calculateSegmentLengths(pathArray: Vector3[][]) {\r\n const pathArrayLength = pathArray.length;\r\n this._vSegmentLengths = new Array(pathArrayLength);\r\n this._vTotalLengths = new Array(pathArrayLength);\r\n let length = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const points = pathArray[pi];\r\n this._vSegmentLengths[pi] = [0]; // first point has 0 distance\r\n length = 0;\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here\r\n length += l;\r\n this._vSegmentLengths[pi].push(l);\r\n }\r\n this._vTotalLengths[pi] = length;\r\n }\r\n\r\n const positionsLength = pathArray[0].length;\r\n this._uSegmentLengths = new Array(positionsLength).fill([]);\r\n this._uTotalLengths = new Array(positionsLength).fill([]);\r\n const uLength = new Vector3();\r\n for (let i = 0; i < positionsLength; i++) {\r\n length = 0;\r\n for (let pi = 1; pi < pathArrayLength; pi++) {\r\n pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);\r\n const l = uLength.length(); // must be length()\r\n length += l;\r\n this._uSegmentLengths[i].push(l);\r\n }\r\n this._uTotalLengths[i] = length;\r\n }\r\n }\r\n\r\n private static _CalculateSlopes(paths: Vector3[][]) {\r\n const points1 = paths[0];\r\n const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];\r\n const slopes: number[] = [];\r\n\r\n const slope = new Vector3();\r\n for (let i = 0; i < points1.length; i++) {\r\n for (let pi = 0; pi < paths.length; pi++) {\r\n if (pi === 0 || pi === paths.length - 1) {\r\n points1[i].subtract(points2[i]).normalizeToRef(slope);\r\n slopes.push(slope.x, slope.y, slope.z);\r\n slopes.push(-slope.x, -slope.y, -slope.z);\r\n } else {\r\n slopes.push(0, 0, 0, 0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n return slopes;\r\n }\r\n\r\n protected _createVertexBuffers() {\r\n this._uvs = this._options.uvs ?? this._uvs;\r\n const vertexData = super._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n\r\n const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);\r\n this.setVerticesBuffer(countersBuffer.createVertexBuffer(\"grl_counters\", 0, 1));\r\n\r\n const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n\r\n const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);\r\n this.setVerticesBuffer(slopesBuffer.createVertexBuffer(\"grl_slopes\", 0, 3));\r\n\r\n const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);\r\n this.setVerticesBuffer(widthsBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthsBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
|
|
@@ -2,7 +2,7 @@ import { NodeGeometryBlock } from "../../nodeGeometryBlock";
|
|
|
2
2
|
import type { NodeGeometryConnectionPoint } from "../../nodeGeometryBlockConnectionPoint";
|
|
3
3
|
import type { NodeGeometryBuildState } from "../../nodeGeometryBuildState";
|
|
4
4
|
import type { INodeGeometryExecutionContext } from "../../Interfaces/nodeGeometryExecutionContext";
|
|
5
|
-
import { Vector3 } from "../../../../Maths/math.vector";
|
|
5
|
+
import { Vector2, Vector3 } from "../../../../Maths/math.vector";
|
|
6
6
|
import type { INodeGeometryInstancingContext } from "../../Interfaces/nodeGeometryInstancingContext";
|
|
7
7
|
/**
|
|
8
8
|
* Block used to instance geometry on every face of a geometry
|
|
@@ -12,11 +12,15 @@ export declare class InstantiateOnFacesBlock extends NodeGeometryBlock implement
|
|
|
12
12
|
private _currentFaceIndex;
|
|
13
13
|
private _currentLoopIndex;
|
|
14
14
|
private _currentPosition;
|
|
15
|
+
private _currentUV;
|
|
15
16
|
private _vertex0;
|
|
16
17
|
private _vertex1;
|
|
17
18
|
private _vertex2;
|
|
18
19
|
private _tempVector0;
|
|
19
20
|
private _tempVector1;
|
|
21
|
+
private _uv0;
|
|
22
|
+
private _uv1;
|
|
23
|
+
private _uv2;
|
|
20
24
|
/**
|
|
21
25
|
* Gets or sets a boolean indicating that this block can evaluate context
|
|
22
26
|
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
@@ -57,6 +61,11 @@ export declare class InstantiateOnFacesBlock extends NodeGeometryBlock implement
|
|
|
57
61
|
* @returns the value associated with the source
|
|
58
62
|
*/
|
|
59
63
|
getOverrideNormalsContextualValue(): Vector3;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the value associated with a contextual UV1 se
|
|
66
|
+
* @returns the value associated with the source
|
|
67
|
+
*/
|
|
68
|
+
getOverrideUVs1ContextualValue(): Vector2;
|
|
60
69
|
/**
|
|
61
70
|
* Gets the current class name
|
|
62
71
|
* @returns the class name
|
|
@@ -2,7 +2,7 @@ import { __decorate } from "../../../../tslib.es6.js";
|
|
|
2
2
|
import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
|
|
3
3
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
4
4
|
import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
|
-
import { Vector3 } from "../../../../Maths/math.vector.js";
|
|
5
|
+
import { Vector2, Vector3 } from "../../../../Maths/math.vector.js";
|
|
6
6
|
import { PropertyTypeForEdition, editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
7
7
|
/**
|
|
8
8
|
* Block used to instance geometry on every face of a geometry
|
|
@@ -15,11 +15,15 @@ export class InstantiateOnFacesBlock extends NodeGeometryBlock {
|
|
|
15
15
|
constructor(name) {
|
|
16
16
|
super(name);
|
|
17
17
|
this._currentPosition = new Vector3();
|
|
18
|
+
this._currentUV = new Vector2();
|
|
18
19
|
this._vertex0 = new Vector3();
|
|
19
20
|
this._vertex1 = new Vector3();
|
|
20
21
|
this._vertex2 = new Vector3();
|
|
21
22
|
this._tempVector0 = new Vector3();
|
|
22
23
|
this._tempVector1 = new Vector3();
|
|
24
|
+
this._uv0 = new Vector2();
|
|
25
|
+
this._uv1 = new Vector2();
|
|
26
|
+
this._uv2 = new Vector2();
|
|
23
27
|
/**
|
|
24
28
|
* Gets or sets a boolean indicating that this block can evaluate context
|
|
25
29
|
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
@@ -80,6 +84,13 @@ export class InstantiateOnFacesBlock extends NodeGeometryBlock {
|
|
|
80
84
|
this._tempVector1.normalize();
|
|
81
85
|
return Vector3.Cross(this._tempVector1, this._tempVector0);
|
|
82
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets the value associated with a contextual UV1 se
|
|
89
|
+
* @returns the value associated with the source
|
|
90
|
+
*/
|
|
91
|
+
getOverrideUVs1ContextualValue() {
|
|
92
|
+
return this._currentUV;
|
|
93
|
+
}
|
|
83
94
|
/**
|
|
84
95
|
* Gets the current class name
|
|
85
96
|
* @returns the class name
|
|
@@ -152,15 +163,23 @@ export class InstantiateOnFacesBlock extends NodeGeometryBlock {
|
|
|
152
163
|
let totalDone = 0;
|
|
153
164
|
this._currentLoopIndex = 0;
|
|
154
165
|
for (this._currentFaceIndex = 0; this._currentFaceIndex < faceCount; this._currentFaceIndex++) {
|
|
155
|
-
// Extract face vertices
|
|
156
|
-
this._vertex0.fromArray(this._vertexData.positions, this._vertexData.indices[this._currentFaceIndex * 3] * 3);
|
|
157
|
-
this._vertex1.fromArray(this._vertexData.positions, this._vertexData.indices[this._currentFaceIndex * 3 + 1] * 3);
|
|
158
|
-
this._vertex2.fromArray(this._vertexData.positions, this._vertexData.indices[this._currentFaceIndex * 3 + 2] * 3);
|
|
159
166
|
accumulatedCount += instancePerFace;
|
|
160
167
|
const countPerFace = (accumulatedCount | 0) - totalDone;
|
|
161
168
|
if (countPerFace < 1) {
|
|
162
169
|
continue;
|
|
163
170
|
}
|
|
171
|
+
const faceID0 = this._vertexData.indices[this._currentFaceIndex * 3];
|
|
172
|
+
const faceID1 = this._vertexData.indices[this._currentFaceIndex * 3 + 1];
|
|
173
|
+
const faceID2 = this._vertexData.indices[this._currentFaceIndex * 3 + 2];
|
|
174
|
+
// Extract face vertices
|
|
175
|
+
this._vertex0.fromArray(this._vertexData.positions, faceID0 * 3);
|
|
176
|
+
this._vertex1.fromArray(this._vertexData.positions, faceID1 * 3);
|
|
177
|
+
this._vertex2.fromArray(this._vertexData.positions, faceID2 * 3);
|
|
178
|
+
if (this._vertexData.uvs) {
|
|
179
|
+
this._uv0.fromArray(this._vertexData.uvs, faceID0 * 2);
|
|
180
|
+
this._uv1.fromArray(this._vertexData.uvs, faceID1 * 2);
|
|
181
|
+
this._uv2.fromArray(this._vertexData.uvs, faceID2 * 2);
|
|
182
|
+
}
|
|
164
183
|
for (let faceDispatchCount = 0; faceDispatchCount < countPerFace; faceDispatchCount++) {
|
|
165
184
|
if (totalDone >= instanceCount) {
|
|
166
185
|
break;
|
|
@@ -177,6 +196,9 @@ export class InstantiateOnFacesBlock extends NodeGeometryBlock {
|
|
|
177
196
|
const t = y - x;
|
|
178
197
|
const u = 1 - s - t;
|
|
179
198
|
this._currentPosition.set(s * this._vertex0.x + t * this._vertex1.x + u * this._vertex2.x, s * this._vertex0.y + t * this._vertex1.y + u * this._vertex2.y, s * this._vertex0.z + t * this._vertex1.z + u * this._vertex2.z);
|
|
199
|
+
if (this._vertexData.uvs) {
|
|
200
|
+
this._currentUV.set(s * this._uv0.x + t * this._uv1.x + u * this._uv2.x, s * this._uv0.y + t * this._uv1.y + u * this._uv2.y);
|
|
201
|
+
}
|
|
180
202
|
// Clone the instance
|
|
181
203
|
instanceGeometry = this.instance.getConnectedValue(state);
|
|
182
204
|
if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {
|