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
experimental
rem..om 11 years ago
parent 15e379c8f1
commit d502d22d0e
  1. 6
      engine/src/core/com/jme3/material/Material.java
  2. 26
      engine/src/core/com/jme3/shader/UniformBinding.java

@ -794,7 +794,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
case Directional: case Directional:
DirectionalLight dl = (DirectionalLight) l; DirectionalLight dl = (DirectionalLight) l;
Vector3f dir = dl.getDirection(); 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); tmpLightPosition.set(dir.getX(), dir.getY(), dir.getZ(), -1);
lightPos.setValue(VarType.Vector4, tmpLightPosition); lightPos.setValue(VarType.Vector4, tmpLightPosition);
tmpLightDirection.set(0, 0, 0, 0); tmpLightDirection.set(0, 0, 0, 0);

@ -171,7 +171,31 @@ public enum UniformBinding {
* Frames per second. * Frames per second.
* Type: float * 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; String glslType;

Loading…
Cancel
Save