roavatar-renderer 1.4.3 → 1.4.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/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # Renderer for RoAvatar
2
2
  The Roblox Avatar renderer used by https://github.com/steinann/RoAvatar
3
3
 
4
- Links: [npm](https://www.npmjs.com/package/roavatar-renderer) | [GitHub](https://github.com/steinann/RoAvatar-Renderer)
5
-
6
- Docs: [Documentation](https://steinann.github.io/RoAvatar-Renderer/)
4
+ Links: [npm](https://www.npmjs.com/package/roavatar-renderer) | [GitHub](https://github.com/steinann/RoAvatar-Renderer) | [docs](https://steinann.github.io/RoAvatar-Renderer/)
7
5
 
8
6
  > **IMPORTANT** <br>
9
7
  > Assets are *NOT* included in the npm module or this repository, you have to get them from the main RoAvatar repository OR set
package/dist/index.d.ts CHANGED
@@ -39,6 +39,7 @@ export declare const accessoryRefinementTypes: number[];
39
39
  /** @category Outfit */
40
40
  export declare const accessoryRefinementUpperBounds: typeof accessoryRefinementLowerBounds;
41
41
 
42
+ /**@category DataModelEnum */
42
43
  export declare const AccessoryType: {
43
44
  Unknown: number;
44
45
  Hat: number;
@@ -103,6 +104,7 @@ export declare const AllHeadShapes: string[];
103
104
  */
104
105
  export declare const AllInstances: Instance[];
105
106
 
107
+ /**@category DataModelEnum */
106
108
  export declare const AlphaMode: {
107
109
  Overlay: number;
108
110
  Transparency: number;
@@ -280,6 +282,7 @@ export declare const API: {
280
282
  parseAssetString: (str: string) => string;
281
283
  getCDNURLFromAssetDelivery: (url: string, headers?: any) => Promise<string | Response>;
282
284
  assetURLToCDNURL: (url: string | number | bigint, headers?: any, extraStr?: string) => Promise<string | Response>;
285
+ getCurrentlyLoading: () => boolean;
283
286
  };
284
287
  Events: {
285
288
  OnLoadingAssets: Event_2;
@@ -515,6 +518,7 @@ export declare class Authentication {
515
518
  getSessionUUID(): string;
516
519
  }
517
520
 
521
+ /**@category API */
518
522
  export declare interface AvatarInventory_Result {
519
523
  avatarInventoryItems: {
520
524
  itemId: number;
@@ -587,14 +591,10 @@ declare class BaseKeyframeGroup {
587
591
  getHigherKeyframe(time: number): BaseKeyframe | null;
588
592
  }
589
593
 
590
- /**
591
- * @category Outfit
592
- */
594
+ /**@category Outfit */
593
595
  export declare type BodyColor3Name = "headColor3" | "torsoColor3" | "rightArmColor3" | "leftArmColor3" | "rightLegColor3" | "leftLegColor3";
594
596
 
595
- /**
596
- * @category Outfit
597
- */
597
+ /**@category Outfit */
598
598
  export declare class BodyColor3s {
599
599
  colorType: ColorType;
600
600
  headColor3: string;
@@ -618,6 +618,7 @@ export declare class BodyColor3s {
618
618
  fromJson(bodyColorsJson: BodyColor3sJson): void;
619
619
  }
620
620
 
621
+ /**@category Outfit */
621
622
  export declare type BodyColor3sJson = {
622
623
  headColor3?: string;
623
624
  torsoColor3?: string;
@@ -627,9 +628,7 @@ export declare type BodyColor3sJson = {
627
628
  leftLegColor3?: string;
628
629
  };
629
630
 
630
- /**
631
- * @category Outfit
632
- */
631
+ /**@category Outfit */
633
632
  export declare class BodyColors {
634
633
  colorType: ColorType;
635
634
  headColorId: number;
@@ -654,6 +653,7 @@ export declare class BodyColors {
654
653
  toColor3(): BodyColor3s;
655
654
  }
656
655
 
656
+ /**@category Outfit */
657
657
  export declare type BodyColorsJson = {
658
658
  headColorId?: number;
659
659
  torsoColorId?: number;
@@ -674,6 +674,7 @@ export declare class BodyColorsWrapper extends InstanceWrapper {
674
674
  update(): void;
675
675
  }
676
676
 
677
+ /**@category DataModelEnum */
677
678
  export declare const BodyPart: {
678
679
  Head: number;
679
680
  Torso: number;
@@ -728,6 +729,7 @@ export declare function BuildJoints(self: RigData): void;
728
729
  */
729
730
  export declare function buildVertKD(mesh: FileMesh): KDNode | null;
730
731
 
732
+ /**@category API */
731
733
  export declare interface BundleDetails_Result {
732
734
  bundleType: number;
733
735
  bundledItems: {
@@ -829,6 +831,7 @@ export declare function cleanString(inputString: string): string;
829
831
 
830
832
  export declare function clonePrimitiveArray<T>(arr: T[]): any[];
831
833
 
834
+ /**@category API */
832
835
  export declare function cloneSearch_Payload(data: Search_Payload): Search_Payload;
833
836
 
834
837
  /**
@@ -889,9 +892,7 @@ export declare class ColorSequenceKeypoint {
889
892
  isSame(other: ColorSequenceKeypoint): boolean;
890
893
  }
891
894
 
892
- /**
893
- * @category Outfit
894
- */
895
+ /**@category Outfit */
895
896
  export declare type ColorType = "BrickColor" | "Color3";
896
897
 
897
898
  /**
@@ -917,7 +918,10 @@ export declare class Content {
917
918
 
918
919
  export declare const ContentMap: Map<string, string>;
919
920
 
920
- declare class COREMESH {
921
+ /**
922
+ * Class inside FileMesh that contains core data
923
+ * @category Mesh */
924
+ export declare class COREMESH {
921
925
  private _numverts;
922
926
  private _positions;
923
927
  private _normals;
@@ -1144,7 +1148,10 @@ declare class FaceKeyframeGroup extends BaseKeyframeGroup {
1144
1148
  getLowerKeyframe(time: number): FaceKeyframe | null;
1145
1149
  }
1146
1150
 
1147
- declare class FACS {
1151
+ /**
1152
+ * Class inside FileMesh that contains facial animation data
1153
+ * @category Mesh */
1154
+ export declare class FACS {
1148
1155
  faceBoneNames: string[];
1149
1156
  faceControlNames: string[];
1150
1157
  quantizedTransforms?: QuantizedTransform;
@@ -1189,7 +1196,10 @@ export declare class FileMesh {
1189
1196
  getValidationIssue(): "subsetLengthMismatch" | undefined;
1190
1197
  }
1191
1198
 
1192
- declare class FileMeshBone {
1199
+ /**
1200
+ * Bone inside SKINNING in FileMesh
1201
+ * @category Mesh */
1202
+ export declare class FileMeshBone {
1193
1203
  boneNameIndex: number;
1194
1204
  parentIndex: number;
1195
1205
  lodParentIndex: number;
@@ -1199,12 +1209,18 @@ declare class FileMeshBone {
1199
1209
  clone(): FileMeshBone;
1200
1210
  }
1201
1211
 
1212
+ /**
1213
+ * Contains bone weights for a single vert
1214
+ * @category Mesh */
1202
1215
  export declare class FileMeshSkinning {
1203
1216
  subsetIndices: Vec4;
1204
1217
  boneWeights: Vec4;
1205
1218
  clone(): FileMeshSkinning;
1206
1219
  }
1207
1220
 
1221
+ /**
1222
+ * Section of mesh inside SKINNING in FileMesh
1223
+ * @category Mesh */
1208
1224
  export declare class FileMeshSubset {
1209
1225
  facesBegin: number;
1210
1226
  facesLength: number;
@@ -1250,6 +1266,8 @@ export declare const FLAGS: {
1250
1266
  ASSET_REQUEST_PRIORITY: RequestPriority | undefined;
1251
1267
  /**the domain all api requests go through */
1252
1268
  API_DOMAIN: string;
1269
+ /**prefix to add before all api requests */
1270
+ API_REQUEST_PREFIX: string;
1253
1271
  /**credentials request type when fetching from API_DOMAIN and credentials are usually include */
1254
1272
  INCLUDE_REQUEST_CREDENTIALS_OVERRIDE: RequestCredentials;
1255
1273
  /**loads assets from assetdelivery instead of local files */
@@ -1296,7 +1314,7 @@ export declare const FLAGS: {
1296
1314
  AUTO_RESTORE_CONTEXT: boolean;
1297
1315
  /**RenderTarget textures are converted to CanvasTextures which can be exported */
1298
1316
  RENDERTARGET_TO_CANVASTEXTURE: boolean;
1299
- /**Amount of time thumbnail generator will wait after no assets are being loaded to resolve */
1317
+ /**Amount of time thumbnail generator will wait after no assets are being loaded to resolve, should be a little time at least so particles can render */
1300
1318
  THUMBNAIL_TIMEOUT: number;
1301
1319
  /**shows ThreeJS SkeletonHelper */
1302
1320
  SHOW_SKELETON_HELPER: boolean;
@@ -1362,7 +1380,7 @@ export declare function gaussian_rbf(v0: Vec3, v1: Vec3, sigma?: number): number
1362
1380
  /**
1363
1381
  * Generates a 2d or 3d thumbnail of a model/similar instance
1364
1382
  * @param auth Authentication
1365
- * @param renderScene Scene to render inside, do note the scene appearance is not populated automaticall, use setupThumbnailScene()
1383
+ * @param renderScene Scene to render inside, do note the scene appearance is not populated automatically, use setupThumbnailScene()
1366
1384
  * @param model Model to render
1367
1385
  * @param size Size of the resulting image, ignored for 3d thumbnails
1368
1386
  * @param type Type of thumbnail, "png" | "webp" | "gltf"
@@ -1426,26 +1444,44 @@ export declare function generateUUIDv4(): string;
1426
1444
 
1427
1445
  export declare function GetAttachedPart(accessory: Instance, rig: Instance): Instance | undefined;
1428
1446
 
1447
+ /**
1448
+ * @deprecated Use getThumbnailCameraCFrame instead
1449
+ * @param rig
1450
+ * @returns
1451
+ */
1429
1452
  export declare function getCameraCFrameForAvatarNonCustomized(rig: Instance): CFrame | undefined;
1430
1453
 
1454
+ /**
1455
+ * Calculates the CFrame the camera should be at when generating a customized headshot thumbnail
1456
+ * @param rig Character
1457
+ * @param fov Customized fov
1458
+ * @param yRot Customized yRot
1459
+ * @param distance Customized distanceScale
1460
+ * @returns Thumbnail camera cframe
1461
+ * @category ThumbnailGenerator
1462
+ */
1431
1463
  export declare function getCameraCFrameForHeadshotCustomized(rig: Instance, fov: number, yRot: number, distance: number): CFrame | undefined;
1432
1464
 
1433
- export declare function getCameraOffset(fov: number, extentsSize: Vector3): number;
1434
-
1435
1465
  /**
1436
1466
  * @category Mesh
1437
1467
  */
1438
1468
  export declare function getDistIndexArray(ref: FileMesh, dist: FileMesh): (number | undefined)[];
1439
1469
 
1470
+ /**@category ThumbnailGenerator */
1440
1471
  export declare function getExtents(cframe: CFrame, parts: Instance[]): [Vector3, Vector3];
1441
1472
 
1473
+ /**@category ThumbnailGenerator */
1442
1474
  export declare function getExtentsCenter(extents: [Vector3, Vector3]): Vector3;
1443
1475
 
1444
- /**@deprecated this is SO broken */
1476
+ /**
1477
+ * @deprecated this is SO broken
1478
+ * @category ThumbnailGenerator
1479
+ * */
1445
1480
  export declare function getExtentsForParts(parts: Instance[], includeTransform?: boolean): [Vector3, Vector3];
1446
1481
 
1447
1482
  export declare function getHeadExtents(rig: Instance): [Vector3, Vector3] | undefined;
1448
1483
 
1484
+ /**@category API */
1449
1485
  export declare interface GetInfoForId_Result {
1450
1486
  "description": string;
1451
1487
  "created": string;
@@ -1472,6 +1508,7 @@ export declare function getRandomBetweenInclusive(min: number, max: number): num
1472
1508
 
1473
1509
  export declare function getRigExtentsWorld(rig: Instance): [Vector3, Vector3];
1474
1510
 
1511
+ /**@category API */
1475
1512
  export declare interface GetSubscription_Result {
1476
1513
  "subscriptionProductModel": {
1477
1514
  "premiumFeatureId": number;
@@ -1487,12 +1524,22 @@ export declare interface GetSubscription_Result {
1487
1524
  };
1488
1525
  }
1489
1526
 
1527
+ /**
1528
+ * Calculates the CFrame the camera should be at when generating a thumbnail
1529
+ * @param model The model-like instance to get thumbnail camera for
1530
+ * @returns Thumbnail camera cframe
1531
+ * @category ThumbnailGenerator
1532
+ */
1533
+ export declare function getThumbnailCameraCFrame(model: Instance): CFrame | undefined;
1534
+
1535
+ /**@category API */
1490
1536
  export declare interface GetTopics_Payload {
1491
1537
  items: unknown[];
1492
1538
  maxResult: 40;
1493
1539
  selectTopics: string[];
1494
1540
  }
1495
1541
 
1542
+ /**@category API */
1496
1543
  export declare interface GetTopics_Result {
1497
1544
  error: null | unknown;
1498
1545
  topics: {
@@ -1501,6 +1548,7 @@ export declare interface GetTopics_Result {
1501
1548
  }[];
1502
1549
  }
1503
1550
 
1551
+ /**@category API */
1504
1552
  export declare interface GetUserOutfits_Result {
1505
1553
  data: {
1506
1554
  id: number;
@@ -1555,6 +1603,7 @@ export declare function hexToRgb(hex: string): {
1555
1603
  } | null;
1556
1604
 
1557
1605
  /**
1606
+ * The main class for the process of HSR (Hidden Surface Removal)
1558
1607
  * @category Mesh
1559
1608
  */
1560
1609
  export declare class HSR {
@@ -1575,7 +1624,10 @@ export declare class HSR {
1575
1624
  calculateCloseToCageThreshold(): void;
1576
1625
  }
1577
1626
 
1578
- declare class HSRAVIS {
1627
+ /**
1628
+ * Class inside FileMesh that contains HSR Always Visible data (unused?)
1629
+ * @category Mesh */
1630
+ export declare class HSRAVIS {
1579
1631
  bitFlags: boolean[];
1580
1632
  clone(): HSRAVIS;
1581
1633
  }
@@ -1653,6 +1705,7 @@ export declare class HumanoidDescriptionWrapper extends InstanceWrapper {
1653
1705
  applyDescription(humanoid: Instance): Promise<Instance | Response | undefined>;
1654
1706
  }
1655
1707
 
1708
+ /**@category DataModelEnum */
1656
1709
  export declare const HumanoidRigType: {
1657
1710
  R6: number;
1658
1711
  R15: number;
@@ -1710,7 +1763,7 @@ export declare class Instance {
1710
1763
  get id(): string;
1711
1764
  set name(value: string);
1712
1765
  get name(): string;
1713
- createWrapper(): void;
1766
+ createWrapper(): InstanceWrapper | undefined;
1714
1767
  addConnectionReference(connection: Connection): void;
1715
1768
  removeConnectionReference(connection: Connection): void;
1716
1769
  addReferencedBy(instance: Instance): void;
@@ -1779,6 +1832,7 @@ export declare class InstanceWrapper {
1779
1832
  preRender(): void;
1780
1833
  }
1781
1834
 
1835
+ /**@category API */
1782
1836
  export declare interface Inventory_Result {
1783
1837
  data: {
1784
1838
  assetId: number;
@@ -1807,6 +1861,7 @@ export declare function isSameFloat(num0: number, num1: number): boolean;
1807
1861
 
1808
1862
  export declare function isSameVector3(vec0: Vector3, vec1: Vector3): boolean;
1809
1863
 
1864
+ /**@category API */
1810
1865
  export declare interface ItemDetail_Result {
1811
1866
  assetType: number;
1812
1867
  bundledItems: [];
@@ -1833,6 +1888,7 @@ export declare interface ItemDetail_Result {
1833
1888
  };
1834
1889
  }
1835
1890
 
1891
+ /**@category API */
1836
1892
  export declare interface ItemDetails_Result {
1837
1893
  data: ItemDetail_Result[];
1838
1894
  }
@@ -1927,7 +1983,10 @@ export declare interface LocalOutfitJson {
1927
1983
  buffer: string;
1928
1984
  }
1929
1985
 
1930
- declare class LODS {
1986
+ /**
1987
+ * Class inside FileMesh that contains LOD metadata
1988
+ * @category Mesh */
1989
+ export declare class LODS {
1931
1990
  lodType: number;
1932
1991
  numHighQualityLODs: number;
1933
1992
  numLodOffsets: number;
@@ -1935,6 +1994,7 @@ declare class LODS {
1935
1994
  clone(): LODS;
1936
1995
  }
1937
1996
 
1997
+ /**@category API */
1938
1998
  export declare interface Look_Result {
1939
1999
  look: {
1940
2000
  avatarProperties: {
@@ -2045,6 +2105,7 @@ export declare class MakeupDescriptionWrapper extends InstanceWrapper {
2045
2105
  setup(): void;
2046
2106
  }
2047
2107
 
2108
+ /**@category DataModelEnum */
2048
2109
  export declare const MakeupType: {
2049
2110
  Face: number;
2050
2111
  Lip: number;
@@ -2060,6 +2121,7 @@ export declare class ManualWeldWrapper extends WeldWrapper {
2060
2121
 
2061
2122
  export declare function mapNum(x: number, in_min: number, in_max: number, out_min: number, out_max: number): number;
2062
2123
 
2124
+ /**@category API */
2063
2125
  export declare interface MarketplaceWidget {
2064
2126
  id: string;
2065
2127
  type: string;
@@ -2081,6 +2143,7 @@ export declare interface MarketplaceWidget {
2081
2143
  };
2082
2144
  }
2083
2145
 
2146
+ /**@category API */
2084
2147
  export declare interface MarketplaceWidgets_Result {
2085
2148
  widgets: {
2086
2149
  [K in number]: MarketplaceWidget;
@@ -2132,6 +2195,7 @@ declare class MeshCollider {
2132
2195
  raycast(ray: Ray_2): boolean;
2133
2196
  }
2134
2197
 
2198
+ /**@category DataModelEnum */
2135
2199
  export declare const MeshType: {
2136
2200
  Brick: number;
2137
2201
  Cylinder: number;
@@ -2201,6 +2265,7 @@ export declare function multiply(v0: Vec3, v1: Vec3): Vec3;
2201
2265
  */
2202
2266
  export declare function multiplyMatrixVector(m: Mat3x3, v: Vec3): Vec3;
2203
2267
 
2268
+ /**@category API */
2204
2269
  export declare interface NavigationMenuItems {
2205
2270
  categories: {
2206
2271
  category: string;
@@ -2277,6 +2342,7 @@ export declare interface NavigationMenuItems {
2277
2342
 
2278
2343
  export declare const NeverLayeredAccessoryTypes: number[];
2279
2344
 
2345
+ /**@category DataModelEnum */
2280
2346
  export declare const NormalId: {
2281
2347
  Right: number;
2282
2348
  Top: number;
@@ -2434,6 +2500,7 @@ export declare class Outfit {
2434
2500
  toBuffer(): ArrayBuffer;
2435
2501
  }
2436
2502
 
2503
+ /**@category Outfit */
2437
2504
  export declare type OutfitJson = {
2438
2505
  scale?: ScaleJson;
2439
2506
  playerAvatarType?: AvatarType;
@@ -2523,12 +2590,14 @@ declare class PartCurve {
2523
2590
  rotation?: FloatCurve3;
2524
2591
  }
2525
2592
 
2593
+ /**@category DataModelEnum */
2526
2594
  export declare const ParticleEmitterShapeInOut: {
2527
2595
  Outward: number;
2528
2596
  Inward: number;
2529
2597
  InAndOut: number;
2530
2598
  };
2531
2599
 
2600
+ /**@category DataModelEnum */
2532
2601
  export declare const ParticleOrientation: {
2533
2602
  FacingCamera: number;
2534
2603
  FacingCameraWorldUp: number;
@@ -3005,13 +3074,12 @@ export declare class RoAvatarVersions {
3005
3074
 
3006
3075
  export declare function rotationMatrixToEulerAngles(te: number[], order?: string): Vec3;
3007
3076
 
3077
+ /**@category API */
3008
3078
  export declare type SaleLocationType = "ShopOnly" | "ShopAndAllExperiences" | "ExperiencesDevApiOnly" | string;
3009
3079
 
3010
3080
  export declare function saveByteArray(data: BlobPart[] | undefined, name: string): void;
3011
3081
 
3012
- /**
3013
- * @category Outfit
3014
- */
3082
+ /**@category Outfit */
3015
3083
  export declare class Scale {
3016
3084
  height: number;
3017
3085
  width: number;
@@ -3039,6 +3107,7 @@ export declare function ScaleAccessoryForRig(accessory: Instance, rig: Instance,
3039
3107
 
3040
3108
  export declare function ScaleCharacter(rig: Instance, outfit: Outfit, humanoidDescription: Instance): RigData | undefined;
3041
3109
 
3110
+ /**@category Outfit */
3042
3111
  export declare type ScaleJson = {
3043
3112
  height?: number;
3044
3113
  width?: number;
@@ -3053,9 +3122,7 @@ export declare type ScaleJson = {
3053
3122
  */
3054
3123
  export declare function scaleMesh(mesh: FileMesh, scale: Vector3): void;
3055
3124
 
3056
- /**
3057
- * @category Outfit
3058
- */
3125
+ /**@category Outfit */
3059
3126
  export declare type ScaleName = "height" | "width" | "head" | "depth" | "proportion" | "bodyType";
3060
3127
 
3061
3128
  /**
@@ -3075,6 +3142,7 @@ declare class ScriptWrapperData {
3075
3142
  shouldStop: boolean;
3076
3143
  }
3077
3144
 
3145
+ /**@category API */
3078
3146
  export declare interface Search_Payload {
3079
3147
  taxonomy: string;
3080
3148
  salesTypeFilter: number;
@@ -3089,6 +3157,7 @@ export declare interface Search_Payload {
3089
3157
  limit?: number;
3090
3158
  }
3091
3159
 
3160
+ /**@category API */
3092
3161
  export declare interface Search_Result {
3093
3162
  keyword: string | null;
3094
3163
  previousPageCursor: string | null;
@@ -3165,7 +3234,10 @@ declare class SimpleView {
3165
3234
  readUint8(): number;
3166
3235
  }
3167
3236
 
3168
- declare class SKINNING {
3237
+ /**
3238
+ * Class inside FileMesh that contains skinning data
3239
+ * @category Mesh */
3240
+ export declare class SKINNING {
3169
3241
  numSkinnings: number;
3170
3242
  skinnings: FileMeshSkinning[];
3171
3243
  numBones: number;
@@ -3230,6 +3302,7 @@ export declare const StringBufferProperties: string[];
3230
3302
 
3231
3303
  declare type ThreePoseCorrective = Vec3;
3232
3304
 
3305
+ /**@category API */
3233
3306
  export declare interface ThumbnailCustomizations_Result {
3234
3307
  "avatarThumbnailCustomizations": {
3235
3308
  "thumbnailType": number;
@@ -3242,10 +3315,12 @@ export declare interface ThumbnailCustomizations_Result {
3242
3315
  }[];
3243
3316
  }
3244
3317
 
3318
+ /**@category ThumbnailGenerator */
3245
3319
  export declare type ThumbnailResult = ArrayBuffer | {
3246
3320
  [key: string]: unknown;
3247
3321
  } | string | undefined;
3248
3322
 
3323
+ /**@category API */
3249
3324
  export declare interface ThumbnailsCustomization_Payload {
3250
3325
  thumbnailType: number;
3251
3326
  emoteAssetId: number;
@@ -3256,6 +3331,7 @@ export declare interface ThumbnailsCustomization_Payload {
3256
3331
  };
3257
3332
  }
3258
3333
 
3334
+ /**@category ThumbnailGenerator */
3259
3335
  export declare type ThumbnailType = "png" | "webp" | "gltf";
3260
3336
 
3261
3337
  /**
@@ -3322,6 +3398,7 @@ declare type UserInfo = {
3322
3398
  displayName: string;
3323
3399
  };
3324
3400
 
3401
+ /**@category API */
3325
3402
  export declare interface UserLooks_Result {
3326
3403
  data: {
3327
3404
  assets: {
@@ -3347,6 +3424,7 @@ export declare interface UserLooks_Result {
3347
3424
  previousCursor: string | null;
3348
3425
  }
3349
3426
 
3427
+ /**@category API */
3350
3428
  export declare interface UserOmniSearch_Result {
3351
3429
  "searchResults": {
3352
3430
  "contentGroupType": "User";
@@ -3363,12 +3441,14 @@ export declare interface UserOmniSearch_Result {
3363
3441
  "nextPageToken": string;
3364
3442
  }
3365
3443
 
3444
+ /**@category Outfit */
3366
3445
  export declare type ValidationIssue = {
3367
3446
  type: ValidationIssueType;
3368
3447
  text: string;
3369
3448
  assetIndex?: number;
3370
3449
  };
3371
3450
 
3451
+ /**@category Outfit */
3372
3452
  export declare type ValidationIssueType = "AccessoryLimit" | "LayeredLimit" | "OneOfTypeLimit" | "DuplicateId" | "NotWearable" | "MissingLayeredMeta" | "InvalidAsset" | "MakeupLimit";
3373
3453
 
3374
3454
  /** @category Mesh */
@@ -3474,6 +3554,7 @@ export declare const WorkerTypeToFunction: {
3474
3554
  [K in string]: Function;
3475
3555
  };
3476
3556
 
3557
+ /**@category DataModelEnum */
3477
3558
  export declare const WrapLayerAutoSkin: {
3478
3559
  Disabled: number;
3479
3560
  EnabledPreserve: number;
@@ -3482,8 +3563,27 @@ export declare const WrapLayerAutoSkin: {
3482
3563
 
3483
3564
  export declare const xmlMagic = "<roblox ";
3484
3565
 
3485
- export declare function zoomExtents(cameraCFrame: CFrame, modelCFrame: CFrame, modelSize: Vector3, targetFOV: number, distanceScale: number): void;
3566
+ export declare function zoomExtents(cameraCFrame: CFrame, modelCFrame: CFrame, modelSize: Vector3, targetFOV: number, distanceScale: number, sizeType?: ZoomExtentsSizeType): void;
3486
3567
 
3568
+ /**
3569
+ * Makes model fit inside camera
3570
+ * @param cameraCFrame Original camera cframe
3571
+ * @param modelCFrame Model cframe
3572
+ * @param modelSize Model extents size
3573
+ * @param targetFOV Camera fov
3574
+ * @param distanceScale Distance is multiplied by this
3575
+ * @category ThumbnailGenerator
3576
+ */
3577
+ export declare type ZoomExtentsSizeType = "largestAxis" | "calculate";
3578
+
3579
+ /**
3580
+ * @deprecated Use zoomExtents instead
3581
+ * @param cameraCFrame
3582
+ * @param modelCFrame
3583
+ * @param modelSize
3584
+ * @param fov
3585
+ * @category ThumbnailGenerator
3586
+ */
3487
3587
  export declare function zoomToExtents(cameraCFrame: CFrame, modelCFrame: CFrame, modelSize: Vector3, fov?: number): void;
3488
3588
 
3489
3589
  export { }
package/dist/index.js CHANGED
@@ -29515,6 +29515,7 @@ const FLAGS = {
29515
29515
  ASSETDELIVERY_V2: true,
29516
29516
  ASSET_REQUEST_PRIORITY: "high",
29517
29517
  API_DOMAIN: "roblox.com",
29518
+ API_REQUEST_PREFIX: "",
29518
29519
  INCLUDE_REQUEST_CREDENTIALS_OVERRIDE: "include",
29519
29520
  //assets
29520
29521
  ONLINE_ASSETS: false,
@@ -29547,7 +29548,7 @@ const FLAGS = {
29547
29548
  USE_RENDERTARGET: true,
29548
29549
  AUTO_RESTORE_CONTEXT: true,
29549
29550
  RENDERTARGET_TO_CANVASTEXTURE: false,
29550
- THUMBNAIL_TIMEOUT: 750,
29551
+ THUMBNAIL_TIMEOUT: 500,
29551
29552
  //skeleton
29552
29553
  SHOW_SKELETON_HELPER: false,
29553
29554
  UPDATE_SKELETON: true,
@@ -30167,6 +30168,7 @@ class Instance {
30167
30168
  this._hasWrappered = true;
30168
30169
  wrapper.created();
30169
30170
  }
30171
+ return wrapper;
30170
30172
  }
30171
30173
  addConnectionReference(connection) {
30172
30174
  if (!this._connectionReferences.includes(connection)) {
@@ -35219,7 +35221,7 @@ async function RBLXPost(url, auth, body, attempt = 0, method = "POST") {
35219
35221
  "X-CSRF-TOKEN": xCsrfToken
35220
35222
  });
35221
35223
  try {
35222
- fetch(url, {
35224
+ fetch(FLAGS.API_REQUEST_PREFIX + url, {
35223
35225
  method,
35224
35226
  credentials: FLAGS.INCLUDE_REQUEST_CREDENTIALS_OVERRIDE,
35225
35227
  headers: fetchHeaders,
@@ -35264,7 +35266,7 @@ async function RBLXGet(url, headers, includeCredentials = true) {
35264
35266
  }
35265
35267
  const fetchHeaders = new Headers(newHeaders);
35266
35268
  try {
35267
- fetch(url, {
35269
+ fetch(FLAGS.API_REQUEST_PREFIX + url, {
35268
35270
  credentials: includeCredentials ? FLAGS.INCLUDE_REQUEST_CREDENTIALS_OVERRIDE : void 0,
35269
35271
  headers: fetchHeaders,
35270
35272
  priority: FLAGS.ASSET_REQUEST_PRIORITY
@@ -35496,6 +35498,9 @@ const API = {
35496
35498
  }
35497
35499
  const cdnURL = await API.Misc.getCDNURLFromAssetDelivery(fetchStr, headers);
35498
35500
  return cdnURL;
35501
+ },
35502
+ "getCurrentlyLoading": function() {
35503
+ return currentlyLoadingAssets > 0;
35499
35504
  }
35500
35505
  },
35501
35506
  "Events": {
@@ -36514,6 +36519,7 @@ class RBFDeformerPatch {
36514
36519
  if (this.refVerts.length === 0) {
36515
36520
  return;
36516
36521
  }
36522
+ API.Misc.startCurrentlyLoadingAssets();
36517
36523
  const [neighborIndicesBuf, weightsBuf, nearestPatchBuf] = await WorkerPool.instance.work(
36518
36524
  "RBFDeformerSolveAsync",
36519
36525
  [this.patchCount, this.K, this.epsilon, this.importantIndices.buffer, this.refVerts.buffer, this.distVerts.buffer, this.meshVerts.buffer, this.meshBones.buffer],
@@ -36534,6 +36540,7 @@ class RBFDeformerPatch {
36534
36540
  });
36535
36541
  this.nearestPatch = new Uint16Array(nearestPatchBuf);
36536
36542
  timeEnd(`RBFDeformerPatch.solveAsync.unpack.${this.id}`);
36543
+ API.Misc.stopCurrentlyLoadingAssets();
36537
36544
  }
36538
36545
  /**
36539
36546
  * solveAsync() needs to be called before this
@@ -49634,8 +49641,7 @@ class RBXRenderer {
49634
49641
  RBXRenderer.backgroundColorHex = backgroundColorHex;
49635
49642
  const backgroundColor = new Color(backgroundColorHex);
49636
49643
  renderScene.scene.background = backgroundColor;
49637
- let thumbnailAmbientVal = 138;
49638
- thumbnailAmbientVal = 128;
49644
+ const thumbnailAmbientVal = 128;
49639
49645
  let ambientLightColor = void 0;
49640
49646
  if (lightingType === "Thumbnail") {
49641
49647
  ambientLightColor = new Color(thumbnailAmbientVal / 255, thumbnailAmbientVal / 255, thumbnailAmbientVal / 255);
@@ -49646,7 +49652,7 @@ class RBXRenderer {
49646
49652
  renderScene.scene.add(ambientLight);
49647
49653
  renderScene.ambientLight = ambientLight;
49648
49654
  let directionalLightColor = void 0;
49649
- const directionalLightVal = 0.7 * 0.9 * 2 * 0.4;
49655
+ const directionalLightVal = Math.PI;
49650
49656
  if (lightingType === "Thumbnail") {
49651
49657
  directionalLightColor = new Color(directionalLightVal, directionalLightVal, directionalLightVal);
49652
49658
  } else if (lightingType === "WellLit") {
@@ -49686,7 +49692,7 @@ class RBXRenderer {
49686
49692
  renderScene.scene.add(directionalLight2);
49687
49693
  renderScene.directionalLight2 = directionalLight2;
49688
49694
  } else if (lightingType === "Thumbnail") {
49689
- const directionalLight2 = new DirectionalLight(directionalLightColor, directionalLightIntensity * 0.5);
49695
+ const directionalLight2 = new DirectionalLight(directionalLightColor, directionalLightVal * 0.1);
49690
49696
  directionalLight2.position.set(-0.47489210963249207 * -10, 0.8225368857383728 * -10, 0.3129066228866577 * -10);
49691
49697
  directionalLight2.target.position.set(0, 0, 0);
49692
49698
  renderScene.scene.add(directionalLight2);
@@ -50172,8 +50178,11 @@ function getExtents(cframe, parts) {
50172
50178
  function getExtentsCenter(extents) {
50173
50179
  return extents[1].minus(extents[0]).divide(new Vector32(2, 2, 2)).add(extents[0]);
50174
50180
  }
50175
- function zoomExtents(cameraCFrame, modelCFrame, modelSize, targetFOV, distanceScale) {
50176
- const largestSize = Math.max(modelSize.X, modelSize.Y, modelSize.Z);
50181
+ function zoomExtents(cameraCFrame, modelCFrame, modelSize, targetFOV, distanceScale, sizeType = "calculate") {
50182
+ let largestSize = Math.max(modelSize.X, modelSize.Y, modelSize.Z);
50183
+ if (sizeType === "calculate") {
50184
+ largestSize = modelSize.magnitude() / 2 / Math.sin(rad(targetFOV / 2));
50185
+ }
50177
50186
  const fovMultiplier = 70 / targetFOV;
50178
50187
  const lookDir = multiply(normalize(minus(cameraCFrame.Position, modelCFrame.Position)), [distanceScale, distanceScale, distanceScale]);
50179
50188
  cameraCFrame.Position = add(modelCFrame.Position, multiply(multiply(lookDir, [largestSize, largestSize, largestSize]), [fovMultiplier, fovMultiplier, fovMultiplier]));
@@ -50242,7 +50251,7 @@ function getCameraCFrameForHeadshotCustomized(rig, fov2, yRot, distance2) {
50242
50251
  lookCF.Position = add(headCenterCF.Position, multiply(multiply([10, 10, 10], lookVector), [fovMultiplier, fovMultiplier, fovMultiplier]));
50243
50252
  lookCF = CFrame.lookAt(lookCF.Position, headCenterCF.Position);
50244
50253
  const cameraCF = lookCF.clone();
50245
- zoomExtents(cameraCF, headCenterCF, headLocalExtents[1].minus(headLocalExtents[0]), fov2, distance2);
50254
+ zoomExtents(cameraCF, headCenterCF, headLocalExtents[1].minus(headLocalExtents[0]), fov2, distance2, "largestAxis");
50246
50255
  return cameraCF;
50247
50256
  }
50248
50257
  function getCameraCFrameForAvatarNonCustomized(rig) {
@@ -50273,6 +50282,36 @@ function getCameraCFrameForAvatarNonCustomized(rig) {
50273
50282
  zoomExtents(cameraCF, rootPartCF, extentsSize, 70, 1);
50274
50283
  return cameraCF;
50275
50284
  }
50285
+ function getThumbnailCameraCFrame(model) {
50286
+ const thumbnailCamera = model.FindFirstChildOfClass("Camera");
50287
+ if (thumbnailCamera) return thumbnailCamera.PropOrDefault("CFrame", new CFrame());
50288
+ let rootPart = model.PropOrDefault("PrimaryPart", void 0);
50289
+ if (!rootPart) rootPart = model.FindFirstChildOfClass("Part");
50290
+ if (!rootPart) rootPart = model.FindFirstChildOfClass("MeshPart");
50291
+ if (!rootPart) return;
50292
+ const rootPartCF = rootPart.PropOrDefault("CFrame", new CFrame()).clone();
50293
+ const worldExtents = getRigExtentsWorld(model);
50294
+ if (!worldExtents) return;
50295
+ const extentsSize = worldExtents[1].minus(worldExtents[0]);
50296
+ rootPartCF.Position = getExtentsCenter(worldExtents).toVec3();
50297
+ let lookVector = rootPartCF.lookVector();
50298
+ if (Math.abs(lookVector[1]) > 0.95) {
50299
+ lookVector = [0, 0, -1];
50300
+ } else {
50301
+ lookVector[1] = 0;
50302
+ lookVector = normalize(lookVector);
50303
+ }
50304
+ let lookCF = CFrame.lookAt([0, 0, 0], lookVector);
50305
+ lookCF = lookCF.multiply(CFrame.fromEulerAngles(0, 0, rad(45)));
50306
+ lookCF = lookCF.multiply(CFrame.fromEulerAngles(rad(35), 0, 0));
50307
+ lookCF = lookCF.multiply(CFrame.fromEulerAngles(0, 0, 0));
50308
+ lookVector = lookCF.lookVector();
50309
+ lookCF.Position = add(rootPartCF.Position, multiply([10, 10, 10], lookVector));
50310
+ lookCF = CFrame.lookAt(lookCF.Position, rootPartCF.Position);
50311
+ const cameraCF = lookCF.clone();
50312
+ zoomExtents(cameraCF, rootPartCF, extentsSize, 70, 1);
50313
+ return cameraCF;
50314
+ }
50276
50315
  class OutfitRenderer {
50277
50316
  auth;
50278
50317
  outfit;
@@ -50474,7 +50513,8 @@ function renderToRenderTarget(width, height, renderScene) {
50474
50513
  generateMipmaps: false,
50475
50514
  minFilter: LinearFilter,
50476
50515
  magFilter: LinearFilter,
50477
- type: UnsignedByteType
50516
+ type: UnsignedByteType,
50517
+ samples: 4
50478
50518
  });
50479
50519
  const rbxRenderer = RBXRenderer.getRenderer();
50480
50520
  if (!rbxRenderer) return renderTarget;
@@ -50493,12 +50533,12 @@ async function renderTargetToCanvas(renderTarget) {
50493
50533
  }
50494
50534
  async function generateModelThumbnail(auth, renderScene, model, size = [150, 150], type = "png", quality = 1, gltfAutoDownload = false) {
50495
50535
  return new Promise((resolve) => {
50496
- const cameraCFrame = getCameraCFrameForAvatarNonCustomized(model);
50536
+ const cameraCFrame = getThumbnailCameraCFrame(model);
50497
50537
  if (cameraCFrame) {
50498
50538
  RBXRenderer.setCameraCFrame(cameraCFrame, renderScene);
50499
50539
  }
50500
50540
  RBXRenderer.addInstance(model, auth, renderScene);
50501
- let exportTimeout = setTimeout(doExport, FLAGS.THUMBNAIL_TIMEOUT);
50541
+ let exportTimeout = !API.Misc.getCurrentlyLoading() ? setTimeout(doExport, FLAGS.THUMBNAIL_TIMEOUT) : void 0;
50502
50542
  const onLoadingConnection = API.Events.OnLoadingAssets.Connect((currentlyLoading) => {
50503
50543
  if (exportTimeout) {
50504
50544
  clearTimeout(exportTimeout);
@@ -50530,12 +50570,20 @@ async function generateModelThumbnail(auth, renderScene, model, size = [150, 150
50530
50570
  }
50531
50571
  async function generateOutfitThumbnail(auth, outfit, size = [150, 150], type = "png", quality = 1, gltfAutoDownload = false) {
50532
50572
  return new Promise((resolve) => {
50573
+ const startTime = performance.now();
50533
50574
  const renderScene = RBXRenderer.addScene();
50534
50575
  setupThumbnailScene(renderScene);
50535
50576
  const outfitRenderer = new OutfitRenderer(auth, outfit, renderScene);
50536
50577
  if (outfit.playerAvatarType === AvatarType.R6) outfitRenderer.deltaTimeMultiplier = 0;
50537
50578
  outfitRenderer.startAnimating();
50538
- let exportTimeout = setTimeout(doExport, FLAGS.THUMBNAIL_TIMEOUT);
50579
+ if (!outfit.containsAssetType("Gear")) {
50580
+ if (outfit.playerAvatarType === AvatarType.R15) {
50581
+ outfitRenderer.setMainAnimation("pose");
50582
+ }
50583
+ } else {
50584
+ outfitRenderer.setMainAnimation("toolnone");
50585
+ }
50586
+ let exportTimeout = !API.Misc.getCurrentlyLoading() ? setTimeout(doExport, FLAGS.THUMBNAIL_TIMEOUT) : void 0;
50539
50587
  const onLoadingConnection = API.Events.OnLoadingAssets.Connect((currentlyLoading) => {
50540
50588
  if (exportTimeout) {
50541
50589
  clearTimeout(exportTimeout);
@@ -50547,15 +50595,9 @@ async function generateOutfitThumbnail(auth, outfit, size = [150, 150], type = "
50547
50595
  });
50548
50596
  async function doExport() {
50549
50597
  onLoadingConnection.Disconnect();
50550
- if (!outfit.containsAssetType("Gear")) {
50551
- if (outfit.playerAvatarType === AvatarType.R15) {
50552
- outfitRenderer.setMainAnimation("pose");
50553
- }
50554
- } else {
50555
- outfitRenderer.setMainAnimation("toolnone");
50556
- }
50557
50598
  if (outfitRenderer.currentRig) {
50558
50599
  const thumbnailResult = await generateModelThumbnail(auth, renderScene, outfitRenderer.currentRig, size, type, quality, gltfAutoDownload);
50600
+ console.log("Generated outfit thumbnail after seconds:", (performance.now() - startTime) / 1e3);
50559
50601
  resolve(thumbnailResult);
50560
50602
  outfitRenderer.stopAnimating();
50561
50603
  if (outfitRenderer.currentRig) outfitRenderer.currentRig.Destroy();
@@ -50569,7 +50611,7 @@ function setupThumbnailScene(renderScene) {
50569
50611
  renderScene.shouldAnimate = false;
50570
50612
  renderScene.wellLitDirectionalLightIntensity *= 2;
50571
50613
  renderScene.shadowEnabled = false;
50572
- RBXRenderer.setupScene("WellLit", 16777215, renderScene);
50614
+ RBXRenderer.setupScene("Thumbnail", 16777215, renderScene);
50573
50615
  if (renderScene.plane) renderScene.scene.remove(renderScene.plane);
50574
50616
  if (renderScene.shadowPlane) renderScene.scene.remove(renderScene.shadowPlane);
50575
50617
  renderScene.scene.background = null;
@@ -50589,6 +50631,7 @@ function exposeThumbnailGenerator() {
50589
50631
  globalThis.generateOutfitThumbnail = generateOutfitThumbnail;
50590
50632
  globalThis.generateModelThumbnail = generateModelThumbnail;
50591
50633
  globalThis.setupThumbnailScene = setupThumbnailScene;
50634
+ globalThis.getThumbnailCameraCFrame = getThumbnailCameraCFrame;
50592
50635
  }
50593
50636
  export {
50594
50637
  API,
@@ -50634,6 +50677,7 @@ export {
50634
50677
  BundleTypes,
50635
50678
  CACHE,
50636
50679
  CFrame,
50680
+ COREMESH,
50637
50681
  CatalogBundleTypes,
50638
50682
  CategoryDictionary,
50639
50683
  Color3,
@@ -50651,10 +50695,12 @@ export {
50651
50695
  DefaultSearchData,
50652
50696
  EmitterGroupDescClassTypes,
50653
50697
  Event,
50698
+ FACS,
50654
50699
  FLAGS,
50655
50700
  FaceControlNames,
50656
50701
  FaceControlsWrapper,
50657
50702
  FileMesh,
50703
+ FileMeshBone,
50658
50704
  FileMeshSkinning,
50659
50705
  FileMeshSubset,
50660
50706
  FindFirstMatchingAttachment,
@@ -50662,12 +50708,14 @@ export {
50662
50708
  GetAttachedPart,
50663
50709
  GetWrapperForInstance,
50664
50710
  HSR,
50711
+ HSRAVIS,
50665
50712
  HumanoidDescriptionWrapper,
50666
50713
  HumanoidRigType,
50667
50714
  Instance,
50668
50715
  InstanceWrapper,
50669
50716
  ItemInfo,
50670
50717
  ItemSort,
50718
+ LODS,
50671
50719
  LayeredAssetTypes,
50672
50720
  LayeredClothingAssetOrder,
50673
50721
  LocalOutfit,
@@ -50704,6 +50752,7 @@ export {
50704
50752
  RoAvatarData,
50705
50753
  RoAvatarDataError,
50706
50754
  RoAvatarVersions,
50755
+ SKINNING,
50707
50756
  Scale,
50708
50757
  ScaleAccessory,
50709
50758
  ScaleAccessoryForRig,
@@ -50774,7 +50823,6 @@ export {
50774
50823
  generateUUIDv4,
50775
50824
  getCameraCFrameForAvatarNonCustomized,
50776
50825
  getCameraCFrameForHeadshotCustomized,
50777
- getCameraOffset,
50778
50826
  getDistIndexArray,
50779
50827
  getExtents,
50780
50828
  getExtentsCenter,
@@ -50786,6 +50834,7 @@ export {
50786
50834
  getOriginalSize,
50787
50835
  getRandomBetweenInclusive,
50788
50836
  getRigExtentsWorld,
50837
+ getThumbnailCameraCFrame,
50789
50838
  getUVtoIndexMap,
50790
50839
  getUVtoIndicesMap,
50791
50840
  getWorkerOnMessage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",