Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SkinnedMesh: Introduce constants for bindMode. #635

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions types/three/src/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ export type ToneMapping =
| typeof ACESFilmicToneMapping
| typeof CustomToneMapping;

// Bind modes
export const AttachedBindMode: 'attached';
export const DetachedBindMode: 'detached';
export type BindMode = typeof AttachedBindMode | typeof DetachedBindMode;

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
Expand Down
17 changes: 9 additions & 8 deletions types/three/src/objects/SkinnedMesh.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Material } from './../materials/Material.js';
import { Material } from '../materials/Material.js';
import { Box3 } from '../math/Box3.js';
import { Matrix4 } from './../math/Matrix4.js';
import { Vector3 } from './../math/Vector3.js';
import { Matrix4 } from '../math/Matrix4.js';
import { Vector3 } from '../math/Vector3.js';
import { Skeleton } from './Skeleton.js';
import { Mesh } from './Mesh.js';
import { BufferGeometry } from '../core/BufferGeometry.js';
import { Sphere } from '../math/Sphere.js';
import { BindMode } from '../constants.js';

/**
* A mesh that has a {@link THREE.Skeleton | Skeleton} with {@link Bone | bones} that can then be used to animate the vertices of the geometry.
Expand Down Expand Up @@ -72,12 +73,12 @@ export class SkinnedMesh<
override readonly type: string | 'SkinnedMesh';

/**
* Either `attached` or `detached`.
* - `attached` uses the {@link THREE.SkinnedMesh.matrixWorld | SkinnedMesh.matrixWorld} property for the base transform matrix of the bones.
* - `detached` uses the {@link THREE.SkinnedMesh.bindMatrix | SkinnedMesh.bindMatrix}.
* @defaultValue `attached`.
* Either {@link AttachedBindMode} or {@link DetachedBindMode}. {@link AttachedBindMode} means the skinned mesh
* shares the same world space as the skeleton. This is not true when using {@link DetachedBindMode} which is useful
* when sharing a skeleton across multiple skinned meshes.
* @defaultValue `AttachedBindMode`
*/
bindMode: 'attached' | 'detached';
bindMode: BindMode;

/**
* The base matrix that is used for the bound bone transforms.
Expand Down