xl-public-utils 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +13 -12
- package/package.json +1 -1
- package/src/threeFont/index.js +4 -0
package/index.d.ts
CHANGED
|
@@ -425,6 +425,19 @@ declare module "xl-public-utils" {
|
|
|
425
425
|
* @returns {Plane| null} 拟合的平面
|
|
426
426
|
*/
|
|
427
427
|
export function pcaFitPlane(points: vec3[]): Plane | null;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* 加载3D模型文件
|
|
431
|
+
* @param data - 文件路径(字符串)或文件数据(ArrayBuffer)
|
|
432
|
+
* @param name - 文件名,用于推断文件类型(可选)
|
|
433
|
+
* @param typeOverride - 手动指定的文件类型,将覆盖文件名推断的类型(可选)
|
|
434
|
+
* @returns Promise<{ vertices: Float32Array, faces: Uint32Array }> - 包含顶点和面片数据的网格对象
|
|
435
|
+
*/
|
|
436
|
+
export function loadFile(
|
|
437
|
+
data: string | ArrayBuffer,
|
|
438
|
+
name?: string,
|
|
439
|
+
typeOverride?: string
|
|
440
|
+
): Promise<{ vertices: Float32Array; faces: Uint32Array }>;
|
|
428
441
|
export type Position = {
|
|
429
442
|
/**
|
|
430
443
|
* 对应vtk坐标系的x值
|
|
@@ -970,17 +983,5 @@ declare module "xl-public-utils" {
|
|
|
970
983
|
* 获取顶点索引映射
|
|
971
984
|
*/
|
|
972
985
|
getPointsMapData(polydata: ArrayLike<number>): IndexData;
|
|
973
|
-
/**
|
|
974
|
-
* 加载3D模型文件
|
|
975
|
-
* @param data - 文件路径(字符串)或文件数据(ArrayBuffer)
|
|
976
|
-
* @param name - 文件名,用于推断文件类型(可选)
|
|
977
|
-
* @param typeOverride - 手动指定的文件类型,将覆盖文件名推断的类型(可选)
|
|
978
|
-
* @returns Promise<{ vertices: Float32Array, faces: Uint32Array }> - 包含顶点和面片数据的网格对象
|
|
979
|
-
*/
|
|
980
|
-
loadFile(
|
|
981
|
-
data: string | ArrayBuffer,
|
|
982
|
-
name?: string,
|
|
983
|
-
typeOverride?: string
|
|
984
|
-
): Promise<{ vertices: Float32Array; faces: Uint32Array }>;
|
|
985
986
|
}
|
|
986
987
|
}
|
package/package.json
CHANGED
package/src/threeFont/index.js
CHANGED
|
@@ -85,6 +85,10 @@ class FontManager {
|
|
|
85
85
|
const indexData = this.getPointsMapData(vfData.vertices);
|
|
86
86
|
// console.log(indexData);
|
|
87
87
|
const newVertices = verticesApplyMat4(scaleM4, vfData.vertices);
|
|
88
|
+
if(!this.cacheFontMap[fontName]) {
|
|
89
|
+
this.cacheFontMap[fontName] = {}
|
|
90
|
+
this.cacheFontPointMap[fontName] = {}
|
|
91
|
+
}
|
|
88
92
|
this.cacheFontMap[fontName][text] = vfData;
|
|
89
93
|
this.cacheFontPointMap[fontName][text] = indexData;
|
|
90
94
|
|