Merge pull request #592 from thecodingmachine/fixpipelinenowebgl

Fixing bug when no WebGL is available
This commit is contained in:
David Négrier 2021-01-13 18:45:16 +01:00 committed by GitHub
commit 842eadeb59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -42,8 +42,10 @@ export class ActionableItem {
return;
}
this.isSelectable = true;
this.sprite.setPipeline(OutlinePipeline.KEY);
this.sprite.pipeline.set2f('uTextureSize', this.sprite.texture.getSourceImage().width, this.sprite.texture.getSourceImage().height);
if (this.sprite.pipeline) {
this.sprite.setPipeline(OutlinePipeline.KEY);
this.sprite.pipeline.set2f('uTextureSize', this.sprite.texture.getSourceImage().width, this.sprite.texture.getSourceImage().height);
}
}
/**

View File

@ -73,9 +73,10 @@ const config: GameConfig = {
},
callbacks: {
postBoot: game => {
// FIXME: we should fore WebGL in the config.
const renderer = game.renderer as WebGLRenderer;
renderer.pipelines.add(OutlinePipeline.KEY, new OutlinePipeline(game));
const renderer = game.renderer;
if (renderer instanceof WebGLRenderer) {
renderer.pipelines.add(OutlinePipeline.KEY, new OutlinePipeline(game));
}
}
}
};