Skip to content

Commit e12350e

Browse files
committed
Merge branch 'dev-es6-materials' into dev
2 parents 8000053 + a21b664 commit e12350e

24 files changed

+1065
-1071
lines changed

examples/jsm/lines/LineMaterial.js

Lines changed: 79 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -247,177 +247,170 @@ ShaderLib[ 'line' ] = {
247247
`
248248
};
249249

250-
var LineMaterial = function ( parameters ) {
250+
class LineMaterial extends ShaderMaterial {
251251

252-
ShaderMaterial.call( this, {
252+
constructor( parameters ) {
253253

254-
type: 'LineMaterial',
254+
super( {
255255

256-
uniforms: UniformsUtils.clone( ShaderLib[ 'line' ].uniforms ),
256+
type: 'LineMaterial',
257257

258-
vertexShader: ShaderLib[ 'line' ].vertexShader,
259-
fragmentShader: ShaderLib[ 'line' ].fragmentShader,
258+
uniforms: UniformsUtils.clone( ShaderLib[ 'line' ].uniforms ),
260259

261-
clipping: true // required for clipping support
260+
vertexShader: ShaderLib[ 'line' ].vertexShader,
261+
fragmentShader: ShaderLib[ 'line' ].fragmentShader,
262262

263-
} );
263+
clipping: true // required for clipping support
264264

265-
this.dashed = false;
265+
} );
266266

267-
Object.defineProperties( this, {
267+
this.dashed = false;
268268

269-
color: {
269+
Object.defineProperties( this, {
270270

271-
enumerable: true,
271+
color: {
272272

273-
get: function () {
273+
enumerable: true,
274274

275-
return this.uniforms.diffuse.value;
275+
get: function () {
276276

277-
},
278-
279-
set: function ( value ) {
280-
281-
this.uniforms.diffuse.value = value;
282-
283-
}
284-
285-
},
277+
return this.uniforms.diffuse.value;
286278

287-
linewidth: {
279+
},
288280

289-
enumerable: true,
281+
set: function ( value ) {
290282

291-
get: function () {
283+
this.uniforms.diffuse.value = value;
292284

293-
return this.uniforms.linewidth.value;
285+
}
294286

295287
},
296288

297-
set: function ( value ) {
289+
linewidth: {
298290

299-
this.uniforms.linewidth.value = value;
291+
enumerable: true,
300292

301-
}
293+
get: function () {
302294

303-
},
295+
return this.uniforms.linewidth.value;
304296

305-
dashScale: {
297+
},
306298

307-
enumerable: true,
299+
set: function ( value ) {
308300

309-
get: function () {
301+
this.uniforms.linewidth.value = value;
310302

311-
return this.uniforms.dashScale.value;
303+
}
312304

313305
},
314306

315-
set: function ( value ) {
307+
dashScale: {
316308

317-
this.uniforms.dashScale.value = value;
309+
enumerable: true,
318310

319-
}
311+
get: function () {
320312

321-
},
313+
return this.uniforms.dashScale.value;
322314

323-
dashSize: {
315+
},
324316

325-
enumerable: true,
317+
set: function ( value ) {
326318

327-
get: function () {
319+
this.uniforms.dashScale.value = value;
328320

329-
return this.uniforms.dashSize.value;
321+
}
330322

331323
},
332324

333-
set: function ( value ) {
325+
dashSize: {
334326

335-
this.uniforms.dashSize.value = value;
327+
enumerable: true,
336328

337-
}
329+
get: function () {
338330

339-
},
331+
return this.uniforms.dashSize.value;
340332

341-
dashOffset: {
333+
},
342334

343-
enumerable: true,
335+
set: function ( value ) {
344336

345-
get: function () {
337+
this.uniforms.dashSize.value = value;
346338

347-
return this.uniforms.dashOffset.value;
339+
}
348340

349341
},
350342

351-
set: function ( value ) {
343+
dashOffset: {
352344

353-
this.uniforms.dashOffset.value = value;
345+
enumerable: true,
354346

355-
}
347+
get: function () {
356348

357-
},
349+
return this.uniforms.dashOffset.value;
358350

359-
gapSize: {
351+
},
360352

361-
enumerable: true,
353+
set: function ( value ) {
362354

363-
get: function () {
355+
this.uniforms.dashOffset.value = value;
364356

365-
return this.uniforms.gapSize.value;
357+
}
366358

367359
},
368360

369-
set: function ( value ) {
361+
gapSize: {
370362

371-
this.uniforms.gapSize.value = value;
363+
set: function ( value ) {
372364

373-
}
365+
this.uniforms.gapSize.value = value;
374366

375-
},
367+
}
376368

377-
opacity: {
369+
},
378370

379-
enumerable: true,
371+
opacity: {
380372

381-
get: function () {
373+
enumerable: true,
382374

383-
return this.uniforms.opacity.value;
375+
get: function () {
384376

385-
},
377+
return this.uniforms.opacity.value;
386378

387-
set: function ( value ) {
379+
},
388380

389-
this.uniforms.opacity.value = value;
381+
set: function ( value ) {
390382

391-
}
383+
this.uniforms.opacity.value = value;
384+
385+
}
392386

393-
},
387+
},
394388

395-
resolution: {
389+
resolution: {
396390

397-
enumerable: true,
391+
enumerable: true,
398392

399-
get: function () {
393+
get: function () {
400394

401-
return this.uniforms.resolution.value;
395+
return this.uniforms.resolution.value;
402396

403-
},
397+
},
404398

405-
set: function ( value ) {
399+
set: function ( value ) {
406400

407-
this.uniforms.resolution.value.copy( value );
401+
this.uniforms.resolution.value.copy( value );
408402

409-
}
403+
}
410404

411-
}
405+
}
412406

413-
} );
407+
} );
414408

415-
this.setValues( parameters );
409+
this.setValues( parameters );
416410

417-
};
411+
}
418412

419-
LineMaterial.prototype = Object.create( ShaderMaterial.prototype );
420-
LineMaterial.prototype.constructor = LineMaterial;
413+
}
421414

422415
LineMaterial.prototype.isLineMaterial = true;
423416

examples/jsm/nodes/materials/MeshStandardNodeMaterial.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ import { MeshStandardNode } from './nodes/MeshStandardNode.js';
22
import { NodeMaterial } from './NodeMaterial.js';
33
import { NodeUtils } from '../core/NodeUtils.js';
44

5-
function MeshStandardNodeMaterial() {
5+
class MeshStandardNodeMaterial extends NodeMaterial {
66

7-
var node = new MeshStandardNode();
7+
constructor() {
88

9-
NodeMaterial.call( this, node, node );
9+
var node = new MeshStandardNode();
1010

11-
this.type = 'MeshStandardNodeMaterial';
11+
super( node, node );
1212

13-
}
13+
this.type = 'MeshStandardNodeMaterial';
14+
15+
}
1416

15-
MeshStandardNodeMaterial.prototype = Object.create( NodeMaterial.prototype );
16-
MeshStandardNodeMaterial.prototype.constructor = MeshStandardNodeMaterial;
17+
}
1718

1819
NodeUtils.addShortcuts( MeshStandardNodeMaterial.prototype, 'properties', [
1920
'color',

0 commit comments

Comments
 (0)