@onerjs/core 8.28.0 → 8.28.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/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +40 -16
- package/Collisions/gpuPicker.js +216 -95
- package/Collisions/gpuPicker.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +5 -1
- package/Decorators/nodeDecorator.js +4 -0
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.d.ts +30 -0
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js +56 -0
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.d.ts +32 -0
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js +62 -0
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.d.ts +36 -0
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.js +88 -0
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/index.d.ts +3 -0
- package/FrameGraph/Node/Blocks/index.js +3 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.d.ts +17 -0
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js +18 -0
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/filterTask.d.ts +16 -0
- package/FrameGraph/Tasks/PostProcesses/filterTask.js +17 -0
- package/FrameGraph/Tasks/PostProcesses/filterTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.d.ts +16 -0
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.js +17 -0
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.js.map +1 -0
- package/FrameGraph/index.d.ts +3 -0
- package/FrameGraph/index.js +3 -0
- package/FrameGraph/index.js.map +1 -1
- package/Materials/Textures/texture.js +9 -2
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/effect.d.ts +1 -0
- package/Materials/effect.js +7 -1
- package/Materials/effect.js.map +1 -1
- package/Particles/gpuParticleSystem.js +2 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.js +4 -3
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/v2/physicsAggregate.js +4 -3
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.d.ts +3 -3
- package/PostProcesses/colorCorrectionPostProcess.js +21 -21
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/filterPostProcess.d.ts +4 -2
- package/PostProcesses/filterPostProcess.js +22 -15
- package/PostProcesses/filterPostProcess.js.map +1 -1
- package/PostProcesses/index.d.ts +3 -0
- package/PostProcesses/index.js +3 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/thinColorCorrectionPostProcess.d.ts +30 -0
- package/PostProcesses/thinColorCorrectionPostProcess.js +52 -0
- package/PostProcesses/thinColorCorrectionPostProcess.js.map +1 -0
- package/PostProcesses/thinFilterPostProcess.d.ts +29 -0
- package/PostProcesses/thinFilterPostProcess.js +51 -0
- package/PostProcesses/thinFilterPostProcess.js.map +1 -0
- package/PostProcesses/thinTonemapPostProcess.d.ts +52 -0
- package/PostProcesses/thinTonemapPostProcess.js +83 -0
- package/PostProcesses/thinTonemapPostProcess.js.map +1 -0
- package/PostProcesses/tonemapPostProcess.d.ts +23 -21
- package/PostProcesses/tonemapPostProcess.js +55 -46
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +6 -1
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/geometry.fragment.js +3 -1
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/geometry.vertex.js +10 -2
- package/Shaders/geometry.vertex.js.map +1 -1
- package/Shaders/picking.fragment.js +20 -6
- package/Shaders/picking.fragment.js.map +1 -1
- package/Shaders/picking.vertex.js +4 -3
- package/Shaders/picking.vertex.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +3 -1
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.vertex.js +10 -2
- package/ShadersWGSL/geometry.vertex.js.map +1 -1
- package/ShadersWGSL/picking.fragment.js +11 -6
- package/ShadersWGSL/picking.fragment.js.map +1 -1
- package/ShadersWGSL/picking.vertex.js +4 -3
- package/ShadersWGSL/picking.vertex.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.d.ts +1 -1
- package/XR/features/WebXRBackgroundRemover.d.ts +1 -1
- package/XR/features/WebXRControllerMovement.d.ts +1 -1
- package/XR/features/WebXRControllerPhysics.d.ts +1 -1
- package/XR/features/WebXRControllerPointerSelection.d.ts +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +1 -1
- package/XR/features/WebXRDOMOverlay.d.ts +1 -1
- package/XR/features/WebXRDepthSensing.d.ts +1 -1
- package/XR/features/WebXREyeTracking.d.ts +1 -1
- package/XR/features/WebXRFeaturePointSystem.d.ts +1 -1
- package/XR/features/WebXRHandTracking.d.ts +1 -1
- package/XR/features/WebXRHitTest.d.ts +1 -1
- package/XR/features/WebXRHitTestLegacy.d.ts +1 -1
- package/XR/features/WebXRImageTracking.d.ts +1 -1
- package/XR/features/WebXRLayers.d.ts +1 -1
- package/XR/features/WebXRLightEstimation.d.ts +1 -1
- package/XR/features/WebXRMeshDetector.d.ts +1 -1
- package/XR/features/WebXRNearInteraction.d.ts +1 -1
- package/XR/features/WebXRPlaneDetector.d.ts +1 -1
- package/XR/features/WebXRRawCameraAccess.d.ts +1 -1
- package/XR/features/WebXRSpaceWarp.d.ts +1 -1
- package/XR/webXRDefaultExperience.js +1 -1
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXRFeaturesManager.d.ts +116 -27
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/package.json +1 -1
|
@@ -46,6 +46,8 @@ export class PhysicsAggregate {
|
|
|
46
46
|
this._options.mass = _options.mass === void 0 ? 0 : _options.mass;
|
|
47
47
|
this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;
|
|
48
48
|
this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;
|
|
49
|
+
this._options.isTriggerShape = _options.isTriggerShape ?? false;
|
|
50
|
+
this._options.mesh = _options.mesh ?? (m._isMesh ? m : undefined);
|
|
49
51
|
const motionType = this._options.mass === 0 ? 0 /* PhysicsMotionType.STATIC */ : 2 /* PhysicsMotionType.DYNAMIC */;
|
|
50
52
|
const startAsleep = this._options.startAsleep ?? false;
|
|
51
53
|
this.body = new PhysicsBody(transformNode, motionType, startAsleep, this._scene);
|
|
@@ -149,6 +151,7 @@ export class PhysicsAggregate {
|
|
|
149
151
|
this._options.mass = _options.mass === void 0 ? 0 : _options.mass;
|
|
150
152
|
this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;
|
|
151
153
|
this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;
|
|
154
|
+
this._options.isTriggerShape = _options.isTriggerShape ?? false;
|
|
152
155
|
const motionType = this._options.mass === 0 ? 0 /* PhysicsMotionType.STATIC */ : 2 /* PhysicsMotionType.DYNAMIC */;
|
|
153
156
|
const startAsleep = this._options.startAsleep ?? false;
|
|
154
157
|
if (motionType !== this.body.motionType) {
|
|
@@ -158,9 +161,7 @@ export class PhysicsAggregate {
|
|
|
158
161
|
this.body.startAsleep = startAsleep;
|
|
159
162
|
}
|
|
160
163
|
this._addSizeOptions();
|
|
161
|
-
|
|
162
|
-
this.shape.isTrigger = true;
|
|
163
|
-
}
|
|
164
|
+
this.shape.isTrigger = this._options.isTriggerShape;
|
|
164
165
|
if (this.material) {
|
|
165
166
|
this.material.friction = this._options.friction;
|
|
166
167
|
this.material.restitution = this._options.restitution;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsAggregate.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsAggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAOlE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAmExD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAoBzB;IACI;;OAEG;IACI,aAA4B;IACnC;;OAEG;IACI,IAAqC,EACpC,WAAuC,EAAE,IAAI,EAAE,CAAC,EAAE,EAClD,MAAc;QANf,kBAAa,GAAb,aAAa,CAAe;QAI5B,SAAI,GAAJ,IAAI,CAAiC;QACpC,aAAQ,GAAR,QAAQ,CAA0C;QAClD,WAAM,GAAN,MAAM,CAAQ;QAdlB,8BAAyB,GAAG,IAAI,CAAC;QAgBrC,eAAe;QACf,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YACvE,OAAO;QACX,CAAC;QACD,MAAM,CAAC,GAAG,aAAqB,CAAC;QAChC,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,C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C;QACD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAChD,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAC9E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { PhysicsBody } from \"./physicsBody\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { PhysicsShape } from \"./physicsShape\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { Quaternion, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { WithinEpsilon } from \"../../Maths/math.scalar.functions\";\r\nimport { PhysicsMotionType, PhysicsShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { BoundingBox } from \"../../Culling/boundingBox\";\r\n\r\n/**\r\n * The interface for the physics aggregate parameters\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsAggregateParameters {\r\n /**\r\n * The mass of the physics aggregate\r\n */\r\n mass: number;\r\n\r\n /**\r\n * The friction of the physics aggregate\r\n */\r\n friction?: number;\r\n\r\n /**\r\n * The coefficient of restitution of the physics aggregate\r\n */\r\n restitution?: number;\r\n\r\n /**\r\n * Radius for sphere, cylinder and capsule\r\n */\r\n radius?: number;\r\n\r\n /**\r\n * Starting point for cylinder/capsule\r\n */\r\n pointA?: Vector3;\r\n\r\n /**\r\n * Ending point for cylinder/capsule\r\n */\r\n pointB?: Vector3;\r\n\r\n /**\r\n * Extents for box\r\n */\r\n extents?: Vector3;\r\n\r\n /**\r\n * Orientation for box\r\n */\r\n rotation?: Quaternion;\r\n\r\n /**\r\n * mesh local center\r\n */\r\n center?: Vector3;\r\n\r\n /**\r\n * mesh object. Used for mesh and convex hull aggregates.\r\n */\r\n mesh?: Mesh;\r\n\r\n /**\r\n * Physics engine will try to make this body sleeping and not active\r\n */\r\n startAsleep?: boolean;\r\n\r\n /**\r\n * If true, mark the created shape as a trigger shape\r\n */\r\n isTriggerShape?: boolean;\r\n}\r\n/**\r\n * Helper class to create and interact with a PhysicsAggregate.\r\n * This is a transition object that works like Physics Plugin V1 Impostors.\r\n * This helper instantiates all mandatory physics objects to get a body/shape and material.\r\n * It's less efficient than handling body and shapes independently but for prototyping or\r\n * a small numbers of physics objects, it's good enough.\r\n */\r\nexport class PhysicsAggregate {\r\n /**\r\n * The body that is associated with this aggregate\r\n */\r\n public body: PhysicsBody;\r\n\r\n /**\r\n * The shape that is associated with this aggregate\r\n */\r\n public shape: PhysicsShape;\r\n\r\n /**\r\n * The material that is associated with this aggregate\r\n */\r\n public material: PhysicsMaterial;\r\n\r\n private _disposeShapeWhenDisposed = true;\r\n\r\n private _nodeDisposeObserver: Nullable<Observer<Node>>;\r\n\r\n constructor(\r\n /**\r\n * The physics-enabled object used as the physics aggregate\r\n */\r\n public transformNode: TransformNode,\r\n /**\r\n * The type of the physics aggregate\r\n */\r\n public type: PhysicsShapeType | PhysicsShape,\r\n private _options: PhysicsAggregateParameters = { mass: 0 },\r\n private _scene?: Scene\r\n ) {\r\n //sanity check!\r\n if (!this.transformNode) {\r\n Logger.Error(\"No object was provided. A physics object is obligatory\");\r\n return;\r\n }\r\n const m = transformNode as Mesh;\r\n if (this.transformNode.parent && this._options.mass !== 0 && m.hasThinInstances) {\r\n Logger.Warn(\r\n \"A physics body has been created for an object which has a parent and thin instances. Babylon physics currently works in local space so unexpected issues may occur.\"\r\n );\r\n }\r\n\r\n // Legacy support for old syntax.\r\n if (!this._scene && transformNode.getScene) {\r\n this._scene = transformNode.getScene();\r\n }\r\n\r\n if (!this._scene) {\r\n return;\r\n }\r\n\r\n //default options params\r\n this._options.mass = _options.mass === void 0 ? 0 : _options.mass;\r\n this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;\r\n this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;\r\n\r\n const motionType = this._options.mass === 0 ? PhysicsMotionType.STATIC : PhysicsMotionType.DYNAMIC;\r\n const startAsleep = this._options.startAsleep ?? false;\r\n this.body = new PhysicsBody(transformNode, motionType, startAsleep, this._scene);\r\n this._addSizeOptions();\r\n if ((type as any).getClassName && (type as any).getClassName() === \"PhysicsShape\") {\r\n this.shape = type as PhysicsShape;\r\n this._disposeShapeWhenDisposed = false;\r\n } else {\r\n this.shape = new PhysicsShape({ type: type as PhysicsShapeType, parameters: this._options as any }, this._scene);\r\n }\r\n\r\n if (this._options.isTriggerShape) {\r\n this.shape.isTrigger = true;\r\n }\r\n\r\n this.material = { friction: this._options.friction, restitution: this._options.restitution };\r\n this.body.shape = this.shape;\r\n this.shape.material = this.material;\r\n\r\n this.body.setMassProperties({ mass: this._options.mass });\r\n\r\n this._nodeDisposeObserver = this.transformNode.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n private _getObjectBoundingBox() {\r\n if ((this.transformNode as AbstractMesh).getRawBoundingInfo) {\r\n return (this.transformNode as AbstractMesh).getRawBoundingInfo().boundingBox;\r\n } else {\r\n return new BoundingBox(new Vector3(-0.5, -0.5, -0.5), new Vector3(0.5, 0.5, 0.5));\r\n }\r\n }\r\n\r\n private _hasVertices(node: TransformNode): boolean {\r\n return (node as any)?.getTotalVertices() > 0;\r\n }\r\n\r\n private _addSizeOptions(): void {\r\n this.transformNode.computeWorldMatrix(true);\r\n const bb = this._getObjectBoundingBox();\r\n const extents = TmpVectors.Vector3[0];\r\n extents.copyFrom(bb.extendSize);\r\n extents.scaleInPlace(2);\r\n extents.multiplyInPlace(this.transformNode.absoluteScaling);\r\n // In case we had any negative scaling, we need to take the absolute value of the extents.\r\n extents.x = Math.abs(extents.x);\r\n extents.y = Math.abs(extents.y);\r\n extents.z = Math.abs(extents.z);\r\n\r\n const min = TmpVectors.Vector3[1];\r\n min.copyFrom(bb.minimum);\r\n min.multiplyInPlace(this.transformNode.absoluteScaling);\r\n\r\n if (!this._options.center) {\r\n const center = new Vector3();\r\n center.copyFrom(bb.center);\r\n center.multiplyInPlace(this.transformNode.absoluteScaling);\r\n this._options.center = center;\r\n }\r\n\r\n switch (this.type) {\r\n case PhysicsShapeType.SPHERE:\r\n if (!this._options.radius && WithinEpsilon(extents.x, extents.y, 0.0001) && WithinEpsilon(extents.x, extents.z, 0.0001)) {\r\n this._options.radius = extents.x / 2;\r\n } else if (!this._options.radius) {\r\n Logger.Warn(\"Non uniform scaling is unsupported for sphere shapes. Setting the radius to the biggest bounding box extent.\");\r\n this._options.radius = Math.max(extents.x, extents.y, extents.z) / 2;\r\n }\r\n break;\r\n case PhysicsShapeType.CAPSULE:\r\n {\r\n const capRadius = extents.x / 2;\r\n this._options.radius = this._options.radius ?? capRadius;\r\n this._options.pointA = this._options.pointA ?? new Vector3(0, min.y + capRadius, 0);\r\n this._options.pointB = this._options.pointB ?? new Vector3(0, min.y + extents.y - capRadius, 0);\r\n }\r\n break;\r\n case PhysicsShapeType.CYLINDER:\r\n {\r\n const capRadius = extents.x / 2;\r\n this._options.radius = this._options.radius ?? capRadius;\r\n this._options.pointA = this._options.pointA ?? new Vector3(0, min.y, 0);\r\n this._options.pointB = this._options.pointB ?? new Vector3(0, min.y + extents.y, 0);\r\n }\r\n break;\r\n case PhysicsShapeType.MESH:\r\n case PhysicsShapeType.CONVEX_HULL:\r\n case PhysicsShapeType.HEIGHTFIELD:\r\n if (!this._options.mesh && this._hasVertices(this.transformNode)) {\r\n this._options.mesh = this.transformNode as Mesh;\r\n } else if (!this._options.mesh || !this._hasVertices(this._options.mesh)) {\r\n throw new Error(\r\n \"No valid mesh was provided for mesh or convex hull shape parameter. Please provide a mesh with valid geometry (number of vertices greater than 0).\"\r\n );\r\n }\r\n break;\r\n case PhysicsShapeType.BOX:\r\n this._options.extents = this._options.extents ?? new Vector3(extents.x, extents.y, extents.z);\r\n this._options.rotation = this._options.rotation ?? Quaternion.Identity();\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the options for the physics aggregate with the provided parameters.\r\n * @param _options - The new set of options to update the physics aggregate with.\r\n */\r\n public updateOptions(_options: PhysicsAggregateParameters) {\r\n this._options.mass = _options.mass === void 0 ? 0 : _options.mass;\r\n this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;\r\n this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;\r\n const motionType = this._options.mass === 0 ? PhysicsMotionType.STATIC : PhysicsMotionType.DYNAMIC;\r\n const startAsleep = this._options.startAsleep ?? false;\r\n if (motionType !== this.body.motionType) {\r\n this.body.setMotionType(motionType);\r\n }\r\n if (startAsleep !== this.body.startAsleep) {\r\n this.body.startAsleep = startAsleep;\r\n }\r\n this._addSizeOptions();\r\n if (this._options.isTriggerShape) {\r\n this.shape.isTrigger = true;\r\n }\r\n if (this.material) {\r\n this.material.friction = this._options.friction;\r\n this.material.restitution = this._options.restitution;\r\n }\r\n this.body.setMassProperties({ mass: this._options.mass });\r\n }\r\n\r\n /**\r\n * Releases the body, shape and material\r\n */\r\n public dispose(): void {\r\n if (this._nodeDisposeObserver) {\r\n this.body.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\r\n this._nodeDisposeObserver = null;\r\n }\r\n this.body.dispose();\r\n if (this._disposeShapeWhenDisposed) {\r\n this.shape.dispose();\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"physicsAggregate.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsAggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAOlE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAmExD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAoBzB;IACI;;OAEG;IACI,aAA4B;IACnC;;OAEG;IACI,IAAqC,EACpC,WAAuC,EAAE,IAAI,EAAE,CAAC,EAAE,EAClD,MAAc;QANf,kBAAa,GAAb,aAAa,CAAe;QAI5B,SAAI,GAAJ,IAAI,CAAiC;QACpC,aAAQ,GAAR,QAAQ,CAA0C;QAClD,WAAM,GAAN,MAAM,CAAQ;QAdlB,8BAAyB,GAAG,IAAI,CAAC;QAgBrC,eAAe;QACf,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YACvE,OAAO;QACX,CAAC;QACD,MAAM,CAAC,GAAG,aAAqB,CAAC;QAChC,IAAI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KAAK,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QACD,IAAI,WAAW,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QACxC,CAAC;QACD,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;QACpD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAChD,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAC9E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { PhysicsBody } from \"./physicsBody\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { PhysicsShape } from \"./physicsShape\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { Quaternion, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { WithinEpsilon } from \"../../Maths/math.scalar.functions\";\r\nimport { PhysicsMotionType, PhysicsShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { BoundingBox } from \"../../Culling/boundingBox\";\r\n\r\n/**\r\n * The interface for the physics aggregate parameters\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsAggregateParameters {\r\n /**\r\n * The mass of the physics aggregate\r\n */\r\n mass: number;\r\n\r\n /**\r\n * The friction of the physics aggregate\r\n */\r\n friction?: number;\r\n\r\n /**\r\n * The coefficient of restitution of the physics aggregate\r\n */\r\n restitution?: number;\r\n\r\n /**\r\n * Radius for sphere, cylinder and capsule\r\n */\r\n radius?: number;\r\n\r\n /**\r\n * Starting point for cylinder/capsule\r\n */\r\n pointA?: Vector3;\r\n\r\n /**\r\n * Ending point for cylinder/capsule\r\n */\r\n pointB?: Vector3;\r\n\r\n /**\r\n * Extents for box\r\n */\r\n extents?: Vector3;\r\n\r\n /**\r\n * Orientation for box\r\n */\r\n rotation?: Quaternion;\r\n\r\n /**\r\n * mesh local center\r\n */\r\n center?: Vector3;\r\n\r\n /**\r\n * mesh object. Used for mesh and convex hull aggregates.\r\n */\r\n mesh?: Mesh;\r\n\r\n /**\r\n * Physics engine will try to make this body sleeping and not active\r\n */\r\n startAsleep?: boolean;\r\n\r\n /**\r\n * If true, mark the created shape as a trigger shape\r\n */\r\n isTriggerShape?: boolean;\r\n}\r\n/**\r\n * Helper class to create and interact with a PhysicsAggregate.\r\n * This is a transition object that works like Physics Plugin V1 Impostors.\r\n * This helper instantiates all mandatory physics objects to get a body/shape and material.\r\n * It's less efficient than handling body and shapes independently but for prototyping or\r\n * a small numbers of physics objects, it's good enough.\r\n */\r\nexport class PhysicsAggregate {\r\n /**\r\n * The body that is associated with this aggregate\r\n */\r\n public body: PhysicsBody;\r\n\r\n /**\r\n * The shape that is associated with this aggregate\r\n */\r\n public shape: PhysicsShape;\r\n\r\n /**\r\n * The material that is associated with this aggregate\r\n */\r\n public material: PhysicsMaterial;\r\n\r\n private _disposeShapeWhenDisposed = true;\r\n\r\n private _nodeDisposeObserver: Nullable<Observer<Node>>;\r\n\r\n constructor(\r\n /**\r\n * The physics-enabled object used as the physics aggregate\r\n */\r\n public transformNode: TransformNode,\r\n /**\r\n * The type of the physics aggregate\r\n */\r\n public type: PhysicsShapeType | PhysicsShape,\r\n private _options: PhysicsAggregateParameters = { mass: 0 },\r\n private _scene?: Scene\r\n ) {\r\n //sanity check!\r\n if (!this.transformNode) {\r\n Logger.Error(\"No object was provided. A physics object is obligatory\");\r\n return;\r\n }\r\n const m = transformNode as Mesh;\r\n if (this.transformNode.parent && this._options.mass !== 0 && m.hasThinInstances) {\r\n Logger.Warn(\r\n \"A physics body has been created for an object which has a parent and thin instances. Babylon physics currently works in local space so unexpected issues may occur.\"\r\n );\r\n }\r\n\r\n // Legacy support for old syntax.\r\n if (!this._scene && transformNode.getScene) {\r\n this._scene = transformNode.getScene();\r\n }\r\n\r\n if (!this._scene) {\r\n return;\r\n }\r\n\r\n //default options params\r\n this._options.mass = _options.mass === void 0 ? 0 : _options.mass;\r\n this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;\r\n this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;\r\n this._options.isTriggerShape = _options.isTriggerShape ?? false;\r\n this._options.mesh = _options.mesh ?? (m._isMesh ? m : undefined);\r\n\r\n const motionType = this._options.mass === 0 ? PhysicsMotionType.STATIC : PhysicsMotionType.DYNAMIC;\r\n const startAsleep = this._options.startAsleep ?? false;\r\n this.body = new PhysicsBody(transformNode, motionType, startAsleep, this._scene);\r\n this._addSizeOptions();\r\n if ((type as any).getClassName && (type as any).getClassName() === \"PhysicsShape\") {\r\n this.shape = type as PhysicsShape;\r\n this._disposeShapeWhenDisposed = false;\r\n } else {\r\n this.shape = new PhysicsShape({ type: type as PhysicsShapeType, parameters: this._options as any }, this._scene);\r\n }\r\n\r\n if (this._options.isTriggerShape) {\r\n this.shape.isTrigger = true;\r\n }\r\n\r\n this.material = { friction: this._options.friction, restitution: this._options.restitution };\r\n this.body.shape = this.shape;\r\n this.shape.material = this.material;\r\n\r\n this.body.setMassProperties({ mass: this._options.mass });\r\n\r\n this._nodeDisposeObserver = this.transformNode.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n private _getObjectBoundingBox() {\r\n if ((this.transformNode as AbstractMesh).getRawBoundingInfo) {\r\n return (this.transformNode as AbstractMesh).getRawBoundingInfo().boundingBox;\r\n } else {\r\n return new BoundingBox(new Vector3(-0.5, -0.5, -0.5), new Vector3(0.5, 0.5, 0.5));\r\n }\r\n }\r\n\r\n private _hasVertices(node: TransformNode): boolean {\r\n return (node as any)?.getTotalVertices() > 0;\r\n }\r\n\r\n private _addSizeOptions(): void {\r\n this.transformNode.computeWorldMatrix(true);\r\n const bb = this._getObjectBoundingBox();\r\n const extents = TmpVectors.Vector3[0];\r\n extents.copyFrom(bb.extendSize);\r\n extents.scaleInPlace(2);\r\n extents.multiplyInPlace(this.transformNode.absoluteScaling);\r\n // In case we had any negative scaling, we need to take the absolute value of the extents.\r\n extents.x = Math.abs(extents.x);\r\n extents.y = Math.abs(extents.y);\r\n extents.z = Math.abs(extents.z);\r\n\r\n const min = TmpVectors.Vector3[1];\r\n min.copyFrom(bb.minimum);\r\n min.multiplyInPlace(this.transformNode.absoluteScaling);\r\n\r\n if (!this._options.center) {\r\n const center = new Vector3();\r\n center.copyFrom(bb.center);\r\n center.multiplyInPlace(this.transformNode.absoluteScaling);\r\n this._options.center = center;\r\n }\r\n\r\n switch (this.type) {\r\n case PhysicsShapeType.SPHERE:\r\n if (!this._options.radius && WithinEpsilon(extents.x, extents.y, 0.0001) && WithinEpsilon(extents.x, extents.z, 0.0001)) {\r\n this._options.radius = extents.x / 2;\r\n } else if (!this._options.radius) {\r\n Logger.Warn(\"Non uniform scaling is unsupported for sphere shapes. Setting the radius to the biggest bounding box extent.\");\r\n this._options.radius = Math.max(extents.x, extents.y, extents.z) / 2;\r\n }\r\n break;\r\n case PhysicsShapeType.CAPSULE:\r\n {\r\n const capRadius = extents.x / 2;\r\n this._options.radius = this._options.radius ?? capRadius;\r\n this._options.pointA = this._options.pointA ?? new Vector3(0, min.y + capRadius, 0);\r\n this._options.pointB = this._options.pointB ?? new Vector3(0, min.y + extents.y - capRadius, 0);\r\n }\r\n break;\r\n case PhysicsShapeType.CYLINDER:\r\n {\r\n const capRadius = extents.x / 2;\r\n this._options.radius = this._options.radius ?? capRadius;\r\n this._options.pointA = this._options.pointA ?? new Vector3(0, min.y, 0);\r\n this._options.pointB = this._options.pointB ?? new Vector3(0, min.y + extents.y, 0);\r\n }\r\n break;\r\n case PhysicsShapeType.MESH:\r\n case PhysicsShapeType.CONVEX_HULL:\r\n case PhysicsShapeType.HEIGHTFIELD:\r\n if (!this._options.mesh && this._hasVertices(this.transformNode)) {\r\n this._options.mesh = this.transformNode as Mesh;\r\n } else if (!this._options.mesh || !this._hasVertices(this._options.mesh)) {\r\n throw new Error(\r\n \"No valid mesh was provided for mesh or convex hull shape parameter. Please provide a mesh with valid geometry (number of vertices greater than 0).\"\r\n );\r\n }\r\n break;\r\n case PhysicsShapeType.BOX:\r\n this._options.extents = this._options.extents ?? new Vector3(extents.x, extents.y, extents.z);\r\n this._options.rotation = this._options.rotation ?? Quaternion.Identity();\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the options for the physics aggregate with the provided parameters.\r\n * @param _options - The new set of options to update the physics aggregate with.\r\n */\r\n public updateOptions(_options: PhysicsAggregateParameters) {\r\n this._options.mass = _options.mass === void 0 ? 0 : _options.mass;\r\n this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;\r\n this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;\r\n this._options.isTriggerShape = _options.isTriggerShape ?? false;\r\n const motionType = this._options.mass === 0 ? PhysicsMotionType.STATIC : PhysicsMotionType.DYNAMIC;\r\n const startAsleep = this._options.startAsleep ?? false;\r\n if (motionType !== this.body.motionType) {\r\n this.body.setMotionType(motionType);\r\n }\r\n if (startAsleep !== this.body.startAsleep) {\r\n this.body.startAsleep = startAsleep;\r\n }\r\n this._addSizeOptions();\r\n this.shape.isTrigger = this._options.isTriggerShape;\r\n if (this.material) {\r\n this.material.friction = this._options.friction;\r\n this.material.restitution = this._options.restitution;\r\n }\r\n this.body.setMassProperties({ mass: this._options.mass });\r\n }\r\n\r\n /**\r\n * Releases the body, shape and material\r\n */\r\n public dispose(): void {\r\n if (this._nodeDisposeObserver) {\r\n this.body.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\r\n this._nodeDisposeObserver = null;\r\n }\r\n this.body.dispose();\r\n if (this._disposeShapeWhenDisposed) {\r\n this.shape.dispose();\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -4,6 +4,7 @@ import type { AbstractEngine } from "../Engines/abstractEngine.js";
|
|
|
4
4
|
import type { Camera } from "../Cameras/camera.js";
|
|
5
5
|
import type { Nullable } from "../types.js";
|
|
6
6
|
import type { Scene } from "../scene.js";
|
|
7
|
+
import { ThinColorCorrectionPostProcess } from "./thinColorCorrectionPostProcess.js";
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
9
10
|
* This post-process allows the modification of rendered colors by using
|
|
@@ -20,18 +21,17 @@ import type { Scene } from "../scene.js";
|
|
|
20
21
|
*
|
|
21
22
|
*/
|
|
22
23
|
export declare class ColorCorrectionPostProcess extends PostProcess {
|
|
23
|
-
private _colorTableTexture;
|
|
24
24
|
/**
|
|
25
25
|
* Gets the color table url used to create the LUT texture
|
|
26
26
|
*/
|
|
27
|
-
colorTableUrl: string;
|
|
27
|
+
get colorTableUrl(): string;
|
|
28
28
|
/**
|
|
29
29
|
* Gets a string identifying the name of the class
|
|
30
30
|
* @returns "ColorCorrectionPostProcess" string
|
|
31
31
|
*/
|
|
32
32
|
getClassName(): string;
|
|
33
|
+
protected _effectWrapper: ThinColorCorrectionPostProcess;
|
|
33
34
|
constructor(name: string, colorTableUrl: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean);
|
|
34
|
-
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
35
35
|
/**
|
|
36
36
|
* @internal
|
|
37
37
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "../tslib.es6.js";
|
|
2
2
|
import { PostProcess } from "./postProcess.js";
|
|
3
|
-
import { Texture } from "../Materials/Textures/texture.js";
|
|
4
3
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
5
4
|
import { serialize } from "../Misc/decorators.js";
|
|
6
5
|
import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
6
|
+
import { ThinColorCorrectionPostProcess } from "./thinColorCorrectionPostProcess.js";
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
* This post-process allows the modification of rendered colors by using
|
|
@@ -20,6 +20,12 @@ import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
22
|
export class ColorCorrectionPostProcess extends PostProcess {
|
|
23
|
+
/**
|
|
24
|
+
* Gets the color table url used to create the LUT texture
|
|
25
|
+
*/
|
|
26
|
+
get colorTableUrl() {
|
|
27
|
+
return this._effectWrapper.colorTableUrl;
|
|
28
|
+
}
|
|
23
29
|
/**
|
|
24
30
|
* Gets a string identifying the name of the class
|
|
25
31
|
* @returns "ColorCorrectionPostProcess" string
|
|
@@ -28,26 +34,20 @@ export class ColorCorrectionPostProcess extends PostProcess {
|
|
|
28
34
|
return "ColorCorrectionPostProcess";
|
|
29
35
|
}
|
|
30
36
|
constructor(name, colorTableUrl, options, camera, samplingMode, engine, reusable) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
effect.setTexture("colorTable", this._colorTableTexture);
|
|
37
|
+
const localOptions = {
|
|
38
|
+
samplers: ThinColorCorrectionPostProcess.Samplers,
|
|
39
|
+
size: typeof options === "number" ? options : undefined,
|
|
40
|
+
camera,
|
|
41
|
+
samplingMode,
|
|
42
|
+
engine,
|
|
43
|
+
reusable,
|
|
44
|
+
...options,
|
|
40
45
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
list.push(Promise.all([import("../Shaders/colorCorrection.fragment.js")]));
|
|
49
|
-
}
|
|
50
|
-
super._gatherImports(useWebGPU, list);
|
|
46
|
+
const scene = camera?.getScene() || null;
|
|
47
|
+
super(name, ThinColorCorrectionPostProcess.FragmentUrl, {
|
|
48
|
+
effectWrapper: typeof options === "number" || !options.effectWrapper ? new ThinColorCorrectionPostProcess(name, scene, colorTableUrl, localOptions) : undefined,
|
|
49
|
+
...localOptions,
|
|
50
|
+
});
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* @internal
|
|
@@ -60,6 +60,6 @@ export class ColorCorrectionPostProcess extends PostProcess {
|
|
|
60
60
|
}
|
|
61
61
|
__decorate([
|
|
62
62
|
serialize()
|
|
63
|
-
], ColorCorrectionPostProcess.prototype, "colorTableUrl",
|
|
63
|
+
], ColorCorrectionPostProcess.prototype, "colorTableUrl", null);
|
|
64
64
|
RegisterClass("BABYLON.ColorCorrectionPostProcess", ColorCorrectionPostProcess);
|
|
65
65
|
//# sourceMappingURL=colorCorrectionPostProcess.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorCorrectionPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/colorCorrectionPostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"colorCorrectionPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/colorCorrectionPostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAIvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,0BAA2B,SAAQ,WAAW;IACvD;;OAEG;IAEH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,4BAA4B,CAAC;IACxC,CAAC;IAID,YACI,IAAY,EACZ,aAAqB,EACrB,OAAoC,EACpC,MAAwB,EACxB,YAAqB,EACrB,MAAuB,EACvB,QAAkB;QAElB,MAAM,YAAY,GAAG;YACjB,QAAQ,EAAE,8BAA8B,CAAC,QAAQ;YACjD,IAAI,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;YACvD,MAAM;YACN,YAAY;YACZ,MAAM;YACN,QAAQ;YACR,GAAI,OAA8B;SACrC,CAAC;QAEF,MAAM,KAAK,GAAG,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC;QAEzC,KAAK,CAAC,IAAI,EAAE,8BAA8B,CAAC,WAAW,EAAE;YACpD,aAAa,EAAE,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,8BAA8B,CAAC,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;YAC/J,GAAG,YAAY;SAClB,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,MAAM,CAAU,MAAM,CAAC,iBAAsB,EAAE,YAAoB,EAAE,KAAY,EAAE,OAAe;QACrG,OAAO,mBAAmB,CAAC,KAAK,CAC5B,GAAG,EAAE;YACD,OAAO,IAAI,0BAA0B,CACjC,iBAAiB,CAAC,IAAI,EACtB,iBAAiB,CAAC,aAAa,EAC/B,iBAAiB,CAAC,OAAO,EACzB,YAAY,EACZ,iBAAiB,CAAC,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;AA9DG;IADC,SAAS,EAAE;+DAGX;AA8DL,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\n\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport type { Nullable } from \"../types\";\r\n\r\nimport type { Scene } from \"../scene\";\r\nimport { ThinColorCorrectionPostProcess } from \"./thinColorCorrectionPostProcess\";\r\n\r\n/**\r\n *\r\n * This post-process allows the modification of rendered colors by using\r\n * a 'look-up table' (LUT). This effect is also called Color Grading.\r\n *\r\n * The object needs to be provided an url to a texture containing the color\r\n * look-up table: the texture must be 256 pixels wide and 16 pixels high.\r\n * Use an image editing software to tweak the LUT to match your needs.\r\n *\r\n * For an example of a color LUT, see here:\r\n * @see http://udn.epicgames.com/Three/rsrc/Three/ColorGrading/RGBTable16x1.png\r\n * For explanations on color grading, see here:\r\n * @see http://udn.epicgames.com/Three/ColorGrading.html\r\n *\r\n */\r\nexport class ColorCorrectionPostProcess extends PostProcess {\r\n /**\r\n * Gets the color table url used to create the LUT texture\r\n */\r\n @serialize()\r\n public get colorTableUrl() {\r\n return this._effectWrapper.colorTableUrl;\r\n }\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"ColorCorrectionPostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"ColorCorrectionPostProcess\";\r\n }\r\n\r\n protected override _effectWrapper: ThinColorCorrectionPostProcess;\r\n\r\n constructor(\r\n name: string,\r\n colorTableUrl: 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 ) {\r\n const localOptions = {\r\n samplers: ThinColorCorrectionPostProcess.Samplers,\r\n size: typeof options === \"number\" ? options : undefined,\r\n camera,\r\n samplingMode,\r\n engine,\r\n reusable,\r\n ...(options as PostProcessOptions),\r\n };\r\n\r\n const scene = camera?.getScene() || null;\r\n\r\n super(name, ThinColorCorrectionPostProcess.FragmentUrl, {\r\n effectWrapper: typeof options === \"number\" || !options.effectWrapper ? new ThinColorCorrectionPostProcess(name, scene, colorTableUrl, 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): Nullable<ColorCorrectionPostProcess> {\r\n return SerializationHelper.Parse(\r\n () => {\r\n return new ColorCorrectionPostProcess(\r\n parsedPostProcess.name,\r\n parsedPostProcess.colorTableUrl,\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.ColorCorrectionPostProcess\", ColorCorrectionPostProcess);\r\n"]}
|
|
@@ -5,17 +5,20 @@ import type { PostProcessOptions } from "./postProcess.js";
|
|
|
5
5
|
import { PostProcess } from "./postProcess.js";
|
|
6
6
|
import type { AbstractEngine } from "../Engines/abstractEngine.js";
|
|
7
7
|
import type { Scene } from "../scene.js";
|
|
8
|
+
import { ThinFilterPostProcess } from "./thinFilterPostProcess.js";
|
|
8
9
|
/**
|
|
9
10
|
* Applies a kernel filter to the image
|
|
10
11
|
*/
|
|
11
12
|
export declare class FilterPostProcess extends PostProcess {
|
|
12
13
|
/** The matrix to be applied to the image */
|
|
13
|
-
kernelMatrix: Matrix;
|
|
14
|
+
get kernelMatrix(): Matrix;
|
|
15
|
+
set kernelMatrix(value: Matrix);
|
|
14
16
|
/**
|
|
15
17
|
* Gets a string identifying the name of the class
|
|
16
18
|
* @returns "FilterPostProcess" string
|
|
17
19
|
*/
|
|
18
20
|
getClassName(): string;
|
|
21
|
+
protected _effectWrapper: ThinFilterPostProcess;
|
|
19
22
|
/**
|
|
20
23
|
*
|
|
21
24
|
* @param name The name of the effect.
|
|
@@ -27,7 +30,6 @@ export declare class FilterPostProcess extends PostProcess {
|
|
|
27
30
|
* @param reusable If the post process can be reused on the same frame. (default: false)
|
|
28
31
|
*/
|
|
29
32
|
constructor(name: string, kernelMatrix: Matrix, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean);
|
|
30
|
-
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
31
33
|
/**
|
|
32
34
|
* @internal
|
|
33
35
|
*/
|
|
@@ -3,10 +3,18 @@ import { PostProcess } from "./postProcess.js";
|
|
|
3
3
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
4
4
|
import { serializeAsMatrix } from "../Misc/decorators.js";
|
|
5
5
|
import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
6
|
+
import { ThinFilterPostProcess } from "./thinFilterPostProcess.js";
|
|
6
7
|
/**
|
|
7
8
|
* Applies a kernel filter to the image
|
|
8
9
|
*/
|
|
9
10
|
export class FilterPostProcess extends PostProcess {
|
|
11
|
+
/** The matrix to be applied to the image */
|
|
12
|
+
get kernelMatrix() {
|
|
13
|
+
return this._effectWrapper.kernelMatrix;
|
|
14
|
+
}
|
|
15
|
+
set kernelMatrix(value) {
|
|
16
|
+
this._effectWrapper.kernelMatrix = value;
|
|
17
|
+
}
|
|
10
18
|
/**
|
|
11
19
|
* Gets a string identifying the name of the class
|
|
12
20
|
* @returns "FilterPostProcess" string
|
|
@@ -25,21 +33,20 @@ export class FilterPostProcess extends PostProcess {
|
|
|
25
33
|
* @param reusable If the post process can be reused on the same frame. (default: false)
|
|
26
34
|
*/
|
|
27
35
|
constructor(name, kernelMatrix, options, camera, samplingMode, engine, reusable) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
const localOptions = {
|
|
37
|
+
uniforms: ThinFilterPostProcess.Uniforms,
|
|
38
|
+
size: typeof options === "number" ? options : undefined,
|
|
39
|
+
camera,
|
|
40
|
+
samplingMode,
|
|
41
|
+
engine,
|
|
42
|
+
reusable,
|
|
43
|
+
...options,
|
|
32
44
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
list.push(Promise.all([import("../Shaders/filter.fragment.js")]));
|
|
41
|
-
}
|
|
42
|
-
super._gatherImports(useWebGPU, list);
|
|
45
|
+
super(name, ThinFilterPostProcess.FragmentUrl, {
|
|
46
|
+
effectWrapper: typeof options === "number" || !options.effectWrapper ? new ThinFilterPostProcess(name, engine, localOptions) : undefined,
|
|
47
|
+
...localOptions,
|
|
48
|
+
});
|
|
49
|
+
this.kernelMatrix = kernelMatrix;
|
|
43
50
|
}
|
|
44
51
|
/**
|
|
45
52
|
* @internal
|
|
@@ -52,6 +59,6 @@ export class FilterPostProcess extends PostProcess {
|
|
|
52
59
|
}
|
|
53
60
|
__decorate([
|
|
54
61
|
serializeAsMatrix()
|
|
55
|
-
], FilterPostProcess.prototype, "kernelMatrix",
|
|
62
|
+
], FilterPostProcess.prototype, "kernelMatrix", null);
|
|
56
63
|
RegisterClass("BABYLON.FilterPostProcess", FilterPostProcess);
|
|
57
64
|
//# sourceMappingURL=filterPostProcess.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/filterPostProcess.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"filterPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/filterPostProcess.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAC9C,4CAA4C;IAE5C,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC;IAC5C,CAAC;IAED,IAAW,YAAY,CAAC,KAAa;QACjC,IAAI,CAAC,cAAc,CAAC,YAAY,GAAG,KAAK,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAID;;;;;;;;;OASG;IACH,YACI,IAAY,EACZ,YAAoB,EACpB,OAAoC,EACpC,MAAwB,EACxB,YAAqB,EACrB,MAAuB,EACvB,QAAkB;QAElB,MAAM,YAAY,GAAG;YACjB,QAAQ,EAAE,qBAAqB,CAAC,QAAQ;YACxC,IAAI,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;YACvD,MAAM;YACN,YAAY;YACZ,MAAM;YACN,QAAQ;YACR,GAAI,OAA8B;SACrC,CAAC;QAEF,KAAK,CAAC,IAAI,EAAE,qBAAqB,CAAC,WAAW,EAAE;YAC3C,aAAa,EAAE,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;YACxI,GAAG,YAAY;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,MAAM,CAAU,MAAM,CAAC,iBAAsB,EAAE,YAAoB,EAAE,KAAY,EAAE,OAAe;QACrG,OAAO,mBAAmB,CAAC,KAAK,CAC5B,GAAG,EAAE;YACD,OAAO,IAAI,iBAAiB,CACxB,iBAAiB,CAAC,IAAI,EACtB,iBAAiB,CAAC,YAAY,EAC9B,iBAAiB,CAAC,OAAO,EACzB,YAAY,EACZ,iBAAiB,CAAC,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;AA5EG;IADC,iBAAiB,EAAE;qDAGnB;AA4EL,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Matrix } from \"../Maths/math.vector\";\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\n\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { serializeAsMatrix } from \"../Misc/decorators\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\n\r\nimport type { Scene } from \"../scene\";\r\nimport { ThinFilterPostProcess } from \"./thinFilterPostProcess\";\r\n\r\n/**\r\n * Applies a kernel filter to the image\r\n */\r\nexport class FilterPostProcess extends PostProcess {\r\n /** The matrix to be applied to the image */\r\n @serializeAsMatrix()\r\n public get kernelMatrix() {\r\n return this._effectWrapper.kernelMatrix;\r\n }\r\n\r\n public set kernelMatrix(value: Matrix) {\r\n this._effectWrapper.kernelMatrix = value;\r\n }\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"FilterPostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"FilterPostProcess\";\r\n }\r\n\r\n protected override _effectWrapper: ThinFilterPostProcess;\r\n\r\n /**\r\n *\r\n * @param name The name of the effect.\r\n * @param kernelMatrix The matrix to be applied to the image\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 */\r\n constructor(\r\n name: string,\r\n kernelMatrix: Matrix,\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera>,\r\n samplingMode?: number,\r\n engine?: AbstractEngine,\r\n reusable?: boolean\r\n ) {\r\n const localOptions = {\r\n uniforms: ThinFilterPostProcess.Uniforms,\r\n size: typeof options === \"number\" ? options : undefined,\r\n camera,\r\n samplingMode,\r\n engine,\r\n reusable,\r\n ...(options as PostProcessOptions),\r\n };\r\n\r\n super(name, ThinFilterPostProcess.FragmentUrl, {\r\n effectWrapper: typeof options === \"number\" || !options.effectWrapper ? new ThinFilterPostProcess(name, engine, localOptions) : undefined,\r\n ...localOptions,\r\n });\r\n\r\n this.kernelMatrix = kernelMatrix;\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): Nullable<FilterPostProcess> {\r\n return SerializationHelper.Parse(\r\n () => {\r\n return new FilterPostProcess(\r\n parsedPostProcess.name,\r\n parsedPostProcess.kernelMatrix,\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.FilterPostProcess\", FilterPostProcess);\r\n"]}
|
package/PostProcesses/index.d.ts
CHANGED
|
@@ -37,9 +37,11 @@ export * from "./thinBloomEffect.js";
|
|
|
37
37
|
export * from "./thinBlurPostProcess.js";
|
|
38
38
|
export * from "./thinChromaticAberrationPostProcess.js";
|
|
39
39
|
export * from "./thinCircleOfConfusionPostProcess.js";
|
|
40
|
+
export * from "./thinColorCorrectionPostProcess.js";
|
|
40
41
|
export * from "./thinConvolutionPostProcess.js";
|
|
41
42
|
export * from "./thinDepthOfFieldEffect.js";
|
|
42
43
|
export * from "./thinExtractHighlightsPostProcess.js";
|
|
44
|
+
export * from "./thinFilterPostProcess.js";
|
|
43
45
|
export * from "./thinFXAAPostProcess.js";
|
|
44
46
|
export * from "./thinGrainPostProcess.js";
|
|
45
47
|
export * from "./thinImageProcessingPostProcess.js";
|
|
@@ -47,6 +49,7 @@ export * from "./thinMotionBlurPostProcess.js";
|
|
|
47
49
|
export * from "./thinPassPostProcess.js";
|
|
48
50
|
export * from "./thinSharpenPostProcess.js";
|
|
49
51
|
export * from "./thinScreenSpaceCurvaturePostProcess.js";
|
|
52
|
+
export * from "./thinTonemapPostProcess.js";
|
|
50
53
|
export * from "../Shaders/postprocess.vertex.js";
|
|
51
54
|
export * from "../ShadersWGSL/postprocess.vertex.js";
|
|
52
55
|
export * from "../Shaders/kernelBlur.fragment.js";
|
package/PostProcesses/index.js
CHANGED
|
@@ -38,9 +38,11 @@ export * from "./thinBloomEffect.js";
|
|
|
38
38
|
export * from "./thinBlurPostProcess.js";
|
|
39
39
|
export * from "./thinChromaticAberrationPostProcess.js";
|
|
40
40
|
export * from "./thinCircleOfConfusionPostProcess.js";
|
|
41
|
+
export * from "./thinColorCorrectionPostProcess.js";
|
|
41
42
|
export * from "./thinConvolutionPostProcess.js";
|
|
42
43
|
export * from "./thinDepthOfFieldEffect.js";
|
|
43
44
|
export * from "./thinExtractHighlightsPostProcess.js";
|
|
45
|
+
export * from "./thinFilterPostProcess.js";
|
|
44
46
|
export * from "./thinFXAAPostProcess.js";
|
|
45
47
|
export * from "./thinGrainPostProcess.js";
|
|
46
48
|
export * from "./thinImageProcessingPostProcess.js";
|
|
@@ -48,6 +50,7 @@ export * from "./thinMotionBlurPostProcess.js";
|
|
|
48
50
|
export * from "./thinPassPostProcess.js";
|
|
49
51
|
export * from "./thinSharpenPostProcess.js";
|
|
50
52
|
export * from "./thinScreenSpaceCurvaturePostProcess.js";
|
|
53
|
+
export * from "./thinTonemapPostProcess.js";
|
|
51
54
|
// Postprocess
|
|
52
55
|
export * from "../Shaders/postprocess.vertex.js";
|
|
53
56
|
export * from "../ShadersWGSL/postprocess.vertex.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,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,cA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AC;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 @typescript-eslint/no-restricted-imports */\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 \"./thinColorCorrectionPostProcess\";\r\nexport * from \"./thinConvolutionPostProcess\";\r\nexport * from \"./thinDepthOfFieldEffect\";\r\nexport * from \"./thinExtractHighlightsPostProcess\";\r\nexport * from \"./thinFilterPostProcess\";\r\nexport * from \"./thinFXAAPostProcess\";\r\nexport * from \"./thinGrainPostProcess\";\r\nexport * from \"./thinImageProcessingPostProcess\";\r\nexport * from \"./thinMotionBlurPostProcess\";\r\nexport * from \"./thinPassPostProcess\";\r\nexport * from \"./thinSharpenPostProcess\";\r\nexport * from \"./thinScreenSpaceCurvaturePostProcess\";\r\nexport * from \"./thinTonemapPostProcess\";\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,30 @@
|
|
|
1
|
+
import type { EffectWrapperCreationOptions, Nullable, Scene } from "../index.js";
|
|
2
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
3
|
+
/**
|
|
4
|
+
* Post process used to apply color correction
|
|
5
|
+
*/
|
|
6
|
+
export declare class ThinColorCorrectionPostProcess extends EffectWrapper {
|
|
7
|
+
private _colorTableTexture;
|
|
8
|
+
/**
|
|
9
|
+
* The fragment shader url
|
|
10
|
+
*/
|
|
11
|
+
static readonly FragmentUrl = "colorCorrection";
|
|
12
|
+
/**
|
|
13
|
+
* The list of uniforms used by the effect
|
|
14
|
+
*/
|
|
15
|
+
static readonly Samplers: string[];
|
|
16
|
+
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
17
|
+
/**
|
|
18
|
+
* Constructs a new black and white post process
|
|
19
|
+
* @param name Name of the effect
|
|
20
|
+
* @param scene The scene the effect belongs to
|
|
21
|
+
* @param colorTableUrl URL of the color table texture
|
|
22
|
+
* @param options Options to configure the effect
|
|
23
|
+
*/
|
|
24
|
+
constructor(name: string, scene: Nullable<Scene>, colorTableUrl: string, options?: EffectWrapperCreationOptions);
|
|
25
|
+
/**
|
|
26
|
+
* Gets the color table url used to create the LUT texture
|
|
27
|
+
*/
|
|
28
|
+
readonly colorTableUrl: string;
|
|
29
|
+
bind(noDefaultBindings?: boolean): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
2
|
+
import { Texture } from "../Materials/Textures/texture.js";
|
|
3
|
+
/**
|
|
4
|
+
* Post process used to apply color correction
|
|
5
|
+
*/
|
|
6
|
+
export class ThinColorCorrectionPostProcess extends EffectWrapper {
|
|
7
|
+
_gatherImports(useWebGPU, list) {
|
|
8
|
+
if (useWebGPU) {
|
|
9
|
+
this._webGPUReady = true;
|
|
10
|
+
list.push(import("../ShadersWGSL/colorCorrection.fragment.js"));
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
list.push(import("../Shaders/colorCorrection.fragment.js"));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a new black and white post process
|
|
18
|
+
* @param name Name of the effect
|
|
19
|
+
* @param scene The scene the effect belongs to
|
|
20
|
+
* @param colorTableUrl URL of the color table texture
|
|
21
|
+
* @param options Options to configure the effect
|
|
22
|
+
*/
|
|
23
|
+
constructor(name, scene, colorTableUrl, options) {
|
|
24
|
+
super({
|
|
25
|
+
...options,
|
|
26
|
+
name,
|
|
27
|
+
engine: scene?.getEngine(),
|
|
28
|
+
useShaderStore: true,
|
|
29
|
+
useAsPostProcess: true,
|
|
30
|
+
fragmentShader: ThinColorCorrectionPostProcess.FragmentUrl,
|
|
31
|
+
samplers: ThinColorCorrectionPostProcess.Samplers,
|
|
32
|
+
});
|
|
33
|
+
this._colorTableTexture = new Texture(colorTableUrl, scene, true, false, Texture.TRILINEAR_SAMPLINGMODE);
|
|
34
|
+
this._colorTableTexture.anisotropicFilteringLevel = 1;
|
|
35
|
+
this._colorTableTexture.wrapU = Texture.CLAMP_ADDRESSMODE;
|
|
36
|
+
this._colorTableTexture.wrapV = Texture.CLAMP_ADDRESSMODE;
|
|
37
|
+
this.colorTableUrl = colorTableUrl;
|
|
38
|
+
}
|
|
39
|
+
bind(noDefaultBindings = false) {
|
|
40
|
+
super.bind(noDefaultBindings);
|
|
41
|
+
this._drawWrapper.effect.setTexture("colorTable", this._colorTableTexture);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The fragment shader url
|
|
46
|
+
*/
|
|
47
|
+
ThinColorCorrectionPostProcess.FragmentUrl = "colorCorrection";
|
|
48
|
+
/**
|
|
49
|
+
* The list of uniforms used by the effect
|
|
50
|
+
*/
|
|
51
|
+
ThinColorCorrectionPostProcess.Samplers = ["colorTable"];
|
|
52
|
+
//# sourceMappingURL=thinColorCorrectionPostProcess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinColorCorrectionPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinColorCorrectionPostProcess.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,aAAa;IAa1C,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC;QAC7D,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,KAAsB,EAAE,aAAqB,EAAE,OAAsC;QAC3G,KAAK,CAAC;YACF,GAAG,OAAO;YACV,IAAI;YACJ,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE;YAC1B,cAAc,EAAE,IAAI;YACpB,gBAAgB,EAAE,IAAI;YACtB,cAAc,EAAE,8BAA8B,CAAC,WAAW;YAC1D,QAAQ,EAAE,8BAA8B,CAAC,QAAQ;SACpD,CAAC,CAAC;QAEH,IAAI,CAAC,kBAAkB,GAAG,IAAI,OAAO,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACzG,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,GAAG,CAAC,CAAC;QACtD,IAAI,CAAC,kBAAkB,CAAC,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC;QAC1D,IAAI,CAAC,kBAAkB,CAAC,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC;QAE1D,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACvC,CAAC;IAOe,IAAI,CAAC,iBAAiB,GAAG,KAAK;QAC1C,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9B,IAAI,CAAC,YAAY,CAAC,MAAO,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAChF,CAAC;;AArDD;;GAEG;AACoB,0CAAW,GAAG,iBAAiB,CAAC;AAEvD;;GAEG;AACoB,uCAAQ,GAAG,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import type { EffectWrapperCreationOptions, Nullable, Scene } from \"core/index\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\n\r\n/**\r\n * Post process used to apply color correction\r\n */\r\nexport class ThinColorCorrectionPostProcess extends EffectWrapper {\r\n private _colorTableTexture: Texture;\r\n\r\n /**\r\n * The fragment shader url\r\n */\r\n public static readonly FragmentUrl = \"colorCorrection\";\r\n\r\n /**\r\n * The list of uniforms used by the effect\r\n */\r\n public static readonly Samplers = [\"colorTable\"];\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(import(\"../ShadersWGSL/colorCorrection.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/colorCorrection.fragment\"));\r\n }\r\n }\r\n\r\n /**\r\n * Constructs a new black and white post process\r\n * @param name Name of the effect\r\n * @param scene The scene the effect belongs to\r\n * @param colorTableUrl URL of the color table texture\r\n * @param options Options to configure the effect\r\n */\r\n constructor(name: string, scene: Nullable<Scene>, colorTableUrl: string, options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: scene?.getEngine(),\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinColorCorrectionPostProcess.FragmentUrl,\r\n samplers: ThinColorCorrectionPostProcess.Samplers,\r\n });\r\n\r\n this._colorTableTexture = new Texture(colorTableUrl, scene, true, false, Texture.TRILINEAR_SAMPLINGMODE);\r\n this._colorTableTexture.anisotropicFilteringLevel = 1;\r\n this._colorTableTexture.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._colorTableTexture.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n\r\n this.colorTableUrl = colorTableUrl;\r\n }\r\n\r\n /**\r\n * Gets the color table url used to create the LUT texture\r\n */\r\n public readonly colorTableUrl: string;\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n this._drawWrapper.effect!.setTexture(\"colorTable\", this._colorTableTexture);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from "../index.js";
|
|
2
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
3
|
+
import { Matrix } from "../Maths/math.vector.js";
|
|
4
|
+
/**
|
|
5
|
+
* Post process used to apply a kernel filter
|
|
6
|
+
*/
|
|
7
|
+
export declare class ThinFilterPostProcess extends EffectWrapper {
|
|
8
|
+
/**
|
|
9
|
+
* The fragment shader url
|
|
10
|
+
*/
|
|
11
|
+
static readonly FragmentUrl = "filter";
|
|
12
|
+
/**
|
|
13
|
+
* The list of uniforms used by the effect
|
|
14
|
+
*/
|
|
15
|
+
static readonly Uniforms: string[];
|
|
16
|
+
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
17
|
+
/**
|
|
18
|
+
* Constructs a new filter post process
|
|
19
|
+
* @param name Name of the effect
|
|
20
|
+
* @param engine Engine to use to render the effect. If not provided, the last created engine will be used
|
|
21
|
+
* @param options Options to configure the effect
|
|
22
|
+
*/
|
|
23
|
+
constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions);
|
|
24
|
+
/**
|
|
25
|
+
* The matrix to be applied to the image
|
|
26
|
+
*/
|
|
27
|
+
kernelMatrix: Matrix;
|
|
28
|
+
bind(noDefaultBindings?: boolean): void;
|
|
29
|
+
}
|