use of com.jme3.shader.Uniform in project jmonkeyengine by jMonkeyEngine.
the class ShaderGenerationInfo method clone.
@Override
protected ShaderGenerationInfo clone() throws CloneNotSupportedException {
ShaderGenerationInfo clone = (ShaderGenerationInfo) super.clone();
for (ShaderNodeVariable attribute : attributes) {
clone.attributes.add(attribute.clone());
}
for (ShaderNodeVariable uniform : vertexUniforms) {
clone.vertexUniforms.add(uniform.clone());
}
clone.vertexGlobal = vertexGlobal.clone();
for (ShaderNodeVariable varying : varyings) {
clone.varyings.add(varying.clone());
}
for (ShaderNodeVariable uniform : fragmentUniforms) {
clone.fragmentUniforms.add(uniform.clone());
}
for (ShaderNodeVariable globals : fragmentGlobals) {
clone.fragmentGlobals.add(globals.clone());
}
clone.unusedNodes.addAll(unusedNodes);
return clone;
}
use of com.jme3.shader.Uniform in project jmonkeyengine by jMonkeyEngine.
the class ShaderNodeLoaderDelegate method updateRightFromUniforms.
/**
* updates the right variable of the given mapping from a UniformBinding (a
* WorldParam) it checks if the uniform hasn't already been loaded, add it
* to the maps if not.
*
* @param param the WorldParam UniformBinding
* @param mapping the mapping
* @param map the map of uniforms to search into
* @return true if the param was added to the map
*/
protected boolean updateRightFromUniforms(UniformBinding param, VariableMapping mapping, Map<String, DeclaredVariable> map) {
ShaderNodeVariable right = mapping.getRightVariable();
String name = "g_" + param.toString();
DeclaredVariable dv = map.get(name);
if (dv == null) {
right.setType(param.getGlslType());
right.setName(name);
dv = new DeclaredVariable(right);
map.put(right.getName(), dv);
dv.addNode(shaderNode);
mapping.setRightVariable(right);
return true;
}
dv.addNode(shaderNode);
mapping.setRightVariable(dv.var);
return false;
}
use of com.jme3.shader.Uniform in project jmonkeyengine by jMonkeyEngine.
the class MaterialMatParamTest method testTextureMpoOnly.
@Test
public void testTextureMpoOnly() {
material("Common/MatDefs/Light/Lighting.j3md");
Texture2D tex = new Texture2D(128, 128, Format.RGBA8);
inputMpo(mpoTexture2D("DiffuseMap", tex));
outDefines(def("DIFFUSEMAP", VarType.Texture2D, tex));
outUniforms(uniform("DiffuseMap", VarType.Int, 0));
outTextures(tex);
}
use of com.jme3.shader.Uniform in project jmonkeyengine by jMonkeyEngine.
the class MaterialMatParamTest method uniform.
private Uniform uniform(String name, VarType type, Object value) {
Uniform u = new Uniform();
u.setName("m_" + name);
u.setValue(type, value);
return u;
}
use of com.jme3.shader.Uniform in project jmonkeyengine by jMonkeyEngine.
the class MaterialMatParamTest method testTextureOverride.
@Test
public void testTextureOverride() {
material("Common/MatDefs/Light/Lighting.j3md");
Texture2D tex1 = new Texture2D(128, 128, Format.RGBA8);
Texture2D tex2 = new Texture2D(128, 128, Format.RGBA8);
inputMp(mpoTexture2D("DiffuseMap", tex1));
inputMpo(mpoTexture2D("DiffuseMap", tex2));
outDefines(def("DIFFUSEMAP", VarType.Texture2D, tex2));
outUniforms(uniform("DiffuseMap", VarType.Int, 0));
outTextures(tex2);
}
Aggregations