@gltf-transform/functions
Version:
Functions for common glTF modifications, written using the core API
27 lines (26 loc) • 918 B
TypeScript
import { Node } from '@gltf-transform/core';
/**
* Clears local transform of the {@link Node}, applying the transform to children and meshes.
*
* - Applies transform to children
* - Applies transform to {@link Mesh mesh}
* - Resets {@link Light lights}, {@link Camera cameras}, and other attachments to the origin
*
* Example:
*
* ```typescript
* import { clearNodeTransform } from '@gltf-transform/functions';
*
* node.getTranslation(); // → [ 5, 0, 0 ]
* node.getMesh(); // → vertex data centered at origin
*
* clearNodeTransform(node);
*
* node.getTranslation(); // → [ 0, 0, 0 ]
* node.getMesh(); // → vertex data centered at [ 5, 0, 0 ]
* ```
*
* To clear _all_ transforms of a Node, first clear its inherited transforms with
* {@link clearNodeParent}, then clear the local transform with {@link clearNodeTransform}.
*/
export declare function clearNodeTransform(node: Node): Node;