From d502d22d0e239bf7f7f4705e1e100a637101e21d Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Sun, 10 Nov 2013 10:21:35 +0000 Subject: [PATCH] Added LightPosition, LightDirection, AmbientColor and LightColor in UniformBinding so they can be referenced and used in the shaderNodes editor. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10884 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/core/com/jme3/material/Material.java | 6 ++++- .../core/com/jme3/shader/UniformBinding.java | 26 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/engine/src/core/com/jme3/material/Material.java b/engine/src/core/com/jme3/material/Material.java index b9830d9f4..73c928e96 100644 --- a/engine/src/core/com/jme3/material/Material.java +++ b/engine/src/core/com/jme3/material/Material.java @@ -794,7 +794,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { case Directional: DirectionalLight dl = (DirectionalLight) l; Vector3f dir = dl.getDirection(); - + //FIXME : there is an inconstencie here due to backward + //compatibility of the lighting shader. + //The directional light direction is passed in the + //LightPosition uniform. The lightinf shader needs to be + //reworked though in order to fix this. tmpLightPosition.set(dir.getX(), dir.getY(), dir.getZ(), -1); lightPos.setValue(VarType.Vector4, tmpLightPosition); tmpLightDirection.set(0, 0, 0, 0); diff --git a/engine/src/core/com/jme3/shader/UniformBinding.java b/engine/src/core/com/jme3/shader/UniformBinding.java index 28fd0c405..3ac5cc0e0 100644 --- a/engine/src/core/com/jme3/shader/UniformBinding.java +++ b/engine/src/core/com/jme3/shader/UniformBinding.java @@ -171,7 +171,31 @@ public enum UniformBinding { * Frames per second. * Type: float */ - FrameRate("float"); + FrameRate("float"), + + /** + * The light position when rendering in multi pass mode + * Type: vec4 + */ + LightDirection("vec4"), + + /** + * The light direction when rendering in multi pass mode + * Type: vec4 + */ + LightPosition("vec4"), + + /** + * Ambient light color + * Type: vec4 + */ + AmbientLightColor("vec4"), + + /** + * The light color when rendering in multi pass mode + * Type: vec4 + */ + LightColor("vec4"); String glslType;