@babylonjs/core 7.10.1 → 7.10.3
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/Collisions/gpuPicker.d.ts +11 -2
- package/Collisions/gpuPicker.js +9 -3
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +3 -0
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +4 -2
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +3 -1
- package/Engines/nativeEngine.js +2 -1
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +2 -1
- package/Engines/thinEngine.js +2 -4
- package/Engines/thinEngine.js.map +1 -1
- package/Layers/effectLayer.js +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/sceneLoader.d.ts +20 -11
- package/Loading/sceneLoader.js +10 -19
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +5 -3
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +3 -0
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js +2 -3
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js +6 -11
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +1 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +9 -1
- package/Materials/Node/nodeMaterialBuildState.js +25 -1
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/material.d.ts +3 -1
- package/Materials/material.js +8 -6
- package/Materials/material.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +1 -2
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +10 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +73 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/mesh.d.ts +3 -2
- package/Meshes/mesh.js +18 -20
- package/Meshes/mesh.js.map +1 -1
- package/Misc/filesInput.js +13 -0
- package/Misc/filesInput.js.map +1 -1
- package/Particles/particleSystemComponent.d.ts +3 -1
- package/Particles/particleSystemComponent.js +3 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +7 -2
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +1 -0
- package/Physics/v2/Plugins/havokPlugin.js +43 -0
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsAggregate.js +1 -0
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsShape.d.ts +27 -0
- package/Physics/v2/physicsShape.js +39 -0
- package/Physics/v2/physicsShape.js.map +1 -1
- package/Rendering/depthRenderer.js +1 -1
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +2 -5
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/picking.vertex.d.ts +4 -0
- package/Shaders/picking.vertex.js +8 -0
- package/Shaders/picking.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/fogVertex.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/fogVertex.js +12 -0
- package/ShadersWGSL/ShadersInclude/fogVertex.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/fogVertexDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/fogVertexDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/fogVertexDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js +35 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +70 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/logDepthDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/logDepthDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/logDepthDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/logDepthVertex.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/logDepthVertex.js +12 -0
- package/ShadersWGSL/ShadersInclude/logDepthVertex.js.map +1 -0
- package/ShadersWGSL/particles.vertex.d.ts +11 -0
- package/ShadersWGSL/particles.vertex.js +89 -0
- package/ShadersWGSL/particles.vertex.js.map +1 -0
- package/package.json +1 -1
|
@@ -128,6 +128,7 @@ export class PhysicsAggregate {
|
|
|
128
128
|
break;
|
|
129
129
|
case PhysicsShapeType.MESH:
|
|
130
130
|
case PhysicsShapeType.CONVEX_HULL:
|
|
131
|
+
case PhysicsShapeType.HEIGHTFIELD:
|
|
131
132
|
if (!this._options.mesh && this._hasVertices(this.transformNode)) {
|
|
132
133
|
this._options.mesh = this.transformNode;
|
|
133
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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AED;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAC9E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;SACpC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,yBAAyB,EAAE;YAChC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB;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 { Scalar } from \"../../Maths/math.scalar\";\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\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 instanciate all mandatory physics objects to get a body/shape and material.\r\n * It's less efficient that 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 && Scalar.WithinEpsilon(extents.x, extents.y, 0.0001) && Scalar.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 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 * 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,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM7E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAkExD;;;;;;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,CAA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AI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;oBACtE,MAAM,IAAI,KAAK,CACX,oJAAoJ,CACvJ,CAAC;iBACL;gBACD,MAAM;YACV,KAAK,gBAAgB,CAAC,GAAG;gBACrB,IAAI,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;gBAC9F,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACzE,MAAM;SACb;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAC9E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;SACpC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,yBAAyB,EAAE;YAChC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB;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 { Scalar } from \"../../Maths/math.scalar\";\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\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 instanciate all mandatory physics objects to get a body/shape and material.\r\n * It's less efficient that 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 && Scalar.WithinEpsilon(extents.x, extents.y, 0.0001) && Scalar.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 * 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"]}
|
|
@@ -5,6 +5,7 @@ import { PhysicsShapeType } from "./IPhysicsEnginePlugin";
|
|
|
5
5
|
import type { PhysicsShapeParameters } from "./IPhysicsEnginePlugin";
|
|
6
6
|
import type { PhysicsMaterial } from "./physicsMaterial";
|
|
7
7
|
import { Vector3, Quaternion } from "../../Maths/math.vector";
|
|
8
|
+
import type { GroundMesh } from "../../Meshes/groundMesh";
|
|
8
9
|
import type { Mesh } from "../../Meshes/mesh";
|
|
9
10
|
import type { Scene } from "../../scene";
|
|
10
11
|
/**
|
|
@@ -270,3 +271,29 @@ export declare class PhysicsShapeContainer extends PhysicsShape {
|
|
|
270
271
|
*/
|
|
271
272
|
constructor(scene: Scene);
|
|
272
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Helper object to create a heightfield Shape
|
|
276
|
+
*/
|
|
277
|
+
export declare class PhysicsShapeHeightField extends PhysicsShape {
|
|
278
|
+
/**
|
|
279
|
+
* Constructor of the Shape heightfield
|
|
280
|
+
* @param heightFieldSizeX The size of the heightfield in the X axis
|
|
281
|
+
* @param heightFieldSizeZ The size of the heightfield in the Z axis
|
|
282
|
+
* @param numHeightFieldSamplesX The number of samples along the X axis
|
|
283
|
+
* @param numHeightFieldSamplesZ The number of samples along the Z axis
|
|
284
|
+
* @param heightFieldData The data for the heightfield
|
|
285
|
+
* @param scene scene to attach to
|
|
286
|
+
*/
|
|
287
|
+
constructor(heightFieldSizeX: number, heightFieldSizeZ: number, numHeightFieldSamplesX: number, numHeightFieldSamplesZ: number, heightFieldData: Float32Array, scene: Scene);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Helper object to create a ground mesh Shape
|
|
291
|
+
*/
|
|
292
|
+
export declare class PhysicsShapeGroundMesh extends PhysicsShape {
|
|
293
|
+
/**
|
|
294
|
+
* Constructor of the Shape heightfield
|
|
295
|
+
* @param groundMesh ground mesh used for display
|
|
296
|
+
* @param scene scene to attach to
|
|
297
|
+
*/
|
|
298
|
+
constructor(groundMesh: GroundMesh, scene: Scene);
|
|
299
|
+
}
|
|
@@ -360,4 +360,43 @@ export class PhysicsShapeContainer extends PhysicsShape {
|
|
|
360
360
|
super({ type: PhysicsShapeType.CONTAINER, parameters: {} }, scene);
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Helper object to create a heightfield Shape
|
|
365
|
+
*/
|
|
366
|
+
export class PhysicsShapeHeightField extends PhysicsShape {
|
|
367
|
+
/**
|
|
368
|
+
* Constructor of the Shape heightfield
|
|
369
|
+
* @param heightFieldSizeX The size of the heightfield in the X axis
|
|
370
|
+
* @param heightFieldSizeZ The size of the heightfield in the Z axis
|
|
371
|
+
* @param numHeightFieldSamplesX The number of samples along the X axis
|
|
372
|
+
* @param numHeightFieldSamplesZ The number of samples along the Z axis
|
|
373
|
+
* @param heightFieldData The data for the heightfield
|
|
374
|
+
* @param scene scene to attach to
|
|
375
|
+
*/
|
|
376
|
+
constructor(heightFieldSizeX, heightFieldSizeZ, numHeightFieldSamplesX, numHeightFieldSamplesZ, heightFieldData, scene) {
|
|
377
|
+
super({
|
|
378
|
+
type: PhysicsShapeType.HEIGHTFIELD,
|
|
379
|
+
parameters: {
|
|
380
|
+
heightFieldSizeX: heightFieldSizeX,
|
|
381
|
+
heightFieldSizeZ: heightFieldSizeZ,
|
|
382
|
+
numHeightFieldSamplesX: numHeightFieldSamplesX,
|
|
383
|
+
numHeightFieldSamplesZ: numHeightFieldSamplesZ,
|
|
384
|
+
heightFieldData: heightFieldData,
|
|
385
|
+
},
|
|
386
|
+
}, scene);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Helper object to create a ground mesh Shape
|
|
391
|
+
*/
|
|
392
|
+
export class PhysicsShapeGroundMesh extends PhysicsShape {
|
|
393
|
+
/**
|
|
394
|
+
* Constructor of the Shape heightfield
|
|
395
|
+
* @param groundMesh ground mesh used for display
|
|
396
|
+
* @param scene scene to attach to
|
|
397
|
+
*/
|
|
398
|
+
constructor(groundMesh, scene) {
|
|
399
|
+
super({ type: PhysicsShapeType.HEIGHTFIELD, parameters: { groundMesh: groundMesh } }, scene);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
363
402
|
//# sourceMappingURL=physicsShape.js.map
|
|
@@ -1 +1 @@
|
|
|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formNode\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport { PhysicsShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsShapeParameters } from \"./IPhysicsEnginePlugin\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { Matrix, Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector\";\r\n\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * Options for creating a physics shape\r\n */\r\nexport interface PhysicShapeOptions {\r\n /**\r\n * The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n */\r\n type?: PhysicsShapeType;\r\n /**\r\n * The parameters of the shape. Varies depending of the shape type.\r\n */\r\n parameters?: PhysicsShapeParameters;\r\n /**\r\n * Reference to an already existing physics shape in the plugin.\r\n */\r\n pluginData?: any;\r\n}\r\n\r\n/**\r\n * PhysicsShape class.\r\n * This class is useful for creating a physics shape that can be used in a physics engine.\r\n * A Physic Shape determine how collision are computed. It must be attached to a body.\r\n */\r\nexport class PhysicsShape {\r\n /**\r\n * V2 Physics plugin private data for single shape\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n\r\n private _type: PhysicsShapeType;\r\n\r\n private _material: PhysicsMaterial;\r\n\r\n private _isTrigger: boolean = false;\r\n\r\n private _isDisposed = false;\r\n\r\n /**\r\n * Constructs a new physics shape.\r\n * @param options The options for the physics shape. These are:\r\n * * type: The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n * * parameters: The parameters of the shape.\r\n * * pluginData: The plugin data of the shape. This is used if you already have a reference to the object on the plugin side.\r\n * You need to specify either type or pluginData.\r\n * @param scene The scene the shape belongs to.\r\n *\r\n * This code is useful for creating a new physics shape with the given type, options, and scene.\r\n * It also checks that the physics engine and plugin version are correct.\r\n * If not, it throws an error. This ensures that the shape is created with the correct parameters and is compatible with the physics engine.\r\n */\r\n constructor(options: PhysicShapeOptions, scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n\r\n if (options.pluginData !== undefined && options.pluginData !== null) {\r\n this._pluginData = options.pluginData;\r\n this._type = this._physicsPlugin.getShapeType(this);\r\n } else if (options.type !== undefined && options.type !== null) {\r\n this._type = options.type;\r\n const parameters = options.parameters ?? {};\r\n this._physicsPlugin.initShape(this, options.type, parameters);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the string \"PhysicsShape\".\r\n * @returns \"PhysicsShape\"\r\n */\r\n public getClassName() {\r\n return \"PhysicsShape\";\r\n }\r\n\r\n /**\r\n * Returns the type of the physics shape.\r\n * @returns The type of the physics shape.\r\n */\r\n public get type(): PhysicsShapeType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Set the membership mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which the shape is a member. This is used in combination\r\n * with the collide mask to determine if this shape should collide with\r\n * another.\r\n *\r\n * @param membershipMask Bitfield of categories of this shape.\r\n */\r\n public set filterMembershipMask(membershipMask: number) {\r\n this._physicsPlugin.setShapeFilterMembershipMask(this, membershipMask);\r\n }\r\n\r\n /**\r\n * Get the membership mask of a shape.\r\n * @returns Bitmask of categories which this shape is a member of.\r\n */\r\n public get filterMembershipMask(): number {\r\n return this._physicsPlugin.getShapeFilterMembershipMask(this);\r\n }\r\n\r\n /**\r\n * Sets the collide mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which this shape collides with. Given two shapes,\r\n * the engine will check if the collide mask and membership overlap:\r\n * shapeA.filterMembershipMask & shapeB.filterCollideMask\r\n *\r\n * If this value is zero (i.e. shapeB only collides with categories\r\n * which shapeA is _not_ a member of) then the shapes will not collide.\r\n *\r\n * Note, the engine will also perform the same test with shapeA and\r\n * shapeB swapped; the shapes will not collide if either shape has\r\n * a collideMask which prevents collision with the other shape.\r\n *\r\n * @param collideMask Bitmask of categories this shape should collide with\r\n */\r\n public set filterCollideMask(collideMask: number) {\r\n this._physicsPlugin.setShapeFilterCollideMask(this, collideMask);\r\n }\r\n\r\n /**\r\n *\r\n * @returns Bitmask of categories that this shape should collide with\r\n */\r\n public get filterCollideMask(): number {\r\n return this._physicsPlugin.getShapeFilterCollideMask(this);\r\n }\r\n /**\r\n *\r\n * @param material\r\n */\r\n public set material(material: PhysicsMaterial) {\r\n this._physicsPlugin.setMaterial(this, material);\r\n this._material = material;\r\n }\r\n\r\n /**\r\n * Returns the material of the physics shape.\r\n * @returns The material of the physics shape.\r\n */\r\n public get material(): PhysicsMaterial {\r\n if (!this._material) {\r\n this._material = this._physicsPlugin.getMaterial(this);\r\n }\r\n return this._material;\r\n }\r\n\r\n /**\r\n * Sets the density of the physics shape.\r\n * @param density The density of the physics shape.\r\n */\r\n public set density(density: number) {\r\n this._physicsPlugin.setDensity(this, density);\r\n }\r\n\r\n /**\r\n * Returns the density of the physics shape.\r\n * @returns The density of the physics shape.\r\n */\r\n public get density(): number {\r\n return this._physicsPlugin.getDensity(this);\r\n }\r\n\r\n /**\r\n * Utility to add a child shape to this container,\r\n * automatically computing the relative transform between\r\n * the container shape and the child instance.\r\n *\r\n * @param parentTransform The transform node associated with this shape\r\n * @param newChild The new PhysicsShape to add\r\n * @param childTransform The transform node associated with the child shape\r\n */\r\n public addChildFromParent(parentTransform: TransformNode, newChild: PhysicsShape, childTransform: TransformNode): void {\r\n const childToWorld = childTransform.computeWorldMatrix(true);\r\n const parentToWorld = parentTransform.computeWorldMatrix(true);\r\n const childToParent = TmpVectors.Matrix[0];\r\n childToWorld.multiplyToRef(Matrix.Invert(parentToWorld), childToParent);\r\n const translation = TmpVectors.Vector3[0];\r\n const rotation = TmpVectors.Quaternion[0];\r\n const scale = TmpVectors.Vector3[1];\r\n childToParent.decompose(scale, rotation, translation);\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Adds a child shape to a container with an optional transform\r\n * @param newChild The new PhysicsShape to add\r\n * @param translation Optional position of the child shape relative to this shape\r\n * @param rotation Optional rotation of the child shape relative to this shape\r\n * @param scale Optional scale of the child shape relative to this shape\r\n */\r\n public addChild(newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void {\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Removes a child shape from this shape.\r\n * @param childIndex The index of the child shape to remove\r\n */\r\n public removeChild(childIndex: number): void {\r\n this._physicsPlugin.removeChild(this, childIndex);\r\n }\r\n\r\n /**\r\n * Returns the number of children of a physics shape.\r\n * @returns The number of children of a physics shape.\r\n */\r\n public getNumChildren(): number {\r\n return this._physicsPlugin.getNumChildren(this);\r\n }\r\n\r\n /**\r\n * Returns the bounding box of the physics shape.\r\n * @returns The bounding box of the physics shape.\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBoundingBox(this);\r\n }\r\n\r\n public set isTrigger(isTrigger: boolean) {\r\n if (this._isTrigger === isTrigger) {\r\n return;\r\n }\r\n this._isTrigger = isTrigger;\r\n this._physicsPlugin.setTrigger(this, isTrigger);\r\n }\r\n\r\n public get isTrigger(): boolean {\r\n return this._isTrigger;\r\n }\r\n\r\n /**\r\n * Dispose the shape and release its associated resources.\r\n */\r\n public dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n this._physicsPlugin.disposeShape(this);\r\n this._isDisposed = true;\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a sphere shape\r\n */\r\nexport class PhysicsShapeSphere extends PhysicsShape {\r\n /**\r\n * Constructor for the Sphere Shape\r\n * @param center local center of the sphere\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.SPHERE, parameters: { center: center, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate sphere from the mesh.\r\n * @param mesh node from which to derive the sphere shape\r\n * @returns PhysicsShapeSphere\r\n */\r\n static FromMesh(mesh: AbstractMesh) {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingSphere.center;\r\n const he = bounds.boundingBox.extendSize;\r\n const radius = Math.max(he.x, he.y, he.z);\r\n return new PhysicsShapeSphere(centerLocal, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a capsule shape\r\n */\r\nexport class PhysicsShapeCapsule extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the capsule segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CAPSULE, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate capsule from the mesh. Note, this is\r\n * not the optimal bounding capsule.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Capsule\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCapsule {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y - radius, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCapsule(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a cylinder shape\r\n */\r\nexport class PhysicsShapeCylinder extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the cylinder segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CYLINDER, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate cylinder from the mesh. Note, this is\r\n * not the optimal bounding cylinder.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Cylinder\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCylinder {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCylinder(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a box shape\r\n */\r\nexport class PhysicsShapeBox extends PhysicsShape {\r\n /**\r\n *\r\n * @param center local center of the box\r\n * @param rotation local orientation\r\n * @param extents size of the box in each direction\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, rotation: Quaternion, extents: Vector3, scene: Scene) {\r\n super({ type: PhysicsShapeType.BOX, parameters: { center: center, rotation: rotation, extents: extents } }, scene);\r\n }\r\n\r\n /**\r\n *\r\n * @param mesh\r\n * @returns PhysicsShapeBox\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeBox {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingBox.center;\r\n const extents = bounds.boundingBox.extendSize.scale(2.0); //<todo.eoin extendSize seems to really be half-extents?\r\n return new PhysicsShapeBox(centerLocal, Quaternion.Identity(), extents, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a convex hull shape\r\n */\r\nexport class PhysicsShapeConvexHull extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh to be used as topology infos for the convex hull\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.CONVEX_HULL, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a mesh shape\r\n */\r\nexport class PhysicsShapeMesh extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh topology that will be used to create the shape\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.MESH, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * A shape container holds a variable number of shapes. Use AddChild to append to newly created parent container.\r\n */\r\nexport class PhysicsShapeContainer extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape container\r\n * @param scene scene to attach to\r\n */\r\n constructor(scene: Scene) {\r\n super({ type: PhysicsShapeType.CONTAINER, parameters: {} }, scene);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"physicsShape.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsShape.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAuBlF;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAkBrB;;;;;;;;;;;;OAYG;IACH,YAAY,OAA2B,EAAE,KAAY;QA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E,eAAe;aACnC;SACJ,EACD,KAAK,CACR,CAAC;IACN,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IACpD;;;;OAIG;IACH,YAAY,UAAsB,EAAE,KAAY;QAC5C,KAAK,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACjG,CAAC;CACJ","sourcesContent":["import type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport { PhysicsShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsShapeParameters } from \"./IPhysicsEnginePlugin\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { Matrix, Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { GroundMesh } from \"../../Meshes/groundMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * Options for creating a physics shape\r\n */\r\nexport interface PhysicShapeOptions {\r\n /**\r\n * The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n */\r\n type?: PhysicsShapeType;\r\n /**\r\n * The parameters of the shape. Varies depending of the shape type.\r\n */\r\n parameters?: PhysicsShapeParameters;\r\n /**\r\n * Reference to an already existing physics shape in the plugin.\r\n */\r\n pluginData?: any;\r\n}\r\n\r\n/**\r\n * PhysicsShape class.\r\n * This class is useful for creating a physics shape that can be used in a physics engine.\r\n * A Physic Shape determine how collision are computed. It must be attached to a body.\r\n */\r\nexport class PhysicsShape {\r\n /**\r\n * V2 Physics plugin private data for single shape\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n\r\n private _type: PhysicsShapeType;\r\n\r\n private _material: PhysicsMaterial;\r\n\r\n private _isTrigger: boolean = false;\r\n\r\n private _isDisposed = false;\r\n\r\n /**\r\n * Constructs a new physics shape.\r\n * @param options The options for the physics shape. These are:\r\n * * type: The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n * * parameters: The parameters of the shape.\r\n * * pluginData: The plugin data of the shape. This is used if you already have a reference to the object on the plugin side.\r\n * You need to specify either type or pluginData.\r\n * @param scene The scene the shape belongs to.\r\n *\r\n * This code is useful for creating a new physics shape with the given type, options, and scene.\r\n * It also checks that the physics engine and plugin version are correct.\r\n * If not, it throws an error. This ensures that the shape is created with the correct parameters and is compatible with the physics engine.\r\n */\r\n constructor(options: PhysicShapeOptions, scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n\r\n if (options.pluginData !== undefined && options.pluginData !== null) {\r\n this._pluginData = options.pluginData;\r\n this._type = this._physicsPlugin.getShapeType(this);\r\n } else if (options.type !== undefined && options.type !== null) {\r\n this._type = options.type;\r\n const parameters = options.parameters ?? {};\r\n this._physicsPlugin.initShape(this, options.type, parameters);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the string \"PhysicsShape\".\r\n * @returns \"PhysicsShape\"\r\n */\r\n public getClassName() {\r\n return \"PhysicsShape\";\r\n }\r\n\r\n /**\r\n * Returns the type of the physics shape.\r\n * @returns The type of the physics shape.\r\n */\r\n public get type(): PhysicsShapeType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Set the membership mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which the shape is a member. This is used in combination\r\n * with the collide mask to determine if this shape should collide with\r\n * another.\r\n *\r\n * @param membershipMask Bitfield of categories of this shape.\r\n */\r\n public set filterMembershipMask(membershipMask: number) {\r\n this._physicsPlugin.setShapeFilterMembershipMask(this, membershipMask);\r\n }\r\n\r\n /**\r\n * Get the membership mask of a shape.\r\n * @returns Bitmask of categories which this shape is a member of.\r\n */\r\n public get filterMembershipMask(): number {\r\n return this._physicsPlugin.getShapeFilterMembershipMask(this);\r\n }\r\n\r\n /**\r\n * Sets the collide mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which this shape collides with. Given two shapes,\r\n * the engine will check if the collide mask and membership overlap:\r\n * shapeA.filterMembershipMask & shapeB.filterCollideMask\r\n *\r\n * If this value is zero (i.e. shapeB only collides with categories\r\n * which shapeA is _not_ a member of) then the shapes will not collide.\r\n *\r\n * Note, the engine will also perform the same test with shapeA and\r\n * shapeB swapped; the shapes will not collide if either shape has\r\n * a collideMask which prevents collision with the other shape.\r\n *\r\n * @param collideMask Bitmask of categories this shape should collide with\r\n */\r\n public set filterCollideMask(collideMask: number) {\r\n this._physicsPlugin.setShapeFilterCollideMask(this, collideMask);\r\n }\r\n\r\n /**\r\n *\r\n * @returns Bitmask of categories that this shape should collide with\r\n */\r\n public get filterCollideMask(): number {\r\n return this._physicsPlugin.getShapeFilterCollideMask(this);\r\n }\r\n /**\r\n *\r\n * @param material\r\n */\r\n public set material(material: PhysicsMaterial) {\r\n this._physicsPlugin.setMaterial(this, material);\r\n this._material = material;\r\n }\r\n\r\n /**\r\n * Returns the material of the physics shape.\r\n * @returns The material of the physics shape.\r\n */\r\n public get material(): PhysicsMaterial {\r\n if (!this._material) {\r\n this._material = this._physicsPlugin.getMaterial(this);\r\n }\r\n return this._material;\r\n }\r\n\r\n /**\r\n * Sets the density of the physics shape.\r\n * @param density The density of the physics shape.\r\n */\r\n public set density(density: number) {\r\n this._physicsPlugin.setDensity(this, density);\r\n }\r\n\r\n /**\r\n * Returns the density of the physics shape.\r\n * @returns The density of the physics shape.\r\n */\r\n public get density(): number {\r\n return this._physicsPlugin.getDensity(this);\r\n }\r\n\r\n /**\r\n * Utility to add a child shape to this container,\r\n * automatically computing the relative transform between\r\n * the container shape and the child instance.\r\n *\r\n * @param parentTransform The transform node associated with this shape\r\n * @param newChild The new PhysicsShape to add\r\n * @param childTransform The transform node associated with the child shape\r\n */\r\n public addChildFromParent(parentTransform: TransformNode, newChild: PhysicsShape, childTransform: TransformNode): void {\r\n const childToWorld = childTransform.computeWorldMatrix(true);\r\n const parentToWorld = parentTransform.computeWorldMatrix(true);\r\n const childToParent = TmpVectors.Matrix[0];\r\n childToWorld.multiplyToRef(Matrix.Invert(parentToWorld), childToParent);\r\n const translation = TmpVectors.Vector3[0];\r\n const rotation = TmpVectors.Quaternion[0];\r\n const scale = TmpVectors.Vector3[1];\r\n childToParent.decompose(scale, rotation, translation);\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Adds a child shape to a container with an optional transform\r\n * @param newChild The new PhysicsShape to add\r\n * @param translation Optional position of the child shape relative to this shape\r\n * @param rotation Optional rotation of the child shape relative to this shape\r\n * @param scale Optional scale of the child shape relative to this shape\r\n */\r\n public addChild(newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void {\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Removes a child shape from this shape.\r\n * @param childIndex The index of the child shape to remove\r\n */\r\n public removeChild(childIndex: number): void {\r\n this._physicsPlugin.removeChild(this, childIndex);\r\n }\r\n\r\n /**\r\n * Returns the number of children of a physics shape.\r\n * @returns The number of children of a physics shape.\r\n */\r\n public getNumChildren(): number {\r\n return this._physicsPlugin.getNumChildren(this);\r\n }\r\n\r\n /**\r\n * Returns the bounding box of the physics shape.\r\n * @returns The bounding box of the physics shape.\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBoundingBox(this);\r\n }\r\n\r\n public set isTrigger(isTrigger: boolean) {\r\n if (this._isTrigger === isTrigger) {\r\n return;\r\n }\r\n this._isTrigger = isTrigger;\r\n this._physicsPlugin.setTrigger(this, isTrigger);\r\n }\r\n\r\n public get isTrigger(): boolean {\r\n return this._isTrigger;\r\n }\r\n\r\n /**\r\n * Dispose the shape and release its associated resources.\r\n */\r\n public dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n this._physicsPlugin.disposeShape(this);\r\n this._isDisposed = true;\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a sphere shape\r\n */\r\nexport class PhysicsShapeSphere extends PhysicsShape {\r\n /**\r\n * Constructor for the Sphere Shape\r\n * @param center local center of the sphere\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.SPHERE, parameters: { center: center, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate sphere from the mesh.\r\n * @param mesh node from which to derive the sphere shape\r\n * @returns PhysicsShapeSphere\r\n */\r\n static FromMesh(mesh: AbstractMesh) {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingSphere.center;\r\n const he = bounds.boundingBox.extendSize;\r\n const radius = Math.max(he.x, he.y, he.z);\r\n return new PhysicsShapeSphere(centerLocal, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a capsule shape\r\n */\r\nexport class PhysicsShapeCapsule extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the capsule segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CAPSULE, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate capsule from the mesh. Note, this is\r\n * not the optimal bounding capsule.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Capsule\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCapsule {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y - radius, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCapsule(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a cylinder shape\r\n */\r\nexport class PhysicsShapeCylinder extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the cylinder segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CYLINDER, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate cylinder from the mesh. Note, this is\r\n * not the optimal bounding cylinder.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Cylinder\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCylinder {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCylinder(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a box shape\r\n */\r\nexport class PhysicsShapeBox extends PhysicsShape {\r\n /**\r\n *\r\n * @param center local center of the box\r\n * @param rotation local orientation\r\n * @param extents size of the box in each direction\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, rotation: Quaternion, extents: Vector3, scene: Scene) {\r\n super({ type: PhysicsShapeType.BOX, parameters: { center: center, rotation: rotation, extents: extents } }, scene);\r\n }\r\n\r\n /**\r\n *\r\n * @param mesh\r\n * @returns PhysicsShapeBox\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeBox {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingBox.center;\r\n const extents = bounds.boundingBox.extendSize.scale(2.0); //<todo.eoin extendSize seems to really be half-extents?\r\n return new PhysicsShapeBox(centerLocal, Quaternion.Identity(), extents, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a convex hull shape\r\n */\r\nexport class PhysicsShapeConvexHull extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh to be used as topology infos for the convex hull\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.CONVEX_HULL, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a mesh shape\r\n */\r\nexport class PhysicsShapeMesh extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh topology that will be used to create the shape\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.MESH, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * A shape container holds a variable number of shapes. Use AddChild to append to newly created parent container.\r\n */\r\nexport class PhysicsShapeContainer extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape container\r\n * @param scene scene to attach to\r\n */\r\n constructor(scene: Scene) {\r\n super({ type: PhysicsShapeType.CONTAINER, parameters: {} }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a heightfield Shape\r\n */\r\nexport class PhysicsShapeHeightField extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param heightFieldSizeX The size of the heightfield in the X axis\r\n * @param heightFieldSizeZ The size of the heightfield in the Z axis\r\n * @param numHeightFieldSamplesX The number of samples along the X axis\r\n * @param numHeightFieldSamplesZ The number of samples along the Z axis\r\n * @param heightFieldData The data for the heightfield\r\n * @param scene scene to attach to\r\n */\r\n constructor(heightFieldSizeX: number, heightFieldSizeZ: number, numHeightFieldSamplesX: number, numHeightFieldSamplesZ: number, heightFieldData: Float32Array, scene: Scene) {\r\n super(\r\n {\r\n type: PhysicsShapeType.HEIGHTFIELD,\r\n parameters: {\r\n heightFieldSizeX: heightFieldSizeX,\r\n heightFieldSizeZ: heightFieldSizeZ,\r\n numHeightFieldSamplesX: numHeightFieldSamplesX,\r\n numHeightFieldSamplesZ: numHeightFieldSamplesZ,\r\n heightFieldData: heightFieldData,\r\n },\r\n },\r\n scene\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a ground mesh Shape\r\n */\r\nexport class PhysicsShapeGroundMesh extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param groundMesh ground mesh used for display\r\n * @param scene scene to attach to\r\n */\r\n constructor(groundMesh: GroundMesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.HEIGHTFIELD, parameters: { groundMesh: groundMesh } }, scene);\r\n }\r\n}\r\n"]}
|
|
@@ -119,7 +119,7 @@ export class DepthRenderer {
|
|
|
119
119
|
}
|
|
120
120
|
// Culling
|
|
121
121
|
const detNeg = effectiveMesh._getWorldMatrixDeterminant() < 0;
|
|
122
|
-
let sideOrientation =
|
|
122
|
+
let sideOrientation = material._getEffectiveOrientation(renderingMesh);
|
|
123
123
|
if (detNeg) {
|
|
124
124
|
sideOrientation =
|
|
125
125
|
sideOrientation === 0
|
|
@@ -1 +1 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IAAI,YAAY,EAAE;gBAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;aAC1C;SACJ;IACL,CAAC;;AAxcD;;GAEG;AACW,2CAA6B,GAA2B,CAAC,CAAC,EAAE,EAAE;IACxE,MAAM,WAAW,CAAC,6BAA6B,CAAC,CAAC;AACrD,CAAC,AAF0C,CAEzC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { SmartArray } from \"../Misc/smartArray\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport \"../Shaders/depth.fragment\";\r\nimport \"../Shaders/depth.vertex\";\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport { addClipPlaneUniforms, bindClipPlane, prepareStringDefinesForClipPlanes } from \"../Materials/clipPlaneMaterialHelper\";\r\n\r\nimport type { Material } from \"../Materials/material\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { BindMorphTargetParameters, PrepareAttributesForMorphTargetsInfluencers, PushAttributesForInstances } from \"../Materials/materialHelper.functions\";\r\n\r\n/**\r\n * This represents a depth renderer in Babylon.\r\n * A depth renderer will render to it's depth map every frame which can be displayed or used in post processing\r\n */\r\nexport class DepthRenderer {\r\n private _scene: Scene;\r\n private _depthMap: RenderTargetTexture;\r\n private readonly _storeNonLinearDepth: boolean;\r\n private readonly _storeCameraSpaceZ: boolean;\r\n\r\n /** Color used to clear the depth texture. Default: (1,0,0,1) */\r\n public clearColor: Color4;\r\n\r\n /** Get if the depth renderer is using packed depth or not */\r\n public readonly isPacked: boolean;\r\n\r\n private _camera: Nullable<Camera>;\r\n\r\n /** Enable or disable the depth renderer. When disabled, the depth texture is not updated */\r\n public enabled = true;\r\n\r\n /** Force writing the transparent objects into the depth map */\r\n public forceDepthWriteTransparentMeshes = false;\r\n\r\n /**\r\n * Specifies that the depth renderer will only be used within\r\n * the camera it is created for.\r\n * This can help forcing its rendering during the camera processing.\r\n */\r\n public useOnlyInActiveCamera: boolean = false;\r\n\r\n /** If true, reverse the culling of materials before writing to the depth texture.\r\n * So, basically, when \"true\", back facing instead of front facing faces are rasterized into the texture\r\n */\r\n public reverseCulling = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _SceneComponentInitialization: (scene: Scene) => void = (_) => {\r\n throw _WarnImport(\"DepthRendererSceneComponent\");\r\n };\r\n\r\n /**\r\n * Sets a specific material to be used to render a mesh/a list of meshes by the depth renderer\r\n * @param mesh mesh or array of meshes\r\n * @param material material to use by the depth render when rendering the mesh(es). If undefined is passed, the specific material created by the depth renderer will be used.\r\n */\r\n public setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material): void {\r\n this._depthMap.setMaterialForRendering(mesh, material);\r\n }\r\n\r\n /**\r\n * Instantiates a depth renderer\r\n * @param scene The scene the renderer belongs to\r\n * @param type The texture type of the depth map (default: Engine.TEXTURETYPE_FLOAT)\r\n * @param camera The camera to be used to render the depth map (default: scene's active camera)\r\n * @param storeNonLinearDepth Defines whether the depth is stored linearly like in Babylon Shadows or directly like glFragCoord.z\r\n * @param samplingMode The sampling mode to be used with the render target (Linear, Nearest...) (default: TRILINEAR_SAMPLINGMODE)\r\n * @param storeCameraSpaceZ Defines whether the depth stored is the Z coordinate in camera space. If true, storeNonLinearDepth has no effect. (Default: false)\r\n * @param name Name of the render target (default: DepthRenderer)\r\n */\r\n constructor(\r\n scene: Scene,\r\n type: number = Constants.TEXTURETYPE_FLOAT,\r\n camera: Nullable<Camera> = null,\r\n storeNonLinearDepth = false,\r\n samplingMode = Texture.TRILINEAR_SAMPLINGMODE,\r\n storeCameraSpaceZ = false,\r\n name?: string\r\n ) {\r\n this._scene = scene;\r\n this._storeNonLinearDepth = storeNonLinearDepth;\r\n this._storeCameraSpaceZ = storeCameraSpaceZ;\r\n this.isPacked = type === Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n if (this.isPacked) {\r\n this.clearColor = new Color4(1.0, 1.0, 1.0, 1.0);\r\n } else {\r\n this.clearColor = new Color4(storeCameraSpaceZ ? 1e8 : 1.0, 0.0, 0.0, 1.0);\r\n }\r\n\r\n DepthRenderer._SceneComponentInitialization(this._scene);\r\n\r\n const engine = scene.getEngine();\r\n\r\n this._camera = camera;\r\n\r\n if (samplingMode !== Texture.NEAREST_SAMPLINGMODE) {\r\n if (type === Constants.TEXTURETYPE_FLOAT && !engine._caps.textureFloatLinearFiltering) {\r\n samplingMode = Texture.NEAREST_SAMPLINGMODE;\r\n }\r\n if (type === Constants.TEXTURETYPE_HALF_FLOAT && !engine._caps.textureHalfFloatLinearFiltering) {\r\n samplingMode = Texture.NEAREST_SAMPLINGMODE;\r\n }\r\n }\r\n\r\n // Render target\r\n const format = this.isPacked || !engine._features.supportExtendedTextureFormats ? Constants.TEXTUREFORMAT_RGBA : Constants.TEXTUREFORMAT_R;\r\n this._depthMap = new RenderTargetTexture(\r\n name ?? \"DepthRenderer\",\r\n { width: engine.getRenderWidth(), height: engine.getRenderHeight() },\r\n this._scene,\r\n false,\r\n true,\r\n type,\r\n false,\r\n samplingMode,\r\n undefined,\r\n undefined,\r\n undefined,\r\n format\r\n );\r\n this._depthMap.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._depthMap.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._depthMap.refreshRate = 1;\r\n this._depthMap.renderParticles = false;\r\n this._depthMap.renderList = null;\r\n this._depthMap.noPrePassRenderer = true;\r\n\r\n // Camera to get depth map from to support multiple concurrent cameras\r\n this._depthMap.activeCamera = this._camera;\r\n this._depthMap.ignoreCameraViewport = true;\r\n this._depthMap.useCameraPostProcesses = false;\r\n\r\n // set default depth value to 1.0 (far away)\r\n this._depthMap.onClearObservable.add((engine) => {\r\n engine.clear(this.clearColor, true, true, true);\r\n });\r\n\r\n this._depthMap.onBeforeBindObservable.add(() => {\r\n engine._debugPushGroup?.(\"depth renderer\", 1);\r\n });\r\n\r\n this._depthMap.onAfterUnbindObservable.add(() => {\r\n engine._debugPopGroup?.(1);\r\n });\r\n\r\n this._depthMap.customIsReadyFunction = (mesh: AbstractMesh, refreshRate: number, preWarm?: boolean) => {\r\n if ((preWarm || refreshRate === 0) && mesh.subMeshes) {\r\n for (let i = 0; i < mesh.subMeshes.length; ++i) {\r\n const subMesh = mesh.subMeshes[i];\r\n const renderingMesh = subMesh.getRenderingMesh();\r\n\r\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!subMesh.getReplacementMesh());\r\n const hardwareInstancedRendering =\r\n engine.getCaps().instancedArrays &&\r\n ((batch.visibleInstances[subMesh._id] !== null && batch.visibleInstances[subMesh._id] !== undefined) || renderingMesh.hasThinInstances);\r\n\r\n if (!this.isReady(subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n };\r\n\r\n // Custom render function\r\n const renderSubMesh = (subMesh: SubMesh): void => {\r\n const renderingMesh = subMesh.getRenderingMesh();\r\n const effectiveMesh = subMesh.getEffectiveMesh();\r\n const scene = this._scene;\r\n const engine = scene.getEngine();\r\n const material = subMesh.getMaterial();\r\n\r\n effectiveMesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n\r\n if (!material || effectiveMesh.infiniteDistance || material.disableDepthWrite || subMesh.verticesCount === 0 || subMesh._renderId === scene.getRenderId()) {\r\n return;\r\n }\r\n\r\n // Culling\r\n const detNeg = effectiveMesh._getWorldMatrixDeterminant() < 0;\r\n let sideOrientation = renderingMesh.overrideMaterialSideOrientation ?? material.sideOrientation;\r\n if (detNeg) {\r\n sideOrientation =\r\n sideOrientation === Constants.MATERIAL_ClockWiseSideOrientation\r\n ? Constants.MATERIAL_CounterClockWiseSideOrientation\r\n : Constants.MATERIAL_ClockWiseSideOrientation;\r\n }\r\n const reverseSideOrientation = sideOrientation === Constants.MATERIAL_ClockWiseSideOrientation;\r\n\r\n engine.setState(material.backFaceCulling, 0, false, reverseSideOrientation, this.reverseCulling ? !material.cullBackFaces : material.cullBackFaces);\r\n\r\n // Managing instances\r\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!subMesh.getReplacementMesh());\r\n\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n\r\n const hardwareInstancedRendering =\r\n engine.getCaps().instancedArrays &&\r\n ((batch.visibleInstances[subMesh._id] !== null && batch.visibleInstances[subMesh._id] !== undefined) || renderingMesh.hasThinInstances);\r\n\r\n const camera = this._camera || scene.activeCamera;\r\n if (this.isReady(subMesh, hardwareInstancedRendering) && camera) {\r\n subMesh._renderId = scene.getRenderId();\r\n\r\n const renderingMaterial = effectiveMesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\r\n\r\n let drawWrapper = subMesh._getDrawWrapper();\r\n if (!drawWrapper && renderingMaterial) {\r\n drawWrapper = renderingMaterial._getDrawWrapper();\r\n }\r\n const cameraIsOrtho = camera.mode === Camera.ORTHOGRAPHIC_CAMERA;\r\n\r\n if (!drawWrapper) {\r\n return;\r\n }\r\n\r\n const effect = drawWrapper.effect!;\r\n\r\n engine.enableEffect(drawWrapper);\r\n\r\n if (!hardwareInstancedRendering) {\r\n renderingMesh._bind(subMesh, effect, material.fillMode);\r\n }\r\n\r\n if (!renderingMaterial) {\r\n effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n effect.setMatrix(\"world\", effectiveMesh.getWorldMatrix());\r\n if (this._storeCameraSpaceZ) {\r\n effect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n } else {\r\n renderingMaterial.bindForSubMesh(effectiveMesh.getWorldMatrix(), effectiveMesh as Mesh, subMesh);\r\n }\r\n\r\n let minZ: number, maxZ: number;\r\n\r\n if (cameraIsOrtho) {\r\n minZ = !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\r\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\r\n } else {\r\n minZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? camera.minZ : engine.isNDCHalfZRange ? 0 : camera.minZ;\r\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : camera.maxZ;\r\n }\r\n\r\n effect.setFloat2(\"depthValues\", minZ, minZ + maxZ);\r\n\r\n if (!renderingMaterial) {\r\n // Alpha test\r\n if (material.needAlphaTesting()) {\r\n const alphaTexture = material.getAlphaTestTexture();\r\n\r\n if (alphaTexture) {\r\n effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n\r\n // Bones\r\n if (renderingMesh.useBones && renderingMesh.computeBonesUsingShaders && renderingMesh.skeleton) {\r\n const skeleton = renderingMesh.skeleton;\r\n\r\n if (skeleton.isUsingTextureForMatrices) {\r\n const boneTexture = skeleton.getTransformMatrixTexture(renderingMesh);\r\n if (!boneTexture) {\r\n return;\r\n }\r\n\r\n effect.setTexture(\"boneSampler\", boneTexture);\r\n effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n } else {\r\n effect.setMatrices(\"mBones\", skeleton.getTransformMatrices(renderingMesh));\r\n }\r\n }\r\n\r\n // Clip planes\r\n bindClipPlane(effect, material, scene);\r\n\r\n // Morph targets\r\n BindMorphTargetParameters(renderingMesh, effect);\r\n if (renderingMesh.morphTargetManager && renderingMesh.morphTargetManager.isUsingTextureForTargets) {\r\n renderingMesh.morphTargetManager._bind(effect);\r\n }\r\n\r\n // Points cloud rendering\r\n if (material.pointsCloud) {\r\n effect.setFloat(\"pointSize\", material.pointSize);\r\n }\r\n }\r\n\r\n // Draw\r\n renderingMesh._processRendering(effectiveMesh, subMesh, effect, material.fillMode, batch, hardwareInstancedRendering, (isInstance, world) =>\r\n effect.setMatrix(\"world\", world)\r\n );\r\n }\r\n };\r\n\r\n this._depthMap.customRenderFunction = (\r\n opaqueSubMeshes: SmartArray<SubMesh>,\r\n alphaTestSubMeshes: SmartArray<SubMesh>,\r\n transparentSubMeshes: SmartArray<SubMesh>,\r\n depthOnlySubMeshes: SmartArray<SubMesh>\r\n ): void => {\r\n let index;\r\n\r\n if (depthOnlySubMeshes.length) {\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n }\r\n\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n\r\n if (this.forceDepthWriteTransparentMeshes) {\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n renderSubMesh(transparentSubMeshes.data[index]);\r\n }\r\n } else {\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n transparentSubMeshes.data[index].getEffectiveMesh()._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n }\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Creates the depth rendering effect and checks if the effect is ready.\r\n * @param subMesh The submesh to be used to render the depth map of\r\n * @param useInstances If multiple world instances should be used\r\n * @returns if the depth renderer is ready to render the depth map\r\n */\r\n public isReady(subMesh: SubMesh, useInstances: boolean): boolean {\r\n const engine = this._scene.getEngine();\r\n const mesh = subMesh.getMesh();\r\n const scene = mesh.getScene();\r\n\r\n const renderingMaterial = mesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\r\n\r\n if (renderingMaterial) {\r\n return renderingMaterial.isReadyForSubMesh(mesh, subMesh, useInstances);\r\n }\r\n\r\n const material = subMesh.getMaterial();\r\n if (!material || material.disableDepthWrite) {\r\n return false;\r\n }\r\n\r\n const defines = [];\r\n\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n // Alpha test\r\n if (material && material.needAlphaTesting() && material.getAlphaTestTexture()) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n attribs.push(VertexBuffer.UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(VertexBuffer.MatricesIndicesKind);\r\n attribs.push(VertexBuffer.MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\r\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\r\n\r\n const skeleton = subMesh.getRenderingMesh().skeleton;\r\n\r\n if (skeleton?.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n }\r\n } else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n\r\n // Morph targets\r\n const morphTargetManager = (mesh as Mesh).morphTargetManager;\r\n let numMorphInfluencers = 0;\r\n if (morphTargetManager) {\r\n numMorphInfluencers = morphTargetManager.numMaxInfluencers || morphTargetManager.numInfluencers;\r\n if (numMorphInfluencers > 0) {\r\n defines.push(\"#define MORPHTARGETS\");\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\r\n\r\n if (morphTargetManager.isUsingTextureForTargets) {\r\n defines.push(\"#define MORPHTARGETS_TEXTURE\");\r\n }\r\n\r\n PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\r\n }\r\n }\r\n\r\n // Points cloud rendering\r\n if (material.pointsCloud) {\r\n defines.push(\"#define POINTSIZE\");\r\n }\r\n\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n PushAttributesForInstances(attribs);\r\n if (subMesh.getRenderingMesh().hasThinInstances) {\r\n defines.push(\"#define THIN_INSTANCES\");\r\n }\r\n }\r\n\r\n // None linear depth\r\n if (this._storeNonLinearDepth) {\r\n defines.push(\"#define NONLINEARDEPTH\");\r\n }\r\n\r\n // Store camera space Z coordinate instead of NDC Z\r\n if (this._storeCameraSpaceZ) {\r\n defines.push(\"#define STORE_CAMERASPACE_Z\");\r\n }\r\n\r\n // Float Mode\r\n if (this.isPacked) {\r\n defines.push(\"#define PACKED\");\r\n }\r\n\r\n // Clip planes\r\n prepareStringDefinesForClipPlanes(material, scene, defines);\r\n\r\n // Get correct effect\r\n const drawWrapper = subMesh._getDrawWrapper(undefined, true)!;\r\n const cachedDefines = drawWrapper.defines;\r\n const join = defines.join(\"\\n\");\r\n if (cachedDefines !== join) {\r\n const uniforms = [\r\n \"world\",\r\n \"mBones\",\r\n \"boneTextureWidth\",\r\n \"pointSize\",\r\n \"viewProjection\",\r\n \"view\",\r\n \"diffuseMatrix\",\r\n \"depthValues\",\r\n \"morphTargetInfluences\",\r\n \"morphTargetCount\",\r\n \"morphTargetTextureInfo\",\r\n \"morphTargetTextureIndices\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n\r\n drawWrapper.setEffect(\r\n engine.createEffect(\"depth\", attribs, uniforms, [\"diffuseSampler\", \"morphTargets\", \"boneSampler\"], join, undefined, undefined, undefined, {\r\n maxSimultaneousMorphTargets: numMorphInfluencers,\r\n }),\r\n join\r\n );\r\n }\r\n\r\n return drawWrapper.effect!.isReady();\r\n }\r\n\r\n /**\r\n * Gets the texture which the depth map will be written to.\r\n * @returns The depth map texture\r\n */\r\n public getDepthMap(): RenderTargetTexture {\r\n return this._depthMap;\r\n }\r\n\r\n /**\r\n * Disposes of the depth renderer.\r\n */\r\n public dispose(): void {\r\n const keysToDelete = [];\r\n for (const key in this._scene._depthRenderer) {\r\n const depthRenderer = this._scene._depthRenderer[key];\r\n if (depthRenderer === this) {\r\n keysToDelete.push(key);\r\n }\r\n }\r\n\r\n if (keysToDelete.length > 0) {\r\n this._depthMap.dispose();\r\n\r\n for (const key of keysToDelete) {\r\n delete this._scene._depthRenderer[key];\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"depthRenderer.js","sourceRoot":"","sources":["../../../../dev/core/src/Rendering/depthRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,2BAA2B,CAAC;AACnC,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAI9H,OAAO,EAAE,yBAAyB,EAAE,2CAA2C,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAE3J;;;GAGG;AACH,MAAM,OAAO,aAAa;IAuCtB;;;;OAIG;IACI,uBAAuB,CAAC,IAAmC,EAAE,QAAmB;QACnF,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;;OASG;IAC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,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;YAC1C,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YACtD,IAAI,aAAa,KAAK,IAAI,EAAE;gBACxB,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAC1B;SACJ;QAED,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;YACzB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YAEzB,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;gBAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;aAC1C;SACJ;IACL,CAAC;;AAzcD;;GAEG;AACW,2CAA6B,GAA2B,CAAC,CAAC,EAAE,EAAE;IACxE,MAAM,WAAW,CAAC,6BAA6B,CAAC,CAAC;AACrD,CAAC,AAF0C,CAEzC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { SmartArray } from \"../Misc/smartArray\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport \"../Shaders/depth.fragment\";\r\nimport \"../Shaders/depth.vertex\";\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport { addClipPlaneUniforms, bindClipPlane, prepareStringDefinesForClipPlanes } from \"../Materials/clipPlaneMaterialHelper\";\r\n\r\nimport type { Material } from \"../Materials/material\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { BindMorphTargetParameters, PrepareAttributesForMorphTargetsInfluencers, PushAttributesForInstances } from \"../Materials/materialHelper.functions\";\r\n\r\n/**\r\n * This represents a depth renderer in Babylon.\r\n * A depth renderer will render to it's depth map every frame which can be displayed or used in post processing\r\n */\r\nexport class DepthRenderer {\r\n private _scene: Scene;\r\n private _depthMap: RenderTargetTexture;\r\n private readonly _storeNonLinearDepth: boolean;\r\n private readonly _storeCameraSpaceZ: boolean;\r\n\r\n /** Color used to clear the depth texture. Default: (1,0,0,1) */\r\n public clearColor: Color4;\r\n\r\n /** Get if the depth renderer is using packed depth or not */\r\n public readonly isPacked: boolean;\r\n\r\n private _camera: Nullable<Camera>;\r\n\r\n /** Enable or disable the depth renderer. When disabled, the depth texture is not updated */\r\n public enabled = true;\r\n\r\n /** Force writing the transparent objects into the depth map */\r\n public forceDepthWriteTransparentMeshes = false;\r\n\r\n /**\r\n * Specifies that the depth renderer will only be used within\r\n * the camera it is created for.\r\n * This can help forcing its rendering during the camera processing.\r\n */\r\n public useOnlyInActiveCamera: boolean = false;\r\n\r\n /** If true, reverse the culling of materials before writing to the depth texture.\r\n * So, basically, when \"true\", back facing instead of front facing faces are rasterized into the texture\r\n */\r\n public reverseCulling = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _SceneComponentInitialization: (scene: Scene) => void = (_) => {\r\n throw _WarnImport(\"DepthRendererSceneComponent\");\r\n };\r\n\r\n /**\r\n * Sets a specific material to be used to render a mesh/a list of meshes by the depth renderer\r\n * @param mesh mesh or array of meshes\r\n * @param material material to use by the depth render when rendering the mesh(es). If undefined is passed, the specific material created by the depth renderer will be used.\r\n */\r\n public setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material): void {\r\n this._depthMap.setMaterialForRendering(mesh, material);\r\n }\r\n\r\n /**\r\n * Instantiates a depth renderer\r\n * @param scene The scene the renderer belongs to\r\n * @param type The texture type of the depth map (default: Engine.TEXTURETYPE_FLOAT)\r\n * @param camera The camera to be used to render the depth map (default: scene's active camera)\r\n * @param storeNonLinearDepth Defines whether the depth is stored linearly like in Babylon Shadows or directly like glFragCoord.z\r\n * @param samplingMode The sampling mode to be used with the render target (Linear, Nearest...) (default: TRILINEAR_SAMPLINGMODE)\r\n * @param storeCameraSpaceZ Defines whether the depth stored is the Z coordinate in camera space. If true, storeNonLinearDepth has no effect. (Default: false)\r\n * @param name Name of the render target (default: DepthRenderer)\r\n */\r\n constructor(\r\n scene: Scene,\r\n type: number = Constants.TEXTURETYPE_FLOAT,\r\n camera: Nullable<Camera> = null,\r\n storeNonLinearDepth = false,\r\n samplingMode = Texture.TRILINEAR_SAMPLINGMODE,\r\n storeCameraSpaceZ = false,\r\n name?: string\r\n ) {\r\n this._scene = scene;\r\n this._storeNonLinearDepth = storeNonLinearDepth;\r\n this._storeCameraSpaceZ = storeCameraSpaceZ;\r\n this.isPacked = type === Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n if (this.isPacked) {\r\n this.clearColor = new Color4(1.0, 1.0, 1.0, 1.0);\r\n } else {\r\n this.clearColor = new Color4(storeCameraSpaceZ ? 1e8 : 1.0, 0.0, 0.0, 1.0);\r\n }\r\n\r\n DepthRenderer._SceneComponentInitialization(this._scene);\r\n\r\n const engine = scene.getEngine();\r\n\r\n this._camera = camera;\r\n\r\n if (samplingMode !== Texture.NEAREST_SAMPLINGMODE) {\r\n if (type === Constants.TEXTURETYPE_FLOAT && !engine._caps.textureFloatLinearFiltering) {\r\n samplingMode = Texture.NEAREST_SAMPLINGMODE;\r\n }\r\n if (type === Constants.TEXTURETYPE_HALF_FLOAT && !engine._caps.textureHalfFloatLinearFiltering) {\r\n samplingMode = Texture.NEAREST_SAMPLINGMODE;\r\n }\r\n }\r\n\r\n // Render target\r\n const format = this.isPacked || !engine._features.supportExtendedTextureFormats ? Constants.TEXTUREFORMAT_RGBA : Constants.TEXTUREFORMAT_R;\r\n this._depthMap = new RenderTargetTexture(\r\n name ?? \"DepthRenderer\",\r\n { width: engine.getRenderWidth(), height: engine.getRenderHeight() },\r\n this._scene,\r\n false,\r\n true,\r\n type,\r\n false,\r\n samplingMode,\r\n undefined,\r\n undefined,\r\n undefined,\r\n format\r\n );\r\n this._depthMap.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._depthMap.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._depthMap.refreshRate = 1;\r\n this._depthMap.renderParticles = false;\r\n this._depthMap.renderList = null;\r\n this._depthMap.noPrePassRenderer = true;\r\n\r\n // Camera to get depth map from to support multiple concurrent cameras\r\n this._depthMap.activeCamera = this._camera;\r\n this._depthMap.ignoreCameraViewport = true;\r\n this._depthMap.useCameraPostProcesses = false;\r\n\r\n // set default depth value to 1.0 (far away)\r\n this._depthMap.onClearObservable.add((engine) => {\r\n engine.clear(this.clearColor, true, true, true);\r\n });\r\n\r\n this._depthMap.onBeforeBindObservable.add(() => {\r\n engine._debugPushGroup?.(\"depth renderer\", 1);\r\n });\r\n\r\n this._depthMap.onAfterUnbindObservable.add(() => {\r\n engine._debugPopGroup?.(1);\r\n });\r\n\r\n this._depthMap.customIsReadyFunction = (mesh: AbstractMesh, refreshRate: number, preWarm?: boolean) => {\r\n if ((preWarm || refreshRate === 0) && mesh.subMeshes) {\r\n for (let i = 0; i < mesh.subMeshes.length; ++i) {\r\n const subMesh = mesh.subMeshes[i];\r\n const renderingMesh = subMesh.getRenderingMesh();\r\n\r\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!subMesh.getReplacementMesh());\r\n const hardwareInstancedRendering =\r\n engine.getCaps().instancedArrays &&\r\n ((batch.visibleInstances[subMesh._id] !== null && batch.visibleInstances[subMesh._id] !== undefined) || renderingMesh.hasThinInstances);\r\n\r\n if (!this.isReady(subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n };\r\n\r\n // Custom render function\r\n const renderSubMesh = (subMesh: SubMesh): void => {\r\n const renderingMesh = subMesh.getRenderingMesh();\r\n const effectiveMesh = subMesh.getEffectiveMesh();\r\n const scene = this._scene;\r\n const engine = scene.getEngine();\r\n const material = subMesh.getMaterial();\r\n\r\n effectiveMesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n\r\n if (!material || effectiveMesh.infiniteDistance || material.disableDepthWrite || subMesh.verticesCount === 0 || subMesh._renderId === scene.getRenderId()) {\r\n return;\r\n }\r\n\r\n // Culling\r\n const detNeg = effectiveMesh._getWorldMatrixDeterminant() < 0;\r\n let sideOrientation = material._getEffectiveOrientation(renderingMesh);\r\n\r\n if (detNeg) {\r\n sideOrientation =\r\n sideOrientation === Constants.MATERIAL_ClockWiseSideOrientation\r\n ? Constants.MATERIAL_CounterClockWiseSideOrientation\r\n : Constants.MATERIAL_ClockWiseSideOrientation;\r\n }\r\n const reverseSideOrientation = sideOrientation === Constants.MATERIAL_ClockWiseSideOrientation;\r\n\r\n engine.setState(material.backFaceCulling, 0, false, reverseSideOrientation, this.reverseCulling ? !material.cullBackFaces : material.cullBackFaces);\r\n\r\n // Managing instances\r\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!subMesh.getReplacementMesh());\r\n\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n\r\n const hardwareInstancedRendering =\r\n engine.getCaps().instancedArrays &&\r\n ((batch.visibleInstances[subMesh._id] !== null && batch.visibleInstances[subMesh._id] !== undefined) || renderingMesh.hasThinInstances);\r\n\r\n const camera = this._camera || scene.activeCamera;\r\n if (this.isReady(subMesh, hardwareInstancedRendering) && camera) {\r\n subMesh._renderId = scene.getRenderId();\r\n\r\n const renderingMaterial = effectiveMesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\r\n\r\n let drawWrapper = subMesh._getDrawWrapper();\r\n if (!drawWrapper && renderingMaterial) {\r\n drawWrapper = renderingMaterial._getDrawWrapper();\r\n }\r\n const cameraIsOrtho = camera.mode === Camera.ORTHOGRAPHIC_CAMERA;\r\n\r\n if (!drawWrapper) {\r\n return;\r\n }\r\n\r\n const effect = drawWrapper.effect!;\r\n\r\n engine.enableEffect(drawWrapper);\r\n\r\n if (!hardwareInstancedRendering) {\r\n renderingMesh._bind(subMesh, effect, material.fillMode);\r\n }\r\n\r\n if (!renderingMaterial) {\r\n effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n effect.setMatrix(\"world\", effectiveMesh.getWorldMatrix());\r\n if (this._storeCameraSpaceZ) {\r\n effect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n } else {\r\n renderingMaterial.bindForSubMesh(effectiveMesh.getWorldMatrix(), effectiveMesh as Mesh, subMesh);\r\n }\r\n\r\n let minZ: number, maxZ: number;\r\n\r\n if (cameraIsOrtho) {\r\n minZ = !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\r\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\r\n } else {\r\n minZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? camera.minZ : engine.isNDCHalfZRange ? 0 : camera.minZ;\r\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : camera.maxZ;\r\n }\r\n\r\n effect.setFloat2(\"depthValues\", minZ, minZ + maxZ);\r\n\r\n if (!renderingMaterial) {\r\n // Alpha test\r\n if (material.needAlphaTesting()) {\r\n const alphaTexture = material.getAlphaTestTexture();\r\n\r\n if (alphaTexture) {\r\n effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n\r\n // Bones\r\n if (renderingMesh.useBones && renderingMesh.computeBonesUsingShaders && renderingMesh.skeleton) {\r\n const skeleton = renderingMesh.skeleton;\r\n\r\n if (skeleton.isUsingTextureForMatrices) {\r\n const boneTexture = skeleton.getTransformMatrixTexture(renderingMesh);\r\n if (!boneTexture) {\r\n return;\r\n }\r\n\r\n effect.setTexture(\"boneSampler\", boneTexture);\r\n effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n } else {\r\n effect.setMatrices(\"mBones\", skeleton.getTransformMatrices(renderingMesh));\r\n }\r\n }\r\n\r\n // Clip planes\r\n bindClipPlane(effect, material, scene);\r\n\r\n // Morph targets\r\n BindMorphTargetParameters(renderingMesh, effect);\r\n if (renderingMesh.morphTargetManager && renderingMesh.morphTargetManager.isUsingTextureForTargets) {\r\n renderingMesh.morphTargetManager._bind(effect);\r\n }\r\n\r\n // Points cloud rendering\r\n if (material.pointsCloud) {\r\n effect.setFloat(\"pointSize\", material.pointSize);\r\n }\r\n }\r\n\r\n // Draw\r\n renderingMesh._processRendering(effectiveMesh, subMesh, effect, material.fillMode, batch, hardwareInstancedRendering, (isInstance, world) =>\r\n effect.setMatrix(\"world\", world)\r\n );\r\n }\r\n };\r\n\r\n this._depthMap.customRenderFunction = (\r\n opaqueSubMeshes: SmartArray<SubMesh>,\r\n alphaTestSubMeshes: SmartArray<SubMesh>,\r\n transparentSubMeshes: SmartArray<SubMesh>,\r\n depthOnlySubMeshes: SmartArray<SubMesh>\r\n ): void => {\r\n let index;\r\n\r\n if (depthOnlySubMeshes.length) {\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n }\r\n\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n\r\n if (this.forceDepthWriteTransparentMeshes) {\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n renderSubMesh(transparentSubMeshes.data[index]);\r\n }\r\n } else {\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n transparentSubMeshes.data[index].getEffectiveMesh()._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n }\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Creates the depth rendering effect and checks if the effect is ready.\r\n * @param subMesh The submesh to be used to render the depth map of\r\n * @param useInstances If multiple world instances should be used\r\n * @returns if the depth renderer is ready to render the depth map\r\n */\r\n public isReady(subMesh: SubMesh, useInstances: boolean): boolean {\r\n const engine = this._scene.getEngine();\r\n const mesh = subMesh.getMesh();\r\n const scene = mesh.getScene();\r\n\r\n const renderingMaterial = mesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\r\n\r\n if (renderingMaterial) {\r\n return renderingMaterial.isReadyForSubMesh(mesh, subMesh, useInstances);\r\n }\r\n\r\n const material = subMesh.getMaterial();\r\n if (!material || material.disableDepthWrite) {\r\n return false;\r\n }\r\n\r\n const defines = [];\r\n\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n // Alpha test\r\n if (material && material.needAlphaTesting() && material.getAlphaTestTexture()) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n attribs.push(VertexBuffer.UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(VertexBuffer.MatricesIndicesKind);\r\n attribs.push(VertexBuffer.MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\r\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\r\n\r\n const skeleton = subMesh.getRenderingMesh().skeleton;\r\n\r\n if (skeleton?.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n }\r\n } else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n\r\n // Morph targets\r\n const morphTargetManager = (mesh as Mesh).morphTargetManager;\r\n let numMorphInfluencers = 0;\r\n if (morphTargetManager) {\r\n numMorphInfluencers = morphTargetManager.numMaxInfluencers || morphTargetManager.numInfluencers;\r\n if (numMorphInfluencers > 0) {\r\n defines.push(\"#define MORPHTARGETS\");\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\r\n\r\n if (morphTargetManager.isUsingTextureForTargets) {\r\n defines.push(\"#define MORPHTARGETS_TEXTURE\");\r\n }\r\n\r\n PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\r\n }\r\n }\r\n\r\n // Points cloud rendering\r\n if (material.pointsCloud) {\r\n defines.push(\"#define POINTSIZE\");\r\n }\r\n\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n PushAttributesForInstances(attribs);\r\n if (subMesh.getRenderingMesh().hasThinInstances) {\r\n defines.push(\"#define THIN_INSTANCES\");\r\n }\r\n }\r\n\r\n // None linear depth\r\n if (this._storeNonLinearDepth) {\r\n defines.push(\"#define NONLINEARDEPTH\");\r\n }\r\n\r\n // Store camera space Z coordinate instead of NDC Z\r\n if (this._storeCameraSpaceZ) {\r\n defines.push(\"#define STORE_CAMERASPACE_Z\");\r\n }\r\n\r\n // Float Mode\r\n if (this.isPacked) {\r\n defines.push(\"#define PACKED\");\r\n }\r\n\r\n // Clip planes\r\n prepareStringDefinesForClipPlanes(material, scene, defines);\r\n\r\n // Get correct effect\r\n const drawWrapper = subMesh._getDrawWrapper(undefined, true)!;\r\n const cachedDefines = drawWrapper.defines;\r\n const join = defines.join(\"\\n\");\r\n if (cachedDefines !== join) {\r\n const uniforms = [\r\n \"world\",\r\n \"mBones\",\r\n \"boneTextureWidth\",\r\n \"pointSize\",\r\n \"viewProjection\",\r\n \"view\",\r\n \"diffuseMatrix\",\r\n \"depthValues\",\r\n \"morphTargetInfluences\",\r\n \"morphTargetCount\",\r\n \"morphTargetTextureInfo\",\r\n \"morphTargetTextureIndices\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n\r\n drawWrapper.setEffect(\r\n engine.createEffect(\"depth\", attribs, uniforms, [\"diffuseSampler\", \"morphTargets\", \"boneSampler\"], join, undefined, undefined, undefined, {\r\n maxSimultaneousMorphTargets: numMorphInfluencers,\r\n }),\r\n join\r\n );\r\n }\r\n\r\n return drawWrapper.effect!.isReady();\r\n }\r\n\r\n /**\r\n * Gets the texture which the depth map will be written to.\r\n * @returns The depth map texture\r\n */\r\n public getDepthMap(): RenderTargetTexture {\r\n return this._depthMap;\r\n }\r\n\r\n /**\r\n * Disposes of the depth renderer.\r\n */\r\n public dispose(): void {\r\n const keysToDelete = [];\r\n for (const key in this._scene._depthRenderer) {\r\n const depthRenderer = this._scene._depthRenderer[key];\r\n if (depthRenderer === this) {\r\n keysToDelete.push(key);\r\n }\r\n }\r\n\r\n if (keysToDelete.length > 0) {\r\n this._depthMap.dispose();\r\n\r\n for (const key of keysToDelete) {\r\n delete this._scene._depthRenderer[key];\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -731,12 +731,9 @@ export class GeometryBufferRenderer {
|
|
|
731
731
|
}
|
|
732
732
|
let sideOrientation;
|
|
733
733
|
const instanceDataStorage = renderingMesh._instanceDataStorage;
|
|
734
|
-
if (!instanceDataStorage.isFrozen && (material.backFaceCulling ||
|
|
734
|
+
if (!instanceDataStorage.isFrozen && (material.backFaceCulling || material.sideOrientation !== null)) {
|
|
735
735
|
const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();
|
|
736
|
-
sideOrientation = renderingMesh
|
|
737
|
-
if (sideOrientation === null) {
|
|
738
|
-
sideOrientation = material.sideOrientation;
|
|
739
|
-
}
|
|
736
|
+
sideOrientation = material._getEffectiveOrientation(renderingMesh);
|
|
740
737
|
if (mainDeterminant < 0) {
|
|
741
738
|
sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;
|
|
742
739
|
}
|