@babylonjs/core 8.2.1 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AudioV2/webAudio/webAudioEngine.d.ts +1 -0
- package/AudioV2/webAudio/webAudioEngine.js +12 -3
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +14 -2
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +2 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/nativeEngine.js +14 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -1
- package/Engines/thinEngine.functions.d.ts +1 -1
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +3 -0
- package/Engines/thinEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/fxaaPostProcessBlock.d.ts +25 -0
- package/FrameGraph/Node/Blocks/PostProcesses/fxaaPostProcessBlock.js +35 -0
- package/FrameGraph/Node/Blocks/PostProcesses/fxaaPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.d.ts +34 -0
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.js +74 -0
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/index.d.ts +2 -0
- package/FrameGraph/Node/Blocks/index.js +2 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.d.ts +17 -0
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.js +23 -0
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/grainTask.d.ts +16 -0
- package/FrameGraph/Tasks/PostProcesses/grainTask.js +17 -0
- package/FrameGraph/Tasks/PostProcesses/grainTask.js.map +1 -0
- package/FrameGraph/index.d.ts +2 -0
- package/FrameGraph/index.js +2 -0
- package/FrameGraph/index.js.map +1 -1
- package/Materials/Textures/dynamicTexture.js +4 -0
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Meshes/meshUtils.d.ts +11 -1
- package/Meshes/meshUtils.js +22 -0
- package/Meshes/meshUtils.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.d.ts +2 -2
- package/PostProcesses/fxaaPostProcess.js +17 -27
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.d.ts +6 -3
- package/PostProcesses/grainPostProcess.js +35 -24
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/index.d.ts +2 -0
- package/PostProcesses/index.js +2 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/thinFXAAPostProcess.d.ts +34 -0
- package/PostProcesses/thinFXAAPostProcess.js +70 -0
- package/PostProcesses/thinFXAAPostProcess.js.map +1 -0
- package/PostProcesses/thinGrainPostProcess.d.ts +32 -0
- package/PostProcesses/thinGrainPostProcess.js +55 -0
- package/PostProcesses/thinGrainPostProcess.js.map +1 -0
- package/package.json +1 -1
package/Meshes/meshUtils.js.map
CHANGED
|
@@ -1 +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,EAAE,MAAM,sBAAsB,CAAC;AAI3D,SAAS,gBAAgB,CAAC,MAA8C;IACpE,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IA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AC,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;oBACpD,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,oFAAoF;gBACpF,KAAK,MAAM,MAAM,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAE,EAAE,CAAC;oBACnD,OAAO,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;gBACpD,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,cAAc,IAAI,cAAc,CAAC,SAAS,EAAE,CAAC;QAC7C,MAAM,YAAY,GAAG,cAAc,CAAC,eAAe,EAAE,CAAC;QACtD,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,CAAC;YAC9E,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAChC,gBAAgB,EAAE,CAAC;QACvB,CAAC;QACD,cAAc,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAC3C,CAAC;SAAM,CAAC;QACJ,gBAAgB,EAAE,CAAC;IACvB,CAAC;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 const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\r\n if (!positions) {\r\n continue;\r\n }\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 currentFrame = animationGroup.getCurrentFrame();\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 animationGroup.goToFrame(currentFrame);\r\n } else {\r\n updateMaxExtents();\r\n }\r\n\r\n return maxExtents;\r\n}\r\n"]}
|
|
1
|
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,CAAC;YAChC,gBAAgB,EAAE,CAAC;QACvB,CAAC;QACD,cAAc,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAC3C,CAAC;SAAM,CAAC;QACJ,gBAAgB,EAAE,CAAC;IACvB,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAuB;IAClE,MAAM,aAAa,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAU,CAAC;IACnK,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QACxB,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,EAAE,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACnD,kBAAkB,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;QAEH,kBAAkB,CAAC,OAAO,CAAC,CAAC,iBAAiB,EAAE,EAAE;YAC7C,IAAI,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBAChD,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;YAC/C,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC","sourcesContent":["import type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport type { FloatArray, Nullable } from \"../types\";\r\nimport type { AbstractMesh } from \"./abstractMesh\";\r\nimport type { Mesh } from \"./mesh\";\r\n\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\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 const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\r\n if (!positions) {\r\n continue;\r\n }\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 currentFrame = animationGroup.getCurrentFrame();\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 animationGroup.goToFrame(currentFrame);\r\n } else {\r\n updateMaxExtents();\r\n }\r\n\r\n return maxExtents;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Removes unreferenced vertex data from the given meshes.\r\n * This is useful for cleaning up unused vertex data, such as UV sets, to reduce memory usage and stay under graphics device limits.\r\n * @remarks\r\n * This function currently only removes unreferenced UV sets (UV2, UV3, etc.) from the meshes.\r\n * @param meshes The array of meshes to clean up.\r\n */\r\nexport function RemoveUnreferencedVerticesData(meshes: readonly Mesh[]) {\r\n const uvIndexToKind = [VertexBuffer.UVKind, VertexBuffer.UV2Kind, VertexBuffer.UV3Kind, VertexBuffer.UV4Kind, VertexBuffer.UV5Kind, VertexBuffer.UV6Kind] as const;\r\n for (const mesh of meshes) {\r\n const unreferencedUVSets = new Set(uvIndexToKind);\r\n mesh.material?.getActiveTextures().forEach((texture) => {\r\n unreferencedUVSets.delete(uvIndexToKind[texture.coordinatesIndex]);\r\n });\r\n\r\n unreferencedUVSets.forEach((unreferencedUVSet) => {\r\n if (mesh.isVerticesDataPresent(unreferencedUVSet)) {\r\n mesh.removeVerticesData(unreferencedUVSet);\r\n }\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -3,6 +3,7 @@ import type { Camera } from "../Cameras/camera.js";
|
|
|
3
3
|
import type { PostProcessOptions } from "./postProcess.js";
|
|
4
4
|
import { PostProcess } from "./postProcess.js";
|
|
5
5
|
import type { AbstractEngine } from "../Engines/abstractEngine.js";
|
|
6
|
+
import { ThinFXAAPostProcess } from "./thinFXAAPostProcess.js";
|
|
6
7
|
import type { Scene } from "../scene.js";
|
|
7
8
|
/**
|
|
8
9
|
* Fxaa post process
|
|
@@ -14,9 +15,8 @@ export declare class FxaaPostProcess extends PostProcess {
|
|
|
14
15
|
* @returns "FxaaPostProcess" string
|
|
15
16
|
*/
|
|
16
17
|
getClassName(): string;
|
|
18
|
+
protected _effectWrapper: ThinFXAAPostProcess;
|
|
17
19
|
constructor(name: string, options: number | PostProcessOptions, camera?: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean, textureType?: number);
|
|
18
|
-
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
19
|
-
private _getDefines;
|
|
20
20
|
/**
|
|
21
21
|
* @internal
|
|
22
22
|
*/
|
|
@@ -3,6 +3,7 @@ import { PostProcess } from "./postProcess.js";
|
|
|
3
3
|
|
|
4
4
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
5
5
|
import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
6
|
+
import { ThinFXAAPostProcess } from "./thinFXAAPostProcess.js";
|
|
6
7
|
/**
|
|
7
8
|
* Fxaa post process
|
|
8
9
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#fxaa
|
|
@@ -16,34 +17,23 @@ export class FxaaPostProcess extends PostProcess {
|
|
|
16
17
|
return "FxaaPostProcess";
|
|
17
18
|
}
|
|
18
19
|
constructor(name, options, camera = null, samplingMode, engine, reusable, textureType = 0) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const localOptions = {
|
|
21
|
+
uniforms: ThinFXAAPostProcess.Uniforms,
|
|
22
|
+
size: typeof options === "number" ? options : undefined,
|
|
23
|
+
camera,
|
|
24
|
+
samplingMode: samplingMode || Texture.BILINEAR_SAMPLINGMODE,
|
|
25
|
+
engine,
|
|
26
|
+
reusable,
|
|
27
|
+
textureType,
|
|
28
|
+
...options,
|
|
29
|
+
};
|
|
30
|
+
super(name, ThinFXAAPostProcess.FragmentUrl, {
|
|
31
|
+
effectWrapper: typeof options === "number" || !options.effectWrapper ? new ThinFXAAPostProcess(name, engine, localOptions) : undefined,
|
|
32
|
+
...localOptions,
|
|
33
|
+
});
|
|
34
|
+
this.onApplyObservable.add((_effect) => {
|
|
35
|
+
this._effectWrapper.texelSize = this.texelSize;
|
|
25
36
|
});
|
|
26
|
-
}
|
|
27
|
-
_gatherImports(useWebGPU, list) {
|
|
28
|
-
if (useWebGPU) {
|
|
29
|
-
this._webGPUReady = true;
|
|
30
|
-
list.push(Promise.all([import("../ShadersWGSL/fxaa.fragment.js"), import("../ShadersWGSL/fxaa.vertex.js")]));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
list.push(Promise.all([import("../Shaders/fxaa.fragment.js"), import("../Shaders/fxaa.vertex.js")]));
|
|
34
|
-
}
|
|
35
|
-
super._gatherImports(useWebGPU, list);
|
|
36
|
-
}
|
|
37
|
-
_getDefines() {
|
|
38
|
-
const engine = this.getEngine();
|
|
39
|
-
if (!engine) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const driverInfo = engine.extractDriverInfo();
|
|
43
|
-
if (driverInfo.toLowerCase().indexOf("mali") > -1) {
|
|
44
|
-
return "#define MALI 1\n";
|
|
45
|
-
}
|
|
46
|
-
return null;
|
|
47
37
|
}
|
|
48
38
|
/**
|
|
49
39
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fxaaPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/fxaaPostProcess.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"fxaaPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/fxaaPostProcess.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,mBAAmB,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AC,wBAAwB,EAC1C,KAAK,CAAC,SAAS,EAAE,EACjB,iBAAiB,CAAC,QAAQ,CAC7B,CAAC;QACN,CAAC,EACD,iBAAiB,EACjB,KAAK,EACL,OAAO,CACV,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport { ThinFXAAPostProcess } from \"./thinFXAAPostProcess\";\r\n\r\nimport type { Scene } from \"../scene\";\r\n/**\r\n * Fxaa post process\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#fxaa\r\n */\r\nexport class FxaaPostProcess extends PostProcess {\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"FxaaPostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"FxaaPostProcess\";\r\n }\r\n\r\n protected override _effectWrapper: ThinFXAAPostProcess;\r\n\r\n constructor(\r\n name: string,\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera> = null,\r\n samplingMode?: number,\r\n engine?: AbstractEngine,\r\n reusable?: boolean,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n const localOptions = {\r\n uniforms: ThinFXAAPostProcess.Uniforms,\r\n size: typeof options === \"number\" ? options : undefined,\r\n camera,\r\n samplingMode: samplingMode || Texture.BILINEAR_SAMPLINGMODE,\r\n engine,\r\n reusable,\r\n textureType,\r\n ...(options as PostProcessOptions),\r\n };\r\n\r\n super(name, ThinFXAAPostProcess.FragmentUrl, {\r\n effectWrapper: typeof options === \"number\" || !options.effectWrapper ? new ThinFXAAPostProcess(name, engine, localOptions) : undefined,\r\n ...localOptions,\r\n });\r\n\r\n this.onApplyObservable.add((_effect: Effect) => {\r\n this._effectWrapper.texelSize = this.texelSize;\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static override _Parse(parsedPostProcess: any, targetCamera: Camera, scene: Scene, rootUrl: string) {\r\n return SerializationHelper.Parse(\r\n () => {\r\n return new FxaaPostProcess(\r\n parsedPostProcess.name,\r\n parsedPostProcess.options,\r\n targetCamera,\r\n parsedPostProcess.renderTargetSamplingMode,\r\n scene.getEngine(),\r\n parsedPostProcess.reusable\r\n );\r\n },\r\n parsedPostProcess,\r\n scene,\r\n rootUrl\r\n );\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FxaaPostProcess\", FxaaPostProcess);\r\n"]}
|
|
@@ -4,6 +4,7 @@ import type { PostProcessOptions } from "./postProcess.js";
|
|
|
4
4
|
import { PostProcess } from "./postProcess.js";
|
|
5
5
|
import type { AbstractEngine } from "../Engines/abstractEngine.js";
|
|
6
6
|
import type { Scene } from "../scene.js";
|
|
7
|
+
import { ThinGrainPostProcess } from "./thinGrainPostProcess.js";
|
|
7
8
|
/**
|
|
8
9
|
* The GrainPostProcess adds noise to the image at mid luminance levels
|
|
9
10
|
*/
|
|
@@ -11,16 +12,19 @@ export declare class GrainPostProcess extends PostProcess {
|
|
|
11
12
|
/**
|
|
12
13
|
* The intensity of the grain added (default: 30)
|
|
13
14
|
*/
|
|
14
|
-
intensity: number;
|
|
15
|
+
get intensity(): number;
|
|
16
|
+
set intensity(value: number);
|
|
15
17
|
/**
|
|
16
18
|
* If the grain should be randomized on every frame
|
|
17
19
|
*/
|
|
18
|
-
animated: boolean;
|
|
20
|
+
get animated(): boolean;
|
|
21
|
+
set animated(value: boolean);
|
|
19
22
|
/**
|
|
20
23
|
* Gets a string identifying the name of the class
|
|
21
24
|
* @returns "GrainPostProcess" string
|
|
22
25
|
*/
|
|
23
26
|
getClassName(): string;
|
|
27
|
+
protected _effectWrapper: ThinGrainPostProcess;
|
|
24
28
|
/**
|
|
25
29
|
* Creates a new instance of @see GrainPostProcess
|
|
26
30
|
* @param name The name of the effect.
|
|
@@ -33,7 +37,6 @@ export declare class GrainPostProcess extends PostProcess {
|
|
|
33
37
|
* @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
|
|
34
38
|
*/
|
|
35
39
|
constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean, textureType?: number, blockCompilation?: boolean);
|
|
36
|
-
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
37
40
|
/**
|
|
38
41
|
* @internal
|
|
39
42
|
*/
|
|
@@ -4,10 +4,29 @@ import { PostProcess } from "./postProcess.js";
|
|
|
4
4
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
5
5
|
import { serialize } from "../Misc/decorators.js";
|
|
6
6
|
import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
7
|
+
import { ThinGrainPostProcess } from "./thinGrainPostProcess.js";
|
|
7
8
|
/**
|
|
8
9
|
* The GrainPostProcess adds noise to the image at mid luminance levels
|
|
9
10
|
*/
|
|
10
11
|
export class GrainPostProcess extends PostProcess {
|
|
12
|
+
/**
|
|
13
|
+
* The intensity of the grain added (default: 30)
|
|
14
|
+
*/
|
|
15
|
+
get intensity() {
|
|
16
|
+
return this._effectWrapper.intensity;
|
|
17
|
+
}
|
|
18
|
+
set intensity(value) {
|
|
19
|
+
this._effectWrapper.intensity = value;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* If the grain should be randomized on every frame
|
|
23
|
+
*/
|
|
24
|
+
get animated() {
|
|
25
|
+
return this._effectWrapper.animated;
|
|
26
|
+
}
|
|
27
|
+
set animated(value) {
|
|
28
|
+
this._effectWrapper.animated = value;
|
|
29
|
+
}
|
|
11
30
|
/**
|
|
12
31
|
* Gets a string identifying the name of the class
|
|
13
32
|
* @returns "GrainPostProcess" string
|
|
@@ -27,30 +46,22 @@ export class GrainPostProcess extends PostProcess {
|
|
|
27
46
|
* @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
|
|
28
47
|
*/
|
|
29
48
|
constructor(name, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
const localOptions = {
|
|
50
|
+
uniforms: ThinGrainPostProcess.Uniforms,
|
|
51
|
+
size: typeof options === "number" ? options : undefined,
|
|
52
|
+
camera,
|
|
53
|
+
samplingMode,
|
|
54
|
+
engine,
|
|
55
|
+
reusable,
|
|
56
|
+
textureType,
|
|
57
|
+
blockCompilation,
|
|
58
|
+
...options,
|
|
59
|
+
};
|
|
60
|
+
super(name, ThinGrainPostProcess.FragmentUrl, {
|
|
61
|
+
effectWrapper: typeof options === "number" || !options.effectWrapper ? new ThinGrainPostProcess(name, engine, localOptions) : undefined,
|
|
62
|
+
...localOptions,
|
|
42
63
|
});
|
|
43
64
|
}
|
|
44
|
-
_gatherImports(useWebGPU, list) {
|
|
45
|
-
if (useWebGPU) {
|
|
46
|
-
this._webGPUReady = true;
|
|
47
|
-
list.push(Promise.all([import("../ShadersWGSL/grain.fragment.js")]));
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
list.push(Promise.all([import("../Shaders/grain.fragment.js")]));
|
|
51
|
-
}
|
|
52
|
-
super._gatherImports(useWebGPU, list);
|
|
53
|
-
}
|
|
54
65
|
/**
|
|
55
66
|
* @internal
|
|
56
67
|
*/
|
|
@@ -62,9 +73,9 @@ export class GrainPostProcess extends PostProcess {
|
|
|
62
73
|
}
|
|
63
74
|
__decorate([
|
|
64
75
|
serialize()
|
|
65
|
-
], GrainPostProcess.prototype, "intensity",
|
|
76
|
+
], GrainPostProcess.prototype, "intensity", null);
|
|
66
77
|
__decorate([
|
|
67
78
|
serialize()
|
|
68
|
-
], GrainPostProcess.prototype, "animated",
|
|
79
|
+
], GrainPostProcess.prototype, "animated", null);
|
|
69
80
|
RegisterClass("BABYLON.GrainPostProcess", GrainPostProcess);
|
|
70
81
|
//# sourceMappingURL=grainPostProcess.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grainPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/grainPostProcess.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"grainPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/grainPostProcess.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC7C;;OAEG;IAEH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;IACzC,CAAC;IAED,IAAW,SAAS,CAAC,KAAa;QAC9B,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,KAAK,CAAC;IAC1C,CAAC;IAED;;OAEG;IAEH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;IACxC,CAAC;IAED,IAAW,QAAQ,CAAC,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AC;CACJ;AAzFG;IADC,SAAS,EAAE;iDAGX;AAUD;IADC,SAAS,EAAE;gDAGX;AA6EL,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\n\r\nimport type { Scene } from \"../scene\";\r\nimport { ThinGrainPostProcess } from \"./thinGrainPostProcess\";\r\n\r\n/**\r\n * The GrainPostProcess adds noise to the image at mid luminance levels\r\n */\r\nexport class GrainPostProcess extends PostProcess {\r\n /**\r\n * The intensity of the grain added (default: 30)\r\n */\r\n @serialize()\r\n public get intensity() {\r\n return this._effectWrapper.intensity;\r\n }\r\n\r\n public set intensity(value: number) {\r\n this._effectWrapper.intensity = value;\r\n }\r\n\r\n /**\r\n * If the grain should be randomized on every frame\r\n */\r\n @serialize()\r\n public get animated() {\r\n return this._effectWrapper.animated;\r\n }\r\n\r\n public set animated(value: boolean) {\r\n this._effectWrapper.animated = value;\r\n }\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"GrainPostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"GrainPostProcess\";\r\n }\r\n\r\n protected override _effectWrapper: ThinGrainPostProcess;\r\n\r\n /**\r\n * Creates a new instance of @see GrainPostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n constructor(\r\n name: string,\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera>,\r\n samplingMode?: number,\r\n engine?: AbstractEngine,\r\n reusable?: boolean,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n blockCompilation = false\r\n ) {\r\n const localOptions = {\r\n uniforms: ThinGrainPostProcess.Uniforms,\r\n size: typeof options === \"number\" ? options : undefined,\r\n camera,\r\n samplingMode,\r\n engine,\r\n reusable,\r\n textureType,\r\n blockCompilation,\r\n ...(options as PostProcessOptions),\r\n };\r\n\r\n super(name, ThinGrainPostProcess.FragmentUrl, {\r\n effectWrapper: typeof options === \"number\" || !options.effectWrapper ? new ThinGrainPostProcess(name, engine, localOptions) : undefined,\r\n ...localOptions,\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static override _Parse(parsedPostProcess: any, targetCamera: Camera, scene: Scene, rootUrl: string) {\r\n return SerializationHelper.Parse(\r\n () => {\r\n return new GrainPostProcess(\r\n parsedPostProcess.name,\r\n parsedPostProcess.options,\r\n targetCamera,\r\n parsedPostProcess.renderTargetSamplingMode,\r\n scene.getEngine(),\r\n parsedPostProcess.reusable\r\n );\r\n },\r\n parsedPostProcess,\r\n scene,\r\n rootUrl\r\n );\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GrainPostProcess\", GrainPostProcess);\r\n"]}
|
package/PostProcesses/index.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export * from "./thinChromaticAberrationPostProcess.js";
|
|
|
39
39
|
export * from "./thinCircleOfConfusionPostProcess.js";
|
|
40
40
|
export * from "./thinDepthOfFieldEffect.js";
|
|
41
41
|
export * from "./thinExtractHighlightsPostProcess.js";
|
|
42
|
+
export * from "./thinFXAAPostProcess.js";
|
|
43
|
+
export * from "./thinGrainPostProcess.js";
|
|
42
44
|
export * from "./thinImageProcessingPostProcess.js";
|
|
43
45
|
export * from "./thinPassPostProcess.js";
|
|
44
46
|
export * from "../Shaders/postprocess.vertex.js";
|
package/PostProcesses/index.js
CHANGED
|
@@ -40,6 +40,8 @@ export * from "./thinChromaticAberrationPostProcess.js";
|
|
|
40
40
|
export * from "./thinCircleOfConfusionPostProcess.js";
|
|
41
41
|
export * from "./thinDepthOfFieldEffect.js";
|
|
42
42
|
export * from "./thinExtractHighlightsPostProcess.js";
|
|
43
|
+
export * from "./thinFXAAPostProcess.js";
|
|
44
|
+
export * from "./thinGrainPostProcess.js";
|
|
43
45
|
export * from "./thinImageProcessingPostProcess.js";
|
|
44
46
|
export * from "./thinPassPostProcess.js";
|
|
45
47
|
// Postprocess
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;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1D,sBAAsB;AACtB,cAAc,uCAAuC,CAAC;AACtD,cAAc,2CAA2C,CAAC;AAE1D,QAAQ;AACR,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,qBAAqB;AACrB,cAAc,uCAAuC,CAAC;AACtD,cAAc,2CAA2C,CAAC;AAE1D,OAAO;AACP,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAE3C,MAAM;AACN,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AAEtD,WAAW;AACX,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AAEjD,cAAc;AACd,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AAEpD,mBAAmB;AACnB,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AAExD,cAAc;AACd,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,SAAS;AACT,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAE/C,aAAa;AACb,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,UAAU;AACV,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AAEpD,UAAU;AACV,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./anaglyphPostProcess\";\r\nexport * from \"./blackAndWhitePostProcess\";\r\nexport * from \"./bloomEffect\";\r\nexport * from \"./bloomMergePostProcess\";\r\nexport * from \"./blurPostProcess\";\r\nexport * from \"./chromaticAberrationPostProcess\";\r\nexport * from \"./circleOfConfusionPostProcess\";\r\nexport * from \"./colorCorrectionPostProcess\";\r\nexport * from \"./convolutionPostProcess\";\r\nexport * from \"./depthOfFieldBlurPostProcess\";\r\nexport * from \"./depthOfFieldEffect\";\r\nexport * from \"./depthOfFieldMergePostProcess\";\r\nexport * from \"./displayPassPostProcess\";\r\nexport * from \"./extractHighlightsPostProcess\";\r\nexport * from \"./filterPostProcess\";\r\nexport * from \"./fxaaPostProcess\";\r\nexport * from \"./grainPostProcess\";\r\nexport * from \"./highlightsPostProcess\";\r\nexport * from \"./imageProcessingPostProcess\";\r\nexport * from \"./motionBlurPostProcess\";\r\nexport * from \"./passPostProcess\";\r\nexport * from \"./postProcess\";\r\nexport * from \"./postProcessManager\";\r\nexport * from \"./refractionPostProcess\";\r\nexport * from \"./RenderPipeline/index\";\r\nexport * from \"./sharpenPostProcess\";\r\nexport * from \"./stereoscopicInterlacePostProcess\";\r\nexport * from \"./tonemapPostProcess\";\r\nexport * from \"./volumetricLightScatteringPostProcess\";\r\nexport * from \"./vrDistortionCorrectionPostProcess\";\r\nexport * from \"./vrMultiviewToSingleviewPostProcess\";\r\nexport * from \"./screenSpaceReflectionPostProcess\";\r\nexport * from \"./screenSpaceCurvaturePostProcess\";\r\n\r\nexport * from \"./thinAnaglyphPostProcess\";\r\nexport * from \"./thinBlackAndWhitePostProcess\";\r\nexport * from \"./thinBloomEffect\";\r\nexport * from \"./thinBlurPostProcess\";\r\nexport * from \"./thinChromaticAberrationPostProcess\";\r\nexport * from \"./thinCircleOfConfusionPostProcess\";\r\nexport * from \"./thinDepthOfFieldEffect\";\r\nexport * from \"./thinExtractHighlightsPostProcess\";\r\nexport * from \"./thinImageProcessingPostProcess\";\r\nexport * from \"./thinPassPostProcess\";\r\n\r\n// Postprocess\r\nexport * from \"../Shaders/postprocess.vertex\";\r\nexport * from \"../ShadersWGSL/postprocess.vertex\";\r\n\r\n// Blur postprocess\r\nexport * from \"../Shaders/kernelBlur.fragment\";\r\nexport * from \"../Shaders/kernelBlur.vertex\";\r\nexport * from \"../ShadersWGSL/kernelBlur.fragment\";\r\nexport * from \"../ShadersWGSL/kernelBlur.vertex\";\r\n\r\n// Pass postprocess\r\nexport * from \"../Shaders/pass.fragment\";\r\nexport * from \"../Shaders/passCube.fragment\";\r\nexport * from \"../ShadersWGSL/pass.fragment\";\r\nexport * from \"../ShadersWGSL/passCube.fragment\";\r\n\r\n// vrDFistortionCorrection postprocess\r\nexport * from \"../Shaders/vrDistortionCorrection.fragment\";\r\nexport * from \"../ShadersWGSL/vrDistortionCorrection.fragment\";\r\n\r\n// Image processing postprocess\r\nexport * from \"../ShadersWGSL/imageProcessing.fragment\";\r\nexport * from \"../Shaders/imageProcessing.fragment\";\r\n\r\n// Sharpen\r\nexport * from \"../Shaders/sharpen.fragment\";\r\nexport * from \"../ShadersWGSL/sharpen.fragment\";\r\n\r\n// Grain\r\nexport * from \"../Shaders/grain.fragment\";\r\nexport * from \"../ShadersWGSL/grain.fragment\";\r\n\r\n// Chromatic Aberration\r\nexport * from \"../Shaders/chromaticAberration.fragment\";\r\nexport * from \"../ShadersWGSL/chromaticAberration.fragment\";\r\n\r\n// Depth of field merge\r\nexport * from \"../Shaders/depthOfFieldMerge.fragment\";\r\nexport * from \"../ShadersWGSL/depthOfFieldMerge.fragment\";\r\n\r\n// Circle of confusion\r\nexport * from \"../Shaders/circleOfConfusion.fragment\";\r\nexport * from \"../ShadersWGSL/circleOfConfusion.fragment\";\r\n\r\n// Bloom\r\nexport * from \"../Shaders/bloomMerge.fragment\";\r\nexport * from \"../ShadersWGSL/bloomMerge.fragment\";\r\n\r\n// Extract highlights\r\nexport * from \"../Shaders/extractHighlights.fragment\";\r\nexport * from \"../ShadersWGSL/extractHighlights.fragment\";\r\n\r\n// FXAA\r\nexport * from \"../Shaders/fxaa.fragment\";\r\nexport * from \"../Shaders/fxaa.vertex\";\r\nexport * from \"../ShadersWGSL/fxaa.fragment\";\r\nexport * from \"../ShadersWGSL/fxaa.vertex\";\r\n\r\n// B&W\r\nexport * from \"../Shaders/blackAndWhite.fragment\";\r\nexport * from \"../ShadersWGSL/blackAndWhite.fragment\";\r\n\r\n// Anaglyph\r\nexport * from \"../Shaders/anaglyph.fragment\";\r\nexport * from \"../ShadersWGSL/anaglyph.fragment\";\r\n\r\n// Convolution\r\nexport * from \"../Shaders/convolution.fragment\";\r\nexport * from \"../ShadersWGSL/convolution.fragment\";\r\n\r\n// Color correction\r\nexport * from \"../Shaders/colorCorrection.fragment\";\r\nexport * from \"../ShadersWGSL/colorCorrection.fragment\";\r\n\r\n// Motion blur\r\nexport * from \"../Shaders/motionBlur.fragment\";\r\nexport * from \"../ShadersWGSL/motionBlur.fragment\";\r\n\r\n// Filter\r\nexport * from \"../Shaders/filter.fragment\";\r\nexport * from \"../ShadersWGSL/filter.fragment\";\r\n\r\n// Highlights\r\nexport * from \"../Shaders/highlights.fragment\";\r\nexport * from \"../ShadersWGSL/highlights.fragment\";\r\n\r\n// Display\r\nexport * from \"../Shaders/displayPass.fragment\";\r\nexport * from \"../ShadersWGSL/displayPass.fragment\";\r\n\r\n// Tonemap\r\nexport * from \"../Shaders/tonemap.fragment\";\r\nexport * from \"../ShadersWGSL/tonemap.fragment\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;A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C;AAEhD,QAAQ;AACR,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAE9C,uBAAuB;AACvB,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAE5D,uBAAuB;AACvB,cAAc,uCAAuC,CAAC;AACtD,cAAc,2CAA2C,CAAC;AAE1D,sBAAsB;AACtB,cAAc,uCAAuC,CAAC;AACtD,cAAc,2CAA2C,CAAC;AAE1D,QAAQ;AACR,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,qBAAqB;AACrB,cAAc,uCAAuC,CAAC;AACtD,cAAc,2CAA2C,CAAC;AAE1D,OAAO;AACP,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAE3C,MAAM;AACN,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AAEtD,WAAW;AACX,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AAEjD,cAAc;AACd,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AAEpD,mBAAmB;AACnB,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AAExD,cAAc;AACd,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,SAAS;AACT,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAE/C,aAAa;AACb,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,UAAU;AACV,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AAEpD,UAAU;AACV,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./anaglyphPostProcess\";\r\nexport * from \"./blackAndWhitePostProcess\";\r\nexport * from \"./bloomEffect\";\r\nexport * from \"./bloomMergePostProcess\";\r\nexport * from \"./blurPostProcess\";\r\nexport * from \"./chromaticAberrationPostProcess\";\r\nexport * from \"./circleOfConfusionPostProcess\";\r\nexport * from \"./colorCorrectionPostProcess\";\r\nexport * from \"./convolutionPostProcess\";\r\nexport * from \"./depthOfFieldBlurPostProcess\";\r\nexport * from \"./depthOfFieldEffect\";\r\nexport * from \"./depthOfFieldMergePostProcess\";\r\nexport * from \"./displayPassPostProcess\";\r\nexport * from \"./extractHighlightsPostProcess\";\r\nexport * from \"./filterPostProcess\";\r\nexport * from \"./fxaaPostProcess\";\r\nexport * from \"./grainPostProcess\";\r\nexport * from \"./highlightsPostProcess\";\r\nexport * from \"./imageProcessingPostProcess\";\r\nexport * from \"./motionBlurPostProcess\";\r\nexport * from \"./passPostProcess\";\r\nexport * from \"./postProcess\";\r\nexport * from \"./postProcessManager\";\r\nexport * from \"./refractionPostProcess\";\r\nexport * from \"./RenderPipeline/index\";\r\nexport * from \"./sharpenPostProcess\";\r\nexport * from \"./stereoscopicInterlacePostProcess\";\r\nexport * from \"./tonemapPostProcess\";\r\nexport * from \"./volumetricLightScatteringPostProcess\";\r\nexport * from \"./vrDistortionCorrectionPostProcess\";\r\nexport * from \"./vrMultiviewToSingleviewPostProcess\";\r\nexport * from \"./screenSpaceReflectionPostProcess\";\r\nexport * from \"./screenSpaceCurvaturePostProcess\";\r\n\r\nexport * from \"./thinAnaglyphPostProcess\";\r\nexport * from \"./thinBlackAndWhitePostProcess\";\r\nexport * from \"./thinBloomEffect\";\r\nexport * from \"./thinBlurPostProcess\";\r\nexport * from \"./thinChromaticAberrationPostProcess\";\r\nexport * from \"./thinCircleOfConfusionPostProcess\";\r\nexport * from \"./thinDepthOfFieldEffect\";\r\nexport * from \"./thinExtractHighlightsPostProcess\";\r\nexport * from \"./thinFXAAPostProcess\";\r\nexport * from \"./thinGrainPostProcess\";\r\nexport * from \"./thinImageProcessingPostProcess\";\r\nexport * from \"./thinPassPostProcess\";\r\n\r\n// Postprocess\r\nexport * from \"../Shaders/postprocess.vertex\";\r\nexport * from \"../ShadersWGSL/postprocess.vertex\";\r\n\r\n// Blur postprocess\r\nexport * from \"../Shaders/kernelBlur.fragment\";\r\nexport * from \"../Shaders/kernelBlur.vertex\";\r\nexport * from \"../ShadersWGSL/kernelBlur.fragment\";\r\nexport * from \"../ShadersWGSL/kernelBlur.vertex\";\r\n\r\n// Pass postprocess\r\nexport * from \"../Shaders/pass.fragment\";\r\nexport * from \"../Shaders/passCube.fragment\";\r\nexport * from \"../ShadersWGSL/pass.fragment\";\r\nexport * from \"../ShadersWGSL/passCube.fragment\";\r\n\r\n// vrDFistortionCorrection postprocess\r\nexport * from \"../Shaders/vrDistortionCorrection.fragment\";\r\nexport * from \"../ShadersWGSL/vrDistortionCorrection.fragment\";\r\n\r\n// Image processing postprocess\r\nexport * from \"../ShadersWGSL/imageProcessing.fragment\";\r\nexport * from \"../Shaders/imageProcessing.fragment\";\r\n\r\n// Sharpen\r\nexport * from \"../Shaders/sharpen.fragment\";\r\nexport * from \"../ShadersWGSL/sharpen.fragment\";\r\n\r\n// Grain\r\nexport * from \"../Shaders/grain.fragment\";\r\nexport * from \"../ShadersWGSL/grain.fragment\";\r\n\r\n// Chromatic Aberration\r\nexport * from \"../Shaders/chromaticAberration.fragment\";\r\nexport * from \"../ShadersWGSL/chromaticAberration.fragment\";\r\n\r\n// Depth of field merge\r\nexport * from \"../Shaders/depthOfFieldMerge.fragment\";\r\nexport * from \"../ShadersWGSL/depthOfFieldMerge.fragment\";\r\n\r\n// Circle of confusion\r\nexport * from \"../Shaders/circleOfConfusion.fragment\";\r\nexport * from \"../ShadersWGSL/circleOfConfusion.fragment\";\r\n\r\n// Bloom\r\nexport * from \"../Shaders/bloomMerge.fragment\";\r\nexport * from \"../ShadersWGSL/bloomMerge.fragment\";\r\n\r\n// Extract highlights\r\nexport * from \"../Shaders/extractHighlights.fragment\";\r\nexport * from \"../ShadersWGSL/extractHighlights.fragment\";\r\n\r\n// FXAA\r\nexport * from \"../Shaders/fxaa.fragment\";\r\nexport * from \"../Shaders/fxaa.vertex\";\r\nexport * from \"../ShadersWGSL/fxaa.fragment\";\r\nexport * from \"../ShadersWGSL/fxaa.vertex\";\r\n\r\n// B&W\r\nexport * from \"../Shaders/blackAndWhite.fragment\";\r\nexport * from \"../ShadersWGSL/blackAndWhite.fragment\";\r\n\r\n// Anaglyph\r\nexport * from \"../Shaders/anaglyph.fragment\";\r\nexport * from \"../ShadersWGSL/anaglyph.fragment\";\r\n\r\n// Convolution\r\nexport * from \"../Shaders/convolution.fragment\";\r\nexport * from \"../ShadersWGSL/convolution.fragment\";\r\n\r\n// Color correction\r\nexport * from \"../Shaders/colorCorrection.fragment\";\r\nexport * from \"../ShadersWGSL/colorCorrection.fragment\";\r\n\r\n// Motion blur\r\nexport * from \"../Shaders/motionBlur.fragment\";\r\nexport * from \"../ShadersWGSL/motionBlur.fragment\";\r\n\r\n// Filter\r\nexport * from \"../Shaders/filter.fragment\";\r\nexport * from \"../ShadersWGSL/filter.fragment\";\r\n\r\n// Highlights\r\nexport * from \"../Shaders/highlights.fragment\";\r\nexport * from \"../ShadersWGSL/highlights.fragment\";\r\n\r\n// Display\r\nexport * from \"../Shaders/displayPass.fragment\";\r\nexport * from \"../ShadersWGSL/displayPass.fragment\";\r\n\r\n// Tonemap\r\nexport * from \"../Shaders/tonemap.fragment\";\r\nexport * from \"../ShadersWGSL/tonemap.fragment\";\r\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from "../index.js";
|
|
2
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
3
|
+
import { Vector2 } from "../Maths/math.vector.js";
|
|
4
|
+
/**
|
|
5
|
+
* Postprocess used to apply FXAA (antialiasing) to the scene
|
|
6
|
+
*/
|
|
7
|
+
export declare class ThinFXAAPostProcess extends EffectWrapper {
|
|
8
|
+
private static _GetDefines;
|
|
9
|
+
/**
|
|
10
|
+
* The vertex shader url
|
|
11
|
+
*/
|
|
12
|
+
static readonly VertexUrl = "fxaa";
|
|
13
|
+
/**
|
|
14
|
+
* The fragment shader url
|
|
15
|
+
*/
|
|
16
|
+
static readonly FragmentUrl = "fxaa";
|
|
17
|
+
/**
|
|
18
|
+
* The list of uniforms used by the effect
|
|
19
|
+
*/
|
|
20
|
+
static readonly Uniforms: string[];
|
|
21
|
+
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a new FXAA post process
|
|
24
|
+
* @param name Name of the effect
|
|
25
|
+
* @param engine Engine to use to render the effect. If not provided, the last created engine will be used
|
|
26
|
+
* @param options Options to configure the effect
|
|
27
|
+
*/
|
|
28
|
+
constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions);
|
|
29
|
+
/**
|
|
30
|
+
* The texel size of the texture to apply FXAA on
|
|
31
|
+
*/
|
|
32
|
+
texelSize: Vector2;
|
|
33
|
+
bind(noDefaultBindings?: boolean): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
2
|
+
import { Engine } from "../Engines/engine.js";
|
|
3
|
+
import { Vector2 } from "../Maths/math.vector.js";
|
|
4
|
+
/**
|
|
5
|
+
* Postprocess used to apply FXAA (antialiasing) to the scene
|
|
6
|
+
*/
|
|
7
|
+
export class ThinFXAAPostProcess extends EffectWrapper {
|
|
8
|
+
static _GetDefines(engine) {
|
|
9
|
+
if (!engine) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const driverInfo = engine.extractDriverInfo();
|
|
13
|
+
if (driverInfo.toLowerCase().indexOf("mali") > -1) {
|
|
14
|
+
return "#define MALI 1\n";
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
_gatherImports(useWebGPU, list) {
|
|
19
|
+
if (useWebGPU) {
|
|
20
|
+
this._webGPUReady = true;
|
|
21
|
+
list.push(Promise.all([import("../ShadersWGSL/fxaa.fragment.js"), import("../ShadersWGSL/fxaa.vertex.js")]));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
list.push(Promise.all([import("../Shaders/fxaa.fragment.js"), import("../Shaders/fxaa.vertex.js")]));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Constructs a new FXAA post process
|
|
29
|
+
* @param name Name of the effect
|
|
30
|
+
* @param engine Engine to use to render the effect. If not provided, the last created engine will be used
|
|
31
|
+
* @param options Options to configure the effect
|
|
32
|
+
*/
|
|
33
|
+
constructor(name, engine = null, options) {
|
|
34
|
+
const localOptions = {
|
|
35
|
+
...options,
|
|
36
|
+
name,
|
|
37
|
+
engine: engine || Engine.LastCreatedEngine,
|
|
38
|
+
useShaderStore: true,
|
|
39
|
+
useAsPostProcess: true,
|
|
40
|
+
vertexShader: ThinFXAAPostProcess.VertexUrl,
|
|
41
|
+
fragmentShader: ThinFXAAPostProcess.FragmentUrl,
|
|
42
|
+
uniforms: ThinFXAAPostProcess.Uniforms,
|
|
43
|
+
};
|
|
44
|
+
super({
|
|
45
|
+
...localOptions,
|
|
46
|
+
defines: ThinFXAAPostProcess._GetDefines(localOptions.engine),
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* The texel size of the texture to apply FXAA on
|
|
50
|
+
*/
|
|
51
|
+
this.texelSize = new Vector2(0, 0);
|
|
52
|
+
}
|
|
53
|
+
bind(noDefaultBindings = false) {
|
|
54
|
+
super.bind(noDefaultBindings);
|
|
55
|
+
this._drawWrapper.effect.setFloat2("texelSize", this.texelSize.x, this.texelSize.y);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The vertex shader url
|
|
60
|
+
*/
|
|
61
|
+
ThinFXAAPostProcess.VertexUrl = "fxaa";
|
|
62
|
+
/**
|
|
63
|
+
* The fragment shader url
|
|
64
|
+
*/
|
|
65
|
+
ThinFXAAPostProcess.FragmentUrl = "fxaa";
|
|
66
|
+
/**
|
|
67
|
+
* The list of uniforms used by the effect
|
|
68
|
+
*/
|
|
69
|
+
ThinFXAAPostProcess.Uniforms = ["texelSize"];
|
|
70
|
+
//# sourceMappingURL=thinFXAAPostProcess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinFXAAPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinFXAAPostProcess.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAC1C,MAAM,CAAC,WAAW,CAAC,MAAsB;QAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC9C,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAChD,OAAO,kBAAkB,CAAC;QAC9B,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAiBkB,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3G,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;QACnG,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,YAAY,IAAY,EAAE,SAAmC,IAAI,EAAE,OAAsC;QACrG,MAAM,YAAY,GAAG;YACjB,GAAG,OAAO;YACV,IAAI;YACJ,MAAM,EAAE,MAAM,IAAI,MAAM,CAAC,iBAAkB;YAC3C,cAAc,EAAE,IAAI;YACpB,gBAAgB,EAAE,IAAI;YACtB,YAAY,EAAE,mBAAmB,CAAC,SAAS;YAC3C,cAAc,EAAE,mBAAmB,CAAC,WAAW;YAC/C,QAAQ,EAAE,mBAAmB,CAAC,QAAQ;SACzC,CAAC;QAEF,KAAK,CAAC;YACF,GAAG,YAAY;YACf,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC;SAChE,CAAC,CAAC;QAGP;;WAEG;QACI,cAAS,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IALrC,CAAC;IAOe,IAAI,CAAC,iBAAiB,GAAG,KAAK;QAC1C,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9B,IAAI,CAAC,YAAY,CAAC,MAAO,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACzF,CAAC;;AAxDD;;GAEG;AACoB,6BAAS,GAAG,MAAM,AAAT,CAAU;AAE1C;;GAEG;AACoB,+BAAW,GAAG,MAAM,AAAT,CAAU;AAE5C;;GAEG;AACoB,4BAAQ,GAAG,CAAC,WAAW,CAAC,AAAhB,CAAiB","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from \"core/index\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\n\r\n/**\r\n * Postprocess used to apply FXAA (antialiasing) to the scene\r\n */\r\nexport class ThinFXAAPostProcess extends EffectWrapper {\r\n private static _GetDefines(engine: AbstractEngine): Nullable<string> {\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const driverInfo = engine.extractDriverInfo();\r\n if (driverInfo.toLowerCase().indexOf(\"mali\") > -1) {\r\n return \"#define MALI 1\\n\";\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * The vertex shader url\r\n */\r\n public static readonly VertexUrl = \"fxaa\";\r\n\r\n /**\r\n * The fragment shader url\r\n */\r\n public static readonly FragmentUrl = \"fxaa\";\r\n\r\n /**\r\n * The list of uniforms used by the effect\r\n */\r\n public static readonly Uniforms = [\"texelSize\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(Promise.all([import(\"../ShadersWGSL/fxaa.fragment\"), import(\"../ShadersWGSL/fxaa.vertex\")]));\r\n } else {\r\n list.push(Promise.all([import(\"../Shaders/fxaa.fragment\"), import(\"../Shaders/fxaa.vertex\")]));\r\n }\r\n }\r\n\r\n /**\r\n * Constructs a new FXAA post process\r\n * @param name Name of the effect\r\n * @param engine Engine to use to render the effect. If not provided, the last created engine will be used\r\n * @param options Options to configure the effect\r\n */\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, options?: EffectWrapperCreationOptions) {\r\n const localOptions = {\r\n ...options,\r\n name,\r\n engine: engine || Engine.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n vertexShader: ThinFXAAPostProcess.VertexUrl,\r\n fragmentShader: ThinFXAAPostProcess.FragmentUrl,\r\n uniforms: ThinFXAAPostProcess.Uniforms,\r\n };\r\n\r\n super({\r\n ...localOptions,\r\n defines: ThinFXAAPostProcess._GetDefines(localOptions.engine),\r\n });\r\n }\r\n\r\n /**\r\n * The texel size of the texture to apply FXAA on\r\n */\r\n public texelSize = new Vector2(0, 0);\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n this._drawWrapper.effect!.setFloat2(\"texelSize\", this.texelSize.x, this.texelSize.y);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from "../index.js";
|
|
2
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
3
|
+
/**
|
|
4
|
+
* Post process used to render a grain effect
|
|
5
|
+
*/
|
|
6
|
+
export declare class ThinGrainPostProcess extends EffectWrapper {
|
|
7
|
+
/**
|
|
8
|
+
* The fragment shader url
|
|
9
|
+
*/
|
|
10
|
+
static readonly FragmentUrl = "grain";
|
|
11
|
+
/**
|
|
12
|
+
* The list of uniforms used by the effect
|
|
13
|
+
*/
|
|
14
|
+
static readonly Uniforms: string[];
|
|
15
|
+
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a new grain post process
|
|
18
|
+
* @param name Name of the effect
|
|
19
|
+
* @param engine Engine to use to render the effect. If not provided, the last created engine will be used
|
|
20
|
+
* @param options Options to configure the effect
|
|
21
|
+
*/
|
|
22
|
+
constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions);
|
|
23
|
+
/**
|
|
24
|
+
* The intensity of the grain added (default: 30)
|
|
25
|
+
*/
|
|
26
|
+
intensity: number;
|
|
27
|
+
/**
|
|
28
|
+
* If the grain should be randomized on every frame
|
|
29
|
+
*/
|
|
30
|
+
animated: boolean;
|
|
31
|
+
bind(noDefaultBindings?: boolean): void;
|
|
32
|
+
}
|