From 56911e28f732ffb54cc5f7230e09a68245ff7c84 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 9 Jan 2012 21:36:37 +0000 Subject: [PATCH] Fixed normal sign in directional light --- .../opengl/src/processing/opengl/PGraphicsOpenGL.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java index 1632350fc..43d3093e5 100644 --- a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -4468,8 +4468,7 @@ public class PGraphicsOpenGL extends PGraphics { lightCount++; } - public void directionalLight(float r, float g, float b, float nx, float ny, - float nz) { + public void directionalLight(float r, float g, float b, float nx, float ny, float nz) { enableLighting(); if (lightCount == MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); @@ -4492,9 +4491,9 @@ public class PGraphicsOpenGL extends PGraphics { // In this case, the normal is used to indicate the direction // of the light, with the w component equals to zero. See // the comments in the lightDirection() method. - lightNormal[lightCount][0] = -nx; - lightNormal[lightCount][1] = -ny; - lightNormal[lightCount][2] = -nz; + lightNormal[lightCount][0] = nx; + lightNormal[lightCount][1] = ny; + lightNormal[lightCount][2] = nz; lightNormal[lightCount][3] = 0.0f; lightEnable(lightCount);