roavatar-renderer 1.9.9 → 1.9.11
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 +126 -8
- package/dist/index.js +591 -239
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -529,7 +529,7 @@ export declare type AssetMetaJson = {
|
|
|
529
529
|
/** @category Outfit */
|
|
530
530
|
export declare class AssetType {
|
|
531
531
|
_id: number;
|
|
532
|
-
|
|
532
|
+
_name: string;
|
|
533
533
|
constructor();
|
|
534
534
|
clone(): AssetType;
|
|
535
535
|
toJson(): {
|
|
@@ -539,6 +539,8 @@ export declare class AssetType {
|
|
|
539
539
|
fromJson(assetTypeJson: AssetTypeJson): void;
|
|
540
540
|
set id(newId: number);
|
|
541
541
|
get id(): number;
|
|
542
|
+
set name(newName: string);
|
|
543
|
+
get name(): string;
|
|
542
544
|
}
|
|
543
545
|
|
|
544
546
|
/** @category Outfit */
|
|
@@ -1013,6 +1015,9 @@ export declare interface BundleDetails_Result {
|
|
|
1013
1015
|
/** @category Outfit */
|
|
1014
1016
|
export declare const BundleTypes: string[];
|
|
1015
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* @category API
|
|
1020
|
+
*/
|
|
1016
1021
|
export declare const CACHE: {
|
|
1017
1022
|
AssetBuffer: Cache_2<string, Promise<ArrayBuffer | Response>>;
|
|
1018
1023
|
RBX: Cache_2<string, RBX>;
|
|
@@ -1026,16 +1031,22 @@ export declare const CACHE: {
|
|
|
1026
1031
|
UserInfo: undefined;
|
|
1027
1032
|
};
|
|
1028
1033
|
|
|
1034
|
+
/**
|
|
1035
|
+
* @category API
|
|
1036
|
+
*/
|
|
1029
1037
|
declare class Cache_2<K, V> {
|
|
1030
1038
|
map: Map<K, V>;
|
|
1031
1039
|
lastAccess: Map<K, number>;
|
|
1032
1040
|
maxEntries: number;
|
|
1041
|
+
minDeleteLifetime: number;
|
|
1033
1042
|
onDelete?: (key: K) => void;
|
|
1034
1043
|
constructor(maxEntries?: number);
|
|
1035
1044
|
get(key: K): V | undefined;
|
|
1036
1045
|
set(key: K, value: V): Cache_2<K, V>;
|
|
1037
1046
|
has(key: K): boolean;
|
|
1038
1047
|
delete(key: K): boolean;
|
|
1048
|
+
deleteUntil(): void;
|
|
1049
|
+
deleteOne(): boolean;
|
|
1039
1050
|
}
|
|
1040
1051
|
export { Cache_2 as Cache }
|
|
1041
1052
|
|
|
@@ -1295,11 +1306,36 @@ export declare function createContentMap(): void;
|
|
|
1295
1306
|
|
|
1296
1307
|
export declare function createThumbnailCamera(): Instance;
|
|
1297
1308
|
|
|
1309
|
+
/**
|
|
1310
|
+
* @returns A RBXRenderScene ready to be used for thumbnail generation
|
|
1311
|
+
*/
|
|
1312
|
+
export declare function createThumbnailScene(): RBXRendererScene;
|
|
1313
|
+
|
|
1298
1314
|
/**
|
|
1299
1315
|
* @category Mesh
|
|
1300
1316
|
*/
|
|
1301
1317
|
export declare function createWeightsForMeshChunked(mesh: FileMesh, ref_mesh: FileMesh): WeightChunk[];
|
|
1302
1318
|
|
|
1319
|
+
/**
|
|
1320
|
+
* Used internally by cropForModel
|
|
1321
|
+
*
|
|
1322
|
+
* @category ThumbnailGenerator
|
|
1323
|
+
*/
|
|
1324
|
+
export declare function cropCameraToViewExtents(camera: THREE.PerspectiveCamera, viewExtents: [Vector2, Vector2], width: number, height: number, keepAspectRatio?: boolean): number;
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* Crops the camera projection matrix to only contain model, allows for image to be cropped without lowering resolution
|
|
1328
|
+
* @param model Model that should be in focus
|
|
1329
|
+
* @param renderScene RenderScene containing model and camera
|
|
1330
|
+
* @param width Width of thumbnail in pixels
|
|
1331
|
+
* @param height Height of thumbnail in pixels
|
|
1332
|
+
* @param resizeToRemoveUnusedSpace If the aspect ratio can be changed to crop out unused space. Default false
|
|
1333
|
+
* @returns [newWidth, newHeight] (Only differs from provided width/height if resizeToRemoveUnusedSpace = true)
|
|
1334
|
+
*
|
|
1335
|
+
* @category ThumbnailGenerator
|
|
1336
|
+
*/
|
|
1337
|
+
export declare function cropForModel(model: Instance, renderScene: RBXRendererScene, width: number, height: number, resizeToRemoveUnusedSpace?: boolean): number[];
|
|
1338
|
+
|
|
1303
1339
|
/**
|
|
1304
1340
|
* @category Mesh
|
|
1305
1341
|
*/
|
|
@@ -1386,10 +1422,14 @@ export declare function deformReferenceToBaseBodyParts(reference: FileMesh, targ
|
|
|
1386
1422
|
export declare function deg(radians: number): number;
|
|
1387
1423
|
|
|
1388
1424
|
declare class DisposableDesc {
|
|
1425
|
+
toDispose: THREEDisposable[];
|
|
1426
|
+
managedTextures: ManagedTexture[];
|
|
1389
1427
|
disposeMesh(scene: THREE.Scene, mesh: THREE.Mesh): void;
|
|
1390
1428
|
disposeMeshes(scene: THREE.Scene, meshes: THREE.Mesh[]): void;
|
|
1391
1429
|
disposeRenderLists(renderer: THREE.WebGLRenderer): void;
|
|
1392
1430
|
dispose(_renderer: THREE.WebGLRenderer, _scene: THREE.Scene): void;
|
|
1431
|
+
clearToDispose(): void;
|
|
1432
|
+
removeFromToDispose(disposable: THREEDisposable): void;
|
|
1393
1433
|
}
|
|
1394
1434
|
|
|
1395
1435
|
export declare function disposeMesh(scene: THREE.Scene, mesh: THREE.Mesh): void;
|
|
@@ -1912,6 +1952,13 @@ export declare interface GetInfoForId_Result {
|
|
|
1912
1952
|
"displayName": string;
|
|
1913
1953
|
}
|
|
1914
1954
|
|
|
1955
|
+
/**
|
|
1956
|
+
* Returns 2D bounds for model in screen space
|
|
1957
|
+
*
|
|
1958
|
+
* @category ThumbnailGenerator
|
|
1959
|
+
*/
|
|
1960
|
+
export declare function getModelViewExtents(model: Instance, camera: THREE.Camera, width: number, height: number): [Vector2, Vector2];
|
|
1961
|
+
|
|
1915
1962
|
/**
|
|
1916
1963
|
* @category Mesh
|
|
1917
1964
|
*/
|
|
@@ -1947,6 +1994,14 @@ export declare interface GetSubscription_Result {
|
|
|
1947
1994
|
};
|
|
1948
1995
|
}
|
|
1949
1996
|
|
|
1997
|
+
/**
|
|
1998
|
+
* Calculates the CFrame the camera should be at when generating a thumbnail
|
|
1999
|
+
* @param model The model-like instance to get thumbnail camera for
|
|
2000
|
+
* @returns Thumbnail camera cframe
|
|
2001
|
+
* @category ThumbnailGenerator
|
|
2002
|
+
*/
|
|
2003
|
+
export declare function getThumbnailCamera(model: Instance): Instance;
|
|
2004
|
+
|
|
1950
2005
|
/**
|
|
1951
2006
|
* Calculates the CFrame the camera should be at when generating a thumbnail
|
|
1952
2007
|
* @param model The model-like instance to get thumbnail camera for
|
|
@@ -1991,6 +2046,13 @@ export declare function getUVtoIndexMap(mesh: FileMesh): Map<number, number>;
|
|
|
1991
2046
|
*/
|
|
1992
2047
|
export declare function getUVtoIndicesMap(mesh: FileMesh): Map<number, number[]>;
|
|
1993
2048
|
|
|
2049
|
+
/**
|
|
2050
|
+
* Returns 2D bounds for array of positions in screen spade
|
|
2051
|
+
*
|
|
2052
|
+
* @category ThumbnailGenerator
|
|
2053
|
+
*/
|
|
2054
|
+
export declare function getViewExtents(camera: THREE.Camera, positions: Vector3[], width: number, height: number): [Vector2, Vector2];
|
|
2055
|
+
|
|
1994
2056
|
export declare function getWorkerOnMessage(): (event: MessageEvent) => void;
|
|
1995
2057
|
|
|
1996
2058
|
/**
|
|
@@ -2151,7 +2213,7 @@ export declare const HumanoidRigType: {
|
|
|
2151
2213
|
*
|
|
2152
2214
|
* @category ThumbnailGenerator
|
|
2153
2215
|
*/
|
|
2154
|
-
export declare function imageThumbnailClick(renderScene: RBXRendererScene, width: number, height: number, format: ImageThumbnailFormat, options?: Partial<ImageThumbnailOptions>): Promise<
|
|
2216
|
+
export declare function imageThumbnailClick(renderScene: RBXRendererScene, width: number, height: number, format: ImageThumbnailFormat, options?: Partial<ImageThumbnailOptions>): Promise<ImageThumbnailResult>;
|
|
2155
2217
|
|
|
2156
2218
|
/**
|
|
2157
2219
|
* @category ThumbnailGenerator
|
|
@@ -2163,8 +2225,14 @@ export declare type ImageThumbnailFormat = "png" | "webp" | "jpeg";
|
|
|
2163
2225
|
*/
|
|
2164
2226
|
export declare interface ImageThumbnailOptions {
|
|
2165
2227
|
quality: number;
|
|
2228
|
+
size: Vec2;
|
|
2166
2229
|
}
|
|
2167
2230
|
|
|
2231
|
+
/**
|
|
2232
|
+
* @category
|
|
2233
|
+
*/
|
|
2234
|
+
export declare type ImageThumbnailResult = string | undefined;
|
|
2235
|
+
|
|
2168
2236
|
export declare function imageUrlToDataUrl(imageUrl: string): Promise<string>;
|
|
2169
2237
|
|
|
2170
2238
|
/**
|
|
@@ -2264,6 +2332,11 @@ export declare class Instance {
|
|
|
2264
2332
|
Child(name: string): Instance | undefined;
|
|
2265
2333
|
FindFirstChildOfClass(className: string): Instance | undefined;
|
|
2266
2334
|
FindLastChildOfClass(className: string): Instance | undefined;
|
|
2335
|
+
/**
|
|
2336
|
+
* IMPORTANT: Only works properly for instances with an InstanceWrapper
|
|
2337
|
+
* @param className
|
|
2338
|
+
* @returns
|
|
2339
|
+
*/
|
|
2267
2340
|
IsA(className: string): boolean;
|
|
2268
2341
|
IsDescendantOf(instance: Instance): boolean;
|
|
2269
2342
|
preRender(): void;
|
|
@@ -2615,6 +2688,11 @@ export declare const MakeupType: {
|
|
|
2615
2688
|
Eye: number;
|
|
2616
2689
|
};
|
|
2617
2690
|
|
|
2691
|
+
declare interface ManagedTexture {
|
|
2692
|
+
url: string;
|
|
2693
|
+
params?: TextureParams;
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2618
2696
|
/**
|
|
2619
2697
|
* @category InstanceWrapper
|
|
2620
2698
|
*/
|
|
@@ -2735,9 +2813,7 @@ export declare function minus(v0: Vec3, v1: Vec3): Vec3;
|
|
|
2735
2813
|
*
|
|
2736
2814
|
* @category ThumbnailGenerator
|
|
2737
2815
|
*/
|
|
2738
|
-
export declare function modelThumbnailClick(renderScene: RBXRendererScene, format: ModelThumbnailFormat, options?: Partial<ModelThumbnailOptions>): Promise<
|
|
2739
|
-
[key: string]: unknown;
|
|
2740
|
-
}>;
|
|
2816
|
+
export declare function modelThumbnailClick(renderScene: RBXRendererScene, format: ModelThumbnailFormat, options?: Partial<ModelThumbnailOptions>): Promise<ModelThumbnailResult>;
|
|
2741
2817
|
|
|
2742
2818
|
/**
|
|
2743
2819
|
* @category ThumbnailGenerator
|
|
@@ -2751,6 +2827,13 @@ export declare interface ModelThumbnailOptions {
|
|
|
2751
2827
|
includeAnimations: boolean;
|
|
2752
2828
|
}
|
|
2753
2829
|
|
|
2830
|
+
/**
|
|
2831
|
+
* @category ThumbnailGenerator
|
|
2832
|
+
*/
|
|
2833
|
+
export declare type ModelThumbnailResult = ArrayBuffer | {
|
|
2834
|
+
[key: string]: unknown;
|
|
2835
|
+
};
|
|
2836
|
+
|
|
2754
2837
|
/**
|
|
2755
2838
|
* @category InstanceWrapper
|
|
2756
2839
|
*/
|
|
@@ -3631,9 +3714,18 @@ export declare class RBXRenderer {
|
|
|
3631
3714
|
static removeInstance(instance: Instance, renderScene?: RBXRendererScene): void;
|
|
3632
3715
|
static getRenderDescs(instance: Instance): RenderDesc[];
|
|
3633
3716
|
private static _addSkeletonToResult;
|
|
3717
|
+
private static _updateCompiledRenderDesc;
|
|
3634
3718
|
private static _addRenderDesc;
|
|
3635
|
-
/**
|
|
3636
|
-
|
|
3719
|
+
/** */
|
|
3720
|
+
/**
|
|
3721
|
+
* Adds an instance to the renderer or updates it, add it again to update it after changes have been made
|
|
3722
|
+
* @param instance The instance that will be updated (the descendants will also update)
|
|
3723
|
+
* @param auth This is here just in case something requires it in the future
|
|
3724
|
+
* @param renderScene The scene the instances will be rendered in. Default RBXRenderer.firstScene
|
|
3725
|
+
* @param includeDescendants If descendants should also have addInstance called on them. Default true
|
|
3726
|
+
* @returns
|
|
3727
|
+
*/
|
|
3728
|
+
static addInstance(instance: Instance, auth: Authentication, renderScene?: RBXRendererScene, includeDescendants?: boolean): void;
|
|
3637
3729
|
static setRendererSize(width: number, height: number): void;
|
|
3638
3730
|
/**
|
|
3639
3731
|
* @deprecated Use getRendererElement instead which includes the loading icon
|
|
@@ -3728,6 +3820,12 @@ export declare class RBXRendererScene {
|
|
|
3728
3820
|
* @return true if all have been compiled
|
|
3729
3821
|
*/
|
|
3730
3822
|
isFullyCompiled(): boolean;
|
|
3823
|
+
/**
|
|
3824
|
+
* @param instances Array of instances you want to wait to be finished compiling
|
|
3825
|
+
* @param timeoutSeconds Default is 30 seconds
|
|
3826
|
+
* @returns true if successful, false if a RenderDesc failed to compile or timed out
|
|
3827
|
+
*/
|
|
3828
|
+
waitUntilFullyCompiled(instances: Instance[], timeoutSeconds?: number): Promise<boolean>;
|
|
3731
3829
|
/**
|
|
3732
3830
|
* Exports scene as a GLTF or GLB
|
|
3733
3831
|
* @param name Name of the resulting file if autoDownload is true
|
|
@@ -3996,6 +4094,15 @@ export declare interface Search_Result {
|
|
|
3996
4094
|
}[];
|
|
3997
4095
|
}
|
|
3998
4096
|
|
|
4097
|
+
/**
|
|
4098
|
+
* Sets the APICACHE to a preset value
|
|
4099
|
+
*
|
|
4100
|
+
* @param preset
|
|
4101
|
+
*
|
|
4102
|
+
* @category API
|
|
4103
|
+
*/
|
|
4104
|
+
export declare function setCacheFootprintPreset(preset: "none" | "low" | "normal" | "high"): void;
|
|
4105
|
+
|
|
3999
4106
|
export declare function setupAccessoryCamera(accessoryModel: Instance, camera: Instance): void;
|
|
4000
4107
|
|
|
4001
4108
|
export declare function setupBodyPartCamera(mannequin: Instance, faceRight: boolean, focusPartNames: string[], camera: Instance): void;
|
|
@@ -4005,7 +4112,7 @@ export declare function setupCamera(camera: Instance, cameraOptions: CameraOptio
|
|
|
4005
4112
|
export declare function setupHeadCamera(headModel: Instance, camera: Instance): void;
|
|
4006
4113
|
|
|
4007
4114
|
/**
|
|
4008
|
-
* Gives a scene the default appearance for thumbnails
|
|
4115
|
+
* Gives a scene the default appearance and properties for thumbnails
|
|
4009
4116
|
* @param renderScene RBXRenderScene to setup
|
|
4010
4117
|
*
|
|
4011
4118
|
* @category ThumbnailGenerator
|
|
@@ -4119,6 +4226,17 @@ export declare const TextureMode: {
|
|
|
4119
4226
|
Static: number;
|
|
4120
4227
|
};
|
|
4121
4228
|
|
|
4229
|
+
declare interface TextureParams {
|
|
4230
|
+
colorSpace?: THREE.ColorSpace;
|
|
4231
|
+
wrapS?: THREE.Wrapping;
|
|
4232
|
+
wrapT?: THREE.Wrapping;
|
|
4233
|
+
magFilter?: THREE.MagnificationTextureFilter;
|
|
4234
|
+
minFilter?: THREE.MinificationTextureFilter;
|
|
4235
|
+
generateMipmaps?: boolean;
|
|
4236
|
+
}
|
|
4237
|
+
|
|
4238
|
+
declare type THREEDisposable = THREE.Texture | THREE.BufferGeometry | THREE.Material | THREE.InstancedMesh | THREE.WebGLRenderTarget;
|
|
4239
|
+
|
|
4122
4240
|
declare type ThreePoseCorrective = Vec3;
|
|
4123
4241
|
|
|
4124
4242
|
/**
|