andrew
March 22, 2020, 11:21pm
1
Hi guys,
I think this line (and all the other logical OR checks surrounding it) is buggy:
var halfHeight = engine.getRenderHeight() / 2.0;
if (scene.useRightHandedSystem) {
Matrix.OrthoOffCenterRHToRef(this.orthoLeft || -halfWidth,
this.orthoRight || halfWidth,
this.orthoBottom || -halfHeight,
this.orthoTop || halfHeight,
this.minZ,
this.maxZ,
this._projectionMatrix);
} else {
Matrix.OrthoOffCenterLHToRef(this.orthoLeft || -halfWidth,
this.orthoRight || halfWidth,
this.orthoBottom || -halfHeight,
this.orthoTop || halfHeight,
this.minZ,
this.maxZ,
this._projectionMatrix);
}
this._cache.orthoLeft = this.orthoLeft;
this._cache.orthoRight = this.orthoRight;
Matrix.OrthoOffCenterRHToRef(this.orthoLeft || -halfWidth
Basically if I’m setting any of these properties to 0, it will be ignored and -halfWidth will be used instead. In my demo I explicitly want to set orthoLeft to 0, and now the workaround is to set it to 0.001.
Maybe you could use the Nullish Coalescing operator instead?
You are so right!! Do you want to submit a PR?
andrew
March 23, 2020, 4:35pm
3
Sure, I’ve submitted a PR here:
BabylonJS:master
← andrewvarga:patch-1
opened 04:32PM - 23 Mar 20 UTC
Let me know if this works.
2 Likes
Thanks this is super fine