mirror of
https://github.com/photonstorm/phaser
synced 2024-12-01 00:49:41 +00:00
Fixed divide by zero error in Camera projection
This commit is contained in:
parent
e224faa903
commit
2062b625d7
1 changed files with 6 additions and 0 deletions
|
@ -150,6 +150,12 @@ var Camera3D = new Class({
|
||||||
// Transform into clip space
|
// Transform into clip space
|
||||||
tmpVec4.transformMat4(this.combined);
|
tmpVec4.transformMat4(this.combined);
|
||||||
|
|
||||||
|
// Avoid divide by zero when 0x0x0 camera projects to a 0x0x0 vec3
|
||||||
|
if (tmpVec4.w === 0)
|
||||||
|
{
|
||||||
|
tmpVec4.w = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Now into NDC
|
// Now into NDC
|
||||||
tmpVec4.x = tmpVec4.x / tmpVec4.w;
|
tmpVec4.x = tmpVec4.x / tmpVec4.w;
|
||||||
tmpVec4.y = tmpVec4.y / tmpVec4.w;
|
tmpVec4.y = tmpVec4.y / tmpVec4.w;
|
||||||
|
|
Loading…
Reference in a new issue