diff --git a/jme3-core/src/main/java/com/jme3/material/MatParam.java b/jme3-core/src/main/java/com/jme3/material/MatParam.java index 9088b5b47..b94e40fc9 100644 --- a/jme3-core/src/main/java/com/jme3/material/MatParam.java +++ b/jme3-core/src/main/java/com/jme3/material/MatParam.java @@ -130,10 +130,7 @@ public class MatParam implements Savable, Cloneable { } void apply(Renderer r, Technique technique) { - TechniqueDef techDef = technique.getDef(); - if (techDef.isUsingShaders()) { - technique.updateUniformParam(getPrefixedName(), getVarType(), getValue()); - } + technique.updateUniformParam(getPrefixedName(), getVarType(), getValue()); } /** @@ -343,6 +340,10 @@ When arrays can be inserted in J3M files @Override public String toString() { - return type.name() + " " + name + " : " + getValueAsString(); + if (value != null) { + return type.name() + " " + name + " : " + getValueAsString(); + } else { + return type.name() + " " + name; + } } } diff --git a/jme3-core/src/main/java/com/jme3/material/MatParamTexture.java b/jme3-core/src/main/java/com/jme3/material/MatParamTexture.java index 1a211b475..b24d27a95 100644 --- a/jme3-core/src/main/java/com/jme3/material/MatParamTexture.java +++ b/jme3-core/src/main/java/com/jme3/material/MatParamTexture.java @@ -110,9 +110,7 @@ public class MatParamTexture extends MatParam { public void apply(Renderer r, Technique technique) { TechniqueDef techDef = technique.getDef(); r.setTexture(getUnit(), getTextureValue()); - if (techDef.isUsingShaders()) { - technique.updateUniformParam(getPrefixedName(), getVarType(), getUnit()); - } + technique.updateUniformParam(getPrefixedName(), getVarType(), getUnit()); } @Override diff --git a/jme3-core/src/main/java/com/jme3/material/Material.java b/jme3-core/src/main/java/com/jme3/material/Material.java index 157b12922..e97f06779 100644 --- a/jme3-core/src/main/java/com/jme3/material/Material.java +++ b/jme3-core/src/main/java/com/jme3/material/Material.java @@ -150,7 +150,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { /** * This method sets the name of the material. * The name is not the same as the asset name. - * It can be null and there is no guarantee of its uniqness. + * It can be null and there is no guarantee of its uniqueness. * @param name the name of the material */ public void setName(String name) { @@ -1060,18 +1060,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { MatParamTexture texParam = (MatParamTexture) param; r.setTexture(0, texParam.getTextureValue()); } else { - if (!techDef.isUsingShaders()) { - continue; - } - technique.updateUniformParam(param.getName(), param.getVarType(), param.getValue()); } } - Shader shader = technique.getShader(); - if (techDef.isUsingShaders()) { - r.setShader(shader); - } + r.setShader(technique.getShader()); } private void clearUniformsSetByCurrent(Shader shader) { @@ -1182,11 +1175,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { // update camera and world matrices // NOTE: setWorldTransform should have been called already - if (techDef.isUsingShaders()) { - // reset unchanged uniform flag - clearUniformsSetByCurrent(technique.getShader()); - rm.updateUniformBindings(technique.getWorldBindUniforms()); - } + + // reset unchanged uniform flag + clearUniformsSetByCurrent(technique.getShader()); + rm.updateUniformBindings(technique.getWorldBindUniforms()); + // setup textures and uniforms for (int i = 0; i < paramValues.size(); i++) { @@ -1220,12 +1213,10 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { } // upload and bind shader - if (techDef.isUsingShaders()) { - // any unset uniforms will be set to 0 - resetUniformsNotSetByCurrent(shader); - r.setShader(shader); - } - + // any unset uniforms will be set to 0 + resetUniformsNotSetByCurrent(shader); + r.setShader(shader); + renderMeshFromGeometry(r, geom); } diff --git a/jme3-core/src/main/java/com/jme3/material/Technique.java b/jme3-core/src/main/java/com/jme3/material/Technique.java index 024311551..ba2bc72f9 100644 --- a/jme3-core/src/main/java/com/jme3/material/Technique.java +++ b/jme3-core/src/main/java/com/jme3/material/Technique.java @@ -63,10 +63,8 @@ public class Technique /* implements Savable */ { public Technique(Material owner, TechniqueDef def) { this.owner = owner; this.def = def; - if (def.isUsingShaders()) { - this.worldBindUniforms = new ArrayList(); - this.defines = new DefineList(); - } + this.worldBindUniforms = new ArrayList(); + this.defines = new DefineList(); } /** @@ -173,22 +171,16 @@ public class Technique /* implements Savable */ { * @param assetManager The asset manager to use for loading shaders. */ public void makeCurrent(AssetManager assetManager, boolean techniqueSwitched, EnumSet rendererCaps, RenderManager rm) { - if (!def.isUsingShaders()) { - // No shaders are used, no processing is neccessary. - return; - } - if (techniqueSwitched) { if (defines.update(owner.getParamsMap(), def)) { needReload = true; } - if(getDef().getLightMode()== TechniqueDef.LightMode.SinglePass){ + if (getDef().getLightMode() == TechniqueDef.LightMode.SinglePass) { defines.set("SINGLE_PASS_LIGHTING", VarType.Boolean, true); - defines.set("NB_LIGHTS", VarType.Int, rm.getSinglePassLightBatchSize()*3 ); - }else{ + defines.set("NB_LIGHTS", VarType.Int, rm.getSinglePassLightBatchSize() * 3); + } else { defines.set("SINGLE_PASS_LIGHTING", VarType.Boolean, null); } - } if (needReload) { diff --git a/jme3-core/src/main/java/com/jme3/material/TechniqueDef.java b/jme3-core/src/main/java/com/jme3/material/TechniqueDef.java index 9c4a74257..1336442fa 100644 --- a/jme3-core/src/main/java/com/jme3/material/TechniqueDef.java +++ b/jme3-core/src/main/java/com/jme3/material/TechniqueDef.java @@ -208,12 +208,9 @@ public class TechniqueDef implements Savable { } /** - * Returns true if this technique uses shaders, false otherwise. - * - * @return true if this technique uses shaders, false otherwise. - * - * @see #setShaderFile(java.lang.String, java.lang.String, java.lang.String) + * @deprecated jME3 always requires shaders now */ + @Deprecated public boolean isUsingShaders(){ return usesShaders; }