roavatar-renderer 1.2.11 → 1.2.12
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 +15 -0
- package/dist/index.js +138 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -646,6 +646,9 @@ export declare class CFrame {
|
|
|
646
646
|
getMatrix(): THREE.Matrix4Tuple;
|
|
647
647
|
fromMatrix(m: Mat4x4): this;
|
|
648
648
|
fromRotationMatrix(r00: number, r01: number, r02: number, r10: number, r11: number, r12: number, r20: number, r21: number, r22: number, order?: string): void;
|
|
649
|
+
lookVector(): Vec3;
|
|
650
|
+
static lookAt(eye: Vec3, target: Vec3, up?: Vec3): CFrame;
|
|
651
|
+
static fromEulerAngles(rx: number, ry: number, rz: number, order?: THREE.EulerOrder): CFrame;
|
|
649
652
|
inverse(): CFrame;
|
|
650
653
|
multiply(cf: CFrame): CFrame;
|
|
651
654
|
isSame(other: CFrame): boolean;
|
|
@@ -786,6 +789,8 @@ export declare const DefaultAnimations: {
|
|
|
786
789
|
*/
|
|
787
790
|
export declare const DefaultAnimationsR6: typeof DefaultAnimations;
|
|
788
791
|
|
|
792
|
+
export declare function DefaultGetWorkerFunc(): Worker;
|
|
793
|
+
|
|
789
794
|
export declare const defaultPantAssetIds: number[];
|
|
790
795
|
|
|
791
796
|
export declare const defaultPantTemplateAssetIds: number[];
|
|
@@ -1022,6 +1027,8 @@ export declare function GetAttachedPart(accessory: Instance, rig: Instance): Ins
|
|
|
1022
1027
|
|
|
1023
1028
|
export declare function getDistVertArray(ref: FileMesh, dist: FileMesh): (FileMeshVertex | undefined)[];
|
|
1024
1029
|
|
|
1030
|
+
export declare function getHeadExtents(rig: Instance): [Vector3, Vector3] | undefined;
|
|
1031
|
+
|
|
1025
1032
|
export declare interface GetInfoForId_Result {
|
|
1026
1033
|
"description": string;
|
|
1027
1034
|
"created": string;
|
|
@@ -1083,6 +1090,8 @@ export declare function getUVtoIndexMap(mesh: FileMesh): Map<number, number>;
|
|
|
1083
1090
|
|
|
1084
1091
|
export declare function getUVtoVertMap(mesh: FileMesh): Map<number, FileMeshVertex[]>;
|
|
1085
1092
|
|
|
1093
|
+
export declare function getWorkerOnMessage(): (event: MessageEvent) => void;
|
|
1094
|
+
|
|
1086
1095
|
export declare function hashVec2(x: number, y: number): number;
|
|
1087
1096
|
|
|
1088
1097
|
export declare function hashVec3(x: number, y: number, z: number, distance: number): number;
|
|
@@ -2512,6 +2521,8 @@ export declare class UDim2 {
|
|
|
2512
2521
|
clone(): UDim2;
|
|
2513
2522
|
}
|
|
2514
2523
|
|
|
2524
|
+
export declare function updateCameraForHeadshotCustomized(rig: Instance, fov: number, yRot: number, distance: number): void;
|
|
2525
|
+
|
|
2515
2526
|
declare type UserInfo = {
|
|
2516
2527
|
id: number;
|
|
2517
2528
|
name: string;
|
|
@@ -2628,6 +2639,10 @@ export declare type WeightChunk3 = WeightChunk & {
|
|
|
2628
2639
|
weights: Vec3[];
|
|
2629
2640
|
};
|
|
2630
2641
|
|
|
2642
|
+
export declare const WorkerTypeToFunction: {
|
|
2643
|
+
[K in string]: Function;
|
|
2644
|
+
};
|
|
2645
|
+
|
|
2631
2646
|
export declare const WrapLayerAutoSkin: {
|
|
2632
2647
|
Disabled: number;
|
|
2633
2648
|
EnabledPreserve: number;
|
package/dist/index.js
CHANGED
|
@@ -29696,6 +29696,13 @@ const WorkerTypeToFunction = {
|
|
|
29696
29696
|
"patchRBF": patchRBFWorkerFunc,
|
|
29697
29697
|
"RBFDeformerSolveAsync": RBFDeformerSolveAsync
|
|
29698
29698
|
};
|
|
29699
|
+
function getWorkerOnMessage() {
|
|
29700
|
+
return function(event) {
|
|
29701
|
+
const [id, type, data] = event.data;
|
|
29702
|
+
const func = WorkerTypeToFunction[type];
|
|
29703
|
+
self.postMessage([id, func(data)]);
|
|
29704
|
+
};
|
|
29705
|
+
}
|
|
29699
29706
|
function DefaultGetWorkerFunc() {
|
|
29700
29707
|
return new WorkerWrapper();
|
|
29701
29708
|
}
|
|
@@ -30107,6 +30114,27 @@ class CFrame {
|
|
|
30107
30114
|
r22
|
|
30108
30115
|
], order);
|
|
30109
30116
|
}
|
|
30117
|
+
lookVector() {
|
|
30118
|
+
const matrix2 = this.getTHREEMatrix();
|
|
30119
|
+
const pos = new Vector3$1();
|
|
30120
|
+
const quat = new Quaternion();
|
|
30121
|
+
const scale = new Vector3$1();
|
|
30122
|
+
matrix2.decompose(pos, quat, scale);
|
|
30123
|
+
const lookVector = new Vector3$1(0, 0, -1);
|
|
30124
|
+
lookVector.applyQuaternion(quat);
|
|
30125
|
+
return lookVector.toArray();
|
|
30126
|
+
}
|
|
30127
|
+
static lookAt(eye, target, up = [0, 1, 0]) {
|
|
30128
|
+
const matrix2 = new Matrix4().lookAt(new Vector3$1(...eye), new Vector3$1(...target), new Vector3$1(...up));
|
|
30129
|
+
const newCFrame = new CFrame();
|
|
30130
|
+
newCFrame.fromMatrix(matrix2.elements);
|
|
30131
|
+
newCFrame.Position = [...eye];
|
|
30132
|
+
return newCFrame;
|
|
30133
|
+
}
|
|
30134
|
+
static fromEulerAngles(rx, ry, rz, order = "XYZ") {
|
|
30135
|
+
const matrix2 = new Matrix4().makeRotationFromEuler(new Euler(rx, ry, rz, order));
|
|
30136
|
+
return new CFrame().fromMatrix(matrix2.elements);
|
|
30137
|
+
}
|
|
30110
30138
|
inverse() {
|
|
30111
30139
|
const thisM = new Matrix4().fromArray(this.getMatrix());
|
|
30112
30140
|
const inverse = thisM.clone();
|
|
@@ -62690,6 +62718,111 @@ class HSR {
|
|
|
62690
62718
|
}
|
|
62691
62719
|
}
|
|
62692
62720
|
}
|
|
62721
|
+
function getCorners(cframe, size2) {
|
|
62722
|
+
const halfX = size2.X / 2;
|
|
62723
|
+
const halfY = size2.Y / 2;
|
|
62724
|
+
const halfZ = size2.Z / 2;
|
|
62725
|
+
return [
|
|
62726
|
+
cframe.multiply(new CFrame(halfX, halfY, halfZ)),
|
|
62727
|
+
cframe.multiply(new CFrame(halfX, halfY, -halfZ)),
|
|
62728
|
+
cframe.multiply(new CFrame(-halfX, halfY, halfZ)),
|
|
62729
|
+
cframe.multiply(new CFrame(-halfX, halfY, -halfZ)),
|
|
62730
|
+
cframe.multiply(new CFrame(halfX, -halfY, halfZ)),
|
|
62731
|
+
cframe.multiply(new CFrame(halfX, -halfY, -halfZ)),
|
|
62732
|
+
cframe.multiply(new CFrame(-halfX, -halfY, halfZ)),
|
|
62733
|
+
cframe.multiply(new CFrame(-halfX, -halfY, -halfZ))
|
|
62734
|
+
];
|
|
62735
|
+
}
|
|
62736
|
+
function getLower(a, b) {
|
|
62737
|
+
return new Vector32(
|
|
62738
|
+
a.X < b.X ? a.X : b.X,
|
|
62739
|
+
a.Y < b.Y ? a.Y : b.Y,
|
|
62740
|
+
a.Z < b.Z ? a.Z : b.Z
|
|
62741
|
+
);
|
|
62742
|
+
}
|
|
62743
|
+
function getHigher(a, b) {
|
|
62744
|
+
return new Vector32(
|
|
62745
|
+
a.X > b.X ? a.X : b.X,
|
|
62746
|
+
a.Y > b.Y ? a.Y : b.Y,
|
|
62747
|
+
a.Z > b.Z ? a.Z : b.Z
|
|
62748
|
+
);
|
|
62749
|
+
}
|
|
62750
|
+
function getExtents(cframe, parts) {
|
|
62751
|
+
const inverseCF = cframe.inverse();
|
|
62752
|
+
let lowerExtents = new Vector32(0, 0, 0);
|
|
62753
|
+
let higherExtents = new Vector32(0, 0, 0);
|
|
62754
|
+
for (const child of parts) {
|
|
62755
|
+
if (child.className === "Part" || child.className === "MeshPart") {
|
|
62756
|
+
const partCF = child.Prop("CFrame");
|
|
62757
|
+
const partSize = child.Prop("Size");
|
|
62758
|
+
const corners = getCorners(inverseCF.multiply(partCF), partSize);
|
|
62759
|
+
for (const corner of corners) {
|
|
62760
|
+
lowerExtents = getLower(lowerExtents, new Vector32().fromVec3(corner.Position));
|
|
62761
|
+
higherExtents = getHigher(higherExtents, new Vector32().fromVec3(corner.Position));
|
|
62762
|
+
}
|
|
62763
|
+
}
|
|
62764
|
+
}
|
|
62765
|
+
return [lowerExtents, higherExtents];
|
|
62766
|
+
}
|
|
62767
|
+
function zoomExtents(cameraCFrame, modelCFrame, modelSize, targetFOV, distanceScale) {
|
|
62768
|
+
const largestSize = Math.max(modelSize.X, modelSize.Y, modelSize.Z);
|
|
62769
|
+
const fovMultiplier = 70 / targetFOV;
|
|
62770
|
+
const lookDir = multiply$1(normalize(minus(cameraCFrame.Position, modelCFrame.Position)), [distanceScale, distanceScale, distanceScale]);
|
|
62771
|
+
cameraCFrame.Position = add$2(modelCFrame.Position, multiply$1(multiply$1(lookDir, [largestSize, largestSize, largestSize]), [fovMultiplier, fovMultiplier, fovMultiplier]));
|
|
62772
|
+
}
|
|
62773
|
+
function getHeadExtents(rig) {
|
|
62774
|
+
const head = rig.FindFirstChild("Head");
|
|
62775
|
+
if (!head) return;
|
|
62776
|
+
const headParts = [];
|
|
62777
|
+
for (const child of rig.GetDescendants()) {
|
|
62778
|
+
if (child === head) {
|
|
62779
|
+
headParts.push(head);
|
|
62780
|
+
} else {
|
|
62781
|
+
const weld = child.FindFirstChildOfClass("Weld");
|
|
62782
|
+
if (weld && child.parent && child.parent.className === "Accessory") {
|
|
62783
|
+
if (weld.Prop("Part0") === head || weld.Prop("Part1") === head) {
|
|
62784
|
+
headParts.push(child);
|
|
62785
|
+
}
|
|
62786
|
+
}
|
|
62787
|
+
}
|
|
62788
|
+
}
|
|
62789
|
+
const extents = getExtents(head.Prop("CFrame"), headParts);
|
|
62790
|
+
return extents;
|
|
62791
|
+
}
|
|
62792
|
+
function updateCameraForHeadshotCustomized(rig, fov2, yRot, distance2) {
|
|
62793
|
+
const head = rig.FindFirstChild("Head");
|
|
62794
|
+
if (!head) return;
|
|
62795
|
+
const headCF = head.PropOrDefault("CFrame", new CFrame());
|
|
62796
|
+
const headLocalExtents = getHeadExtents(rig);
|
|
62797
|
+
if (!headLocalExtents) return;
|
|
62798
|
+
const headCenterPosLocal = headLocalExtents[0].add(headLocalExtents[1].minus(headLocalExtents[0]).divide(new Vector32(2, 2, 2)));
|
|
62799
|
+
const headCenterPos = new Vector32().fromVec3(headCF.multiply(new CFrame(...headCenterPosLocal.toVec3())).Position);
|
|
62800
|
+
const headCenterCF = new CFrame(...headCenterPos.toVec3());
|
|
62801
|
+
let lookVector = headCF.lookVector();
|
|
62802
|
+
if (Math.abs(lookVector[1]) > 0.95) {
|
|
62803
|
+
lookVector = [0, 0, -1];
|
|
62804
|
+
} else {
|
|
62805
|
+
lookVector[1] = 0;
|
|
62806
|
+
lookVector = normalize(lookVector);
|
|
62807
|
+
}
|
|
62808
|
+
let lookCF = CFrame.lookAt([0, 0, 0], lookVector);
|
|
62809
|
+
lookCF = lookCF.multiply(CFrame.fromEulerAngles(0, yRot, 0, "ZXY"));
|
|
62810
|
+
lookVector = lookCF.lookVector();
|
|
62811
|
+
const fovMultiplier = 70 / fov2;
|
|
62812
|
+
lookCF.Position = add$2(headCenterCF.Position, multiply$1(multiply$1([10, 10, 10], lookVector), [fovMultiplier, fovMultiplier, fovMultiplier]));
|
|
62813
|
+
lookCF = CFrame.lookAt(lookCF.Position, headCenterCF.Position);
|
|
62814
|
+
const cameraCF = lookCF.clone();
|
|
62815
|
+
zoomExtents(cameraCF, headCenterCF, headLocalExtents[1].minus(headLocalExtents[0]), fov2, distance2);
|
|
62816
|
+
const camPos = new Vector3$1();
|
|
62817
|
+
const camQuat = new Quaternion();
|
|
62818
|
+
const camScale = new Vector3$1();
|
|
62819
|
+
const camMatrix = cameraCF.getTHREEMatrix();
|
|
62820
|
+
camMatrix.decompose(camPos, camQuat, camScale);
|
|
62821
|
+
RBXRenderer.getRendererCamera().position.set(...camPos.toArray());
|
|
62822
|
+
RBXRenderer.getRendererCamera().quaternion.set(...camQuat.toArray());
|
|
62823
|
+
RBXRenderer.getRendererCamera().fov = fov2;
|
|
62824
|
+
RBXRenderer.getRendererCamera().updateMatrixWorld();
|
|
62825
|
+
}
|
|
62693
62826
|
class OutfitRenderer {
|
|
62694
62827
|
auth;
|
|
62695
62828
|
outfit;
|
|
@@ -62925,6 +63058,7 @@ export {
|
|
|
62925
63058
|
DataType,
|
|
62926
63059
|
DefaultAnimations,
|
|
62927
63060
|
DefaultAnimationsR6,
|
|
63061
|
+
DefaultGetWorkerFunc,
|
|
62928
63062
|
DefaultSearchData,
|
|
62929
63063
|
EmitterGroupDescClassTypes,
|
|
62930
63064
|
Event,
|
|
@@ -62996,6 +63130,7 @@ export {
|
|
|
62996
63130
|
Vector32 as Vector3,
|
|
62997
63131
|
Wait,
|
|
62998
63132
|
WearableAssetTypes,
|
|
63133
|
+
WorkerTypeToFunction,
|
|
62999
63134
|
WrapLayerAutoSkin,
|
|
63000
63135
|
accessoryRefinementLowerBounds,
|
|
63001
63136
|
accessoryRefinementTypes,
|
|
@@ -63038,12 +63173,14 @@ export {
|
|
|
63038
63173
|
gaussian_rbf,
|
|
63039
63174
|
generateUUIDv4,
|
|
63040
63175
|
getDistVertArray,
|
|
63176
|
+
getHeadExtents,
|
|
63041
63177
|
getOffsetArray,
|
|
63042
63178
|
getOffsetMap,
|
|
63043
63179
|
getOriginalSize,
|
|
63044
63180
|
getRandomBetweenInclusive,
|
|
63045
63181
|
getUVtoIndexMap,
|
|
63046
63182
|
getUVtoVertMap,
|
|
63183
|
+
getWorkerOnMessage,
|
|
63047
63184
|
hasSameVal,
|
|
63048
63185
|
hasSameValFloat,
|
|
63049
63186
|
hashVec2,
|
|
@@ -63091,6 +63228,7 @@ export {
|
|
|
63091
63228
|
traverseRigCFrame,
|
|
63092
63229
|
traverseRigInstance,
|
|
63093
63230
|
triangleNormal,
|
|
63231
|
+
updateCameraForHeadshotCustomized,
|
|
63094
63232
|
versionToNumber,
|
|
63095
63233
|
vertPosToChunkPos,
|
|
63096
63234
|
xmlMagic
|