mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[phaser] Closes #2348, fix visibility test
This commit is contained in:
parent
a740fae009
commit
4f33a2aae6
@ -63,6 +63,11 @@
|
||||
>Visibility test</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/spine-phaser/example/visibility-test-container.html"
|
||||
>Visibility test (container)</a
|
||||
>
|
||||
</li>
|
||||
<li><a href="/spine-phaser/example/blend-test.html">Blend test</a></li>
|
||||
<li>
|
||||
<a href="/spine-phaser/example/camera-pipeline-test.html"
|
||||
|
||||
66
spine-ts/spine-phaser/example/visibility-test-container.html
Normal file
66
spine-ts/spine-phaser/example/visibility-test-container.html
Normal file
@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
|
||||
<script src="../dist/iife/spine-phaser.js"></script>
|
||||
<title>Spine Phaser Example</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Visibility Test 2</h1>
|
||||
</body>
|
||||
<script>
|
||||
const config = {
|
||||
type: Phaser.AUTO,
|
||||
width: 800,
|
||||
height: 600,
|
||||
type: Phaser.WEBGL,
|
||||
scene: {
|
||||
preload: preload,
|
||||
create: create,
|
||||
pack: {
|
||||
files: [
|
||||
{ type: "scenePlugin", key: "spine.SpinePlugin", url: "../dist/iife/spine-phaser.js", sceneKey: "spine" }
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const game = new Phaser.Game(config);
|
||||
|
||||
function preload() {
|
||||
this.load.image('coin', 'assets/coin-pma.png');
|
||||
this.load.spineBinary("spineboy-data", "assets/spineboy-pro.skel");
|
||||
this.load.spineAtlas("spineboy-atlas", "assets/spineboy-pma.atlas");
|
||||
}
|
||||
|
||||
function create() {
|
||||
const spineboy = this.add.spine(100, 400, 'spineboy-data', "spineboy-atlas");
|
||||
spineboy.scale = 0.25;
|
||||
spineboy.animationState.setAnimation(0, "idle", true);
|
||||
|
||||
const spineboy2 = this.add.spine(250, 400, 'spineboy-data', "spineboy-atlas");
|
||||
spineboy2.scale = 0.25;
|
||||
spineboy2.animationState.setAnimation(0, "walk", true);
|
||||
|
||||
window.coin = this.add.image(400,500,'coin').setOrigin(0.5,1).setScale(0.3).setCrop(304,283,286,284);
|
||||
|
||||
const spineboy3 = this.add.spine(500, 400, 'spineboy-data', "spineboy-atlas");
|
||||
spineboy3.scale = 0.25;
|
||||
spineboy3.animationState.setAnimation(0, "run", true);
|
||||
|
||||
const spineboy4 = this.add.spine(650, 400, 'spineboy-data', "spineboy-atlas");
|
||||
spineboy4.scale = 0.25;
|
||||
spineboy4.animationState.setAnimation(0, "shoot", true);
|
||||
|
||||
const grp = this.add.container().add([spineboy,spineboy2,coin,spineboy3,spineboy4]);
|
||||
|
||||
this.input.on('pointerdown', () => spineboy2.visible = !spineboy2.visible);
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
||||
@ -297,10 +297,9 @@ export class SpineGameObject extends DepthMixin(
|
||||
}
|
||||
|
||||
willRender (camera: Phaser.Cameras.Scene2D.Camera) {
|
||||
if (!this.visible) return false;
|
||||
|
||||
var GameObjectRenderMask = 0xf;
|
||||
var result = !this.skeleton || !(GameObjectRenderMask !== this.renderFlags || (this.cameraFilter !== 0 && this.cameraFilter & camera.id));
|
||||
if (!this.visible) result = false;
|
||||
|
||||
if (!result && this.parentContainer && this.plugin.webGLRenderer) {
|
||||
var sceneRenderer = this.plugin.webGLRenderer;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user