import { Skeleton, Vector3, Bone, BufferGeometry, SkinnedMesh, Matrix4 } from "three"; import type { Material, Mesh, Object3D } from "three"; /** * 创建链式骨格的选项 */ export type CreateChainBonesOptions = Partial & Partial & { /** * 关节位置列表 */ joints?: Vector3[] | null; }; /** * 创建链式骨骼 * @param options * @returns */ export declare function createChainBones(options: CreateChainBonesOptions): Bone[]; /** * 创建链式骨骼的公共选项 */ export interface CreateChainBonesOptions_Base { /** * 根骨骼的起始点 */ start?: Vector3 | null; } /** * createChainBones 的选项 */ export interface CreateChainBonesOptionsByAxials extends CreateChainBonesOptions_Base { /** * 所有骨骼的轴向量列表 */ axials: Vector3[]; } /** * 创建链式骨骼 * @remarks * 一个轴连接两个 `Bone`,(即:关切),所以 `start` 对应一个 `Bone`,每个轴对应一个骨骼 * @param options - 选项 * @returns 返回一个具有 axials.length + 1 个 Bone 的 数组 */ export declare function createChainBonesByAxials(options: CreateChainBonesOptionsByAxials): Bone[]; /** * 通过关节位置列表来创建链式骨骼 * @param joints - 关节的位置列表 * @returns 骨骼数组 */ export declare function createChainBonesByJoints(joints: Vector3[]): Bone[]; /** * 等分链式骨骼选项 */ export interface EqualChainBoneOptions extends CreateChainBonesOptions_Base { /** * 单个骨骼的轴向量 * @remarks * 该向量的方向会作为骨骼的方向,向量的长度会作为骨骼的长度 */ axial: Vector3; /** * 骨骼的数量 */ number: number; } /** * 创建等分链式骨骼 * @param boneOpts - 等分链式骨骼的选项 * @returns 骨骼数组 */ export declare function createEqualChainBones(boneOpts: EqualChainBoneOptions): Bone[]; /** * 配置权重的基础选项 */ export interface ConfigVertexWeightOptions_Base { /** * 几何体 * @remarks * 被配置的目标 */ geometry: BufferGeometry; /** * 柔性系数 * @remarks * 取值范围:0 - 1 * @defaultValue 1 */ flexible?: number; } /** * configVertexWeightByEquallyDivided 的选项 */ export type ConfigVertexWeightByEquallyDividedOptions = ConfigVertexWeightOptions_Base & EqualChainBoneOptions; /** * 以等分链的方式配置几何体的顶点权重 * @param options - 选项 * @returns 原来的 geometry */ export declare function configVertexWeightByEquallyDivided(options: ConfigVertexWeightByEquallyDividedOptions): BufferGeometry; /** * configVertexWeightForEqualChainBones 的选项 */ export interface ConfigVertexWeightForEqualChainBonesOptions extends ConfigVertexWeightOptions_Base { /** * 链式骨架 */ skeleton: Skeleton; /** * 几何体的顶点的坐标系矩阵 */ geometryFrame?: Matrix4 | null; } /** * 为等分链骨骼配置几何体的顶点权重 * @param options - 选项 * @returns 原来的 geometry */ export declare function configVertexWeightForEqualChainBones(options: ConfigVertexWeightForEqualChainBonesOptions): BufferGeometry; export interface ConfigVertexWeightForChainBonesOptions_Base { /** * 几何体的顶点的坐标系矩阵 */ geometryFrame?: Matrix4 | null; } export type ConfigVertexWeightForChainBonesOptions = ConfigVertexWeightForChainBonesOptions_Base & ConfigVertexWeightForEqualChainBonesOptions; /** * 为链式骨骼配置几何体的顶点权重 * @param options - 选项 * @returns 原来的 geometry */ export declare function configVertexWeightForChainBones(options: ConfigVertexWeightForChainBonesOptions): BufferGeometry; /** * 为链式骨骼配置几何体的顶点权重 * @param options - 选项 * @returns 原来的 geometry */ /** * createChainSkinnedMesh 的选项 */ export interface ChainSkinnedMeshOptions extends CreateChainBonesOptions, ConfigVertexWeightOptions_Base { /** * 材质 */ material?: Material[] | Material | null; } /** * 创建带有链式骨骼的蒙皮网格对象 * @param options - 选项 * @returns */ export declare function createChainSkinnedMesh(options: ChainSkinnedMeshOptions): SkinnedMesh, Material | Material[]>; export interface CreateChainSkinnedMeshForMeshOptions_Base { target: Mesh; skeleton: Skeleton; } export type CreateChainSkinnedMeshForMeshOptions = CreateChainSkinnedMeshForMeshOptions_Base & Omit & Omit; /** * 为指定的 mesh 对象创建其对应的蒙皮网格对象 * @param options * @returns */ export declare function createChainSkinnedMeshForMesh(options: CreateChainSkinnedMeshForMeshOptions): SkinnedMesh, Material | Material[]>; export interface CreateChainSkeletalModelOptions_Base { /** * 模型对象 * @remarks * 可以是任意的 Object3D 对象,会对 model 及其子孙节点进行递归的 Object3D 级别的拷贝(会复用 geometry 和 material 对象); * 并会将所有的 Mesh 对象转为 SkinnedMesh */ target: Object3D; /** * 要绑定的骨架对象 */ skeleton?: Skeleton | null; } export type CreateChainSkeletalModelOptions = CreateChainSkeletalModelOptions_Base & CreateChainBonesOptions & Omit & Pick; /** * createChainSkeletalModel 返回值的类型 */ export type SkeletalModelInfo = ReturnType; /** * 为指定的 模型 创建其对应的链式骨骼模型 * @param options * @returns 返回新的模型对象 */ export declare function createChainSkeletalModel(options: CreateChainSkeletalModelOptions): { model: Object3D; skeleton: Skeleton; rootBone: Bone; }; export interface BindChainSkeletalForModelOptions_Base { parent?: Object3D | null; skeleton: Skeleton; /** * 路径动画的目标是否是根骨骼 * @remarks * 骨骼路径动画可由两部分组成: * - 贴合路径的变形动画 * - 沿路径的位置和旋转动画 * 其中贴合路径的变形动画的动画目标一定是骨骼 bone,而沿路径的位置和旋转动画的动画目标可以是根骨骼 bone,也可以是目标对象(模型对象) */ posOnBone?: boolean | null; } export type BindChainSkeletalForModelOptions = BindChainSkeletalForModelOptions_Base & Omit; //# sourceMappingURL=chain-bone.d.ts.map