Skip to content

Commit

Permalink
transition rendertarget use same size of renderer (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiweicao committed Jun 6, 2024
1 parent 7a3f4f0 commit baaf135
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { platform } from '../platform.js';
import { Frustum } from '../math/Frustum.js';
import { Matrix4 } from '../math/Matrix4.js';
import { Vector2 } from '../math/Vector2.js';
import { Vector3 } from '../math/Vector3.js';
import { Vector4 } from '../math/Vector4.js';
import { WebGLAnimation } from './webgl/WebGLAnimation.js';
Expand Down Expand Up @@ -170,6 +171,7 @@ function WebGLRenderer( parameters = {} ) {
const _projScreenMatrix = new Matrix4();

const _vector3 = new Vector3();
const _vector2 = new Vector2();

const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, layers: { test: () => false }, children: [], isScene: true, onBeforeRender: function () {}, onAfterRender: function () {} };

Expand Down Expand Up @@ -1254,7 +1256,7 @@ function WebGLRenderer( parameters = {} ) {
const needsAntialias = _antialias === true && capabilities.isWebGL2 === true;
const hasColorBufferHalfFloat = extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) );

_transmissionRenderTarget = new WebGLRenderTarget( 1024, 1024, {
_transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
generateMipmaps: true,
type: hasColorBufferHalfFloat ? HalfFloatType : UnsignedByteType,
minFilter: LinearMipmapLinearFilter,
Expand All @@ -1263,6 +1265,9 @@ function WebGLRenderer( parameters = {} ) {

}

_this.getDrawingBufferSize( _vector2 );
_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );

const currentRenderTarget = _this.getRenderTarget();
_this.setRenderTarget( _transmissionRenderTarget );
_this.clear();
Expand Down

0 comments on commit baaf135

Please sign in to comment.