Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions examples/js/nodes/accessors/NormalNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,26 @@ NormalNode.prototype.generate = function ( builder, output ) {

case NormalNode.LOCAL:

builder.requires.normal = true;
// to use vObjectNormal as vertex normal
//builder.requires.normal = true;

result = 'normal';

break;

case NormalNode.WORLD:

builder.requires.worldNormal = true;
if ( builder.isShader( 'vertex' ) ) {

result = builder.isShader( 'vertex' ) ? '( modelMatrix * vec4( objectNormal, 0.0 ) ).xyz' : 'vWNormal';
return '( modelMatrix * vec4( objectNormal, 0.0 ) ).xyz';

} else {

builder.requires.worldNormal = true;

result = 'vWNormal';

}

break;

Expand Down
24 changes: 20 additions & 4 deletions examples/js/nodes/accessors/PositionNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,33 @@ PositionNode.prototype.generate = function ( builder, output ) {

case PositionNode.LOCAL:

builder.requires.position = true;
if ( builder.isShader( 'vertex' ) ) {

result = builder.isShader( 'vertex' ) ? 'transformed' : 'vPosition';
result = 'transformed';

} else {

builder.requires.position = true;

result = 'vPosition';

}

break;

case PositionNode.WORLD:

builder.requires.worldPosition = true;
if ( builder.isShader( 'vertex' ) ) {

return '( modelMatrix * vec4( transformed, 1.0 ) ).xyz';

} else {

builder.requires.worldPosition = true;

result = 'vWPosition';

result = 'vWPosition';
}

break;

Expand Down
11 changes: 7 additions & 4 deletions examples/js/nodes/accessors/ResolutionNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ function ResolutionNode() {

Vector2Node.call( this );

this.size = new THREE.Vector2();

}

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

if ( frame.renderer ) {

var size = frame.renderer.getSize(),
pixelRatio = frame.renderer.getPixelRatio();
frame.renderer.getSize( this.size );

var pixelRatio = frame.renderer.getPixelRatio();

this.x = size.width * pixelRatio;
this.y = size.height * pixelRatio;
this.x = this.size.width * pixelRatio;
this.y = this.size.height * pixelRatio;

} else {

Expand Down
Binary file modified examples/models/sea3d/morph.sea
Binary file not shown.
Binary file modified examples/models/sea3d/morph.tjs.sea
Binary file not shown.
8 changes: 5 additions & 3 deletions examples/webgl_materials_nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@

// apply material

mtl.side = THREE.DoubleSide;
mtl.side = defaultSide;
mtl.needsUpdate = true;

mesh.material = mtl;
Expand Down Expand Up @@ -766,6 +766,8 @@

mtl = new THREE.PhongNodeMaterial();

defaultSide = THREE.FrontSide;

var intensity = 1.3;
var power = new THREE.FloatNode( 3 );
var color = new THREE.ColorNode( 0xFFFFFF );
Expand Down Expand Up @@ -1538,6 +1540,8 @@

mtl = new THREE.PhongNodeMaterial();

defaultSide = THREE.FrontSide;

var time = new THREE.TimerNode();
var uv = new THREE.UVNode();

Expand Down Expand Up @@ -1577,8 +1581,6 @@
mtl.environment = new THREE.ColorNode( 0xFFFFFF );
mtl.alpha = clouds;

defaultSide = THREE.FrontSide;

// GUI

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