@configura/web-core 2.1.0-alpha.2 → 2.1.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 (173) hide show
  1. package/.eslintrc.json +5 -5
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/cm/basic/Color.d.ts +16 -16
  5. package/dist/cm/basic/Color.js +18 -18
  6. package/dist/cm/basic/ColorF.d.ts +9 -9
  7. package/dist/cm/basic/ColorF.js +10 -10
  8. package/dist/cm/basic/boolean.d.ts +2 -2
  9. package/dist/cm/basic/boolean.js +11 -11
  10. package/dist/cm/basic/number.d.ts +3 -3
  11. package/dist/cm/basic/number.js +18 -18
  12. package/dist/cm/basic/string.d.ts +2 -2
  13. package/dist/cm/basic/string.js +11 -11
  14. package/dist/cm/core3D/ATriMeshF.d.ts +96 -96
  15. package/dist/cm/core3D/ATriMeshF.js +197 -197
  16. package/dist/cm/core3D/GMaterial3D.d.ts +62 -62
  17. package/dist/cm/core3D/GMaterial3D.js +112 -112
  18. package/dist/cm/core3D/GMaterialClassic.d.ts +55 -55
  19. package/dist/cm/core3D/GMaterialClassic.js +171 -171
  20. package/dist/cm/core3D/GMaterialPBR.d.ts +73 -73
  21. package/dist/cm/core3D/GMaterialPBR.js +314 -314
  22. package/dist/cm/core3D/MultiGMaterial3D.d.ts +8 -8
  23. package/dist/cm/core3D/MultiGMaterial3D.js +17 -17
  24. package/dist/cm/core3D/uvmapper/UVMapEnv.d.ts +19 -19
  25. package/dist/cm/core3D/uvmapper/UVMapEnv.js +47 -47
  26. package/dist/cm/core3D/uvmapper/UVMapper.d.ts +41 -41
  27. package/dist/cm/core3D/uvmapper/UVMapper.js +94 -94
  28. package/dist/cm/core3D/uvmapper/UVMapperBox.d.ts +4 -4
  29. package/dist/cm/core3D/uvmapper/UVMapperBox.js +181 -181
  30. package/dist/cm/core3D/uvmapper/UVMapperCylinder.d.ts +9 -9
  31. package/dist/cm/core3D/uvmapper/UVMapperCylinder.js +96 -96
  32. package/dist/cm/core3D/uvmapper/UVMapperPlane.d.ts +3 -3
  33. package/dist/cm/core3D/uvmapper/UVMapperPlane.js +84 -84
  34. package/dist/cm/core3D/uvmapper/UVTransformer.d.ts +5 -5
  35. package/dist/cm/core3D/uvmapper/UVTransformer.js +5 -5
  36. package/dist/cm/core3D/uvmapper/instantiateUVMapper.d.ts +3 -3
  37. package/dist/cm/core3D/uvmapper/instantiateUVMapper.js +4 -4
  38. package/dist/cm/format/cmsym/InvalidationEnv.d.ts +9 -9
  39. package/dist/cm/format/cmsym/InvalidationEnv.js +13 -13
  40. package/dist/cm/format/cmsym/SymImportEnv.d.ts +9 -9
  41. package/dist/cm/format/cmsym/SymImportEnv.js +9 -9
  42. package/dist/cm/format/cmsym/SymInv.d.ts +8 -8
  43. package/dist/cm/format/cmsym/SymInv.js +17 -17
  44. package/dist/cm/format/cmsym/SymNode.d.ts +94 -94
  45. package/dist/cm/format/cmsym/SymNode.js +652 -652
  46. package/dist/cm/format/cmsym/components/SymBox.d.ts +15 -15
  47. package/dist/cm/format/cmsym/components/SymBox.js +39 -39
  48. package/dist/cm/format/cmsym/components/SymComponent.d.ts +29 -29
  49. package/dist/cm/format/cmsym/components/SymComponent.js +56 -56
  50. package/dist/cm/format/cmsym/components/SymConnector.d.ts +5 -5
  51. package/dist/cm/format/cmsym/components/SymConnector.js +10 -10
  52. package/dist/cm/format/cmsym/components/SymDexObj.d.ts +11 -11
  53. package/dist/cm/format/cmsym/components/SymDexObj.js +10 -10
  54. package/dist/cm/format/cmsym/components/SymGFX.d.ts +11 -11
  55. package/dist/cm/format/cmsym/components/SymGFX.js +20 -20
  56. package/dist/cm/format/cmsym/components/SymGMaterial.d.ts +19 -19
  57. package/dist/cm/format/cmsym/components/SymGMaterial.js +88 -88
  58. package/dist/cm/format/cmsym/components/SymGMaterialSelector.d.ts +17 -17
  59. package/dist/cm/format/cmsym/components/SymGMaterialSelector.js +22 -22
  60. package/dist/cm/format/cmsym/components/SymGetMeshEnv.d.ts +9 -9
  61. package/dist/cm/format/cmsym/components/SymGetMeshEnv.js +9 -9
  62. package/dist/cm/format/cmsym/components/SymLODGroup.d.ts +9 -9
  63. package/dist/cm/format/cmsym/components/SymLODGroup.js +13 -13
  64. package/dist/cm/format/cmsym/components/SymLight.d.ts +8 -8
  65. package/dist/cm/format/cmsym/components/SymLight.js +10 -10
  66. package/dist/cm/format/cmsym/components/SymLines2D.d.ts +5 -5
  67. package/dist/cm/format/cmsym/components/SymLines2D.js +7 -7
  68. package/dist/cm/format/cmsym/components/SymMeasure.d.ts +33 -33
  69. package/dist/cm/format/cmsym/components/SymMeasure.js +149 -149
  70. package/dist/cm/format/cmsym/components/SymMesh.d.ts +29 -29
  71. package/dist/cm/format/cmsym/components/SymMesh.js +130 -130
  72. package/dist/cm/format/cmsym/components/SymMeshLight.d.ts +8 -8
  73. package/dist/cm/format/cmsym/components/SymMeshLight.js +10 -10
  74. package/dist/cm/format/cmsym/components/SymMultiSelector.d.ts +13 -13
  75. package/dist/cm/format/cmsym/components/SymMultiSelector.js +48 -48
  76. package/dist/cm/format/cmsym/components/SymParams.d.ts +16 -16
  77. package/dist/cm/format/cmsym/components/SymParams.js +58 -58
  78. package/dist/cm/format/cmsym/components/SymPlane.d.ts +15 -15
  79. package/dist/cm/format/cmsym/components/SymPlane.js +30 -30
  80. package/dist/cm/format/cmsym/components/SymPlaneDivider.d.ts +4 -4
  81. package/dist/cm/format/cmsym/components/SymPlaneDivider.js +7 -7
  82. package/dist/cm/format/cmsym/components/SymPrimitive2D.d.ts +3 -3
  83. package/dist/cm/format/cmsym/components/SymPrimitive2D.js +3 -3
  84. package/dist/cm/format/cmsym/components/SymProgs.d.ts +32 -32
  85. package/dist/cm/format/cmsym/components/SymProgs.js +120 -120
  86. package/dist/cm/format/cmsym/components/SymProps.d.ts +54 -54
  87. package/dist/cm/format/cmsym/components/SymProps.js +171 -171
  88. package/dist/cm/format/cmsym/components/SymRep.d.ts +13 -13
  89. package/dist/cm/format/cmsym/components/SymRep.js +28 -28
  90. package/dist/cm/format/cmsym/components/SymReps.d.ts +36 -36
  91. package/dist/cm/format/cmsym/components/SymReps.js +230 -230
  92. package/dist/cm/format/cmsym/components/SymShape.d.ts +10 -10
  93. package/dist/cm/format/cmsym/components/SymShape.js +17 -17
  94. package/dist/cm/format/cmsym/components/SymSphere.d.ts +18 -18
  95. package/dist/cm/format/cmsym/components/SymSphere.js +33 -33
  96. package/dist/cm/format/cmsym/components/SymSpotlight.d.ts +8 -8
  97. package/dist/cm/format/cmsym/components/SymSpotlight.js +10 -10
  98. package/dist/cm/format/cmsym/components/SymTags.d.ts +11 -11
  99. package/dist/cm/format/cmsym/components/SymTags.js +20 -20
  100. package/dist/cm/format/cmsym/components/SymText2D.d.ts +5 -5
  101. package/dist/cm/format/cmsym/components/SymText2D.js +8 -8
  102. package/dist/cm/format/cmsym/components/SymText3D.d.ts +5 -5
  103. package/dist/cm/format/cmsym/components/SymText3D.js +8 -8
  104. package/dist/cm/format/cmsym/components/SymTransform.d.ts +23 -23
  105. package/dist/cm/format/cmsym/components/SymTransform.js +101 -101
  106. package/dist/cm/format/cmsym/components/SymUVMapper.d.ts +13 -13
  107. package/dist/cm/format/cmsym/components/SymUVMapper.js +50 -50
  108. package/dist/cm/format/cmsym/components/instantiate.d.ts +2 -2
  109. package/dist/cm/format/cmsym/components/instantiate.js +121 -121
  110. package/dist/cm/format/cmsym/components/legacy.d.ts +7 -7
  111. package/dist/cm/format/cmsym/components/legacy.js +27 -27
  112. package/dist/cm/format/cmsym/components/mesh.d.ts +8 -8
  113. package/dist/cm/format/cmsym/components/mesh.js +28 -28
  114. package/dist/cm/format/cmsym/invalidation.d.ts +4 -4
  115. package/dist/cm/format/cmsym/invalidation.js +72 -72
  116. package/dist/cm/format/dex/DexIRef.d.ts +9 -9
  117. package/dist/cm/format/dex/DexIRef.js +18 -18
  118. package/dist/cm/format/dex/DexInt.d.ts +11 -11
  119. package/dist/cm/format/dex/DexInt.js +18 -18
  120. package/dist/cm/format/dex/DexInternalizedXRef.d.ts +19 -19
  121. package/dist/cm/format/dex/DexInternalizedXRef.js +65 -65
  122. package/dist/cm/format/dex/DexLoader.d.ts +8 -8
  123. package/dist/cm/format/dex/DexLoader.js +12 -12
  124. package/dist/cm/format/dex/DexManager.d.ts +20 -20
  125. package/dist/cm/format/dex/DexManager.js +78 -78
  126. package/dist/cm/format/dex/DexObj.d.ts +15 -15
  127. package/dist/cm/format/dex/DexObj.js +86 -86
  128. package/dist/cm/format/dex/DexReader.d.ts +90 -90
  129. package/dist/cm/format/dex/DexReader.js +532 -532
  130. package/dist/cm/format/dex/DexRef.d.ts +6 -6
  131. package/dist/cm/format/dex/DexRef.js +8 -8
  132. package/dist/cm/format/dex/DexReplacedXRefs.d.ts +9 -9
  133. package/dist/cm/format/dex/DexReplacedXRefs.js +22 -22
  134. package/dist/cm/format/dex/DexURL.d.ts +4 -4
  135. package/dist/cm/format/dex/DexURL.js +5 -5
  136. package/dist/cm/format/dex/DexVersion.d.ts +15 -15
  137. package/dist/cm/format/dex/DexVersion.js +53 -53
  138. package/dist/cm/format/dex/DexXRef.d.ts +18 -18
  139. package/dist/cm/format/dex/DexXRef.js +51 -51
  140. package/dist/cm/format/dex/DexXRefTargetFilter.d.ts +4 -4
  141. package/dist/cm/format/dex/DexXRefTargetFilter.js +5 -5
  142. package/dist/cm/geometry/Angle.d.ts +9 -9
  143. package/dist/cm/geometry/Angle.js +18 -18
  144. package/dist/cm/geometry/AngleF.d.ts +5 -5
  145. package/dist/cm/geometry/AngleF.js +8 -8
  146. package/dist/cm/geometry/Box.d.ts +7 -7
  147. package/dist/cm/geometry/Box.js +9 -9
  148. package/dist/cm/geometry/DetailMask.d.ts +37 -37
  149. package/dist/cm/geometry/DetailMask.js +114 -114
  150. package/dist/cm/geometry/LayerExpr.d.ts +2 -2
  151. package/dist/cm/geometry/LayerExpr.js +2 -2
  152. package/dist/cm/geometry/Matrix22.d.ts +7 -7
  153. package/dist/cm/geometry/Matrix22.js +9 -9
  154. package/dist/cm/geometry/Matrix33.d.ts +42 -42
  155. package/dist/cm/geometry/Matrix33.js +124 -124
  156. package/dist/cm/geometry/Orientation.d.ts +7 -7
  157. package/dist/cm/geometry/Orientation.js +7 -7
  158. package/dist/cm/geometry/Plane.d.ts +8 -8
  159. package/dist/cm/geometry/Plane.js +14 -14
  160. package/dist/cm/geometry/Point.d.ts +21 -21
  161. package/dist/cm/geometry/Point.js +65 -65
  162. package/dist/cm/geometry/Point2D.d.ts +9 -9
  163. package/dist/cm/geometry/Point2D.js +23 -23
  164. package/dist/cm/geometry/PointF.d.ts +11 -11
  165. package/dist/cm/geometry/PointF.js +27 -27
  166. package/dist/cm/geometry/Transform.d.ts +11 -11
  167. package/dist/cm/geometry/Transform.js +61 -61
  168. package/dist/cm/geometry/Transform2D.d.ts +7 -7
  169. package/dist/cm/geometry/Transform2D.js +6 -6
  170. package/dist/cm/io/Semver.d.ts +18 -18
  171. package/dist/cm/io/Semver.js +61 -61
  172. package/dist/index.js +1 -1
  173. package/package.json +4 -4
@@ -1,149 +1,149 @@
1
- import { DexObj } from "../../dex/DexObj.js";
2
- import { VERBOSE_SYM_LOGGING } from "../SymNode.js";
3
- import { SymComponent } from "./SymComponent.js";
4
- import { SymMultiSelector } from "./SymMultiSelector.js";
5
- import { SymRep } from "./SymRep.js";
6
- export class SymMeasure extends SymComponent {
7
- constructor() {
8
- super(...arguments);
9
- this.id = "symMeasure";
10
- this._sections = [];
11
- this._dividerSubpaths = [];
12
- }
13
- load(logger, obj, _env, force = false) {
14
- const sections = obj.get("sections");
15
- const dividers = obj.get("dividers");
16
- const measureParam = obj.get("measureParam");
17
- const originalLength = obj.get("originalLength");
18
- const spOffsetParam = obj.get("spOffsetParam");
19
- const stretchingEPParam = obj.get("stretchingEPParam");
20
- if (!(sections instanceof Array &&
21
- dividers instanceof Array &&
22
- typeof measureParam === "string" &&
23
- typeof originalLength === "number" &&
24
- (typeof spOffsetParam === "string" || typeof stretchingEPParam === "string"))) {
25
- logger.warn("SymMeasure loading error", "data not structured as expected");
26
- return;
27
- }
28
- this._measureParam = measureParam;
29
- this._originalLength = originalLength;
30
- this._spOffsetParam = typeof spOffsetParam === "string" ? spOffsetParam : undefined;
31
- this._stretchingEPParam =
32
- typeof stretchingEPParam === "string" ? stretchingEPParam : undefined;
33
- for (const divide of dividers) {
34
- if (!(divide instanceof DexObj)) {
35
- logger.warn("SymMeasure loading error", "divider has wrong type");
36
- continue;
37
- }
38
- this._dividerSubpaths.push(new SymMeasureDivider(divide, logger));
39
- }
40
- for (const section of sections) {
41
- if (!(section instanceof DexObj)) {
42
- logger.warn("SymMeasure loading error", "section has wrong type");
43
- continue;
44
- }
45
- this._sections.push(new SymMeasureSection(section, logger));
46
- }
47
- if (VERBOSE_SYM_LOGGING) {
48
- logger.info(`SymMeasure`, `originalLength ${this.originalLength}`, `measureParam ${this.measureParam}`, `spOffsetParam ${this.spOffsetParam}`, `stretchingEPParam ${this._stretchingEPParam}`, "sections:", this.sections, "dividerSubpaths", this.dividerSubpaths);
49
- }
50
- }
51
- get measureParam() {
52
- return this._measureParam;
53
- }
54
- get originalLength() {
55
- return this._originalLength;
56
- }
57
- get spOffsetParam() {
58
- return this._spOffsetParam;
59
- }
60
- get stretchingEPParam() {
61
- return this._stretchingEPParam;
62
- }
63
- get sections() {
64
- return this._sections;
65
- }
66
- get dividerSubpaths() {
67
- return this._dividerSubpaths;
68
- }
69
- }
70
- export class SymMeasureDivider {
71
- constructor(obj, logger) {
72
- this.repToPath = new Map();
73
- const currentStretch = obj.get("currentStretch");
74
- this.currentStretch = typeof currentStretch === "number" ? currentStretch : 0;
75
- for (const key of obj.props.keys()) {
76
- // skipping static keys
77
- if (key === "currentStretch") {
78
- continue;
79
- }
80
- const subPath = obj.get(key);
81
- if (!(subPath instanceof DexObj)) {
82
- logger.warn("SymMeasureDivider loading error", "unexpected type in top object");
83
- continue;
84
- }
85
- const rep = subPath.get("rep");
86
- const path = subPath.get("path");
87
- if (!(rep instanceof DexObj)) {
88
- logger.warn("SymMeasureDivider loading error", "rep is not DexObj");
89
- continue;
90
- }
91
- const symRep = SymRep.load(rep);
92
- if (!(symRep instanceof SymRep && typeof path === "string")) {
93
- logger.warn("SymMeasureDivider loading error", "SymRep or path not correct type");
94
- continue;
95
- }
96
- this.repToPath.set(JSON.stringify(symRep), path);
97
- }
98
- if (VERBOSE_SYM_LOGGING) {
99
- logger.info(`SymMeasureDivider`, `currentStretch ${this.currentStretch}`, "repToPath:", this.repToPath);
100
- }
101
- }
102
- }
103
- export class SymMeasureSection {
104
- constructor(obj, logger) {
105
- this.gfxModeToDetailLevelToMultiSelector = new Map();
106
- const sizeChange = obj.get("sizeChange");
107
- const move = obj.get("move");
108
- const currentStretch = obj.get("currentStretch");
109
- if (typeof sizeChange !== "number" || typeof move !== "boolean") {
110
- logger.warn("SymMeasureSection loading error", "required fields missing or incorrect");
111
- }
112
- this.sizeChange = typeof sizeChange === "number" ? sizeChange : 0;
113
- this.move = typeof move === "boolean" ? move : false;
114
- this.currentStretch = typeof currentStretch === "number" ? currentStretch : 0;
115
- for (const key of obj.props.keys()) {
116
- // skipping static keys
117
- if (key === "sizeChange" || key === "move" || key === "currentStretch") {
118
- continue;
119
- }
120
- const repToSelector = obj.get(key);
121
- if (!(repToSelector instanceof DexObj)) {
122
- logger.warn("SymMeasureSection loading error", "repToSelector not of type DexObj");
123
- continue;
124
- }
125
- const rep = repToSelector.get("rep");
126
- const selector = repToSelector.get("selector");
127
- if (!(selector instanceof DexObj && rep instanceof DexObj)) {
128
- logger.warn("SymMeasureSection loading error", "rep or selector not of type DexObj");
129
- continue;
130
- }
131
- const symRep = SymRep.load(rep);
132
- if (!(symRep instanceof SymRep)) {
133
- logger.warn("SymMeasureSection loading error", "SymRep failed to load");
134
- continue;
135
- }
136
- const { mode, detail } = symRep;
137
- let detailLevelToMultiSelector = this.gfxModeToDetailLevelToMultiSelector.get(mode);
138
- if (detailLevelToMultiSelector === undefined) {
139
- detailLevelToMultiSelector = new Map();
140
- this.gfxModeToDetailLevelToMultiSelector.set(mode, detailLevelToMultiSelector);
141
- }
142
- const symMultiSelector = new SymMultiSelector(selector, logger);
143
- detailLevelToMultiSelector.set(detail, symMultiSelector);
144
- }
145
- if (VERBOSE_SYM_LOGGING) {
146
- logger.info(`SymMeasureSection`, `sizeChange ${this.sizeChange}`, `move ${this.move}`, `currentStretch ${this.currentStretch}`, "repToSelector:", this.gfxModeToDetailLevelToMultiSelector);
147
- }
148
- }
149
- }
1
+ import { DexObj } from "../../dex/DexObj.js";
2
+ import { VERBOSE_SYM_LOGGING } from "../SymNode.js";
3
+ import { SymComponent } from "./SymComponent.js";
4
+ import { SymMultiSelector } from "./SymMultiSelector.js";
5
+ import { SymRep } from "./SymRep.js";
6
+ export class SymMeasure extends SymComponent {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.id = "symMeasure";
10
+ this._sections = [];
11
+ this._dividerSubpaths = [];
12
+ }
13
+ load(logger, obj, _env, force = false) {
14
+ const sections = obj.get("sections");
15
+ const dividers = obj.get("dividers");
16
+ const measureParam = obj.get("measureParam");
17
+ const originalLength = obj.get("originalLength");
18
+ const spOffsetParam = obj.get("spOffsetParam");
19
+ const stretchingEPParam = obj.get("stretchingEPParam");
20
+ if (!(sections instanceof Array &&
21
+ dividers instanceof Array &&
22
+ typeof measureParam === "string" &&
23
+ typeof originalLength === "number" &&
24
+ (typeof spOffsetParam === "string" || typeof stretchingEPParam === "string"))) {
25
+ logger.warn("SymMeasure loading error", "data not structured as expected");
26
+ return;
27
+ }
28
+ this._measureParam = measureParam;
29
+ this._originalLength = originalLength;
30
+ this._spOffsetParam = typeof spOffsetParam === "string" ? spOffsetParam : undefined;
31
+ this._stretchingEPParam =
32
+ typeof stretchingEPParam === "string" ? stretchingEPParam : undefined;
33
+ for (const divide of dividers) {
34
+ if (!(divide instanceof DexObj)) {
35
+ logger.warn("SymMeasure loading error", "divider has wrong type");
36
+ continue;
37
+ }
38
+ this._dividerSubpaths.push(new SymMeasureDivider(divide, logger));
39
+ }
40
+ for (const section of sections) {
41
+ if (!(section instanceof DexObj)) {
42
+ logger.warn("SymMeasure loading error", "section has wrong type");
43
+ continue;
44
+ }
45
+ this._sections.push(new SymMeasureSection(section, logger));
46
+ }
47
+ if (VERBOSE_SYM_LOGGING) {
48
+ logger.info(`SymMeasure`, `originalLength ${this.originalLength}`, `measureParam ${this.measureParam}`, `spOffsetParam ${this.spOffsetParam}`, `stretchingEPParam ${this._stretchingEPParam}`, "sections:", this.sections, "dividerSubpaths", this.dividerSubpaths);
49
+ }
50
+ }
51
+ get measureParam() {
52
+ return this._measureParam;
53
+ }
54
+ get originalLength() {
55
+ return this._originalLength;
56
+ }
57
+ get spOffsetParam() {
58
+ return this._spOffsetParam;
59
+ }
60
+ get stretchingEPParam() {
61
+ return this._stretchingEPParam;
62
+ }
63
+ get sections() {
64
+ return this._sections;
65
+ }
66
+ get dividerSubpaths() {
67
+ return this._dividerSubpaths;
68
+ }
69
+ }
70
+ export class SymMeasureDivider {
71
+ constructor(obj, logger) {
72
+ this.repToPath = new Map();
73
+ const currentStretch = obj.get("currentStretch");
74
+ this.currentStretch = typeof currentStretch === "number" ? currentStretch : 0;
75
+ for (const key of obj.props.keys()) {
76
+ // skipping static keys
77
+ if (key === "currentStretch") {
78
+ continue;
79
+ }
80
+ const subPath = obj.get(key);
81
+ if (!(subPath instanceof DexObj)) {
82
+ logger.warn("SymMeasureDivider loading error", "unexpected type in top object");
83
+ continue;
84
+ }
85
+ const rep = subPath.get("rep");
86
+ const path = subPath.get("path");
87
+ if (!(rep instanceof DexObj)) {
88
+ logger.warn("SymMeasureDivider loading error", "rep is not DexObj");
89
+ continue;
90
+ }
91
+ const symRep = SymRep.load(rep);
92
+ if (!(symRep instanceof SymRep && typeof path === "string")) {
93
+ logger.warn("SymMeasureDivider loading error", "SymRep or path not correct type");
94
+ continue;
95
+ }
96
+ this.repToPath.set(JSON.stringify(symRep), path);
97
+ }
98
+ if (VERBOSE_SYM_LOGGING) {
99
+ logger.info(`SymMeasureDivider`, `currentStretch ${this.currentStretch}`, "repToPath:", this.repToPath);
100
+ }
101
+ }
102
+ }
103
+ export class SymMeasureSection {
104
+ constructor(obj, logger) {
105
+ this.gfxModeToDetailLevelToMultiSelector = new Map();
106
+ const sizeChange = obj.get("sizeChange");
107
+ const move = obj.get("move");
108
+ const currentStretch = obj.get("currentStretch");
109
+ if (typeof sizeChange !== "number" || typeof move !== "boolean") {
110
+ logger.warn("SymMeasureSection loading error", "required fields missing or incorrect");
111
+ }
112
+ this.sizeChange = typeof sizeChange === "number" ? sizeChange : 0;
113
+ this.move = typeof move === "boolean" ? move : false;
114
+ this.currentStretch = typeof currentStretch === "number" ? currentStretch : 0;
115
+ for (const key of obj.props.keys()) {
116
+ // skipping static keys
117
+ if (key === "sizeChange" || key === "move" || key === "currentStretch") {
118
+ continue;
119
+ }
120
+ const repToSelector = obj.get(key);
121
+ if (!(repToSelector instanceof DexObj)) {
122
+ logger.warn("SymMeasureSection loading error", "repToSelector not of type DexObj");
123
+ continue;
124
+ }
125
+ const rep = repToSelector.get("rep");
126
+ const selector = repToSelector.get("selector");
127
+ if (!(selector instanceof DexObj && rep instanceof DexObj)) {
128
+ logger.warn("SymMeasureSection loading error", "rep or selector not of type DexObj");
129
+ continue;
130
+ }
131
+ const symRep = SymRep.load(rep);
132
+ if (!(symRep instanceof SymRep)) {
133
+ logger.warn("SymMeasureSection loading error", "SymRep failed to load");
134
+ continue;
135
+ }
136
+ const { mode, detail } = symRep;
137
+ let detailLevelToMultiSelector = this.gfxModeToDetailLevelToMultiSelector.get(mode);
138
+ if (detailLevelToMultiSelector === undefined) {
139
+ detailLevelToMultiSelector = new Map();
140
+ this.gfxModeToDetailLevelToMultiSelector.set(mode, detailLevelToMultiSelector);
141
+ }
142
+ const symMultiSelector = new SymMultiSelector(selector, logger);
143
+ detailLevelToMultiSelector.set(detail, symMultiSelector);
144
+ }
145
+ if (VERBOSE_SYM_LOGGING) {
146
+ logger.info(`SymMeasureSection`, `sizeChange ${this.sizeChange}`, `move ${this.move}`, `currentStretch ${this.currentStretch}`, "repToSelector:", this.gfxModeToDetailLevelToMultiSelector);
147
+ }
148
+ }
149
+ }
@@ -1,30 +1,30 @@
1
- import { Logger } from "@configura/web-utilities";
2
- import { ATriMeshF } from "../../../core3D/ATriMeshF.js";
3
- import { DexObj } from "../../dex/DexObj.js";
4
- import { SymImportEnv } from "../SymImportEnv.js";
5
- import { SymInv } from "../SymInv.js";
6
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
7
- import { SymGetMeshEnv } from "./SymGetMeshEnv.js";
8
- /**
9
- * Represents a SymMesh node in the CmSym format.
10
- *
11
- * @remarks
12
- * Specification: {@link https://www.configura.com/cmsym/#SymMesh CmSym - SymMesh}
13
- */
14
- export declare class SymMesh extends SymComponent {
15
- private _mesh?;
16
- cachedKey?: string | undefined;
17
- shared: boolean;
18
- id: SymComponentKey;
19
- constructor(_mesh?: ATriMeshF | undefined, cachedKey?: string | undefined, shared?: boolean, src?: string);
20
- load(logger: Logger, dexObj: DexObj, _env: SymImportEnv, force?: boolean): void;
21
- loadLazy(logger: Logger, dexObj?: DexObj): void;
22
- loadMesh(logger: Logger, dexObj?: DexObj): Error | undefined;
23
- mesh(logger: Logger, env: SymGetMeshEnv): ATriMeshF | undefined;
24
- createUVCoordinates(logger: Logger): void;
25
- unshare(): void;
26
- dexObj(): DexObj | undefined;
27
- features(): Set<string>;
28
- invalidation(removed: boolean): SymInv[];
29
- }
1
+ import { Logger } from "@configura/web-utilities";
2
+ import { ATriMeshF } from "../../../core3D/ATriMeshF.js";
3
+ import { DexObj } from "../../dex/DexObj.js";
4
+ import { SymImportEnv } from "../SymImportEnv.js";
5
+ import { SymInv } from "../SymInv.js";
6
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
7
+ import { SymGetMeshEnv } from "./SymGetMeshEnv.js";
8
+ /**
9
+ * Represents a SymMesh node in the CmSym format.
10
+ *
11
+ * @remarks
12
+ * Specification: {@link https://www.configura.com/cmsym/#SymMesh CmSym - SymMesh}
13
+ */
14
+ export declare class SymMesh extends SymComponent {
15
+ private _mesh?;
16
+ cachedKey?: string | undefined;
17
+ shared: boolean;
18
+ id: SymComponentKey;
19
+ constructor(_mesh?: ATriMeshF | undefined, cachedKey?: string | undefined, shared?: boolean, src?: string);
20
+ load(logger: Logger, dexObj: DexObj, _env: SymImportEnv, force?: boolean): void;
21
+ loadLazy(logger: Logger, dexObj?: DexObj): void;
22
+ loadMesh(logger: Logger, dexObj?: DexObj): Error | undefined;
23
+ mesh(logger: Logger, env: SymGetMeshEnv): ATriMeshF | undefined;
24
+ createUVCoordinates(logger: Logger): void;
25
+ unshare(): void;
26
+ dexObj(): DexObj | undefined;
27
+ features(): Set<string>;
28
+ invalidation(removed: boolean): SymInv[];
29
+ }
30
30
  //# sourceMappingURL=SymMesh.d.ts.map
@@ -1,130 +1,130 @@
1
- import { ATriMeshF } from "../../../core3D/ATriMeshF.js";
2
- import { DexObj } from "../../dex/DexObj.js";
3
- import { SymComponent } from "./SymComponent.js";
4
- import { SymPropsInv, SYM_GEOMETRY_KEY, SYM_LOCAL_BOUND_KEY } from "./SymProps.js";
5
- /**
6
- * Represents a SymMesh node in the CmSym format.
7
- *
8
- * @remarks
9
- * Specification: {@link https://www.configura.com/cmsym/#SymMesh CmSym - SymMesh}
10
- */
11
- export class SymMesh extends SymComponent {
12
- constructor(_mesh, cachedKey, shared = false, src) {
13
- super(src);
14
- this._mesh = _mesh;
15
- this.cachedKey = cachedKey;
16
- this.shared = shared;
17
- this.id = "symMesh";
18
- }
19
- load(logger, dexObj, _env, force = false) {
20
- if (force) {
21
- this.loadLazy(logger, dexObj);
22
- }
23
- }
24
- loadLazy(logger, dexObj) {
25
- if (this._mesh === undefined) {
26
- this.loadMesh(logger, dexObj);
27
- }
28
- }
29
- loadMesh(logger, dexObj) {
30
- if (dexObj === undefined) {
31
- dexObj = this.dexObj();
32
- }
33
- if (dexObj !== undefined) {
34
- const meshProperty = dexObj.get("mesh");
35
- if (meshProperty instanceof DexObj) {
36
- const mesh = toATriMesh(logger, meshProperty);
37
- if (mesh instanceof Error) {
38
- return mesh;
39
- }
40
- this._mesh = mesh;
41
- }
42
- else {
43
- return logger.errorAsObject("[SymMesh.loadMesh] unexpected type:", meshProperty);
44
- }
45
- }
46
- else {
47
- return logger.errorAsObject("[SymMesh.loadMesh] no dexObj!");
48
- }
49
- }
50
- mesh(logger, env) {
51
- if (this._mesh === undefined && env.load) {
52
- this.loadMesh(logger);
53
- }
54
- const mesh = this._mesh;
55
- if (mesh === undefined) {
56
- return;
57
- }
58
- if (env.doubleSided !== !mesh.doubleSided) {
59
- this.unshare();
60
- mesh.doubleSided = env.doubleSided;
61
- }
62
- // Inside-out doesn't make any sense on double sided meshes
63
- if (env.insideOut && !mesh.doubleSided) {
64
- this.unshare();
65
- mesh.reverse();
66
- }
67
- if (!mesh.hasNormals()) {
68
- mesh.autoNormals();
69
- }
70
- if (env.requiresUVs && !mesh.hasUVCoordinates()) {
71
- this.createUVCoordinates(logger);
72
- }
73
- return this._mesh;
74
- }
75
- createUVCoordinates(logger) {
76
- throw logger.errorAsObject("[SymMesh.createUVCoordinates] not yet implemented");
77
- }
78
- unshare() {
79
- if (this.shared) {
80
- this._mesh = this._mesh && this._mesh.copy();
81
- this.cachedKey = undefined;
82
- this.shared = false;
83
- }
84
- }
85
- dexObj() {
86
- const dex = this.node && this.node.dexObj();
87
- if (dex && dex instanceof DexObj) {
88
- const dexMesh = dex.get("symMesh");
89
- if (dexMesh instanceof DexObj) {
90
- return dexMesh;
91
- }
92
- return;
93
- }
94
- }
95
- features() {
96
- return new Set(["mesh", "solid"]);
97
- }
98
- invalidation(removed) {
99
- return [new SymPropsInv(SYM_LOCAL_BOUND_KEY), new SymPropsInv(SYM_GEOMETRY_KEY)];
100
- }
101
- }
102
- function toATriMesh(logger, obj) {
103
- if (obj.type !== "ctmMesh") {
104
- return logger.errorAsObject("bad obj.type: !== ctmMesh", obj.type);
105
- }
106
- // Undefined will result in false, checked with CM code to be correct.
107
- const llto = obj.get("lowerLeftTextureOrigin");
108
- if (llto instanceof Error) {
109
- return llto;
110
- }
111
- else if (llto !== undefined && typeof llto !== "boolean") {
112
- throw logger.errorAsObject(`bad obj.lowerLeftTextureOrigin:`, llto);
113
- }
114
- // Undefined will result in false, checked with CM code to be correct.
115
- const doubleSided = obj.get("doubleSided");
116
- if (doubleSided instanceof Error) {
117
- return doubleSided;
118
- }
119
- else if (doubleSided !== undefined && typeof doubleSided !== "boolean") {
120
- throw logger.errorAsObject("bad obj.doubleSided:", doubleSided);
121
- }
122
- const data = obj.get("data");
123
- if (data instanceof Error) {
124
- return data;
125
- }
126
- else if (data instanceof Uint8Array) {
127
- return new ATriMeshF(data, llto ? true : false, doubleSided ? true : false);
128
- }
129
- return logger.errorAsObject("bad data", data);
130
- }
1
+ import { ATriMeshF } from "../../../core3D/ATriMeshF.js";
2
+ import { DexObj } from "../../dex/DexObj.js";
3
+ import { SymComponent } from "./SymComponent.js";
4
+ import { SymPropsInv, SYM_GEOMETRY_KEY, SYM_LOCAL_BOUND_KEY } from "./SymProps.js";
5
+ /**
6
+ * Represents a SymMesh node in the CmSym format.
7
+ *
8
+ * @remarks
9
+ * Specification: {@link https://www.configura.com/cmsym/#SymMesh CmSym - SymMesh}
10
+ */
11
+ export class SymMesh extends SymComponent {
12
+ constructor(_mesh, cachedKey, shared = false, src) {
13
+ super(src);
14
+ this._mesh = _mesh;
15
+ this.cachedKey = cachedKey;
16
+ this.shared = shared;
17
+ this.id = "symMesh";
18
+ }
19
+ load(logger, dexObj, _env, force = false) {
20
+ if (force) {
21
+ this.loadLazy(logger, dexObj);
22
+ }
23
+ }
24
+ loadLazy(logger, dexObj) {
25
+ if (this._mesh === undefined) {
26
+ this.loadMesh(logger, dexObj);
27
+ }
28
+ }
29
+ loadMesh(logger, dexObj) {
30
+ if (dexObj === undefined) {
31
+ dexObj = this.dexObj();
32
+ }
33
+ if (dexObj !== undefined) {
34
+ const meshProperty = dexObj.get("mesh");
35
+ if (meshProperty instanceof DexObj) {
36
+ const mesh = toATriMesh(logger, meshProperty);
37
+ if (mesh instanceof Error) {
38
+ return mesh;
39
+ }
40
+ this._mesh = mesh;
41
+ }
42
+ else {
43
+ return logger.errorAsObject("[SymMesh.loadMesh] unexpected type:", meshProperty);
44
+ }
45
+ }
46
+ else {
47
+ return logger.errorAsObject("[SymMesh.loadMesh] no dexObj!");
48
+ }
49
+ }
50
+ mesh(logger, env) {
51
+ if (this._mesh === undefined && env.load) {
52
+ this.loadMesh(logger);
53
+ }
54
+ const mesh = this._mesh;
55
+ if (mesh === undefined) {
56
+ return;
57
+ }
58
+ if (env.doubleSided !== !mesh.doubleSided) {
59
+ this.unshare();
60
+ mesh.doubleSided = env.doubleSided;
61
+ }
62
+ // Inside-out doesn't make any sense on double sided meshes
63
+ if (env.insideOut && !mesh.doubleSided) {
64
+ this.unshare();
65
+ mesh.reverse();
66
+ }
67
+ if (!mesh.hasNormals()) {
68
+ mesh.autoNormals();
69
+ }
70
+ if (env.requiresUVs && !mesh.hasUVCoordinates()) {
71
+ this.createUVCoordinates(logger);
72
+ }
73
+ return this._mesh;
74
+ }
75
+ createUVCoordinates(logger) {
76
+ throw logger.errorAsObject("[SymMesh.createUVCoordinates] not yet implemented");
77
+ }
78
+ unshare() {
79
+ if (this.shared) {
80
+ this._mesh = this._mesh && this._mesh.copy();
81
+ this.cachedKey = undefined;
82
+ this.shared = false;
83
+ }
84
+ }
85
+ dexObj() {
86
+ const dex = this.node && this.node.dexObj();
87
+ if (dex && dex instanceof DexObj) {
88
+ const dexMesh = dex.get("symMesh");
89
+ if (dexMesh instanceof DexObj) {
90
+ return dexMesh;
91
+ }
92
+ return;
93
+ }
94
+ }
95
+ features() {
96
+ return new Set(["mesh", "solid"]);
97
+ }
98
+ invalidation(removed) {
99
+ return [new SymPropsInv(SYM_LOCAL_BOUND_KEY), new SymPropsInv(SYM_GEOMETRY_KEY)];
100
+ }
101
+ }
102
+ function toATriMesh(logger, obj) {
103
+ if (obj.type !== "ctmMesh") {
104
+ return logger.errorAsObject("bad obj.type: !== ctmMesh", obj.type);
105
+ }
106
+ // Undefined will result in false, checked with CM code to be correct.
107
+ const llto = obj.get("lowerLeftTextureOrigin");
108
+ if (llto instanceof Error) {
109
+ return llto;
110
+ }
111
+ else if (llto !== undefined && typeof llto !== "boolean") {
112
+ throw logger.errorAsObject(`bad obj.lowerLeftTextureOrigin:`, llto);
113
+ }
114
+ // Undefined will result in false, checked with CM code to be correct.
115
+ const doubleSided = obj.get("doubleSided");
116
+ if (doubleSided instanceof Error) {
117
+ return doubleSided;
118
+ }
119
+ else if (doubleSided !== undefined && typeof doubleSided !== "boolean") {
120
+ throw logger.errorAsObject("bad obj.doubleSided:", doubleSided);
121
+ }
122
+ const data = obj.get("data");
123
+ if (data instanceof Error) {
124
+ return data;
125
+ }
126
+ else if (data instanceof Uint8Array) {
127
+ return new ATriMeshF(data, llto ? true : false, doubleSided ? true : false);
128
+ }
129
+ return logger.errorAsObject("bad data", data);
130
+ }
@@ -1,9 +1,9 @@
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 SymMeshLight extends SymComponent {
6
- id: SymComponentKey;
7
- load(logger: Logger, _obj: DexObj, _env: SymImportEnv, _force?: boolean): void;
8
- }
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 SymMeshLight extends SymComponent {
6
+ id: SymComponentKey;
7
+ load(logger: Logger, _obj: DexObj, _env: SymImportEnv, _force?: boolean): void;
8
+ }
9
9
  //# sourceMappingURL=SymMeshLight.d.ts.map