bplinejs 0.0.101-beta.10
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/README.md +215 -0
- package/docs/API.md +471 -0
- package/lib/Camera/index.d.ts +88 -0
- package/lib/Camera/index.js +178 -0
- package/lib/Camera/index.js.map +1 -0
- package/lib/Color/index.d.ts +99 -0
- package/lib/Color/index.js +178 -0
- package/lib/Color/index.js.map +1 -0
- package/lib/Geometry/Geo.d.ts +131 -0
- package/lib/Geometry/Geo.js +180 -0
- package/lib/Geometry/Geo.js.map +1 -0
- package/lib/Geometry/Poly2D.d.ts +53 -0
- package/lib/Geometry/Poly2D.js +133 -0
- package/lib/Geometry/Poly2D.js.map +1 -0
- package/lib/Geometry/Rect2d.d.ts +89 -0
- package/lib/Geometry/Rect2d.js +128 -0
- package/lib/Geometry/Rect2d.js.map +1 -0
- package/lib/Geometry/index.d.ts +6 -0
- package/lib/Geometry/index.js +4 -0
- package/lib/Group/index.d.ts +70 -0
- package/lib/Group/index.js +110 -0
- package/lib/Group/index.js.map +1 -0
- package/lib/ID.d.ts +6 -0
- package/lib/ID.js +15 -0
- package/lib/ID.js.map +1 -0
- package/lib/IMesh/index.d.ts +104 -0
- package/lib/IMesh/index.js +333 -0
- package/lib/IMesh/index.js.map +1 -0
- package/lib/Material/Material.d.ts +158 -0
- package/lib/Material/Material.js +229 -0
- package/lib/Material/Material.js.map +1 -0
- package/lib/Material/baseMaterial.d.ts +15 -0
- package/lib/Material/baseMaterial.js +24 -0
- package/lib/Material/baseMaterial.js.map +1 -0
- package/lib/Material/index.d.ts +4 -0
- package/lib/Material/index.js +3 -0
- package/lib/Material/shaders/base/poly/fragment.js +6 -0
- package/lib/Material/shaders/base/poly/fragment.js.map +1 -0
- package/lib/Material/shaders/base/poly/vertex.js +6 -0
- package/lib/Material/shaders/base/poly/vertex.js.map +1 -0
- package/lib/Material/shaders/base/rect/fragment.js +6 -0
- package/lib/Material/shaders/base/rect/fragment.js.map +1 -0
- package/lib/Material/shaders/base/rect/vertex.js +6 -0
- package/lib/Material/shaders/base/rect/vertex.js.map +1 -0
- package/lib/Material/shaders/line/fragment.js +6 -0
- package/lib/Material/shaders/line/fragment.js.map +1 -0
- package/lib/Material/shaders/line/vertex.js +6 -0
- package/lib/Material/shaders/line/vertex.js.map +1 -0
- package/lib/Mesh/index.d.ts +154 -0
- package/lib/Mesh/index.js +254 -0
- package/lib/Mesh/index.js.map +1 -0
- package/lib/Object/index.d.ts +95 -0
- package/lib/Object/index.js +212 -0
- package/lib/Object/index.js.map +1 -0
- package/lib/Raws/index.d.ts +87 -0
- package/lib/Raws/index.js +164 -0
- package/lib/Raws/index.js.map +1 -0
- package/lib/Render/BufferManager.d.ts +93 -0
- package/lib/Render/BufferManager.js +281 -0
- package/lib/Render/BufferManager.js.map +1 -0
- package/lib/Render/DepthManager.d.ts +22 -0
- package/lib/Render/DepthManager.js +95 -0
- package/lib/Render/DepthManager.js.map +1 -0
- package/lib/Render/DestroyManager.d.ts +74 -0
- package/lib/Render/DestroyManager.js +221 -0
- package/lib/Render/DestroyManager.js.map +1 -0
- package/lib/Render/DevelopmentValidator.d.ts +73 -0
- package/lib/Render/DevelopmentValidator.js +188 -0
- package/lib/Render/DevelopmentValidator.js.map +1 -0
- package/lib/Render/DrawCallManager.d.ts +58 -0
- package/lib/Render/DrawCallManager.js +267 -0
- package/lib/Render/DrawCallManager.js.map +1 -0
- package/lib/Render/PipelineManager.d.ts +46 -0
- package/lib/Render/PipelineManager.js +254 -0
- package/lib/Render/PipelineManager.js.map +1 -0
- package/lib/Render/SamplerManager.d.ts +26 -0
- package/lib/Render/SamplerManager.js +42 -0
- package/lib/Render/SamplerManager.js.map +1 -0
- package/lib/Render/SceneUpdate.d.ts +9 -0
- package/lib/Render/SceneUpdate.js +18 -0
- package/lib/Render/SceneUpdate.js.map +1 -0
- package/lib/Render/TextureManager.d.ts +33 -0
- package/lib/Render/TextureManager.js +152 -0
- package/lib/Render/TextureManager.js.map +1 -0
- package/lib/Render/index.d.ts +212 -0
- package/lib/Render/index.js +347 -0
- package/lib/Render/index.js.map +1 -0
- package/lib/Render/types.d.ts +191 -0
- package/lib/Scene/index.d.ts +124 -0
- package/lib/Scene/index.js +225 -0
- package/lib/Scene/index.js.map +1 -0
- package/lib/Style/EdgeStyle.d.ts +28 -0
- package/lib/Style/EdgeStyle.js +67 -0
- package/lib/Style/EdgeStyle.js.map +1 -0
- package/lib/Style/JoinStyle.d.ts +27 -0
- package/lib/Style/JoinStyle.js +53 -0
- package/lib/Style/JoinStyle.js.map +1 -0
- package/lib/Style/PartStyle.d.ts +50 -0
- package/lib/Style/PartStyle.js +92 -0
- package/lib/Style/PartStyle.js.map +1 -0
- package/lib/Style/PointsStyle.d.ts +43 -0
- package/lib/Style/PointsStyle.js +98 -0
- package/lib/Style/PointsStyle.js.map +1 -0
- package/lib/Style/SolidStyle.d.ts +37 -0
- package/lib/Style/SolidStyle.js +83 -0
- package/lib/Style/SolidStyle.js.map +1 -0
- package/lib/Style/TexturedStyle.d.ts +29 -0
- package/lib/Style/TexturedStyle.js +66 -0
- package/lib/Style/TexturedStyle.js.map +1 -0
- package/lib/Style/WireframeStyle.d.ts +7 -0
- package/lib/Style/WireframeStyle.js +13 -0
- package/lib/Style/WireframeStyle.js.map +1 -0
- package/lib/Style/WriteStyleData.d.ts +10 -0
- package/lib/Style/WriteStyleData.js +59 -0
- package/lib/Style/WriteStyleData.js.map +1 -0
- package/lib/Style/index.d.ts +50 -0
- package/lib/Style/index.js +92 -0
- package/lib/Style/index.js.map +1 -0
- package/lib/Style/types.d.ts +21 -0
- package/lib/Texture/Layers.d.ts +26 -0
- package/lib/Texture/Layers.js +42 -0
- package/lib/Texture/Layers.js.map +1 -0
- package/lib/Texture/index.d.ts +116 -0
- package/lib/Texture/index.js +198 -0
- package/lib/Texture/index.js.map +1 -0
- package/lib/global-types.d.ts +8 -0
- package/lib/index.d.ts +43 -0
- package/lib/index.js +34 -0
- package/package.json +130 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import SolidStyle from "./SolidStyle.js";
|
|
2
|
+
import WireframeStyle from "./WireframeStyle.js";
|
|
3
|
+
import EdgeStyle from "./EdgeStyle.js";
|
|
4
|
+
import PointsStyle from "./PointsStyle.js";
|
|
5
|
+
import JoinStyle from "./JoinStyle.js";
|
|
6
|
+
import { STYLE_STRIDE, WriteStyleData } from "./WriteStyleData.js";
|
|
7
|
+
//#region src/scripts/Style/index.ts
|
|
8
|
+
/** 共享样式;四个显示分区与节点连接样式独立持有参数,通过订阅链通知使用者。 */
|
|
9
|
+
var Style = class {
|
|
10
|
+
_solid;
|
|
11
|
+
_wireframe;
|
|
12
|
+
_edge;
|
|
13
|
+
_points;
|
|
14
|
+
_join;
|
|
15
|
+
_subscribers = /* @__PURE__ */ new Set();
|
|
16
|
+
_version = 0;
|
|
17
|
+
/** 构建四个关闭的显示分区及默认尖角连接,并订阅它们的变化。 */
|
|
18
|
+
constructor() {
|
|
19
|
+
this._solid = new SolidStyle();
|
|
20
|
+
this._wireframe = new WireframeStyle();
|
|
21
|
+
this._edge = new EdgeStyle();
|
|
22
|
+
this._points = new PointsStyle();
|
|
23
|
+
this._join = new JoinStyle();
|
|
24
|
+
this._solid.add(this);
|
|
25
|
+
this._wireframe.add(this);
|
|
26
|
+
this._edge.add(this);
|
|
27
|
+
this._points.add(this);
|
|
28
|
+
this._join.add(this);
|
|
29
|
+
}
|
|
30
|
+
/** 实体面与 SDF 样式。 */
|
|
31
|
+
get solid() {
|
|
32
|
+
return this._solid;
|
|
33
|
+
}
|
|
34
|
+
/** 原生线框样式。 */
|
|
35
|
+
get wireframe() {
|
|
36
|
+
return this._wireframe;
|
|
37
|
+
}
|
|
38
|
+
/** 实体三角面边框样式。 */
|
|
39
|
+
get edge() {
|
|
40
|
+
return this._edge;
|
|
41
|
+
}
|
|
42
|
+
/** 关键点样式。 */
|
|
43
|
+
get points() {
|
|
44
|
+
return this._points;
|
|
45
|
+
}
|
|
46
|
+
/** 多边形连接类型和精度,由 Geometry.style 决定,不随实例单独生成。 */
|
|
47
|
+
get join() {
|
|
48
|
+
return this._join;
|
|
49
|
+
}
|
|
50
|
+
/** 任意分区变化时递增的单一版本。 */
|
|
51
|
+
get version() {
|
|
52
|
+
return this._version;
|
|
53
|
+
}
|
|
54
|
+
/** @param subscriber 几何、材质或未来实现通知协议的 IMesh */
|
|
55
|
+
add(subscriber) {
|
|
56
|
+
this._subscribers.add(subscriber);
|
|
57
|
+
}
|
|
58
|
+
/** @param subscriber 解除订阅的对象,不销毁资源 */
|
|
59
|
+
delete(subscriber) {
|
|
60
|
+
this._subscribers.delete(subscriber);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 最终停止使用时释放整条订阅链,不销毁共享颜色、贴图或 GPU 缓存。
|
|
64
|
+
* 仅在所有 Geometry / Material 均停止使用该 Style 后调用,不应再复用。
|
|
65
|
+
*/
|
|
66
|
+
dispose() {
|
|
67
|
+
this._solid.dispose();
|
|
68
|
+
this._wireframe.dispose();
|
|
69
|
+
this._edge.dispose();
|
|
70
|
+
this._points.dispose();
|
|
71
|
+
this._join.dispose();
|
|
72
|
+
this._subscribers.clear();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 将分区变化转发给使用者;接收者自行判断是否影响 CPU 几何。
|
|
76
|
+
* @param area 变化区域
|
|
77
|
+
* @param field 变化字段
|
|
78
|
+
*/
|
|
79
|
+
onPartChange(area, field) {
|
|
80
|
+
this._version++;
|
|
81
|
+
const change = Object.freeze({
|
|
82
|
+
source: this,
|
|
83
|
+
area,
|
|
84
|
+
field
|
|
85
|
+
});
|
|
86
|
+
for (const subscriber of [...this._subscribers]) subscriber.onStyleChange(change);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
//#endregion
|
|
90
|
+
export { EdgeStyle, JoinStyle, PointsStyle, STYLE_STRIDE, SolidStyle, WireframeStyle, WriteStyleData, Style as default };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/scripts/Style/index.ts"],"sourcesContent":["import SolidStyle from \"./SolidStyle\";\nimport WireframeStyle from \"./WireframeStyle\";\nimport EdgeStyle from \"./EdgeStyle\";\nimport PointsStyle from \"./PointsStyle\";\nimport JoinStyle from \"./JoinStyle\";\nimport type { PartSubscriber, StyleArea, StyleSubscriber } from \"./types\";\n\n/** 共享样式;四个显示分区与节点连接样式独立持有参数,通过订阅链通知使用者。 */\nclass Style implements PartSubscriber {\n private readonly _solid: SolidStyle;\n private readonly _wireframe: WireframeStyle;\n private readonly _edge: EdgeStyle;\n private readonly _points: PointsStyle;\n private readonly _join: JoinStyle;\n private readonly _subscribers = new Set<StyleSubscriber>();\n private _version: number = 0;\n\n /** 构建四个关闭的显示分区及默认尖角连接,并订阅它们的变化。 */\n public constructor() {\n this._solid = new SolidStyle();\n this._wireframe = new WireframeStyle();\n this._edge = new EdgeStyle();\n this._points = new PointsStyle();\n this._join = new JoinStyle();\n this._solid.add(this);\n this._wireframe.add(this);\n this._edge.add(this);\n this._points.add(this);\n this._join.add(this);\n }\n /** 实体面与 SDF 样式。 */\n public get solid(): SolidStyle { return this._solid; }\n /** 原生线框样式。 */\n public get wireframe(): WireframeStyle { return this._wireframe; }\n /** 实体三角面边框样式。 */\n public get edge(): EdgeStyle { return this._edge; }\n /** 关键点样式。 */\n public get points(): PointsStyle { return this._points; }\n /** 多边形连接类型和精度,由 Geometry.style 决定,不随实例单独生成。 */\n public get join(): JoinStyle { return this._join; }\n /** 任意分区变化时递增的单一版本。 */\n public get version(): number { return this._version; }\n\n /** @param subscriber 几何、材质或未来实现通知协议的 IMesh */\n public add(subscriber: StyleSubscriber): void { this._subscribers.add(subscriber); }\n /** @param subscriber 解除订阅的对象,不销毁资源 */\n public delete(subscriber: StyleSubscriber): void { this._subscribers.delete(subscriber); }\n\n /**\n * 最终停止使用时释放整条订阅链,不销毁共享颜色、贴图或 GPU 缓存。\n * 仅在所有 Geometry / Material 均停止使用该 Style 后调用,不应再复用。\n */\n public dispose(): void {\n this._solid.dispose();\n this._wireframe.dispose();\n this._edge.dispose();\n this._points.dispose();\n this._join.dispose();\n this._subscribers.clear();\n }\n\n /**\n * 将分区变化转发给使用者;接收者自行判断是否影响 CPU 几何。\n * @param area 变化区域\n * @param field 变化字段\n */\n public onPartChange(area: Exclude<StyleArea, \"whole\">, field: string): void {\n this._version++;\n const change = Object.freeze({ source: this, area, field });\n for (const subscriber of [...this._subscribers]) subscriber.onStyleChange(change);\n }\n}\nexport default Style;\nexport { SolidStyle, WireframeStyle, EdgeStyle, PointsStyle, JoinStyle };\nexport type { JoinType } from \"./JoinStyle\";\nexport { WriteStyleData, STYLE_STRIDE } from \"./WriteStyleData\";\nexport type { StyleArea, StyleChange, StyleSubscriber, BorderAlign, PixelAligned, PartSubscriber } from \"./types\";\n"],"mappings":";;;;;;;;AAQA,IAAM,QAAN,MAAsC;CAClC;CACA;CACA;CACA;CACA;CACA,+BAAgC,IAAI,IAAqB;CACzD,WAA2B;;CAG3B,cAAqB;EACjB,KAAK,SAAS,IAAI,WAAW;EAC7B,KAAK,aAAa,IAAI,eAAe;EACrC,KAAK,QAAQ,IAAI,UAAU;EAC3B,KAAK,UAAU,IAAI,YAAY;EAC/B,KAAK,QAAQ,IAAI,UAAU;EAC3B,KAAK,OAAO,IAAI,IAAI;EACpB,KAAK,WAAW,IAAI,IAAI;EACxB,KAAK,MAAM,IAAI,IAAI;EACnB,KAAK,QAAQ,IAAI,IAAI;EACrB,KAAK,MAAM,IAAI,IAAI;CACvB;;CAEA,IAAW,QAAoB;EAAE,OAAO,KAAK;CAAQ;;CAErD,IAAW,YAA4B;EAAE,OAAO,KAAK;CAAY;;CAEjE,IAAW,OAAkB;EAAE,OAAO,KAAK;CAAO;;CAElD,IAAW,SAAsB;EAAE,OAAO,KAAK;CAAS;;CAExD,IAAW,OAAkB;EAAE,OAAO,KAAK;CAAO;;CAElD,IAAW,UAAkB;EAAE,OAAO,KAAK;CAAU;;CAGrD,IAAW,YAAmC;EAAE,KAAK,aAAa,IAAI,UAAU;CAAG;;CAEnF,OAAc,YAAmC;EAAE,KAAK,aAAa,OAAO,UAAU;CAAG;;;;;CAMzF,UAAuB;EACnB,KAAK,OAAO,QAAQ;EACpB,KAAK,WAAW,QAAQ;EACxB,KAAK,MAAM,QAAQ;EACnB,KAAK,QAAQ,QAAQ;EACrB,KAAK,MAAM,QAAQ;EACnB,KAAK,aAAa,MAAM;CAC5B;;;;;;CAOA,aAAoB,MAAmC,OAAqB;EACxE,KAAK;EACL,MAAM,SAAS,OAAO,OAAO;GAAE,QAAQ;GAAM;GAAM;EAAM,CAAC;EAC1D,KAAK,MAAM,cAAc,CAAC,GAAG,KAAK,YAAY,GAAG,WAAW,cAAc,MAAM;CACpF;AACJ"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type Style from "./index";
|
|
2
|
+
/** 样式通知区域,whole 表示更换整个 Style。 */
|
|
3
|
+
export type StyleArea = "solid" | "wireframe" | "edge" | "points" | "join" | "whole";
|
|
4
|
+
/** 边框对齐方式。 */
|
|
5
|
+
export type BorderAlign = "inset" | "normal" | "outset";
|
|
6
|
+
/** px 固定屏幕像素,zoom 跟随相机缩放。 */
|
|
7
|
+
export type PixelAligned = "px" | "zoom";
|
|
8
|
+
/** 不携带 GPU 缓存的样式变化通知。 */
|
|
9
|
+
export interface StyleChange {
|
|
10
|
+
readonly source: Style;
|
|
11
|
+
readonly area: StyleArea;
|
|
12
|
+
readonly field: string;
|
|
13
|
+
}
|
|
14
|
+
/** 开放式订阅协议;Geometry、Material 和未来 IMesh 都可实现。 */
|
|
15
|
+
export interface StyleSubscriber {
|
|
16
|
+
onStyleChange(change: StyleChange): void;
|
|
17
|
+
}
|
|
18
|
+
/** 分区通知接收者,通常是所属 Style。 */
|
|
19
|
+
export interface PartSubscriber {
|
|
20
|
+
onPartChange(area: Exclude<StyleArea, "whole">, field: string): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TextureLike, TextureSubscriber } from "./index";
|
|
2
|
+
/** 可上传贴图资源:单图也以一层的 2d-array 视图绑定。 */
|
|
3
|
+
export type TextureResource = TextureLike | TextureLayers;
|
|
4
|
+
/** 多层纹理的 CPU 引用集合,GPUTexture 仍只属于 Render。 */
|
|
5
|
+
declare class TextureLayers implements TextureSubscriber {
|
|
6
|
+
/** 数组资源 ID,与层内图片 ID 独立。 */
|
|
7
|
+
readonly id: number;
|
|
8
|
+
/** 对象类型。 */
|
|
9
|
+
readonly type: string;
|
|
10
|
+
private _version;
|
|
11
|
+
private _layers;
|
|
12
|
+
/** 任一源图或层表变化时递增。 */
|
|
13
|
+
get version(): number;
|
|
14
|
+
/** 有序层表;undefined 对应白色,不改变其他层的编号。 */
|
|
15
|
+
get layers(): readonly (TextureLike | undefined)[];
|
|
16
|
+
/**
|
|
17
|
+
* 原子替换层表;相同引用序列不更新,不保留废弃源的订阅。
|
|
18
|
+
* @param layers 有序图片列表,由 IMesh 统一维护
|
|
19
|
+
*/
|
|
20
|
+
set(layers: readonly (TextureLike | undefined)[]): void;
|
|
21
|
+
/** @param texture 已订阅图片,更新像素不需要重打包实例样式 */
|
|
22
|
+
onTextureChange(texture: TextureLike): void;
|
|
23
|
+
/** 解除图片订阅,不销毁共享图片或 GPU 缓存。 */
|
|
24
|
+
dispose(): void;
|
|
25
|
+
}
|
|
26
|
+
export default TextureLayers;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GETID } from "../ID.js";
|
|
2
|
+
//#region src/scripts/Texture/Layers.ts
|
|
3
|
+
/** 多层纹理的 CPU 引用集合,GPUTexture 仍只属于 Render。 */
|
|
4
|
+
var TextureLayers = class {
|
|
5
|
+
/** 数组资源 ID,与层内图片 ID 独立。 */
|
|
6
|
+
id = GETID();
|
|
7
|
+
/** 对象类型。 */
|
|
8
|
+
type = "TextureLayers";
|
|
9
|
+
_version = 0;
|
|
10
|
+
_layers = [];
|
|
11
|
+
/** 任一源图或层表变化时递增。 */
|
|
12
|
+
get version() {
|
|
13
|
+
return this._version;
|
|
14
|
+
}
|
|
15
|
+
/** 有序层表;undefined 对应白色,不改变其他层的编号。 */
|
|
16
|
+
get layers() {
|
|
17
|
+
return this._layers;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 原子替换层表;相同引用序列不更新,不保留废弃源的订阅。
|
|
21
|
+
* @param layers 有序图片列表,由 IMesh 统一维护
|
|
22
|
+
*/
|
|
23
|
+
set(layers) {
|
|
24
|
+
if (layers.length === this._layers.length && layers.every((item, index) => item === this._layers[index])) return;
|
|
25
|
+
for (const texture of this._layers) texture?.delete(this);
|
|
26
|
+
this._layers = Object.freeze([...layers]);
|
|
27
|
+
for (const texture of this._layers) texture?.add(this);
|
|
28
|
+
this._version++;
|
|
29
|
+
}
|
|
30
|
+
/** @param texture 已订阅图片,更新像素不需要重打包实例样式 */
|
|
31
|
+
onTextureChange(texture) {
|
|
32
|
+
if (this._layers.includes(texture)) this._version++;
|
|
33
|
+
}
|
|
34
|
+
/** 解除图片订阅,不销毁共享图片或 GPU 缓存。 */
|
|
35
|
+
dispose() {
|
|
36
|
+
this.set([]);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { TextureLayers as default };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=Layers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layers.js","names":[],"sources":["../../src/scripts/Texture/Layers.ts"],"sourcesContent":["import { GETID } from \"../ID\";\nimport type { TextureLike, TextureSubscriber } from \"./index\";\n\n/** 可上传贴图资源:单图也以一层的 2d-array 视图绑定。 */\nexport type TextureResource = TextureLike | TextureLayers;\n\n/** 多层纹理的 CPU 引用集合,GPUTexture 仍只属于 Render。 */\nclass TextureLayers implements TextureSubscriber {\n /** 数组资源 ID,与层内图片 ID 独立。 */\n public readonly id: number = GETID();\n /** 对象类型。 */\n public readonly type: string = \"TextureLayers\";\n private _version: number = 0;\n private _layers: readonly (TextureLike | undefined)[] = [];\n /** 任一源图或层表变化时递增。 */\n public get version(): number { return this._version; }\n /** 有序层表;undefined 对应白色,不改变其他层的编号。 */\n public get layers(): readonly (TextureLike | undefined)[] { return this._layers; }\n /**\n * 原子替换层表;相同引用序列不更新,不保留废弃源的订阅。\n * @param layers 有序图片列表,由 IMesh 统一维护\n */\n public set(layers: readonly (TextureLike | undefined)[]): void {\n if (layers.length === this._layers.length && layers.every((item, index): boolean => item === this._layers[index])) return;\n for (const texture of this._layers) texture?.delete(this);\n this._layers = Object.freeze([...layers]);\n for (const texture of this._layers) texture?.add(this);\n this._version++;\n }\n /** @param texture 已订阅图片,更新像素不需要重打包实例样式 */\n public onTextureChange(texture: TextureLike): void {\n if (this._layers.includes(texture)) this._version++;\n }\n /** 解除图片订阅,不销毁共享图片或 GPU 缓存。 */\n public dispose(): void { this.set([]); }\n}\n\nexport default TextureLayers;\n"],"mappings":";;;AAOA,IAAM,gBAAN,MAAiD;;CAE7C,KAA6B,MAAM;;CAEnC,OAA+B;CAC/B,WAA2B;CAC3B,UAAwD,CAAC;;CAEzD,IAAW,UAAkB;EAAE,OAAO,KAAK;CAAU;;CAErD,IAAW,SAA+C;EAAE,OAAO,KAAK;CAAS;;;;;CAKjF,IAAW,QAAoD;EAC3D,IAAI,OAAO,WAAW,KAAK,QAAQ,UAAU,OAAO,OAAO,MAAM,UAAmB,SAAS,KAAK,QAAQ,MAAM,GAAG;EACnH,KAAK,MAAM,WAAW,KAAK,SAAS,SAAS,OAAO,IAAI;EACxD,KAAK,UAAU,OAAO,OAAO,CAAC,GAAG,MAAM,CAAC;EACxC,KAAK,MAAM,WAAW,KAAK,SAAS,SAAS,IAAI,IAAI;EACrD,KAAK;CACT;;CAEA,gBAAuB,SAA4B;EAC/C,IAAI,KAAK,QAAQ,SAAS,OAAO,GAAG,KAAK;CAC7C;;CAEA,UAAuB;EAAE,KAAK,IAAI,CAAC,CAAC;CAAG;AAC3C"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
type TextureSource = HTMLImageElement | ImageBitmap | ImageData;
|
|
2
|
+
/** 贴图消费者,通常由 Style 的贴图分区实现。 */
|
|
3
|
+
interface TextureSubscriber {
|
|
4
|
+
onTextureChange(texture: TextureLike): void;
|
|
5
|
+
}
|
|
6
|
+
interface TextureLike {
|
|
7
|
+
readonly id: number;
|
|
8
|
+
readonly type: string;
|
|
9
|
+
readonly version: number;
|
|
10
|
+
url: string | null;
|
|
11
|
+
source: TextureSource | null;
|
|
12
|
+
loaded: boolean;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
add(subscriber: TextureSubscriber): void;
|
|
16
|
+
delete(subscriber: TextureSubscriber): void;
|
|
17
|
+
updateVersion(): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 贴图对象
|
|
21
|
+
* 用于描述贴图资源本身
|
|
22
|
+
* 不直接绑定具体渲染后端的 GPU 纹理对象
|
|
23
|
+
* @class
|
|
24
|
+
*/
|
|
25
|
+
declare class Texture implements TextureLike {
|
|
26
|
+
/**
|
|
27
|
+
* 全局唯一贴图 ID
|
|
28
|
+
*/
|
|
29
|
+
readonly id: number;
|
|
30
|
+
/**
|
|
31
|
+
* 对象类型
|
|
32
|
+
*/
|
|
33
|
+
readonly type: string;
|
|
34
|
+
private _version;
|
|
35
|
+
private readonly _subscribers;
|
|
36
|
+
/**
|
|
37
|
+
* 贴图来源地址
|
|
38
|
+
*/
|
|
39
|
+
private _url;
|
|
40
|
+
/**
|
|
41
|
+
* 贴图源数据
|
|
42
|
+
*/
|
|
43
|
+
private _source;
|
|
44
|
+
/**
|
|
45
|
+
* 是否已加载完成
|
|
46
|
+
*/
|
|
47
|
+
private _loaded;
|
|
48
|
+
/**
|
|
49
|
+
* 贴图宽度
|
|
50
|
+
*/
|
|
51
|
+
private _width;
|
|
52
|
+
/**
|
|
53
|
+
* 贴图高度
|
|
54
|
+
*/
|
|
55
|
+
private _height;
|
|
56
|
+
/**
|
|
57
|
+
* 创建贴图对象
|
|
58
|
+
*/
|
|
59
|
+
constructor();
|
|
60
|
+
/** 单一贴图版本,每个 Render 独立记录已上传版本。 */
|
|
61
|
+
get version(): number;
|
|
62
|
+
/** 贴图来源地址;修改地址本身不会自动下载。 */
|
|
63
|
+
get url(): string | null;
|
|
64
|
+
/** @param value 来源地址,下载使用 load */
|
|
65
|
+
set url(value: string | null);
|
|
66
|
+
/** 当前浏览器图片源。 */
|
|
67
|
+
get source(): TextureSource | null;
|
|
68
|
+
/** @param value 新图片源;同步更新宽高和 loaded,null 清空 */
|
|
69
|
+
set source(value: TextureSource | null);
|
|
70
|
+
/** 当前图片是否可上传。 */
|
|
71
|
+
get loaded(): boolean;
|
|
72
|
+
/** @param value 是否已加载;正常情况由 setSource / clearSource 自动维护 */
|
|
73
|
+
set loaded(value: boolean);
|
|
74
|
+
/** 图片宽度,单位为源像素。 */
|
|
75
|
+
get width(): number;
|
|
76
|
+
/** @param value 源像素宽度,必须为非负整数 */
|
|
77
|
+
set width(value: number);
|
|
78
|
+
/** 图片高度,单位为源像素。 */
|
|
79
|
+
get height(): number;
|
|
80
|
+
/** @param value 源像素高度,必须为非负整数 */
|
|
81
|
+
set height(value: number);
|
|
82
|
+
/**
|
|
83
|
+
* 关联贴图消费者;多个分区可以共享同一 Texture。
|
|
84
|
+
* @param subscriber 消费者,重复 add 不会重复通知
|
|
85
|
+
*/
|
|
86
|
+
add(subscriber: TextureSubscriber): void;
|
|
87
|
+
/**
|
|
88
|
+
* 解绑贴图消费者,不销毁图片源和任何 Render 的缓存。
|
|
89
|
+
* @param subscriber 需要解绑的消费者
|
|
90
|
+
*/
|
|
91
|
+
delete(subscriber: TextureSubscriber): void;
|
|
92
|
+
/** 原地修改图片像素后手动递增版本并通知;各 Render 独立消费,不存在清除版本操作。 */
|
|
93
|
+
updateVersion(): void;
|
|
94
|
+
/**
|
|
95
|
+
* 设置贴图源数据
|
|
96
|
+
* @param source 贴图源数据
|
|
97
|
+
* @param url 贴图来源地址
|
|
98
|
+
* @returns 当前贴图对象
|
|
99
|
+
*/
|
|
100
|
+
setSource(source: TextureSource, url?: string | null): this;
|
|
101
|
+
/**
|
|
102
|
+
* 清空贴图源数据
|
|
103
|
+
* @returns 当前贴图对象
|
|
104
|
+
*/
|
|
105
|
+
clearSource(): this;
|
|
106
|
+
/**
|
|
107
|
+
* 从地址加载贴图
|
|
108
|
+
* @param url 贴图地址
|
|
109
|
+
* @returns 当前贴图对象
|
|
110
|
+
*/
|
|
111
|
+
load(url: string): Promise<this>;
|
|
112
|
+
}
|
|
113
|
+
export default Texture;
|
|
114
|
+
export type { TextureLike, TextureSource, TextureSubscriber };
|
|
115
|
+
export { default as TextureLayers } from "./Layers";
|
|
116
|
+
export type { TextureResource } from "./Layers";
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { GETID } from "../ID.js";
|
|
2
|
+
import TextureLayers from "./Layers.js";
|
|
3
|
+
//#region src/scripts/Texture/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* 贴图对象
|
|
6
|
+
* 用于描述贴图资源本身
|
|
7
|
+
* 不直接绑定具体渲染后端的 GPU 纹理对象
|
|
8
|
+
* @class
|
|
9
|
+
*/
|
|
10
|
+
var Texture = class {
|
|
11
|
+
/**
|
|
12
|
+
* 全局唯一贴图 ID
|
|
13
|
+
*/
|
|
14
|
+
id;
|
|
15
|
+
/**
|
|
16
|
+
* 对象类型
|
|
17
|
+
*/
|
|
18
|
+
type = "Texture";
|
|
19
|
+
_version = 0;
|
|
20
|
+
_subscribers = /* @__PURE__ */ new Set();
|
|
21
|
+
/**
|
|
22
|
+
* 贴图来源地址
|
|
23
|
+
*/
|
|
24
|
+
_url = null;
|
|
25
|
+
/**
|
|
26
|
+
* 贴图源数据
|
|
27
|
+
*/
|
|
28
|
+
_source = null;
|
|
29
|
+
/**
|
|
30
|
+
* 是否已加载完成
|
|
31
|
+
*/
|
|
32
|
+
_loaded = false;
|
|
33
|
+
/**
|
|
34
|
+
* 贴图宽度
|
|
35
|
+
*/
|
|
36
|
+
_width = 0;
|
|
37
|
+
/**
|
|
38
|
+
* 贴图高度
|
|
39
|
+
*/
|
|
40
|
+
_height = 0;
|
|
41
|
+
/**
|
|
42
|
+
* 创建贴图对象
|
|
43
|
+
*/
|
|
44
|
+
constructor() {
|
|
45
|
+
this.id = GETID();
|
|
46
|
+
}
|
|
47
|
+
/** 单一贴图版本,每个 Render 独立记录已上传版本。 */
|
|
48
|
+
get version() {
|
|
49
|
+
return this._version;
|
|
50
|
+
}
|
|
51
|
+
/** 贴图来源地址;修改地址本身不会自动下载。 */
|
|
52
|
+
get url() {
|
|
53
|
+
return this._url;
|
|
54
|
+
}
|
|
55
|
+
/** @param value 来源地址,下载使用 load */
|
|
56
|
+
set url(value) {
|
|
57
|
+
if (this._url === value) return;
|
|
58
|
+
this._url = value;
|
|
59
|
+
this.updateVersion();
|
|
60
|
+
}
|
|
61
|
+
/** 当前浏览器图片源。 */
|
|
62
|
+
get source() {
|
|
63
|
+
return this._source;
|
|
64
|
+
}
|
|
65
|
+
/** @param value 新图片源;同步更新宽高和 loaded,null 清空 */
|
|
66
|
+
set source(value) {
|
|
67
|
+
if (this._source === value) return;
|
|
68
|
+
if (value === null) this.clearSource();
|
|
69
|
+
else this.setSource(value, this._url);
|
|
70
|
+
}
|
|
71
|
+
/** 当前图片是否可上传。 */
|
|
72
|
+
get loaded() {
|
|
73
|
+
return this._loaded;
|
|
74
|
+
}
|
|
75
|
+
/** @param value 是否已加载;正常情况由 setSource / clearSource 自动维护 */
|
|
76
|
+
set loaded(value) {
|
|
77
|
+
if (this._loaded === value) return;
|
|
78
|
+
this._loaded = value;
|
|
79
|
+
this.updateVersion();
|
|
80
|
+
}
|
|
81
|
+
/** 图片宽度,单位为源像素。 */
|
|
82
|
+
get width() {
|
|
83
|
+
return this._width;
|
|
84
|
+
}
|
|
85
|
+
/** @param value 源像素宽度,必须为非负整数 */
|
|
86
|
+
set width(value) {
|
|
87
|
+
if (!Number.isInteger(value) || value < 0) throw new RangeError("Texture width must be a non-negative integer.");
|
|
88
|
+
if (this._width === value) return;
|
|
89
|
+
this._width = value;
|
|
90
|
+
this.updateVersion();
|
|
91
|
+
}
|
|
92
|
+
/** 图片高度,单位为源像素。 */
|
|
93
|
+
get height() {
|
|
94
|
+
return this._height;
|
|
95
|
+
}
|
|
96
|
+
/** @param value 源像素高度,必须为非负整数 */
|
|
97
|
+
set height(value) {
|
|
98
|
+
if (!Number.isInteger(value) || value < 0) throw new RangeError("Texture height must be a non-negative integer.");
|
|
99
|
+
if (this._height === value) return;
|
|
100
|
+
this._height = value;
|
|
101
|
+
this.updateVersion();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 关联贴图消费者;多个分区可以共享同一 Texture。
|
|
105
|
+
* @param subscriber 消费者,重复 add 不会重复通知
|
|
106
|
+
*/
|
|
107
|
+
add(subscriber) {
|
|
108
|
+
this._subscribers.add(subscriber);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 解绑贴图消费者,不销毁图片源和任何 Render 的缓存。
|
|
112
|
+
* @param subscriber 需要解绑的消费者
|
|
113
|
+
*/
|
|
114
|
+
delete(subscriber) {
|
|
115
|
+
this._subscribers.delete(subscriber);
|
|
116
|
+
}
|
|
117
|
+
/** 原地修改图片像素后手动递增版本并通知;各 Render 独立消费,不存在清除版本操作。 */
|
|
118
|
+
updateVersion() {
|
|
119
|
+
this._version++;
|
|
120
|
+
for (const subscriber of [...this._subscribers]) subscriber.onTextureChange(this);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 设置贴图源数据
|
|
124
|
+
* @param source 贴图源数据
|
|
125
|
+
* @param url 贴图来源地址
|
|
126
|
+
* @returns 当前贴图对象
|
|
127
|
+
*/
|
|
128
|
+
setSource(source, url = null) {
|
|
129
|
+
this._url = url;
|
|
130
|
+
this._source = source;
|
|
131
|
+
this._loaded = true;
|
|
132
|
+
this._width = GetTextureWidth(source);
|
|
133
|
+
this._height = GetTextureHeight(source);
|
|
134
|
+
this.updateVersion();
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 清空贴图源数据
|
|
139
|
+
* @returns 当前贴图对象
|
|
140
|
+
*/
|
|
141
|
+
clearSource() {
|
|
142
|
+
this._url = null;
|
|
143
|
+
this._source = null;
|
|
144
|
+
this._loaded = false;
|
|
145
|
+
this._width = 0;
|
|
146
|
+
this._height = 0;
|
|
147
|
+
this.updateVersion();
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 从地址加载贴图
|
|
152
|
+
* @param url 贴图地址
|
|
153
|
+
* @returns 当前贴图对象
|
|
154
|
+
*/
|
|
155
|
+
async load(url) {
|
|
156
|
+
const image = await LoadImage(url);
|
|
157
|
+
return this.setSource(image, url);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* 加载图片元素
|
|
162
|
+
* @param url 图片地址
|
|
163
|
+
* @returns 图片元素
|
|
164
|
+
*/
|
|
165
|
+
var LoadImage = (url) => {
|
|
166
|
+
return new Promise((resolve, reject) => {
|
|
167
|
+
const image = new Image();
|
|
168
|
+
image.onload = () => {
|
|
169
|
+
resolve(image);
|
|
170
|
+
};
|
|
171
|
+
image.onerror = () => {
|
|
172
|
+
reject(/* @__PURE__ */ new Error(`Texture load failed: ${url}`));
|
|
173
|
+
};
|
|
174
|
+
image.src = url;
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* 获取贴图宽度
|
|
179
|
+
* @param source 贴图源数据
|
|
180
|
+
* @returns 贴图宽度
|
|
181
|
+
*/
|
|
182
|
+
var GetTextureWidth = (source) => {
|
|
183
|
+
if ("naturalWidth" in source) return source.naturalWidth;
|
|
184
|
+
return source.width;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* 获取贴图高度
|
|
188
|
+
* @param source 贴图源数据
|
|
189
|
+
* @returns 贴图高度
|
|
190
|
+
*/
|
|
191
|
+
var GetTextureHeight = (source) => {
|
|
192
|
+
if ("naturalHeight" in source) return source.naturalHeight;
|
|
193
|
+
return source.height;
|
|
194
|
+
};
|
|
195
|
+
//#endregion
|
|
196
|
+
export { TextureLayers, Texture as default };
|
|
197
|
+
|
|
198
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/scripts/Texture/index.ts"],"sourcesContent":["import { GETID } from \"../ID\";\n\ntype TextureSource = HTMLImageElement | ImageBitmap | ImageData;\n\n/** 贴图消费者,通常由 Style 的贴图分区实现。 */\ninterface TextureSubscriber {\n onTextureChange(texture: TextureLike): void;\n}\n\ninterface TextureLike {\n readonly id: number;\n readonly type: string;\n readonly version: number;\n url: string | null;\n source: TextureSource | null;\n loaded: boolean;\n width: number;\n height: number;\n add(subscriber: TextureSubscriber): void;\n delete(subscriber: TextureSubscriber): void;\n updateVersion(): void;\n}\n\n/**\n * 贴图对象\n * 用于描述贴图资源本身\n * 不直接绑定具体渲染后端的 GPU 纹理对象\n * @class\n */\nclass Texture implements TextureLike {\n /**\n * 全局唯一贴图 ID\n */\n public readonly id: number;\n\n /**\n * 对象类型\n */\n public readonly type: string = \"Texture\";\n\n private _version: number = 0;\n private readonly _subscribers = new Set<TextureSubscriber>();\n\n /**\n * 贴图来源地址\n */\n private _url: string | null = null;\n\n /**\n * 贴图源数据\n */\n private _source: TextureSource | null = null;\n\n /**\n * 是否已加载完成\n */\n private _loaded: boolean = false;\n\n /**\n * 贴图宽度\n */\n private _width: number = 0;\n\n /**\n * 贴图高度\n */\n private _height: number = 0;\n\n /**\n * 创建贴图对象\n */\n public constructor() {\n this.id = GETID();\n }\n\n /** 单一贴图版本,每个 Render 独立记录已上传版本。 */\n public get version(): number { return this._version; }\n /** 贴图来源地址;修改地址本身不会自动下载。 */\n public get url(): string | null { return this._url; }\n /** @param value 来源地址,下载使用 load */\n public set url(value: string | null) {\n if (this._url === value) return;\n this._url = value;\n this.updateVersion();\n }\n /** 当前浏览器图片源。 */\n public get source(): TextureSource | null { return this._source; }\n /** @param value 新图片源;同步更新宽高和 loaded,null 清空 */\n public set source(value: TextureSource | null) {\n if (this._source === value) return;\n if (value === null) this.clearSource();\n else this.setSource(value, this._url);\n }\n /** 当前图片是否可上传。 */\n public get loaded(): boolean { return this._loaded; }\n /** @param value 是否已加载;正常情况由 setSource / clearSource 自动维护 */\n public set loaded(value: boolean) {\n if (this._loaded === value) return;\n this._loaded = value;\n this.updateVersion();\n }\n /** 图片宽度,单位为源像素。 */\n public get width(): number { return this._width; }\n /** @param value 源像素宽度,必须为非负整数 */\n public set width(value: number) {\n if (!Number.isInteger(value) || value < 0) throw new RangeError(\"Texture width must be a non-negative integer.\");\n if (this._width === value) return;\n this._width = value;\n this.updateVersion();\n }\n /** 图片高度,单位为源像素。 */\n public get height(): number { return this._height; }\n /** @param value 源像素高度,必须为非负整数 */\n public set height(value: number) {\n if (!Number.isInteger(value) || value < 0) throw new RangeError(\"Texture height must be a non-negative integer.\");\n if (this._height === value) return;\n this._height = value;\n this.updateVersion();\n }\n\n /**\n * 关联贴图消费者;多个分区可以共享同一 Texture。\n * @param subscriber 消费者,重复 add 不会重复通知\n */\n public add(subscriber: TextureSubscriber): void {\n this._subscribers.add(subscriber);\n }\n /**\n * 解绑贴图消费者,不销毁图片源和任何 Render 的缓存。\n * @param subscriber 需要解绑的消费者\n */\n public delete(subscriber: TextureSubscriber): void {\n this._subscribers.delete(subscriber);\n }\n\n /** 原地修改图片像素后手动递增版本并通知;各 Render 独立消费,不存在清除版本操作。 */\n public updateVersion(): void {\n this._version++;\n for (const subscriber of [...this._subscribers]) subscriber.onTextureChange(this);\n }\n\n /**\n * 设置贴图源数据\n * @param source 贴图源数据\n * @param url 贴图来源地址\n * @returns 当前贴图对象\n */\n public setSource(source: TextureSource, url: string | null = null): this {\n // 原子提交:消费者不会看到“新图片配旧宽高”的中间状态,只通知一次。\n this._url = url;\n this._source = source;\n this._loaded = true;\n this._width = GetTextureWidth(source);\n this._height = GetTextureHeight(source);\n this.updateVersion();\n\n return this;\n }\n\n /**\n * 清空贴图源数据\n * @returns 当前贴图对象\n */\n public clearSource(): this {\n this._url = null;\n this._source = null;\n this._loaded = false;\n this._width = 0;\n this._height = 0;\n this.updateVersion();\n\n return this;\n }\n\n /**\n * 从地址加载贴图\n * @param url 贴图地址\n * @returns 当前贴图对象\n */\n public async load(url: string): Promise<this> {\n const image = await LoadImage(url);\n\n return this.setSource(image, url);\n }\n}\n\n/**\n * 加载图片元素\n * @param url 图片地址\n * @returns 图片元素\n */\nconst LoadImage = (url: string): Promise<HTMLImageElement> => {\n return new Promise((resolve, reject) => {\n const image = new Image();\n\n image.onload = () => {\n resolve(image);\n };\n\n image.onerror = () => {\n reject(new Error(`Texture load failed: ${url}`));\n };\n\n image.src = url;\n });\n};\n\n/**\n * 获取贴图宽度\n * @param source 贴图源数据\n * @returns 贴图宽度\n */\nconst GetTextureWidth = (source: TextureSource): number => {\n if (\"naturalWidth\" in source) {\n return source.naturalWidth;\n }\n\n return source.width;\n};\n\n/**\n * 获取贴图高度\n * @param source 贴图源数据\n * @returns 贴图高度\n */\nconst GetTextureHeight = (source: TextureSource): number => {\n if (\"naturalHeight\" in source) {\n return source.naturalHeight;\n }\n\n return source.height;\n};\n\nexport default Texture;\nexport type { TextureLike, TextureSource, TextureSubscriber };\nexport { default as TextureLayers } from \"./Layers\";\nexport type { TextureResource } from \"./Layers\";\n"],"mappings":";;;;;;;;;AA6BA,IAAM,UAAN,MAAqC;;;;CAIjC;;;;CAKA,OAA+B;CAE/B,WAA2B;CAC3B,+BAAgC,IAAI,IAAuB;;;;CAK3D,OAA8B;;;;CAK9B,UAAwC;;;;CAKxC,UAA2B;;;;CAK3B,SAAyB;;;;CAKzB,UAA0B;;;;CAK1B,cAAqB;EACjB,KAAK,KAAK,MAAM;CACpB;;CAGA,IAAW,UAAkB;EAAE,OAAO,KAAK;CAAU;;CAErD,IAAW,MAAqB;EAAE,OAAO,KAAK;CAAM;;CAEpD,IAAW,IAAI,OAAsB;EACjC,IAAI,KAAK,SAAS,OAAO;EACzB,KAAK,OAAO;EACZ,KAAK,cAAc;CACvB;;CAEA,IAAW,SAA+B;EAAE,OAAO,KAAK;CAAS;;CAEjE,IAAW,OAAO,OAA6B;EAC3C,IAAI,KAAK,YAAY,OAAO;EAC5B,IAAI,UAAU,MAAM,KAAK,YAAY;OAChC,KAAK,UAAU,OAAO,KAAK,IAAI;CACxC;;CAEA,IAAW,SAAkB;EAAE,OAAO,KAAK;CAAS;;CAEpD,IAAW,OAAO,OAAgB;EAC9B,IAAI,KAAK,YAAY,OAAO;EAC5B,KAAK,UAAU;EACf,KAAK,cAAc;CACvB;;CAEA,IAAW,QAAgB;EAAE,OAAO,KAAK;CAAQ;;CAEjD,IAAW,MAAM,OAAe;EAC5B,IAAI,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,GAAG,MAAM,IAAI,WAAW,+CAA+C;EAC/G,IAAI,KAAK,WAAW,OAAO;EAC3B,KAAK,SAAS;EACd,KAAK,cAAc;CACvB;;CAEA,IAAW,SAAiB;EAAE,OAAO,KAAK;CAAS;;CAEnD,IAAW,OAAO,OAAe;EAC7B,IAAI,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,GAAG,MAAM,IAAI,WAAW,gDAAgD;EAChH,IAAI,KAAK,YAAY,OAAO;EAC5B,KAAK,UAAU;EACf,KAAK,cAAc;CACvB;;;;;CAMA,IAAW,YAAqC;EAC5C,KAAK,aAAa,IAAI,UAAU;CACpC;;;;;CAKA,OAAc,YAAqC;EAC/C,KAAK,aAAa,OAAO,UAAU;CACvC;;CAGA,gBAA6B;EACzB,KAAK;EACL,KAAK,MAAM,cAAc,CAAC,GAAG,KAAK,YAAY,GAAG,WAAW,gBAAgB,IAAI;CACpF;;;;;;;CAQA,UAAiB,QAAuB,MAAqB,MAAY;EAErE,KAAK,OAAO;EACZ,KAAK,UAAU;EACf,KAAK,UAAU;EACf,KAAK,SAAS,gBAAgB,MAAM;EACpC,KAAK,UAAU,iBAAiB,MAAM;EACtC,KAAK,cAAc;EAEnB,OAAO;CACX;;;;;CAMA,cAA2B;EACvB,KAAK,OAAO;EACZ,KAAK,UAAU;EACf,KAAK,UAAU;EACf,KAAK,SAAS;EACd,KAAK,UAAU;EACf,KAAK,cAAc;EAEnB,OAAO;CACX;;;;;;CAOA,MAAa,KAAK,KAA4B;EAC1C,MAAM,QAAQ,MAAM,UAAU,GAAG;EAEjC,OAAO,KAAK,UAAU,OAAO,GAAG;CACpC;AACJ;;;;;;AAOA,IAAM,aAAa,QAA2C;CAC1D,OAAO,IAAI,SAAS,SAAS,WAAW;EACpC,MAAM,QAAQ,IAAI,MAAM;EAExB,MAAM,eAAe;GACjB,QAAQ,KAAK;EACjB;EAEA,MAAM,gBAAgB;GAClB,uBAAO,IAAI,MAAM,wBAAwB,KAAK,CAAC;EACnD;EAEA,MAAM,MAAM;CAChB,CAAC;AACL;;;;;;AAOA,IAAM,mBAAmB,WAAkC;CACvD,IAAI,kBAAkB,QAClB,OAAO,OAAO;CAGlB,OAAO,OAAO;AAClB;;;;;;AAOA,IAAM,oBAAoB,WAAkC;CACxD,IAAI,mBAAmB,QACnB,OAAO,OAAO;CAGlB,OAAO,OAAO;AAClB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ObjectNodeLike } from "./Object/index";
|
|
2
|
+
import type { Rect2dLike } from "./Geometry/Rect2d";
|
|
3
|
+
import type { Poly2DLike } from "./Geometry/Poly2D";
|
|
4
|
+
import type { BaseMaterialLike } from "./Material/baseMaterial";
|
|
5
|
+
type AddObject = ObjectNodeLike;
|
|
6
|
+
type Geometry2d = Rect2dLike | Poly2DLike;
|
|
7
|
+
type Material2d = BaseMaterialLike;
|
|
8
|
+
export type { AddObject, Geometry2d, Material2d };
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="@webgpu/types" preserve="true" />
|
|
2
|
+
import Camera from "./Camera";
|
|
3
|
+
import Color from "./Color";
|
|
4
|
+
import Style from "./Style";
|
|
5
|
+
import Geo from "./Geometry/Geo";
|
|
6
|
+
import Rect2d from "./Geometry/Rect2d";
|
|
7
|
+
import Poly2D from "./Geometry/Poly2D";
|
|
8
|
+
import Group from "./Group";
|
|
9
|
+
import IMesh from "./IMesh";
|
|
10
|
+
import BaseMaterial from "./Material/baseMaterial";
|
|
11
|
+
import Material from "./Material/Material";
|
|
12
|
+
import Mesh from "./Mesh";
|
|
13
|
+
import ObjectNode from "./Object";
|
|
14
|
+
import Render from "./Render";
|
|
15
|
+
import Scene from "./Scene";
|
|
16
|
+
import Raws from "./Raws";
|
|
17
|
+
import Texture from "./Texture";
|
|
18
|
+
import { GETID } from "./ID";
|
|
19
|
+
export { BaseMaterial, Camera, Color, Style, Geo, GETID, Group, IMesh, Material, Mesh, ObjectNode, Rect2d, Poly2D, Render, Scene, Raws, Texture, };
|
|
20
|
+
export { BufferManager, DepthManager, DevelopmentValidator, DestroyManager, DrawCallManager, InitCamera, InitScene, MatrixUpdate, PipelineManager, SamplerManager, TextureManager, } from "./Render";
|
|
21
|
+
export type { CameraBuffersLike, CameraLike } from "./Camera";
|
|
22
|
+
export type { BorderAlign, GeoBuffersLike, GeoData, GeoPartDataLike, GeometrySubscriber } from "./Geometry/Geo";
|
|
23
|
+
export type { Rect2dLike, Rect2dOptions } from "./Geometry/Rect2d";
|
|
24
|
+
export type { Poly2DLike, Poly2DOptions } from "./Geometry/Poly2D";
|
|
25
|
+
export { JoinStyle } from "./Style";
|
|
26
|
+
export type { JoinType } from "./Style";
|
|
27
|
+
export type { GroupLike } from "./Group";
|
|
28
|
+
export type { BaseMaterialLike } from "./Material/baseMaterial";
|
|
29
|
+
export type { MaterialBuffersLike, MaterialChange, MaterialChangeKind, MaterialLike, MaterialSubscriber, PixelAligned, ShadersLike } from "./Material/Material";
|
|
30
|
+
export type { MeshLike } from "./Mesh";
|
|
31
|
+
export type { AddObject, Geometry2d, Material2d } from "./global-types";
|
|
32
|
+
export type { ObjectNodeLike } from "./Object";
|
|
33
|
+
export type { BufferManagerLike, DepthTextureLike, MeshDepthBufferLike, DevelopmentValidatorLike, DestroyManagerLike, DrawCallManagerLike, GeometryBufferPartLike, GeometryBufferLike, GPUTextureResourceLike, MeshMatrixBufferLike, MeshStyleBufferLike, PipelineBuffersLike, PipelineLike, PipelineManagerLike, PipelineTemplateLike, RenderLike, RenderMode, SamplerManagerLike, SceneResourcesLike, TextureManagerLike, } from "./Render";
|
|
34
|
+
export type { DrawList, GeometryList, MaterialList, SceneLike, TextureList } from "./Scene";
|
|
35
|
+
export type { TextureLike, TextureSource, TextureSubscriber } from "./Texture";
|
|
36
|
+
export { SolidStyle, WireframeStyle, EdgeStyle, PointsStyle, WriteStyleData, STYLE_STRIDE } from "./Style";
|
|
37
|
+
export type { ColorSubscriber } from "./Color";
|
|
38
|
+
export type { StyleArea, StyleChange, StyleSubscriber, PartSubscriber } from "./Style";
|
|
39
|
+
export { Raw } from "./Raws";
|
|
40
|
+
export type { RawOptions, RawChange, RawSubscriber } from "./Raws";
|
|
41
|
+
export type { IMeshOptions } from "./IMesh";
|
|
42
|
+
export { default as TextureLayers } from "./Texture/Layers";
|
|
43
|
+
export type { TextureResource } from "./Texture/Layers";
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GETID } from "./ID.js";
|
|
2
|
+
import ObjectNode from "./Object/index.js";
|
|
3
|
+
import Camera from "./Camera/index.js";
|
|
4
|
+
import Color from "./Color/index.js";
|
|
5
|
+
import SolidStyle from "./Style/SolidStyle.js";
|
|
6
|
+
import WireframeStyle from "./Style/WireframeStyle.js";
|
|
7
|
+
import EdgeStyle from "./Style/EdgeStyle.js";
|
|
8
|
+
import PointsStyle from "./Style/PointsStyle.js";
|
|
9
|
+
import JoinStyle from "./Style/JoinStyle.js";
|
|
10
|
+
import { STYLE_STRIDE, WriteStyleData } from "./Style/WriteStyleData.js";
|
|
11
|
+
import Style from "./Style/index.js";
|
|
12
|
+
import Geo from "./Geometry/Geo.js";
|
|
13
|
+
import Rect2d from "./Geometry/Rect2d.js";
|
|
14
|
+
import Poly2D from "./Geometry/Poly2D.js";
|
|
15
|
+
import Group from "./Group/index.js";
|
|
16
|
+
import Mesh from "./Mesh/index.js";
|
|
17
|
+
import Raws, { Raw } from "./Raws/index.js";
|
|
18
|
+
import TextureLayers from "./Texture/Layers.js";
|
|
19
|
+
import IMesh from "./IMesh/index.js";
|
|
20
|
+
import Material from "./Material/Material.js";
|
|
21
|
+
import BaseMaterial from "./Material/baseMaterial.js";
|
|
22
|
+
import DepthManager from "./Render/DepthManager.js";
|
|
23
|
+
import DevelopmentValidator from "./Render/DevelopmentValidator.js";
|
|
24
|
+
import BufferManager from "./Render/BufferManager.js";
|
|
25
|
+
import DestroyManager from "./Render/DestroyManager.js";
|
|
26
|
+
import SamplerManager from "./Render/SamplerManager.js";
|
|
27
|
+
import DrawCallManager from "./Render/DrawCallManager.js";
|
|
28
|
+
import TextureManager from "./Render/TextureManager.js";
|
|
29
|
+
import PipelineManager from "./Render/PipelineManager.js";
|
|
30
|
+
import { InitCamera, InitScene, MatrixUpdate } from "./Render/SceneUpdate.js";
|
|
31
|
+
import Render from "./Render/index.js";
|
|
32
|
+
import Scene from "./Scene/index.js";
|
|
33
|
+
import Texture from "./Texture/index.js";
|
|
34
|
+
export { BaseMaterial, BufferManager, Camera, Color, DepthManager, DestroyManager, DevelopmentValidator, DrawCallManager, EdgeStyle, GETID, Geo, Group, IMesh, InitCamera, InitScene, JoinStyle, Material, MatrixUpdate, Mesh, ObjectNode, PipelineManager, PointsStyle, Poly2D, Raw, Raws, Rect2d, Render, STYLE_STRIDE, SamplerManager, Scene, SolidStyle, Style, Texture, TextureLayers, TextureManager, WireframeStyle, WriteStyleData };
|