@configura/web-core 1.2.1 → 1.3.0-alpha.3

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.
Files changed (166) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/cm/basic/Color.d.ts +16 -16
  4. package/dist/cm/basic/Color.js +18 -18
  5. package/dist/cm/basic/ColorF.d.ts +9 -9
  6. package/dist/cm/basic/ColorF.js +10 -10
  7. package/dist/cm/basic/boolean.d.ts +2 -2
  8. package/dist/cm/basic/boolean.js +11 -11
  9. package/dist/cm/basic/number.d.ts +3 -3
  10. package/dist/cm/basic/number.js +18 -18
  11. package/dist/cm/basic/string.d.ts +2 -2
  12. package/dist/cm/basic/string.js +11 -11
  13. package/dist/cm/core3D/ATriMeshF.d.ts +90 -90
  14. package/dist/cm/core3D/ATriMeshF.js +193 -193
  15. package/dist/cm/core3D/DummyUVMapper.d.ts +6 -6
  16. package/dist/cm/core3D/DummyUVMapper.js +6 -6
  17. package/dist/cm/core3D/GMaterial3D.d.ts +58 -58
  18. package/dist/cm/core3D/GMaterial3D.js +112 -112
  19. package/dist/cm/core3D/GMaterialClassic.d.ts +55 -55
  20. package/dist/cm/core3D/GMaterialClassic.js +171 -171
  21. package/dist/cm/core3D/GMaterialPBR.d.ts +71 -71
  22. package/dist/cm/core3D/GMaterialPBR.js +288 -288
  23. package/dist/cm/core3D/MultiGMaterial3D.d.ts +8 -8
  24. package/dist/cm/core3D/MultiGMaterial3D.js +17 -17
  25. package/dist/cm/core3D/UVMapEnv.d.ts +17 -17
  26. package/dist/cm/core3D/UVMapEnv.js +35 -35
  27. package/dist/cm/core3D/UVTransformer.d.ts +5 -5
  28. package/dist/cm/core3D/UVTransformer.js +5 -5
  29. package/dist/cm/core3D/instantiateUVMapper.d.ts +3 -3
  30. package/dist/cm/core3D/instantiateUVMapper.js +5 -5
  31. package/dist/cm/format/cmsym/InvalidationEnv.d.ts +9 -9
  32. package/dist/cm/format/cmsym/InvalidationEnv.js +13 -13
  33. package/dist/cm/format/cmsym/SymImportEnv.d.ts +9 -9
  34. package/dist/cm/format/cmsym/SymImportEnv.js +9 -9
  35. package/dist/cm/format/cmsym/SymInv.d.ts +8 -8
  36. package/dist/cm/format/cmsym/SymInv.js +15 -15
  37. package/dist/cm/format/cmsym/SymNode.d.ts +85 -85
  38. package/dist/cm/format/cmsym/SymNode.js +577 -577
  39. package/dist/cm/format/cmsym/components/SymBox.d.ts +14 -14
  40. package/dist/cm/format/cmsym/components/SymBox.js +34 -34
  41. package/dist/cm/format/cmsym/components/SymComponent.d.ts +29 -29
  42. package/dist/cm/format/cmsym/components/SymComponent.js +54 -54
  43. package/dist/cm/format/cmsym/components/SymConnector.d.ts +5 -5
  44. package/dist/cm/format/cmsym/components/SymConnector.js +10 -10
  45. package/dist/cm/format/cmsym/components/SymDexObj.d.ts +11 -11
  46. package/dist/cm/format/cmsym/components/SymDexObj.js +10 -10
  47. package/dist/cm/format/cmsym/components/SymGFX.d.ts +11 -11
  48. package/dist/cm/format/cmsym/components/SymGFX.js +20 -20
  49. package/dist/cm/format/cmsym/components/SymGMaterial.d.ts +19 -19
  50. package/dist/cm/format/cmsym/components/SymGMaterial.js +88 -88
  51. package/dist/cm/format/cmsym/components/SymGMaterialSelector.d.ts +12 -12
  52. package/dist/cm/format/cmsym/components/SymGMaterialSelector.js +20 -20
  53. package/dist/cm/format/cmsym/components/SymGetMeshEnv.d.ts +9 -9
  54. package/dist/cm/format/cmsym/components/SymGetMeshEnv.js +9 -9
  55. package/dist/cm/format/cmsym/components/SymLODGroup.d.ts +9 -9
  56. package/dist/cm/format/cmsym/components/SymLODGroup.js +11 -11
  57. package/dist/cm/format/cmsym/components/SymLight.d.ts +8 -8
  58. package/dist/cm/format/cmsym/components/SymLight.js +10 -10
  59. package/dist/cm/format/cmsym/components/SymLines2D.d.ts +5 -5
  60. package/dist/cm/format/cmsym/components/SymLines2D.js +7 -7
  61. package/dist/cm/format/cmsym/components/SymMeasure.d.ts +34 -34
  62. package/dist/cm/format/cmsym/components/SymMeasure.js +158 -158
  63. package/dist/cm/format/cmsym/components/SymMesh.d.ts +29 -29
  64. package/dist/cm/format/cmsym/components/SymMesh.js +130 -130
  65. package/dist/cm/format/cmsym/components/SymMeshLight.d.ts +8 -8
  66. package/dist/cm/format/cmsym/components/SymMeshLight.js +10 -10
  67. package/dist/cm/format/cmsym/components/SymMultiSelector.d.ts +13 -13
  68. package/dist/cm/format/cmsym/components/SymMultiSelector.js +49 -49
  69. package/dist/cm/format/cmsym/components/SymParams.d.ts +4 -4
  70. package/dist/cm/format/cmsym/components/SymParams.js +7 -7
  71. package/dist/cm/format/cmsym/components/SymPlane.d.ts +14 -14
  72. package/dist/cm/format/cmsym/components/SymPlane.js +27 -27
  73. package/dist/cm/format/cmsym/components/SymPlaneDivider.d.ts +4 -4
  74. package/dist/cm/format/cmsym/components/SymPlaneDivider.js +7 -7
  75. package/dist/cm/format/cmsym/components/SymPrimitive2D.d.ts +3 -3
  76. package/dist/cm/format/cmsym/components/SymPrimitive2D.js +3 -3
  77. package/dist/cm/format/cmsym/components/SymProgs.d.ts +4 -4
  78. package/dist/cm/format/cmsym/components/SymProgs.js +7 -7
  79. package/dist/cm/format/cmsym/components/SymProps.d.ts +54 -54
  80. package/dist/cm/format/cmsym/components/SymProps.js +170 -170
  81. package/dist/cm/format/cmsym/components/SymRep.d.ts +13 -13
  82. package/dist/cm/format/cmsym/components/SymRep.js +28 -28
  83. package/dist/cm/format/cmsym/components/SymReps.d.ts +36 -36
  84. package/dist/cm/format/cmsym/components/SymReps.js +229 -229
  85. package/dist/cm/format/cmsym/components/SymShape.d.ts +10 -10
  86. package/dist/cm/format/cmsym/components/SymShape.js +14 -14
  87. package/dist/cm/format/cmsym/components/SymSphere.d.ts +16 -16
  88. package/dist/cm/format/cmsym/components/SymSphere.js +30 -30
  89. package/dist/cm/format/cmsym/components/SymSpotlight.d.ts +8 -8
  90. package/dist/cm/format/cmsym/components/SymSpotlight.js +10 -10
  91. package/dist/cm/format/cmsym/components/SymTags.d.ts +11 -11
  92. package/dist/cm/format/cmsym/components/SymTags.js +20 -20
  93. package/dist/cm/format/cmsym/components/SymText2D.d.ts +4 -4
  94. package/dist/cm/format/cmsym/components/SymText2D.js +8 -8
  95. package/dist/cm/format/cmsym/components/SymText3D.d.ts +4 -4
  96. package/dist/cm/format/cmsym/components/SymText3D.js +8 -8
  97. package/dist/cm/format/cmsym/components/SymTransform.d.ts +23 -23
  98. package/dist/cm/format/cmsym/components/SymTransform.js +101 -101
  99. package/dist/cm/format/cmsym/components/SymUVMapper.d.ts +13 -13
  100. package/dist/cm/format/cmsym/components/SymUVMapper.js +50 -50
  101. package/dist/cm/format/cmsym/components/instantiate.d.ts +2 -2
  102. package/dist/cm/format/cmsym/components/instantiate.js +121 -121
  103. package/dist/cm/format/cmsym/components/legacy.d.ts +7 -7
  104. package/dist/cm/format/cmsym/components/legacy.js +27 -27
  105. package/dist/cm/format/cmsym/components/mesh.d.ts +8 -8
  106. package/dist/cm/format/cmsym/components/mesh.js +28 -28
  107. package/dist/cm/format/cmsym/invalidation.d.ts +4 -4
  108. package/dist/cm/format/cmsym/invalidation.js +72 -72
  109. package/dist/cm/format/dex/DexIRef.d.ts +9 -9
  110. package/dist/cm/format/dex/DexIRef.js +18 -18
  111. package/dist/cm/format/dex/DexInt.d.ts +11 -11
  112. package/dist/cm/format/dex/DexInt.js +18 -18
  113. package/dist/cm/format/dex/DexInternalizedXRef.d.ts +19 -19
  114. package/dist/cm/format/dex/DexInternalizedXRef.js +64 -64
  115. package/dist/cm/format/dex/DexLoader.d.ts +8 -8
  116. package/dist/cm/format/dex/DexLoader.js +12 -12
  117. package/dist/cm/format/dex/DexManager.d.ts +20 -20
  118. package/dist/cm/format/dex/DexManager.js +78 -78
  119. package/dist/cm/format/dex/DexObj.d.ts +15 -15
  120. package/dist/cm/format/dex/DexObj.js +86 -86
  121. package/dist/cm/format/dex/DexReader.d.ts +86 -86
  122. package/dist/cm/format/dex/DexReader.js +492 -492
  123. package/dist/cm/format/dex/DexRef.d.ts +6 -6
  124. package/dist/cm/format/dex/DexRef.js +8 -8
  125. package/dist/cm/format/dex/DexReplacedXRefs.d.ts +8 -8
  126. package/dist/cm/format/dex/DexReplacedXRefs.js +22 -22
  127. package/dist/cm/format/dex/DexURL.d.ts +4 -4
  128. package/dist/cm/format/dex/DexURL.js +5 -5
  129. package/dist/cm/format/dex/DexVersion.d.ts +15 -15
  130. package/dist/cm/format/dex/DexVersion.js +53 -53
  131. package/dist/cm/format/dex/DexXRef.d.ts +18 -18
  132. package/dist/cm/format/dex/DexXRef.js +51 -51
  133. package/dist/cm/format/dex/DexXRefTargetFilter.d.ts +4 -4
  134. package/dist/cm/format/dex/DexXRefTargetFilter.js +5 -5
  135. package/dist/cm/geometry/Angle.d.ts +9 -9
  136. package/dist/cm/geometry/Angle.js +18 -18
  137. package/dist/cm/geometry/AngleF.d.ts +5 -5
  138. package/dist/cm/geometry/AngleF.js +8 -8
  139. package/dist/cm/geometry/Box.d.ts +7 -7
  140. package/dist/cm/geometry/Box.js +9 -9
  141. package/dist/cm/geometry/DetailMask.d.ts +32 -32
  142. package/dist/cm/geometry/DetailMask.js +112 -112
  143. package/dist/cm/geometry/LayerExpr.d.ts +2 -2
  144. package/dist/cm/geometry/LayerExpr.js +2 -2
  145. package/dist/cm/geometry/Matrix22.d.ts +6 -6
  146. package/dist/cm/geometry/Matrix22.js +6 -6
  147. package/dist/cm/geometry/Matrix33.d.ts +42 -42
  148. package/dist/cm/geometry/Matrix33.js +124 -124
  149. package/dist/cm/geometry/Orientation.d.ts +7 -7
  150. package/dist/cm/geometry/Orientation.js +7 -7
  151. package/dist/cm/geometry/Plane.d.ts +8 -8
  152. package/dist/cm/geometry/Plane.js +14 -14
  153. package/dist/cm/geometry/Point.d.ts +18 -18
  154. package/dist/cm/geometry/Point.js +56 -56
  155. package/dist/cm/geometry/Point2D.d.ts +8 -8
  156. package/dist/cm/geometry/Point2D.js +20 -20
  157. package/dist/cm/geometry/PointF.d.ts +11 -11
  158. package/dist/cm/geometry/PointF.js +27 -27
  159. package/dist/cm/geometry/Transform.d.ts +11 -11
  160. package/dist/cm/geometry/Transform.js +61 -61
  161. package/dist/cm/geometry/Transform2D.d.ts +7 -7
  162. package/dist/cm/geometry/Transform2D.js +6 -6
  163. package/dist/cm/io/Semver.d.ts +17 -17
  164. package/dist/cm/io/Semver.js +58 -58
  165. package/dist/index.js +1 -1
  166. package/package.json +4 -4
@@ -1,12 +1,12 @@
1
- import { Logger } from "@configura/web-utilities";
2
- import { DexObj } from "../../dex/DexObj.js";
3
- import { SymImportEnv } from "../SymImportEnv.js";
4
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
5
- export declare class SymTags extends SymComponent {
6
- id: SymComponentKey;
7
- main?: string;
8
- tags?: string;
9
- load(logger: Logger, obj: DexObj, env: SymImportEnv, force?: boolean): void;
10
- level(): number;
11
- }
1
+ import { Logger } from "@configura/web-utilities";
2
+ import { DexObj } from "../../dex/DexObj.js";
3
+ import { SymImportEnv } from "../SymImportEnv.js";
4
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
5
+ export declare class SymTags extends SymComponent {
6
+ id: SymComponentKey;
7
+ main?: string;
8
+ tags?: string;
9
+ load(logger: Logger, obj: DexObj, env: SymImportEnv, force?: boolean): void;
10
+ level(): number;
11
+ }
12
12
  //# sourceMappingURL=SymTags.d.ts.map
@@ -1,20 +1,20 @@
1
- import { SymComponent } from "./SymComponent.js";
2
- export class SymTags extends SymComponent {
3
- constructor() {
4
- super(...arguments);
5
- this.id = "symTags";
6
- }
7
- load(logger, obj, env, force = false) {
8
- const tags = obj.get("tags");
9
- if (typeof tags === "string") {
10
- this.tags = tags;
11
- }
12
- const mainTag = obj.get("main");
13
- if (typeof mainTag === "string") {
14
- this.main = mainTag;
15
- }
16
- }
17
- level() {
18
- return 1;
19
- }
20
- }
1
+ import { SymComponent } from "./SymComponent.js";
2
+ export class SymTags extends SymComponent {
3
+ constructor() {
4
+ super(...arguments);
5
+ this.id = "symTags";
6
+ }
7
+ load(logger, obj, env, force = false) {
8
+ const tags = obj.get("tags");
9
+ if (typeof tags === "string") {
10
+ this.tags = tags;
11
+ }
12
+ const mainTag = obj.get("main");
13
+ if (typeof mainTag === "string") {
14
+ this.main = mainTag;
15
+ }
16
+ }
17
+ level() {
18
+ return 1;
19
+ }
20
+ }
@@ -1,5 +1,5 @@
1
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
2
- export declare class SymText2D extends SymComponent {
3
- id: SymComponentKey;
4
- }
1
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
2
+ export declare class SymText2D extends SymComponent {
3
+ id: SymComponentKey;
4
+ }
5
5
  //# sourceMappingURL=SymText2D.d.ts.map
@@ -1,8 +1,8 @@
1
- import { SymComponent } from "./SymComponent.js";
2
- /// Intentionally ignored
3
- export class SymText2D extends SymComponent {
4
- constructor() {
5
- super(...arguments);
6
- this.id = "symText2D";
7
- }
8
- }
1
+ import { SymComponent } from "./SymComponent.js";
2
+ /// Intentionally ignored
3
+ export class SymText2D extends SymComponent {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.id = "symText2D";
7
+ }
8
+ }
@@ -1,5 +1,5 @@
1
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
2
- export declare class SymText3D extends SymComponent {
3
- id: SymComponentKey;
4
- }
1
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
2
+ export declare class SymText3D extends SymComponent {
3
+ id: SymComponentKey;
4
+ }
5
5
  //# sourceMappingURL=SymText3D.d.ts.map
@@ -1,8 +1,8 @@
1
- import { SymComponent } from "./SymComponent.js";
2
- /// Intentionally ignored
3
- export class SymText3D extends SymComponent {
4
- constructor() {
5
- super(...arguments);
6
- this.id = "symText3D";
7
- }
8
- }
1
+ import { SymComponent } from "./SymComponent.js";
2
+ /// Intentionally ignored
3
+ export class SymText3D extends SymComponent {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.id = "symText3D";
7
+ }
8
+ }
@@ -1,24 +1,24 @@
1
- import { Logger } from "@configura/web-utilities";
2
- import { Matrix33 } from "../../../geometry/Matrix33.js";
3
- import { Orientation } from "../../../geometry/Orientation.js";
4
- import { Point } from "../../../geometry/Point.js";
5
- import { Transform } from "../../../geometry/Transform.js";
6
- import { DexObj } from "../../dex/DexObj.js";
7
- import { SymImportEnv } from "../SymImportEnv.js";
8
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
9
- export declare class SymTransform extends SymComponent {
10
- pos?: Point | undefined;
11
- rot?: Orientation | undefined;
12
- pivot?: Point | undefined;
13
- scale: Point;
14
- id: SymComponentKey;
15
- originalTransform?: Transform;
16
- _transform?: Transform;
17
- constructor(pos?: Point | undefined, rot?: Orientation | undefined, pivot?: Point | undefined, scale?: Point, src?: string);
18
- load(logger: Logger, obj: DexObj, env: SymImportEnv, force?: boolean): void;
19
- transform(): Transform;
20
- rotToMatrix33(): Matrix33 | undefined;
21
- scaleToMatrix33(): Matrix33;
22
- totalTransform(): Transform;
23
- }
1
+ import { Logger } from "@configura/web-utilities";
2
+ import { Matrix33 } from "../../../geometry/Matrix33.js";
3
+ import { Orientation } from "../../../geometry/Orientation.js";
4
+ import { Point } from "../../../geometry/Point.js";
5
+ import { Transform } from "../../../geometry/Transform.js";
6
+ import { DexObj } from "../../dex/DexObj.js";
7
+ import { SymImportEnv } from "../SymImportEnv.js";
8
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
9
+ export declare class SymTransform extends SymComponent {
10
+ pos?: Point | undefined;
11
+ rot?: Orientation | undefined;
12
+ pivot?: Point | undefined;
13
+ scale: Point;
14
+ id: SymComponentKey;
15
+ originalTransform?: Transform;
16
+ _transform?: Transform;
17
+ constructor(pos?: Point | undefined, rot?: Orientation | undefined, pivot?: Point | undefined, scale?: Point, src?: string);
18
+ load(logger: Logger, obj: DexObj, env: SymImportEnv, force?: boolean): void;
19
+ transform(): Transform;
20
+ rotToMatrix33(): Matrix33 | undefined;
21
+ scaleToMatrix33(): Matrix33;
22
+ totalTransform(): Transform;
23
+ }
24
24
  //# sourceMappingURL=SymTransform.d.ts.map
@@ -1,101 +1,101 @@
1
- import { Matrix33 } from "../../../geometry/Matrix33.js";
2
- import { Orientation } from "../../../geometry/Orientation.js";
3
- import { Point } from "../../../geometry/Point.js";
4
- import { Transform } from "../../../geometry/Transform.js";
5
- import { SymComponent } from "./SymComponent.js";
6
- export class SymTransform extends SymComponent {
7
- constructor(pos, rot, pivot, scale = new Point(1, 1, 1), src) {
8
- super(src);
9
- this.pos = pos;
10
- this.rot = rot;
11
- this.pivot = pivot;
12
- this.scale = scale;
13
- this.id = "symTransform";
14
- }
15
- load(logger, obj, env, force = false) {
16
- const pos = obj.get("pos");
17
- if (pos instanceof Point) {
18
- this.pos = pos;
19
- }
20
- const rot = obj.get("rot");
21
- if (rot instanceof Orientation) {
22
- this.rot = rot;
23
- }
24
- const scale = obj.get("scale");
25
- if (scale instanceof Point) {
26
- this.scale = scale;
27
- }
28
- const pivot = obj.get("pivot");
29
- if (pivot instanceof Point) {
30
- this.pivot = pivot;
31
- }
32
- const transform = obj.get("originalTransform");
33
- if (transform instanceof Transform) {
34
- this.originalTransform = transform;
35
- }
36
- }
37
- transform() {
38
- if (this._transform !== undefined) {
39
- return this._transform;
40
- }
41
- let transform = this.totalTransform();
42
- if (this.originalTransform !== undefined) {
43
- transform = this.originalTransform.add(transform);
44
- }
45
- this._transform = transform;
46
- return this._transform;
47
- }
48
- rotToMatrix33() {
49
- if (this.rot === undefined)
50
- return;
51
- const { yaw, pitch, roll } = this.rot;
52
- const sinY = Math.sin(yaw.radians);
53
- const cosY = Math.cos(yaw.radians);
54
- const sinP = Math.sin(pitch.radians);
55
- const cosP = Math.cos(pitch.radians);
56
- const sinR = Math.sin(roll.radians);
57
- const cosR = Math.cos(roll.radians);
58
- const c0 = new Point(cosY * cosP, sinY * cosP, -sinP);
59
- const c1 = new Point(cosY * sinP * sinR - sinY * cosR, sinY * sinP * sinR + cosY * cosR, cosP * sinR);
60
- const c2 = new Point(cosY * sinP * cosR + sinY * sinR, sinY * sinP * cosR - cosY * sinR, cosP * cosR);
61
- return new Matrix33(c0, c1, c2);
62
- }
63
- scaleToMatrix33() {
64
- const c0 = new Point(this.scale.x, 0, 0);
65
- const c1 = new Point(0, this.scale.y, 0);
66
- const c2 = new Point(0, 0, this.scale.z);
67
- return new Matrix33(c0, c1, c2);
68
- }
69
- totalTransform() {
70
- let transform;
71
- let pos = new Point(0, 0, 0);
72
- if (this.pivot !== undefined && this.pos !== undefined) {
73
- pos = this.pivot.add(this.pos);
74
- }
75
- else if (this.pos !== undefined) {
76
- pos = this.pos;
77
- }
78
- else if (this.pivot !== undefined) {
79
- pos = this.pivot;
80
- }
81
- let mapping;
82
- const m1 = this.rotToMatrix33();
83
- const m2 = this.scaleToMatrix33();
84
- if (m1 !== undefined && m2 !== undefined) {
85
- mapping = m1.multiply(m2);
86
- }
87
- else if (m1 !== undefined) {
88
- mapping = m1;
89
- }
90
- else if (m2 !== undefined) {
91
- mapping = m2;
92
- }
93
- transform = new Transform(pos, mapping);
94
- if (this.pivot !== undefined) {
95
- const t1 = new Transform(this.pivot);
96
- const inverted = t1.inverted();
97
- transform = inverted.add(transform);
98
- }
99
- return transform;
100
- }
101
- }
1
+ import { Matrix33 } from "../../../geometry/Matrix33.js";
2
+ import { Orientation } from "../../../geometry/Orientation.js";
3
+ import { Point } from "../../../geometry/Point.js";
4
+ import { Transform } from "../../../geometry/Transform.js";
5
+ import { SymComponent } from "./SymComponent.js";
6
+ export class SymTransform extends SymComponent {
7
+ constructor(pos, rot, pivot, scale = new Point(1, 1, 1), src) {
8
+ super(src);
9
+ this.pos = pos;
10
+ this.rot = rot;
11
+ this.pivot = pivot;
12
+ this.scale = scale;
13
+ this.id = "symTransform";
14
+ }
15
+ load(logger, obj, env, force = false) {
16
+ const pos = obj.get("pos");
17
+ if (pos instanceof Point) {
18
+ this.pos = pos;
19
+ }
20
+ const rot = obj.get("rot");
21
+ if (rot instanceof Orientation) {
22
+ this.rot = rot;
23
+ }
24
+ const scale = obj.get("scale");
25
+ if (scale instanceof Point) {
26
+ this.scale = scale;
27
+ }
28
+ const pivot = obj.get("pivot");
29
+ if (pivot instanceof Point) {
30
+ this.pivot = pivot;
31
+ }
32
+ const transform = obj.get("originalTransform");
33
+ if (transform instanceof Transform) {
34
+ this.originalTransform = transform;
35
+ }
36
+ }
37
+ transform() {
38
+ if (this._transform !== undefined) {
39
+ return this._transform;
40
+ }
41
+ let transform = this.totalTransform();
42
+ if (this.originalTransform !== undefined) {
43
+ transform = this.originalTransform.add(transform);
44
+ }
45
+ this._transform = transform;
46
+ return this._transform;
47
+ }
48
+ rotToMatrix33() {
49
+ if (this.rot === undefined)
50
+ return;
51
+ const { yaw, pitch, roll } = this.rot;
52
+ const sinY = Math.sin(yaw.radians);
53
+ const cosY = Math.cos(yaw.radians);
54
+ const sinP = Math.sin(pitch.radians);
55
+ const cosP = Math.cos(pitch.radians);
56
+ const sinR = Math.sin(roll.radians);
57
+ const cosR = Math.cos(roll.radians);
58
+ const c0 = new Point(cosY * cosP, sinY * cosP, -sinP);
59
+ const c1 = new Point(cosY * sinP * sinR - sinY * cosR, sinY * sinP * sinR + cosY * cosR, cosP * sinR);
60
+ const c2 = new Point(cosY * sinP * cosR + sinY * sinR, sinY * sinP * cosR - cosY * sinR, cosP * cosR);
61
+ return new Matrix33(c0, c1, c2);
62
+ }
63
+ scaleToMatrix33() {
64
+ const c0 = new Point(this.scale.x, 0, 0);
65
+ const c1 = new Point(0, this.scale.y, 0);
66
+ const c2 = new Point(0, 0, this.scale.z);
67
+ return new Matrix33(c0, c1, c2);
68
+ }
69
+ totalTransform() {
70
+ let transform;
71
+ let pos = new Point(0, 0, 0);
72
+ if (this.pivot !== undefined && this.pos !== undefined) {
73
+ pos = this.pivot.add(this.pos);
74
+ }
75
+ else if (this.pos !== undefined) {
76
+ pos = this.pos;
77
+ }
78
+ else if (this.pivot !== undefined) {
79
+ pos = this.pivot;
80
+ }
81
+ let mapping;
82
+ const m1 = this.rotToMatrix33();
83
+ const m2 = this.scaleToMatrix33();
84
+ if (m1 !== undefined && m2 !== undefined) {
85
+ mapping = m1.multiply(m2);
86
+ }
87
+ else if (m1 !== undefined) {
88
+ mapping = m1;
89
+ }
90
+ else if (m2 !== undefined) {
91
+ mapping = m2;
92
+ }
93
+ transform = new Transform(pos, mapping);
94
+ if (this.pivot !== undefined) {
95
+ const t1 = new Transform(this.pivot);
96
+ const inverted = t1.inverted();
97
+ transform = inverted.add(transform);
98
+ }
99
+ return transform;
100
+ }
101
+ }
@@ -1,14 +1,14 @@
1
- import { Logger } from "@configura/web-utilities";
2
- import { DummyUVMapper } from "../../../core3D/DummyUVMapper.js";
3
- import { UVMapEnv } from "../../../core3D/UVMapEnv.js";
4
- import { DexObj } from "../../dex/DexObj.js";
5
- import { SymImportEnv } from "../SymImportEnv.js";
6
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
7
- export declare class SymUVMapper extends SymComponent {
8
- id: SymComponentKey;
9
- mapper?: DummyUVMapper;
10
- load(logger: Logger, dexObj: DexObj, _env: SymImportEnv, force?: boolean): void;
11
- }
12
- export declare function dexToUVMapper(logger: Logger, obj: DexObj): DummyUVMapper;
13
- export declare function dexToUVMapEnv(obj: DexObj): UVMapEnv;
1
+ import { Logger } from "@configura/web-utilities";
2
+ import { DummyUVMapper } from "../../../core3D/DummyUVMapper.js";
3
+ import { UVMapEnv } from "../../../core3D/UVMapEnv.js";
4
+ import { DexObj } from "../../dex/DexObj.js";
5
+ import { SymImportEnv } from "../SymImportEnv.js";
6
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
7
+ export declare class SymUVMapper extends SymComponent {
8
+ id: SymComponentKey;
9
+ mapper?: DummyUVMapper;
10
+ load(logger: Logger, dexObj: DexObj, _env: SymImportEnv, force?: boolean): void;
11
+ }
12
+ export declare function dexToUVMapper(logger: Logger, obj: DexObj): DummyUVMapper;
13
+ export declare function dexToUVMapEnv(obj: DexObj): UVMapEnv;
14
14
  //# sourceMappingURL=SymUVMapper.d.ts.map
@@ -1,50 +1,50 @@
1
- import { castBoolean } from "../../../basic/boolean.js";
2
- import { fcastString } from "../../../basic/string.js";
3
- import { instantiateUVMapper } from "../../../core3D/instantiateUVMapper.js";
4
- import { fcastUVMapperType, UVMapEnv } from "../../../core3D/UVMapEnv.js";
5
- import { UVTransformer } from "../../../core3D/UVTransformer.js";
6
- import { Matrix22 } from "../../../geometry/Matrix22.js";
7
- import { Point } from "../../../geometry/Point.js";
8
- import { Point2D } from "../../../geometry/Point2D.js";
9
- import { Transform2D } from "../../../geometry/Transform2D.js";
10
- import { DexObj } from "../../dex/DexObj.js";
11
- import { SymComponent } from "./SymComponent.js";
12
- export class SymUVMapper extends SymComponent {
13
- constructor() {
14
- super(...arguments);
15
- this.id = "symUVMapper";
16
- }
17
- load(logger, dexObj, _env, force = false) {
18
- const dexUVMapper = dexObj.get("mapper");
19
- if (dexUVMapper instanceof DexObj) {
20
- this.mapper = dexToUVMapper(logger, dexUVMapper);
21
- }
22
- }
23
- }
24
- export function dexToUVMapper(logger, obj) {
25
- const className = fcastString(obj.get("class"));
26
- const mapper = instantiateUVMapper(logger, className);
27
- const env = dexToUVMapEnv(DexObj.fcast(obj.get("env")));
28
- mapper.env = env;
29
- return mapper;
30
- }
31
- export function dexToUVMapEnv(obj) {
32
- const type = fcastUVMapperType(fcastString(obj.get("type")));
33
- const normal = Point.cast(obj.get("normal"));
34
- const uniform = castBoolean(obj.get("uniform"));
35
- const dexTransforms = obj.get("transforms");
36
- if (!Array.isArray(dexTransforms)) {
37
- throw Error(`t: ${dexTransforms} not Array`);
38
- }
39
- const transforms = [];
40
- for (const t of dexTransforms) {
41
- const obj = DexObj.fcast(t);
42
- const pos = Point2D.fcast(obj.get("pos"));
43
- const c0 = Point2D.fcast(obj.get("mapping_c0"));
44
- const c1 = Point2D.fcast(obj.get("mapping_c1"));
45
- const mapping = new Matrix22(c0, c1);
46
- const transform = new Transform2D(pos, mapping);
47
- transforms.push(new UVTransformer(transform));
48
- }
49
- return new UVMapEnv(type, transforms, normal, uniform);
50
- }
1
+ import { castBoolean } from "../../../basic/boolean.js";
2
+ import { fcastString } from "../../../basic/string.js";
3
+ import { instantiateUVMapper } from "../../../core3D/instantiateUVMapper.js";
4
+ import { fcastUVMapperType, UVMapEnv } from "../../../core3D/UVMapEnv.js";
5
+ import { UVTransformer } from "../../../core3D/UVTransformer.js";
6
+ import { Matrix22 } from "../../../geometry/Matrix22.js";
7
+ import { Point } from "../../../geometry/Point.js";
8
+ import { Point2D } from "../../../geometry/Point2D.js";
9
+ import { Transform2D } from "../../../geometry/Transform2D.js";
10
+ import { DexObj } from "../../dex/DexObj.js";
11
+ import { SymComponent } from "./SymComponent.js";
12
+ export class SymUVMapper extends SymComponent {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.id = "symUVMapper";
16
+ }
17
+ load(logger, dexObj, _env, force = false) {
18
+ const dexUVMapper = dexObj.get("mapper");
19
+ if (dexUVMapper instanceof DexObj) {
20
+ this.mapper = dexToUVMapper(logger, dexUVMapper);
21
+ }
22
+ }
23
+ }
24
+ export function dexToUVMapper(logger, obj) {
25
+ const className = fcastString(obj.get("class"));
26
+ const mapper = instantiateUVMapper(logger, className);
27
+ const env = dexToUVMapEnv(DexObj.fcast(obj.get("env")));
28
+ mapper.env = env;
29
+ return mapper;
30
+ }
31
+ export function dexToUVMapEnv(obj) {
32
+ const type = fcastUVMapperType(fcastString(obj.get("type")));
33
+ const normal = Point.cast(obj.get("normal"));
34
+ const uniform = castBoolean(obj.get("uniform"));
35
+ const dexTransforms = obj.get("transforms");
36
+ if (!Array.isArray(dexTransforms)) {
37
+ throw Error(`t: ${dexTransforms} not Array`);
38
+ }
39
+ const transforms = [];
40
+ for (const t of dexTransforms) {
41
+ const obj = DexObj.fcast(t);
42
+ const pos = Point2D.fcast(obj.get("pos"));
43
+ const c0 = Point2D.fcast(obj.get("mapping_c0"));
44
+ const c1 = Point2D.fcast(obj.get("mapping_c1"));
45
+ const mapping = new Matrix22(c0, c1);
46
+ const transform = new Transform2D(pos, mapping);
47
+ transforms.push(new UVTransformer(transform));
48
+ }
49
+ return new UVMapEnv(type, transforms, normal, uniform);
50
+ }
@@ -1,3 +1,3 @@
1
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
2
- export declare function instantiate(key: SymComponentKey | string): SymComponent;
1
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
2
+ export declare function instantiate(key: SymComponentKey | string): SymComponent;
3
3
  //# sourceMappingURL=instantiate.d.ts.map