|  | 
| 264 | 264 | 		` | 
| 265 | 265 | 	}; | 
| 266 | 266 | 
 | 
| 267 |  | -	var LineMaterial = function ( parameters ) { | 
|  | 267 | +	class LineMaterial extends THREE.ShaderMaterial { | 
| 268 | 268 | 
 | 
| 269 |  | -		THREE.ShaderMaterial.call( this, { | 
| 270 |  | -			type: 'LineMaterial', | 
| 271 |  | -			uniforms: THREE.UniformsUtils.clone( THREE.ShaderLib[ 'line' ].uniforms ), | 
| 272 |  | -			vertexShader: THREE.ShaderLib[ 'line' ].vertexShader, | 
| 273 |  | -			fragmentShader: THREE.ShaderLib[ 'line' ].fragmentShader, | 
| 274 |  | -			clipping: true // required for clipping support | 
|  | 269 | +		constructor( parameters ) { | 
| 275 | 270 | 
 | 
| 276 |  | -		} ); | 
| 277 |  | -		this.dashed = false; | 
| 278 |  | -		Object.defineProperties( this, { | 
| 279 |  | -			color: { | 
| 280 |  | -				enumerable: true, | 
| 281 |  | -				get: function () { | 
|  | 271 | +			super( { | 
|  | 272 | +				type: 'LineMaterial', | 
|  | 273 | +				uniforms: THREE.UniformsUtils.clone( THREE.ShaderLib[ 'line' ].uniforms ), | 
|  | 274 | +				vertexShader: THREE.ShaderLib[ 'line' ].vertexShader, | 
|  | 275 | +				fragmentShader: THREE.ShaderLib[ 'line' ].fragmentShader, | 
|  | 276 | +				clipping: true // required for clipping support | 
| 282 | 277 | 
 | 
| 283 |  | -					return this.uniforms.diffuse.value; | 
|  | 278 | +			} ); | 
|  | 279 | +			this.dashed = false; | 
|  | 280 | +			Object.defineProperties( this, { | 
|  | 281 | +				color: { | 
|  | 282 | +					enumerable: true, | 
|  | 283 | +					get: function () { | 
| 284 | 284 | 
 | 
| 285 |  | -				}, | 
| 286 |  | -				set: function ( value ) { | 
| 287 |  | - | 
| 288 |  | -					this.uniforms.diffuse.value = value; | 
|  | 285 | +						return this.uniforms.diffuse.value; | 
| 289 | 286 | 
 | 
| 290 |  | -				} | 
| 291 |  | -			}, | 
| 292 |  | -			linewidth: { | 
| 293 |  | -				enumerable: true, | 
| 294 |  | -				get: function () { | 
|  | 287 | +					}, | 
|  | 288 | +					set: function ( value ) { | 
| 295 | 289 | 
 | 
| 296 |  | -					return this.uniforms.linewidth.value; | 
|  | 290 | +						this.uniforms.diffuse.value = value; | 
| 297 | 291 | 
 | 
|  | 292 | +					} | 
| 298 | 293 | 				}, | 
| 299 |  | -				set: function ( value ) { | 
|  | 294 | +				linewidth: { | 
|  | 295 | +					enumerable: true, | 
|  | 296 | +					get: function () { | 
| 300 | 297 | 
 | 
| 301 |  | -					this.uniforms.linewidth.value = value; | 
|  | 298 | +						return this.uniforms.linewidth.value; | 
| 302 | 299 | 
 | 
| 303 |  | -				} | 
| 304 |  | -			}, | 
| 305 |  | -			dashScale: { | 
| 306 |  | -				enumerable: true, | 
| 307 |  | -				get: function () { | 
|  | 300 | +					}, | 
|  | 301 | +					set: function ( value ) { | 
| 308 | 302 | 
 | 
| 309 |  | -					return this.uniforms.dashScale.value; | 
|  | 303 | +						this.uniforms.linewidth.value = value; | 
| 310 | 304 | 
 | 
|  | 305 | +					} | 
| 311 | 306 | 				}, | 
| 312 |  | -				set: function ( value ) { | 
|  | 307 | +				dashScale: { | 
|  | 308 | +					enumerable: true, | 
|  | 309 | +					get: function () { | 
| 313 | 310 | 
 | 
| 314 |  | -					this.uniforms.dashScale.value = value; | 
|  | 311 | +						return this.uniforms.dashScale.value; | 
| 315 | 312 | 
 | 
| 316 |  | -				} | 
| 317 |  | -			}, | 
| 318 |  | -			dashSize: { | 
| 319 |  | -				enumerable: true, | 
| 320 |  | -				get: function () { | 
|  | 313 | +					}, | 
|  | 314 | +					set: function ( value ) { | 
| 321 | 315 | 
 | 
| 322 |  | -					return this.uniforms.dashSize.value; | 
|  | 316 | +						this.uniforms.dashScale.value = value; | 
| 323 | 317 | 
 | 
|  | 318 | +					} | 
| 324 | 319 | 				}, | 
| 325 |  | -				set: function ( value ) { | 
|  | 320 | +				dashSize: { | 
|  | 321 | +					enumerable: true, | 
|  | 322 | +					get: function () { | 
| 326 | 323 | 
 | 
| 327 |  | -					this.uniforms.dashSize.value = value; | 
|  | 324 | +						return this.uniforms.dashSize.value; | 
| 328 | 325 | 
 | 
| 329 |  | -				} | 
| 330 |  | -			}, | 
| 331 |  | -			dashOffset: { | 
| 332 |  | -				enumerable: true, | 
| 333 |  | -				get: function () { | 
|  | 326 | +					}, | 
|  | 327 | +					set: function ( value ) { | 
| 334 | 328 | 
 | 
| 335 |  | -					return this.uniforms.dashOffset.value; | 
|  | 329 | +						this.uniforms.dashSize.value = value; | 
| 336 | 330 | 
 | 
|  | 331 | +					} | 
| 337 | 332 | 				}, | 
| 338 |  | -				set: function ( value ) { | 
|  | 333 | +				dashOffset: { | 
|  | 334 | +					enumerable: true, | 
|  | 335 | +					get: function () { | 
| 339 | 336 | 
 | 
| 340 |  | -					this.uniforms.dashOffset.value = value; | 
|  | 337 | +						return this.uniforms.dashOffset.value; | 
| 341 | 338 | 
 | 
| 342 |  | -				} | 
| 343 |  | -			}, | 
| 344 |  | -			gapSize: { | 
| 345 |  | -				enumerable: true, | 
| 346 |  | -				get: function () { | 
|  | 339 | +					}, | 
|  | 340 | +					set: function ( value ) { | 
| 347 | 341 | 
 | 
| 348 |  | -					return this.uniforms.gapSize.value; | 
|  | 342 | +						this.uniforms.dashOffset.value = value; | 
| 349 | 343 | 
 | 
|  | 344 | +					} | 
| 350 | 345 | 				}, | 
| 351 |  | -				set: function ( value ) { | 
|  | 346 | +				gapSize: { | 
|  | 347 | +					enumerable: true, | 
|  | 348 | +					get: function () { | 
| 352 | 349 | 
 | 
| 353 |  | -					this.uniforms.gapSize.value = value; | 
|  | 350 | +						return this.uniforms.gapSize.value; | 
| 354 | 351 | 
 | 
| 355 |  | -				} | 
| 356 |  | -			}, | 
| 357 |  | -			opacity: { | 
| 358 |  | -				enumerable: true, | 
| 359 |  | -				get: function () { | 
|  | 352 | +					}, | 
|  | 353 | +					set: function ( value ) { | 
| 360 | 354 | 
 | 
| 361 |  | -					return this.uniforms.opacity.value; | 
|  | 355 | +						this.uniforms.gapSize.value = value; | 
| 362 | 356 | 
 | 
|  | 357 | +					} | 
| 363 | 358 | 				}, | 
| 364 |  | -				set: function ( value ) { | 
|  | 359 | +				opacity: { | 
|  | 360 | +					enumerable: true, | 
|  | 361 | +					get: function () { | 
| 365 | 362 | 
 | 
| 366 |  | -					this.uniforms.opacity.value = value; | 
|  | 363 | +						return this.uniforms.opacity.value; | 
| 367 | 364 | 
 | 
| 368 |  | -				} | 
| 369 |  | -			}, | 
| 370 |  | -			resolution: { | 
| 371 |  | -				enumerable: true, | 
| 372 |  | -				get: function () { | 
|  | 365 | +					}, | 
|  | 366 | +					set: function ( value ) { | 
| 373 | 367 | 
 | 
| 374 |  | -					return this.uniforms.resolution.value; | 
|  | 368 | +						this.uniforms.opacity.value = value; | 
| 375 | 369 | 
 | 
|  | 370 | +					} | 
| 376 | 371 | 				}, | 
| 377 |  | -				set: function ( value ) { | 
|  | 372 | +				resolution: { | 
|  | 373 | +					enumerable: true, | 
|  | 374 | +					get: function () { | 
| 378 | 375 | 
 | 
| 379 |  | -					this.uniforms.resolution.value.copy( value ); | 
|  | 376 | +						return this.uniforms.resolution.value; | 
| 380 | 377 | 
 | 
| 381 |  | -				} | 
| 382 |  | -			}, | 
| 383 |  | -			alphaToCoverage: { | 
| 384 |  | -				enumerable: true, | 
| 385 |  | -				get: function () { | 
|  | 378 | +					}, | 
|  | 379 | +					set: function ( value ) { | 
| 386 | 380 | 
 | 
| 387 |  | -					return Boolean( 'ALPHA_TO_COVERAGE' in this.defines ); | 
|  | 381 | +						this.uniforms.resolution.value.copy( value ); | 
| 388 | 382 | 
 | 
|  | 383 | +					} | 
| 389 | 384 | 				}, | 
| 390 |  | -				set: function ( value ) { | 
|  | 385 | +				alphaToCoverage: { | 
|  | 386 | +					enumerable: true, | 
|  | 387 | +					get: function () { | 
| 391 | 388 | 
 | 
| 392 |  | -					if ( Boolean( value ) !== Boolean( 'ALPHA_TO_COVERAGE' in this.defines ) ) { | 
|  | 389 | +						return Boolean( 'ALPHA_TO_COVERAGE' in this.defines ); | 
| 393 | 390 | 
 | 
| 394 |  | -						this.needsUpdate = true; | 
|  | 391 | +					}, | 
|  | 392 | +					set: function ( value ) { | 
| 395 | 393 | 
 | 
| 396 |  | -					} | 
|  | 394 | +						if ( Boolean( value ) !== Boolean( 'ALPHA_TO_COVERAGE' in this.defines ) ) { | 
| 397 | 395 | 
 | 
| 398 |  | -					if ( value ) { | 
|  | 396 | +							this.needsUpdate = true; | 
| 399 | 397 | 
 | 
| 400 |  | -						this.defines.ALPHA_TO_COVERAGE = ''; | 
| 401 |  | -						this.extensions.derivatives = true; | 
|  | 398 | +						} | 
| 402 | 399 | 
 | 
| 403 |  | -					} else { | 
|  | 400 | +						if ( value ) { | 
| 404 | 401 | 
 | 
| 405 |  | -						delete this.defines.ALPHA_TO_COVERAGE; | 
| 406 |  | -						this.extensions.derivatives = false; | 
|  | 402 | +							this.defines.ALPHA_TO_COVERAGE = ''; | 
|  | 403 | +							this.extensions.derivatives = true; | 
| 407 | 404 | 
 | 
| 408 |  | -					} | 
|  | 405 | +						} else { | 
|  | 406 | + | 
|  | 407 | +							delete this.defines.ALPHA_TO_COVERAGE; | 
|  | 408 | +							this.extensions.derivatives = false; | 
| 409 | 409 | 
 | 
|  | 410 | +						} | 
|  | 411 | + | 
|  | 412 | +					} | 
| 410 | 413 | 				} | 
| 411 |  | -			} | 
| 412 |  | -		} ); | 
| 413 |  | -		this.setValues( parameters ); | 
|  | 414 | +			} ); | 
|  | 415 | +			this.setValues( parameters ); | 
| 414 | 416 | 
 | 
| 415 |  | -	}; | 
|  | 417 | +		} | 
|  | 418 | + | 
|  | 419 | +	} | 
| 416 | 420 | 
 | 
| 417 |  | -	LineMaterial.prototype = Object.create( THREE.ShaderMaterial.prototype ); | 
| 418 |  | -	LineMaterial.prototype.constructor = LineMaterial; | 
| 419 | 421 | 	LineMaterial.prototype.isLineMaterial = true; | 
| 420 | 422 | 
 | 
| 421 | 423 | 	THREE.LineMaterial = LineMaterial; | 
|  | 
0 commit comments