提交 23a9613d 编写于 作者: M MiiBond 提交者: Mr.doob

Adding dispose method to a couple of effects to allow for applications to clean them up easily.

上级 320fe3ac
......@@ -80,6 +80,8 @@ THREE.AnaglyphEffect = function ( renderer, width, height ) {
this.setSize = function ( width, height ) {
if ( _renderTargetL ) _renderTargetL.dispose();
if ( _renderTargetR ) _renderTargetR.dispose();
_renderTargetL = new THREE.WebGLRenderTarget( width, height, _params );
_renderTargetR = new THREE.WebGLRenderTarget( width, height, _params );
......@@ -165,4 +167,9 @@ THREE.AnaglyphEffect = function ( renderer, width, height ) {
};
this.dispose = function() {
if ( _renderTargetL ) _renderTargetL.dispose();
if ( _renderTargetR ) _renderTargetR.dispose();
}
};
......@@ -136,6 +136,7 @@ THREE.OculusRiftEffect = function ( renderer, options ) {
RTMaterial.uniforms['scale'].value = new THREE.Vector2(1.0/distScale, 1.0*aspect/distScale);
// Create render target
if ( renderTarget ) renderTarget.dispose();
renderTarget = new THREE.WebGLRenderTarget( HMD.hResolution*distScale/2, HMD.vResolution*distScale, RTParams );
RTMaterial.uniforms[ "texid" ].value = renderTarget;
......@@ -194,4 +195,13 @@ THREE.OculusRiftEffect = function ( renderer, options ) {
};
this.dispose = function() {
if ( RTMaterial ) {
RTMaterial.dispose();
}
if ( renderTarget ) {
renderTarget.dispose();
}
};
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册