@babylonjs/core 7.15.0 → 7.15.1

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.
@@ -142,13 +142,13 @@ export class GreasedLineMesh extends GreasedLineBaseMesh {
142
142
  else {
143
143
  for (let j = 0; j < l; j++) {
144
144
  // uvs
145
+ const lengthRatio = lengthArray[j] / totalLength;
145
146
  const uvOffsetBase = uvOffset + j * 4;
146
- uvArr[uvOffsetBase + 0] = j / (l - 1);
147
+ uvArr[uvOffsetBase + 0] = lengthRatio;
147
148
  uvArr[uvOffsetBase + 1] = 0;
148
- uvArr[uvOffsetBase + 2] = j / (l - 1);
149
+ uvArr[uvOffsetBase + 2] = lengthRatio;
149
150
  uvArr[uvOffsetBase + 3] = 1;
150
151
  }
151
- uvOffset += l * 4;
152
152
  }
153
153
  });
154
154
  this._vertexPositions = vertexPositionsArr;
@@ -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,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,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,OAA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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;;AAzWc,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, FloatArray } 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\nimport type { VertexData } from \"../mesh.vertexData\";\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: FloatArray;\r\n private _nextAndCounters: FloatArray;\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 override 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 override 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 // intentionally left blank\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 let vertexPositionsLen = 0,\r\n indicesLength = 0,\r\n uvLength = 0,\r\n previousAndSideLength = 0;\r\n points.forEach((p) => {\r\n vertexPositionsLen += p.length * 2;\r\n indicesLength += (p.length - 3) * 2;\r\n uvLength += (p.length * 4) / 3;\r\n previousAndSideLength += (p.length * 8) / 3;\r\n });\r\n const vertexPositionsArr = new Float32Array(vertexPositionsLen);\r\n const indicesArr = vertexPositionsLen > 65535 ? new Uint32Array(indicesLength) : new Uint16Array(indicesLength);\r\n const uvArr = new Float32Array(uvLength);\r\n const previousAndSide = new Float32Array(previousAndSideLength);\r\n // it's the same length here\r\n const nextAndCounters = new Float32Array(previousAndSideLength);\r\n let vertexPositionsOffset = 0,\r\n indicesOffset = 0,\r\n uvOffset = 0,\r\n previousAndSideOffset = 0,\r\n nextAndCountersOffset = 0;\r\n\r\n points.forEach((p) => {\r\n const lengthArray = GreasedLineTools.GetLineLengthArray(p);\r\n const totalLength = lengthArray[lengthArray.length - 1];\r\n for (let j = 0, jj = 0; jj < p.length; j++, jj += 3) {\r\n const baseOffset = vertexPositionsOffset + jj * 2;\r\n vertexPositionsArr[baseOffset + 0] = p[jj + 0];\r\n vertexPositionsArr[baseOffset + 1] = p[jj + 1];\r\n vertexPositionsArr[baseOffset + 2] = p[jj + 2];\r\n vertexPositionsArr[baseOffset + 3] = p[jj + 0];\r\n vertexPositionsArr[baseOffset + 4] = p[jj + 1];\r\n vertexPositionsArr[baseOffset + 5] = p[jj + 2];\r\n\r\n if (jj < p.length - 3) {\r\n const n = j * 2 + indiceOffset;\r\n const baseIndicesOffset = indicesOffset + jj * 2;\r\n indicesArr[baseIndicesOffset + 0] = n;\r\n indicesArr[baseIndicesOffset + 1] = n + 1;\r\n indicesArr[baseIndicesOffset + 2] = n + 2;\r\n indicesArr[baseIndicesOffset + 3] = n + 2;\r\n indicesArr[baseIndicesOffset + 4] = n + 1;\r\n indicesArr[baseIndicesOffset + 5] = n + 3;\r\n }\r\n }\r\n\r\n indiceOffset += (p.length / 3) * 2;\r\n const currVertexPositionsOffsetLength = p.length * 2;\r\n const positions = vertexPositionsArr.subarray(vertexPositionsOffset, vertexPositionsOffset + currVertexPositionsOffsetLength);\r\n vertexPositionsOffset += currVertexPositionsOffsetLength;\r\n indicesOffset += (p.length - 3) * 2;\r\n\r\n const previous = new Float32Array(positions.length);\r\n const next = new Float32Array(positions.length);\r\n const l = positions.length / 6;\r\n let v;\r\n if (GreasedLineMesh._CompareV3(0, l - 1, positions)) {\r\n v = positions.subarray((l - 2) * 6, (l - 1) * 6);\r\n } else {\r\n v = positions.subarray(0, 6);\r\n }\r\n previous.set(v);\r\n previous.set(positions.subarray(0, positions.length - 6), 6);\r\n next.set(positions.subarray(6));\r\n if (GreasedLineMesh._CompareV3(l - 1, 0, positions)) {\r\n v = positions.subarray(6, 12);\r\n } else {\r\n v = positions.subarray((l - 1) * 6, l * 6);\r\n }\r\n next.set(v, next.length - 6);\r\n\r\n for (let i = 0, sidesLength = positions.length / 3; i < sidesLength; i++) {\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3];\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3 + 1];\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3 + 2];\r\n // side[i] = i % 2 ? -1 : 1;\r\n // side[i] = 1 - ((i & 1) << 1);\r\n previousAndSide[previousAndSideOffset++] = 1 - ((i & 1) << 1);\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3];\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 1];\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 2];\r\n // counters[i] = lengthArray[i >> 1] / totalLength;\r\n nextAndCounters[nextAndCountersOffset++] = lengthArray[i >> 1] / totalLength;\r\n }\r\n if (this._options.uvs) {\r\n for (let i = 0; i < this._options.uvs.length; i++) {\r\n uvArr[uvOffset++] = this._options.uvs[i];\r\n }\r\n } else {\r\n for (let j = 0; j < l; j++) {\r\n // uvs\r\n const uvOffsetBase = uvOffset + j * 4;\r\n uvArr[uvOffsetBase + 0] = j / (l - 1);\r\n uvArr[uvOffsetBase + 1] = 0;\r\n uvArr[uvOffsetBase + 2] = j / (l - 1);\r\n uvArr[uvOffsetBase + 3] = 1;\r\n }\r\n uvOffset += l * 4;\r\n }\r\n });\r\n this._vertexPositions = vertexPositionsArr;\r\n this._indices = indicesArr;\r\n this._uvs = uvArr;\r\n this._previousAndSide = previousAndSide;\r\n this._nextAndCounters = nextAndCounters;\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 override 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\"], undefined, true);\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 override 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 override 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 override _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 override 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: FloatArray) {\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 protected override _createVertexBuffers() {\r\n const vertexData: 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;AAG5D,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,YAC6B,IAAY,EACrC,KAAY,EACZ,QAAgC;QAEhC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC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CAAC,CAAC,CAAC;QAC1F,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAC;QAEhD,OAAO,UAAU,CAAC;IACtB,CAAC;;AAzWc,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, FloatArray } 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\nimport type { VertexData } from \"../mesh.vertexData\";\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: FloatArray;\r\n private _nextAndCounters: FloatArray;\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 override 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 override 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 // intentionally left blank\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 let vertexPositionsLen = 0,\r\n indicesLength = 0,\r\n uvLength = 0,\r\n previousAndSideLength = 0;\r\n points.forEach((p) => {\r\n vertexPositionsLen += p.length * 2;\r\n indicesLength += (p.length - 3) * 2;\r\n uvLength += (p.length * 4) / 3;\r\n previousAndSideLength += (p.length * 8) / 3;\r\n });\r\n const vertexPositionsArr = new Float32Array(vertexPositionsLen);\r\n const indicesArr = vertexPositionsLen > 65535 ? new Uint32Array(indicesLength) : new Uint16Array(indicesLength);\r\n const uvArr = new Float32Array(uvLength);\r\n const previousAndSide = new Float32Array(previousAndSideLength);\r\n // it's the same length here\r\n const nextAndCounters = new Float32Array(previousAndSideLength);\r\n let vertexPositionsOffset = 0,\r\n indicesOffset = 0,\r\n uvOffset = 0,\r\n previousAndSideOffset = 0,\r\n nextAndCountersOffset = 0;\r\n\r\n points.forEach((p) => {\r\n const lengthArray = GreasedLineTools.GetLineLengthArray(p);\r\n const totalLength = lengthArray[lengthArray.length - 1];\r\n for (let j = 0, jj = 0; jj < p.length; j++, jj += 3) {\r\n const baseOffset = vertexPositionsOffset + jj * 2;\r\n vertexPositionsArr[baseOffset + 0] = p[jj + 0];\r\n vertexPositionsArr[baseOffset + 1] = p[jj + 1];\r\n vertexPositionsArr[baseOffset + 2] = p[jj + 2];\r\n vertexPositionsArr[baseOffset + 3] = p[jj + 0];\r\n vertexPositionsArr[baseOffset + 4] = p[jj + 1];\r\n vertexPositionsArr[baseOffset + 5] = p[jj + 2];\r\n\r\n if (jj < p.length - 3) {\r\n const n = j * 2 + indiceOffset;\r\n const baseIndicesOffset = indicesOffset + jj * 2;\r\n indicesArr[baseIndicesOffset + 0] = n;\r\n indicesArr[baseIndicesOffset + 1] = n + 1;\r\n indicesArr[baseIndicesOffset + 2] = n + 2;\r\n indicesArr[baseIndicesOffset + 3] = n + 2;\r\n indicesArr[baseIndicesOffset + 4] = n + 1;\r\n indicesArr[baseIndicesOffset + 5] = n + 3;\r\n }\r\n }\r\n\r\n indiceOffset += (p.length / 3) * 2;\r\n const currVertexPositionsOffsetLength = p.length * 2;\r\n const positions = vertexPositionsArr.subarray(vertexPositionsOffset, vertexPositionsOffset + currVertexPositionsOffsetLength);\r\n vertexPositionsOffset += currVertexPositionsOffsetLength;\r\n indicesOffset += (p.length - 3) * 2;\r\n\r\n const previous = new Float32Array(positions.length);\r\n const next = new Float32Array(positions.length);\r\n const l = positions.length / 6;\r\n let v;\r\n if (GreasedLineMesh._CompareV3(0, l - 1, positions)) {\r\n v = positions.subarray((l - 2) * 6, (l - 1) * 6);\r\n } else {\r\n v = positions.subarray(0, 6);\r\n }\r\n previous.set(v);\r\n previous.set(positions.subarray(0, positions.length - 6), 6);\r\n next.set(positions.subarray(6));\r\n if (GreasedLineMesh._CompareV3(l - 1, 0, positions)) {\r\n v = positions.subarray(6, 12);\r\n } else {\r\n v = positions.subarray((l - 1) * 6, l * 6);\r\n }\r\n next.set(v, next.length - 6);\r\n\r\n for (let i = 0, sidesLength = positions.length / 3; i < sidesLength; i++) {\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3];\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3 + 1];\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3 + 2];\r\n // side[i] = i % 2 ? -1 : 1;\r\n // side[i] = 1 - ((i & 1) << 1);\r\n previousAndSide[previousAndSideOffset++] = 1 - ((i & 1) << 1);\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3];\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 1];\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 2];\r\n // counters[i] = lengthArray[i >> 1] / totalLength;\r\n nextAndCounters[nextAndCountersOffset++] = lengthArray[i >> 1] / totalLength;\r\n }\r\n if (this._options.uvs) {\r\n for (let i = 0; i < this._options.uvs.length; i++) {\r\n uvArr[uvOffset++] = this._options.uvs[i];\r\n }\r\n } else {\r\n for (let j = 0; j < l; j++) {\r\n // uvs\r\n const lengthRatio = lengthArray[j] / totalLength;\r\n const uvOffsetBase = uvOffset + j * 4;\r\n uvArr[uvOffsetBase + 0] = lengthRatio;\r\n uvArr[uvOffsetBase + 1] = 0;\r\n uvArr[uvOffsetBase + 2] = lengthRatio;\r\n uvArr[uvOffsetBase + 3] = 1;\r\n }\r\n }\r\n });\r\n this._vertexPositions = vertexPositionsArr;\r\n this._indices = indicesArr;\r\n this._uvs = uvArr;\r\n this._previousAndSide = previousAndSide;\r\n this._nextAndCounters = nextAndCounters;\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 override 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\"], undefined, true);\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 override 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 override 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 override _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 override 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: FloatArray) {\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 protected override _createVertexBuffers() {\r\n const vertexData: 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"]}
package/Meshes/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./mesh.vertexData";
14
14
  export * from "./meshBuilder";
15
15
  export * from "./meshSimplification";
16
16
  export * from "./meshSimplificationSceneComponent";
17
+ export * from "./meshUtils";
17
18
  export * from "./polygonMesh";
18
19
  export * from "./geodesicMesh";
19
20
  export * from "./subMesh";
package/Meshes/index.js CHANGED
@@ -16,6 +16,7 @@ export * from "./mesh.vertexData.js";
16
16
  export * from "./meshBuilder.js";
17
17
  export * from "./meshSimplification.js";
18
18
  export * from "./meshSimplificationSceneComponent.js";
19
+ export * from "./meshUtils.js";
19
20
  export * from "./polygonMesh.js";
20
21
  export * from "./geodesicMesh.js";
21
22
  export * from "./subMesh.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+CAA+C;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,OAAO,oBAAoB,CAAC;AAC5B,gDAAgD;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,2CAA2C,CAAC","sourcesContent":["/* eslint-disable import/export */\r\n/* eslint-disable import/no-internal-modules */\r\nexport * from \"./abstractMesh\";\r\nimport \"./abstractMesh.decalMap\";\r\nexport * from \"./Compression/index\";\r\nexport * from \"./csg\";\r\nexport * from \"./meshUVSpaceRenderer\";\r\nexport * from \"./geometry\";\r\nexport * from \"./groundMesh\";\r\nexport * from \"./goldbergMesh\";\r\nexport * from \"./trailMesh\";\r\nexport * from \"./instancedMesh\";\r\nexport * from \"./linesMesh\";\r\nexport * from \"./mesh\";\r\nexport * from \"./mesh.vertexData\";\r\nexport * from \"./meshBuilder\";\r\nexport * from \"./meshSimplification\";\r\nexport * from \"./meshSimplificationSceneComponent\";\r\nexport * from \"./polygonMesh\";\r\nexport * from \"./geodesicMesh\";\r\nexport * from \"./subMesh\";\r\nexport * from \"./subMesh.project\";\r\nexport * from \"./meshLODLevel\";\r\nexport * from \"./transformNode\";\r\nexport * from \"./Builders/index\";\r\nexport * from \"./WebGL/webGLDataBuffer\";\r\nexport * from \"./WebGPU/webgpuDataBuffer\";\r\nexport * from \"./GreasedLine/greasedLineMesh\";\r\nexport * from \"./GreasedLine/greasedLineRibbonMesh\";\r\nexport * from \"./GreasedLine/greasedLineBaseMesh\";\r\nimport \"./thinInstanceMesh\";\r\n// eslint-disable-next-line no-duplicate-imports\r\nexport * from \"./thinInstanceMesh\";\r\nexport * from \"./Node/index\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingMesh\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+CAA+C;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,OAAO,oBAAoB,CAAC;AAC5B,gDAAgD;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,2CAA2C,CAAC","sourcesContent":["/* eslint-disable import/export */\r\n/* eslint-disable import/no-internal-modules */\r\nexport * from \"./abstractMesh\";\r\nimport \"./abstractMesh.decalMap\";\r\nexport * from \"./Compression/index\";\r\nexport * from \"./csg\";\r\nexport * from \"./meshUVSpaceRenderer\";\r\nexport * from \"./geometry\";\r\nexport * from \"./groundMesh\";\r\nexport * from \"./goldbergMesh\";\r\nexport * from \"./trailMesh\";\r\nexport * from \"./instancedMesh\";\r\nexport * from \"./linesMesh\";\r\nexport * from \"./mesh\";\r\nexport * from \"./mesh.vertexData\";\r\nexport * from \"./meshBuilder\";\r\nexport * from \"./meshSimplification\";\r\nexport * from \"./meshSimplificationSceneComponent\";\r\nexport * from \"./meshUtils\";\r\nexport * from \"./polygonMesh\";\r\nexport * from \"./geodesicMesh\";\r\nexport * from \"./subMesh\";\r\nexport * from \"./subMesh.project\";\r\nexport * from \"./meshLODLevel\";\r\nexport * from \"./transformNode\";\r\nexport * from \"./Builders/index\";\r\nexport * from \"./WebGL/webGLDataBuffer\";\r\nexport * from \"./WebGPU/webgpuDataBuffer\";\r\nexport * from \"./GreasedLine/greasedLineMesh\";\r\nexport * from \"./GreasedLine/greasedLineRibbonMesh\";\r\nexport * from \"./GreasedLine/greasedLineBaseMesh\";\r\nimport \"./thinInstanceMesh\";\r\n// eslint-disable-next-line no-duplicate-imports\r\nexport * from \"./thinInstanceMesh\";\r\nexport * from \"./Node/index\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingMesh\";\r\n"]}
@@ -0,0 +1,15 @@
1
+ import type { AnimationGroup } from "../Animations/animationGroup";
2
+ import { Vector3 } from "../Maths/math.vector";
3
+ import type { Nullable } from "../types";
4
+ import type { AbstractMesh } from "./abstractMesh";
5
+ /**
6
+ * Computes the maximum extents of the given meshes considering animation, skeleton, and morph targets.
7
+ * @param meshes The array of meshes to compute
8
+ * @param animationGroup An optional animation group to animate (must be started to take effect)
9
+ * @param animationStep An optional value indicating the number of seconds to step while looping through the given animation group
10
+ * @returns An array of world space extents corresponding to the given meshes
11
+ */
12
+ export declare function computeMaxExtents(meshes: Array<AbstractMesh>, animationGroup?: Nullable<AnimationGroup>, animationStep?: number): Array<{
13
+ minimum: Vector3;
14
+ maximum: Vector3;
15
+ }>;
@@ -0,0 +1,186 @@
1
+ import { VertexBuffer } from "../Buffers/buffer.js";
2
+ import { TmpVectors, Vector3 } from "../Maths/math.vector.js";
3
+ function getExtentCorners(extent) {
4
+ const minX = extent.minimum.x;
5
+ const minY = extent.minimum.y;
6
+ const minZ = extent.minimum.z;
7
+ const maxX = extent.maximum.x;
8
+ const maxY = extent.maximum.y;
9
+ const maxZ = extent.maximum.z;
10
+ return [
11
+ new Vector3(minX, minY, minZ),
12
+ new Vector3(maxX, maxY, maxZ),
13
+ new Vector3(maxX, minY, minZ),
14
+ new Vector3(minX, maxY, minZ),
15
+ new Vector3(minX, minY, maxZ),
16
+ new Vector3(maxX, maxY, minZ),
17
+ new Vector3(minX, maxY, maxZ),
18
+ new Vector3(maxX, minY, maxZ),
19
+ ];
20
+ }
21
+ /**
22
+ * Computes the maximum extents of the given meshes considering animation, skeleton, and morph targets.
23
+ * @param meshes The array of meshes to compute
24
+ * @param animationGroup An optional animation group to animate (must be started to take effect)
25
+ * @param animationStep An optional value indicating the number of seconds to step while looping through the given animation group
26
+ * @returns An array of world space extents corresponding to the given meshes
27
+ */
28
+ export function computeMaxExtents(meshes, animationGroup = null, animationStep = 1 / 6) {
29
+ // Local vector to avoid allocations.
30
+ const position = TmpVectors.Vector3[0];
31
+ const meshExtents = new Map();
32
+ const skinnedMeshExtents = new Map();
33
+ // Compute the non-skinned and skinned mesh extents.
34
+ const maxLength = meshes.reduce((previous, current) => Math.max(previous, current.getTotalVertices()), 0);
35
+ const minPositions = Array.from({ length: maxLength }, () => new Vector3());
36
+ const maxPositions = Array.from({ length: maxLength }, () => new Vector3());
37
+ for (const mesh of meshes) {
38
+ const positions = mesh.getVerticesData(VertexBuffer.PositionKind);
39
+ if (!positions) {
40
+ continue;
41
+ }
42
+ // Initialize min/max positions with the original positions.
43
+ const numVertices = mesh.getTotalVertices();
44
+ minPositions.length = Math.max(minPositions.length, numVertices);
45
+ maxPositions.length = Math.max(minPositions.length, numVertices);
46
+ for (let i = 0, j = 0; i < numVertices; i++, j += 3) {
47
+ position.set(positions[j], positions[j + 1], positions[j + 2]);
48
+ minPositions[i].copyFrom(position);
49
+ maxPositions[i].copyFrom(position);
50
+ }
51
+ // Apply morph targets to the min/max positions.
52
+ const morphTargetManager = mesh.morphTargetManager;
53
+ if (morphTargetManager) {
54
+ for (let targetIndex = 0; targetIndex < morphTargetManager.numTargets; ++targetIndex) {
55
+ const target = morphTargetManager.getTarget(targetIndex);
56
+ const positions = target.getPositions();
57
+ if (positions) {
58
+ for (let i = 0, j = 0; i < numVertices; i++, j += 3) {
59
+ position.set(positions[j], positions[j + 1], positions[j + 2]);
60
+ minPositions[i].minimizeInPlace(position);
61
+ maxPositions[i].maximizeInPlace(position);
62
+ }
63
+ }
64
+ }
65
+ }
66
+ // Compute extent per mesh.
67
+ const skeleton = mesh.skeleton;
68
+ const weights = skeleton ? mesh.getVerticesData(VertexBuffer.MatricesWeightsKind) : null;
69
+ const indices = skeleton ? mesh.getVerticesData(VertexBuffer.MatricesIndicesKind) : null;
70
+ if (weights && indices) {
71
+ // Compute extent per bone for skinned meshes.
72
+ const needsExtra = mesh.numBoneInfluencers > 4;
73
+ const weightsExtra = needsExtra ? mesh.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;
74
+ const indicesExtra = needsExtra ? mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;
75
+ const perBoneExtents = skinnedMeshExtents.get(mesh.uniqueId) || new Map();
76
+ skinnedMeshExtents.set(mesh.uniqueId, perBoneExtents);
77
+ const updateExtents = (i, j, weights, indices) => {
78
+ for (let k = j; k < j + 4; k++) {
79
+ if (weights[k] > 0) {
80
+ const boneIndex = indices[k];
81
+ const extent = perBoneExtents.get(boneIndex);
82
+ if (extent) {
83
+ extent.minimum.minimizeInPlace(minPositions[i]);
84
+ extent.maximum.maximizeInPlace(maxPositions[i]);
85
+ }
86
+ else {
87
+ perBoneExtents.set(boneIndex, {
88
+ minimum: minPositions[i].clone(),
89
+ maximum: maxPositions[i].clone(),
90
+ });
91
+ }
92
+ }
93
+ }
94
+ };
95
+ for (let i = 0, j = 0; i < numVertices; i++, j += 4) {
96
+ updateExtents(i, j, weights, indices);
97
+ if (weightsExtra && indicesExtra) {
98
+ updateExtents(i, j, weightsExtra, indicesExtra);
99
+ }
100
+ }
101
+ }
102
+ else {
103
+ // Compute extent for the whole mesh for non-skinned meshes.
104
+ const extent = meshExtents.get(mesh.uniqueId) || {
105
+ minimum: new Vector3().setAll(Number.POSITIVE_INFINITY),
106
+ maximum: new Vector3().setAll(Number.NEGATIVE_INFINITY),
107
+ };
108
+ meshExtents.set(mesh.uniqueId, extent);
109
+ for (let i = 0; i < numVertices; i++) {
110
+ extent.minimum.minimizeInPlace(minPositions[i]);
111
+ extent.maximum.maximizeInPlace(maxPositions[i]);
112
+ }
113
+ }
114
+ }
115
+ // Create the 8 corners of each non-skinned and skinned extent.
116
+ const meshCorners = new Map();
117
+ const skinnedMeshCorners = new Map();
118
+ for (const mesh of meshes) {
119
+ const extent = meshExtents.get(mesh.uniqueId);
120
+ if (extent) {
121
+ meshCorners.set(mesh.uniqueId, getExtentCorners(extent));
122
+ }
123
+ else {
124
+ const perBoneExtents = skinnedMeshExtents.get(mesh.uniqueId);
125
+ if (perBoneExtents) {
126
+ const bones = mesh.skeleton.bones;
127
+ const perBoneCorners = new Map();
128
+ skinnedMeshCorners.set(mesh.uniqueId, perBoneCorners);
129
+ perBoneExtents.forEach((extent, boneIndex) => {
130
+ const corners = getExtentCorners(extent);
131
+ // Transform the coordinates of the corners for skinned meshes to bone space.
132
+ const inverseBindMatrix = bones[boneIndex].getAbsoluteInverseBindMatrix();
133
+ for (const corner of corners) {
134
+ Vector3.TransformCoordinatesToRef(corner, inverseBindMatrix, corner);
135
+ }
136
+ perBoneCorners.set(boneIndex, corners);
137
+ });
138
+ }
139
+ }
140
+ }
141
+ const maxExtents = Array.from({ length: meshes.length }, () => ({
142
+ minimum: new Vector3().setAll(Number.POSITIVE_INFINITY),
143
+ maximum: new Vector3().setAll(Number.NEGATIVE_INFINITY),
144
+ }));
145
+ const updateMaxExtents = () => {
146
+ for (let i = 0; i < meshes.length; i++) {
147
+ const mesh = meshes[i];
148
+ const worldMatrix = mesh.computeWorldMatrix(true);
149
+ const skeleton = mesh.skeleton;
150
+ if (skeleton) {
151
+ skeleton.prepare(true);
152
+ const bones = skeleton.bones;
153
+ const perBoneCorners = skinnedMeshCorners.get(mesh.uniqueId);
154
+ perBoneCorners.forEach((corners, boneIndex) => {
155
+ // Transform the per-bone corners into world space and update the max extent for each corner.
156
+ for (const corner of corners) {
157
+ const matrix = bones[boneIndex].getFinalMatrix().multiplyToRef(worldMatrix, TmpVectors.Matrix[0]);
158
+ Vector3.TransformCoordinatesToRef(corner, matrix, position);
159
+ maxExtents[i].minimum.minimizeInPlace(position);
160
+ maxExtents[i].maximum.maximizeInPlace(position);
161
+ }
162
+ });
163
+ }
164
+ else {
165
+ // Transform the corners into world space and update the max extent for each corner.
166
+ for (const corner of meshCorners.get(mesh.uniqueId)) {
167
+ Vector3.TransformCoordinatesToRef(corner, worldMatrix, position);
168
+ maxExtents[i].minimum.minimizeInPlace(position);
169
+ maxExtents[i].maximum.maximizeInPlace(position);
170
+ }
171
+ }
172
+ }
173
+ };
174
+ if (animationGroup && animationGroup.isStarted) {
175
+ const step = animationStep / animationGroup.getLength(0, 1);
176
+ for (let frame = animationGroup.from; frame <= animationGroup.to; frame += step) {
177
+ animationGroup.goToFrame(frame);
178
+ updateMaxExtents();
179
+ }
180
+ }
181
+ else {
182
+ updateMaxExtents();
183
+ }
184
+ return maxExtents;
185
+ }
186
+ //# sourceMappingURL=meshUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshUtils.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/meshUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,OAAO,E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CAAC,yBAAyB,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;oBACjE,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;oBAChD,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;iBACnD;aACJ;SACJ;IACL,CAAC,CAAC;IAEF,IAAI,cAAc,IAAI,cAAc,CAAC,SAAS,EAAE;QAC5C,MAAM,IAAI,GAAG,aAAa,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5D,KAAK,IAAI,KAAK,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,IAAI,cAAc,CAAC,EAAE,EAAE,KAAK,IAAI,IAAI,EAAE;YAC7E,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAChC,gBAAgB,EAAE,CAAC;SACtB;KACJ;SAAM;QACH,gBAAgB,EAAE,CAAC;KACtB;IAED,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { FloatArray, Nullable } from \"../types\";\r\nimport type { AbstractMesh } from \"./abstractMesh\";\r\n\r\nfunction getExtentCorners(extent: { minimum: Vector3; maximum: Vector3 }): Array<Vector3> {\r\n const minX = extent.minimum.x;\r\n const minY = extent.minimum.y;\r\n const minZ = extent.minimum.z;\r\n const maxX = extent.maximum.x;\r\n const maxY = extent.maximum.y;\r\n const maxZ = extent.maximum.z;\r\n return [\r\n new Vector3(minX, minY, minZ),\r\n new Vector3(maxX, maxY, maxZ),\r\n new Vector3(maxX, minY, minZ),\r\n new Vector3(minX, maxY, minZ),\r\n new Vector3(minX, minY, maxZ),\r\n new Vector3(maxX, maxY, minZ),\r\n new Vector3(minX, maxY, maxZ),\r\n new Vector3(maxX, minY, maxZ),\r\n ];\r\n}\r\n\r\n/**\r\n * Computes the maximum extents of the given meshes considering animation, skeleton, and morph targets.\r\n * @param meshes The array of meshes to compute\r\n * @param animationGroup An optional animation group to animate (must be started to take effect)\r\n * @param animationStep An optional value indicating the number of seconds to step while looping through the given animation group\r\n * @returns An array of world space extents corresponding to the given meshes\r\n */\r\nexport function computeMaxExtents(\r\n meshes: Array<AbstractMesh>,\r\n animationGroup: Nullable<AnimationGroup> = null,\r\n animationStep = 1 / 6\r\n): Array<{ minimum: Vector3; maximum: Vector3 }> {\r\n // Local vector to avoid allocations.\r\n const position = TmpVectors.Vector3[0];\r\n\r\n const meshExtents = new Map<number, { minimum: Vector3; maximum: Vector3 }>();\r\n const skinnedMeshExtents = new Map<number, Map<number, { minimum: Vector3; maximum: Vector3 }>>();\r\n\r\n // Compute the non-skinned and skinned mesh extents.\r\n const maxLength = meshes.reduce((previous, current) => Math.max(previous, current.getTotalVertices()), 0);\r\n const minPositions = Array.from({ length: maxLength }, () => new Vector3());\r\n const maxPositions = Array.from({ length: maxLength }, () => new Vector3());\r\n for (const mesh of meshes) {\r\n const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\r\n if (!positions) {\r\n continue;\r\n }\r\n\r\n // Initialize min/max positions with the original positions.\r\n const numVertices = mesh.getTotalVertices();\r\n minPositions.length = Math.max(minPositions.length, numVertices);\r\n maxPositions.length = Math.max(minPositions.length, numVertices);\r\n for (let i = 0, j = 0; i < numVertices; i++, j += 3) {\r\n position.set(positions[j], positions[j + 1], positions[j + 2]);\r\n minPositions[i].copyFrom(position);\r\n maxPositions[i].copyFrom(position);\r\n }\r\n\r\n // Apply morph targets to the min/max positions.\r\n const morphTargetManager = mesh.morphTargetManager;\r\n if (morphTargetManager) {\r\n for (let targetIndex = 0; targetIndex < morphTargetManager.numTargets; ++targetIndex) {\r\n const target = morphTargetManager.getTarget(targetIndex);\r\n const positions = target.getPositions();\r\n if (positions) {\r\n for (let i = 0, j = 0; i < numVertices; i++, j += 3) {\r\n position.set(positions[j], positions[j + 1], positions[j + 2]);\r\n minPositions[i].minimizeInPlace(position);\r\n maxPositions[i].maximizeInPlace(position);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Compute extent per mesh.\r\n const skeleton = mesh.skeleton;\r\n const weights = skeleton ? mesh.getVerticesData(VertexBuffer.MatricesWeightsKind) : null;\r\n const indices = skeleton ? mesh.getVerticesData(VertexBuffer.MatricesIndicesKind) : null;\r\n if (weights && indices) {\r\n // Compute extent per bone for skinned meshes.\r\n const needsExtra = mesh.numBoneInfluencers > 4;\r\n const weightsExtra = needsExtra ? mesh.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n const indicesExtra = needsExtra ? mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n\r\n const perBoneExtents = skinnedMeshExtents.get(mesh.uniqueId) || new Map<number, { minimum: Vector3; maximum: Vector3 }>();\r\n skinnedMeshExtents.set(mesh.uniqueId, perBoneExtents);\r\n\r\n const updateExtents = (i: number, j: number, weights: FloatArray, indices: FloatArray): void => {\r\n for (let k = j; k < j + 4; k++) {\r\n if (weights[k] > 0) {\r\n const boneIndex = indices[k];\r\n\r\n const extent = perBoneExtents.get(boneIndex);\r\n if (extent) {\r\n extent.minimum.minimizeInPlace(minPositions[i]);\r\n extent.maximum.maximizeInPlace(maxPositions[i]);\r\n } else {\r\n perBoneExtents.set(boneIndex, {\r\n minimum: minPositions[i].clone(),\r\n maximum: maxPositions[i].clone(),\r\n });\r\n }\r\n }\r\n }\r\n };\r\n\r\n for (let i = 0, j = 0; i < numVertices; i++, j += 4) {\r\n updateExtents(i, j, weights, indices);\r\n\r\n if (weightsExtra && indicesExtra) {\r\n updateExtents(i, j, weightsExtra, indicesExtra);\r\n }\r\n }\r\n } else {\r\n // Compute extent for the whole mesh for non-skinned meshes.\r\n const extent = meshExtents.get(mesh.uniqueId) || {\r\n minimum: new Vector3().setAll(Number.POSITIVE_INFINITY),\r\n maximum: new Vector3().setAll(Number.NEGATIVE_INFINITY),\r\n };\r\n meshExtents.set(mesh.uniqueId, extent);\r\n\r\n for (let i = 0; i < numVertices; i++) {\r\n extent.minimum.minimizeInPlace(minPositions[i]);\r\n extent.maximum.maximizeInPlace(maxPositions[i]);\r\n }\r\n }\r\n }\r\n\r\n // Create the 8 corners of each non-skinned and skinned extent.\r\n const meshCorners = new Map<number, Array<Vector3>>();\r\n const skinnedMeshCorners = new Map<number, Map<number, Array<Vector3>>>();\r\n for (const mesh of meshes) {\r\n const extent = meshExtents.get(mesh.uniqueId);\r\n if (extent) {\r\n meshCorners.set(mesh.uniqueId, getExtentCorners(extent));\r\n } else {\r\n const perBoneExtents = skinnedMeshExtents.get(mesh.uniqueId);\r\n if (perBoneExtents) {\r\n const bones = mesh.skeleton!.bones;\r\n\r\n const perBoneCorners = new Map<number, Array<Vector3>>();\r\n skinnedMeshCorners.set(mesh.uniqueId, perBoneCorners);\r\n\r\n perBoneExtents.forEach((extent, boneIndex) => {\r\n const corners = getExtentCorners(extent);\r\n\r\n // Transform the coordinates of the corners for skinned meshes to bone space.\r\n const inverseBindMatrix = bones[boneIndex].getAbsoluteInverseBindMatrix();\r\n for (const corner of corners) {\r\n Vector3.TransformCoordinatesToRef(corner, inverseBindMatrix, corner);\r\n }\r\n\r\n perBoneCorners.set(boneIndex, corners);\r\n });\r\n }\r\n }\r\n }\r\n\r\n const maxExtents = Array.from({ length: meshes.length }, () => ({\r\n minimum: new Vector3().setAll(Number.POSITIVE_INFINITY),\r\n maximum: new Vector3().setAll(Number.NEGATIVE_INFINITY),\r\n }));\r\n\r\n const updateMaxExtents = (): void => {\r\n for (let i = 0; i < meshes.length; i++) {\r\n const mesh = meshes[i];\r\n\r\n const worldMatrix = mesh.computeWorldMatrix(true);\r\n\r\n const skeleton = mesh.skeleton;\r\n if (skeleton) {\r\n skeleton.prepare(true);\r\n\r\n const bones = skeleton.bones;\r\n const perBoneCorners = skinnedMeshCorners.get(mesh.uniqueId)!;\r\n perBoneCorners.forEach((corners, boneIndex) => {\r\n // Transform the per-bone corners into world space and update the max extent for each corner.\r\n for (const corner of corners) {\r\n const matrix = bones[boneIndex].getFinalMatrix().multiplyToRef(worldMatrix, TmpVectors.Matrix[0]);\r\n Vector3.TransformCoordinatesToRef(corner, matrix, position);\r\n maxExtents[i].minimum.minimizeInPlace(position);\r\n maxExtents[i].maximum.maximizeInPlace(position);\r\n }\r\n });\r\n } else {\r\n // Transform the corners into world space and update the max extent for each corner.\r\n for (const corner of meshCorners.get(mesh.uniqueId)!) {\r\n Vector3.TransformCoordinatesToRef(corner, worldMatrix, position);\r\n maxExtents[i].minimum.minimizeInPlace(position);\r\n maxExtents[i].maximum.maximizeInPlace(position);\r\n }\r\n }\r\n }\r\n };\r\n\r\n if (animationGroup && animationGroup.isStarted) {\r\n const step = animationStep / animationGroup.getLength(0, 1);\r\n for (let frame = animationGroup.from; frame <= animationGroup.to; frame += step) {\r\n animationGroup.goToFrame(frame);\r\n updateMaxExtents();\r\n }\r\n } else {\r\n updateMaxExtents();\r\n }\r\n\r\n return maxExtents;\r\n}\r\n"]}
@@ -190,11 +190,11 @@ export function CreateScreenshotUsingRenderTarget(engine, camera, size, successC
190
190
  });
191
191
  }
192
192
  });
193
- texture.render(true);
194
193
  // re-render the scene after the camera has been reset to the original camera to avoid a flicker that could occur
195
194
  // if the camera used for the RTT rendering stays in effect for the next frame (and if that camera was different from the original camera)
196
195
  scene.incrementRenderId();
197
196
  scene.resetCachedMaterial();
197
+ texture.render(true);
198
198
  engine.setSize(originalSize.width, originalSize.height);
199
199
  camera.getProjectionMatrix(true); // Force cache refresh;
200
200
  scene.render();