mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 05:58:30 +00:00
Added Sprite3D.fastHide option and tidied up the Camera3D matrix transform
This commit is contained in:
parent
df0c457b0d
commit
d6fe678966
2 changed files with 19 additions and 1 deletions
|
@ -166,7 +166,7 @@ var Camera3D = new Class({
|
|||
children[i].position.transformMat4(mat4);
|
||||
}
|
||||
|
||||
return this.update();
|
||||
return this.updateChildren();
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,12 +25,25 @@ var Sprite3D = new Class({
|
|||
this.adjustScaleX = true;
|
||||
this.adjustScaleY = true;
|
||||
|
||||
this.fastHide = true;
|
||||
|
||||
this._visible = true;
|
||||
},
|
||||
|
||||
// Performs a simple check to see if this Sprite3D object should be hidden from view if its
|
||||
// z position is behind the cameras. Very fast but doesn't take camera direction into consideration,
|
||||
// so not suitable for all types of game.
|
||||
setFastHide: function (value)
|
||||
{
|
||||
this.fastHide = value;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
project: function (camera)
|
||||
{
|
||||
var pos = this.position;
|
||||
|
||||
var gameObject = this.gameObject;
|
||||
|
||||
camera.project(pos, gameObject);
|
||||
|
@ -48,6 +61,11 @@ var Sprite3D = new Class({
|
|||
}
|
||||
|
||||
gameObject.setDepth(gameObject.z);
|
||||
|
||||
if (this.fastHide)
|
||||
{
|
||||
gameObject.setVisible(pos.z > camera.position.z);
|
||||
}
|
||||
},
|
||||
|
||||
visible: {
|
||||
|
|
Loading…
Add table
Reference in a new issue