-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: add a r168 compat to tslFn calling
In r168, `tslFn` has been renamed to `Fn` See: mrdoob/three.js#29064
- Loading branch information
Showing
3 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/three-vrm-materials-mtoon/src/nodes/mtoonParametricRim.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/three-vrm-materials-mtoon/src/nodes/utils/FnCompat.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as THREE from 'three/webgpu'; | ||
|
||
/** | ||
* A compat function for `Fn()` / `tslFn()`. | ||
* `tslFn()` has been renamed to `Fn()` in r168. | ||
* We are going to use this compat for a while. | ||
* | ||
* See: https://github.com/mrdoob/three.js/pull/29064 | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export const FnCompat: typeof THREE.tslFn = (jsFunc: any) => { | ||
// COMPAT r168: `tslFn()` has been renamed to `Fn()` | ||
// See: https://github.com/mrdoob/three.js/pull/29064 | ||
const threeRevision = parseInt(THREE.REVISION, 10); | ||
if (threeRevision >= 168) { | ||
return (THREE as any).Fn(jsFunc); | ||
} else { | ||
return (THREE as any).tslFn(jsFunc); | ||
} | ||
}; |