mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-23 08:00:51 +01:00
Room Widget Camera updates
This commit is contained in:
parent
09e90a8c93
commit
191cb16a8d
@ -6,4 +6,5 @@ export interface IRoomCameraWidgetEffect
|
||||
minLevel: number;
|
||||
texture: Texture;
|
||||
colorMatrix: number[];
|
||||
blendMode: number;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { IRoomCameraWidgetSelectedEffect } from './IRoomCameraWidgetSelectedEffe
|
||||
export interface IRoomCameraWidgetManager
|
||||
{
|
||||
init(): void;
|
||||
applyEffects(image: HTMLImageElement, selectedEffects: IRoomCameraWidgetSelectedEffect[]): HTMLImageElement;
|
||||
applyEffects(image: HTMLImageElement, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): HTMLImageElement;
|
||||
events: IEventDispatcher;
|
||||
effects: Map<string, IRoomCameraWidgetEffect>;
|
||||
isLoaded: boolean;
|
||||
|
@ -7,13 +7,15 @@ export class RoomCameraWidgetEffect implements IRoomCameraWidgetEffect
|
||||
private _minLevel: number = -1;
|
||||
private _texture: Texture = null;
|
||||
private _colorMatrix: number[] = null;
|
||||
private _blendMode: number = null;
|
||||
|
||||
constructor(name: string, minLevel: number = -1, texture: Texture = null, colorMatrix: number[] = null)
|
||||
constructor(name: string, minLevel: number = -1, texture: Texture = null, colorMatrix: number[] = null, blendMode: number = null)
|
||||
{
|
||||
this._name = name;
|
||||
this._minLevel = minLevel;
|
||||
this._texture = texture;
|
||||
this._colorMatrix = colorMatrix;
|
||||
this._blendMode = blendMode;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
@ -41,6 +43,16 @@ export class RoomCameraWidgetEffect implements IRoomCameraWidgetEffect
|
||||
this._colorMatrix = colorMatrix;
|
||||
}
|
||||
|
||||
public get blendMode(): number
|
||||
{
|
||||
return this._blendMode;
|
||||
}
|
||||
|
||||
public set blendMode(blendMode: number)
|
||||
{
|
||||
this._blendMode = blendMode;
|
||||
}
|
||||
|
||||
public get minLevel(): number
|
||||
{
|
||||
return this._minLevel;
|
||||
|
@ -28,7 +28,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
||||
this._isLoaded = true;
|
||||
|
||||
const imagesUrl = Nitro.instance.getConfiguration<string>('image.library.url') + 'Habbo-Stories/';
|
||||
const effects = Nitro.instance.getConfiguration<{ name: string, colorMatrix?: number[], minLevel: number, enabled: boolean }[]>('camera.available.effects');
|
||||
const effects = Nitro.instance.getConfiguration<{ name: string, colorMatrix?: number[], minLevel: number, blendMode?: number, enabled: boolean }[]>('camera.available.effects');
|
||||
|
||||
for(const effect of effects)
|
||||
{
|
||||
@ -43,6 +43,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
||||
else
|
||||
{
|
||||
cameraEffect.texture = Texture.from(imagesUrl + effect.name + '.png');
|
||||
cameraEffect.blendMode = effect.blendMode;
|
||||
}
|
||||
|
||||
this._effects.set(cameraEffect.name, cameraEffect);
|
||||
@ -51,7 +52,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
||||
this.events.dispatchEvent(new RoomCameraWidgetManagerEvent(RoomCameraWidgetManagerEvent.INITIALIZED));
|
||||
}
|
||||
|
||||
public applyEffects(image: HTMLImageElement, selectedEffects: IRoomCameraWidgetSelectedEffect[]): HTMLImageElement
|
||||
public applyEffects(image: HTMLImageElement, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): HTMLImageElement
|
||||
{
|
||||
const container = new Container();
|
||||
const texture = Texture.from(image);
|
||||
@ -80,6 +81,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
||||
{
|
||||
const effectSprite = new Sprite(effect.texture);
|
||||
effectSprite.alpha = selectedEffect.alpha;
|
||||
effectSprite.blendMode = effect.blendMode;
|
||||
|
||||
container.addChild(effectSprite);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user