mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Update wired filter
This commit is contained in:
parent
40e67afb7f
commit
0df421e20c
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user