33 lines
861 B
JavaScript
33 lines
861 B
JavaScript
|
import {ExtensionType} from '@pixi/core';
|
||
|
import {Layer, Stage as LayerStage} from '@pixi/layers';
|
||
|
|
||
|
let AmbientLight, diffuseGroup, normalGroup, lightGroup;
|
||
|
if ('undefined' !== typeof window) {
|
||
|
({AmbientLight, diffuseGroup, normalGroup, lightGroup} = await import('@pixi/lights'));
|
||
|
}
|
||
|
|
||
|
export const ApplicationStageLayers = {
|
||
|
type: ExtensionType.Application,
|
||
|
priority: 100,
|
||
|
ref: {
|
||
|
destroy: function() {},
|
||
|
init: function() {
|
||
|
this.stage = new LayerStage();
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
|
||
|
export const ApplicationStageLights = {
|
||
|
type: ExtensionType.Application,
|
||
|
ref: {
|
||
|
destroy: function() {},
|
||
|
init: function() {
|
||
|
const {stage} = this;
|
||
|
stage.addChild(new Layer(diffuseGroup));
|
||
|
stage.addChild(new Layer(normalGroup));
|
||
|
stage.addChild(new Layer(lightGroup));
|
||
|
stage.addChild(new AmbientLight(0xffffff, 1));
|
||
|
},
|
||
|
},
|
||
|
};
|