- added a ColorRGBA to tempVars

- Used tempvars in Materila.renderMultipassLighting

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7903 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent 0b7f96726f
commit 310193018d
  1. 11
      engine/src/core/com/jme3/material/Material.java
  2. 6
      engine/src/core/com/jme3/util/TempVars.java

@ -61,6 +61,7 @@ import com.jme3.shader.Uniform;
import com.jme3.shader.VarType; import com.jme3.shader.VarType;
import com.jme3.texture.Texture; import com.jme3.texture.Texture;
import com.jme3.util.ListMap; import com.jme3.util.ListMap;
import com.jme3.util.TempVars;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.EnumSet; import java.util.EnumSet;
@ -698,9 +699,6 @@ public class Material implements Cloneable, Savable, Comparable<Material> {
lightIndex++; lightIndex++;
} }
} }
Quaternion tmpLightDirection = new Quaternion();
Quaternion tmpLightPosition = new Quaternion();
ColorRGBA tmpLightColor = new ColorRGBA();
protected void renderMultipassLighting(Shader shader, Geometry g, Renderer r) { protected void renderMultipassLighting(Shader shader, Geometry g, Renderer r) {
LightList lightList = g.getWorldLightList(); LightList lightList = g.getWorldLightList();
@ -729,6 +727,11 @@ public class Material implements Cloneable, Savable, Comparable<Material> {
isSecondLight = false; isSecondLight = false;
} }
TempVars vars = TempVars.get();
Quaternion tmpLightDirection = vars.quat1;
Quaternion tmpLightPosition = vars.quat2;
ColorRGBA tmpLightColor = vars.color;
ColorRGBA color = l.getColor(); ColorRGBA color = l.getColor();
tmpLightColor.set(color); tmpLightColor.set(color);
tmpLightColor.a = l.getType().getId(); tmpLightColor.a = l.getType().getId();
@ -767,7 +770,7 @@ public class Material implements Cloneable, Savable, Comparable<Material> {
default: default:
throw new UnsupportedOperationException("Unknown type of light: " + l.getType()); throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
} }
vars.release();
r.setShader(shader); r.setShader(shader);
r.renderMesh(g.getMesh(), g.getLodLevel(), 1); r.renderMesh(g.getMesh(), g.getLodLevel(), 1);
} }

@ -32,6 +32,7 @@
package com.jme3.util; package com.jme3.util;
import com.jme3.collision.bih.BIHNode.BIHStackData; import com.jme3.collision.bih.BIHNode.BIHStackData;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Eigen3f; import com.jme3.math.Eigen3f;
import com.jme3.math.Matrix4f; import com.jme3.math.Matrix4f;
import com.jme3.math.Matrix3f; import com.jme3.math.Matrix3f;
@ -160,6 +161,11 @@ public class TempVars {
* Fetching triangle from mesh * Fetching triangle from mesh
*/ */
public final Triangle triangle = new Triangle(); public final Triangle triangle = new Triangle();
/**
* Color
*/
public final ColorRGBA color = new ColorRGBA();
/** /**
* General vectors. * General vectors.
*/ */

Loading…
Cancel
Save