roavatar-renderer 1.5.9 → 1.5.10

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
@@ -56,5 +56,7 @@ if (!(outfit instanceof Outfit)) throw new Error("Failed to get outfit")
56
56
  outfitRenderer.startAnimating()
57
57
  outfitRenderer.setMainAnimation("idle")
58
58
  ```
59
+ **RESULT:**
60
+ <img src="https://devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/5X/9/f/a/d/9fadf25d9770b63e8a2e480369930cad94ad04aa.png">
59
61
 
60
62
  Also the OutfitRenderer code or RoAvatar source code is useful, especially ```avatarPreview.ts```
package/dist/index.d.ts CHANGED
@@ -873,18 +873,29 @@ export declare interface BundleDetails_Result {
873
873
  export declare const BundleTypes: string[];
874
874
 
875
875
  export declare const CACHE: {
876
- AssetBuffer: Map<string, Promise<ArrayBuffer | Response>>;
877
- RBX: Map<string, RBX>;
878
- Mesh: Map<string, FileMesh>;
879
- Image: Map<string, HTMLImageElement | Promise<HTMLImageElement | undefined> | undefined>;
880
- Thumbnails: Map<string, string | undefined>;
881
- ItemOwned: Map<string, [boolean, number]>;
882
- IsLayered: Map<number, boolean>;
883
- AvatarInventoryItem: Map<string, AvatarInventory_Result>;
884
- ItemDetails: Map<string, ItemDetail_Result>;
876
+ AssetBuffer: Cache_2<string, Promise<ArrayBuffer | Response>>;
877
+ RBX: Cache_2<string, RBX>;
878
+ Mesh: Cache_2<string, FileMesh>;
879
+ Image: Cache_2<string, HTMLImageElement | Promise<HTMLImageElement | undefined> | undefined>;
880
+ Thumbnails: Cache_2<string, string | undefined>;
881
+ ItemOwned: Cache_2<string, [boolean, number]>;
882
+ IsLayered: Cache_2<number, boolean>;
883
+ AvatarInventoryItem: Cache_2<string, AvatarInventory_Result>;
884
+ ItemDetails: Cache_2<string, ItemDetail_Result>;
885
885
  UserInfo: undefined;
886
886
  };
887
887
 
888
+ declare class Cache_2<K, V> {
889
+ map: Map<K, V>;
890
+ lastAccess: Map<K, number>;
891
+ maxEntries: number;
892
+ constructor(maxEntries?: number);
893
+ get(key: K): V | undefined;
894
+ set(key: K, value: V): Cache_2<K, V>;
895
+ has(key: K): boolean;
896
+ delete(key: K): boolean;
897
+ }
898
+
888
899
  /**
889
900
  * @category Mesh
890
901
  */
@@ -1432,6 +1443,8 @@ export declare const FLAGS: {
1432
1443
  THUMBNAIL_TIMEOUT: number;
1433
1444
  /**Always render attachments even when theyre set to not be visible */
1434
1445
  ALWAYS_SHOW_ATTACHMENTS: boolean;
1446
+ /**Multiplier for delta time used by renderer things (does not affect datamodel side of things but particles and such instead) */
1447
+ RENDERER_DELTA_TIME_MULTIPLIER: number;
1435
1448
  /**shows ThreeJS SkeletonHelper */
1436
1449
  SHOW_SKELETON_HELPER: boolean;
1437
1450
  /**if set the skeleton helper will only show if the instance has the name */
package/dist/index.js CHANGED
@@ -29863,6 +29863,7 @@ const FLAGS = {
29863
29863
  RENDERTARGET_TO_CANVASTEXTURE: false,
29864
29864
  THUMBNAIL_TIMEOUT: 500,
29865
29865
  ALWAYS_SHOW_ATTACHMENTS: false,
29866
+ RENDERER_DELTA_TIME_MULTIPLIER: 1,
29866
29867
  //skeleton
29867
29868
  SHOW_SKELETON_HELPER: false,
29868
29869
  SKELETON_HELPER_INSTANCE_NAME: void 0,
@@ -35721,16 +35722,49 @@ function _updateCurrentlyLoadingAssets(type, label) {
35721
35722
  const newCurrentlyLoading = currentlyLoadingAssets.length > 0;
35722
35723
  API.Events.OnLoadingAssets.Fire(newCurrentlyLoading, type, label);
35723
35724
  }
35725
+ class Cache {
35726
+ map = /* @__PURE__ */ new Map();
35727
+ lastAccess = /* @__PURE__ */ new Map();
35728
+ maxEntries;
35729
+ constructor(maxEntries = 250) {
35730
+ this.maxEntries = maxEntries;
35731
+ }
35732
+ get(key) {
35733
+ if (this.map.has(key)) {
35734
+ this.lastAccess.set(key, Date.now());
35735
+ }
35736
+ return this.map.get(key);
35737
+ }
35738
+ set(key, value) {
35739
+ this.map.set(key, value);
35740
+ this.lastAccess.set(key, Date.now());
35741
+ if (this.map.size > this.maxEntries) {
35742
+ const toDelete = [...this.lastAccess.entries()].reduce((min, current) => {
35743
+ return current[1] < min[1] ? current : min;
35744
+ });
35745
+ this.delete(toDelete[0]);
35746
+ }
35747
+ return this;
35748
+ }
35749
+ has(key) {
35750
+ return this.map.has(key);
35751
+ }
35752
+ delete(key) {
35753
+ const toReturn = this.map.delete(key);
35754
+ this.lastAccess.delete(key);
35755
+ return toReturn;
35756
+ }
35757
+ }
35724
35758
  const CACHE = {
35725
- "AssetBuffer": /* @__PURE__ */ new Map(),
35726
- "RBX": /* @__PURE__ */ new Map(),
35727
- "Mesh": /* @__PURE__ */ new Map(),
35728
- "Image": /* @__PURE__ */ new Map(),
35729
- "Thumbnails": /* @__PURE__ */ new Map(),
35730
- "ItemOwned": /* @__PURE__ */ new Map(),
35731
- "IsLayered": /* @__PURE__ */ new Map(),
35732
- "AvatarInventoryItem": /* @__PURE__ */ new Map(),
35733
- "ItemDetails": /* @__PURE__ */ new Map(),
35759
+ "AssetBuffer": new Cache(250),
35760
+ "RBX": new Cache(100),
35761
+ "Mesh": new Cache(250),
35762
+ "Image": new Cache(100),
35763
+ "Thumbnails": new Cache(1e3),
35764
+ "ItemOwned": new Cache(1e3),
35765
+ "IsLayered": new Cache(1e3),
35766
+ "AvatarInventoryItem": new Cache(1e3),
35767
+ "ItemDetails": new Cache(1e4),
35734
35768
  "UserInfo": void 0
35735
35769
  };
35736
35770
  const ContentMap = /* @__PURE__ */ new Map();
@@ -50248,7 +50282,7 @@ class EmitterGroupDesc extends RenderDesc {
50248
50282
  return this.results;
50249
50283
  }
50250
50284
  updateResults() {
50251
- const dt = specialClamp(this.time - this.lastTime, 0, 1 / 10);
50285
+ const dt = specialClamp(this.time - this.lastTime, 0, 1 / 10) * FLAGS.RENDERER_DELTA_TIME_MULTIPLIER;
50252
50286
  this.lastTime = this.time;
50253
50287
  for (const emitterDesc of this.emitterDescs) {
50254
50288
  emitterDesc.tick(dt, this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.5.9",
3
+ "version": "1.5.10",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",