Explorar el Código

Examples: Ensure geometries are disposed in webgl_loader_nrrd

Mugen87 hace 6 años
padre
commit
7fed340836
Se han modificado 2 ficheros con 5 adiciones y 3 borrados
  1. 3 1
      examples/js/VolumeSlice.js
  2. 2 2
      examples/webgl_loader_nrrd.html

+ 3 - 1
examples/js/VolumeSlice.js

@@ -196,13 +196,15 @@ THREE.VolumeSlice.prototype = {
 		this.ctx = this.canvas.getContext( '2d' );
 		this.ctx = this.canvas.getContext( '2d' );
 		this.ctxBuffer = this.canvasBuffer.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 );
 		this.geometry = new THREE.PlaneBufferGeometry( extracted.planeWidth, extracted.planeHeight );
 
 
 		if ( this.mesh ) {
 		if ( this.mesh ) {
 
 
 			this.mesh.geometry = this.geometry;
 			this.mesh.geometry = this.geometry;
 			//reset mesh matrix
 			//reset mesh matrix
-			this.mesh.matrix = ( new THREE.Matrix4() ).identity();
+			this.mesh.matrix.identity();
 			this.mesh.applyMatrix( this.matrix );
 			this.mesh.applyMatrix( this.matrix );
 
 
 		}
 		}

+ 2 - 2
examples/webgl_loader_nrrd.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<title>three.js webgl - loaders - vtk loader</title>
+		<title>three.js webgl - loaders - NRRD loader</title>
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>
@@ -43,7 +43,7 @@
 	<body>
 	<body>
 		<div id="info">
 		<div id="info">
 			<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> -
 			<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> -
-			nrrd format loader test
+			NRRD format loader test
 		</div>
 		</div>
 		<div id="inset"></div>
 		<div id="inset"></div>