roavatar-renderer 1.7.4 → 1.8.0

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
  /**
@@ -4011,6 +4028,13 @@ export declare const SpecialLayeredAssetTypes: string[];
4011
4028
 
4012
4029
  export declare const StringBufferProperties: string[];
4013
4030
 
4031
+ /**@category DataModelEnum */
4032
+ export declare const TextureMode: {
4033
+ Stretch: number;
4034
+ Wrap: number;
4035
+ Static: number;
4036
+ };
4037
+
4014
4038
  declare type ThreePoseCorrective = Vec3;
4015
4039
 
4016
4040
  /**
@@ -4129,7 +4153,7 @@ export declare class UDim2 {
4129
4153
  clone(): UDim2;
4130
4154
  }
4131
4155
 
4132
- declare type UserInfo = {
4156
+ export declare type UserInfo = {
4133
4157
  id: number;
4134
4158
  name: string;
4135
4159
  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);
@@ -48214,7 +48667,7 @@ class ObjectDesc extends RenderDesc {
48214
48667
  return !isBakedDecal && (!isDecal || isFirstDecal);
48215
48668
  }
48216
48669
  }
48217
- const __vite_glob_0_3$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48670
+ const __vite_glob_0_4$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48218
48671
  __proto__: null,
48219
48672
  MeshPartTypes,
48220
48673
  ObjectDesc,
@@ -49595,7 +50048,7 @@ class AnimatorWrapper extends InstanceWrapper {
49595
50048
  return false;
49596
50049
  }
49597
50050
  }
49598
- const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
50051
+ const __vite_glob_0_3$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49599
50052
  __proto__: null,
49600
50053
  AnimatorWrapper
49601
50054
  }, Symbol.toStringTag, { value: "Module" }));
@@ -51737,7 +52190,11 @@ class Particle {
51737
52190
  }
51738
52191
  if (isNext) offset += 1;
51739
52192
  if (offset >= total) {
51740
- offset %= total;
52193
+ if (mode !== ParticleFlipbookMode.OneShot) {
52194
+ offset %= total;
52195
+ } else {
52196
+ offset = total - 1;
52197
+ }
51741
52198
  }
51742
52199
  return offset;
51743
52200
  }
@@ -51849,21 +52306,6 @@ class EmitterDesc extends DisposableDesc {
51849
52306
  this.disposeRenderLists(renderer);
51850
52307
  }
51851
52308
  }
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
52309
  getFlipbookSize() {
51868
52310
  let flipbookSizeX = this.flipbookSizeX;
51869
52311
  let flipbookSizeY = this.flipbookSizeY;
@@ -51892,9 +52334,9 @@ class EmitterDesc extends DisposableDesc {
51892
52334
  async compileResult(renderer, scene) {
51893
52335
  const originalResult = this.result;
51894
52336
  const texturePromises = [
51895
- this.getTexture(this.texture),
51896
- this.getTexture(this.alphaTexture, NoColorSpace),
51897
- this.getTexture(this.colorTexture)
52337
+ getTexture(this.texture),
52338
+ getTexture(this.alphaTexture, NoColorSpace),
52339
+ getTexture(this.colorTexture)
51898
52340
  ];
51899
52341
  let [mapToUse, alphaMapToUse, colorMapToUse] = await Promise.all(texturePromises);
51900
52342
  if (!mapToUse) {
@@ -52390,7 +52832,7 @@ class EmitterGroupDesc extends RenderDesc {
52390
52832
  this.lastCframe = this.cframe.clone();
52391
52833
  }
52392
52834
  }
52393
- const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52835
+ const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52394
52836
  __proto__: null,
52395
52837
  EmitterGroupDesc
52396
52838
  }, Symbol.toStringTag, { value: "Module" }));
@@ -52850,7 +53292,7 @@ const __vite_glob_0_27 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
52850
53292
  __proto__: null,
52851
53293
  WeldWrapper
52852
53294
  }, 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 });
53295
+ 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
53296
  function RegisterWrappers() {
52855
53297
  for (const module of Object.values(modules$1)) {
52856
53298
  for (const exprt of Object.values(module)) {
@@ -52912,6 +53354,249 @@ const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
52912
53354
  __proto__: null,
52913
53355
  AttachmentDesc
52914
53356
  }, Symbol.toStringTag, { value: "Module" }));
53357
+ class BeamDesc extends RenderDesc {
53358
+ static classTypes = ["Beam"];
53359
+ lastTime = Date.now() / 1e3;
53360
+ time = Date.now() / 1e3;
53361
+ passedLength = 0;
53362
+ enabled = true;
53363
+ lightEmission = 0;
53364
+ //blends between normal -> additive blending, how?? graphics magic
53365
+ lightInfluence = 1;
53366
+ texture;
53367
+ textureLength = 1;
53368
+ textureMode = TextureMode.Stretch;
53369
+ //static behaves identically to wrap
53370
+ textureSpeed = 1;
53371
+ color = ColorSequence.fromColor(new Color3(1, 1, 1));
53372
+ transparency = new NumberSequence([new NumberSequenceKeypoint(0, 0.5), new NumberSequenceKeypoint(1, 0.5)]);
53373
+ zOffset = 0;
53374
+ //this moves its world position based on camera direction
53375
+ cframe0 = new CFrame();
53376
+ cframe1 = new CFrame();
53377
+ curveSize0 = 0;
53378
+ curveSize1 = 1;
53379
+ width0 = 1;
53380
+ width1 = 1;
53381
+ faceCamera = false;
53382
+ segments = 10;
53383
+ //results
53384
+ results = [];
53385
+ isSame(newDesc) {
53386
+ 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;
53387
+ }
53388
+ needsRegeneration(newDesc) {
53389
+ return this.enabled !== newDesc.enabled || this.texture !== newDesc.texture || this.segments !== newDesc.segments;
53390
+ }
53391
+ virtualFromRenderDesc(newDesc) {
53392
+ this.time = newDesc.time;
53393
+ this.lightEmission = newDesc.lightEmission;
53394
+ this.lightInfluence = newDesc.lightInfluence;
53395
+ this.textureLength = newDesc.textureLength;
53396
+ this.textureMode = newDesc.textureMode;
53397
+ this.textureSpeed = newDesc.textureSpeed;
53398
+ this.color = newDesc.color.clone();
53399
+ this.transparency = newDesc.transparency.clone();
53400
+ this.zOffset = newDesc.zOffset;
53401
+ this.cframe0 = newDesc.cframe0.clone();
53402
+ this.cframe1 = newDesc.cframe1.clone();
53403
+ this.curveSize0 = newDesc.curveSize0;
53404
+ this.curveSize1 = newDesc.curveSize1;
53405
+ this.width0 = newDesc.width0;
53406
+ this.width1 = newDesc.width1;
53407
+ this.faceCamera = newDesc.faceCamera;
53408
+ }
53409
+ virtualTransferFrom(oldDesc) {
53410
+ this.passedLength = oldDesc.passedLength;
53411
+ }
53412
+ fromInstance(child) {
53413
+ this.enabled = child.PropOrDefault("Enabled", this.enabled);
53414
+ this.lightEmission = child.PropOrDefault("LightEmission", this.lightEmission);
53415
+ this.lightInfluence = child.PropOrDefault("LightInfluence", this.lightInfluence);
53416
+ this.texture = child.PropOrDefault("Texture", this.texture);
53417
+ if (!this.texture) {
53418
+ const textureContent = child.PropOrDefault("TextureContent", void 0);
53419
+ if (textureContent) {
53420
+ this.texture = textureContent.uri;
53421
+ }
53422
+ }
53423
+ this.textureLength = child.PropOrDefault("TextureLength", this.textureLength);
53424
+ this.textureMode = child.PropOrDefault("TextureMode", this.textureMode);
53425
+ this.textureSpeed = child.PropOrDefault("TextureSpeed", this.textureSpeed);
53426
+ this.color = child.PropOrDefault("Color", this.color);
53427
+ this.transparency = child.PropOrDefault("Transparency", this.transparency);
53428
+ this.zOffset = child.PropOrDefault("ZOffset", this.zOffset);
53429
+ const att0 = child.PropOrDefault("Attachment0", void 0);
53430
+ if (att0 && att0.IsA("Attachment")) {
53431
+ const att0W = att0.w;
53432
+ this.cframe0 = att0W.getWorldCFrame();
53433
+ }
53434
+ const att1 = child.PropOrDefault("Attachment1", void 0);
53435
+ if (att1 && att1.IsA("Attachment")) {
53436
+ const att1W = att1.w;
53437
+ this.cframe1 = att1W.getWorldCFrame();
53438
+ }
53439
+ this.curveSize0 = child.PropOrDefault("CurveSize0", this.curveSize0);
53440
+ this.curveSize1 = child.PropOrDefault("CurveSize1", this.curveSize1);
53441
+ this.width0 = child.PropOrDefault("Width0", this.width0);
53442
+ this.width1 = child.PropOrDefault("Width1", this.width1);
53443
+ this.faceCamera = child.PropOrDefault("FaceCamera", this.faceCamera);
53444
+ this.segments = child.PropOrDefault("Segments", this.segments);
53445
+ if (!FLAGS.BEAMS_ENABLED) this.enabled = false;
53446
+ }
53447
+ async compileResults(renderer, scene) {
53448
+ const originalResults = this.results;
53449
+ this.results = [];
53450
+ if (this.enabled) {
53451
+ let textureResult = void 0;
53452
+ if (this.texture) {
53453
+ textureResult = await getTexture(this.texture);
53454
+ if (textureResult) {
53455
+ textureResult.wrapT = RepeatWrapping;
53456
+ }
53457
+ }
53458
+ const material = new MeshBasicMaterial({
53459
+ side: DoubleSide,
53460
+ map: textureResult,
53461
+ vertexColors: true,
53462
+ transparent: true,
53463
+ depthWrite: false
53464
+ });
53465
+ const geometry = new PlaneGeometry(1, 1, this.segments, 1);
53466
+ const colorValues = new Float32Array((this.segments + 1) * 2 * 4).fill(1);
53467
+ geometry.setAttribute("color", new BufferAttribute(colorValues, 4));
53468
+ const mesh = new Mesh(geometry, material);
53469
+ mesh.name = this.instance ? this.instance.PropOrDefault("Name", "Unknown") + "_Beam" : "Unknown_Beam";
53470
+ this.results.push(mesh);
53471
+ }
53472
+ if (originalResults) {
53473
+ this.disposeMeshes(scene, originalResults);
53474
+ this.disposeRenderLists(renderer);
53475
+ }
53476
+ this.updateResults();
53477
+ return this.results;
53478
+ }
53479
+ updateResults() {
53480
+ if (!this.results) return;
53481
+ const deltaTime = this.time - this.lastTime;
53482
+ this.passedLength += deltaTime * this.textureSpeed;
53483
+ const camera = this.renderScene.camera;
53484
+ const toCamera = new Vector3$1(0, 0, -1).applyQuaternion(camera.quaternion);
53485
+ const v0 = new Vector3$1(...this.cframe0.Position);
53486
+ const v1 = new Vector3$1(...this.cframe0.multiply(new CFrame(this.curveSize0, 0, 0)).Position);
53487
+ const v2 = new Vector3$1(...this.cframe1.multiply(new CFrame(-this.curveSize1, 0, 0)).Position);
53488
+ const v3 = new Vector3$1(...this.cframe1.Position);
53489
+ const curve = new CubicBezierCurve3(v0, v1, v2, v3);
53490
+ const curveLength = curve.getLength();
53491
+ for (const result of this.results) {
53492
+ const resultMaterial = result.material;
53493
+ const resultGeometry = result.geometry;
53494
+ resultMaterial.blending = this.lightEmission > 0.5 ? AdditiveBlending : NormalBlending;
53495
+ const positions = resultGeometry.getAttribute("position");
53496
+ for (let i = 0; i < positions.count; i++) {
53497
+ const normSide = i < positions.count / 2 ? 0.5 : -0.5;
53498
+ const t = i % (positions.count / 2) / (positions.count / 2 - 1);
53499
+ const side = normSide * lerp(this.width0, this.width1, t);
53500
+ const prevT = specialClamp(t - 1e-3, 0, 1);
53501
+ const nextT = specialClamp(prevT + 1e-3, 0, 1);
53502
+ const prevPos = curve.getPoint(prevT);
53503
+ const nextPos = curve.getPoint(nextT);
53504
+ let finalMatrix = void 0;
53505
+ if (!this.faceCamera) {
53506
+ const vZ = new Vector3$1().subVectors(nextPos, prevPos).normalize();
53507
+ let vY = new Vector3$1(...lerpCFrame(this.cframe0, this.cframe1, t).upVector());
53508
+ const vX = new Vector3$1().crossVectors(vZ, vY);
53509
+ vY = new Vector3$1().crossVectors(vZ, vX);
53510
+ const rotation = new Matrix4().set(
53511
+ vX.x,
53512
+ vY.x,
53513
+ vZ.x,
53514
+ 0,
53515
+ vX.y,
53516
+ vY.y,
53517
+ vZ.y,
53518
+ 0,
53519
+ vX.z,
53520
+ vY.z,
53521
+ vZ.z,
53522
+ 0,
53523
+ 0,
53524
+ 0,
53525
+ 0,
53526
+ 1
53527
+ );
53528
+ finalMatrix = new Matrix4().makeTranslation(prevPos).multiply(rotation);
53529
+ } else {
53530
+ const vZ = new Vector3$1().subVectors(nextPos, prevPos).normalize();
53531
+ let vX = toCamera.clone().negate().normalize();
53532
+ const vY = new Vector3$1().crossVectors(vZ, vX).normalize();
53533
+ vX = new Vector3$1().crossVectors(vY, vZ).normalize();
53534
+ const rotation = new Matrix4().set(
53535
+ vX.x,
53536
+ vY.x,
53537
+ vZ.x,
53538
+ 0,
53539
+ vX.y,
53540
+ vY.y,
53541
+ vZ.y,
53542
+ 0,
53543
+ vX.z,
53544
+ vY.z,
53545
+ vZ.z,
53546
+ 0,
53547
+ 0,
53548
+ 0,
53549
+ 0,
53550
+ 1
53551
+ );
53552
+ finalMatrix = new Matrix4().makeTranslation(prevPos).multiply(rotation);
53553
+ }
53554
+ const lookCF = new CFrame().fromMatrix(finalMatrix.toArray());
53555
+ const sideCF = lookCF.multiply(new CFrame(0, side, 0));
53556
+ positions.setXYZ(i, ...sideCF.Position);
53557
+ }
53558
+ const colors = resultGeometry.getAttribute("color");
53559
+ for (let i = 0; i < colors.count; i++) {
53560
+ const t = i % (colors.count / 2) / (colors.count / 2 - 1);
53561
+ const colorValue = this.color.getValue(t);
53562
+ const transparencyValue = this.transparency.getValue(t, 0);
53563
+ const mult = 1 + this.lightEmission;
53564
+ colors.setXYZW(i, colorValue.R * mult, colorValue.G * mult, colorValue.B * mult, 1 - transparencyValue);
53565
+ }
53566
+ const uvs = resultGeometry.getAttribute("uv");
53567
+ if (this.textureMode === TextureMode.Stretch) {
53568
+ for (let i = 0; i < uvs.count; i++) {
53569
+ const t = i % (colors.count / 2) / (colors.count / 2 - 1);
53570
+ const normSide = i < positions.count / 2 ? 1 : 0;
53571
+ uvs.setXY(i, normSide, (1 - t + this.passedLength) * this.textureLength);
53572
+ }
53573
+ } else {
53574
+ for (let i = 0; i < uvs.count; i++) {
53575
+ const t = i % (colors.count / 2) / (colors.count / 2 - 1);
53576
+ const normSide = i < positions.count / 2 ? 1 : 0;
53577
+ uvs.setXY(i, normSide, (1 - t + this.passedLength / curveLength) * curveLength / this.textureLength);
53578
+ }
53579
+ }
53580
+ positions.needsUpdate = true;
53581
+ colors.needsUpdate = true;
53582
+ uvs.needsUpdate = true;
53583
+ const resultCF = new CFrame();
53584
+ resultCF.Position = multiply(toCamera.clone().negate().normalize().toArray(), [this.zOffset, this.zOffset, this.zOffset]);
53585
+ setTHREEObjectCF(result, resultCF);
53586
+ }
53587
+ this.lastTime = this.time;
53588
+ }
53589
+ dispose(_renderer, scene) {
53590
+ if (!this.results) return;
53591
+ for (const result of this.results) {
53592
+ scene.remove(result);
53593
+ }
53594
+ }
53595
+ }
53596
+ const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53597
+ __proto__: null,
53598
+ BeamDesc
53599
+ }, Symbol.toStringTag, { value: "Module" }));
52915
53600
  function disposeLight(scene, light) {
52916
53601
  if (light.shadow && light.shadow.map) {
52917
53602
  light.shadow.map.dispose();
@@ -53051,11 +53736,11 @@ class LightDesc extends RenderDesc {
53051
53736
  }
53052
53737
  }
53053
53738
  }
53054
- const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53739
+ const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53055
53740
  __proto__: null,
53056
53741
  LightDesc
53057
53742
  }, 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 });
53743
+ 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
53744
  function RegisterRenderDescs() {
53060
53745
  for (const module of Object.values(modules)) {
53061
53746
  for (const exprt of Object.values(module)) {
@@ -61344,6 +62029,7 @@ class RBXRenderer {
61344
62029
  plane.rotation.set(rad(-90), 0, 0);
61345
62030
  plane.position.set(0, 0, 0);
61346
62031
  plane.receiveShadow = false;
62032
+ plane.renderOrder = -3;
61347
62033
  renderScene.plane = plane;
61348
62034
  renderScene.scene.add(plane);
61349
62035
  }
@@ -62387,6 +63073,8 @@ class BackgroundRenderer {
62387
63073
  affectSceneLighting = true;
62388
63074
  cameraAffectsTransparency = true;
62389
63075
  cameraAffectsRotation = false;
63076
+ forceImage;
63077
+ forceColor;
62390
63078
  lastFrameTime = Date.now() / 1e3;
62391
63079
  animationInterval;
62392
63080
  animationFPS = 60;
@@ -62500,35 +63188,42 @@ class BackgroundRenderer {
62500
63188
  RBXRenderer.shadowPlane.position.set(0, -0.01, 0);
62501
63189
  }
62502
63190
  }
62503
- if (this.avatarCyclorama && this.backgroundData) {
63191
+ if (this.avatarCyclorama && (this.backgroundData || this.forceImage && this.forceColor)) {
62504
63192
  const cameraDirTransparency = specialClamp((dot(RBXRenderer.getCameraCFrame(this.renderScene).lookVector(), [0, 0, -1]) + 0.5) * 2, 0, 1);
62505
63193
  const targetTransparency = this.cameraAffectsTransparency ? cameraDirTransparency : 0;
62506
63194
  const cyclorama = this.avatarCyclorama;
62507
63195
  const backgroundData = this.backgroundData;
62508
63196
  cyclorama.Child("color_mesh").setProperty("Transparency", targetTransparency);
62509
63197
  cyclorama.Child("texture_mesh").setProperty("Transparency", Math.max(0.05, targetTransparency));
63198
+ let color2 = void 0;
63199
+ let imageUrl = void 0;
62510
63200
  if (backgroundData) {
62511
63201
  const colorValue = backgroundData.Child("Color");
62512
63202
  const imageIdValue = backgroundData.Child("ImageId");
62513
63203
  if (colorValue && imageIdValue) {
62514
- const color2 = colorValue.Prop("Value");
63204
+ color2 = colorValue.Prop("Value");
62515
63205
  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
- }
63206
+ imageUrl = `rbxassetid://${imageId}`;
63207
+ }
63208
+ }
63209
+ color2 = this.forceColor || color2;
63210
+ imageUrl = this.forceImage || imageUrl;
63211
+ if (color2 && imageUrl) {
63212
+ cyclorama.Child("color_mesh").setProperty("Color", color2.toColor3uint8());
63213
+ cyclorama.Child("texture_mesh").setProperty("TextureID", imageUrl);
63214
+ if (this.affectSceneLighting) {
63215
+ this.ambientLight.color = new Color().setRGB(...color2.toArray(), SRGBColorSpace);
63216
+ this.ambientLight.intensity = 1 * (1 - targetTransparency);
63217
+ this.renderScene.scene.add(this.ambientLight);
63218
+ } else {
63219
+ this.renderScene.scene.remove(this.ambientLight);
62525
63220
  }
63221
+ cyclorama.preRender();
63222
+ RBXRenderer.addInstance(cyclorama, this.auth, this.renderScene);
62526
63223
  } else {
62527
63224
  cyclorama.Child("color_mesh").setProperty("Transparency", 1);
62528
63225
  cyclorama.Child("texture_mesh").setProperty("Transparency", 1);
62529
63226
  }
62530
- cyclorama.preRender();
62531
- RBXRenderer.addInstance(cyclorama, this.auth, this.renderScene);
62532
63227
  const colorDesc = this.renderScene.renderDescs.get(cyclorama.Child("color_mesh"));
62533
63228
  const textureDesc = this.renderScene.renderDescs.get(cyclorama.Child("texture_mesh"));
62534
63229
  if (colorDesc && colorDesc.results && colorDesc.results[0]) {
@@ -63447,6 +64142,7 @@ export {
63447
64142
  SpecialInfo,
63448
64143
  SpecialLayeredAssetTypes,
63449
64144
  StringBufferProperties,
64145
+ TextureMode,
63450
64146
  ThumbnailCustomization,
63451
64147
  ToRemoveBeforeBundleType,
63452
64148
  ToolWrapper,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.7.4",
3
+ "version": "1.8.0",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",