@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.
- package/.eslintrc.json +5 -5
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/cm/basic/Color.d.ts +16 -16
- package/dist/cm/basic/Color.js +18 -18
- package/dist/cm/basic/ColorF.d.ts +9 -9
- package/dist/cm/basic/ColorF.js +10 -10
- package/dist/cm/basic/boolean.d.ts +2 -2
- package/dist/cm/basic/boolean.js +11 -11
- package/dist/cm/basic/number.d.ts +3 -3
- package/dist/cm/basic/number.js +18 -18
- package/dist/cm/basic/string.d.ts +2 -2
- package/dist/cm/basic/string.js +11 -11
- package/dist/cm/core3D/ATriMeshF.d.ts +96 -96
- package/dist/cm/core3D/ATriMeshF.js +197 -197
- package/dist/cm/core3D/GMaterial3D.d.ts +62 -62
- package/dist/cm/core3D/GMaterial3D.js +112 -112
- package/dist/cm/core3D/GMaterialClassic.d.ts +55 -55
- package/dist/cm/core3D/GMaterialClassic.js +171 -171
- package/dist/cm/core3D/GMaterialPBR.d.ts +73 -73
- package/dist/cm/core3D/GMaterialPBR.js +314 -314
- package/dist/cm/core3D/MultiGMaterial3D.d.ts +8 -8
- package/dist/cm/core3D/MultiGMaterial3D.js +17 -17
- package/dist/cm/core3D/uvmapper/UVMapEnv.d.ts +19 -19
- package/dist/cm/core3D/uvmapper/UVMapEnv.js +47 -47
- package/dist/cm/core3D/uvmapper/UVMapper.d.ts +41 -41
- package/dist/cm/core3D/uvmapper/UVMapper.js +94 -94
- package/dist/cm/core3D/uvmapper/UVMapperBox.d.ts +4 -4
- package/dist/cm/core3D/uvmapper/UVMapperBox.js +181 -181
- package/dist/cm/core3D/uvmapper/UVMapperCylinder.d.ts +9 -9
- package/dist/cm/core3D/uvmapper/UVMapperCylinder.js +96 -96
- package/dist/cm/core3D/uvmapper/UVMapperPlane.d.ts +3 -3
- package/dist/cm/core3D/uvmapper/UVMapperPlane.js +84 -84
- package/dist/cm/core3D/uvmapper/UVTransformer.d.ts +5 -5
- package/dist/cm/core3D/uvmapper/UVTransformer.js +5 -5
- package/dist/cm/core3D/uvmapper/instantiateUVMapper.d.ts +3 -3
- package/dist/cm/core3D/uvmapper/instantiateUVMapper.js +4 -4
- package/dist/cm/format/cmsym/InvalidationEnv.d.ts +9 -9
- package/dist/cm/format/cmsym/InvalidationEnv.js +13 -13
- package/dist/cm/format/cmsym/SymImportEnv.d.ts +9 -9
- package/dist/cm/format/cmsym/SymImportEnv.js +9 -9
- package/dist/cm/format/cmsym/SymInv.d.ts +8 -8
- package/dist/cm/format/cmsym/SymInv.js +17 -17
- package/dist/cm/format/cmsym/SymNode.d.ts +94 -94
- package/dist/cm/format/cmsym/SymNode.js +652 -652
- package/dist/cm/format/cmsym/components/SymBox.d.ts +15 -15
- package/dist/cm/format/cmsym/components/SymBox.js +39 -39
- package/dist/cm/format/cmsym/components/SymComponent.d.ts +29 -29
- package/dist/cm/format/cmsym/components/SymComponent.js +56 -56
- package/dist/cm/format/cmsym/components/SymConnector.d.ts +5 -5
- package/dist/cm/format/cmsym/components/SymConnector.js +10 -10
- package/dist/cm/format/cmsym/components/SymDexObj.d.ts +11 -11
- package/dist/cm/format/cmsym/components/SymDexObj.js +10 -10
- package/dist/cm/format/cmsym/components/SymGFX.d.ts +11 -11
- package/dist/cm/format/cmsym/components/SymGFX.js +20 -20
- package/dist/cm/format/cmsym/components/SymGMaterial.d.ts +19 -19
- package/dist/cm/format/cmsym/components/SymGMaterial.js +88 -88
- package/dist/cm/format/cmsym/components/SymGMaterialSelector.d.ts +17 -17
- package/dist/cm/format/cmsym/components/SymGMaterialSelector.js +22 -22
- package/dist/cm/format/cmsym/components/SymGetMeshEnv.d.ts +9 -9
- package/dist/cm/format/cmsym/components/SymGetMeshEnv.js +9 -9
- package/dist/cm/format/cmsym/components/SymLODGroup.d.ts +9 -9
- package/dist/cm/format/cmsym/components/SymLODGroup.js +13 -13
- package/dist/cm/format/cmsym/components/SymLight.d.ts +8 -8
- package/dist/cm/format/cmsym/components/SymLight.js +10 -10
- package/dist/cm/format/cmsym/components/SymLines2D.d.ts +5 -5
- package/dist/cm/format/cmsym/components/SymLines2D.js +7 -7
- package/dist/cm/format/cmsym/components/SymMeasure.d.ts +33 -33
- package/dist/cm/format/cmsym/components/SymMeasure.js +149 -149
- package/dist/cm/format/cmsym/components/SymMesh.d.ts +29 -29
- package/dist/cm/format/cmsym/components/SymMesh.js +130 -130
- package/dist/cm/format/cmsym/components/SymMeshLight.d.ts +8 -8
- package/dist/cm/format/cmsym/components/SymMeshLight.js +10 -10
- package/dist/cm/format/cmsym/components/SymMultiSelector.d.ts +13 -13
- package/dist/cm/format/cmsym/components/SymMultiSelector.js +48 -48
- package/dist/cm/format/cmsym/components/SymParams.d.ts +16 -16
- package/dist/cm/format/cmsym/components/SymParams.js +58 -58
- package/dist/cm/format/cmsym/components/SymPlane.d.ts +15 -15
- package/dist/cm/format/cmsym/components/SymPlane.js +30 -30
- package/dist/cm/format/cmsym/components/SymPlaneDivider.d.ts +4 -4
- package/dist/cm/format/cmsym/components/SymPlaneDivider.js +7 -7
- package/dist/cm/format/cmsym/components/SymPrimitive2D.d.ts +3 -3
- package/dist/cm/format/cmsym/components/SymPrimitive2D.js +3 -3
- package/dist/cm/format/cmsym/components/SymProgs.d.ts +32 -32
- package/dist/cm/format/cmsym/components/SymProgs.js +120 -120
- package/dist/cm/format/cmsym/components/SymProps.d.ts +54 -54
- package/dist/cm/format/cmsym/components/SymProps.js +171 -171
- package/dist/cm/format/cmsym/components/SymRep.d.ts +13 -13
- package/dist/cm/format/cmsym/components/SymRep.js +28 -28
- package/dist/cm/format/cmsym/components/SymReps.d.ts +36 -36
- package/dist/cm/format/cmsym/components/SymReps.js +230 -230
- package/dist/cm/format/cmsym/components/SymShape.d.ts +10 -10
- package/dist/cm/format/cmsym/components/SymShape.js +17 -17
- package/dist/cm/format/cmsym/components/SymSphere.d.ts +18 -18
- package/dist/cm/format/cmsym/components/SymSphere.js +33 -33
- package/dist/cm/format/cmsym/components/SymSpotlight.d.ts +8 -8
- package/dist/cm/format/cmsym/components/SymSpotlight.js +10 -10
- package/dist/cm/format/cmsym/components/SymTags.d.ts +11 -11
- package/dist/cm/format/cmsym/components/SymTags.js +20 -20
- package/dist/cm/format/cmsym/components/SymText2D.d.ts +5 -5
- package/dist/cm/format/cmsym/components/SymText2D.js +8 -8
- package/dist/cm/format/cmsym/components/SymText3D.d.ts +5 -5
- package/dist/cm/format/cmsym/components/SymText3D.js +8 -8
- package/dist/cm/format/cmsym/components/SymTransform.d.ts +23 -23
- package/dist/cm/format/cmsym/components/SymTransform.js +101 -101
- package/dist/cm/format/cmsym/components/SymUVMapper.d.ts +13 -13
- package/dist/cm/format/cmsym/components/SymUVMapper.js +50 -50
- package/dist/cm/format/cmsym/components/instantiate.d.ts +2 -2
- package/dist/cm/format/cmsym/components/instantiate.js +121 -121
- package/dist/cm/format/cmsym/components/legacy.d.ts +7 -7
- package/dist/cm/format/cmsym/components/legacy.js +27 -27
- package/dist/cm/format/cmsym/components/mesh.d.ts +8 -8
- package/dist/cm/format/cmsym/components/mesh.js +28 -28
- package/dist/cm/format/cmsym/invalidation.d.ts +4 -4
- package/dist/cm/format/cmsym/invalidation.js +72 -72
- package/dist/cm/format/dex/DexIRef.d.ts +9 -9
- package/dist/cm/format/dex/DexIRef.js +18 -18
- package/dist/cm/format/dex/DexInt.d.ts +11 -11
- package/dist/cm/format/dex/DexInt.js +18 -18
- package/dist/cm/format/dex/DexInternalizedXRef.d.ts +19 -19
- package/dist/cm/format/dex/DexInternalizedXRef.js +65 -65
- package/dist/cm/format/dex/DexLoader.d.ts +8 -8
- package/dist/cm/format/dex/DexLoader.js +12 -12
- package/dist/cm/format/dex/DexManager.d.ts +20 -20
- package/dist/cm/format/dex/DexManager.js +78 -78
- package/dist/cm/format/dex/DexObj.d.ts +15 -15
- package/dist/cm/format/dex/DexObj.js +86 -86
- package/dist/cm/format/dex/DexReader.d.ts +90 -90
- package/dist/cm/format/dex/DexReader.js +532 -532
- package/dist/cm/format/dex/DexRef.d.ts +6 -6
- package/dist/cm/format/dex/DexRef.js +8 -8
- package/dist/cm/format/dex/DexReplacedXRefs.d.ts +9 -9
- package/dist/cm/format/dex/DexReplacedXRefs.js +22 -22
- package/dist/cm/format/dex/DexURL.d.ts +4 -4
- package/dist/cm/format/dex/DexURL.js +5 -5
- package/dist/cm/format/dex/DexVersion.d.ts +15 -15
- package/dist/cm/format/dex/DexVersion.js +53 -53
- package/dist/cm/format/dex/DexXRef.d.ts +18 -18
- package/dist/cm/format/dex/DexXRef.js +51 -51
- package/dist/cm/format/dex/DexXRefTargetFilter.d.ts +4 -4
- package/dist/cm/format/dex/DexXRefTargetFilter.js +5 -5
- package/dist/cm/geometry/Angle.d.ts +9 -9
- package/dist/cm/geometry/Angle.js +18 -18
- package/dist/cm/geometry/AngleF.d.ts +5 -5
- package/dist/cm/geometry/AngleF.js +8 -8
- package/dist/cm/geometry/Box.d.ts +7 -7
- package/dist/cm/geometry/Box.js +9 -9
- package/dist/cm/geometry/DetailMask.d.ts +37 -37
- package/dist/cm/geometry/DetailMask.js +114 -114
- package/dist/cm/geometry/LayerExpr.d.ts +2 -2
- package/dist/cm/geometry/LayerExpr.js +2 -2
- package/dist/cm/geometry/Matrix22.d.ts +7 -7
- package/dist/cm/geometry/Matrix22.js +9 -9
- package/dist/cm/geometry/Matrix33.d.ts +42 -42
- package/dist/cm/geometry/Matrix33.js +124 -124
- package/dist/cm/geometry/Orientation.d.ts +7 -7
- package/dist/cm/geometry/Orientation.js +7 -7
- package/dist/cm/geometry/Plane.d.ts +8 -8
- package/dist/cm/geometry/Plane.js +14 -14
- package/dist/cm/geometry/Point.d.ts +21 -21
- package/dist/cm/geometry/Point.js +65 -65
- package/dist/cm/geometry/Point2D.d.ts +9 -9
- package/dist/cm/geometry/Point2D.js +23 -23
- package/dist/cm/geometry/PointF.d.ts +11 -11
- package/dist/cm/geometry/PointF.js +27 -27
- package/dist/cm/geometry/Transform.d.ts +11 -11
- package/dist/cm/geometry/Transform.js +61 -61
- package/dist/cm/geometry/Transform2D.d.ts +7 -7
- package/dist/cm/geometry/Transform2D.js +6 -6
- package/dist/cm/io/Semver.d.ts +18 -18
- package/dist/cm/io/Semver.js +61 -61
- package/dist/index.js +1 -1
- package/package.json +4 -4
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
import { DexObj } from "../format/dex/DexObj.js";
|
|
2
|
-
import { GMaterial3D, GMaterial3DTexture, imageUrlFromDex, textureWrapFromDex, } from "./GMaterial3D.js";
|
|
3
|
-
// tslint:disable:max-classes-per-file
|
|
4
|
-
export class GMaterialClassic extends GMaterial3D {
|
|
5
|
-
constructor(log, obj) {
|
|
6
|
-
super(log, obj);
|
|
7
|
-
if (obj === undefined) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
let property = obj.get("diffuse");
|
|
11
|
-
if (property instanceof DexObj) {
|
|
12
|
-
this.diffuse = new Diffuse3D();
|
|
13
|
-
readBaseMaterialProps(log, this.diffuse, property);
|
|
14
|
-
const amount = property.get("amount");
|
|
15
|
-
if (typeof amount === "number") {
|
|
16
|
-
this.diffuse.amount = amount;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
property = obj.get("ambient");
|
|
20
|
-
if (property instanceof DexObj) {
|
|
21
|
-
this.ambient = new Ambient3D();
|
|
22
|
-
readBaseMaterialProps(log, this.ambient, property);
|
|
23
|
-
const amount = property.get("amount");
|
|
24
|
-
if (typeof amount === "number") {
|
|
25
|
-
this.ambient.amount = amount;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
property = obj.get("specular");
|
|
29
|
-
if (property instanceof DexObj) {
|
|
30
|
-
this.specular = new Specular3D();
|
|
31
|
-
readBaseMaterialProps(log, this.specular, property);
|
|
32
|
-
const amount = property.get("amount");
|
|
33
|
-
const exponent = property.get("exponent");
|
|
34
|
-
if (typeof amount === "number") {
|
|
35
|
-
this.specular.amount = amount;
|
|
36
|
-
}
|
|
37
|
-
if (typeof exponent === "number") {
|
|
38
|
-
this.specular.exponent = exponent;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
property = obj.get("transparency");
|
|
42
|
-
if (property instanceof DexObj) {
|
|
43
|
-
const alpha = property.get("alphaThreshold");
|
|
44
|
-
if (alpha !== undefined && typeof alpha !== "number") {
|
|
45
|
-
throw log.errorAsObject("bad alpha:", alpha);
|
|
46
|
-
}
|
|
47
|
-
const opacity = property.get("opacity");
|
|
48
|
-
if (opacity !== undefined && typeof opacity !== "number") {
|
|
49
|
-
throw log.errorAsObject("bad opacity:", opacity);
|
|
50
|
-
}
|
|
51
|
-
this.transparency = new Transparency3D(alpha, opacity);
|
|
52
|
-
readBaseMaterialProps(log, this.transparency, property);
|
|
53
|
-
}
|
|
54
|
-
property = obj.get("reflection");
|
|
55
|
-
if (property instanceof DexObj) {
|
|
56
|
-
this.reflection = new Reflection3D();
|
|
57
|
-
readBaseMaterialProps(log, this.reflection, property);
|
|
58
|
-
const amount = property.get("amount");
|
|
59
|
-
if (typeof amount === "number") {
|
|
60
|
-
this.reflection.amount = amount;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
property = obj.get("refraction");
|
|
64
|
-
if (property instanceof DexObj) {
|
|
65
|
-
this.refraction = new Refraction3D();
|
|
66
|
-
readBaseMaterialProps(log, this.refraction, property);
|
|
67
|
-
const index = property.get("index");
|
|
68
|
-
if (typeof index === "number") {
|
|
69
|
-
this.refraction.index = index;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else if (property !== undefined) {
|
|
73
|
-
log.warn("material property 'refraction' is of an unexpected type", property);
|
|
74
|
-
}
|
|
75
|
-
property = obj.get("bump");
|
|
76
|
-
if (property instanceof DexObj) {
|
|
77
|
-
this.bump = new Bump3D();
|
|
78
|
-
readBaseMaterialProps(log, this.bump, property);
|
|
79
|
-
const amount = property.get("amount");
|
|
80
|
-
const bumpEffectRR = property.get("effectRR");
|
|
81
|
-
const texturePrepared = property.get("prepared");
|
|
82
|
-
if (typeof amount === "number") {
|
|
83
|
-
this.bump.amount = amount;
|
|
84
|
-
}
|
|
85
|
-
if (typeof bumpEffectRR === "number") {
|
|
86
|
-
this.bump.effectRR = bumpEffectRR;
|
|
87
|
-
}
|
|
88
|
-
if (typeof texturePrepared === "boolean") {
|
|
89
|
-
this.bump.prepared = texturePrepared;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else if (property !== undefined) {
|
|
93
|
-
log.warn("material property 'bump' is of an unexpected type", property);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
export class GMaterialProp3D extends GMaterial3DTexture {
|
|
98
|
-
setTextureUrl(url) {
|
|
99
|
-
if (url !== this.textureUrl) {
|
|
100
|
-
this._avgTextureColor = undefined;
|
|
101
|
-
this.textureUrl = url;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
export class Diffuse3D extends GMaterialProp3D {
|
|
106
|
-
constructor(amount = 1) {
|
|
107
|
-
super(0 /* classicDiffuse */);
|
|
108
|
-
this.amount = amount;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
export class Ambient3D extends GMaterialProp3D {
|
|
112
|
-
constructor(amount = 1) {
|
|
113
|
-
super(1 /* classicAmbient */);
|
|
114
|
-
this.amount = amount;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
export class Emission3D extends GMaterialProp3D {
|
|
118
|
-
}
|
|
119
|
-
export class Specular3D extends GMaterialProp3D {
|
|
120
|
-
constructor(exponent, amount = 1) {
|
|
121
|
-
super(3 /* classicSpecular */);
|
|
122
|
-
this.exponent = exponent;
|
|
123
|
-
this.amount = amount;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
export class Transparency3D extends GMaterialProp3D {
|
|
127
|
-
constructor(alphaThreshold, opacity) {
|
|
128
|
-
super(4 /* classicTransparency */);
|
|
129
|
-
this.alphaThreshold = alphaThreshold;
|
|
130
|
-
this.opacity = opacity;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
export class Reflection3D extends GMaterialProp3D {
|
|
134
|
-
constructor(amount) {
|
|
135
|
-
super(5 /* classicReflection */);
|
|
136
|
-
this.amount = amount;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
export class Refraction3D extends GMaterialProp3D {
|
|
140
|
-
constructor(index) {
|
|
141
|
-
super(6 /* classicRefraction */);
|
|
142
|
-
this.index = index;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
export class Bump3D extends GMaterialProp3D {
|
|
146
|
-
constructor(amount, effectRR, prepared) {
|
|
147
|
-
super(7 /* classicBump */);
|
|
148
|
-
this.amount = amount;
|
|
149
|
-
this.effectRR = effectRR;
|
|
150
|
-
this.prepared = prepared;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function readBaseMaterialProps(log, prop, obj) {
|
|
154
|
-
var _a, _b, _c, _d;
|
|
155
|
-
const imageUrl = imageUrlFromDex(log, obj);
|
|
156
|
-
if (imageUrl !== undefined) {
|
|
157
|
-
prop.setTextureUrl(imageUrl);
|
|
158
|
-
}
|
|
159
|
-
prop.c = obj.get("c");
|
|
160
|
-
prop.uScale = (_a = obj.get("uScale")) !== null && _a !== void 0 ? _a : prop.uScale;
|
|
161
|
-
prop.vScale = (_b = obj.get("vScale")) !== null && _b !== void 0 ? _b : prop.vScale;
|
|
162
|
-
prop.uOffset = (_c = obj.get("uOffset")) !== null && _c !== void 0 ? _c : prop.uOffset;
|
|
163
|
-
prop.vOffset = (_d = obj.get("vOffset")) !== null && _d !== void 0 ? _d : prop.vOffset;
|
|
164
|
-
const angleF = obj.get("rot");
|
|
165
|
-
if (angleF !== undefined) {
|
|
166
|
-
prop.rot = angleF.radians;
|
|
167
|
-
}
|
|
168
|
-
const wrap = textureWrapFromDex(obj);
|
|
169
|
-
if (wrap !== undefined)
|
|
170
|
-
prop.wrapU = prop.wrapV = wrap;
|
|
171
|
-
}
|
|
1
|
+
import { DexObj } from "../format/dex/DexObj.js";
|
|
2
|
+
import { GMaterial3D, GMaterial3DTexture, imageUrlFromDex, textureWrapFromDex, } from "./GMaterial3D.js";
|
|
3
|
+
// tslint:disable:max-classes-per-file
|
|
4
|
+
export class GMaterialClassic extends GMaterial3D {
|
|
5
|
+
constructor(log, obj) {
|
|
6
|
+
super(log, obj);
|
|
7
|
+
if (obj === undefined) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
let property = obj.get("diffuse");
|
|
11
|
+
if (property instanceof DexObj) {
|
|
12
|
+
this.diffuse = new Diffuse3D();
|
|
13
|
+
readBaseMaterialProps(log, this.diffuse, property);
|
|
14
|
+
const amount = property.get("amount");
|
|
15
|
+
if (typeof amount === "number") {
|
|
16
|
+
this.diffuse.amount = amount;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
property = obj.get("ambient");
|
|
20
|
+
if (property instanceof DexObj) {
|
|
21
|
+
this.ambient = new Ambient3D();
|
|
22
|
+
readBaseMaterialProps(log, this.ambient, property);
|
|
23
|
+
const amount = property.get("amount");
|
|
24
|
+
if (typeof amount === "number") {
|
|
25
|
+
this.ambient.amount = amount;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
property = obj.get("specular");
|
|
29
|
+
if (property instanceof DexObj) {
|
|
30
|
+
this.specular = new Specular3D();
|
|
31
|
+
readBaseMaterialProps(log, this.specular, property);
|
|
32
|
+
const amount = property.get("amount");
|
|
33
|
+
const exponent = property.get("exponent");
|
|
34
|
+
if (typeof amount === "number") {
|
|
35
|
+
this.specular.amount = amount;
|
|
36
|
+
}
|
|
37
|
+
if (typeof exponent === "number") {
|
|
38
|
+
this.specular.exponent = exponent;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
property = obj.get("transparency");
|
|
42
|
+
if (property instanceof DexObj) {
|
|
43
|
+
const alpha = property.get("alphaThreshold");
|
|
44
|
+
if (alpha !== undefined && typeof alpha !== "number") {
|
|
45
|
+
throw log.errorAsObject("bad alpha:", alpha);
|
|
46
|
+
}
|
|
47
|
+
const opacity = property.get("opacity");
|
|
48
|
+
if (opacity !== undefined && typeof opacity !== "number") {
|
|
49
|
+
throw log.errorAsObject("bad opacity:", opacity);
|
|
50
|
+
}
|
|
51
|
+
this.transparency = new Transparency3D(alpha, opacity);
|
|
52
|
+
readBaseMaterialProps(log, this.transparency, property);
|
|
53
|
+
}
|
|
54
|
+
property = obj.get("reflection");
|
|
55
|
+
if (property instanceof DexObj) {
|
|
56
|
+
this.reflection = new Reflection3D();
|
|
57
|
+
readBaseMaterialProps(log, this.reflection, property);
|
|
58
|
+
const amount = property.get("amount");
|
|
59
|
+
if (typeof amount === "number") {
|
|
60
|
+
this.reflection.amount = amount;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
property = obj.get("refraction");
|
|
64
|
+
if (property instanceof DexObj) {
|
|
65
|
+
this.refraction = new Refraction3D();
|
|
66
|
+
readBaseMaterialProps(log, this.refraction, property);
|
|
67
|
+
const index = property.get("index");
|
|
68
|
+
if (typeof index === "number") {
|
|
69
|
+
this.refraction.index = index;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (property !== undefined) {
|
|
73
|
+
log.warn("material property 'refraction' is of an unexpected type", property);
|
|
74
|
+
}
|
|
75
|
+
property = obj.get("bump");
|
|
76
|
+
if (property instanceof DexObj) {
|
|
77
|
+
this.bump = new Bump3D();
|
|
78
|
+
readBaseMaterialProps(log, this.bump, property);
|
|
79
|
+
const amount = property.get("amount");
|
|
80
|
+
const bumpEffectRR = property.get("effectRR");
|
|
81
|
+
const texturePrepared = property.get("prepared");
|
|
82
|
+
if (typeof amount === "number") {
|
|
83
|
+
this.bump.amount = amount;
|
|
84
|
+
}
|
|
85
|
+
if (typeof bumpEffectRR === "number") {
|
|
86
|
+
this.bump.effectRR = bumpEffectRR;
|
|
87
|
+
}
|
|
88
|
+
if (typeof texturePrepared === "boolean") {
|
|
89
|
+
this.bump.prepared = texturePrepared;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (property !== undefined) {
|
|
93
|
+
log.warn("material property 'bump' is of an unexpected type", property);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export class GMaterialProp3D extends GMaterial3DTexture {
|
|
98
|
+
setTextureUrl(url) {
|
|
99
|
+
if (url !== this.textureUrl) {
|
|
100
|
+
this._avgTextureColor = undefined;
|
|
101
|
+
this.textureUrl = url;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export class Diffuse3D extends GMaterialProp3D {
|
|
106
|
+
constructor(amount = 1) {
|
|
107
|
+
super(0 /* classicDiffuse */);
|
|
108
|
+
this.amount = amount;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export class Ambient3D extends GMaterialProp3D {
|
|
112
|
+
constructor(amount = 1) {
|
|
113
|
+
super(1 /* classicAmbient */);
|
|
114
|
+
this.amount = amount;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export class Emission3D extends GMaterialProp3D {
|
|
118
|
+
}
|
|
119
|
+
export class Specular3D extends GMaterialProp3D {
|
|
120
|
+
constructor(exponent, amount = 1) {
|
|
121
|
+
super(3 /* classicSpecular */);
|
|
122
|
+
this.exponent = exponent;
|
|
123
|
+
this.amount = amount;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export class Transparency3D extends GMaterialProp3D {
|
|
127
|
+
constructor(alphaThreshold, opacity) {
|
|
128
|
+
super(4 /* classicTransparency */);
|
|
129
|
+
this.alphaThreshold = alphaThreshold;
|
|
130
|
+
this.opacity = opacity;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export class Reflection3D extends GMaterialProp3D {
|
|
134
|
+
constructor(amount) {
|
|
135
|
+
super(5 /* classicReflection */);
|
|
136
|
+
this.amount = amount;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export class Refraction3D extends GMaterialProp3D {
|
|
140
|
+
constructor(index) {
|
|
141
|
+
super(6 /* classicRefraction */);
|
|
142
|
+
this.index = index;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
export class Bump3D extends GMaterialProp3D {
|
|
146
|
+
constructor(amount, effectRR, prepared) {
|
|
147
|
+
super(7 /* classicBump */);
|
|
148
|
+
this.amount = amount;
|
|
149
|
+
this.effectRR = effectRR;
|
|
150
|
+
this.prepared = prepared;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function readBaseMaterialProps(log, prop, obj) {
|
|
154
|
+
var _a, _b, _c, _d;
|
|
155
|
+
const imageUrl = imageUrlFromDex(log, obj);
|
|
156
|
+
if (imageUrl !== undefined) {
|
|
157
|
+
prop.setTextureUrl(imageUrl);
|
|
158
|
+
}
|
|
159
|
+
prop.c = obj.get("c");
|
|
160
|
+
prop.uScale = (_a = obj.get("uScale")) !== null && _a !== void 0 ? _a : prop.uScale;
|
|
161
|
+
prop.vScale = (_b = obj.get("vScale")) !== null && _b !== void 0 ? _b : prop.vScale;
|
|
162
|
+
prop.uOffset = (_c = obj.get("uOffset")) !== null && _c !== void 0 ? _c : prop.uOffset;
|
|
163
|
+
prop.vOffset = (_d = obj.get("vOffset")) !== null && _d !== void 0 ? _d : prop.vOffset;
|
|
164
|
+
const angleF = obj.get("rot");
|
|
165
|
+
if (angleF !== undefined) {
|
|
166
|
+
prop.rot = angleF.radians;
|
|
167
|
+
}
|
|
168
|
+
const wrap = textureWrapFromDex(obj);
|
|
169
|
+
if (wrap !== undefined)
|
|
170
|
+
prop.wrapU = prop.wrapV = wrap;
|
|
171
|
+
}
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { Logger } from "@configura/web-utilities";
|
|
2
|
-
import { ColorF } from "../basic/ColorF.js";
|
|
3
|
-
import { DexObj } from "../format/dex/DexObj.js";
|
|
4
|
-
import { DexURL } from "../format/dex/DexURL.js";
|
|
5
|
-
import { GMaterial3D, GMaterial3DTexture, TextureType } from "./GMaterial3D.js";
|
|
6
|
-
export declare class GMaterialPBR extends GMaterial3D {
|
|
7
|
-
base?: PBRBase;
|
|
8
|
-
emissive?: PBREmissive;
|
|
9
|
-
metallic?: PBRMetallic;
|
|
10
|
-
normal?: PBRNormal;
|
|
11
|
-
occlusion?: PBROcclusion;
|
|
12
|
-
opacity?: PBROpacity;
|
|
13
|
-
refraction?: PBRRefraction;
|
|
14
|
-
roughness?: PBRRoughness;
|
|
15
|
-
constructor(log: Logger, obj?: DexObj);
|
|
16
|
-
}
|
|
17
|
-
export declare type PBRTextureChannel = "r" | "g" | "b" | "a";
|
|
18
|
-
export declare type PBRTextureChannels = PBRTextureChannel | "rgb" | "rgba";
|
|
19
|
-
export declare type PBROpacityMode = "opaque" | "mask" | "translucent" | "translucentAndMask";
|
|
20
|
-
export declare type PBRTextureFilter = "linear" | "nearest";
|
|
21
|
-
export declare class PBRTexture extends GMaterial3DTexture {
|
|
22
|
-
constructor(type: TextureType, imageUrl: DexURL);
|
|
23
|
-
textureUrl: DexURL;
|
|
24
|
-
}
|
|
25
|
-
export declare class PBRBase {
|
|
26
|
-
readonly factor: ColorF;
|
|
27
|
-
readonly texture?: PBRTexture | undefined;
|
|
28
|
-
constructor(factor: ColorF, texture?: PBRTexture | undefined);
|
|
29
|
-
}
|
|
30
|
-
export declare class PBREmissive {
|
|
31
|
-
readonly factor: ColorF;
|
|
32
|
-
readonly texture?: PBRTexture | undefined;
|
|
33
|
-
constructor(factor: ColorF, texture?: PBRTexture | undefined);
|
|
34
|
-
}
|
|
35
|
-
export declare class PBRMetallic {
|
|
36
|
-
readonly factor: number;
|
|
37
|
-
readonly texture?: PBRTexture | undefined;
|
|
38
|
-
readonly channel?: "b" | "r" | undefined;
|
|
39
|
-
constructor(factor: number, texture?: PBRTexture | undefined, channel?: "b" | "r" | undefined);
|
|
40
|
-
}
|
|
41
|
-
export declare class PBRNormal {
|
|
42
|
-
readonly scale: number;
|
|
43
|
-
readonly texture?: PBRTexture | undefined;
|
|
44
|
-
readonly channels?: PBRTextureChannels | undefined;
|
|
45
|
-
constructor(scale: number, texture?: PBRTexture | undefined, channels?: PBRTextureChannels | undefined);
|
|
46
|
-
}
|
|
47
|
-
export declare class PBROcclusion {
|
|
48
|
-
readonly strength: number;
|
|
49
|
-
readonly texture?: PBRTexture | undefined;
|
|
50
|
-
readonly channel?: "a" | "r" | undefined;
|
|
51
|
-
constructor(strength: number, // default 0
|
|
52
|
-
texture?: PBRTexture | undefined, channel?: "a" | "r" | undefined);
|
|
53
|
-
}
|
|
54
|
-
export declare class PBROpacity {
|
|
55
|
-
readonly factor: number;
|
|
56
|
-
readonly mode: PBROpacityMode;
|
|
57
|
-
maskThreshold: number;
|
|
58
|
-
readonly texture?: PBRTexture | undefined;
|
|
59
|
-
readonly channels?: "a" | "r" | undefined;
|
|
60
|
-
readonly useAlphaFromBase?: boolean | undefined;
|
|
61
|
-
constructor(factor: number, mode: PBROpacityMode, maskThreshold: number, texture?: PBRTexture | undefined, channels?: "a" | "r" | undefined, // Undocumented in CmSym-spec, r seem to mean rgb
|
|
62
|
-
useAlphaFromBase?: boolean | undefined);
|
|
63
|
-
}
|
|
64
|
-
export declare class PBRRefraction {
|
|
65
|
-
readonly ior: number;
|
|
66
|
-
constructor(ior: number);
|
|
67
|
-
}
|
|
68
|
-
export declare class PBRRoughness {
|
|
69
|
-
readonly factor: number;
|
|
70
|
-
readonly texture?: PBRTexture | undefined;
|
|
71
|
-
readonly channel?: "a" | "g" | undefined;
|
|
72
|
-
constructor(factor: number, texture?: PBRTexture | undefined, channel?: "a" | "g" | undefined);
|
|
73
|
-
}
|
|
1
|
+
import { Logger } from "@configura/web-utilities";
|
|
2
|
+
import { ColorF } from "../basic/ColorF.js";
|
|
3
|
+
import { DexObj } from "../format/dex/DexObj.js";
|
|
4
|
+
import { DexURL } from "../format/dex/DexURL.js";
|
|
5
|
+
import { GMaterial3D, GMaterial3DTexture, TextureType } from "./GMaterial3D.js";
|
|
6
|
+
export declare class GMaterialPBR extends GMaterial3D {
|
|
7
|
+
base?: PBRBase;
|
|
8
|
+
emissive?: PBREmissive;
|
|
9
|
+
metallic?: PBRMetallic;
|
|
10
|
+
normal?: PBRNormal;
|
|
11
|
+
occlusion?: PBROcclusion;
|
|
12
|
+
opacity?: PBROpacity;
|
|
13
|
+
refraction?: PBRRefraction;
|
|
14
|
+
roughness?: PBRRoughness;
|
|
15
|
+
constructor(log: Logger, obj?: DexObj);
|
|
16
|
+
}
|
|
17
|
+
export declare type PBRTextureChannel = "r" | "g" | "b" | "a";
|
|
18
|
+
export declare type PBRTextureChannels = PBRTextureChannel | "rgb" | "rgba";
|
|
19
|
+
export declare type PBROpacityMode = "opaque" | "mask" | "translucent" | "translucentAndMask";
|
|
20
|
+
export declare type PBRTextureFilter = "linear" | "nearest";
|
|
21
|
+
export declare class PBRTexture extends GMaterial3DTexture {
|
|
22
|
+
constructor(type: TextureType, imageUrl: DexURL);
|
|
23
|
+
textureUrl: DexURL;
|
|
24
|
+
}
|
|
25
|
+
export declare class PBRBase {
|
|
26
|
+
readonly factor: ColorF;
|
|
27
|
+
readonly texture?: PBRTexture | undefined;
|
|
28
|
+
constructor(factor: ColorF, texture?: PBRTexture | undefined);
|
|
29
|
+
}
|
|
30
|
+
export declare class PBREmissive {
|
|
31
|
+
readonly factor: ColorF;
|
|
32
|
+
readonly texture?: PBRTexture | undefined;
|
|
33
|
+
constructor(factor: ColorF, texture?: PBRTexture | undefined);
|
|
34
|
+
}
|
|
35
|
+
export declare class PBRMetallic {
|
|
36
|
+
readonly factor: number;
|
|
37
|
+
readonly texture?: PBRTexture | undefined;
|
|
38
|
+
readonly channel?: "b" | "r" | undefined;
|
|
39
|
+
constructor(factor: number, texture?: PBRTexture | undefined, channel?: "b" | "r" | undefined);
|
|
40
|
+
}
|
|
41
|
+
export declare class PBRNormal {
|
|
42
|
+
readonly scale: number;
|
|
43
|
+
readonly texture?: PBRTexture | undefined;
|
|
44
|
+
readonly channels?: PBRTextureChannels | undefined;
|
|
45
|
+
constructor(scale: number, texture?: PBRTexture | undefined, channels?: PBRTextureChannels | undefined);
|
|
46
|
+
}
|
|
47
|
+
export declare class PBROcclusion {
|
|
48
|
+
readonly strength: number;
|
|
49
|
+
readonly texture?: PBRTexture | undefined;
|
|
50
|
+
readonly channel?: "a" | "r" | undefined;
|
|
51
|
+
constructor(strength: number, // default 0
|
|
52
|
+
texture?: PBRTexture | undefined, channel?: "a" | "r" | undefined);
|
|
53
|
+
}
|
|
54
|
+
export declare class PBROpacity {
|
|
55
|
+
readonly factor: number;
|
|
56
|
+
readonly mode: PBROpacityMode;
|
|
57
|
+
maskThreshold: number;
|
|
58
|
+
readonly texture?: PBRTexture | undefined;
|
|
59
|
+
readonly channels?: "a" | "r" | undefined;
|
|
60
|
+
readonly useAlphaFromBase?: boolean | undefined;
|
|
61
|
+
constructor(factor: number, mode: PBROpacityMode, maskThreshold: number, texture?: PBRTexture | undefined, channels?: "a" | "r" | undefined, // Undocumented in CmSym-spec, r seem to mean rgb
|
|
62
|
+
useAlphaFromBase?: boolean | undefined);
|
|
63
|
+
}
|
|
64
|
+
export declare class PBRRefraction {
|
|
65
|
+
readonly ior: number;
|
|
66
|
+
constructor(ior: number);
|
|
67
|
+
}
|
|
68
|
+
export declare class PBRRoughness {
|
|
69
|
+
readonly factor: number;
|
|
70
|
+
readonly texture?: PBRTexture | undefined;
|
|
71
|
+
readonly channel?: "a" | "g" | undefined;
|
|
72
|
+
constructor(factor: number, texture?: PBRTexture | undefined, channel?: "a" | "g" | undefined);
|
|
73
|
+
}
|
|
74
74
|
//# sourceMappingURL=GMaterialPBR.d.ts.map
|