@babylonjs/core 7.15.0 → 7.15.2
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/Animations/animationGroup.d.ts +1 -1
- package/Animations/animationGroup.js +6 -3
- package/Animations/animationGroup.js.map +1 -1
- package/Buffers/buffer.js +9 -10
- package/Buffers/buffer.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +6 -0
- package/Collisions/gpuPicker.js +47 -20
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +3 -0
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +19 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/thinEngine.js +4 -3
- package/Engines/thinEngine.js.map +1 -1
- package/Layers/effectLayer.js +9 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +3 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +13 -5
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.d.ts +2 -0
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js +36 -8
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.js +15 -9
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js +2 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +6 -2
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +1 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +27 -3
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +1 -0
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +3 -3
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.d.ts +3 -1
- package/Meshes/Node/Blocks/randomBlock.js +6 -0
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +13 -1
- package/Meshes/abstractMesh.js +37 -4
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/index.d.ts +1 -0
- package/Meshes/index.js +1 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/meshUtils.d.ts +15 -0
- package/Meshes/meshUtils.js +186 -0
- package/Meshes/meshUtils.js.map +1 -0
- package/Misc/screenshotTools.js +1 -1
- package/Misc/screenshotTools.js.map +1 -1
- package/Shaders/gpuRenderParticles.vertex.js +1 -1
- package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/packingFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/packingFunctions.js +12 -0
- package/ShadersWGSL/ShadersInclude/packingFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js +36 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.js +33 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.js.map +1 -0
- package/XR/features/WebXRAnchorSystem.d.ts +4 -0
- package/XR/features/WebXRAnchorSystem.js +8 -7
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,OAAO,eAAgB,SAAQ,mBAAmB;IAcpD;;;;;OAKG;IACH,YAC6B,IAAY,EACrC,KAAY,EACZ,QAAgC;QAEhC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAJJ,SAAI,GAAJ,IAAI,CAAQ;QAZzC;;WAEG;QACI,0BAAqB,GAAG,GAAG,CAAC;QAe/B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAE3B,IAAI,QAAQ,CAAC,MAAM,EAAE;YACjB,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,C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O,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
|
+
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B,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE9F,MAAM,qBAAqB,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QAClF,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE9F,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,kBAAkB,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;;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"]}
|
|
@@ -17,6 +17,8 @@ export var RandomBlockLocks;
|
|
|
17
17
|
RandomBlockLocks[RandomBlockLocks["LoopID"] = 1] = "LoopID";
|
|
18
18
|
/** InstanceID */
|
|
19
19
|
RandomBlockLocks[RandomBlockLocks["InstanceID"] = 2] = "InstanceID";
|
|
20
|
+
/** Once */
|
|
21
|
+
RandomBlockLocks[RandomBlockLocks["Once"] = 3] = "Once";
|
|
20
22
|
})(RandomBlockLocks || (RandomBlockLocks = {}));
|
|
21
23
|
/**
|
|
22
24
|
* Block used to get a random number
|
|
@@ -133,6 +135,9 @@ export class RandomBlock extends NodeGeometryBlock {
|
|
|
133
135
|
case RandomBlockLocks.LoopID:
|
|
134
136
|
lockId = state.getContextualValue(NodeGeometryContextualSources.LoopID, true) || 0;
|
|
135
137
|
break;
|
|
138
|
+
case RandomBlockLocks.Once:
|
|
139
|
+
lockId = state.buildId || 0;
|
|
140
|
+
break;
|
|
136
141
|
}
|
|
137
142
|
if (this._currentLockId !== lockId || this.lockMode === RandomBlockLocks.None) {
|
|
138
143
|
this._currentLockId = lockId;
|
|
@@ -167,6 +172,7 @@ __decorate([
|
|
|
167
172
|
{ label: "None", value: RandomBlockLocks.None },
|
|
168
173
|
{ label: "LoopID", value: RandomBlockLocks.LoopID },
|
|
169
174
|
{ label: "InstanceID", value: RandomBlockLocks.InstanceID },
|
|
175
|
+
{ label: "Once", value: RandomBlockLocks.Once },
|
|
170
176
|
],
|
|
171
177
|
})
|
|
172
178
|
], RandomBlock.prototype, "lockMode", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/randomBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAElG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EAA0B,sBAAsB,EAAE,6CAAsC;AAC/F,OAAO,EAAE,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CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QACvJ,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IACjD,CAAC;CACJ;AA/JU;IARN,sBAAsB,CAAC,UAAU,uCAA+B,UAAU,EAAE;QACzE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAE;YAC/C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,CAAC,MAAM,EAAE;YACnD,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,CAAC,UAAU,EAAE;SAC9D;KACJ,CAAC;6CACsC;AAiK5C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"./geometryInputBlock\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Locks supported by the random block\r\n */\r\nexport enum RandomBlockLocks {\r\n /** None */\r\n None,\r\n /** LoopID */\r\n LoopID,\r\n /** InstanceID */\r\n InstanceID,\r\n}\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class RandomBlock extends NodeGeometryBlock {\r\n private _currentLockId = -1;\r\n /**\r\n * Gets or sets a value indicating if that block will lock its value for a specific duration\r\n */\r\n @editableInPropertyPage(\"LockMode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"None\", value: RandomBlockLocks.None },\r\n { label: \"LoopID\", value: RandomBlockLocks.LoopID },\r\n { label: \"InstanceID\", value: RandomBlockLocks.InstanceID },\r\n ],\r\n })\r\n public lockMode = RandomBlockLocks.None;\r\n\r\n /**\r\n * Create a new RandomBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"min\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"max\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"RandomBlock\";\r\n }\r\n\r\n /**\r\n * Gets the min input component\r\n */\r\n public get min(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (!this.min.isConnected) {\r\n const minInput = new GeometryInputBlock(\"Min\");\r\n minInput.value = 0;\r\n minInput.output.connectTo(this.min);\r\n }\r\n\r\n if (!this.max.isConnected) {\r\n const maxInput = new GeometryInputBlock(\"Max\");\r\n maxInput.value = 1;\r\n maxInput.output.connectTo(this.max);\r\n }\r\n }\r\n\r\n protected override _buildBlock() {\r\n let func: Nullable<(state: NodeGeometryBuildState) => any> = null;\r\n this._currentLockId = -1;\r\n\r\n switch (this.min.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || 0;\r\n const max = this.max.getConnectedValue(state) || 0;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector2.Zero();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector3.Zero();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector4.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector4.Zero();\r\n return new Vector4(\r\n min.x + Math.random() * (max.x - min.x),\r\n min.y + Math.random() * (max.y - min.y),\r\n min.z + Math.random() * (max.z - min.z),\r\n min.w + Math.random() * (max.w - min.w)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n if (this.lockMode === RandomBlockLocks.None || !func) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = (state) => {\r\n let lockId = 0;\r\n\r\n switch (this.lockMode) {\r\n case RandomBlockLocks.InstanceID:\r\n lockId = state.getContextualValue(NodeGeometryContextualSources.InstanceID, true) || 0;\r\n break;\r\n case RandomBlockLocks.LoopID:\r\n lockId = state.getContextualValue(NodeGeometryContextualSources.LoopID, true) || 0;\r\n break;\r\n }\r\n\r\n if (this._currentLockId !== lockId || this.lockMode === RandomBlockLocks.None) {\r\n this._currentLockId = lockId;\r\n this.output._storedValue = func!(state);\r\n }\r\n return this.output._storedValue;\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.lockMode = BABYLON.RandomBlockLocks.${RandomBlockLocks[this.lockMode]};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.lockMode = this.lockMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.lockMode = serializationObject.lockMode;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.RandomBlock\", RandomBlock);\r\n"]}
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KAAK,EAAE,gBAAgB,CAAC,MAAM,EAAE;YACnD,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,CAAC,UAAU,EAAE;YAC3D,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAE;SAClD;KACJ,CAAC;6CACsC;AAoK5C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"./geometryInputBlock\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Locks supported by the random block\r\n */\r\nexport enum RandomBlockLocks {\r\n /** None */\r\n None,\r\n /** LoopID */\r\n LoopID,\r\n /** InstanceID */\r\n InstanceID,\r\n /** Once */\r\n Once,\r\n}\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class RandomBlock extends NodeGeometryBlock {\r\n private _currentLockId = -1;\r\n /**\r\n * Gets or sets a value indicating if that block will lock its value for a specific duration\r\n */\r\n @editableInPropertyPage(\"LockMode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"None\", value: RandomBlockLocks.None },\r\n { label: \"LoopID\", value: RandomBlockLocks.LoopID },\r\n { label: \"InstanceID\", value: RandomBlockLocks.InstanceID },\r\n { label: \"Once\", value: RandomBlockLocks.Once },\r\n ],\r\n })\r\n public lockMode = RandomBlockLocks.None;\r\n\r\n /**\r\n * Create a new RandomBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"min\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"max\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"RandomBlock\";\r\n }\r\n\r\n /**\r\n * Gets the min input component\r\n */\r\n public get min(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (!this.min.isConnected) {\r\n const minInput = new GeometryInputBlock(\"Min\");\r\n minInput.value = 0;\r\n minInput.output.connectTo(this.min);\r\n }\r\n\r\n if (!this.max.isConnected) {\r\n const maxInput = new GeometryInputBlock(\"Max\");\r\n maxInput.value = 1;\r\n maxInput.output.connectTo(this.max);\r\n }\r\n }\r\n\r\n protected override _buildBlock() {\r\n let func: Nullable<(state: NodeGeometryBuildState) => any> = null;\r\n this._currentLockId = -1;\r\n\r\n switch (this.min.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || 0;\r\n const max = this.max.getConnectedValue(state) || 0;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector2.Zero();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector3.Zero();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector4.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector4.Zero();\r\n return new Vector4(\r\n min.x + Math.random() * (max.x - min.x),\r\n min.y + Math.random() * (max.y - min.y),\r\n min.z + Math.random() * (max.z - min.z),\r\n min.w + Math.random() * (max.w - min.w)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n if (this.lockMode === RandomBlockLocks.None || !func) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = (state) => {\r\n let lockId = 0;\r\n\r\n switch (this.lockMode) {\r\n case RandomBlockLocks.InstanceID:\r\n lockId = state.getContextualValue(NodeGeometryContextualSources.InstanceID, true) || 0;\r\n break;\r\n case RandomBlockLocks.LoopID:\r\n lockId = state.getContextualValue(NodeGeometryContextualSources.LoopID, true) || 0;\r\n break;\r\n case RandomBlockLocks.Once:\r\n lockId = state.buildId || 0;\r\n break;\r\n }\r\n\r\n if (this._currentLockId !== lockId || this.lockMode === RandomBlockLocks.None) {\r\n this._currentLockId = lockId;\r\n this.output._storedValue = func!(state);\r\n }\r\n return this.output._storedValue;\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.lockMode = BABYLON.RandomBlockLocks.${RandomBlockLocks[this.lockMode]};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.lockMode = this.lockMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.lockMode = serializationObject.lockMode;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.RandomBlock\", RandomBlock);\r\n"]}
|
package/Meshes/abstractMesh.d.ts
CHANGED
|
@@ -132,6 +132,11 @@ declare class _InternalAbstractMeshDataInfo {
|
|
|
132
132
|
* We use that as a clue to force the material to sideOrientation = null
|
|
133
133
|
*/
|
|
134
134
|
_sideOrientationHint: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* @internal
|
|
137
|
+
* if this is set to true, the mesh will be visible only if its parent(s) are also visible
|
|
138
|
+
*/
|
|
139
|
+
_inheritVisibility: boolean;
|
|
135
140
|
}
|
|
136
141
|
/**
|
|
137
142
|
* Class used to store all common mesh properties
|
|
@@ -309,10 +314,17 @@ export declare abstract class AbstractMesh extends TransformNode implements IDis
|
|
|
309
314
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering#alpha-index
|
|
310
315
|
*/
|
|
311
316
|
alphaIndex: number;
|
|
317
|
+
/**
|
|
318
|
+
* If set to true, a mesh will only be visible only if its parent(s) are also visible (default is false)
|
|
319
|
+
*/
|
|
320
|
+
get inheritVisibility(): boolean;
|
|
321
|
+
set inheritVisibility(value: boolean);
|
|
322
|
+
private _isVisible;
|
|
312
323
|
/**
|
|
313
324
|
* Gets or sets a boolean indicating if the mesh is visible (renderable). Default is true
|
|
314
325
|
*/
|
|
315
|
-
isVisible: boolean;
|
|
326
|
+
get isVisible(): boolean;
|
|
327
|
+
set isVisible(value: boolean);
|
|
316
328
|
/**
|
|
317
329
|
* Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true
|
|
318
330
|
*/
|
package/Meshes/abstractMesh.js
CHANGED
|
@@ -145,6 +145,11 @@ class _InternalAbstractMeshDataInfo {
|
|
|
145
145
|
* We use that as a clue to force the material to sideOrientation = null
|
|
146
146
|
*/
|
|
147
147
|
this._sideOrientationHint = false;
|
|
148
|
+
/**
|
|
149
|
+
* @internal
|
|
150
|
+
* if this is set to true, the mesh will be visible only if its parent(s) are also visible
|
|
151
|
+
*/
|
|
152
|
+
this._inheritVisibility = false;
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
155
|
/**
|
|
@@ -326,6 +331,37 @@ export class AbstractMesh extends TransformNode {
|
|
|
326
331
|
});
|
|
327
332
|
}
|
|
328
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* If set to true, a mesh will only be visible only if its parent(s) are also visible (default is false)
|
|
336
|
+
*/
|
|
337
|
+
get inheritVisibility() {
|
|
338
|
+
return this._internalAbstractMeshDataInfo._inheritVisibility;
|
|
339
|
+
}
|
|
340
|
+
set inheritVisibility(value) {
|
|
341
|
+
this._internalAbstractMeshDataInfo._inheritVisibility = value;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Gets or sets a boolean indicating if the mesh is visible (renderable). Default is true
|
|
345
|
+
*/
|
|
346
|
+
get isVisible() {
|
|
347
|
+
if (!this._isVisible || !this.inheritVisibility || !this._parentNode) {
|
|
348
|
+
return this._isVisible;
|
|
349
|
+
}
|
|
350
|
+
if (this._isVisible) {
|
|
351
|
+
let parent = this._parentNode;
|
|
352
|
+
while (parent) {
|
|
353
|
+
const parentVisible = parent.isVisible;
|
|
354
|
+
if (typeof parentVisible !== "undefined") {
|
|
355
|
+
return parentVisible;
|
|
356
|
+
}
|
|
357
|
+
parent = parent.parent;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return this._isVisible;
|
|
361
|
+
}
|
|
362
|
+
set isVisible(value) {
|
|
363
|
+
this._isVisible = value;
|
|
364
|
+
}
|
|
329
365
|
/**
|
|
330
366
|
* Gets or sets the property which disables the test that is checking that the mesh under the pointer is the same than the previous time we tested for it (default: false).
|
|
331
367
|
* Set this property to true if you want thin instances picking to be reported accurately when moving over the mesh.
|
|
@@ -615,10 +651,7 @@ export class AbstractMesh extends TransformNode {
|
|
|
615
651
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering#alpha-index
|
|
616
652
|
*/
|
|
617
653
|
this.alphaIndex = Number.MAX_VALUE;
|
|
618
|
-
|
|
619
|
-
* Gets or sets a boolean indicating if the mesh is visible (renderable). Default is true
|
|
620
|
-
*/
|
|
621
|
-
this.isVisible = true;
|
|
654
|
+
this._isVisible = true;
|
|
622
655
|
/**
|
|
623
656
|
* Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true
|
|
624
657
|
*/
|