Skip to content

Commit 59c869f

Browse files
committed
Missed equality check for change in orthographic size. Added render texture maximum texture size
1 parent 4ff6f03 commit 59c869f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

PixelCamera.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ public bool Equals(CamSettings other)
3939
bool equalAspect = other.aspect == aspect;
4040
bool equalFoV = Math.Abs(other.fieldOfView - fieldOfView) <= float.Epsilon;
4141
bool equalZoom = Math.Abs(other.zoomLevel - zoomLevel) <= float.Epsilon;
42-
bool isEqual = equalScreen && equalAspect && equalFoV && equalZoom;
42+
bool equalOrtho = other.isOrtho == isOrtho;
43+
bool isEqual = equalScreen && equalAspect &&
44+
equalFoV && equalZoom &&
45+
equalOrtho;
4346
//if (!isEqual)
4447
//{
4548
// Debug.LogFormat("scr {0}, asp {1}, fov {2}, zoom {3}", equalScreen, equalAspect, equalFoV, equalZoom);
@@ -227,7 +230,7 @@ protected Vector2 GetScreenRenderSize()
227230
return screenRenderSize;
228231
}
229232

230-
protected void SetupCamera()
233+
private void SetupCamera()
231234
{
232235
var aspect = AspectStretch;
233236

@@ -307,8 +310,8 @@ protected int[] GetRenderTextureSize(Vector2 size, Vector2 aspect)
307310
height += 1;
308311

309312
// Just in case
310-
width = Mathf.Max(2, width);
311-
height = Mathf.Max(2, height);
313+
width = Mathf.Clamp(width, 2, 4096);
314+
height = Mathf.Clamp(height, 2, 4096);
312315

313316
return new[] {width, height};
314317
}
@@ -356,12 +359,13 @@ public void ForceRefresh()
356359
lastSettings.screenSize = new [] {0, 0};
357360
}
358361

359-
public void CheckCamera()
362+
public bool CheckCamera()
360363
{
361364
var currentSettings = new CamSettings(AspectStretch, zoomLevel, cam.fieldOfView, cam.orthographic);
362365
bool didChange = currentSettings.Equals(lastSettings) == false;
363366
if (didChange)
364367
SetupCamera();
368+
return didChange;
365369
}
366370
}
367371
}

0 commit comments

Comments
 (0)