Skip to content

Commit

Permalink
Examples: Ensure geometries are disposed in webgl_loader_nrrd
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Dec 5, 2018
1 parent 1675680 commit 7fed340
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion examples/js/VolumeSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,15 @@ THREE.VolumeSlice.prototype = {
this.ctx = this.canvas.getContext( '2d' );
this.ctxBuffer = this.canvasBuffer.getContext( '2d' );

if ( this.geometry ) this.geometry.dispose(); // dispose existing geometry

this.geometry = new THREE.PlaneBufferGeometry( extracted.planeWidth, extracted.planeHeight );

if ( this.mesh ) {

this.mesh.geometry = this.geometry;
//reset mesh matrix
this.mesh.matrix = ( new THREE.Matrix4() ).identity();
this.mesh.matrix.identity();
this.mesh.applyMatrix( this.matrix );

}
Expand Down
4 changes: 2 additions & 2 deletions examples/webgl_loader_nrrd.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - loaders - vtk loader</title>
<title>three.js webgl - loaders - NRRD loader</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
Expand Down Expand Up @@ -43,7 +43,7 @@
<body>
<div id="info">
<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> -
nrrd format loader test
NRRD format loader test
</div>
<div id="inset"></div>

Expand Down

0 comments on commit 7fed340

Please sign in to comment.