UNPKG

@three3d/tools

Version:

@three3d/tools 提供了 ThreeJS 常用的工具库

104 lines 2.52 kB
import { Matrix3, type Wrapping, Vector2, type BufferAttribute } from "three"; import type { IVector2 } from "type-tls"; /** * 配置uv的选项 */ export interface ConfigUVOptions { /** * 定义了纹理贴图在水平方向上将如何包裹,在UV映射中对应于U。 */ wrapS?: Wrapping; /** * 定义了纹理贴图在垂直方向上将如何包裹,在UV映射中对应于V。 */ wrapT?: Wrapping; /** * 是否横向的翻转 */ flipX?: boolean; /** * 是否纵向的翻转 */ flipY?: boolean; } /** * 使用纹理选项来设置uv * @param uv * @param options * @returns */ export declare function configUV(uv: IVector2, options: ConfigUVOptions): IVector2; /** * 使用纹理选项批量设置uv * @param uv * @param options * @returns */ export declare function configUVBufferAttribute(uvs: BufferAttribute, options: ConfigUVOptions): BufferAttribute; /** * 使用纹理选项批量设置uv * @param uv * @param options * @returns */ export declare function configUVs(uvs: ArrayLike<number>, options: ConfigUVOptions): ArrayLike<number>; /** * uv 变换选项 */ export interface UVTransformOptions { /** * 偏移 * * @defaultValue {x:0,y:0} */ offset?: IVector2; /** * 重复 * @defaultValue {x:1,y:1} */ repeat?: IVector2; /** * 旋转角度 * @remarks * 弧度 * * @defaultValue 0 */ rotation?: number; /** * 旋转中心 * @defaultValue {x:0,y:0} */ center?: IVector2; } /** * 创建uv的变换矩阵 * @param transfrom * @param target * @returns */ export declare function createUVTransformMatrix(transfrom: UVTransformOptions, target?: Matrix3): Matrix3; /** * 变换单个uv * @param uv * @param transfrom * @returns */ export declare function transformUV(uv: Vector2, transfrom: UVTransformOptions, options?: ConfigUVOptions | null): Vector2; /** * 对 uv BufferAttribute 进行变换 * @param uvs * @param transfrom * @param options * @returns */ export declare function transformUVBufferAttribute(uvs: BufferAttribute, transfrom: UVTransformOptions, options?: ConfigUVOptions | null): BufferAttribute; /** * 对 uv 数组进行变换 * @param uvs * @param transfrom * @param options * @returns */ export declare function transformUVs(uvs: ArrayLike<number>, transfrom: UVTransformOptions, options?: ConfigUVOptions | null): ArrayLike<number>; //# sourceMappingURL=uv.d.ts.map