roavatar-renderer 1.7.4 → 1.8.1

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 CHANGED
@@ -383,7 +383,7 @@ export declare const API: {
383
383
  };
384
384
  Inventory: {
385
385
  GetInventory: (userId: number, assetType: number, cursor?: string) => Promise<Response>;
386
- IsItemOwned: (userId: number, itemType: string, assetId: number) => Promise<any>;
386
+ IsItemOwned: (userId: number, itemType: string, assetId: number) => Promise<boolean | Response>;
387
387
  };
388
388
  Users: {
389
389
  GetUserInfo: () => Promise<UserInfo | undefined>;
@@ -413,6 +413,11 @@ export declare const API: {
413
413
  Subscriptions: {
414
414
  HasPlus: () => Promise<Response | boolean>;
415
415
  };
416
+ AvatarAIGenerationService: {
417
+ GenerateBackground: (auth: Authentication, prompt: string) => Promise<Response | string>;
418
+ GetBackground: (generationId: string) => Promise<Response | GetBackground_Result>;
419
+ UploadBackground: (auth: Authentication, generationId: string, displayName: string, description?: string) => Promise<Response | string>;
420
+ };
416
421
  RBLXGet: typeof RBLXGet;
417
422
  RBLXPost: typeof RBLXPost;
418
423
  RBLXDelete: typeof RBLXDelete;
@@ -703,6 +708,8 @@ export declare class BackgroundRenderer {
703
708
  affectSceneLighting: boolean;
704
709
  cameraAffectsTransparency: boolean;
705
710
  cameraAffectsRotation: boolean;
711
+ forceImage: string | undefined;
712
+ forceColor: Color3 | undefined;
706
713
  lastFrameTime: number;
707
714
  animationInterval?: NodeJS.Timeout;
708
715
  animationFPS: number;
@@ -1092,6 +1099,7 @@ export declare class CFrame {
1092
1099
  fromRotationMatrix(r00: number, r01: number, r02: number, r10: number, r11: number, r12: number, r20: number, r21: number, r22: number, order?: string): void;
1093
1100
  lookVector(): Vec3;
1094
1101
  upVector(): Vec3;
1102
+ rightVector(): Vec3;
1095
1103
  static lookAt(eye: Vec3, target: Vec3, up?: Vec3): CFrame;
1096
1104
  static fromEulerAngles(rx: number, ry: number, rz: number, order?: THREE.EulerOrder): CFrame;
1097
1105
  rotationOnly(): CFrame;
@@ -1623,6 +1631,8 @@ export declare const FLAGS: {
1623
1631
  GEAR_ENABLED: boolean;
1624
1632
  /**makes Audio instances play sound when played */
1625
1633
  AUDIO_ENABLED: boolean;
1634
+ /**makes Beam instances render */
1635
+ BEAMS_ENABLED: boolean;
1626
1636
  /**enables full texture compilation using ThreeJS RenderTarget */
1627
1637
  USE_RENDERTARGET: boolean;
1628
1638
  /**the renderer will attempt to restore the webgl context when it is lost */
@@ -1790,6 +1800,13 @@ export declare function GetAttachedPart(accessory: Instance, rig: Instance): Ins
1790
1800
 
1791
1801
  export declare function getAvatarCameraCFrame(character: Instance, applyEmote?: () => void, isFallbackEmoteApplied?: boolean, fieldOfViewDeg?: number, cameraOptionsOverride?: Partial<CameraOptions>): Instance | undefined;
1792
1802
 
1803
+ export declare interface GetBackground_Result {
1804
+ generationId: string;
1805
+ status: "Generating" | "Completed" | string;
1806
+ presignedUrl: string | null;
1807
+ failureReason: unknown | null;
1808
+ }
1809
+
1793
1810
  export declare function getCameraCFrame(targetCFrame: CFrame, relativePos: Vector3): CFrame;
1794
1811
 
1795
1812
  /**
@@ -1820,8 +1837,15 @@ export declare function getCameraCFrameForAvatarNonCustomized(rig: Instance): CF
1820
1837
  */
1821
1838
  export declare function getCameraCFrameForHeadshotCustomized(rig: Instance, fov: number, yRot: number, distance: number): CFrame | undefined;
1822
1839
 
1840
+ export declare function getCameraCFrameForHeadshotNonCustomized(rig: Instance, newLighting?: boolean): {
1841
+ cframe: CFrame;
1842
+ fov: number;
1843
+ };
1844
+
1823
1845
  export declare function getCharacterTorsoCFrame(character: Instance): CFrame;
1824
1846
 
1847
+ export declare function getCloseupCameraCFrame(character: Instance, newLighting?: boolean): Instance;
1848
+
1825
1849
  /**
1826
1850
  * @category Mesh
1827
1851
  */
@@ -4011,6 +4035,13 @@ export declare const SpecialLayeredAssetTypes: string[];
4011
4035
 
4012
4036
  export declare const StringBufferProperties: string[];
4013
4037
 
4038
+ /**@category DataModelEnum */
4039
+ export declare const TextureMode: {
4040
+ Stretch: number;
4041
+ Wrap: number;
4042
+ Static: number;
4043
+ };
4044
+
4014
4045
  declare type ThreePoseCorrective = Vec3;
4015
4046
 
4016
4047
  /**
@@ -4129,7 +4160,7 @@ export declare class UDim2 {
4129
4160
  clone(): UDim2;
4130
4161
  }
4131
4162
 
4132
- declare type UserInfo = {
4163
+ export declare type UserInfo = {
4133
4164
  id: number;
4134
4165
  name: string;
4135
4166
  displayName: string;
package/dist/index.js CHANGED
@@ -14978,6 +14978,382 @@ class BoxGeometry extends BufferGeometry {
14978
14978
  return new BoxGeometry(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments);
14979
14979
  }
14980
14980
  }
14981
+ class Curve {
14982
+ /**
14983
+ * Constructs a new curve.
14984
+ */
14985
+ constructor() {
14986
+ this.type = "Curve";
14987
+ this.arcLengthDivisions = 200;
14988
+ this.needsUpdate = false;
14989
+ this.cacheArcLengths = null;
14990
+ }
14991
+ /**
14992
+ * This method returns a vector in 2D or 3D space (depending on the curve definition)
14993
+ * for the given interpolation factor.
14994
+ *
14995
+ * @abstract
14996
+ * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
14997
+ * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
14998
+ * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.
14999
+ */
15000
+ getPoint() {
15001
+ warn$1("Curve: .getPoint() not implemented.");
15002
+ }
15003
+ /**
15004
+ * This method returns a vector in 2D or 3D space (depending on the curve definition)
15005
+ * for the given interpolation factor. Unlike {@link Curve#getPoint}, this method honors the length
15006
+ * of the curve which equidistant samples.
15007
+ *
15008
+ * @param {number} u - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
15009
+ * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
15010
+ * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.
15011
+ */
15012
+ getPointAt(u, optionalTarget) {
15013
+ const t = this.getUtoTmapping(u);
15014
+ return this.getPoint(t, optionalTarget);
15015
+ }
15016
+ /**
15017
+ * This method samples the curve via {@link Curve#getPoint} and returns an array of points representing
15018
+ * the curve shape.
15019
+ *
15020
+ * @param {number} [divisions=5] - The number of divisions.
15021
+ * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`.
15022
+ */
15023
+ getPoints(divisions = 5) {
15024
+ const points = [];
15025
+ for (let d = 0; d <= divisions; d++) {
15026
+ points.push(this.getPoint(d / divisions));
15027
+ }
15028
+ return points;
15029
+ }
15030
+ // Get sequence of points using getPointAt( u )
15031
+ /**
15032
+ * This method samples the curve via {@link Curve#getPointAt} and returns an array of points representing
15033
+ * the curve shape. Unlike {@link Curve#getPoints}, this method returns equi-spaced points across the entire
15034
+ * curve.
15035
+ *
15036
+ * @param {number} [divisions=5] - The number of divisions.
15037
+ * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`.
15038
+ */
15039
+ getSpacedPoints(divisions = 5) {
15040
+ const points = [];
15041
+ for (let d = 0; d <= divisions; d++) {
15042
+ points.push(this.getPointAt(d / divisions));
15043
+ }
15044
+ return points;
15045
+ }
15046
+ /**
15047
+ * Returns the total arc length of the curve.
15048
+ *
15049
+ * @return {number} The length of the curve.
15050
+ */
15051
+ getLength() {
15052
+ const lengths = this.getLengths();
15053
+ return lengths[lengths.length - 1];
15054
+ }
15055
+ /**
15056
+ * Returns an array of cumulative segment lengths of the curve.
15057
+ *
15058
+ * @param {number} [divisions=this.arcLengthDivisions] - The number of divisions.
15059
+ * @return {Array<number>} An array holding the cumulative segment lengths.
15060
+ */
15061
+ getLengths(divisions = this.arcLengthDivisions) {
15062
+ if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) {
15063
+ return this.cacheArcLengths;
15064
+ }
15065
+ this.needsUpdate = false;
15066
+ const cache = [];
15067
+ let current, last = this.getPoint(0);
15068
+ let sum = 0;
15069
+ cache.push(0);
15070
+ for (let p2 = 1; p2 <= divisions; p2++) {
15071
+ current = this.getPoint(p2 / divisions);
15072
+ sum += current.distanceTo(last);
15073
+ cache.push(sum);
15074
+ last = current;
15075
+ }
15076
+ this.cacheArcLengths = cache;
15077
+ return cache;
15078
+ }
15079
+ /**
15080
+ * Update the cumulative segment distance cache. The method must be called
15081
+ * every time curve parameters are changed. If an updated curve is part of a
15082
+ * composed curve like {@link CurvePath}, this method must be called on the
15083
+ * composed curve, too.
15084
+ */
15085
+ updateArcLengths() {
15086
+ this.needsUpdate = true;
15087
+ this.getLengths();
15088
+ }
15089
+ /**
15090
+ * Given an interpolation factor in the range `[0,1]`, this method returns an updated
15091
+ * interpolation factor in the same range that can be ued to sample equidistant points
15092
+ * from a curve.
15093
+ *
15094
+ * @param {number} u - The interpolation factor.
15095
+ * @param {?number} distance - An optional distance on the curve.
15096
+ * @return {number} The updated interpolation factor.
15097
+ */
15098
+ getUtoTmapping(u, distance2 = null) {
15099
+ const arcLengths = this.getLengths();
15100
+ let i = 0;
15101
+ const il = arcLengths.length;
15102
+ let targetArcLength;
15103
+ if (distance2) {
15104
+ targetArcLength = distance2;
15105
+ } else {
15106
+ targetArcLength = u * arcLengths[il - 1];
15107
+ }
15108
+ let low = 0, high = il - 1, comparison;
15109
+ while (low <= high) {
15110
+ i = Math.floor(low + (high - low) / 2);
15111
+ comparison = arcLengths[i] - targetArcLength;
15112
+ if (comparison < 0) {
15113
+ low = i + 1;
15114
+ } else if (comparison > 0) {
15115
+ high = i - 1;
15116
+ } else {
15117
+ high = i;
15118
+ break;
15119
+ }
15120
+ }
15121
+ i = high;
15122
+ if (arcLengths[i] === targetArcLength) {
15123
+ return i / (il - 1);
15124
+ }
15125
+ const lengthBefore = arcLengths[i];
15126
+ const lengthAfter = arcLengths[i + 1];
15127
+ const segmentLength = lengthAfter - lengthBefore;
15128
+ const segmentFraction = (targetArcLength - lengthBefore) / segmentLength;
15129
+ const t = (i + segmentFraction) / (il - 1);
15130
+ return t;
15131
+ }
15132
+ /**
15133
+ * Returns a unit vector tangent for the given interpolation factor.
15134
+ * If the derived curve does not implement its tangent derivation,
15135
+ * two points a small delta apart will be used to find its gradient
15136
+ * which seems to give a reasonable approximation.
15137
+ *
15138
+ * @param {number} t - The interpolation factor.
15139
+ * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
15140
+ * @return {(Vector2|Vector3)} The tangent vector.
15141
+ */
15142
+ getTangent(t, optionalTarget) {
15143
+ const delta = 1e-4;
15144
+ let t1 = t - delta;
15145
+ let t2 = t + delta;
15146
+ if (t1 < 0) t1 = 0;
15147
+ if (t2 > 1) t2 = 1;
15148
+ const pt1 = this.getPoint(t1);
15149
+ const pt2 = this.getPoint(t2);
15150
+ const tangent = optionalTarget || (pt1.isVector2 ? new Vector2$1() : new Vector3$1());
15151
+ tangent.copy(pt2).sub(pt1).normalize();
15152
+ return tangent;
15153
+ }
15154
+ /**
15155
+ * Same as {@link Curve#getTangent} but with equidistant samples.
15156
+ *
15157
+ * @param {number} u - The interpolation factor.
15158
+ * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
15159
+ * @return {(Vector2|Vector3)} The tangent vector.
15160
+ * @see {@link Curve#getPointAt}
15161
+ */
15162
+ getTangentAt(u, optionalTarget) {
15163
+ const t = this.getUtoTmapping(u);
15164
+ return this.getTangent(t, optionalTarget);
15165
+ }
15166
+ /**
15167
+ * Generates the Frenet Frames. Requires a curve definition in 3D space. Used
15168
+ * in geometries like {@link TubeGeometry} or {@link ExtrudeGeometry}.
15169
+ *
15170
+ * @param {number} segments - The number of segments.
15171
+ * @param {boolean} [closed=false] - Whether the curve is closed or not.
15172
+ * @return {{tangents: Array<Vector3>, normals: Array<Vector3>, binormals: Array<Vector3>}} The Frenet Frames.
15173
+ */
15174
+ computeFrenetFrames(segments, closed = false) {
15175
+ const normal = new Vector3$1();
15176
+ const tangents = [];
15177
+ const normals = [];
15178
+ const binormals = [];
15179
+ const vec = new Vector3$1();
15180
+ const mat = new Matrix4();
15181
+ for (let i = 0; i <= segments; i++) {
15182
+ const u = i / segments;
15183
+ tangents[i] = this.getTangentAt(u, new Vector3$1());
15184
+ }
15185
+ normals[0] = new Vector3$1();
15186
+ binormals[0] = new Vector3$1();
15187
+ let min = Number.MAX_VALUE;
15188
+ const tx = Math.abs(tangents[0].x);
15189
+ const ty = Math.abs(tangents[0].y);
15190
+ const tz = Math.abs(tangents[0].z);
15191
+ if (tx <= min) {
15192
+ min = tx;
15193
+ normal.set(1, 0, 0);
15194
+ }
15195
+ if (ty <= min) {
15196
+ min = ty;
15197
+ normal.set(0, 1, 0);
15198
+ }
15199
+ if (tz <= min) {
15200
+ normal.set(0, 0, 1);
15201
+ }
15202
+ vec.crossVectors(tangents[0], normal).normalize();
15203
+ normals[0].crossVectors(tangents[0], vec);
15204
+ binormals[0].crossVectors(tangents[0], normals[0]);
15205
+ for (let i = 1; i <= segments; i++) {
15206
+ normals[i] = normals[i - 1].clone();
15207
+ binormals[i] = binormals[i - 1].clone();
15208
+ vec.crossVectors(tangents[i - 1], tangents[i]);
15209
+ if (vec.length() > Number.EPSILON) {
15210
+ vec.normalize();
15211
+ const theta = Math.acos(clamp$1(tangents[i - 1].dot(tangents[i]), -1, 1));
15212
+ normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta));
15213
+ }
15214
+ binormals[i].crossVectors(tangents[i], normals[i]);
15215
+ }
15216
+ if (closed === true) {
15217
+ let theta = Math.acos(clamp$1(normals[0].dot(normals[segments]), -1, 1));
15218
+ theta /= segments;
15219
+ if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) {
15220
+ theta = -theta;
15221
+ }
15222
+ for (let i = 1; i <= segments; i++) {
15223
+ normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i));
15224
+ binormals[i].crossVectors(tangents[i], normals[i]);
15225
+ }
15226
+ }
15227
+ return {
15228
+ tangents,
15229
+ normals,
15230
+ binormals
15231
+ };
15232
+ }
15233
+ /**
15234
+ * Returns a new curve with copied values from this instance.
15235
+ *
15236
+ * @return {Curve} A clone of this instance.
15237
+ */
15238
+ clone() {
15239
+ return new this.constructor().copy(this);
15240
+ }
15241
+ /**
15242
+ * Copies the values of the given curve to this instance.
15243
+ *
15244
+ * @param {Curve} source - The curve to copy.
15245
+ * @return {Curve} A reference to this curve.
15246
+ */
15247
+ copy(source) {
15248
+ this.arcLengthDivisions = source.arcLengthDivisions;
15249
+ return this;
15250
+ }
15251
+ /**
15252
+ * Serializes the curve into JSON.
15253
+ *
15254
+ * @return {Object} A JSON object representing the serialized curve.
15255
+ * @see {@link ObjectLoader#parse}
15256
+ */
15257
+ toJSON() {
15258
+ const data = {
15259
+ metadata: {
15260
+ version: 4.7,
15261
+ type: "Curve",
15262
+ generator: "Curve.toJSON"
15263
+ }
15264
+ };
15265
+ data.arcLengthDivisions = this.arcLengthDivisions;
15266
+ data.type = this.type;
15267
+ return data;
15268
+ }
15269
+ /**
15270
+ * Deserializes the curve from the given JSON.
15271
+ *
15272
+ * @param {Object} json - The JSON holding the serialized curve.
15273
+ * @return {Curve} A reference to this curve.
15274
+ */
15275
+ fromJSON(json) {
15276
+ this.arcLengthDivisions = json.arcLengthDivisions;
15277
+ return this;
15278
+ }
15279
+ }
15280
+ function CubicBezierP0(t, p2) {
15281
+ const k = 1 - t;
15282
+ return k * k * k * p2;
15283
+ }
15284
+ function CubicBezierP1(t, p2) {
15285
+ const k = 1 - t;
15286
+ return 3 * k * k * t * p2;
15287
+ }
15288
+ function CubicBezierP2(t, p2) {
15289
+ return 3 * (1 - t) * t * t * p2;
15290
+ }
15291
+ function CubicBezierP3(t, p2) {
15292
+ return t * t * t * p2;
15293
+ }
15294
+ function CubicBezier(t, p0, p1, p2, p3) {
15295
+ return CubicBezierP0(t, p0) + CubicBezierP1(t, p1) + CubicBezierP2(t, p2) + CubicBezierP3(t, p3);
15296
+ }
15297
+ class CubicBezierCurve3 extends Curve {
15298
+ /**
15299
+ * Constructs a new Cubic Bezier curve.
15300
+ *
15301
+ * @param {Vector3} [v0] - The start point.
15302
+ * @param {Vector3} [v1] - The first control point.
15303
+ * @param {Vector3} [v2] - The second control point.
15304
+ * @param {Vector3} [v3] - The end point.
15305
+ */
15306
+ constructor(v0 = new Vector3$1(), v1 = new Vector3$1(), v2 = new Vector3$1(), v3 = new Vector3$1()) {
15307
+ super();
15308
+ this.isCubicBezierCurve3 = true;
15309
+ this.type = "CubicBezierCurve3";
15310
+ this.v0 = v0;
15311
+ this.v1 = v1;
15312
+ this.v2 = v2;
15313
+ this.v3 = v3;
15314
+ }
15315
+ /**
15316
+ * Returns a point on the curve.
15317
+ *
15318
+ * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
15319
+ * @param {Vector3} [optionalTarget] - The optional target vector the result is written to.
15320
+ * @return {Vector3} The position on the curve.
15321
+ */
15322
+ getPoint(t, optionalTarget = new Vector3$1()) {
15323
+ const point = optionalTarget;
15324
+ const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;
15325
+ point.set(
15326
+ CubicBezier(t, v0.x, v1.x, v2.x, v3.x),
15327
+ CubicBezier(t, v0.y, v1.y, v2.y, v3.y),
15328
+ CubicBezier(t, v0.z, v1.z, v2.z, v3.z)
15329
+ );
15330
+ return point;
15331
+ }
15332
+ copy(source) {
15333
+ super.copy(source);
15334
+ this.v0.copy(source.v0);
15335
+ this.v1.copy(source.v1);
15336
+ this.v2.copy(source.v2);
15337
+ this.v3.copy(source.v3);
15338
+ return this;
15339
+ }
15340
+ toJSON() {
15341
+ const data = super.toJSON();
15342
+ data.v0 = this.v0.toArray();
15343
+ data.v1 = this.v1.toArray();
15344
+ data.v2 = this.v2.toArray();
15345
+ data.v3 = this.v3.toArray();
15346
+ return data;
15347
+ }
15348
+ fromJSON(json) {
15349
+ super.fromJSON(json);
15350
+ this.v0.fromArray(json.v0);
15351
+ this.v1.fromArray(json.v1);
15352
+ this.v2.fromArray(json.v2);
15353
+ this.v3.fromArray(json.v3);
15354
+ return this;
15355
+ }
15356
+ }
14981
15357
  class PlaneGeometry extends BufferGeometry {
14982
15358
  /**
14983
15359
  * Constructs a new plane geometry.
@@ -30649,6 +31025,11 @@ class RBXSimpleView {
30649
31025
  }
30650
31026
  const magic = "<roblox!";
30651
31027
  const xmlMagic = "<roblox ";
31028
+ const TextureMode = {
31029
+ "Stretch": 0,
31030
+ "Wrap": 1,
31031
+ "Static": 2
31032
+ };
30652
31033
  const ResamplerMode = {
30653
31034
  "Default": 0,
30654
31035
  "Pixelated": 1
@@ -32239,6 +32620,7 @@ const FLAGS = {
32239
32620
  //does this count as anti aliasing?
32240
32621
  GEAR_ENABLED: true,
32241
32622
  AUDIO_ENABLED: true,
32623
+ BEAMS_ENABLED: true,
32242
32624
  USE_RENDERTARGET: true,
32243
32625
  AUTO_RESTORE_CONTEXT: true,
32244
32626
  RENDERTARGET_TO_CANVASTEXTURE: false,
@@ -32780,6 +33162,16 @@ class CFrame {
32780
33162
  upVector.applyQuaternion(quat);
32781
33163
  return upVector.toArray();
32782
33164
  }
33165
+ rightVector() {
33166
+ const matrix = this.getTHREEMatrix();
33167
+ const pos = new Vector3$1();
33168
+ const quat = new Quaternion();
33169
+ const scale = new Vector3$1();
33170
+ matrix.decompose(pos, quat, scale);
33171
+ const rightVector = new Vector3$1(1, 0, 0);
33172
+ rightVector.applyQuaternion(quat);
33173
+ return rightVector.toArray();
33174
+ }
32783
33175
  static lookAt(eye, target, up = [0, 1, 0]) {
32784
33176
  const matrix = new Matrix4().lookAt(new Vector3$1(...eye), new Vector3$1(...target), new Vector3$1(...up));
32785
33177
  const newCFrame = new CFrame();
@@ -36531,8 +36923,8 @@ const CategoryDictionary = {
36531
36923
  "Idle": new SortInfo([new ItemSort(51)]),
36532
36924
  "Walk": new SortInfo([new ItemSort(55)]),
36533
36925
  "Run": new SortInfo([new ItemSort(53)]),
36534
- "Fall": new SortInfo([new ItemSort(50)]),
36535
36926
  "Jump": new SortInfo([new ItemSort(52)]),
36927
+ "Fall": new SortInfo([new ItemSort(50)]),
36536
36928
  "Swim": new SortInfo([new ItemSort(54)]),
36537
36929
  "Climb": new SortInfo([new ItemSort(48)]),
36538
36930
  "Mood": new SortInfo([new ItemSort(AssetTypeNameToId.get("MoodAnimation") || 0)], "inventory")
@@ -38283,7 +38675,7 @@ class FileMesh {
38283
38675
  log(false, "COREMESH v2");
38284
38676
  const dracoBitStreamSize = view.readUint32();
38285
38677
  const buffer2 = view.buffer.slice(view.viewOffset, view.viewOffset + dracoBitStreamSize);
38286
- if (!window.DracoDecoderModule) throw new Error("DracoDecoderModule is missing, you forgot to add draco_decoder.js");
38678
+ if (!globalThis.DracoDecoderModule) throw new Error("DracoDecoderModule is missing, you forgot to add draco_decoder.js");
38287
38679
  const decoderModule = await DracoDecoderModule();
38288
38680
  const decoder = new decoderModule.Decoder();
38289
38681
  const mesh = new decoderModule.Mesh();
@@ -38366,7 +38758,7 @@ class FileMesh {
38366
38758
  }
38367
38759
  async fromBuffer(buffer2) {
38368
38760
  this.reset();
38369
- if (!window.DracoDecoderModule) {
38761
+ if (!globalThis.DracoDecoderModule) {
38370
38762
  error("Missing module dependency: draco_decoder.js");
38371
38763
  throw new Error("Missing module dependency: draco_decoder.js, more info in documentation");
38372
38764
  }
@@ -38879,7 +39271,7 @@ async function RBLXPost(url, auth, body, attempt = 0, method = "POST") {
38879
39271
  headers: fetchHeaders,
38880
39272
  body
38881
39273
  }).then((response2) => {
38882
- if (response2.status !== 200) {
39274
+ if (!response2.ok) {
38883
39275
  if (response2.status === 403 && attempt < 1) {
38884
39276
  const responseToken = response2.headers.get("x-csrf-token");
38885
39277
  if (responseToken && auth) {
@@ -38901,7 +39293,7 @@ async function RBLXPost(url, auth, body, attempt = 0, method = "POST") {
38901
39293
  resolve(new Response(JSON.stringify({ "error": error2 }), { status: 500 }));
38902
39294
  }
38903
39295
  });
38904
- if (FLAGS.API_REQUEST_RETRY && response.status !== 200 && attempt === 0) {
39296
+ if (FLAGS.API_REQUEST_RETRY && !response.ok && attempt === 0) {
38905
39297
  return RBLXPost(url, auth, body, attempt + 1, method);
38906
39298
  } else {
38907
39299
  return response;
@@ -38938,7 +39330,7 @@ async function RBLXGet(url, headers, includeCredentials = true, attempt = 0) {
38938
39330
  resolve(new Response(JSON.stringify({ "error": error2 }), { status: 500 }));
38939
39331
  }
38940
39332
  });
38941
- if (FLAGS.API_REQUEST_RETRY && response.status !== 200 && attempt === 0) {
39333
+ if (FLAGS.API_REQUEST_RETRY && !response.ok && attempt === 0) {
38942
39334
  return RBLXGet(url, headers, includeCredentials, attempt + 1);
38943
39335
  } else {
38944
39336
  return response;
@@ -39854,7 +40246,7 @@ const API = {
39854
40246
  const cacheResult = CACHE.ItemOwned.get(`${userId}.${itemType}.${assetId}`);
39855
40247
  if (cacheResult) {
39856
40248
  if (cacheResult[0]) return true;
39857
- if ((/* @__PURE__ */ new Date()).getTime() - cacheResult[1] < 5) return false;
40249
+ if (Date.now() / 1e3 - cacheResult[1] < 10) return false;
39858
40250
  }
39859
40251
  const response = await RBLXGet(`https://inventory.roblox.com/v1/users/${userId}/items/${itemType}/${assetId}/is-owned`);
39860
40252
  if (response.status !== 200) {
@@ -39864,7 +40256,7 @@ const API = {
39864
40256
  if (responseBool) {
39865
40257
  CACHE.ItemOwned.set(`${userId}.${itemType}.${assetId}`, [true, 0]);
39866
40258
  } else {
39867
- CACHE.ItemOwned.set(`${userId}.${itemType}.${assetId}`, [false, (/* @__PURE__ */ new Date()).getTime() / 1e3]);
40259
+ CACHE.ItemOwned.set(`${userId}.${itemType}.${assetId}`, [false, Date.now() / 1e3]);
39868
40260
  }
39869
40261
  return responseBool;
39870
40262
  }
@@ -39874,15 +40266,21 @@ const API = {
39874
40266
  if (CACHE.UserInfo !== void 0) {
39875
40267
  return CACHE.UserInfo;
39876
40268
  }
39877
- const response = await RBLXGet("https://users.roblox.com/v1/users/authenticated");
39878
- if (response.status === 200) {
39879
- const result = await response.json();
39880
- CACHE.UserInfo = result;
39881
- return result;
39882
- } else {
39883
- warn(true, "Failed to get user info: GetUserInfo(auth)");
39884
- return void 0;
39885
- }
40269
+ const promise = new Promise((resolve) => {
40270
+ RBLXGet("https://users.roblox.com/v1/users/authenticated").then(((response) => {
40271
+ if (response.status === 200) {
40272
+ response.json().then((result) => {
40273
+ CACHE.UserInfo = result;
40274
+ resolve(result);
40275
+ });
40276
+ } else {
40277
+ warn(true, "Failed to get user info: GetUserInfo(auth)");
40278
+ resolve(void 0);
40279
+ }
40280
+ }));
40281
+ });
40282
+ CACHE.UserInfo = promise;
40283
+ return promise;
39886
40284
  },
39887
40285
  GetIdsFromUsernames: async function(usernames) {
39888
40286
  const response = await RBLXPost("https://users.roblox.com/v1/usernames/users", void 0, { "usernames": usernames });
@@ -40075,6 +40473,46 @@ const API = {
40075
40473
  return (await response.json()).subscriptions.length > 0;
40076
40474
  }
40077
40475
  },
40476
+ "AvatarAIGenerationService": {
40477
+ GenerateBackground: async function(auth, prompt) {
40478
+ const response = await RBLXPost("https://apis.roblox.com/avatar-ai-generation-service/v1/backgrounds/generation", auth, {
40479
+ prompt
40480
+ });
40481
+ if (response.status !== 200 && response.status !== 202) {
40482
+ return response;
40483
+ }
40484
+ const result = await response.json();
40485
+ if (result.generationId) {
40486
+ return result.generationId;
40487
+ } else {
40488
+ return response;
40489
+ }
40490
+ },
40491
+ GetBackground: async function(generationId) {
40492
+ const response = await RBLXGet(`https://apis.roblox.com/avatar-ai-generation-service/v1/backgrounds/generation/${generationId}`);
40493
+ if (response.status !== 200) {
40494
+ return response;
40495
+ }
40496
+ return await response.json();
40497
+ },
40498
+ UploadBackground: async function(auth, generationId, displayName, description) {
40499
+ const response = await RBLXPost(`https://apis.roblox.com/avatar-ai-generation-service/v1/backgrounds/generation/${generationId}/upload`, auth, {
40500
+ displayName,
40501
+ //max 50 characters
40502
+ description
40503
+ //max 500 characters
40504
+ });
40505
+ if (response.status !== 200) {
40506
+ return response;
40507
+ }
40508
+ const result = await response.json();
40509
+ if (result.operationId) {
40510
+ return result.operationId;
40511
+ } else {
40512
+ return response;
40513
+ }
40514
+ }
40515
+ },
40078
40516
  "RBLXGet": RBLXGet,
40079
40517
  "RBLXPost": RBLXPost,
40080
40518
  "RBLXDelete": RBLXDelete,
@@ -43413,6 +43851,21 @@ function setTHREEObjectCF(threeObject, cframe) {
43413
43851
  threeObject.rotation.y = rad(cframe.Orientation[1]);
43414
43852
  threeObject.rotation.z = rad(cframe.Orientation[2]);
43415
43853
  }
43854
+ async function getTexture(texture, colorSpace = SRGBColorSpace) {
43855
+ if (texture) {
43856
+ const source = texture.replace(".dds", ".png");
43857
+ const image = await API.Generic.LoadImage(source);
43858
+ if (image) {
43859
+ const texture2 = new Texture(image);
43860
+ texture2.wrapS = ClampToEdgeWrapping;
43861
+ texture2.wrapT = ClampToEdgeWrapping;
43862
+ texture2.colorSpace = colorSpace;
43863
+ texture2.needsUpdate = true;
43864
+ return texture2;
43865
+ }
43866
+ }
43867
+ return void 0;
43868
+ }
43416
43869
  class DisposableDesc {
43417
43870
  disposeMesh(scene, mesh) {
43418
43871
  disposeMesh(scene, mesh);
@@ -48197,6 +48650,11 @@ class ObjectDesc extends RenderDesc {
48197
48650
  }
48198
48651
  if (this.materialDesc.result) {
48199
48652
  this.materialDesc.updateResult();
48653
+ if (this.results) {
48654
+ for (const result of this.results) {
48655
+ result.visible = this.materialDesc.visible;
48656
+ }
48657
+ }
48200
48658
  }
48201
48659
  }
48202
48660
  static shouldRenderInstance(instance) {
@@ -48214,7 +48672,7 @@ class ObjectDesc extends RenderDesc {
48214
48672
  return !isBakedDecal && (!isDecal || isFirstDecal);
48215
48673
  }
48216
48674
  }
48217
- const __vite_glob_0_3$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48675
+ const __vite_glob_0_4$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48218
48676
  __proto__: null,
48219
48677
  MeshPartTypes,
48220
48678
  ObjectDesc,
@@ -49595,7 +50053,7 @@ class AnimatorWrapper extends InstanceWrapper {
49595
50053
  return false;
49596
50054
  }
49597
50055
  }
49598
- const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
50056
+ const __vite_glob_0_3$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49599
50057
  __proto__: null,
49600
50058
  AnimatorWrapper
49601
50059
  }, Symbol.toStringTag, { value: "Module" }));
@@ -51737,7 +52195,11 @@ class Particle {
51737
52195
  }
51738
52196
  if (isNext) offset += 1;
51739
52197
  if (offset >= total) {
51740
- offset %= total;
52198
+ if (mode !== ParticleFlipbookMode.OneShot) {
52199
+ offset %= total;
52200
+ } else {
52201
+ offset = total - 1;
52202
+ }
51741
52203
  }
51742
52204
  return offset;
51743
52205
  }
@@ -51849,21 +52311,6 @@ class EmitterDesc extends DisposableDesc {
51849
52311
  this.disposeRenderLists(renderer);
51850
52312
  }
51851
52313
  }
51852
- async getTexture(texture, colorSpace = SRGBColorSpace) {
51853
- if (texture) {
51854
- const source = texture.replace(".dds", ".png");
51855
- const image = await API.Generic.LoadImage(source);
51856
- if (image) {
51857
- const texture2 = new Texture(image);
51858
- texture2.wrapS = ClampToEdgeWrapping;
51859
- texture2.wrapT = ClampToEdgeWrapping;
51860
- texture2.colorSpace = colorSpace;
51861
- texture2.needsUpdate = true;
51862
- return texture2;
51863
- }
51864
- }
51865
- return void 0;
51866
- }
51867
52314
  getFlipbookSize() {
51868
52315
  let flipbookSizeX = this.flipbookSizeX;
51869
52316
  let flipbookSizeY = this.flipbookSizeY;
@@ -51892,9 +52339,9 @@ class EmitterDesc extends DisposableDesc {
51892
52339
  async compileResult(renderer, scene) {
51893
52340
  const originalResult = this.result;
51894
52341
  const texturePromises = [
51895
- this.getTexture(this.texture),
51896
- this.getTexture(this.alphaTexture, NoColorSpace),
51897
- this.getTexture(this.colorTexture)
52342
+ getTexture(this.texture),
52343
+ getTexture(this.alphaTexture, NoColorSpace),
52344
+ getTexture(this.colorTexture)
51898
52345
  ];
51899
52346
  let [mapToUse, alphaMapToUse, colorMapToUse] = await Promise.all(texturePromises);
51900
52347
  if (!mapToUse) {
@@ -52390,7 +52837,7 @@ class EmitterGroupDesc extends RenderDesc {
52390
52837
  this.lastCframe = this.cframe.clone();
52391
52838
  }
52392
52839
  }
52393
- const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52840
+ const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52394
52841
  __proto__: null,
52395
52842
  EmitterGroupDesc
52396
52843
  }, Symbol.toStringTag, { value: "Module" }));
@@ -52850,7 +53297,7 @@ const __vite_glob_0_27 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
52850
53297
  __proto__: null,
52851
53298
  WeldWrapper
52852
53299
  }, Symbol.toStringTag, { value: "Module" }));
52853
- const modules$1 = /* @__PURE__ */ Object.assign({ "./instance/Accessory.ts": __vite_glob_0_0$1, "./instance/AccessoryDescription.ts": __vite_glob_0_1$1, "./instance/AnimationConstraint.ts": __vite_glob_0_2$1, "./instance/Animator.ts": __vite_glob_0_3, "./instance/Attachment.ts": __vite_glob_0_4, "./instance/BasePart.ts": __vite_glob_0_5, "./instance/BodyColors.ts": __vite_glob_0_6, "./instance/BodyPartDescription.ts": __vite_glob_0_7, "./instance/Bone.ts": __vite_glob_0_8, "./instance/Camera.ts": __vite_glob_0_9, "./instance/Constraint.ts": __vite_glob_0_10, "./instance/Decal.ts": __vite_glob_0_11, "./instance/FaceControls.ts": __vite_glob_0_12, "./instance/HumanoidDescription.ts": __vite_glob_0_13, "./instance/InstanceWrapper.ts": __vite_glob_0_14, "./instance/JointInstance.ts": __vite_glob_0_15, "./instance/MakeupDescription.ts": __vite_glob_0_16, "./instance/ManualWeld.ts": __vite_glob_0_17, "./instance/MeshPart.ts": __vite_glob_0_18, "./instance/Model.ts": __vite_glob_0_19, "./instance/Motor6D.ts": __vite_glob_0_20, "./instance/Part.ts": __vite_glob_0_21, "./instance/ParticleEmitter.ts": __vite_glob_0_22, "./instance/Script.ts": __vite_glob_0_23, "./instance/Sound.ts": __vite_glob_0_24, "./instance/Tool.ts": __vite_glob_0_25, "./instance/WedgePart.ts": __vite_glob_0_26, "./instance/Weld.ts": __vite_glob_0_27 });
53300
+ const modules$1 = /* @__PURE__ */ Object.assign({ "./instance/Accessory.ts": __vite_glob_0_0$1, "./instance/AccessoryDescription.ts": __vite_glob_0_1$1, "./instance/AnimationConstraint.ts": __vite_glob_0_2$1, "./instance/Animator.ts": __vite_glob_0_3$1, "./instance/Attachment.ts": __vite_glob_0_4, "./instance/BasePart.ts": __vite_glob_0_5, "./instance/BodyColors.ts": __vite_glob_0_6, "./instance/BodyPartDescription.ts": __vite_glob_0_7, "./instance/Bone.ts": __vite_glob_0_8, "./instance/Camera.ts": __vite_glob_0_9, "./instance/Constraint.ts": __vite_glob_0_10, "./instance/Decal.ts": __vite_glob_0_11, "./instance/FaceControls.ts": __vite_glob_0_12, "./instance/HumanoidDescription.ts": __vite_glob_0_13, "./instance/InstanceWrapper.ts": __vite_glob_0_14, "./instance/JointInstance.ts": __vite_glob_0_15, "./instance/MakeupDescription.ts": __vite_glob_0_16, "./instance/ManualWeld.ts": __vite_glob_0_17, "./instance/MeshPart.ts": __vite_glob_0_18, "./instance/Model.ts": __vite_glob_0_19, "./instance/Motor6D.ts": __vite_glob_0_20, "./instance/Part.ts": __vite_glob_0_21, "./instance/ParticleEmitter.ts": __vite_glob_0_22, "./instance/Script.ts": __vite_glob_0_23, "./instance/Sound.ts": __vite_glob_0_24, "./instance/Tool.ts": __vite_glob_0_25, "./instance/WedgePart.ts": __vite_glob_0_26, "./instance/Weld.ts": __vite_glob_0_27 });
52854
53301
  function RegisterWrappers() {
52855
53302
  for (const module of Object.values(modules$1)) {
52856
53303
  for (const exprt of Object.values(module)) {
@@ -52912,6 +53359,249 @@ const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
52912
53359
  __proto__: null,
52913
53360
  AttachmentDesc
52914
53361
  }, Symbol.toStringTag, { value: "Module" }));
53362
+ class BeamDesc extends RenderDesc {
53363
+ static classTypes = ["Beam"];
53364
+ lastTime = Date.now() / 1e3;
53365
+ time = Date.now() / 1e3;
53366
+ passedLength = 0;
53367
+ enabled = true;
53368
+ lightEmission = 0;
53369
+ //blends between normal -> additive blending, how?? graphics magic
53370
+ lightInfluence = 1;
53371
+ texture;
53372
+ textureLength = 1;
53373
+ textureMode = TextureMode.Stretch;
53374
+ //static behaves identically to wrap
53375
+ textureSpeed = 1;
53376
+ color = ColorSequence.fromColor(new Color3(1, 1, 1));
53377
+ transparency = new NumberSequence([new NumberSequenceKeypoint(0, 0.5), new NumberSequenceKeypoint(1, 0.5)]);
53378
+ zOffset = 0;
53379
+ //this moves its world position based on camera direction
53380
+ cframe0 = new CFrame();
53381
+ cframe1 = new CFrame();
53382
+ curveSize0 = 0;
53383
+ curveSize1 = 1;
53384
+ width0 = 1;
53385
+ width1 = 1;
53386
+ faceCamera = false;
53387
+ segments = 10;
53388
+ //results
53389
+ results = [];
53390
+ isSame(newDesc) {
53391
+ return this.time === newDesc.time && this.enabled === newDesc.enabled && this.lightEmission === newDesc.lightEmission && this.lightInfluence === newDesc.lightInfluence && this.texture === newDesc.texture && this.textureLength === newDesc.textureLength && this.textureMode === newDesc.textureMode && this.textureSpeed === newDesc.textureSpeed && this.color.isSame(newDesc.color) && this.transparency.isSame(newDesc.transparency) && this.zOffset === newDesc.zOffset && this.cframe0.isSame(newDesc.cframe0) && this.cframe1.isSame(newDesc.cframe1) && this.curveSize0 === newDesc.curveSize0 && this.curveSize1 === newDesc.curveSize1 && this.width0 === newDesc.width0 && this.width1 === newDesc.width1 && this.faceCamera === newDesc.faceCamera && this.segments === newDesc.segments;
53392
+ }
53393
+ needsRegeneration(newDesc) {
53394
+ return this.enabled !== newDesc.enabled || this.texture !== newDesc.texture || this.segments !== newDesc.segments;
53395
+ }
53396
+ virtualFromRenderDesc(newDesc) {
53397
+ this.time = newDesc.time;
53398
+ this.lightEmission = newDesc.lightEmission;
53399
+ this.lightInfluence = newDesc.lightInfluence;
53400
+ this.textureLength = newDesc.textureLength;
53401
+ this.textureMode = newDesc.textureMode;
53402
+ this.textureSpeed = newDesc.textureSpeed;
53403
+ this.color = newDesc.color.clone();
53404
+ this.transparency = newDesc.transparency.clone();
53405
+ this.zOffset = newDesc.zOffset;
53406
+ this.cframe0 = newDesc.cframe0.clone();
53407
+ this.cframe1 = newDesc.cframe1.clone();
53408
+ this.curveSize0 = newDesc.curveSize0;
53409
+ this.curveSize1 = newDesc.curveSize1;
53410
+ this.width0 = newDesc.width0;
53411
+ this.width1 = newDesc.width1;
53412
+ this.faceCamera = newDesc.faceCamera;
53413
+ }
53414
+ virtualTransferFrom(oldDesc) {
53415
+ this.passedLength = oldDesc.passedLength;
53416
+ }
53417
+ fromInstance(child) {
53418
+ this.enabled = child.PropOrDefault("Enabled", this.enabled);
53419
+ this.lightEmission = child.PropOrDefault("LightEmission", this.lightEmission);
53420
+ this.lightInfluence = child.PropOrDefault("LightInfluence", this.lightInfluence);
53421
+ this.texture = child.PropOrDefault("Texture", this.texture);
53422
+ if (!this.texture) {
53423
+ const textureContent = child.PropOrDefault("TextureContent", void 0);
53424
+ if (textureContent) {
53425
+ this.texture = textureContent.uri;
53426
+ }
53427
+ }
53428
+ this.textureLength = child.PropOrDefault("TextureLength", this.textureLength);
53429
+ this.textureMode = child.PropOrDefault("TextureMode", this.textureMode);
53430
+ this.textureSpeed = child.PropOrDefault("TextureSpeed", this.textureSpeed);
53431
+ this.color = child.PropOrDefault("Color", this.color);
53432
+ this.transparency = child.PropOrDefault("Transparency", this.transparency);
53433
+ this.zOffset = child.PropOrDefault("ZOffset", this.zOffset);
53434
+ const att0 = child.PropOrDefault("Attachment0", void 0);
53435
+ if (att0 && att0.IsA("Attachment")) {
53436
+ const att0W = att0.w;
53437
+ this.cframe0 = att0W.getWorldCFrame();
53438
+ }
53439
+ const att1 = child.PropOrDefault("Attachment1", void 0);
53440
+ if (att1 && att1.IsA("Attachment")) {
53441
+ const att1W = att1.w;
53442
+ this.cframe1 = att1W.getWorldCFrame();
53443
+ }
53444
+ this.curveSize0 = child.PropOrDefault("CurveSize0", this.curveSize0);
53445
+ this.curveSize1 = child.PropOrDefault("CurveSize1", this.curveSize1);
53446
+ this.width0 = child.PropOrDefault("Width0", this.width0);
53447
+ this.width1 = child.PropOrDefault("Width1", this.width1);
53448
+ this.faceCamera = child.PropOrDefault("FaceCamera", this.faceCamera);
53449
+ this.segments = child.PropOrDefault("Segments", this.segments);
53450
+ if (!FLAGS.BEAMS_ENABLED) this.enabled = false;
53451
+ }
53452
+ async compileResults(renderer, scene) {
53453
+ const originalResults = this.results;
53454
+ this.results = [];
53455
+ if (this.enabled) {
53456
+ let textureResult = void 0;
53457
+ if (this.texture) {
53458
+ textureResult = await getTexture(this.texture);
53459
+ if (textureResult) {
53460
+ textureResult.wrapT = RepeatWrapping;
53461
+ }
53462
+ }
53463
+ const material = new MeshBasicMaterial({
53464
+ side: DoubleSide,
53465
+ map: textureResult,
53466
+ vertexColors: true,
53467
+ transparent: true,
53468
+ depthWrite: false
53469
+ });
53470
+ const geometry = new PlaneGeometry(1, 1, this.segments, 1);
53471
+ const colorValues = new Float32Array((this.segments + 1) * 2 * 4).fill(1);
53472
+ geometry.setAttribute("color", new BufferAttribute(colorValues, 4));
53473
+ const mesh = new Mesh(geometry, material);
53474
+ mesh.name = this.instance ? this.instance.PropOrDefault("Name", "Unknown") + "_Beam" : "Unknown_Beam";
53475
+ this.results.push(mesh);
53476
+ }
53477
+ if (originalResults) {
53478
+ this.disposeMeshes(scene, originalResults);
53479
+ this.disposeRenderLists(renderer);
53480
+ }
53481
+ this.updateResults();
53482
+ return this.results;
53483
+ }
53484
+ updateResults() {
53485
+ if (!this.results) return;
53486
+ const deltaTime = this.time - this.lastTime;
53487
+ this.passedLength += deltaTime * this.textureSpeed;
53488
+ const camera = this.renderScene.camera;
53489
+ const toCamera = new Vector3$1(0, 0, -1).applyQuaternion(camera.quaternion);
53490
+ const v0 = new Vector3$1(...this.cframe0.Position);
53491
+ const v1 = new Vector3$1(...this.cframe0.multiply(new CFrame(this.curveSize0, 0, 0)).Position);
53492
+ const v2 = new Vector3$1(...this.cframe1.multiply(new CFrame(-this.curveSize1, 0, 0)).Position);
53493
+ const v3 = new Vector3$1(...this.cframe1.Position);
53494
+ const curve = new CubicBezierCurve3(v0, v1, v2, v3);
53495
+ const curveLength = curve.getLength();
53496
+ for (const result of this.results) {
53497
+ const resultMaterial = result.material;
53498
+ const resultGeometry = result.geometry;
53499
+ resultMaterial.blending = this.lightEmission > 0.5 ? AdditiveBlending : NormalBlending;
53500
+ const positions = resultGeometry.getAttribute("position");
53501
+ for (let i = 0; i < positions.count; i++) {
53502
+ const normSide = i < positions.count / 2 ? 0.5 : -0.5;
53503
+ const t = i % (positions.count / 2) / (positions.count / 2 - 1);
53504
+ const side = normSide * lerp(this.width0, this.width1, t);
53505
+ const prevT = specialClamp(t - 1e-3, 0, 1);
53506
+ const nextT = specialClamp(prevT + 1e-3, 0, 1);
53507
+ const prevPos = curve.getPoint(prevT);
53508
+ const nextPos = curve.getPoint(nextT);
53509
+ let finalMatrix = void 0;
53510
+ if (!this.faceCamera) {
53511
+ const vZ = new Vector3$1().subVectors(nextPos, prevPos).normalize();
53512
+ let vY = new Vector3$1(...lerpCFrame(this.cframe0, this.cframe1, t).upVector());
53513
+ const vX = new Vector3$1().crossVectors(vZ, vY);
53514
+ vY = new Vector3$1().crossVectors(vZ, vX);
53515
+ const rotation = new Matrix4().set(
53516
+ vX.x,
53517
+ vY.x,
53518
+ vZ.x,
53519
+ 0,
53520
+ vX.y,
53521
+ vY.y,
53522
+ vZ.y,
53523
+ 0,
53524
+ vX.z,
53525
+ vY.z,
53526
+ vZ.z,
53527
+ 0,
53528
+ 0,
53529
+ 0,
53530
+ 0,
53531
+ 1
53532
+ );
53533
+ finalMatrix = new Matrix4().makeTranslation(prevPos).multiply(rotation);
53534
+ } else {
53535
+ const vZ = new Vector3$1().subVectors(nextPos, prevPos).normalize();
53536
+ let vX = toCamera.clone().negate().normalize();
53537
+ const vY = new Vector3$1().crossVectors(vZ, vX).normalize();
53538
+ vX = new Vector3$1().crossVectors(vY, vZ).normalize();
53539
+ const rotation = new Matrix4().set(
53540
+ vX.x,
53541
+ vY.x,
53542
+ vZ.x,
53543
+ 0,
53544
+ vX.y,
53545
+ vY.y,
53546
+ vZ.y,
53547
+ 0,
53548
+ vX.z,
53549
+ vY.z,
53550
+ vZ.z,
53551
+ 0,
53552
+ 0,
53553
+ 0,
53554
+ 0,
53555
+ 1
53556
+ );
53557
+ finalMatrix = new Matrix4().makeTranslation(prevPos).multiply(rotation);
53558
+ }
53559
+ const lookCF = new CFrame().fromMatrix(finalMatrix.toArray());
53560
+ const sideCF = lookCF.multiply(new CFrame(0, side, 0));
53561
+ positions.setXYZ(i, ...sideCF.Position);
53562
+ }
53563
+ const colors = resultGeometry.getAttribute("color");
53564
+ for (let i = 0; i < colors.count; i++) {
53565
+ const t = i % (colors.count / 2) / (colors.count / 2 - 1);
53566
+ const colorValue = this.color.getValue(t);
53567
+ const transparencyValue = this.transparency.getValue(t, 0);
53568
+ const mult = 1 + this.lightEmission;
53569
+ colors.setXYZW(i, colorValue.R * mult, colorValue.G * mult, colorValue.B * mult, 1 - transparencyValue);
53570
+ }
53571
+ const uvs = resultGeometry.getAttribute("uv");
53572
+ if (this.textureMode === TextureMode.Stretch) {
53573
+ for (let i = 0; i < uvs.count; i++) {
53574
+ const t = i % (colors.count / 2) / (colors.count / 2 - 1);
53575
+ const normSide = i < positions.count / 2 ? 1 : 0;
53576
+ uvs.setXY(i, normSide, (1 - t + this.passedLength) * this.textureLength);
53577
+ }
53578
+ } else {
53579
+ for (let i = 0; i < uvs.count; i++) {
53580
+ const t = i % (colors.count / 2) / (colors.count / 2 - 1);
53581
+ const normSide = i < positions.count / 2 ? 1 : 0;
53582
+ uvs.setXY(i, normSide, (1 - t + this.passedLength / curveLength) * curveLength / this.textureLength);
53583
+ }
53584
+ }
53585
+ positions.needsUpdate = true;
53586
+ colors.needsUpdate = true;
53587
+ uvs.needsUpdate = true;
53588
+ const resultCF = new CFrame();
53589
+ resultCF.Position = multiply(toCamera.clone().negate().normalize().toArray(), [this.zOffset, this.zOffset, this.zOffset]);
53590
+ setTHREEObjectCF(result, resultCF);
53591
+ }
53592
+ this.lastTime = this.time;
53593
+ }
53594
+ dispose(_renderer, scene) {
53595
+ if (!this.results) return;
53596
+ for (const result of this.results) {
53597
+ scene.remove(result);
53598
+ }
53599
+ }
53600
+ }
53601
+ const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53602
+ __proto__: null,
53603
+ BeamDesc
53604
+ }, Symbol.toStringTag, { value: "Module" }));
52915
53605
  function disposeLight(scene, light) {
52916
53606
  if (light.shadow && light.shadow.map) {
52917
53607
  light.shadow.map.dispose();
@@ -53051,11 +53741,11 @@ class LightDesc extends RenderDesc {
53051
53741
  }
53052
53742
  }
53053
53743
  }
53054
- const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53744
+ const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53055
53745
  __proto__: null,
53056
53746
  LightDesc
53057
53747
  }, Symbol.toStringTag, { value: "Module" }));
53058
- const modules = /* @__PURE__ */ Object.assign({ "./attachmentDesc.ts": __vite_glob_0_0, "./emitterGroupDesc.ts": __vite_glob_0_1, "./lightDesc.ts": __vite_glob_0_2, "./objectDesc.ts": __vite_glob_0_3$1 });
53748
+ const modules = /* @__PURE__ */ Object.assign({ "./attachmentDesc.ts": __vite_glob_0_0, "./beamDesc.ts": __vite_glob_0_1, "./emitterGroupDesc.ts": __vite_glob_0_2, "./lightDesc.ts": __vite_glob_0_3, "./objectDesc.ts": __vite_glob_0_4$1 });
53059
53749
  function RegisterRenderDescs() {
53060
53750
  for (const module of Object.values(modules)) {
53061
53751
  for (const exprt of Object.values(module)) {
@@ -61344,6 +62034,7 @@ class RBXRenderer {
61344
62034
  plane.rotation.set(rad(-90), 0, 0);
61345
62035
  plane.position.set(0, 0, 0);
61346
62036
  plane.receiveShadow = false;
62037
+ plane.renderOrder = -3;
61347
62038
  renderScene.plane = plane;
61348
62039
  renderScene.scene.add(plane);
61349
62040
  }
@@ -62208,6 +62899,63 @@ function getAvatarCameraCFrame(character, applyEmote, isFallbackEmoteApplied, fi
62208
62899
  setupCamera(camera, cameraOptions);
62209
62900
  return camera;
62210
62901
  }
62902
+ function getCloseupCameraCFrame(character, newLighting = true) {
62903
+ const cameraOffsetX = 0;
62904
+ const cameraOffsetY = 0;
62905
+ const baseHatZoom = 30;
62906
+ const maxHatZoom = 100;
62907
+ const headAttachments = [];
62908
+ const head = character.FindFirstChild("Head");
62909
+ let headPos = new Vector3();
62910
+ let headCF = new CFrame();
62911
+ if (head) {
62912
+ headPos = head.Prop("Position");
62913
+ headCF = head.Prop("CFrame");
62914
+ for (const child of head.GetChildren()) {
62915
+ if (child.IsA("Attachment")) {
62916
+ headAttachments.push(child.Prop("Name"));
62917
+ }
62918
+ }
62919
+ }
62920
+ let maxDimension = 0;
62921
+ for (const child of character.GetChildren()) {
62922
+ if (child.IsA("Accessory")) {
62923
+ const handle = child.FindFirstChild("Handle");
62924
+ if (handle) {
62925
+ const handlePos = handle.Prop("Position");
62926
+ let hasHeadAttachment = false;
62927
+ for (const att of handle.GetChildren()) {
62928
+ if (att.IsA("Attachment") && headAttachments.includes(att.Prop("Name"))) {
62929
+ hasHeadAttachment = true;
62930
+ break;
62931
+ }
62932
+ }
62933
+ if (hasHeadAttachment) {
62934
+ const size = handle.Prop("Size").divide(new Vector3(2, 2, 2)).add(handlePos).minus(headPos);
62935
+ size.Z = 0;
62936
+ if (size.magnitude() > maxDimension) {
62937
+ maxDimension = size.magnitude();
62938
+ }
62939
+ }
62940
+ }
62941
+ }
62942
+ }
62943
+ const maxHatOffset = 0.5;
62944
+ maxDimension = Math.min(1, maxDimension / 3);
62945
+ maxDimension *= maxDimension;
62946
+ const viewOffset = headCF.multiply(new CFrame(cameraOffsetX, cameraOffsetY + maxHatOffset * maxDimension, 0.1));
62947
+ let yAngle = -Math.PI / 16;
62948
+ if (newLighting) {
62949
+ yAngle = 0;
62950
+ }
62951
+ const positionOffset = headCF.clone();
62952
+ const toAdd = multiply(normalize(CFrame.Angles(0, yAngle, 0).lookVector()), [3, 3, 3]);
62953
+ positionOffset.Position = add(positionOffset.Position, toAdd);
62954
+ const camera = createThumbnailCamera();
62955
+ camera.setProperty("CFrame", CFrame.lookAt(positionOffset.Position, viewOffset.Position));
62956
+ camera.setProperty("FieldOfView", baseHatZoom + (maxHatZoom - baseHatZoom) * maxDimension);
62957
+ return camera;
62958
+ }
62211
62959
  function getCorners(cframe, size) {
62212
62960
  const halfX = size.X / 2;
62213
62961
  const halfY = size.Y / 2;
@@ -62273,7 +63021,7 @@ function getExtents(cframe, parts) {
62273
63021
  function getExtentsWorld(rig) {
62274
63022
  const rigParts = [];
62275
63023
  for (const child of rig.GetDescendants()) {
62276
- if (child.createWrapper()?.IsA("BasePart")) {
63024
+ if (child.createWrapper()?.IsA("BasePart") && !(child.Prop("Name") === "HumanoidRootPart")) {
62277
63025
  rigParts.push(child);
62278
63026
  }
62279
63027
  }
@@ -62335,6 +63083,13 @@ function getCameraCFrameForHeadshotCustomized(rig, fov2, yRot, distance2) {
62335
63083
  return cameraCF;
62336
63084
  }
62337
63085
  }
63086
+ function getCameraCFrameForHeadshotNonCustomized(rig, newLighting = true) {
63087
+ const camera = getCloseupCameraCFrame(rig, newLighting);
63088
+ const cameraCF = camera.Prop("CFrame");
63089
+ const cameraFOV = camera.Prop("FieldOfView");
63090
+ camera.Destroy();
63091
+ return { cframe: cameraCF, fov: cameraFOV };
63092
+ }
62338
63093
  function getCameraCFrameForAvatarCustomized(rig, fov2, yRot) {
62339
63094
  const camera = getAvatarCameraCFrame(rig, void 0, void 0, fov2, {
62340
63095
  optCameraYRot: yRot,
@@ -62387,6 +63142,8 @@ class BackgroundRenderer {
62387
63142
  affectSceneLighting = true;
62388
63143
  cameraAffectsTransparency = true;
62389
63144
  cameraAffectsRotation = false;
63145
+ forceImage;
63146
+ forceColor;
62390
63147
  lastFrameTime = Date.now() / 1e3;
62391
63148
  animationInterval;
62392
63149
  animationFPS = 60;
@@ -62500,35 +63257,42 @@ class BackgroundRenderer {
62500
63257
  RBXRenderer.shadowPlane.position.set(0, -0.01, 0);
62501
63258
  }
62502
63259
  }
62503
- if (this.avatarCyclorama && this.backgroundData) {
63260
+ if (this.avatarCyclorama && (this.backgroundData || this.forceImage && this.forceColor)) {
62504
63261
  const cameraDirTransparency = specialClamp((dot(RBXRenderer.getCameraCFrame(this.renderScene).lookVector(), [0, 0, -1]) + 0.5) * 2, 0, 1);
62505
63262
  const targetTransparency = this.cameraAffectsTransparency ? cameraDirTransparency : 0;
62506
63263
  const cyclorama = this.avatarCyclorama;
62507
63264
  const backgroundData = this.backgroundData;
62508
63265
  cyclorama.Child("color_mesh").setProperty("Transparency", targetTransparency);
62509
63266
  cyclorama.Child("texture_mesh").setProperty("Transparency", Math.max(0.05, targetTransparency));
63267
+ let color2 = void 0;
63268
+ let imageUrl = void 0;
62510
63269
  if (backgroundData) {
62511
63270
  const colorValue = backgroundData.Child("Color");
62512
63271
  const imageIdValue = backgroundData.Child("ImageId");
62513
63272
  if (colorValue && imageIdValue) {
62514
- const color2 = colorValue.Prop("Value");
63273
+ color2 = colorValue.Prop("Value");
62515
63274
  const imageId = imageIdValue.Prop("Value");
62516
- cyclorama.Child("color_mesh").setProperty("Color", color2.toColor3uint8());
62517
- cyclorama.Child("texture_mesh").setProperty("TextureID", `rbxassetid://${imageId}`);
62518
- if (this.affectSceneLighting) {
62519
- this.ambientLight.color = new Color().setRGB(...color2.toArray(), SRGBColorSpace);
62520
- this.ambientLight.intensity = 1 * (1 - targetTransparency);
62521
- this.renderScene.scene.add(this.ambientLight);
62522
- } else {
62523
- this.renderScene.scene.remove(this.ambientLight);
62524
- }
63275
+ imageUrl = `rbxassetid://${imageId}`;
63276
+ }
63277
+ }
63278
+ color2 = this.forceColor || color2;
63279
+ imageUrl = this.forceImage || imageUrl;
63280
+ if (color2 && imageUrl) {
63281
+ cyclorama.Child("color_mesh").setProperty("Color", color2.toColor3uint8());
63282
+ cyclorama.Child("texture_mesh").setProperty("TextureID", imageUrl);
63283
+ if (this.affectSceneLighting) {
63284
+ this.ambientLight.color = new Color().setRGB(...color2.toArray(), SRGBColorSpace);
63285
+ this.ambientLight.intensity = 1 * (1 - targetTransparency);
63286
+ this.renderScene.scene.add(this.ambientLight);
63287
+ } else {
63288
+ this.renderScene.scene.remove(this.ambientLight);
62525
63289
  }
63290
+ cyclorama.preRender();
63291
+ RBXRenderer.addInstance(cyclorama, this.auth, this.renderScene);
62526
63292
  } else {
62527
63293
  cyclorama.Child("color_mesh").setProperty("Transparency", 1);
62528
63294
  cyclorama.Child("texture_mesh").setProperty("Transparency", 1);
62529
63295
  }
62530
- cyclorama.preRender();
62531
- RBXRenderer.addInstance(cyclorama, this.auth, this.renderScene);
62532
63296
  const colorDesc = this.renderScene.renderDescs.get(cyclorama.Child("color_mesh"));
62533
63297
  const textureDesc = this.renderScene.renderDescs.get(cyclorama.Child("texture_mesh"));
62534
63298
  if (colorDesc && colorDesc.results && colorDesc.results[0]) {
@@ -63447,6 +64211,7 @@ export {
63447
64211
  SpecialInfo,
63448
64212
  SpecialLayeredAssetTypes,
63449
64213
  StringBufferProperties,
64214
+ TextureMode,
63450
64215
  ThumbnailCustomization,
63451
64216
  ToRemoveBeforeBundleType,
63452
64217
  ToolWrapper,
@@ -63515,7 +64280,9 @@ export {
63515
64280
  getCameraCFrameForAvatarCustomized,
63516
64281
  getCameraCFrameForAvatarNonCustomized,
63517
64282
  getCameraCFrameForHeadshotCustomized,
64283
+ getCameraCFrameForHeadshotNonCustomized,
63518
64284
  getCharacterTorsoCFrame,
64285
+ getCloseupCameraCFrame,
63519
64286
  getDistIndexArray,
63520
64287
  getExtents,
63521
64288
  getExtentsCenter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.7.4",
3
+ "version": "1.8.1",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",