This commit is contained in:
Bill 2024-04-09 19:28:10 -04:00
parent 1df42159a7
commit be80b2aa55
9 changed files with 117 additions and 693 deletions

View File

@ -117,9 +117,9 @@ export class AvatarStructure
this._animationManager.registerAnimation(this, data);
}
public getPartColor(k: IAvatarFigureContainer, _arg_2: string, _arg_3: number = 0): IPartColor
public getPartColor(container: IAvatarFigureContainer, _arg_2: string, _arg_3: number = 0): IPartColor
{
const _local_4 = k.getPartColorIds(_arg_2);
const _local_4 = container.getPartColorIds(_arg_2);
if((!(_local_4)) || (_local_4.length < _arg_3)) return null;

View File

@ -88,49 +88,54 @@ export class AvatarDataContainer implements IAvatarDataContainer
private generatePaletteMapForGrayscale(background: number, foreground: number): Map<string, number[]>
{
const alphaBackground = ((background >> 24) & 0xFF);
const redBackground = ((background >> 16) & 0xFF);
const greenBackground = ((background >> 8) & 0xFF);
const blueBackground = ((background >> 0) & 0xFF);
const alphaForeground = ((foreground >> 24) & 0xFF);
const redForeground = ((foreground >> 16) & 0xFF);
const greenForeground = ((foreground >> 8) & 0xFF);
const blueForeground = ((foreground >> 0) & 0xFF);
const alphaDifference = ((alphaForeground - alphaBackground) / 0xFF);
const redDifference = ((redForeground - redBackground) / 0xFF);
const greenDifference = ((greenForeground - greenBackground) / 0xFF);
const blueDifference = ((blueForeground - blueBackground) / 0xFF);
const _local_15: Map<string, number[]> = new Map();
const _local_16: number[] = [];
const _local_17: number[] = [];
const _local_18: number[] = [];
const _local_19: number[] = [];
let _local_20 = alphaBackground;
let _local_21 = redBackground;
let _local_22 = greenBackground;
let _local_23 = blueBackground;
const alphaBackground = (background >> 24) & 0xFF;
const redBackground = (background >> 16) & 0xFF;
const greenBackground = (background >> 8) & 0xFF;
const blueBackground = background & 0xFF;
const alphaForeground = (foreground >> 24) & 0xFF;
const redForeground = (foreground >> 16) & 0xFF;
const greenForeground = (foreground >> 8) & 0xFF;
const blueForeground = foreground & 0xFF;
const alphaStep = (alphaForeground - alphaBackground) / 255;
const redStep = (redForeground - redBackground) / 255;
const greenStep = (greenForeground - greenBackground) / 255;
const blueStep = (blueForeground - blueBackground) / 255;
const paletteMap: Map<string, number[]> = new Map();
const gradientColors: number[] = [];
let currentAlpha = alphaBackground;
let currentRed = redBackground;
let currentGreen = greenBackground;
let currentBlue = blueBackground;
for(let i = 0; i < 256; i++)
{
if((((_local_21 == redBackground) && (_local_22 == greenBackground)) && (_local_23 == blueBackground)))
{
_local_20 = 0;
}
_local_20 = (_local_20 + alphaDifference);
_local_21 = (_local_21 + redDifference);
_local_22 = (_local_22 + greenDifference);
_local_23 = (_local_23 + blueDifference);
_local_19.push((_local_20 << 24));
_local_16.push(((((_local_20 << 24) | (_local_21 << 16)) | (_local_22 << 8)) | _local_23));
_local_17.push(((((_local_20 << 24) | (_local_21 << 16)) | (_local_22 << 8)) | _local_23));
_local_18.push(((((_local_20 << 24) | (_local_21 << 16)) | (_local_22 << 8)) | _local_23));
// Update the current colors by their respective steps
currentAlpha += alphaStep;
currentRed += redStep;
currentGreen += greenStep;
currentBlue += blueStep;
// Clamp the color values between 0 and 255 to ensure valid color values
const clampedAlpha = Math.max(0, Math.min(255, Math.round(currentAlpha)));
const clampedRed = Math.max(0, Math.min(255, Math.round(currentRed)));
const clampedGreen = Math.max(0, Math.min(255, Math.round(currentGreen)));
const clampedBlue = Math.max(0, Math.min(255, Math.round(currentBlue)));
// Combine the color components back into a single integer
const color = (clampedAlpha << 24) | (clampedRed << 16) | (clampedGreen << 8) | clampedBlue;
gradientColors.push(color);
}
_local_15.set('alphas', _local_16);
_local_15.set('reds', _local_16);
_local_15.set('greens', _local_17);
_local_15.set('blues', _local_18);
// Since the gradients for all color channels are the same, we use the same array
paletteMap.set('alphas', gradientColors);
paletteMap.set('reds', gradientColors);
paletteMap.set('greens', gradientColors);
paletteMap.set('blues', gradientColors);
return _local_15;
return paletteMap;
}
}

View File

@ -85,12 +85,8 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
const display = new Container();
display.isRenderGroup = true;
display.cullableChildren = false;
display.interactive = false;
display.interactiveChildren = false;
this._master.addChild(display);
this._display = display;

View File

@ -1,453 +0,0 @@
import { IPlaneDrawingData, IPlaneVisualization, IRoomObjectSpriteVisualization, IRoomPlane, IRoomRenderingCanvas, RoomObjectCategory, RoomObjectSpriteData } from '@nitrots/api';
import { GetStage, Vector3d } from '@nitrots/utils';
import { Point, Rectangle } from 'pixi.js';
import { RoomEngine } from '../RoomEngine';
import { PlaneDrawingData } from '../object';
export class SpriteDataCollector
{
private static MANNEQUIN_MAGIC_X_OFFSET: number = 1;
private static MANNEQUIN_MAGIC_Y_OFFSET: number = -16;
private static AVATAR_WATER_EFFECT_MAGIC_Y_OFFSET: number = -52;
private static MAX_EXTERNAL_IMAGE_COUNT: number = 30;
private maxZ: number;
private spriteCount: number = 0;
private externalImageCount: number = 0;
private static addMannequinSprites(k: RoomObjectSpriteData[], _arg_2: RoomEngine): RoomObjectSpriteData[]
{
const datas: RoomObjectSpriteData[] = [];
for(const data of k)
{
if(!data) continue;
if((data.type === 'boutique_mannequin1') && (data.name.indexOf('mannequin_') === 0))
{
const roomObject = _arg_2.getRoomObject(_arg_2.activeRoomId, data.objectId, RoomObjectCategory.FLOOR);
if(roomObject)
{
const spriteList = (roomObject.visualization as IRoomObjectSpriteVisualization).getSpriteList();
if(spriteList)
{
for(const sprite of spriteList)
{
sprite.x = (sprite.x + ((data.x + (data.width / 2)) + SpriteDataCollector.MANNEQUIN_MAGIC_X_OFFSET));
sprite.y = (sprite.y + ((data.y + data.height) + SpriteDataCollector.MANNEQUIN_MAGIC_Y_OFFSET));
sprite.z = (sprite.z + data.z);
datas.push(sprite);
}
}
}
}
else
{
datas.push(data);
}
}
return datas;
}
private static sortSpriteDataObjects(k: RoomObjectSpriteData, _arg_2: RoomObjectSpriteData): number
{
if(k.z < _arg_2.z) return 1;
if(k.z > _arg_2.z) return -1;
return -1;
}
private static isSpriteInViewPort(k: RoomObjectSpriteData, _arg_2: Rectangle, _arg_3: IRoomRenderingCanvas): boolean
{
return true;
// var _local_4 = new Rectangle((k.x + _arg_3.screenOffsetX), (k.y + _arg_3.screenOffsetY), k.width, k.height);
// // intersects
// return _local_4.contains(_arg_2.x, _arg_2.y);
}
private static sortQuadPoints(k: Point, _arg_2: Point, _arg_3: Point, _arg_4: Point): Point[]
{
const points: Point[] = [];
if(k.x == _arg_2.x)
{
points.push(k, _arg_3, _arg_2, _arg_4);
}
else
{
if(k.x == _arg_3.x)
{
points.push(k, _arg_2, _arg_3, _arg_4);
}
else
{
if((((_arg_2.x < k.x) && (_arg_2.y > k.y)) || ((_arg_2.x > k.x) && (_arg_2.y < k.y))))
{
points.push(k, _arg_3, _arg_2, _arg_4);
}
else
{
points.push(k, _arg_2, _arg_3, _arg_4);
}
}
}
if(points[0].x < points[1].x)
{
let _local_6 = points[0];
points[0] = points[1];
points[1] = _local_6;
_local_6 = points[2];
points[2] = points[3];
points[3] = _local_6;
}
if(points[0].y < points[2].y)
{
let _local_6 = points[0];
points[0] = points[2];
points[2] = _local_6;
_local_6 = points[1];
points[1] = points[3];
points[3] = _local_6;
}
return points;
}
public getFurniData(k: Rectangle, _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine, _arg_4: number): string
{
const _local_5: Object[] = [];
let _local_6 = _arg_2.getSortableSpriteList();
const _local_7 = _arg_3.getRoomObjects(_arg_3.activeRoomId, RoomObjectCategory.UNIT);
for(const _local_8 of _local_7)
{
if(_local_8.id !== _arg_4)
{
const _local_11 = (_local_8.visualization as IRoomObjectSpriteVisualization).getSpriteList();
if(_local_11)
{
let _local_12 = 0;
let _local_13 = 0;
for(const _local_14 of _local_6)
{
if(_local_14.name === ('avatar_' + _local_8.id))
{
_local_12 = _local_14.z;
_local_13 = ((_local_14.y + _local_14.height) - (_arg_2.geometry.scale / 4));
break;
}
}
const _local_15 = _arg_3.getRoomObjectScreenLocation(_arg_3.activeRoomId, _local_8.id, RoomObjectCategory.UNIT, _arg_2.id);
if(_local_15)
{
if(_local_13 === 0) _local_13 = _local_15.y;
for(const _local_16 of _local_11)
{
_local_16.x = (_local_16.x + (_local_15.x - _arg_2.screenOffsetX));
_local_16.y = (_local_16.y + _local_13);
_local_16.z = (_local_16.z + _local_12);
if(((_local_16.name.indexOf('h_std_fx29_') === 0) || (_local_16.name.indexOf('h_std_fx185_') === 0)))
{
_local_16.y = (_local_16.y + SpriteDataCollector.AVATAR_WATER_EFFECT_MAGIC_Y_OFFSET);
}
_local_6.push(_local_16);
}
}
}
}
}
_local_6 = SpriteDataCollector.addMannequinSprites(_local_6, _arg_3);
_local_6.sort(SpriteDataCollector.sortSpriteDataObjects);
for(const _local_9 of _local_6)
{
if((((((!(_local_9.name === null)) && (_local_9.name.length > 0)) && (!(_local_9.name.indexOf('tile_cursor_') === 0))) && (SpriteDataCollector.isSpriteInViewPort(_local_9, k, _arg_2))) && ((_arg_4 < 0) || (!(_local_9.objectId == _arg_4)))))
{
_local_5.push(this.getSpriteDataObject(_local_9, k, _arg_2, _arg_3));
if(!this.maxZ) this.maxZ = _local_9.z;
this.spriteCount++;
}
}
return JSON.stringify(_local_5);
}
public getRoomRenderingModifiers(k: RoomEngine): string
{
return JSON.stringify(new Object());
}
private getSpriteDataObject(k: RoomObjectSpriteData, _arg_2: Rectangle, _arg_3: IRoomRenderingCanvas, _arg_4: RoomEngine): Object
{
let _local_7: string = null;
let _local_9: string[] = [];
const _local_5: {
name?: string,
x?: number,
y?: number,
z?: number,
alpha?: number,
flipH?: boolean,
skew?: number,
frame?: boolean,
color?: number,
blendMode?: string,
width?: number,
height?: number,
posture?: string
} = {};
let _local_6 = k.name;
if(k.name.indexOf('@') !== -1)
{
_local_9 = k.name.split('@');
_local_6 = _local_9[0];
_local_7 = _local_9[1];
}
// if(((_local_7) && (k.type)))
// {
// const _local_10 = _arg_4.roomContentLoader.getCollection(k.type);
// if(_local_10)
// {
// const _local_11 = _local_10.getPalette(_local_7);
// if (((!(_local_11 == null)) && (!(_local_11.@source == null))))
// {
// _local_5.paletteSourceName = (_local_11.@source + '');
// }
// }
// }
// var _local_8: string = _arg_4.configuration.getProperty('image.library.url');
// _local_6 = _local_6.replace('%image.library.url%', _local_8);
// if (_local_6.indexOf('%group.badge.url%') != -1)
// {
// _local_12 = _arg_4.configuration.getProperty('group.badge.url');
// _local_6 = _local_6.replace('%group.badge.url%', '');
// _local_13 = _local_12.replace('%imagerdata%', _local_6);
// _local_6 = _local_13;
// }
_local_5.name = _local_6;
_local_5.x = (k.x - _arg_2.x);
_local_5.y = (k.y - _arg_2.y);
_local_5.x = (_local_5.x + _arg_3.screenOffsetX);
_local_5.y = (_local_5.y + _arg_3.screenOffsetY);
_local_5.z = k.z;
if(k.alpha && (k.alpha.toString() !== '255')) _local_5.alpha = k.alpha;
if(k.flipH) _local_5.flipH = k.flipH;
if(k.skew) _local_5.skew = k.skew;
if(k.frame) _local_5.frame = k.frame;
if(k.color && (k.color.length > 0)) _local_5.color = parseInt(k.color);
if(k.blendMode && (k.blendMode !== 'normal')) _local_5.blendMode = k.blendMode;
if(_local_6.indexOf('http') === 0)
{
_local_5.width = k.width;
_local_5.height = k.height;
this.externalImageCount++;
if(this.externalImageCount > SpriteDataCollector.MAX_EXTERNAL_IMAGE_COUNT) _local_5.name = 'box';
}
if(k.posture) _local_5.posture = k.posture;
return _local_5;
}
private makeBackgroundPlane(k: Rectangle, _arg_2: number, _arg_3: IPlaneDrawingData[]): PlaneDrawingData
{
const _local_4 = new Point(0, 0);
const _local_5 = new Point(k.width, 0);
const _local_6 = new Point(0, k.height);
const _local_7 = new Point(k.width, k.height);
const _local_8 = SpriteDataCollector.sortQuadPoints(_local_4, _local_5, _local_6, _local_7);
let _local_9 = 0;
if(_arg_3.length > 0)
{
_local_9 = _arg_3[0].z;
if(this.maxZ) _local_9 = Math.max(this.maxZ, _local_9);
}
else
{
_local_9 = ((this.maxZ) ? this.maxZ : 0);
}
_local_9 = (_local_9 + ((this.spriteCount * 1.776104) + (_arg_3.length * 2.31743)));
const _local_10 = new PlaneDrawingData(null, _arg_2);
_local_10.cornerPoints = _local_8;
_local_10.z = _local_9;
return _local_10;
}
private sortRoomPlanes(k: IRoomPlane[], _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine): { plane: IRoomPlane, z: number }[]
{
const _local_4: Map<number, { plane: IRoomPlane, z: number }> = new Map();
let _local_5 = 1;
if(this.maxZ)
{
_local_5 = (_local_5 + this.maxZ);
}
for(const _local_6 of k)
{
const _local_10 = {
plane: _local_6,
z: _local_5
};
_local_4.set(_local_6.uniqueId, _local_10);
}
const sprites = _arg_2.getPlaneSortableSprites();
sprites.sort((a, b) =>
{
return (b.z - a.z);
});
sprites.reverse();
let _local_8: { plane: IRoomPlane, z: number }[] = [];
for(const sprite of sprites)
{
const objectSprite = sprite.sprite;
if(objectSprite)
{
const _local_10 = _local_4.get(objectSprite.id);
if(_local_10)
{
_local_4.delete(objectSprite.id);
_local_10.z = sprite.z;
_local_8.push(_local_10);
}
}
}
_local_8 = _local_8.concat(Array.from(_local_4.values()));
return _local_8;
}
public getRoomPlanes(k: Rectangle, _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine, _arg_4: number): IPlaneDrawingData[]
{
const _local_5: IPlaneDrawingData[] = [];
const roomObject = _arg_3.getRoomObject(_arg_3.activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM);
const visualization = (roomObject.visualization as unknown as IPlaneVisualization);
if(visualization)
{
const _local_8 = _arg_2.geometry;
const _local_9 = this.sortRoomPlanes(visualization.planes, _arg_2, _arg_3);
const _local_10 = GetStage();
for(const _local_11 of _local_9)
{
const _local_12 = _local_11.plane;
const _local_13: Point[] = [];
const _local_14 = Vector3d.sum(_local_12.location, _local_12.leftSide);
const _local_15 = _local_8.getScreenPoint(_local_12.location);
const _local_16 = _local_8.getScreenPoint(_local_14);
const _local_17 = _local_8.getScreenPoint(Vector3d.sum(_local_12.location, _local_12.rightSide));
const _local_18 = _local_8.getScreenPoint(Vector3d.sum(_local_14, _local_12.rightSide));
_local_13.push(_local_15, _local_16, _local_17, _local_18);
let _local_19 = 0;
let _local_20 = 0;
for(const _local_21 of _local_13)
{
_local_21.x += (_local_10.width / 2);
_local_21.y += (_local_10.height / 2);
_local_21.x += _arg_2.screenOffsetX;
_local_21.y += _arg_2.screenOffsetY;
_local_21.x += -(k.x);
_local_21.y += -(k.y);
if(_local_21.x < 0) _local_19--;
else if(_local_21.x >= k.width) _local_19++;
if(_local_21.y < 0) _local_20--;
else if(_local_21.y >= k.height) _local_20++;
}
if(((Math.abs(_local_19) === 4) || (Math.abs(_local_20) === 4)))
{
//
}
else
{
const _local_22 = SpriteDataCollector.sortQuadPoints(_local_15, _local_16, _local_17, _local_18);
/* for(const _local_23 of _local_12.getDrawingDatas(_local_8))
{
_local_23.cornerPoints = _local_22;
_local_23.z = _local_11.z;
_local_5.push(_local_23);
} */
}
}
_local_5.unshift(this.makeBackgroundPlane(k, _arg_4, _local_5));
}
return _local_5;
}
}

View File

@ -10,5 +10,4 @@ export * from './RoomObjectBadgeImageAssetListener';
export * from './RoomRotatingEffect';
export * from './RoomShakingEffect';
export * from './SelectedRoomObjectData';
export * from './SpriteDataCollector';
export * from './TileObjectMap';

View File

@ -57,212 +57,84 @@ export class ColorConverter
return 'rgba(' + [r, g, b, 1].join(',') + ')';
}
public static rgbToHSL(k: number): number
public static rgbToHSL(rgbValue: number): number
{
const _local_2: number = (((k >> 16) & 0xFF) / 0xFF);
const _local_3: number = (((k >> 8) & 0xFF) / 0xFF);
const _local_4: number = ((k & 0xFF) / 0xFF);
const _local_5: number = Math.max(_local_2, _local_3, _local_4);
const _local_6: number = Math.min(_local_2, _local_3, _local_4);
const _local_7: number = (_local_5 - _local_6);
let _local_8 = 0;
let _local_9 = 0;
let _local_10 = 0;
if(_local_7 == 0)
const red = ((rgbValue >> 16) & 0xFF) / 0xFF;
const green = ((rgbValue >> 8) & 0xFF) / 0xFF;
const blue = (rgbValue & 0xFF) / 0xFF;
const max = Math.max(red, green, blue);
const min = Math.min(red, green, blue);
const delta = max - min;
let hue = 0;
let saturation = 0;
const lightness = (max + min) / 2;
if(delta !== 0)
{
_local_8 = 0;
}
else
{
if(_local_5 == _local_2)
saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
switch(max)
{
if(_local_3 > _local_4)
{
_local_8 = ((60 * (_local_3 - _local_4)) / _local_7);
}
else
{
_local_8 = (((60 * (_local_3 - _local_4)) / _local_7) + 360);
}
}
else
{
if(_local_5 == _local_3)
{
_local_8 = (((60 * (_local_4 - _local_2)) / _local_7) + 120);
}
else
{
if(_local_5 == _local_4)
{
_local_8 = (((60 * (_local_2 - _local_3)) / _local_7) + 240);
}
}
case red:
hue = (green - blue) / delta + (green < blue ? 6 : 0);
break;
case green:
hue = (blue - red) / delta + 2;
break;
case blue:
hue = (red - green) / delta + 4;
break;
}
hue *= 60;
}
_local_9 = (0.5 * (_local_5 + _local_6));
if(_local_7 == 0)
{
_local_10 = 0;
}
else
{
if(_local_9 <= 0.5)
{
_local_10 = ((_local_7 / _local_9) * 0.5);
}
else
{
_local_10 = ((_local_7 / (1 - _local_9)) * 0.5);
}
}
const _local_11: number = Math.round(((_local_8 / 360) * 0xFF));
const _local_12: number = Math.round((_local_10 * 0xFF));
const _local_13: number = Math.round((_local_9 * 0xFF));
const _local_14: number = (((_local_11 << 16) + (_local_12 << 8)) + _local_13);
return _local_14;
const h = Math.round((hue / 360) * 0xFF);
const s = Math.round(saturation * 0xFF);
const l = Math.round(lightness * 0xFF);
return (h << 16) + (s << 8) + l;
}
public static hslToRGB(k: number): number
public static hslToRGB(hslValue: number): number
{
let _local_12: number;
let _local_13: number;
let _local_14: number;
let _local_15: number;
let _local_16: number;
const _local_2: number = (((k >> 16) & 0xFF) / 0xFF);
const _local_3: number = (((k >> 8) & 0xFF) / 0xFF);
const _local_4: number = ((k & 0xFF) / 0xFF);
let _local_5 = 0;
let _local_6 = 0;
let _local_7 = 0;
if(_local_3 > 0)
const hue = ((hslValue >> 16) & 0xFF) / 0xFF;
const saturation = ((hslValue >> 8) & 0xFF) / 0xFF;
const lightness = (hslValue & 0xFF) / 0xFF;
let red = 0;
let green = 0;
let blue = 0;
if(saturation > 0)
{
_local_12 = 0;
_local_13 = 0;
if(_local_4 < 0.5)
const t2 = lightness < 0.5 ? lightness * (1 + saturation) : (lightness + saturation) - (lightness * saturation);
const t1 = (2 * lightness) - t2;
const rgb = [hue + (1 / 3), hue, hue - (1 / 3)].map(color =>
{
_local_12 = (_local_4 * (1 + _local_3));
}
else
{
_local_12 = ((_local_4 + _local_3) - (_local_4 * _local_3));
}
_local_13 = ((2 * _local_4) - _local_12);
_local_14 = (_local_2 + (1 / 3));
_local_15 = _local_2;
_local_16 = (_local_2 - (1 / 3));
if(_local_14 < 0)
{
_local_14 = (_local_14 + 1);
}
else
{
if(_local_14 > 1)
{
_local_14--;
}
}
if(_local_15 < 0)
{
_local_15 = (_local_15 + 1);
}
else
{
if(_local_15 > 1)
{
_local_15--;
}
}
if(_local_16 < 0)
{
_local_16 = (_local_16 + 1);
}
else
{
if(_local_16 > 1)
{
_local_16--;
}
}
if((_local_14 * 6) < 1)
{
_local_5 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_14));
}
else
{
if((_local_14 * 2) < 1)
{
_local_5 = _local_12;
}
else
{
if((_local_14 * 3) < 2)
{
_local_5 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_14)));
}
else
{
_local_5 = _local_13;
}
}
}
if((_local_15 * 6) < 1)
{
_local_6 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_15));
}
else
{
if((_local_15 * 2) < 1)
{
_local_6 = _local_12;
}
else
{
if((_local_15 * 3) < 2)
{
_local_6 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_15)));
}
else
{
_local_6 = _local_13;
}
}
}
if((_local_16 * 6) < 1)
{
_local_7 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_16));
}
else
{
if((_local_16 * 2) < 1)
{
_local_7 = _local_12;
}
else
{
if((_local_16 * 3) < 2)
{
_local_7 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_16)));
}
else
{
_local_7 = _local_13;
}
}
}
if(color < 0) color += 1;
if(color > 1) color -= 1;
if(color * 6 < 1) return t1 + ((t2 - t1) * 6 * color);
if(color * 2 < 1) return t2;
if(color * 3 < 2) return t1 + ((t2 - t1) * ((2 / 3) - color) * 6);
return t1;
});
[red, green, blue] = rgb;
}
else
{
_local_5 = _local_4;
_local_6 = _local_4;
_local_7 = _local_4;
red = green = blue = lightness; // In the case of no saturation, all colors are the same.
}
const _local_8: number = Math.round((_local_5 * 0xFF));
const _local_9: number = Math.round((_local_6 * 0xFF));
const _local_10: number = Math.round((_local_7 * 0xFF));
const _local_11: number = (((_local_8 << 16) + (_local_9 << 8)) + _local_10);
return _local_11;
const r = Math.round(red * 0xFF);
const g = Math.round(green * 0xFF);
const b = Math.round(blue * 0xFF);
return (r << 16) + (g << 8) + b;
}
public static rgb2xyz(k: number): IVector3D

View File

@ -6,7 +6,9 @@ export const PrepareRenderer = async (options: Partial<AutoDetectOptions>): Prom
{
renderer = await autoDetectRenderer(options);
renderer.events?.destroy();
return renderer;
}
};
export const GetRenderer = () => renderer;

View File

@ -2,4 +2,8 @@ import { Container } from 'pixi.js';
const stage = new Container();
stage.interactive = false;
stage.interactiveChildren = false;
stage.eventMode = 'none';
export const GetStage = () => stage;

View File

@ -1,7 +1,6 @@
import { AbstractRenderer, BrowserAdapter, DOMAdapter, HelloSystem, TextureSource } from 'pixi.js';
import { BrowserAdapter, DOMAdapter, HelloSystem, TextureSource } from 'pixi.js';
HelloSystem.defaultOptions.hello = true;
AbstractRenderer.defaultOptions.failIfMajorPerformanceCaveat = false;
TextureSource.defaultOptions.scaleMode = (!(window.devicePixelRatio % 1)) ? 'nearest' : 'linear';
DOMAdapter.set(BrowserAdapter);