@babylonjs/core 7.38.0 → 7.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Lights/spotLight.d.ts +7 -0
- package/Lights/spotLight.js +27 -0
- package/Lights/spotLight.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Textures/Loaders/exrTextureLoader.d.ts +1 -0
- package/Materials/Textures/Loaders/exrTextureLoader.js +1 -0
- package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/hdrTextureLoader.d.ts +1 -0
- package/Materials/Textures/Loaders/hdrTextureLoader.js +2 -1
- package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/iesTextureLoader.js +1 -1
- package/Materials/Textures/Loaders/iesTextureLoader.js.map +1 -1
- package/Materials/material.js +1 -1
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +2 -1
- package/Materials/materialHelper.functions.js +6 -2
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Physics/v2/characterController.d.ts +327 -0
- package/Physics/v2/characterController.js +1236 -0
- package/Physics/v2/characterController.js.map +1 -0
- package/Physics/v2/index.d.ts +1 -0
- package/Physics/v2/index.js +1 -0
- package/Physics/v2/index.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragment.js +28 -4
- package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragmentDeclaration.js +3 -0
- package/Shaders/ShadersInclude/lightFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/lightUboDeclaration.js +3 -0
- package/Shaders/ShadersInclude/lightUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js +20 -3
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.js +2 -0
- package/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/fogVertex.js +4 -0
- package/ShadersWGSL/ShadersInclude/fogVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +28 -4
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +16 -3
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.js +2 -0
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js +3 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"characterController.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/characterController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIlF,OAAO,EAAE,mBAAmB,EAAqB,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAmBlD;;GAEG;AACH,MAAM,CAAN,IAAkB,uBAIjB;AAJD,WAAkB,uBAAuB;IACrC,mFAAW,CAAA;IACX,2EAAO,CAAA;IACP,+EAAS,CAAA;AACb,CAAC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I,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACpC,IAAI,CAAC,sBAAsB,CAAC,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxI,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import { Vector3, Quaternion, Matrix, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { DeepImmutableObject } from \"../../types\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\r\nimport { PhysicsShapeCapsule, type PhysicsShape } from \"./physicsShape\";\r\nimport { PhysicsMotionType } from \"./IPhysicsEnginePlugin\";\r\nimport type { HavokPlugin } from \"./Plugins/havokPlugin\";\r\nimport { BuildArray } from \"core/Misc/arrayTools\";\r\n\r\n/**\r\n * Shape properties for the character controller\r\n */\r\nexport interface CharacterShapeOptions {\r\n /**\r\n * optional shape used for collision detection\r\n */\r\n shape?: PhysicsShape;\r\n /**\r\n * capsule height for the capsule shape if no shape is provided\r\n */\r\n capsuleHeight?: number;\r\n /**\r\n * capsule radius for the capsule shape if no shape is provided\r\n */\r\n capsuleRadius?: number;\r\n}\r\n/**\r\n * State of the character on the surface\r\n */\r\nexport const enum CharacterSupportedState {\r\n UNSUPPORTED,\r\n SLIDING,\r\n SUPPORTED,\r\n}\r\n\r\n/**\r\n * Surface information computed by checkSupport method\r\n */\r\nexport interface CharacterSurfaceInfo {\r\n /**\r\n * Indicates whether the surface is dynamic.\r\n * A dynamic surface is one that can change its properties over time,\r\n * such as moving platforms or surfaces that can be affected by external forces.\r\n */\r\n isSurfaceDynamic: boolean;\r\n /**\r\n * The supported state of the character on the surface.\r\n */\r\n supportedState: CharacterSupportedState;\r\n /**\r\n * The average normal vector of the surface.\r\n * This vector is perpendicular to the surface and points outwards.\r\n */\r\n averageSurfaceNormal: Vector3;\r\n /**\r\n * The average velocity of the surface.\r\n * This vector represents the speed and direction in which the surface is moving.\r\n */\r\n averageSurfaceVelocity: Vector3;\r\n /**\r\n * The average angular velocity of the surface.\r\n */\r\n averageAngularSurfaceVelocity: Vector3;\r\n}\r\n\r\n/** @internal */\r\ninterface Contact {\r\n /** @internal */\r\n position: Vector3;\r\n /** @internal */\r\n normal: Vector3;\r\n /** @internal */\r\n distance: number;\r\n /** @internal */\r\n fraction: number;\r\n /** @internal */\r\n bodyB: { body: PhysicsBody; index: number };\r\n /** @internal */\r\n allowedPenetration: number;\r\n}\r\n\r\n/** @internal */\r\ninterface SurfaceConstraintInfo {\r\n /** @internal */\r\n planeNormal: Vector3;\r\n /** @internal */\r\n planeDistance: number;\r\n /** @internal */\r\n velocity: Vector3;\r\n /** @internal */\r\n angularVelocity: Vector3;\r\n /** @internal */\r\n staticFriction: number;\r\n /** @internal */\r\n extraUpStaticFriction: number;\r\n /** @internal */\r\n extraDownStaticFriction: number;\r\n /** @internal */\r\n dynamicFriction: number;\r\n /** @internal */\r\n priority: number;\r\n}\r\n\r\n/** @internal */\r\nconst enum SurfaceConstraintInteractionStatus {\r\n OK,\r\n FAILURE_3D,\r\n FAILURE_2D,\r\n}\r\n\r\n/** @internal */\r\ninterface SurfaceConstraintInteraction {\r\n /** @internal */\r\n touched: boolean;\r\n /** @internal */\r\n stopped: boolean;\r\n /** @internal */\r\n surfaceTime: number;\r\n /** @internal */\r\n penaltyDistance: number;\r\n /** @internal */\r\n status: SurfaceConstraintInteractionStatus;\r\n}\r\n\r\n/** @internal */\r\nclass SimplexSolverOutput {\r\n /** @internal */\r\n public position: Vector3;\r\n /** @internal */\r\n public velocity: Vector3;\r\n /** @internal */\r\n public deltaTime: number;\r\n /** @internal */\r\n public planeInteractions: SurfaceConstraintInteraction[];\r\n}\r\n\r\n/** @internal */\r\nclass SimplexSolverActivePlanes {\r\n /** @internal */\r\n public index: number;\r\n /** @internal */\r\n public constraint: SurfaceConstraintInfo;\r\n /** @internal */\r\n public interaction: SurfaceConstraintInteraction;\r\n\r\n /** @internal */\r\n public copyFrom(other: SimplexSolverActivePlanes) {\r\n this.index = other.index;\r\n this.constraint = other.constraint;\r\n this.interaction = other.interaction;\r\n }\r\n}\r\n\r\n/** @internal */\r\nclass SimplexSolverInfo {\r\n /** @internal */\r\n public supportPlanes: Array<SimplexSolverActivePlanes> = new Array<SimplexSolverActivePlanes>(4);\r\n /** @internal */\r\n public numSupportPlanes: number = 0;\r\n /** @internal */\r\n public currentTime: number = 0;\r\n /** @internal */\r\n public inputConstraints: SurfaceConstraintInfo[];\r\n /** @internal */\r\n public outputInteractions: SurfaceConstraintInteraction[];\r\n /** @internal */\r\n public getOutput(constraint: SurfaceConstraintInfo): SurfaceConstraintInteraction {\r\n return this.outputInteractions[this.inputConstraints.indexOf(constraint)]; //<todo.eoin This is O(1) in C++! Equivalent in TS?\r\n }\r\n}\r\n\r\n/** @internal */\r\nfunction contactFromCast(hp: HavokPlugin, cp: any /*ContactPoint*/, castPath: Vector3, hitFraction: number, keepDistance: number): Contact {\r\n //@ts-ignore\r\n const bodyMap = hp._bodies;\r\n\r\n const normal = Vector3.FromArray(cp[4]);\r\n const dist = -hitFraction * castPath.dot(normal);\r\n return {\r\n position: Vector3.FromArray(cp[3]),\r\n normal: normal,\r\n distance: dist,\r\n fraction: hitFraction,\r\n bodyB: bodyMap.get(cp[0][0])!,\r\n allowedPenetration: Math.min(Math.max(keepDistance - dist, 0.0), keepDistance),\r\n };\r\n}\r\n\r\n/**\r\n * Character controller using physics\r\n */\r\nexport class PhysicsCharacterController {\r\n private _position: Vector3;\r\n private _orientation: Quaternion = Quaternion.Identity();\r\n private _velocity: Vector3;\r\n private _lastVelocity: Vector3;\r\n private _shape: PhysicsShape;\r\n private _manifold: Contact[] = [];\r\n private _lastDisplacement: Vector3;\r\n private _contactAngleSensitivity = 10.0;\r\n private _lastInvDeltaTime: number;\r\n private _scene: Scene;\r\n private _tmpMatrix = new Matrix();\r\n private _tmpVecs: Vector3[] = BuildArray(31, Vector3.Zero);\r\n\r\n /**\r\n * minimum distance to make contact\r\n * default 0.05\r\n */\r\n public keepDistance: number = 0.05;\r\n /**\r\n * maximum distance to keep contact\r\n * default 0.1\r\n */\r\n public keepContactTolerance: number = 0.1;\r\n /**\r\n * maximum number of raycast per integration starp\r\n * default 10\r\n */\r\n public maxCastIterations: number = 10;\r\n /**\r\n * speed when recovery from penetration\r\n * default 1.0\r\n */\r\n public penetrationRecoverySpeed = 1.0;\r\n /**\r\n * friction with static surfaces\r\n * default 0\r\n */\r\n public staticFriction = 0;\r\n /**\r\n * friction with dynamic surfaces\r\n * default 1\r\n */\r\n public dynamicFriction = 1;\r\n /**\r\n * cosine value of slop angle that can be climbed\r\n * computed as `Math.cos(Math.PI * (angleInDegree / 180.0));`\r\n * default 0.5 (value for a 60deg angle)\r\n */\r\n public maxSlopeCosine = 0.5;\r\n /**\r\n * character maximum speed\r\n * default 10\r\n */\r\n public maxCharacterSpeedForSolver = 10.0;\r\n /**\r\n * up vector\r\n */\r\n public up = new Vector3(0, 1, 0);\r\n /**\r\n * Strength when pushing other bodies\r\n * default 1e38\r\n */\r\n public characterStrength = 1e38;\r\n /**\r\n * character mass\r\n * default 0\r\n */\r\n public characterMass = 0;\r\n private _startCollector;\r\n private _castCollector;\r\n\r\n /**\r\n * instanciate a new characterController\r\n * @param position Initial position\r\n * @param characterShapeOptions character physics shape options\r\n * @param scene Scene\r\n */\r\n public constructor(position: Vector3, characterShapeOptions: CharacterShapeOptions, scene: Scene) {\r\n this._position = position.clone();\r\n this._velocity = Vector3.Zero();\r\n this._lastVelocity = Vector3.Zero();\r\n const r = characterShapeOptions.capsuleRadius ?? 0.6;\r\n const h = characterShapeOptions.capsuleHeight ?? 1.8;\r\n this._tmpVecs[0].set(0, h * 0.5 - r, 0);\r\n this._tmpVecs[1].set(0, -h * 0.5 + r, 0);\r\n this._shape = characterShapeOptions.shape ?? new PhysicsShapeCapsule(this._tmpVecs[0], this._tmpVecs[1], r, scene);\r\n this._lastInvDeltaTime = 1.0 / 60.0;\r\n this._lastDisplacement = Vector3.Zero();\r\n this._scene = scene;\r\n\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n\r\n this._startCollector = hknp.HP_QueryCollector_Create(16)[1];\r\n this._castCollector = hknp.HP_QueryCollector_Create(16)[1];\r\n }\r\n\r\n /**\r\n * Character position\r\n * @returns Character position\r\n */\r\n public getPosition(): Vector3 {\r\n return this._position;\r\n }\r\n\r\n /**\r\n * Character velocity\r\n * @returns Character velocity vector\r\n */\r\n public getVelocity(): Vector3 {\r\n return this._velocity;\r\n }\r\n\r\n /**\r\n * Set velocity vector\r\n * @param velocity vector\r\n */\r\n public setVelocity(velocity: Vector3) {\r\n this._velocity.copyFrom(velocity);\r\n }\r\n\r\n protected _validateManifold() {\r\n const newManifold = [];\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n if (!this._manifold[i].bodyB.body.isDisposed) {\r\n newManifold.push(this._manifold[i]);\r\n }\r\n }\r\n this._manifold = newManifold;\r\n }\r\n\r\n private _getPointVelocityToRef(body: { body: PhysicsBody; index: number }, pointWorld: Vector3, result: Vector3) {\r\n //<todo does this really not exist in body interface?\r\n const comWorld = this._tmpVecs[10];\r\n this._getComWorldToRef(body, comWorld);\r\n const relPos = this._tmpVecs[11];\r\n pointWorld.subtractToRef(comWorld, relPos);\r\n const av = this._tmpVecs[12];\r\n body.body.getAngularVelocityToRef(av, body.index);\r\n const arm = this._tmpVecs[13];\r\n Vector3.CrossToRef(av, relPos, arm);\r\n arm.addToRef(body.body.getLinearVelocity(body.index), result);\r\n }\r\n\r\n protected _compareContacts(contactA: Contact, contactB: Contact): number {\r\n const angSquared = (1.0 - contactA.normal.dot(contactB.normal)) * this._contactAngleSensitivity * this._contactAngleSensitivity;\r\n const planeDistSquared = (contactA.distance - contactB.distance) * (contactA.distance * contactB.distance);\r\n\r\n const p1Vel = this._tmpVecs[7];\r\n this._getPointVelocityToRef(contactA.bodyB, contactA.position, p1Vel);\r\n const p2Vel = this._tmpVecs[8];\r\n this._getPointVelocityToRef(contactB.bodyB, contactB.position, p2Vel);\r\n const velocityDiff = this._tmpVecs[9];\r\n p1Vel.subtractToRef(p2Vel, velocityDiff);\r\n const velocityDiffSquared = velocityDiff.lengthSquared();\r\n\r\n const fitness = angSquared * 10.0 + velocityDiffSquared * 0.1 + planeDistSquared;\r\n return fitness;\r\n }\r\n\r\n protected _findContact(referenceContact: Contact, contactList: Contact[], threshold: number) {\r\n let bestIdx = -1;\r\n let bestFitness = threshold;\r\n for (let i = 0; i < contactList.length; i++) {\r\n const fitness = this._compareContacts(referenceContact, contactList[i]);\r\n if (fitness < bestFitness) {\r\n bestFitness = fitness;\r\n bestIdx = i;\r\n }\r\n }\r\n return bestIdx;\r\n }\r\n\r\n public _updateManifold(startCollector: any /*HP_CollectorId*/, castCollector: any /*HP_CollectorId*/, castPath: Vector3): number {\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n\r\n const numProximityHits = hknp.HP_QueryCollector_GetNumHits(startCollector)[1];\r\n if (numProximityHits > 0) {\r\n const newContacts = [];\r\n let minDistance = 1e38;\r\n const bodyMap = (<any>hk)._bodies;\r\n for (let i = 0; i < numProximityHits; i++) {\r\n const [distance, , contactWorld] = hknp.HP_QueryCollector_GetShapeProximityResult(startCollector, i)[1];\r\n minDistance = Math.min(minDistance, distance);\r\n newContacts.push({\r\n position: Vector3.FromArray(contactWorld[3]),\r\n normal: Vector3.FromArray(contactWorld[4]),\r\n distance: distance,\r\n fraction: 0,\r\n bodyB: bodyMap.get(contactWorld[0][0])!,\r\n allowedPenetration: Math.min(Math.max(this.keepDistance - distance, 0.0), this.keepDistance),\r\n });\r\n }\r\n\r\n for (let i = this._manifold.length - 1; i >= 0; i--) {\r\n const currentContact = this._manifold[i];\r\n const bestMatch = this._findContact(currentContact, newContacts, 1.1);\r\n if (bestMatch >= 0) {\r\n const newAllowedPenetration = Math.min(Math.max(this.keepDistance - newContacts[bestMatch].distance, 0.0), currentContact.allowedPenetration);\r\n this._manifold[i] = newContacts[bestMatch];\r\n this._manifold[i].allowedPenetration = newAllowedPenetration;\r\n newContacts.splice(bestMatch, 1);\r\n } else {\r\n this._manifold.splice(i, 1);\r\n }\r\n }\r\n\r\n const closestContactIndex = newContacts.findIndex((c) => c.distance == minDistance);\r\n if (closestContactIndex >= 0) {\r\n const bestMatch = this._findContact(newContacts[closestContactIndex], this._manifold, 0.1);\r\n if (bestMatch >= 0) {\r\n const newAllowedPenetration = Math.min(\r\n Math.max(this.keepDistance - newContacts[closestContactIndex].distance, 0.0),\r\n this._manifold[bestMatch].allowedPenetration\r\n );\r\n this._manifold[bestMatch] = newContacts[closestContactIndex];\r\n this._manifold[bestMatch].allowedPenetration = newAllowedPenetration;\r\n } else {\r\n this._manifold.push(newContacts[closestContactIndex]);\r\n }\r\n }\r\n } else {\r\n // No start hits; clear manifold completely\r\n this._manifold.length = 0;\r\n }\r\n\r\n let numHitBodies = 0; //< == CASTCOLLECTOR_HIT_SINGLE_BODY\r\n // Process shape cast results if any\r\n const numCastHits = hknp.HP_QueryCollector_GetNumHits(castCollector)[1];\r\n if (numCastHits > 0) {\r\n let closestHitBody = null;\r\n for (let i = 0; i < numCastHits; i++) {\r\n const [fraction, , hitWorld] = hknp.HP_QueryCollector_GetShapeCastResult(castCollector, i)[1];\r\n if (closestHitBody == null) {\r\n const contact = contactFromCast(hk, hitWorld, castPath, fraction, this.keepDistance);\r\n closestHitBody = hitWorld[0][0];\r\n const bestMatch = this._findContact(contact, this._manifold, 0.1);\r\n if (bestMatch == -1) {\r\n this._manifold.push(contact);\r\n }\r\n\r\n if (contact.bodyB.body.getMotionType(contact.bodyB.index) == PhysicsMotionType.STATIC) {\r\n // The closest body is static, so it cannot move away from CC and we don't need to look any further.\r\n break;\r\n }\r\n } else if (closestHitBody._pluginData && hitWorld[0] != closestHitBody._pluginData.hpBodyId) {\r\n numHitBodies++;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Remove from the manifold contacts that are too similar as the simplex does not handle parallel planes\r\n for (let e1 = this._manifold.length - 1; e1 >= 0; e1--) {\r\n let e2 = e1 - 1;\r\n for (; e2 >= 0; e2--) {\r\n const fitness = this._compareContacts(this._manifold[e1], this._manifold[e2]);\r\n if (fitness < 0.1) break;\r\n }\r\n if (e2 >= 0) {\r\n this._manifold.slice(e1, 1);\r\n }\r\n }\r\n\r\n return numHitBodies;\r\n }\r\n\r\n protected _createSurfaceConstraint(contact: Contact, timeTravelled: number): SurfaceConstraintInfo {\r\n const constraint = {\r\n //let distance = contact.distance - this.keepDistance;\r\n planeNormal: contact.normal.clone(),\r\n planeDistance: contact.distance,\r\n staticFriction: this.staticFriction,\r\n dynamicFriction: this.dynamicFriction,\r\n extraUpStaticFriction: 0,\r\n extraDownStaticFriction: 0,\r\n velocity: Vector3.Zero(),\r\n angularVelocity: Vector3.Zero(),\r\n priority: 0,\r\n };\r\n\r\n const maxSlopeCosEps = 0.1;\r\n const maxSlopeCosine = Math.max(this.maxSlopeCosine, maxSlopeCosEps);\r\n const normalDotUp = contact.normal.dot(this.up);\r\n\r\n const contactPosition = contact.position.clone();\r\n if (normalDotUp > maxSlopeCosine) {\r\n const com = this.getPosition();\r\n const contactArm = this._tmpVecs[20];\r\n contact.position.subtractToRef(com, contactArm);\r\n const scale = contact.normal.dot(contactArm);\r\n contactPosition.x = com.x + this.up.x * scale;\r\n contactPosition.y = com.y + this.up.y * scale;\r\n contactPosition.z = com.z + this.up.z * scale;\r\n }\r\n\r\n const motionType = contact.bodyB.body.getMotionType(contact.bodyB.index);\r\n if (motionType != PhysicsMotionType.STATIC) {\r\n //<todo Need hknpMotionUtil::predictPontVelocity\r\n }\r\n\r\n const shift = constraint.velocity.dot(constraint.planeNormal) * timeTravelled;\r\n constraint.planeDistance -= shift;\r\n\r\n if (motionType == PhysicsMotionType.STATIC) {\r\n constraint.priority = 2;\r\n } else if (motionType == PhysicsMotionType.ANIMATED) {\r\n constraint.priority = 1;\r\n }\r\n\r\n return constraint;\r\n }\r\n\r\n protected _addMaxSlopePlane(maxSlopeCos: number, up: Vector3, index: number, constraints: SurfaceConstraintInfo[], allowedPenetration: number): boolean {\r\n const verticalComponent = constraints[index].planeNormal.dot(up);\r\n if (verticalComponent > 0.01 && verticalComponent < maxSlopeCos) {\r\n const newConstraint = {\r\n planeNormal: constraints[index].planeNormal.clone(),\r\n planeDistance: constraints[index].planeDistance,\r\n velocity: constraints[index].velocity.clone(),\r\n angularVelocity: constraints[index].angularVelocity.clone(),\r\n priority: constraints[index].priority,\r\n dynamicFriction: constraints[index].dynamicFriction,\r\n staticFriction: constraints[index].staticFriction,\r\n extraDownStaticFriction: constraints[index].extraDownStaticFriction,\r\n extraUpStaticFriction: constraints[index].extraUpStaticFriction,\r\n };\r\n const distance = newConstraint.planeDistance;\r\n newConstraint.planeNormal.subtractInPlace(up.scale(verticalComponent));\r\n newConstraint.planeNormal.normalize();\r\n if (distance >= 0) {\r\n newConstraint.planeDistance = distance * newConstraint.planeNormal.dot(constraints[index].planeNormal);\r\n } else {\r\n const penetrationToResolve = Math.min(0, distance + allowedPenetration);\r\n newConstraint.planeDistance = penetrationToResolve / newConstraint.planeNormal.dot(constraints[index].planeNormal);\r\n constraints[index].planeDistance = 0;\r\n this._resolveConstraintPenetration(newConstraint, this.penetrationRecoverySpeed);\r\n }\r\n constraints.push(newConstraint);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n protected _resolveConstraintPenetration(constraint: SurfaceConstraintInfo, penetrationRecoverySpeed: number) {\r\n // If penetrating we add extra velocity to push the character back out\r\n const eps = 1e-6;\r\n if (constraint.planeDistance < -eps) {\r\n constraint.planeNormal.scaleToRef(constraint.planeDistance * penetrationRecoverySpeed, this._tmpVecs[6]);\r\n constraint.velocity.subtractInPlace(this._tmpVecs[6]);\r\n }\r\n }\r\n\r\n protected _createConstraintsFromManifold(dt: number, timeTravelled: number): SurfaceConstraintInfo[] {\r\n const constraints = [];\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n const surfaceConstraint = this._createSurfaceConstraint(this._manifold[i], timeTravelled);\r\n constraints.push(surfaceConstraint);\r\n this._addMaxSlopePlane(this.maxSlopeCosine, this.up, i, constraints, this._manifold[i].allowedPenetration);\r\n this._resolveConstraintPenetration(surfaceConstraint, this.penetrationRecoverySpeed);\r\n }\r\n return constraints;\r\n }\r\n\r\n protected _simplexSolverSortInfo(info: SimplexSolverInfo) {\r\n // simple bubble sort by (priority,velocity)\r\n for (let i = 0; i < info.numSupportPlanes - 1; i++) {\r\n for (let j = i + 1; j < info.numSupportPlanes; j++) {\r\n const p0 = info.supportPlanes[i];\r\n const p1 = info.supportPlanes[j];\r\n if (p0.constraint.priority < p1.constraint.priority) {\r\n continue;\r\n }\r\n if (p0.constraint.priority == p1.constraint.priority) {\r\n const vel0 = p0.constraint.velocity.lengthSquared();\r\n const vel1 = p1.constraint.velocity.lengthSquared();\r\n if (vel0 < vel1) {\r\n continue;\r\n }\r\n }\r\n info.supportPlanes[i] = p1;\r\n info.supportPlanes[j] = p0;\r\n }\r\n }\r\n }\r\n\r\n protected _simplexSolverSolve1d(info: SimplexSolverInfo, sci: SurfaceConstraintInfo, velocityIn: Vector3, velocityOut: Vector3) {\r\n const eps = 1e-5;\r\n const groundVelocity = sci.velocity;\r\n const relativeVelocity = this._tmpVecs[22];\r\n velocityIn.subtractToRef(groundVelocity, relativeVelocity);\r\n\r\n const planeVel = relativeVelocity.dot(sci.planeNormal);\r\n\r\n const origVelocity2 = relativeVelocity.lengthSquared();\r\n relativeVelocity.subtractInPlace(sci.planeNormal.scale(planeVel));\r\n {\r\n const vp2 = planeVel * planeVel;\r\n // static friction is active if\r\n // velProjPlane * friction > |(velParallel)|\r\n // vplane * f > vpar\r\n // vp * f > vpar\r\n // vp2 * f2 > vpar2\r\n const extraStaticFriction = relativeVelocity.dot(this.up) > 0 ? sci.extraUpStaticFriction : sci.extraDownStaticFriction;\r\n if (extraStaticFriction > 0) {\r\n const horizontal = this.up.cross(sci.planeNormal);\r\n const hor2 = horizontal.lengthSquared();\r\n let horVel = 0.0;\r\n if (hor2 > eps) {\r\n horizontal.scaleInPlace(1 / Math.sqrt(hor2));\r\n\r\n horVel = relativeVelocity.dot(horizontal);\r\n\r\n // horizontal component\r\n {\r\n const horVel2 = horVel * horVel;\r\n const f2 = sci.staticFriction * sci.staticFriction;\r\n if (vp2 * f2 >= horVel2) {\r\n relativeVelocity.subtractInPlace(horizontal.scale(horVel));\r\n horVel = 0;\r\n }\r\n }\r\n }\r\n\r\n // vert component\r\n {\r\n const vertVel2 = origVelocity2 - horVel * horVel - vp2;\r\n const f2 = (sci.staticFriction + extraStaticFriction) * (sci.staticFriction + extraStaticFriction);\r\n if (vp2 * f2 >= vertVel2) {\r\n if (horVel == 0.0) {\r\n velocityOut.copyFrom(groundVelocity);\r\n return;\r\n }\r\n }\r\n }\r\n } else {\r\n // static friction is active if\r\n // velProjPlane * friction > |(vel-velProjPlane)|\r\n // vp * f > rvProj\r\n //\r\n // -> vp * f >= rvProj\r\n // -> vp * f >= sqrt( vel^2 - vp^2 )\r\n // -> vp^2 ( f^2 + 1 ) >= vel^2\r\n const f2 = sci.staticFriction * sci.staticFriction;\r\n if (vp2 * (1 + f2) >= origVelocity2) {\r\n velocityOut.copyFrom(groundVelocity);\r\n return;\r\n }\r\n }\r\n }\r\n\r\n if (sci.dynamicFriction < 1) {\r\n // apply dynamic friction 0 = conserve input velocity 1 = clip against normal\r\n const velOut2 = relativeVelocity.lengthSquared();\r\n if (velOut2 >= eps) {\r\n if (velOut2 > 1e-4 * origVelocity2) {\r\n let f = Math.sqrt(origVelocity2 / velOut2);\r\n f = sci.dynamicFriction + (1 - sci.dynamicFriction) * f;\r\n relativeVelocity.scaleInPlace(f);\r\n const p = sci.planeNormal.dot(relativeVelocity);\r\n relativeVelocity.subtractInPlace(sci.planeNormal.scale(p));\r\n }\r\n }\r\n }\r\n velocityOut.copyFrom(relativeVelocity);\r\n velocityOut.addInPlace(groundVelocity);\r\n }\r\n\r\n protected _simplexSolverSolveTest1d(sci: SurfaceConstraintInfo, velocityIn: Vector3): boolean {\r\n const eps = 1e-3;\r\n const relativeVelocity = this._tmpVecs[23];\r\n velocityIn.subtractToRef(sci.velocity, relativeVelocity);\r\n return relativeVelocity.dot(sci.planeNormal) < -eps;\r\n }\r\n\r\n protected _simplexSolverSolve2d(\r\n info: SimplexSolverInfo,\r\n maxSurfaceVelocity: Vector3,\r\n sci0: SurfaceConstraintInfo,\r\n sci1: SurfaceConstraintInfo,\r\n velocityIn: Vector3,\r\n velocityOut: Vector3\r\n ) {\r\n const eps = 1e-5;\r\n const axis = sci0.planeNormal.cross(sci1.planeNormal);\r\n const axisLen2 = axis.lengthSquared();\r\n\r\n let solveSequentially = false;\r\n let axisVel = null;\r\n\r\n // eslint-disable-next-line no-constant-condition\r\n while (true) {\r\n // Check for parallel planes\r\n if (axisLen2 <= eps || solveSequentially) {\r\n info.getOutput(sci0).status = SurfaceConstraintInteractionStatus.FAILURE_2D;\r\n info.getOutput(sci1).status = SurfaceConstraintInteractionStatus.FAILURE_2D;\r\n\r\n if (sci0.priority > sci1.priority) {\r\n this._simplexSolverSolve1d(info, sci1, velocityIn, velocityOut);\r\n this._simplexSolverSolve1d(info, sci0, velocityIn, velocityOut);\r\n } else {\r\n this._simplexSolverSolve1d(info, sci0, velocityIn, velocityOut);\r\n this._simplexSolverSolve1d(info, sci1, velocityIn, velocityOut);\r\n }\r\n return;\r\n }\r\n\r\n const invAxisLen = 1.0 / Math.sqrt(axisLen2);\r\n axis.scaleInPlace(invAxisLen);\r\n\r\n // Calculate the velocity of the free axis\r\n {\r\n const r0 = sci0.planeNormal.cross(sci1.planeNormal);\r\n const r1 = sci1.planeNormal.cross(axis);\r\n const r2 = axis.cross(sci0.planeNormal);\r\n\r\n const sVel = sci0.velocity.add(sci1.velocity);\r\n\r\n const t = this._tmpVecs[2];\r\n t.set(0.5 * axis.dot(sVel), sci0.planeNormal.dot(sci0.velocity), sci1.planeNormal.dot(sci1.velocity));\r\n const m = Matrix.FromValues(r0.x, r1.x, r2.x, 0, r0.y, r1.y, r2.y, 0, r0.z, r1.z, r2.z, 0, 0, 0, 0, 1);\r\n axisVel = Vector3.TransformNormal(t, m);\r\n axisVel.scaleInPlace(invAxisLen);\r\n\r\n if (Math.abs(axisVel.x) > maxSurfaceVelocity.x || Math.abs(axisVel.y) > maxSurfaceVelocity.y || Math.abs(axisVel.z) > maxSurfaceVelocity.z) {\r\n solveSequentially = true;\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const groundVelocity = axisVel;\r\n const relativeVelocity = this._tmpVecs[24];\r\n velocityIn.subtractToRef(groundVelocity, relativeVelocity);\r\n\r\n const vel2 = relativeVelocity.lengthSquared();\r\n const axisVert = this.up.dot(axis);\r\n let axisProjVelocity = relativeVelocity.dot(axis);\r\n\r\n let staticFriction = sci0.staticFriction + sci1.staticFriction;\r\n if (axisVert * axisProjVelocity > 0) {\r\n staticFriction += (sci0.extraUpStaticFriction + sci1.extraUpStaticFriction) * axisVert;\r\n } else {\r\n staticFriction += (sci0.extraDownStaticFriction + sci1.extraDownStaticFriction) * axisVert;\r\n }\r\n staticFriction *= 0.5;\r\n\r\n const dynamicFriction = (sci0.dynamicFriction + sci1.dynamicFriction) * 0.5;\r\n // static friction is active if\r\n // |vel-axisProjVelocity|(rv) * friction(f) > axisProjVelocity(av)\r\n // -> sqrt( vel2 - av2 ) * f > av\r\n // -> (vel2 - av2) * f2 > av2\r\n const f2 = staticFriction * staticFriction;\r\n const av2 = axisProjVelocity * axisProjVelocity;\r\n if ((vel2 - av2) * f2 >= av2) {\r\n // static friction kicks in\r\n velocityOut.copyFrom(groundVelocity);\r\n return;\r\n }\r\n\r\n if (dynamicFriction < 1) {\r\n // apply dynamic friction\r\n if (axisProjVelocity * axisProjVelocity > 1e-4 * vel2) {\r\n const tmp = 1.0 / axisProjVelocity;\r\n const f = Math.abs(tmp) * Math.sqrt(vel2) * (1.0 - dynamicFriction) + dynamicFriction;\r\n axisProjVelocity *= f;\r\n }\r\n }\r\n velocityOut.copyFrom(groundVelocity);\r\n velocityOut.addInPlace(axis.scale(axisProjVelocity));\r\n }\r\n\r\n protected _simplexSolverSolve3d(\r\n info: SimplexSolverInfo,\r\n maxSurfaceVelocity: Vector3,\r\n sci0: SurfaceConstraintInfo,\r\n sci1: SurfaceConstraintInfo,\r\n sci2: SurfaceConstraintInfo,\r\n allowResort: boolean,\r\n velocityIn: Vector3,\r\n velocityOut: Vector3\r\n ) {\r\n const eps = 1e-5;\r\n // Calculate the velocity of the point axis\r\n let pointVel = null;\r\n {\r\n const r0 = sci1.planeNormal.cross(sci2.planeNormal);\r\n const r1 = sci2.planeNormal.cross(sci0.planeNormal);\r\n const r2 = sci0.planeNormal.cross(sci1.planeNormal);\r\n\r\n const det = r0.dot(sci0.planeNormal);\r\n let solveSequentially = false;\r\n // eslint-disable-next-line no-constant-condition\r\n while (true) {\r\n if (Math.abs(det) < eps || solveSequentially) {\r\n if (allowResort) {\r\n this._simplexSolverSortInfo(info);\r\n sci0 = info.supportPlanes[0].constraint;\r\n sci1 = info.supportPlanes[1].constraint;\r\n sci2 = info.supportPlanes[2].constraint;\r\n }\r\n info.getOutput(sci0).status = SurfaceConstraintInteractionStatus.FAILURE_3D;\r\n info.getOutput(sci1).status = SurfaceConstraintInteractionStatus.FAILURE_3D;\r\n info.getOutput(sci2).status = SurfaceConstraintInteractionStatus.FAILURE_3D;\r\n\r\n const oldNum = info.numSupportPlanes;\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, sci0, sci1, velocityIn, velocityOut);\r\n if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, sci0, sci2, velocityIn, velocityOut);\r\n }\r\n if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, sci1, sci2, velocityIn, velocityOut);\r\n }\r\n\r\n return;\r\n }\r\n\r\n const t = this._tmpVecs[2];\r\n t.set(sci0.planeNormal.dot(sci0.velocity), sci1.planeNormal.dot(sci1.velocity), sci2.planeNormal.dot(sci2.velocity));\r\n const m = Matrix.FromValues(r0.x, r0.y, r0.z, 0, r1.x, r1.y, r1.z, 0, r2.x, r2.y, r2.z, 0, 0, 0, 0, 1);\r\n pointVel = Vector3.TransformNormal(t, m);\r\n pointVel.scaleInPlace(1 / det);\r\n if (Math.abs(pointVel.x) > maxSurfaceVelocity.x || Math.abs(pointVel.y) > maxSurfaceVelocity.y || Math.abs(pointVel.z) > maxSurfaceVelocity.z) {\r\n solveSequentially = true;\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n velocityOut.copyFrom(pointVel);\r\n }\r\n\r\n protected _simplexSolverExamineActivePlanes(info: SimplexSolverInfo, maxSurfaceVelocity: Vector3, velocityIn: Vector3, velocityOut: Vector3) {\r\n // eslint-disable-next-line no-constant-condition\r\n while (true) {\r\n switch (info.numSupportPlanes) {\r\n case 1: {\r\n const sci = info.supportPlanes[0].constraint;\r\n this._simplexSolverSolve1d(info, sci, velocityIn, velocityOut);\r\n return;\r\n }\r\n case 2: {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve1d(info, info.supportPlanes[1].constraint, velocityIn, velocity);\r\n const plane0Used = this._simplexSolverSolveTest1d(info.supportPlanes[0].constraint, velocity);\r\n if (!plane0Used) {\r\n // Only need plane 1, so remove plane 0\r\n info.supportPlanes[0].copyFrom(info.supportPlanes[1]);\r\n info.numSupportPlanes = 1;\r\n velocityOut.copyFrom(velocity);\r\n } else {\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, info.supportPlanes[0].constraint, info.supportPlanes[1].constraint, velocityIn, velocityOut);\r\n }\r\n return;\r\n }\r\n case 3: {\r\n // Try to drop both planes\r\n {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve1d(info, info.supportPlanes[2].constraint, velocityIn, velocityOut);\r\n\r\n const plane0Used = this._simplexSolverSolveTest1d(info.supportPlanes[0].constraint, velocity);\r\n if (!plane0Used) {\r\n const plane1Used = this._simplexSolverSolveTest1d(info.supportPlanes[1].constraint, velocity);\r\n if (!plane1Used) {\r\n velocityOut.copyFrom(velocity);\r\n info.supportPlanes[0].copyFrom(info.supportPlanes[2]);\r\n info.numSupportPlanes = 1;\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n // Try to drop plane 0 or 1\r\n {\r\n let droppedAPlane = false;\r\n for (let testPlane = 0; testPlane < 2; testPlane++) {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve2d(\r\n info,\r\n maxSurfaceVelocity,\r\n info.supportPlanes[testPlane].constraint,\r\n info.supportPlanes[2].constraint,\r\n velocityIn,\r\n velocityOut\r\n );\r\n const planeUsed = this._simplexSolverSolveTest1d(info.supportPlanes[1 - testPlane].constraint, velocity);\r\n if (!planeUsed) {\r\n info.supportPlanes[0].copyFrom(info.supportPlanes[testPlane]);\r\n info.supportPlanes[1].copyFrom(info.supportPlanes[2]);\r\n info.numSupportPlanes--;\r\n droppedAPlane = true;\r\n break;\r\n }\r\n }\r\n\r\n if (droppedAPlane) {\r\n continue;\r\n }\r\n }\r\n\r\n // Otherwise, try and solve all three planes:\r\n this._simplexSolverSolve3d(\r\n info,\r\n maxSurfaceVelocity,\r\n info.supportPlanes[0].constraint,\r\n info.supportPlanes[1].constraint,\r\n info.supportPlanes[2].constraint,\r\n true,\r\n velocityIn,\r\n velocityOut\r\n );\r\n return;\r\n }\r\n case 4: {\r\n this._simplexSolverSortInfo(info);\r\n let droppedAPlane = false;\r\n\r\n for (let i = 0; i < 3; i++) {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve3d(\r\n info,\r\n maxSurfaceVelocity,\r\n info.supportPlanes[(i + 1) % 3].constraint,\r\n info.supportPlanes[(i + 2) % 3].constraint,\r\n info.supportPlanes[3].constraint,\r\n false,\r\n velocityIn,\r\n velocity\r\n );\r\n const planeUsed = this._simplexSolverSolveTest1d(info.supportPlanes[i].constraint, velocity);\r\n if (!planeUsed) {\r\n info.supportPlanes[i].copyFrom(info.supportPlanes[2]);\r\n info.supportPlanes[2].copyFrom(info.supportPlanes[3]);\r\n info.numSupportPlanes = 3;\r\n droppedAPlane = true;\r\n break;\r\n }\r\n }\r\n\r\n if (droppedAPlane) {\r\n continue;\r\n }\r\n\r\n // Nothing can be dropped so we've failed to solve\r\n // Now we try all 3d combinations\r\n {\r\n const velocity = velocityIn.clone();\r\n const sci0 = info.supportPlanes[0].constraint;\r\n const sci1 = info.supportPlanes[1].constraint;\r\n const sci2 = info.supportPlanes[2].constraint;\r\n const sci3 = info.supportPlanes[3].constraint;\r\n const oldNum = info.numSupportPlanes;\r\n if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci0, sci1, sci2, false, velocity, velocity);\r\n // eslint-disable-next-line no-dupe-else-if\r\n } else if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci0, sci1, sci3, false, velocity, velocity);\r\n // eslint-disable-next-line no-dupe-else-if\r\n } else if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci0, sci2, sci3, false, velocity, velocity);\r\n // eslint-disable-next-line no-dupe-else-if\r\n } else if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci1, sci2, sci3, false, velocity, velocity);\r\n }\r\n\r\n velocityOut.copyFrom(velocity);\r\n }\r\n\r\n // Search a plane to drop\r\n {\r\n // Search the highest penalty value\r\n let maxStatus = SurfaceConstraintInteractionStatus.OK;\r\n for (let i = 0; i < 4; i++) {\r\n maxStatus = Math.max(maxStatus, info.supportPlanes[i].interaction.status);\r\n }\r\n\r\n // Remove the place with the lowest priority and the highest penalty\r\n let i = 0;\r\n for (; i < 4; i++) {\r\n if (maxStatus == info.supportPlanes[i].interaction.status) {\r\n info.supportPlanes[i].copyFrom(info.supportPlanes[3]);\r\n break;\r\n }\r\n info.numSupportPlanes--;\r\n }\r\n }\r\n\r\n // Clear penalty flags for the other planes\r\n for (let i = 0; i < 3; i++) {\r\n info.supportPlanes[i].interaction.status = SurfaceConstraintInteractionStatus.OK;\r\n }\r\n\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n\r\n public _simplexSolverSolve(\r\n constraints: SurfaceConstraintInfo[],\r\n velocity: Vector3,\r\n deltaTime: number,\r\n minDeltaTime: number,\r\n up: Vector3,\r\n maxSurfaceVelocity: Vector3\r\n ): SimplexSolverOutput {\r\n const eps = 1e-6;\r\n const output = new SimplexSolverOutput();\r\n output.position = Vector3.Zero();\r\n output.velocity = velocity.clone();\r\n output.planeInteractions = [];\r\n let remainingTime = deltaTime;\r\n\r\n for (let i = 0; i < constraints.length; i++) {\r\n output.planeInteractions.push({\r\n touched: false,\r\n stopped: false,\r\n surfaceTime: 0,\r\n penaltyDistance: 0,\r\n status: SurfaceConstraintInteractionStatus.OK,\r\n });\r\n }\r\n\r\n const info = new SimplexSolverInfo();\r\n info.inputConstraints = constraints;\r\n info.outputInteractions = output.planeInteractions;\r\n info.supportPlanes[0] = new SimplexSolverActivePlanes();\r\n info.supportPlanes[1] = new SimplexSolverActivePlanes();\r\n info.supportPlanes[2] = new SimplexSolverActivePlanes();\r\n info.supportPlanes[3] = new SimplexSolverActivePlanes();\r\n\r\n while (remainingTime > 0) {\r\n // search for a plane which collides our current direction\r\n let hitIndex = -1;\r\n let minCollisionTime = remainingTime;\r\n for (let i = 0; i < constraints.length; i++) {\r\n // Do not search existing active planes\r\n if (info.numSupportPlanes >= 1 && info.supportPlanes[0].index == i) continue;\r\n if (info.numSupportPlanes >= 2 && info.supportPlanes[1].index == i) continue;\r\n if (info.numSupportPlanes >= 3 && info.supportPlanes[2].index == i) continue;\r\n if (output.planeInteractions[i].status != SurfaceConstraintInteractionStatus.OK) {\r\n continue;\r\n }\r\n\r\n // Try to find the plane with the shortest time to move\r\n const sci = constraints[i];\r\n const relativeVel = this._tmpVecs[25];\r\n output.velocity.subtractToRef(sci.velocity, relativeVel);\r\n const relativeProjectedVel = -relativeVel.dot(sci.planeNormal);\r\n // if projected velocity is pointing away skip it\r\n if (relativeProjectedVel <= 0) {\r\n continue;\r\n }\r\n\r\n // Calculate the time of impact\r\n const relativePos = this._tmpVecs[26];\r\n sci.velocity.scaleToRef(info.currentTime, this._tmpVecs[27]);\r\n output.position.subtractToRef(this._tmpVecs[27], relativePos);\r\n let projectedPos = sci.planeNormal.dot(relativePos);\r\n\r\n // treat penetrations\r\n const penaltyDist = output.planeInteractions[i].penaltyDistance;\r\n if (penaltyDist < eps) {\r\n projectedPos = 0;\r\n }\r\n projectedPos += penaltyDist;\r\n\r\n // check for new hit\r\n if (projectedPos < minCollisionTime * relativeProjectedVel) {\r\n minCollisionTime = projectedPos / relativeProjectedVel;\r\n hitIndex = i;\r\n }\r\n }\r\n\r\n // integrate: Walk to our hitPosition we must walk more than 10 microseconds into the future to consider it valid.\r\n const minAcceptableCollisionTime = 1e-4;\r\n if (minCollisionTime > minAcceptableCollisionTime) {\r\n info.currentTime += minCollisionTime;\r\n remainingTime -= minCollisionTime;\r\n output.position.addInPlace(output.velocity.scale(minCollisionTime));\r\n for (let i = 0; i < info.numSupportPlanes; i++) {\r\n info.supportPlanes[i].interaction.surfaceTime += minCollisionTime;\r\n info.supportPlanes[i].interaction.touched = true;\r\n }\r\n\r\n output.deltaTime = info.currentTime;\r\n if (info.currentTime > minDeltaTime) {\r\n return output;\r\n }\r\n }\r\n\r\n // If we have no hit than we are done\r\n if (hitIndex < 0) {\r\n output.deltaTime = deltaTime;\r\n break;\r\n }\r\n\r\n // Add our hit to our current list of active planes\r\n const supportPlane = info.supportPlanes[info.numSupportPlanes++];\r\n supportPlane.constraint = constraints[hitIndex];\r\n supportPlane.interaction = output.planeInteractions[hitIndex];\r\n supportPlane.interaction.penaltyDistance = (supportPlane.interaction.penaltyDistance + eps) * 2.0;\r\n supportPlane.index = hitIndex;\r\n\r\n // Move our character along the current set of active planes\r\n this._simplexSolverExamineActivePlanes(info, maxSurfaceVelocity, velocity, output.velocity);\r\n }\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Compute a CharacterSurfaceInfo from current state and a direction\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param direction direction to check, usually gravity direction\r\n * @returns a CharacterSurfaceInfo object\r\n */\r\n public checkSupport(deltaTime: number, direction: Vector3): CharacterSurfaceInfo {\r\n const surfaceInfo = {\r\n isSurfaceDynamic: false,\r\n supportedState: CharacterSupportedState.UNSUPPORTED,\r\n averageSurfaceNormal: Vector3.Zero(),\r\n averageSurfaceVelocity: Vector3.Zero(),\r\n averageAngularSurfaceVelocity: Vector3.Zero(),\r\n };\r\n this.checkSupportToRef(deltaTime, direction, surfaceInfo);\r\n return surfaceInfo;\r\n }\r\n\r\n /**\r\n * Compute a CharacterSurfaceInfo from current state and a direction\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param direction direction to check, usually gravity direction\r\n * @param surfaceInfo output for surface info\r\n */\r\n public checkSupportToRef(deltaTime: number, direction: Vector3, surfaceInfo: CharacterSurfaceInfo): void {\r\n const eps = 1e-4;\r\n\r\n this._validateManifold();\r\n const constraints = this._createConstraintsFromManifold(deltaTime, 0.0);\r\n const storedVelocities: Vector3[] = [];\r\n // Remove velocities and friction to make this a query of the static geometry\r\n for (let i = 0; i < constraints.length; i++) {\r\n storedVelocities.push(constraints[i].velocity.clone());\r\n constraints[i].velocity.setAll(0);\r\n }\r\n\r\n const maxSurfaceVelocity = this._tmpVecs[3];\r\n maxSurfaceVelocity.set(this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver);\r\n const output = this._simplexSolverSolve(constraints, direction, deltaTime, deltaTime, this.up, maxSurfaceVelocity);\r\n\r\n surfaceInfo.averageSurfaceVelocity.setAll(0);\r\n surfaceInfo.averageAngularSurfaceVelocity.setAll(0);\r\n surfaceInfo.averageSurfaceNormal.setAll(0);\r\n\r\n // If the constraints did not affect the character movement then it is unsupported and we can finish\r\n if (output.velocity.equalsWithEpsilon(direction, eps)) {\r\n surfaceInfo.supportedState = CharacterSupportedState.UNSUPPORTED;\r\n return;\r\n }\r\n\r\n // Check how was the input velocity modified to determine if the character is supported or sliding\r\n if (output.velocity.lengthSquared() < eps) {\r\n surfaceInfo.supportedState = CharacterSupportedState.SUPPORTED;\r\n } else {\r\n output.velocity.normalize();\r\n const angleSin = output.velocity.dot(direction);\r\n const cosSqr = 1 - angleSin * angleSin;\r\n if (cosSqr < this.maxSlopeCosine * this.maxSlopeCosine) {\r\n surfaceInfo.supportedState = CharacterSupportedState.SLIDING;\r\n } else {\r\n surfaceInfo.supportedState = CharacterSupportedState.SUPPORTED;\r\n }\r\n }\r\n\r\n // Add all supporting constraints to the ground information\r\n let numTouching = 0;\r\n for (let i = -0; i < constraints.length; i++) {\r\n if (output.planeInteractions[i].touched && constraints[i].planeNormal.dot(direction) < -0.08) {\r\n surfaceInfo.averageSurfaceNormal.addInPlace(constraints[i].planeNormal);\r\n surfaceInfo.averageSurfaceVelocity.addInPlace(storedVelocities[i]);\r\n surfaceInfo.averageAngularSurfaceVelocity.addInPlace(constraints[i].angularVelocity);\r\n numTouching++;\r\n }\r\n }\r\n\r\n if (numTouching > 0) {\r\n surfaceInfo.averageSurfaceNormal.normalize();\r\n surfaceInfo.averageSurfaceVelocity.scaleInPlace(1 / numTouching);\r\n surfaceInfo.averageAngularSurfaceVelocity.scaleInPlace(1 / numTouching);\r\n }\r\n }\r\n\r\n protected _castWithCollectors(startPos: Vector3, endPos: Vector3, castCollector: any /*HP_CollectorId*/, startCollector?: any /*HP_CollectorId*/) {\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n\r\n const startNative = [startPos.x, startPos.y, startPos.z];\r\n const orientation = [this._orientation.x, this._orientation.y, this._orientation.z, this._orientation.w];\r\n if (startCollector != null) {\r\n const query /*: ShapeProximityInput*/ = [\r\n this._shape._pluginData,\r\n //@ts-ignore\r\n startNative,\r\n //@ts-ignore\r\n orientation,\r\n this.keepDistance + this.keepContactTolerance, // max distance\r\n false, // should hit triggers\r\n [BigInt(0)], // body to ignore //<todo allow for a proxy body!\r\n ];\r\n hknp.HP_World_ShapeProximityWithCollector(hk.world, startCollector, query);\r\n }\r\n\r\n {\r\n const query /*: ShapeCastInput*/ = [\r\n this._shape._pluginData,\r\n //@ts-ignore\r\n orientation,\r\n //@ts-ignore\r\n startNative,\r\n [endPos.x, endPos.y, endPos.z],\r\n false, // should hit triggers\r\n [BigInt(0)], // body to ignore //<todo allow for proxy body\r\n ];\r\n hknp.HP_World_ShapeCastWithCollector(hk.world, castCollector, query);\r\n }\r\n }\r\n\r\n protected _resolveContacts(deltaTime: number, gravity: Vector3) {\r\n const eps = 1e-12;\r\n //<todo object interactions out\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n const contact = this._manifold[i];\r\n const bodyB = this._manifold[i].bodyB;\r\n\r\n //<todo test if bodyB is another character with a proxy body\r\n\r\n // Skip fixed or keyframed bodies as we won't apply impulses to them\r\n if (bodyB.body.getMotionType(bodyB.index) != PhysicsMotionType.DYNAMIC) {\r\n continue;\r\n }\r\n\r\n // Calculate and apply impulse on contacted body\r\n {\r\n //<todo input/output for callbacks\r\n let inputObjectMassInv = 0;\r\n let inputObjectImpulse = 0;\r\n let outputObjectImpulse = Vector3.Zero();\r\n const outputImpulsePosition = contact.position;\r\n\r\n // Calculate relative normal velocity of the contact point in the contacted body\r\n const pointRelVel = this._tmpVecs[19];\r\n this._getPointVelocityToRef(bodyB, contact.position, pointRelVel);\r\n pointRelVel.subtractInPlace(this._velocity);\r\n const inputProjectedVelocity = pointRelVel.dot(contact.normal);\r\n const dampFactor = 0.9;\r\n\r\n // Change velocity\r\n let deltaVelocity = -inputProjectedVelocity * dampFactor;\r\n\r\n // Apply an extra impulse if the collision is actually penetrating\r\n if (contact.distance < 0) {\r\n const recoveryTau = 0.4;\r\n deltaVelocity += (contact.distance * recoveryTau) / deltaTime;\r\n }\r\n\r\n // Apply impulse if required to keep bodies apart\r\n if (deltaVelocity < 0) {\r\n // Calculate the impulse magnitude\r\n const invInertia = this._getInverseInertiaWorld(bodyB);\r\n const comWorld = this._tmpVecs[15];\r\n this._getComWorldToRef(bodyB, comWorld);\r\n const r = this._tmpVecs[16];\r\n contact.position.subtractToRef(comWorld, r);\r\n const jacAng = this._tmpVecs[17];\r\n Vector3.CrossToRef(r, contact.normal, jacAng);\r\n const rc = this._tmpVecs[18];\r\n Vector3.TransformNormalToRef(jacAng, invInertia, rc);\r\n inputObjectMassInv = rc.dot(jacAng) + this._getInvMass(bodyB);\r\n inputObjectImpulse = deltaVelocity / inputObjectMassInv;\r\n\r\n // Clamp impulse magnitude if required and apply it to the normal direction\r\n const maxPushImpulse = -this.characterStrength * deltaTime;\r\n if (inputObjectImpulse < maxPushImpulse) {\r\n inputObjectImpulse = maxPushImpulse;\r\n }\r\n outputObjectImpulse = contact.normal.scale(inputObjectImpulse);\r\n } else {\r\n inputObjectImpulse = 0;\r\n inputObjectMassInv = this._getInvMass(bodyB);\r\n }\r\n\r\n // Add gravity\r\n {\r\n // Calculate effect of gravity on the velocity of the character in the contact normal direction\r\n let relVelN = contact.normal.dot(gravity.scale(deltaTime));\r\n // If it is a separating contact subtract the separation velocity\r\n if (inputProjectedVelocity < 0) {\r\n relVelN -= inputProjectedVelocity;\r\n }\r\n // If the resulting velocity is negative an impulse is applied to stop the character from falling into\r\n // the contacted body\r\n if (relVelN < -eps) {\r\n outputObjectImpulse.addInPlace(contact.normal.scale(this.characterMass * relVelN));\r\n }\r\n }\r\n\r\n //<todo Fire callback to allow user to change impulse + use the info / play sounds\r\n\r\n bodyB.body.applyImpulse(outputObjectImpulse, outputImpulsePosition, bodyB.index);\r\n }\r\n }\r\n }\r\n\r\n protected _getInverseInertiaWorld(body: { body: PhysicsBody; index: number }): DeepImmutableObject<Matrix> {\r\n const mp = body.body.getMassProperties(body.index);\r\n if (!mp.inertia || !mp.inertiaOrientation) {\r\n return Matrix.IdentityReadOnly;\r\n }\r\n const invOrientation = Matrix.FromQuaternionToRef(mp.inertiaOrientation, TmpVectors.Matrix[0]).invert();\r\n const it = TmpVectors.Matrix[1];\r\n\r\n const ir = invOrientation.getRowToRef(0, TmpVectors.Vector4[0]);\r\n it.setRowFromFloats(0, mp.inertia.x * ir.x, mp.inertia.x * ir.y, mp.inertia.x * ir.z, 0);\r\n invOrientation.getRowToRef(1, ir);\r\n it.setRowFromFloats(0, mp.inertia.y * ir.x, mp.inertia.y * ir.y, mp.inertia.y * ir.z, 0);\r\n invOrientation.getRowToRef(2, ir);\r\n it.setRowFromFloats(0, mp.inertia.z * ir.x, mp.inertia.z * ir.y, mp.inertia.z * ir.z, 0);\r\n invOrientation.multiplyToRef(it, this._tmpMatrix);\r\n return this._tmpMatrix;\r\n }\r\n\r\n protected _getComWorldToRef(body: { body: PhysicsBody; index: number }, result: Vector3) {\r\n const mp = body.body.getMassProperties(body.index);\r\n Vector3.TransformCoordinatesToRef(mp.centerOfMass!, body.body.transformNode.getWorldMatrix(), result);\r\n }\r\n\r\n protected _getInvMass(body: { body: PhysicsBody; index: number }): number {\r\n return 1 / body.body.getMassProperties(body.index).mass!;\r\n }\r\n\r\n /**\r\n * Update internal state. Must be called once per frame\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param surfaceInfo surface information returned by checkSupport\r\n * @param gravity gravity applied to the character. Can be different that world gravity\r\n */\r\n public integrate(deltaTime: number, surfaceInfo: CharacterSurfaceInfo, gravity: Vector3) {\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n\r\n const invDeltaTime = 1 / deltaTime;\r\n let remainingTime = deltaTime;\r\n let newVelocity = Vector3.Zero();\r\n\r\n // If the difference between the cast displacement and the simplex solver output position is less than this\r\n // value (per component), do not do a second cast to check if it's possible to reach the output position.\r\n const displacementEps = 1e-4;\r\n const epsSqrd = 1e-8;\r\n\r\n // Choose the first cast direction. If velocity hasn't changed from the previous integrate, guess that the\r\n // displacement will be the same as last integrate, scaled by relative step length. Otherwise, guess based\r\n // on current velocity.\r\n {\r\n const tolerance = displacementEps * invDeltaTime;\r\n if (this._velocity.equalsWithEpsilon(this._lastVelocity, tolerance)) {\r\n this._lastDisplacement.scaleInPlace(remainingTime * this._lastInvDeltaTime);\r\n } else {\r\n const displacementVelocity = this._velocity;\r\n if (surfaceInfo.supportedState == CharacterSupportedState.SUPPORTED) {\r\n const relativeVelocity = this._tmpVecs[28];\r\n this._velocity.subtractToRef(surfaceInfo.averageSurfaceVelocity, relativeVelocity);\r\n const normalDotVelocity = surfaceInfo.averageSurfaceNormal.dot(relativeVelocity);\r\n if (normalDotVelocity < 0) {\r\n relativeVelocity.subtractInPlace(surfaceInfo.averageSurfaceNormal.scale(normalDotVelocity));\r\n displacementVelocity.copyFrom(relativeVelocity);\r\n displacementVelocity.addInPlace(surfaceInfo.averageSurfaceVelocity);\r\n }\r\n }\r\n this._lastDisplacement.copyFrom(displacementVelocity);\r\n this._lastDisplacement.scaleInPlace(remainingTime);\r\n }\r\n this._lastVelocity.copyFrom(this._velocity);\r\n this._lastInvDeltaTime = invDeltaTime;\r\n }\r\n\r\n // Make sure that contact with bodies that have been removed since the call to checkSupport() are removed from the\r\n // manifold\r\n this._validateManifold();\r\n\r\n for (let iter = 0; iter < this.maxCastIterations && remainingTime > 1e-5; iter++) {\r\n this._castWithCollectors(this._position, this._position.add(this._lastDisplacement), this._castCollector, this._startCollector);\r\n const updateResult = this._updateManifold(this._startCollector, this._castCollector, this._lastDisplacement);\r\n\r\n // Create surface constraints from the manifold contacts.\r\n const constraints = this._createConstraintsFromManifold(deltaTime, deltaTime - remainingTime);\r\n const maxSurfaceVelocity = this._tmpVecs[3];\r\n maxSurfaceVelocity.set(this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver);\r\n const minDeltaTime = this._velocity.lengthSquared() == 0 ? 0.0 : (0.5 * this.keepDistance) / this._velocity.length();\r\n const solveResults = this._simplexSolverSolve(constraints, this._velocity, remainingTime, minDeltaTime, this.up, maxSurfaceVelocity);\r\n const newDisplacement = solveResults.position;\r\n const solverDeltaTime = solveResults.deltaTime;\r\n newVelocity = solveResults.velocity;\r\n\r\n this._resolveContacts(deltaTime, gravity);\r\n\r\n let newContactIndex = -1;\r\n // todo if (updateResult == hit multiple bodies) ... cast again\r\n\r\n // If castCollector had hits on different bodies (so we're not sure if some non-closest body could be in our way) OR\r\n // the simplex has given an output direction different from the cast guess\r\n // we re-cast to check we can move there. There is no need to get the start points again.\r\n if (updateResult != 0 || (newDisplacement.lengthSquared() > epsSqrd && !this._lastDisplacement.equalsWithEpsilon(newDisplacement, displacementEps))) {\r\n this._castWithCollectors(this._position, this._position.add(newDisplacement), this._castCollector, this._startCollector);\r\n const hknp = hk._hknp;\r\n const numCastHits = hknp.HP_QueryCollector_GetNumHits(this._castCollector)[1];\r\n // Find the first contact that isn't already in the manifold\r\n if (numCastHits > 0) {\r\n //<todo sortHits()\r\n for (let i = 0; i < numCastHits; i++) {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const [fraction, _hitLocal, hitWorld] = hknp.HP_QueryCollector_GetShapeCastResult(this._castCollector, i)[1];\r\n const newContact = contactFromCast(hk, hitWorld, newDisplacement, fraction, this.keepDistance);\r\n if (this._findContact(newContact, this._manifold, 0.1) == -1) {\r\n //<todo fireContactAdded\r\n newContactIndex = this._manifold.length;\r\n this._manifold.push(newContact);\r\n //<todo updateTriggersSeen()\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (newContactIndex >= 0) {\r\n const newContact = this._manifold[newContactIndex];\r\n const displacementLengthInv = 1.0 / newDisplacement.length();\r\n const angleBetweenMovementAndSurface = newDisplacement.dot(newContact.normal) * displacementLengthInv;\r\n const keepDistanceAlongMovement = this.keepDistance / -angleBetweenMovementAndSurface;\r\n const distance = newContact.fraction;\r\n let fraction = distance - keepDistanceAlongMovement * displacementLengthInv;\r\n fraction = Math.min(Math.max(fraction, 0.0), 1.0);\r\n\r\n const displacement = newDisplacement.scale(fraction);\r\n this._position.addInPlace(displacement);\r\n remainingTime -= solverDeltaTime * fraction;\r\n } else {\r\n this._position.addInPlace(newDisplacement);\r\n remainingTime -= solverDeltaTime;\r\n }\r\n this._lastDisplacement.copyFrom(newDisplacement);\r\n }\r\n\r\n this._velocity.copyFrom(newVelocity);\r\n }\r\n\r\n /**\r\n * Helper function to calculate velocity based on surface informations and current velocity state and target\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param forwardWorld character forward in world coordinates\r\n * @param surfaceNormal surface normal direction\r\n * @param currentVelocity current velocity\r\n * @param surfaceVelocity velocity induced by the surface\r\n * @param desiredVelocity desired character velocity\r\n * @param upWorld up vector in world space\r\n * @param result resulting velocity vector\r\n * @returns boolean true if result has been computed\r\n */\r\n public calculateMovementToRef(\r\n deltaTime: number,\r\n forwardWorld: Vector3,\r\n surfaceNormal: Vector3,\r\n currentVelocity: Vector3,\r\n surfaceVelocity: Vector3,\r\n desiredVelocity: Vector3,\r\n upWorld: Vector3,\r\n result: Vector3\r\n ): boolean {\r\n const eps = 1e-5;\r\n let binorm = forwardWorld.cross(upWorld);\r\n if (binorm.lengthSquared() < eps) {\r\n return false;\r\n }\r\n binorm.normalize();\r\n const tangent = binorm.cross(surfaceNormal);\r\n tangent.normalize();\r\n binorm = tangent.cross(surfaceNormal);\r\n binorm.normalize();\r\n\r\n const surfaceFrame = Matrix.FromValues(\r\n tangent.x,\r\n tangent.y,\r\n tangent.z,\r\n 0,\r\n binorm.x,\r\n binorm.y,\r\n binorm.z,\r\n 0,\r\n surfaceNormal.x,\r\n surfaceNormal.y,\r\n surfaceNormal.z,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 1\r\n );\r\n const invSurfaceFrame = surfaceFrame.clone().invert();\r\n\r\n currentVelocity.subtractToRef(surfaceVelocity, this._tmpVecs[29]);\r\n const relative = this._tmpVecs[30];\r\n Vector3.TransformNormalToRef(this._tmpVecs[29], invSurfaceFrame, relative);\r\n\r\n const sideVec = upWorld.cross(forwardWorld);\r\n const fwd = desiredVelocity.dot(forwardWorld);\r\n const side = desiredVelocity.dot(sideVec);\r\n const len = desiredVelocity.length();\r\n\r\n const desiredVelocitySF = this._tmpVecs[4];\r\n desiredVelocitySF.set(-fwd, side, 0);\r\n desiredVelocitySF.normalize();\r\n desiredVelocitySF.scaleInPlace(len);\r\n const diff = this._tmpVecs[5];\r\n desiredVelocitySF.subtractToRef(relative, diff);\r\n\r\n // Clamp it by maxVelocityDelta and limit it by gain.\r\n {\r\n const lenSq = diff.lengthSquared();\r\n const gain = 0.05;\r\n const maxVelocityDelta = 50.0 * deltaTime;\r\n let tmp: number;\r\n if (lenSq * gain * gain > maxVelocityDelta * maxVelocityDelta) {\r\n tmp = maxVelocityDelta / Math.sqrt(lenSq);\r\n } else {\r\n tmp = gain;\r\n }\r\n diff.scaleInPlace(tmp);\r\n }\r\n\r\n relative.addInPlace(diff);\r\n\r\n // Transform back to world space and apply\r\n Vector3.TransformNormalToRef(relative, surfaceFrame, result);\r\n\r\n // Add back in the surface velocity\r\n result.addInPlace(surfaceVelocity);\r\n return true;\r\n }\r\n\r\n /**\r\n * Helper function to calculate velocity based on surface informations and current velocity state and target\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param forwardWorld character forward in world coordinates\r\n * @param surfaceNormal surface normal direction\r\n * @param currentVelocity current velocity\r\n * @param surfaceVelocity velocity induced by the surface\r\n * @param desiredVelocity desired character velocity\r\n * @param upWorld up vector in world space\r\n * @returns a new velocity vector\r\n */\r\n public calculateMovement(\r\n deltaTime: number,\r\n forwardWorld: Vector3,\r\n surfaceNormal: Vector3,\r\n currentVelocity: Vector3,\r\n surfaceVelocity: Vector3,\r\n desiredVelocity: Vector3,\r\n upWorld: Vector3\r\n ): Vector3 {\r\n const result = new Vector3(0, 0, 0);\r\n this.calculateMovementToRef(deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld, result);\r\n return result;\r\n }\r\n}\r\n"]}
|
package/Physics/v2/index.d.ts
CHANGED
package/Physics/v2/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./physicsMaterial.js";
|
|
|
7
7
|
export * from "./physicsAggregate.js";
|
|
8
8
|
export * from "./ragdoll.js";
|
|
9
9
|
export * from "./IPhysicsEnginePlugin.js";
|
|
10
|
+
export * from "./characterController.js";
|
|
10
11
|
/* eslint-disable import/no-internal-modules */
|
|
11
12
|
export * from "./Plugins/index.js";
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/Physics/v2/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,+CAA+C;AAC/C,cAAc,iBAAiB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport { PhysicsEngine as PhysicsEngineV2 } from \"./physicsEngine\";\r\nexport * from \"./physicsBody\";\r\nexport * from \"./physicsShape\";\r\nexport * from \"./physicsConstraint\";\r\nexport * from \"./physicsMaterial\";\r\nexport * from \"./physicsAggregate\";\r\nexport * from \"./ragdoll\";\r\nexport * from \"./IPhysicsEnginePlugin\";\r\n/* eslint-disable import/no-internal-modules */\r\nexport * from \"./Plugins/index\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,+CAA+C;AAC/C,cAAc,iBAAiB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport { PhysicsEngine as PhysicsEngineV2 } from \"./physicsEngine\";\r\nexport * from \"./physicsBody\";\r\nexport * from \"./physicsShape\";\r\nexport * from \"./physicsConstraint\";\r\nexport * from \"./physicsMaterial\";\r\nexport * from \"./physicsAggregate\";\r\nexport * from \"./ragdoll\";\r\nexport * from \"./IPhysicsEnginePlugin\";\r\nexport * from \"./characterController\";\r\n/* eslint-disable import/no-internal-modules */\r\nexport * from \"./Plugins/index\";\r\n"]}
|
|
@@ -19,13 +19,33 @@ preInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,nor
|
|
|
19
19
|
preInfo.NdotV=NdotV;
|
|
20
20
|
#ifdef SPOTLIGHT{X}
|
|
21
21
|
#ifdef LIGHT_FALLOFF_GLTF{X}
|
|
22
|
-
preInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);
|
|
22
|
+
preInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);
|
|
23
|
+
#ifdef IESLIGHTTEXTURE{X}
|
|
24
|
+
preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});
|
|
25
|
+
#else
|
|
26
|
+
preInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);
|
|
27
|
+
#endif
|
|
23
28
|
#elif defined(LIGHT_FALLOFF_PHYSICAL{X})
|
|
24
|
-
preInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);
|
|
29
|
+
preInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);
|
|
30
|
+
#ifdef IESLIGHTTEXTURE{X}
|
|
31
|
+
preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});
|
|
32
|
+
#else
|
|
33
|
+
preInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);
|
|
34
|
+
#endif
|
|
25
35
|
#elif defined(LIGHT_FALLOFF_STANDARD{X})
|
|
26
|
-
preInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);
|
|
36
|
+
preInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);
|
|
37
|
+
#ifdef IESLIGHTTEXTURE{X}
|
|
38
|
+
preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});
|
|
27
39
|
#else
|
|
28
|
-
preInfo.attenuation
|
|
40
|
+
preInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);
|
|
41
|
+
#endif
|
|
42
|
+
#else
|
|
43
|
+
preInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);
|
|
44
|
+
#ifdef IESLIGHTTEXTURE{X}
|
|
45
|
+
preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});
|
|
46
|
+
#else
|
|
47
|
+
preInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);
|
|
48
|
+
#endif
|
|
29
49
|
#endif
|
|
30
50
|
#elif defined(POINTLIGHT{X})
|
|
31
51
|
#ifdef LIGHT_FALLOFF_GLTF{X}
|
|
@@ -97,7 +117,11 @@ info.sheen*=info.clearCoat.w;
|
|
|
97
117
|
#endif
|
|
98
118
|
#else
|
|
99
119
|
#ifdef SPOTLIGHT{X}
|
|
120
|
+
#ifdef IESLIGHTTEXTURE{X}
|
|
121
|
+
info=computeIESSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness,iesLightTexture{X});
|
|
122
|
+
#else
|
|
100
123
|
info=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness);
|
|
124
|
+
#endif
|
|
101
125
|
#elif defined(HEMILIGHT{X})
|
|
102
126
|
info=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);
|
|
103
127
|
#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightFragment.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/lightFragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,eAAe,CAAC;AAC7B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwQd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"lightFragment\";\nconst shader = `#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n#else\nvec4 diffuse{X}=light{X}.vLightDiffuse;\n#define CUSTOM_LIGHT{X}_COLOR \n#ifdef PBR\n#ifdef SPOTLIGHT{X}\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);\n#elif defined(POINTLIGHT{X})\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);\n#elif defined(HEMILIGHT{X})\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(DIRLIGHT{X})\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#endif\npreInfo.NdotV=NdotV;\n#ifdef SPOTLIGHT{X}\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);preInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);preInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);preInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);preInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#elif defined(POINTLIGHT{X})\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\n#else\npreInfo.attenuation=1.0;\n#endif\n#ifdef HEMILIGHT{X}\npreInfo.roughness=roughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#ifdef IRIDESCENCE\npreInfo.iridescenceIntensity=iridescenceIntensity;\n#endif\n#ifdef HEMILIGHT{X}\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,diffuse{X}.rgb,light{X}.vLightGround);\n#elif defined(SS_TRANSLUCENCY)\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance);\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb);\n#endif\n#ifdef SPECULARTERM\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\n#ifdef HEMILIGHT{X}\npreInfo.roughness=sheenOut.sheenRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#endif\n#ifdef CLEARCOAT\n#ifdef HEMILIGHT{X}\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,diffuse{X}.rgb);\n#ifdef CLEARCOAT_TINT\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption;\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\n#else\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness);\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness);\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},textureProjectionMatrix{X},vPositionW);\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nfor (int i=0; i<SHADOWCSMNUM_CASCADES{X}; i++) \n{\n#ifdef SHADOWCSM_RIGHTHANDED{X}\ndiff{X}=viewFrustumZ{X}[i]+vPositionFromCamera{X}.z;\n#else\ndiff{X}=viewFrustumZ{X}[i]-vPositionFromCamera{X}.z;\n#endif\nif (diff{X}>=0.) {index{X}=i;break;}}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nfloat frustumLength=frustumLengths{X}[index{X}];float diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};if (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{index{X}+=1;float nextShadow=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;shadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\naggShadow+=shadow;numLights+=1.0;\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else \ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightFragment = { name, shader };\n"]}
|
|
1
|
+
{"version":3,"file":"lightFragment.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/lightFragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,eAAe,CAAC;AAC7B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgSd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"lightFragment\";\nconst shader = `#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n#else\nvec4 diffuse{X}=light{X}.vLightDiffuse;\n#define CUSTOM_LIGHT{X}_COLOR \n#ifdef PBR\n#ifdef SPOTLIGHT{X}\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);\n#elif defined(POINTLIGHT{X})\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);\n#elif defined(HEMILIGHT{X})\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(DIRLIGHT{X})\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#endif\npreInfo.NdotV=NdotV;\n#ifdef SPOTLIGHT{X}\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\n#endif\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#endif\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif \n#endif\n#elif defined(POINTLIGHT{X})\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\n#else\npreInfo.attenuation=1.0;\n#endif\n#ifdef HEMILIGHT{X}\npreInfo.roughness=roughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#ifdef IRIDESCENCE\npreInfo.iridescenceIntensity=iridescenceIntensity;\n#endif\n#ifdef HEMILIGHT{X}\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,diffuse{X}.rgb,light{X}.vLightGround);\n#elif defined(SS_TRANSLUCENCY)\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance);\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb);\n#endif\n#ifdef SPECULARTERM\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\n#ifdef HEMILIGHT{X}\npreInfo.roughness=sheenOut.sheenRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#endif\n#ifdef CLEARCOAT\n#ifdef HEMILIGHT{X}\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,diffuse{X}.rgb);\n#ifdef CLEARCOAT_TINT\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption;\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\n#else\n#ifdef SPOTLIGHT{X}\n#ifdef IESLIGHTTEXTURE{X}\ninfo=computeIESSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness,iesLightTexture{X});\n#else\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness);\n#endif\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness);\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},textureProjectionMatrix{X},vPositionW);\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nfor (int i=0; i<SHADOWCSMNUM_CASCADES{X}; i++) \n{\n#ifdef SHADOWCSM_RIGHTHANDED{X}\ndiff{X}=viewFrustumZ{X}[i]+vPositionFromCamera{X}.z;\n#else\ndiff{X}=viewFrustumZ{X}[i]-vPositionFromCamera{X}.z;\n#endif\nif (diff{X}>=0.) {index{X}=i;break;}}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nfloat frustumLength=frustumLengths{X}[index{X}];float diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};if (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{index{X}+=1;float nextShadow=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;shadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\naggShadow+=shadow;numLights+=1.0;\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else \ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightFragment = { name, shader };\n"]}
|
|
@@ -59,6 +59,9 @@ uniform vec4 vLightFalloff{X};
|
|
|
59
59
|
#elif defined(HEMILIGHT{X})
|
|
60
60
|
uniform vec3 vLightGround{X};
|
|
61
61
|
#endif
|
|
62
|
+
#ifdef IESLIGHTTEXTURE{X}
|
|
63
|
+
uniform sampler2D iesLightTexture{X};
|
|
64
|
+
#endif
|
|
62
65
|
#ifdef PROJECTEDLIGHTTEXTURE{X}
|
|
63
66
|
uniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X};
|
|
64
67
|
#endif
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightFragmentDeclaration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/lightFragmentDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"lightFragmentDeclaration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/lightFragmentDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"lightFragmentDeclaration\";\nconst shader = `#ifdef LIGHT{X}\nuniform vec4 vLightData{X};uniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowTexture{X};uniform highp sampler2DArray depthTexture{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowTexture{X};\n#else\nuniform highp sampler2DArray shadowTexture{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);vec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowTexture{X};\n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowTexture{X};uniform highp sampler2D depthTexture{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowTexture{X};\n#else\nuniform sampler2D shadowTexture{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};uniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};uniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef IESLIGHTTEXTURE{X}\nuniform sampler2D iesLightTexture{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X};\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightFragmentDeclaration = { name, shader };\n"]}
|
|
@@ -12,6 +12,9 @@ vec4 vLightFalloff;
|
|
|
12
12
|
vec3 vLightGround;
|
|
13
13
|
#endif
|
|
14
14
|
vec4 shadowsInfo;vec2 depthValues;} light{X};
|
|
15
|
+
#ifdef IESLIGHTTEXTURE{X}
|
|
16
|
+
uniform sampler2D iesLightTexture{X};
|
|
17
|
+
#endif
|
|
15
18
|
#ifdef PROJECTEDLIGHTTEXTURE{X}
|
|
16
19
|
uniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X};
|
|
17
20
|
#endif
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightUboDeclaration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/lightUboDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"lightUboDeclaration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/lightUboDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Dd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"lightUboDeclaration\";\nconst shader = `#ifdef LIGHT{X}\nuniform Light{X}\n{vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;vec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;vec2 depthValues;} light{X};\n#ifdef IESLIGHTTEXTURE{X}\nuniform sampler2D iesLightTexture{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X};\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowTexture{X};uniform highp sampler2DArray depthTexture{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowTexture{X};\n#else\nuniform highp sampler2DArray shadowTexture{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);vec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowTexture{X}; \n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowTexture{X};uniform highp sampler2D depthTexture{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowTexture{X};\n#else\nuniform sampler2D shadowTexture{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightUboDeclaration = { name, shader };\n"]}
|
|
@@ -22,8 +22,10 @@ result.diffuse=ndl*diffuseColor*attenuation;
|
|
|
22
22
|
vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
|
|
23
23
|
#endif
|
|
24
24
|
return result;}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
float getAttenuation(float cosAngle,float exponent) {return max(0.,pow(cosAngle,exponent));}
|
|
26
|
+
float getIESAttenuation(float cosAngle,sampler2D iesLightSampler) {float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.),0.).r;}
|
|
27
|
+
lightingInfo basicSpotLighting(vec3 viewDirectionW,vec3 lightVectorW,vec3 vNormal,float attenuation,vec3 diffuseColor,vec3 specularColor,float glossiness) {lightingInfo result;
|
|
28
|
+
float ndl=max(0.,dot(vNormal,lightVectorW));
|
|
27
29
|
#ifdef NDOTL
|
|
28
30
|
result.ndl=ndl;
|
|
29
31
|
#endif
|
|
@@ -32,7 +34,22 @@ result.diffuse=ndl*diffuseColor*attenuation;
|
|
|
32
34
|
vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
|
|
33
35
|
#endif
|
|
34
36
|
return result;}
|
|
35
|
-
|
|
37
|
+
lightingInfo computeIESSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness,sampler2D iesLightSampler) {
|
|
38
|
+
vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float dotProduct=dot(lightDirection.xyz,-lightVectorW);float cosAngle=max(0.,dotProduct);if (cosAngle>=lightDirection.w)
|
|
39
|
+
{
|
|
40
|
+
attenuation*=getIESAttenuation(dotProduct,iesLightSampler);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
|
|
41
|
+
lightingInfo result;result.diffuse=vec3(0.);
|
|
42
|
+
#ifdef SPECULARTERM
|
|
43
|
+
result.specular=vec3(0.);
|
|
44
|
+
#endif
|
|
45
|
+
#ifdef NDOTL
|
|
46
|
+
result.ndl=0.;
|
|
47
|
+
#endif
|
|
48
|
+
return result;}
|
|
49
|
+
lightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)
|
|
50
|
+
{
|
|
51
|
+
attenuation*=getAttenuation(cosAngle,lightData.w);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
|
|
52
|
+
lightingInfo result;result.diffuse=vec3(0.);
|
|
36
53
|
#ifdef SPECULARTERM
|
|
37
54
|
result.specular=vec3(0.);
|
|
38
55
|
#endif
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightsFragmentFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/lightsFragmentFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,yBAAyB,CAAC;AACvC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"lightsFragmentFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/lightsFragmentFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,yBAAyB,CAAC;AACvC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0QAkE2P,CAAC;AAC3Q,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"lightsFragmentFunctions\";\nconst shader = `struct lightingInfo\n{vec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};lightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {lightingInfo result;vec3 lightVectorW;float attenuation=1.0;if (lightData.w==0.)\n{vec3 direction=lightData.xyz-vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}\nelse\n{lightVectorW=normalize(-lightData.xyz);}\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nfloat getAttenuation(float cosAngle,float exponent) {return max(0.,pow(cosAngle,exponent));}\nfloat getIESAttenuation(float cosAngle,sampler2D iesLightSampler) {float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.),0.).r;}\nlightingInfo basicSpotLighting(vec3 viewDirectionW,vec3 lightVectorW,vec3 vNormal,float attenuation,vec3 diffuseColor,vec3 specularColor,float glossiness) {lightingInfo result; \nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nlightingInfo computeIESSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness,sampler2D iesLightSampler) { \nvec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float dotProduct=dot(lightDirection.xyz,-lightVectorW);float cosAngle=max(0.,dotProduct);if (cosAngle>=lightDirection.w)\n{ \nattenuation*=getIESAttenuation(dotProduct,iesLightSampler);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}\nlightingInfo result;result.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)\n{ \nattenuation*=getAttenuation(cosAngle,lightData.w);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}\nlightingInfo result;result.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {lightingInfo result;float ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;\n#endif\nreturn result;}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return textureColor;}`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightsFragmentFunctions = { name, shader };\n"]}
|
|
@@ -21,6 +21,8 @@ float computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 direction
|
|
|
21
21
|
{float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)
|
|
22
22
|
{falloff=max(0.,pow(cosAngle,exponent));}
|
|
23
23
|
return falloff;}
|
|
24
|
+
float computeDirectionalLightFalloff_IES(vec3 lightDirection,vec3 directionToLightCenterW,sampler2D iesLightSampler)
|
|
25
|
+
{float cosAngle=dot(-lightDirection,directionToLightCenterW);float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
|
|
24
26
|
float computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)
|
|
25
27
|
{const float kMinusLog2ConeAngleIntensityRatio=6.64385618977;
|
|
26
28
|
float concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pbrDirectLightingFalloffFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"pbrDirectLightingFalloffFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"pbrDirectLightingFalloffFunctions\";\nconst shader = `float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{return max(0.,1.0-length(lightOffset)/range);}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{return 1.0/maxEps(lightDistanceSquared);}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);float factor=lightDistanceSquared*inverseSquaredRange;float attenuation=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)\n{falloff=max(0.,pow(cosAngle,exponent));}\nreturn falloff;}\nfloat computeDirectionalLightFalloff_IES(vec3 lightDirection,vec3 directionToLightCenterW,sampler2D iesLightSampler)\n{float cosAngle=dot(-lightDirection,directionToLightCenterW);float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{const float kMinusLog2ConeAngleIntensityRatio=6.64385618977; \nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{float cd=dot(-lightDirection,directionToLightCenterW);float falloff=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrDirectLightingFalloffFunctions = { name, shader };\n"]}
|