Skip to content

Commit ec325de

Browse files
authored
Merge pull request #16231 from sunag/dev-fix-warnings
fix warnings sea3d and nodematerials
2 parents 04c4fb0 + 2f367c4 commit ec325de

File tree

6 files changed

+44
-14
lines changed

6 files changed

+44
-14
lines changed

examples/js/nodes/accessors/NormalNode.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,26 @@ NormalNode.prototype.generate = function ( builder, output ) {
4343

4444
case NormalNode.LOCAL:
4545

46-
builder.requires.normal = true;
46+
// to use vObjectNormal as vertex normal
47+
//builder.requires.normal = true;
4748

4849
result = 'normal';
4950

5051
break;
5152

5253
case NormalNode.WORLD:
5354

54-
builder.requires.worldNormal = true;
55+
if ( builder.isShader( 'vertex' ) ) {
5556

56-
result = builder.isShader( 'vertex' ) ? '( modelMatrix * vec4( objectNormal, 0.0 ) ).xyz' : 'vWNormal';
57+
return '( modelMatrix * vec4( objectNormal, 0.0 ) ).xyz';
58+
59+
} else {
60+
61+
builder.requires.worldNormal = true;
62+
63+
result = 'vWNormal';
64+
65+
}
5766

5867
break;
5968

examples/js/nodes/accessors/PositionNode.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,33 @@ PositionNode.prototype.generate = function ( builder, output ) {
5959

6060
case PositionNode.LOCAL:
6161

62-
builder.requires.position = true;
62+
if ( builder.isShader( 'vertex' ) ) {
6363

64-
result = builder.isShader( 'vertex' ) ? 'transformed' : 'vPosition';
64+
result = 'transformed';
65+
66+
} else {
67+
68+
builder.requires.position = true;
69+
70+
result = 'vPosition';
71+
72+
}
6573

6674
break;
6775

6876
case PositionNode.WORLD:
6977

70-
builder.requires.worldPosition = true;
78+
if ( builder.isShader( 'vertex' ) ) {
79+
80+
return '( modelMatrix * vec4( transformed, 1.0 ) ).xyz';
81+
82+
} else {
83+
84+
builder.requires.worldPosition = true;
85+
86+
result = 'vWPosition';
7187

72-
result = 'vWPosition';
88+
}
7389

7490
break;
7591

examples/js/nodes/accessors/ResolutionNode.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ function ResolutionNode() {
88

99
Vector2Node.call( this );
1010

11+
this.size = new THREE.Vector2();
12+
1113
}
1214

1315
ResolutionNode.prototype = Object.create( Vector2Node.prototype );
@@ -18,11 +20,12 @@ ResolutionNode.prototype.updateFrame = function ( frame ) {
1820

1921
if ( frame.renderer ) {
2022

21-
var size = frame.renderer.getSize(),
22-
pixelRatio = frame.renderer.getPixelRatio();
23+
frame.renderer.getSize( this.size );
24+
25+
var pixelRatio = frame.renderer.getPixelRatio();
2326

24-
this.x = size.width * pixelRatio;
25-
this.y = size.height * pixelRatio;
27+
this.x = this.size.width * pixelRatio;
28+
this.y = this.size.height * pixelRatio;
2629

2730
} else {
2831

examples/models/sea3d/morph.sea

70 Bytes
Binary file not shown.
355 Bytes
Binary file not shown.

examples/webgl_materials_nodes.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@
455455

456456
// apply material
457457

458-
mtl.side = THREE.DoubleSide;
458+
mtl.side = defaultSide;
459459
mtl.needsUpdate = true;
460460

461461
mesh.material = mtl;
@@ -766,6 +766,8 @@
766766

767767
mtl = new THREE.PhongNodeMaterial();
768768

769+
defaultSide = THREE.FrontSide;
770+
769771
var intensity = 1.3;
770772
var power = new THREE.FloatNode( 3 );
771773
var color = new THREE.ColorNode( 0xFFFFFF );
@@ -1538,6 +1540,8 @@
15381540

15391541
mtl = new THREE.PhongNodeMaterial();
15401542

1543+
defaultSide = THREE.FrontSide;
1544+
15411545
var time = new THREE.TimerNode();
15421546
var uv = new THREE.UVNode();
15431547

@@ -1577,8 +1581,6 @@
15771581
mtl.environment = new THREE.ColorNode( 0xFFFFFF );
15781582
mtl.alpha = clouds;
15791583

1580-
defaultSide = THREE.FrontSide;
1581-
15821584
// GUI
15831585

15841586
addGui( 'color', mtl.environment.value.getHex(), function ( val ) {

0 commit comments

Comments
 (0)