Просмотр исходного кода

WebGLBackend: Fix `ArrayCamera` pixel ratio (#30338)

sunag 1 год назад
Родитель
Сommit
0195417348
1 измененных файлов с 9 добавлено и 4 удалено
  1. 9 4
      src/renderers/webgl-fallback/WebGLBackend.js

+ 9 - 4
src/renderers/webgl-fallback/WebGLBackend.js

@@ -1104,11 +1104,16 @@ class WebGLBackend extends Backend {
 
 					const vp = subCamera.viewport;
 
+					const x = vp.x * pixelRatio;
+					const y = vp.y * pixelRatio;
+					const width = vp.width * pixelRatio;
+					const height = vp.height * pixelRatio;
+
 					state.viewport(
-						Math.floor( vp.x * pixelRatio ),
-						Math.floor( ( renderObject.context.height - vp.height - vp.y ) * pixelRatio ),
-						Math.floor( vp.width * pixelRatio ),
-						Math.floor( vp.height * pixelRatio )
+						Math.floor( x ),
+						Math.floor( renderObject.context.height - height - y ),
+						Math.floor( width ),
+						Math.floor( height )
 					);
 
 					state.bindBufferBase( gl.UNIFORM_BUFFER, cameraIndexData.index, cameraData.indexesGPU[ i ] );

粤ICP备19079148号