فهرست منبع

WebGLBackend: Update viewport state (#30337)

* update viewport state

* cleanup
sunag 1 سال پیش
والد
کامیت
785add5017
2فایلهای تغییر یافته به همراه5 افزوده شده و 5 حذف شده
  1. 1 1
      src/renderers/webgl-fallback/WebGLBackend.js
  2. 4 4
      src/renderers/webgl-fallback/utils/WebGLState.js

+ 1 - 1
src/renderers/webgl-fallback/WebGLBackend.js

@@ -1104,7 +1104,7 @@ class WebGLBackend extends Backend {
 
 					const vp = subCamera.viewport;
 
-					gl.viewport(
+					state.viewport(
 						Math.floor( vp.x * pixelRatio ),
 						Math.floor( ( renderObject.context.height - vp.height - vp.y ) * pixelRatio ),
 						Math.floor( vp.width * pixelRatio ),

+ 4 - 4
src/renderers/webgl-fallback/utils/WebGLState.js

@@ -127,8 +127,8 @@ class WebGLState {
 
 		this.currentScissor = new Vector4().fromArray( scissorParam );
 		this.currentViewport = new Vector4().fromArray( viewportParam );
-		this._tempScissor = new Vector4();
-		this._tempViewport = new Vector4();
+
+		this._tempVec4 = new Vector4();
 
 	}
 
@@ -563,7 +563,7 @@ class WebGLState {
 	 */
 	scissor( x, y, width, height ) {
 
-		const scissor = this._tempScissor.set( x, y, width, height );
+		const scissor = this._tempVec4.set( x, y, width, height );
 
 		if ( this.currentScissor.equals( scissor ) === false ) {
 
@@ -587,7 +587,7 @@ class WebGLState {
 	 */
 	viewport( x, y, width, height ) {
 
-		const viewport = this._tempScissor.set( x, y, width, height );
+		const viewport = this._tempVec4.set( x, y, width, height );
 
 		if ( this.currentViewport.equals( viewport ) === false ) {
 

粤ICP备19079148号