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;
|
minLevel: number;
|
||||||
texture: Texture;
|
texture: Texture;
|
||||||
colorMatrix: number[];
|
colorMatrix: number[];
|
||||||
|
blendMode: number;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { IRoomCameraWidgetSelectedEffect } from './IRoomCameraWidgetSelectedEffe
|
|||||||
export interface IRoomCameraWidgetManager
|
export interface IRoomCameraWidgetManager
|
||||||
{
|
{
|
||||||
init(): void;
|
init(): void;
|
||||||
applyEffects(image: HTMLImageElement, selectedEffects: IRoomCameraWidgetSelectedEffect[]): HTMLImageElement;
|
applyEffects(image: HTMLImageElement, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): HTMLImageElement;
|
||||||
events: IEventDispatcher;
|
events: IEventDispatcher;
|
||||||
effects: Map<string, IRoomCameraWidgetEffect>;
|
effects: Map<string, IRoomCameraWidgetEffect>;
|
||||||
isLoaded: boolean;
|
isLoaded: boolean;
|
||||||
|
@ -7,13 +7,15 @@ export class RoomCameraWidgetEffect implements IRoomCameraWidgetEffect
|
|||||||
private _minLevel: number = -1;
|
private _minLevel: number = -1;
|
||||||
private _texture: Texture = null;
|
private _texture: Texture = null;
|
||||||
private _colorMatrix: number[] = 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._name = name;
|
||||||
this._minLevel = minLevel;
|
this._minLevel = minLevel;
|
||||||
this._texture = texture;
|
this._texture = texture;
|
||||||
this._colorMatrix = colorMatrix;
|
this._colorMatrix = colorMatrix;
|
||||||
|
this._blendMode = blendMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get name(): string
|
public get name(): string
|
||||||
@ -41,6 +43,16 @@ export class RoomCameraWidgetEffect implements IRoomCameraWidgetEffect
|
|||||||
this._colorMatrix = colorMatrix;
|
this._colorMatrix = colorMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get blendMode(): number
|
||||||
|
{
|
||||||
|
return this._blendMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set blendMode(blendMode: number)
|
||||||
|
{
|
||||||
|
this._blendMode = blendMode;
|
||||||
|
}
|
||||||
|
|
||||||
public get minLevel(): number
|
public get minLevel(): number
|
||||||
{
|
{
|
||||||
return this._minLevel;
|
return this._minLevel;
|
||||||
|
@ -28,7 +28,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
|||||||
this._isLoaded = true;
|
this._isLoaded = true;
|
||||||
|
|
||||||
const imagesUrl = Nitro.instance.getConfiguration<string>('image.library.url') + 'Habbo-Stories/';
|
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)
|
for(const effect of effects)
|
||||||
{
|
{
|
||||||
@ -43,6 +43,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
cameraEffect.texture = Texture.from(imagesUrl + effect.name + '.png');
|
cameraEffect.texture = Texture.from(imagesUrl + effect.name + '.png');
|
||||||
|
cameraEffect.blendMode = effect.blendMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._effects.set(cameraEffect.name, cameraEffect);
|
this._effects.set(cameraEffect.name, cameraEffect);
|
||||||
@ -51,7 +52,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
|||||||
this.events.dispatchEvent(new RoomCameraWidgetManagerEvent(RoomCameraWidgetManagerEvent.INITIALIZED));
|
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 container = new Container();
|
||||||
const texture = Texture.from(image);
|
const texture = Texture.from(image);
|
||||||
@ -80,6 +81,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
|||||||
{
|
{
|
||||||
const effectSprite = new Sprite(effect.texture);
|
const effectSprite = new Sprite(effect.texture);
|
||||||
effectSprite.alpha = selectedEffect.alpha;
|
effectSprite.alpha = selectedEffect.alpha;
|
||||||
|
effectSprite.blendMode = effect.blendMode;
|
||||||
|
|
||||||
container.addChild(effectSprite);
|
container.addChild(effectSprite);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user