Deprecate TechniqueDef.isUsingShaders(). Do not use it anywhere in the engine.
This commit is contained in:
parent
4db0acaca9
commit
a7517c17c0
@ -130,10 +130,7 @@ public class MatParam implements Savable, Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void apply(Renderer r, Technique technique) {
|
void apply(Renderer r, Technique technique) {
|
||||||
TechniqueDef techDef = technique.getDef();
|
technique.updateUniformParam(getPrefixedName(), getVarType(), getValue());
|
||||||
if (techDef.isUsingShaders()) {
|
|
||||||
technique.updateUniformParam(getPrefixedName(), getVarType(), getValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -343,6 +340,10 @@ When arrays can be inserted in J3M files
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return type.name() + " " + name + " : " + getValueAsString();
|
if (value != null) {
|
||||||
|
return type.name() + " " + name + " : " + getValueAsString();
|
||||||
|
} else {
|
||||||
|
return type.name() + " " + name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,9 +110,7 @@ public class MatParamTexture extends MatParam {
|
|||||||
public void apply(Renderer r, Technique technique) {
|
public void apply(Renderer r, Technique technique) {
|
||||||
TechniqueDef techDef = technique.getDef();
|
TechniqueDef techDef = technique.getDef();
|
||||||
r.setTexture(getUnit(), getTextureValue());
|
r.setTexture(getUnit(), getTextureValue());
|
||||||
if (techDef.isUsingShaders()) {
|
technique.updateUniformParam(getPrefixedName(), getVarType(), getUnit());
|
||||||
technique.updateUniformParam(getPrefixedName(), getVarType(), getUnit());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -150,7 +150,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
|||||||
/**
|
/**
|
||||||
* This method sets the name of the material.
|
* This method sets the name of the material.
|
||||||
* The name is not the same as the asset name.
|
* 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
|
* @param name the name of the material
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
@ -1060,18 +1060,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
|||||||
MatParamTexture texParam = (MatParamTexture) param;
|
MatParamTexture texParam = (MatParamTexture) param;
|
||||||
r.setTexture(0, texParam.getTextureValue());
|
r.setTexture(0, texParam.getTextureValue());
|
||||||
} else {
|
} else {
|
||||||
if (!techDef.isUsingShaders()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
technique.updateUniformParam(param.getName(), param.getVarType(), param.getValue());
|
technique.updateUniformParam(param.getName(), param.getVarType(), param.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shader shader = technique.getShader();
|
r.setShader(technique.getShader());
|
||||||
if (techDef.isUsingShaders()) {
|
|
||||||
r.setShader(shader);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearUniformsSetByCurrent(Shader shader) {
|
private void clearUniformsSetByCurrent(Shader shader) {
|
||||||
@ -1182,11 +1175,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
|||||||
|
|
||||||
// update camera and world matrices
|
// update camera and world matrices
|
||||||
// NOTE: setWorldTransform should have been called already
|
// NOTE: setWorldTransform should have been called already
|
||||||
if (techDef.isUsingShaders()) {
|
|
||||||
// reset unchanged uniform flag
|
// reset unchanged uniform flag
|
||||||
clearUniformsSetByCurrent(technique.getShader());
|
clearUniformsSetByCurrent(technique.getShader());
|
||||||
rm.updateUniformBindings(technique.getWorldBindUniforms());
|
rm.updateUniformBindings(technique.getWorldBindUniforms());
|
||||||
}
|
|
||||||
|
|
||||||
// setup textures and uniforms
|
// setup textures and uniforms
|
||||||
for (int i = 0; i < paramValues.size(); i++) {
|
for (int i = 0; i < paramValues.size(); i++) {
|
||||||
@ -1220,11 +1213,9 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// upload and bind shader
|
// upload and bind shader
|
||||||
if (techDef.isUsingShaders()) {
|
// any unset uniforms will be set to 0
|
||||||
// any unset uniforms will be set to 0
|
resetUniformsNotSetByCurrent(shader);
|
||||||
resetUniformsNotSetByCurrent(shader);
|
r.setShader(shader);
|
||||||
r.setShader(shader);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderMeshFromGeometry(r, geom);
|
renderMeshFromGeometry(r, geom);
|
||||||
}
|
}
|
||||||
|
@ -63,10 +63,8 @@ public class Technique /* implements Savable */ {
|
|||||||
public Technique(Material owner, TechniqueDef def) {
|
public Technique(Material owner, TechniqueDef def) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.def = def;
|
this.def = def;
|
||||||
if (def.isUsingShaders()) {
|
this.worldBindUniforms = new ArrayList<Uniform>();
|
||||||
this.worldBindUniforms = new ArrayList<Uniform>();
|
this.defines = new DefineList();
|
||||||
this.defines = new DefineList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,22 +171,16 @@ public class Technique /* implements Savable */ {
|
|||||||
* @param assetManager The asset manager to use for loading shaders.
|
* @param assetManager The asset manager to use for loading shaders.
|
||||||
*/
|
*/
|
||||||
public void makeCurrent(AssetManager assetManager, boolean techniqueSwitched, EnumSet<Caps> rendererCaps, RenderManager rm) {
|
public void makeCurrent(AssetManager assetManager, boolean techniqueSwitched, EnumSet<Caps> rendererCaps, RenderManager rm) {
|
||||||
if (!def.isUsingShaders()) {
|
|
||||||
// No shaders are used, no processing is neccessary.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (techniqueSwitched) {
|
if (techniqueSwitched) {
|
||||||
if (defines.update(owner.getParamsMap(), def)) {
|
if (defines.update(owner.getParamsMap(), def)) {
|
||||||
needReload = true;
|
needReload = true;
|
||||||
}
|
}
|
||||||
if(getDef().getLightMode()== TechniqueDef.LightMode.SinglePass){
|
if (getDef().getLightMode() == TechniqueDef.LightMode.SinglePass) {
|
||||||
defines.set("SINGLE_PASS_LIGHTING", VarType.Boolean, true);
|
defines.set("SINGLE_PASS_LIGHTING", VarType.Boolean, true);
|
||||||
defines.set("NB_LIGHTS", VarType.Int, rm.getSinglePassLightBatchSize()*3 );
|
defines.set("NB_LIGHTS", VarType.Int, rm.getSinglePassLightBatchSize() * 3);
|
||||||
}else{
|
} else {
|
||||||
defines.set("SINGLE_PASS_LIGHTING", VarType.Boolean, null);
|
defines.set("SINGLE_PASS_LIGHTING", VarType.Boolean, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needReload) {
|
if (needReload) {
|
||||||
|
@ -208,12 +208,9 @@ public class TechniqueDef implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this technique uses shaders, false otherwise.
|
* @deprecated jME3 always requires shaders now
|
||||||
*
|
|
||||||
* @return true if this technique uses shaders, false otherwise.
|
|
||||||
*
|
|
||||||
* @see #setShaderFile(java.lang.String, java.lang.String, java.lang.String)
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean isUsingShaders(){
|
public boolean isUsingShaders(){
|
||||||
return usesShaders;
|
return usesShaders;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user