Skip to content

Commit a375175

Browse files
deltakoshDavid Catuhe
andauthored
Allow user to globally set the numMaxInfluencers (#16761)
Co-authored-by: David Catuhe <[email protected]>
1 parent fd3d76f commit a375175

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/dev/core/src/Morph/morphTargetManager.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ export class MorphTargetManager implements IDisposable {
2121
/** Maximum number of active morph targets supported in the "vertex attribute" mode (i.e., not the "texture" mode) */
2222
public static MaxActiveMorphTargetsInVertexAttributeMode = 8;
2323

24+
/**
25+
* When used in texture mode, if greather than 0, this will override the the morph manager numMaxInfluencers value.
26+
*/
27+
public static ConstantTargetCountForTextureMode = 0;
28+
2429
private _targets = new Array<MorphTarget>();
2530
private _targetInfluenceChangedObservers = new Array<Nullable<Observer<boolean>>>();
2631
private _targetDataLayoutChangedObservers = new Array<Nullable<Observer<void>>>();
@@ -146,8 +151,12 @@ export class MorphTargetManager implements IDisposable {
146151
* If you assign a non-zero value to this property, you need to ensure that this value is greater than the maximum number of (active) influencers you'll need for this morph manager.
147152
* Otherwise, the number of active influencers will be truncated at the value you set for this property, which can lead to unexpected results.
148153
* Note that this property has no effect if "useTextureToStoreTargets" is false.
154+
* Note as well that if MorphTargetManager.ConstantTargetCountForTextureMode is greater than 0, this property will be ignored and the constant value will be used instead.
149155
*/
150156
public get numMaxInfluencers(): number {
157+
if (MorphTargetManager.ConstantTargetCountForTextureMode > 0 && this.isUsingTextureForTargets) {
158+
return MorphTargetManager.ConstantTargetCountForTextureMode;
159+
}
151160
return this._numMaxInfluencers;
152161
}
153162

0 commit comments

Comments
 (0)