Skip to content

Commit

Permalink
fix worldNormal mrdoob#17360
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag committed Aug 27, 2019
1 parent c3476e8 commit 179586f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/jsm/nodes/accessors/NormalNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import { TempNode } from '../core/TempNode.js';
import { NodeLib } from '../core/NodeLib.js';
import { ReflectNode } from './ReflectNode.js';

function NormalNode( scope ) {

Expand Down Expand Up @@ -33,7 +34,7 @@ NormalNode.prototype.generate = function ( builder, output ) {

case NormalNode.VIEW:

result = builder.isShader( 'vertex' ) ? 'objectNormal' : 'geometryNormal';
result = builder.isShader( 'vertex' ) ? 'transformedNormal' : 'geometryNormal';

break;

Expand Down Expand Up @@ -61,9 +62,11 @@ NormalNode.prototype.generate = function ( builder, output ) {

case NormalNode.WORLD:

var reflectVec = new ReflectNode( ReflectNode.VECTOR ).build( builder, 'v3' );

builder.addVaryNodeCode( this, 'varying vec3 vWNormal;' );

setVaryCode = 'vWNormal = ( modelMatrix * vec4( objectNormal, 0.0 ) ).xyz;';
setVaryCode = `vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;`;

if ( builder.isShader( 'vertex' ) ) {

Expand Down

0 comments on commit 179586f

Please sign in to comment.