Preserve reflection render target aspect
This commit is contained in:
@@ -1051,8 +1051,14 @@ function resize() {
|
|||||||
renderer.setSize(width, height, false);
|
renderer.setSize(width, height, false);
|
||||||
camera.aspect = width / height;
|
camera.aspect = width / height;
|
||||||
camera.updateProjectionMatrix();
|
camera.updateProjectionMatrix();
|
||||||
const reflectionWidth = Math.max(1024, Math.min(4096, Math.floor(width * reflectionPixelRatio * 1.5)));
|
const desiredReflectionScale = reflectionPixelRatio * 1.5;
|
||||||
const reflectionHeight = Math.max(576, Math.min(2304, Math.floor(height * reflectionPixelRatio * 1.5)));
|
const reflectionScale = Math.max(1, Math.min(
|
||||||
|
desiredReflectionScale,
|
||||||
|
4096 / width,
|
||||||
|
2304 / height
|
||||||
|
));
|
||||||
|
const reflectionWidth = Math.floor(width * reflectionScale);
|
||||||
|
const reflectionHeight = Math.floor(height * reflectionScale);
|
||||||
reflectionTargetSize.set(reflectionWidth, reflectionHeight);
|
reflectionTargetSize.set(reflectionWidth, reflectionHeight);
|
||||||
tableReflectionTarget.setSize(
|
tableReflectionTarget.setSize(
|
||||||
reflectionTargetSize.x,
|
reflectionTargetSize.x,
|
||||||
|
|||||||
Reference in New Issue
Block a user