roavatar-renderer 1.9.3 → 1.9.5
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/dist/index.d.ts +11 -1
- package/dist/index.js +61 -42
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1520,7 +1520,13 @@ export declare class FileMesh {
|
|
|
1520
1520
|
setBoneSource(name: string): void;
|
|
1521
1521
|
setBoneSourceSize(): void;
|
|
1522
1522
|
combine(other: FileMesh): void;
|
|
1523
|
-
|
|
1523
|
+
/**
|
|
1524
|
+
*
|
|
1525
|
+
* @param distance
|
|
1526
|
+
* @param updateFaces This also fixes the faces (but it doesnt actually since its broken)
|
|
1527
|
+
* @returns
|
|
1528
|
+
*/
|
|
1529
|
+
removeDuplicateVertices(distance?: number, updateFaces?: boolean): number;
|
|
1524
1530
|
removeFaces(indices: number[]): void;
|
|
1525
1531
|
basicSkin(boneNames: string[]): void;
|
|
1526
1532
|
getValidationIssue(): "subsetLengthMismatch" | undefined;
|
|
@@ -2240,6 +2246,10 @@ export declare class Instance {
|
|
|
2240
2246
|
setParent(instance: Instance | undefined | null, fireEvents?: boolean): void;
|
|
2241
2247
|
Destroy(): void;
|
|
2242
2248
|
GetFullName(): string;
|
|
2249
|
+
/**
|
|
2250
|
+
* @returns A reference to Instance._children, dangerous since the array can be modified by the Instance due to setParent and similar
|
|
2251
|
+
*/
|
|
2252
|
+
GetChildrenDangerous(): Instance[];
|
|
2243
2253
|
GetChildren(): Instance[];
|
|
2244
2254
|
GetDescendants(): Instance[];
|
|
2245
2255
|
FindFirstChild(name: string): Instance | undefined;
|
package/dist/index.js
CHANGED
|
@@ -33114,7 +33114,7 @@ class CFrame {
|
|
|
33114
33114
|
return new Matrix4().compose(new Vector3$1(...this.Position), new Quaternion().setFromEuler(new Euler(rad(this.Orientation[0]), rad(this.Orientation[1]), rad(this.Orientation[2]), "YXZ")), new Vector3$1(1, 1, 1));
|
|
33115
33115
|
}
|
|
33116
33116
|
getMatrix() {
|
|
33117
|
-
return this.getTHREEMatrix().
|
|
33117
|
+
return this.getTHREEMatrix().elements;
|
|
33118
33118
|
}
|
|
33119
33119
|
fromMatrix(m) {
|
|
33120
33120
|
this.Orientation = rotationMatrixToEulerAngles([
|
|
@@ -33197,14 +33197,13 @@ class CFrame {
|
|
|
33197
33197
|
return euler.toArray();
|
|
33198
33198
|
}
|
|
33199
33199
|
inverse() {
|
|
33200
|
-
const
|
|
33201
|
-
const inverse = thisM.clone();
|
|
33200
|
+
const inverse = this.getTHREEMatrix();
|
|
33202
33201
|
inverse.invert();
|
|
33203
33202
|
return new CFrame().fromMatrix(inverse.elements);
|
|
33204
33203
|
}
|
|
33205
33204
|
multiply(cf) {
|
|
33206
|
-
const thisM =
|
|
33207
|
-
const cfM =
|
|
33205
|
+
const thisM = this.getTHREEMatrix();
|
|
33206
|
+
const cfM = cf.getTHREEMatrix();
|
|
33208
33207
|
const newM = thisM.multiply(cfM);
|
|
33209
33208
|
const newCf = new CFrame().fromMatrix(newM.elements);
|
|
33210
33209
|
return newCf;
|
|
@@ -33635,17 +33634,23 @@ class Instance {
|
|
|
33635
33634
|
return this.name || "null";
|
|
33636
33635
|
}
|
|
33637
33636
|
}
|
|
33637
|
+
/**
|
|
33638
|
+
* @returns A reference to Instance._children, dangerous since the array can be modified by the Instance due to setParent and similar
|
|
33639
|
+
*/
|
|
33640
|
+
GetChildrenDangerous() {
|
|
33641
|
+
return this._children;
|
|
33642
|
+
}
|
|
33638
33643
|
GetChildren() {
|
|
33639
|
-
|
|
33640
|
-
for (const child of this._children) {
|
|
33641
|
-
childrenList.push(child);
|
|
33642
|
-
}
|
|
33643
|
-
return childrenList;
|
|
33644
|
+
return [...this._children];
|
|
33644
33645
|
}
|
|
33645
33646
|
GetDescendants() {
|
|
33646
|
-
|
|
33647
|
-
|
|
33648
|
-
|
|
33647
|
+
const toCheck = this.GetChildren();
|
|
33648
|
+
const descendants = [...toCheck];
|
|
33649
|
+
while (toCheck.length > 0) {
|
|
33650
|
+
const child = toCheck.pop();
|
|
33651
|
+
const children = child.GetChildrenDangerous();
|
|
33652
|
+
toCheck.push(...children);
|
|
33653
|
+
descendants.push(...children);
|
|
33649
33654
|
}
|
|
33650
33655
|
return descendants;
|
|
33651
33656
|
}
|
|
@@ -39041,10 +39046,15 @@ class FileMesh {
|
|
|
39041
39046
|
this.skinning.setWeight(ogSkinningsSize + i, other.skinning.getWeight(i));
|
|
39042
39047
|
}
|
|
39043
39048
|
}
|
|
39044
|
-
|
|
39049
|
+
/**
|
|
39050
|
+
*
|
|
39051
|
+
* @param distance
|
|
39052
|
+
* @param updateFaces This also fixes the faces (but it doesnt actually since its broken)
|
|
39053
|
+
* @returns
|
|
39054
|
+
*/
|
|
39055
|
+
removeDuplicateVertices(distance2 = 1e-4, updateFaces = false) {
|
|
39045
39056
|
const posToIndex = /* @__PURE__ */ new Map();
|
|
39046
39057
|
const remap = new Array(this.coreMesh.numverts).fill(-1);
|
|
39047
|
-
const vertToSubset = new Array(this.coreMesh.numverts).fill(-1);
|
|
39048
39058
|
for (let i = 0; i < this.coreMesh.numverts; i++) {
|
|
39049
39059
|
const pos = this.coreMesh.getPos(i);
|
|
39050
39060
|
const uv = this.coreMesh.getUV(i);
|
|
@@ -39061,27 +39071,26 @@ class FileMesh {
|
|
|
39061
39071
|
remap[i] = i;
|
|
39062
39072
|
}
|
|
39063
39073
|
}
|
|
39064
|
-
for (let i = 0; i < this.coreMesh.numfaces; i++) {
|
|
39065
|
-
const remapFace = this.coreMesh.getFace(remap[i]);
|
|
39066
|
-
this.coreMesh.setFace(i, clonePrimitiveArray(remapFace));
|
|
39067
|
-
}
|
|
39068
39074
|
const newVerts = [];
|
|
39069
39075
|
const newSkinnings = [];
|
|
39070
|
-
const newSubsetIndices = [];
|
|
39071
39076
|
const newIndex = /* @__PURE__ */ new Map();
|
|
39072
39077
|
for (let i = 0; i < this.coreMesh.numverts; i++) {
|
|
39073
39078
|
const canonical = remap[i];
|
|
39074
39079
|
if (!newIndex.has(canonical)) {
|
|
39075
39080
|
newIndex.set(canonical, newVerts.length);
|
|
39076
39081
|
newVerts.push(canonical);
|
|
39077
|
-
newSubsetIndices.push(vertToSubset[i]);
|
|
39078
39082
|
newSkinnings.push(canonical);
|
|
39079
39083
|
}
|
|
39080
39084
|
remap[i] = newIndex.get(canonical);
|
|
39081
39085
|
}
|
|
39082
|
-
|
|
39083
|
-
|
|
39084
|
-
|
|
39086
|
+
if (updateFaces) {
|
|
39087
|
+
for (let i = 0; i < this.coreMesh.numfaces; i++) {
|
|
39088
|
+
const face = this.coreMesh.getFace(i);
|
|
39089
|
+
face[0] = remap[face[0]];
|
|
39090
|
+
face[1] = remap[face[1]];
|
|
39091
|
+
face[2] = remap[face[2]];
|
|
39092
|
+
this.coreMesh.setFace(i, face);
|
|
39093
|
+
}
|
|
39085
39094
|
}
|
|
39086
39095
|
this.coreMesh.onlyVerts(newVerts);
|
|
39087
39096
|
this.skinning.onlySkinnings(newSkinnings);
|
|
@@ -44181,21 +44190,20 @@ class AccessoryWrapper extends InstanceWrapper {
|
|
|
44181
44190
|
if (humanoid) {
|
|
44182
44191
|
const handle = this.instance.FindFirstChild("Handle");
|
|
44183
44192
|
if (handle) {
|
|
44184
|
-
|
|
44185
|
-
let bodyAttachment = null;
|
|
44186
|
-
for (const child of handle.GetChildren()) {
|
|
44193
|
+
for (const child of handle.GetChildrenDangerous()) {
|
|
44187
44194
|
if (child.className === "Attachment") {
|
|
44188
|
-
const
|
|
44189
|
-
for (const
|
|
44190
|
-
if (
|
|
44191
|
-
|
|
44192
|
-
|
|
44193
|
-
|
|
44195
|
+
const bodyParts = this.instance.parent.GetChildrenDangerous();
|
|
44196
|
+
for (const bodyPart of bodyParts) {
|
|
44197
|
+
if (bodyPart.className !== "Part" && bodyPart.className !== "MeshPart") continue;
|
|
44198
|
+
const bodyPartChildren = bodyPart.GetChildrenDangerous();
|
|
44199
|
+
for (const bodyChild of bodyPartChildren) {
|
|
44200
|
+
if (bodyChild.className === "Attachment" && child && bodyChild.Property("Name") === child.Property("Name") && bodyChild.parent && bodyChild.parent.parent === this.instance.parent) {
|
|
44201
|
+
return [bodyChild, child];
|
|
44202
|
+
}
|
|
44194
44203
|
}
|
|
44195
44204
|
}
|
|
44196
44205
|
}
|
|
44197
44206
|
}
|
|
44198
|
-
if (bodyAttachment && accessoryAttachment) return [bodyAttachment, accessoryAttachment];
|
|
44199
44207
|
}
|
|
44200
44208
|
}
|
|
44201
44209
|
}
|
|
@@ -44208,12 +44216,9 @@ class AccessoryWrapper extends InstanceWrapper {
|
|
|
44208
44216
|
if (handle) {
|
|
44209
44217
|
const attachmentPair = this.getBodyAccessoryAttachmentPair();
|
|
44210
44218
|
const oldAccessoryWeld = handle.FindFirstChild("AccessoryWeld");
|
|
44211
|
-
if (oldAccessoryWeld) {
|
|
44212
|
-
oldAccessoryWeld.Destroy();
|
|
44213
|
-
}
|
|
44214
44219
|
if (attachmentPair) {
|
|
44215
44220
|
const [bodyAttachment, accessoryAttachment] = attachmentPair;
|
|
44216
|
-
const weld = new Instance("Weld");
|
|
44221
|
+
const weld = oldAccessoryWeld || new Instance("Weld");
|
|
44217
44222
|
weld.addProperty(new Property("Name", DataType.String), "AccessoryWeld");
|
|
44218
44223
|
weld.addProperty(new Property("Archivable", DataType.Bool), true);
|
|
44219
44224
|
weld.addProperty(new Property("C1", DataType.CFrame), accessoryAttachment.Property("CFrame").clone());
|
|
@@ -44228,7 +44233,7 @@ class AccessoryWrapper extends InstanceWrapper {
|
|
|
44228
44233
|
const head = this.instance.parent.FindFirstChild("Head");
|
|
44229
44234
|
if (!head) return;
|
|
44230
44235
|
const attachmentPoint = this.instance.PropOrDefault("AttachmentPoint", new CFrame());
|
|
44231
|
-
const weld = new Instance("Weld");
|
|
44236
|
+
const weld = oldAccessoryWeld || new Instance("Weld");
|
|
44232
44237
|
weld.addProperty(new Property("Name", DataType.String), "AccessoryWeld");
|
|
44233
44238
|
weld.addProperty(new Property("Archivable", DataType.Bool), true);
|
|
44234
44239
|
weld.addProperty(new Property("C1", DataType.CFrame), attachmentPoint.clone());
|
|
@@ -48634,7 +48639,12 @@ class ObjectDesc extends RenderDesc {
|
|
|
48634
48639
|
threeMesh.scale.set(this.size.X, this.size.Y, this.size.Z);
|
|
48635
48640
|
} else {
|
|
48636
48641
|
const oldSize = this.originalScale;
|
|
48637
|
-
|
|
48642
|
+
const [sX, sY, sZ] = [
|
|
48643
|
+
specialClamp(this.size.X / oldSize.x, 1e-5, 1e6),
|
|
48644
|
+
specialClamp(this.size.Y / oldSize.y, 1e-5, 1e6),
|
|
48645
|
+
specialClamp(this.size.Z / oldSize.z, 1e-5, 1e6)
|
|
48646
|
+
];
|
|
48647
|
+
threeMesh.scale.set(sX, sY, sZ);
|
|
48638
48648
|
}
|
|
48639
48649
|
if (SkeletonDesc.descNeedsSkeleton(this.meshDesc)) {
|
|
48640
48650
|
this.skeletonDesc = new SkeletonDesc(this, this.meshDesc, scene);
|
|
@@ -48663,7 +48673,12 @@ class ObjectDesc extends RenderDesc {
|
|
|
48663
48673
|
return new Vector3(this.size.X, this.size.Y, this.size.Z);
|
|
48664
48674
|
} else {
|
|
48665
48675
|
const oldSize = this.originalScale;
|
|
48666
|
-
|
|
48676
|
+
const [sX, sY, sZ] = [
|
|
48677
|
+
specialClamp(this.size.X / oldSize.x, 1e-5, 1e6),
|
|
48678
|
+
specialClamp(this.size.Y / oldSize.y, 1e-5, 1e6),
|
|
48679
|
+
specialClamp(this.size.Z / oldSize.z, 1e-5, 1e6)
|
|
48680
|
+
];
|
|
48681
|
+
return new Vector3(sX, sY, sZ);
|
|
48667
48682
|
}
|
|
48668
48683
|
}
|
|
48669
48684
|
updateResults() {
|
|
@@ -52553,7 +52568,7 @@ class EmitterDesc extends DisposableDesc {
|
|
|
52553
52568
|
const size = this.size.getValue(this.normalizeSizeKeypointTime ? normalizedTime : time2, particle.seed + 0);
|
|
52554
52569
|
const squash = this.squash.getValue(this.normalizeSizeKeypointTime ? normalizedTime : time2, particle.seed + 2);
|
|
52555
52570
|
const opacity = 1 - this.transparency.getValue(normalizedTime, particle.seed + 1);
|
|
52556
|
-
const flipbookFramerate = mathRandom(this.flipbookFramerate.Min, this.flipbookFramerate.Max, new RNG(particle.seed + 67).nextFloat());
|
|
52571
|
+
const flipbookFramerate = mathRandom(this.flipbookFramerate.Min, this.flipbookFramerate.Max, new RNG(particle.seed + 67).nextFloat()) || 1;
|
|
52557
52572
|
let flipbookFrameTime = this.flipbookMode === ParticleFlipbookMode.OneShot ? particle.lifetime / flipbookTotal : 1 / flipbookFramerate;
|
|
52558
52573
|
if (!this.flipbookBlendFrames) flipbookFrameTime = 1e6;
|
|
52559
52574
|
this.result.setMatrixAt(i, particle.getMatrix(renderScene, size, this.orientation, squash));
|
|
@@ -62315,6 +62330,10 @@ class RBXRenderer {
|
|
|
62315
62330
|
controls.domElement = newCanvas;
|
|
62316
62331
|
controls.connect(newCanvas);
|
|
62317
62332
|
}
|
|
62333
|
+
const effectComposer = renderScene.effectComposer;
|
|
62334
|
+
if (effectComposer) {
|
|
62335
|
+
RBXRenderer.createEffectComposer(renderScene);
|
|
62336
|
+
}
|
|
62318
62337
|
for (const renderDesc of renderScene.renderDescs.values()) {
|
|
62319
62338
|
if (renderDesc instanceof ObjectDesc) {
|
|
62320
62339
|
const materialDesc = renderDesc.materialDesc;
|