Camera.preRender will no longer round the origin, follow coordinates or scrollX/Y coordinates. It will still round the World view.

This commit is contained in:
Richard Davey 2023-11-07 18:31:48 +00:00
parent df846bdab3
commit 7590600b5e

View file

@ -516,12 +516,6 @@ var Camera = new Class({
var emitFollowEvent = false; var emitFollowEvent = false;
if (this.roundPixels)
{
originX = Math.floor(originX);
originY = Math.floor(originY);
}
if (follow && !this.panEffect.isRunning) if (follow && !this.panEffect.isRunning)
{ {
var lerp = this.lerp; var lerp = this.lerp;
@ -529,12 +523,6 @@ var Camera = new Class({
var fx = follow.x - this.followOffset.x; var fx = follow.x - this.followOffset.x;
var fy = follow.y - this.followOffset.y; var fy = follow.y - this.followOffset.y;
if (this.roundPixels)
{
fx = Math.floor(fx);
fy = Math.floor(fy);
}
if (deadzone) if (deadzone)
{ {
if (fx < deadzone.x) if (fx < deadzone.x)
@ -570,12 +558,6 @@ var Camera = new Class({
sy = this.clampY(sy); sy = this.clampY(sy);
} }
if (this.roundPixels)
{
sx = Math.floor(sx);
sy = Math.floor(sy);
}
// Values are in pixels and not impacted by zooming the Camera // Values are in pixels and not impacted by zooming the Camera
this.scrollX = sx; this.scrollX = sx;
this.scrollY = sy; this.scrollY = sy;
@ -590,18 +572,13 @@ var Camera = new Class({
var displayWidth = width / zoom; var displayWidth = width / zoom;
var displayHeight = height / zoom; var displayHeight = height / zoom;
var vwx = midX - (displayWidth / 2); var vwx = Math.floor(midX - (displayWidth / 2));
var vwy = midY - (displayHeight / 2); var vwy = Math.floor(midY - (displayHeight / 2));
if (this.roundPixels)
{
vwx = Math.floor(vwx);
vwy = Math.floor(vwy);
}
this.worldView.setTo(vwx, vwy, displayWidth, displayHeight); this.worldView.setTo(vwx, vwy, displayWidth, displayHeight);
matrix.applyITRS(Math.floor(this.x + originX), Math.floor(this.y + originY), this.rotation, zoom, zoom); matrix.applyITRS(Math.floor(this.x + originX), Math.floor(this.y + originY), this.rotation, zoom, zoom);
matrix.translate(-originX, -originY); matrix.translate(-originX, -originY);
this.shakeEffect.preRender(); this.shakeEffect.preRender();