Update wired filter

This commit is contained in:
billsonnn 2024-03-30 21:28:49 -04:00
parent 40e67afb7f
commit 0df421e20c

View File

@ -1,9 +1,11 @@
import { GetRoomEngine, IRoomObject, IRoomObjectSpriteVisualization, NitroFilter, RoomObjectCategory } from '@nitrots/nitro-renderer';
import { GetRoomEngine, IRoomObject, IRoomObjectSpriteVisualization, RoomObjectCategory, WiredFilter } from '@nitrots/nitro-renderer';
export class WiredSelectionVisualizer
{
// private static _selectionShader: NitroFilter = new WiredSelectionFilter([ 1, 1, 1 ], [ 0.6, 0.6, 0.6 ]);
private static _selectionShader: NitroFilter = null;
private static _selectionShader: WiredFilter = new WiredFilter({
lineColor: [ 1, 1, 1 ],
color: [ 0.6, 0.6, 0.6 ]
});
public static show(furniId: number): void
{
@ -50,7 +52,11 @@ export class WiredSelectionVisualizer
{
if(sprite.blendMode === 'add') continue;
sprite.filters = [ WiredSelectionVisualizer._selectionShader ];
if(!sprite.filters) sprite.filters = [];
sprite.filters.push(WiredSelectionVisualizer._selectionShader);
sprite.increaseUpdateCounter();
}
}
@ -62,6 +68,18 @@ export class WiredSelectionVisualizer
if(!visualization) return;
for(const sprite of visualization.sprites) sprite.filters = [];
for(const sprite of visualization.sprites)
{
if(!sprite.filters) continue;
const index = sprite.filters.indexOf(WiredSelectionVisualizer._selectionShader);
if(index >= 0)
{
sprite.filters.splice(index, 1);
sprite.increaseUpdateCounter();
}
}
}
}