Skip to content

Commit c570b9b

Browse files
authored
Merge pull request #14825 from Mugen87/dev9
Examples: Clean up
2 parents bf1d242 + 5ecdacd commit c570b9b

17 files changed

+150
-160
lines changed

examples/canvas_materials_reflection.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@
4545

4646
<script>
4747

48-
var camera, scene, renderer,
49-
particle1, particle2, particle2,
50-
light1, light2, light3,
51-
loader, mesh;
48+
var camera, scene, renderer, loader, mesh;
5249

5350
init();
5451
animate();

examples/js/Volume.js

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @param {string} type The type of data (uint8, uint16, ...)
1212
* @param {ArrayBuffer} arrayBuffer The buffer with volume data
1313
*/
14-
THREE.Volume = function( xLength, yLength, zLength, type, arrayBuffer ) {
14+
THREE.Volume = function ( xLength, yLength, zLength, type, arrayBuffer ) {
1515

1616
if ( arguments.length > 0 ) {
1717

@@ -137,17 +137,17 @@ THREE.Volume = function( xLength, yLength, zLength, type, arrayBuffer ) {
137137
*/
138138
var lowerThreshold = - Infinity;
139139
Object.defineProperty( this, 'lowerThreshold', {
140-
get : function() {
140+
get: function () {
141141

142142
return lowerThreshold;
143143

144144
},
145-
set : function( value ) {
145+
set: function ( value ) {
146146

147147
lowerThreshold = value;
148-
this.sliceList.forEach( function( slice ) {
148+
this.sliceList.forEach( function ( slice ) {
149149

150-
slice.geometryNeedsUpdate = true
150+
slice.geometryNeedsUpdate = true;
151151

152152
} );
153153

@@ -159,15 +159,15 @@ THREE.Volume = function( xLength, yLength, zLength, type, arrayBuffer ) {
159159
*/
160160
var upperThreshold = Infinity;
161161
Object.defineProperty( this, 'upperThreshold', {
162-
get : function() {
162+
get: function () {
163163

164164
return upperThreshold;
165165

166166
},
167-
set : function( value ) {
167+
set: function ( value ) {
168168

169169
upperThreshold = value;
170-
this.sliceList.forEach( function( slice ) {
170+
this.sliceList.forEach( function ( slice ) {
171171

172172
slice.geometryNeedsUpdate = true;
173173

@@ -191,7 +191,7 @@ THREE.Volume = function( xLength, yLength, zLength, type, arrayBuffer ) {
191191

192192
THREE.Volume.prototype = {
193193

194-
constructor : THREE.Volume,
194+
constructor: THREE.Volume,
195195

196196
/**
197197
* @member {Function} getData Shortcut for data[access(i,j,k)]
@@ -201,7 +201,7 @@ THREE.Volume.prototype = {
201201
* @param {number} k Third coordinate
202202
* @returns {number} value in the data array
203203
*/
204-
getData : function( i, j, k ) {
204+
getData: function ( i, j, k ) {
205205

206206
return this.data[ k * this.xLength * this.yLength + j * this.xLength + i ];
207207

@@ -215,7 +215,7 @@ THREE.Volume.prototype = {
215215
* @param {number} k Third coordinate
216216
* @returns {number} index
217217
*/
218-
access : function( i, j, k ) {
218+
access: function ( i, j, k ) {
219219

220220
return k * this.xLength * this.yLength + j * this.xLength + i;
221221

@@ -227,7 +227,7 @@ THREE.Volume.prototype = {
227227
* @param {number} index index of the voxel
228228
* @returns {Array} [x,y,z]
229229
*/
230-
reverseAccess : function( index ) {
230+
reverseAccess: function ( index ) {
231231

232232
var z = Math.floor( index / ( this.yLength * this.xLength ) );
233233
var y = Math.floor( ( index - z * this.yLength * this.xLength ) / this.xLength );
@@ -246,7 +246,7 @@ THREE.Volume.prototype = {
246246
* @param {Object} context You can specify a context in which call the function, default if this Volume
247247
* @returns {THREE.Volume} this
248248
*/
249-
map : function( functionToMap, context ) {
249+
map: function ( functionToMap, context ) {
250250

251251
var length = this.data.length;
252252
context = context || this;
@@ -268,23 +268,23 @@ THREE.Volume.prototype = {
268268
* @param {number} index the index of the slice
269269
* @returns {Object} an object containing all the usefull information on the geometry of the slice
270270
*/
271-
extractPerpendicularPlane : function( axis, RASIndex ) {
271+
extractPerpendicularPlane: function ( axis, RASIndex ) {
272272

273273
var iLength,
274-
jLength,
275-
sliceAccess,
276-
planeMatrix = ( new THREE.Matrix4() ).identity(),
277-
volume = this,
278-
planeWidth,
279-
planeHeight,
280-
firstSpacing,
281-
secondSpacing,
282-
positionOffset,
283-
IJKIndex;
274+
jLength,
275+
sliceAccess,
276+
planeMatrix = ( new THREE.Matrix4() ).identity(),
277+
volume = this,
278+
planeWidth,
279+
planeHeight,
280+
firstSpacing,
281+
secondSpacing,
282+
positionOffset,
283+
IJKIndex;
284284

285285
var axisInIJK = new THREE.Vector3(),
286-
firstDirection = new THREE.Vector3(),
287-
secondDirection = new THREE.Vector3();
286+
firstDirection = new THREE.Vector3(),
287+
secondDirection = new THREE.Vector3();
288288

289289
var dimensions = new THREE.Vector3( this.xLength, this.yLength, this.zLength );
290290

@@ -327,6 +327,7 @@ THREE.Volume.prototype = {
327327
positionOffset = ( volume.RASDimensions[ 2 ] - 1 ) / 2;
328328
planeMatrix.setPosition( new THREE.Vector3( 0, 0, RASIndex - positionOffset ) );
329329
break;
330+
330331
}
331332

332333
firstDirection.applyMatrix4( volume.inverseMatrix ).normalize();
@@ -341,38 +342,38 @@ THREE.Volume.prototype = {
341342

342343
IJKIndex = Math.abs( Math.round( IJKIndex.applyMatrix4( volume.inverseMatrix ).dot( axisInIJK ) ) );
343344
var base = [ new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, 0, 1 ) ];
344-
var iDirection = [ firstDirection, secondDirection, axisInIJK ].find( function( x ) {
345+
var iDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
345346

346347
return Math.abs( x.dot( base[ 0 ] ) ) > 0.9;
347348

348349
} );
349-
var jDirection = [ firstDirection, secondDirection, axisInIJK ].find( function( x ) {
350+
var jDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
350351

351352
return Math.abs( x.dot( base[ 1 ] ) ) > 0.9;
352353

353354
} );
354-
var kDirection = [ firstDirection, secondDirection, axisInIJK ].find( function( x ) {
355+
var kDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
355356

356357
return Math.abs( x.dot( base[ 2 ] ) ) > 0.9;
357358

358359
} );
359360
var argumentsWithInversion = [ 'volume.xLength-1-', 'volume.yLength-1-', 'volume.zLength-1-' ];
360-
var argArray = [ iDirection, jDirection, kDirection ].map( function( direction, n ) {
361+
var argArray = [ iDirection, jDirection, kDirection ].map( function ( direction, n ) {
361362

362-
return ( direction.dot( base[ n ] ) > 0 ? '' : argumentsWithInversion[ n ] ) + ( direction === axisInIJK ? 'IJKIndex' : direction.argVar )
363+
return ( direction.dot( base[ n ] ) > 0 ? '' : argumentsWithInversion[ n ] ) + ( direction === axisInIJK ? 'IJKIndex' : direction.argVar );
363364

364365
} );
365366
var argString = argArray.join( ',' );
366367
sliceAccess = eval( '(function sliceAccess (i,j) {return volume.access( ' + argString + ');})' );
367368

368369

369370
return {
370-
iLength : iLength,
371-
jLength : jLength,
372-
sliceAccess : sliceAccess,
373-
matrix : planeMatrix,
374-
planeWidth : planeWidth,
375-
planeHeight : planeHeight
371+
iLength: iLength,
372+
jLength: jLength,
373+
sliceAccess: sliceAccess,
374+
matrix: planeMatrix,
375+
planeWidth: planeWidth,
376+
planeHeight: planeHeight
376377
};
377378

378379
},
@@ -385,7 +386,7 @@ THREE.Volume.prototype = {
385386
* @param {number} index the index of the slice
386387
* @returns {THREE.VolumeSlice} the extracted slice
387388
*/
388-
extractSlice : function( axis, index ) {
389+
extractSlice: function ( axis, index ) {
389390

390391
var slice = new THREE.VolumeSlice( this, index, axis );
391392
this.sliceList.push( slice );
@@ -399,9 +400,9 @@ THREE.Volume.prototype = {
399400
* @memberof THREE.Volume
400401
* @returns {THREE.Volume} this
401402
*/
402-
repaintAllSlices : function() {
403+
repaintAllSlices: function () {
403404

404-
this.sliceList.forEach( function( slice ) {
405+
this.sliceList.forEach( function ( slice ) {
405406

406407
slice.repaint();
407408

@@ -416,7 +417,7 @@ THREE.Volume.prototype = {
416417
* @memberof THREE.Volume
417418
* @returns {Array} [min,max]
418419
*/
419-
computeMinMax : function() {
420+
computeMinMax: function () {
420421

421422
var min = Infinity;
422423
var max = - Infinity;

examples/js/controls/TransformControls.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ THREE.TransformControls = function ( camera, domElement ) {
511511
x: ( pointer.clientX - rect.left ) / rect.width * 2 - 1,
512512
y: - ( pointer.clientY - rect.top ) / rect.height * 2 + 1,
513513
button: event.button
514-
}
514+
};
515515

516516
}
517517

@@ -604,7 +604,7 @@ THREE.TransformControls = function ( camera, domElement ) {
604604

605605
console.warn( 'THREE.TransformControls: update function has been depricated.' );
606606

607-
}
607+
};
608608

609609
};
610610

examples/js/loaders/MTLLoader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ THREE.MTLLoader.prototype = {
148148
info = { name: value };
149149
materialsInfo[ value ] = info;
150150

151-
} else if ( info ) {
151+
} else {
152152

153153
if ( key === 'ka' || key === 'kd' || key === 'ks' ) {
154154

0 commit comments

Comments
 (0)