Shader Nodes implementation :

Test case


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10435 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 12 years ago
parent 241cbce7e6
commit 1091069059
  1. 47
      engine/src/test/jme3test/material/TestShaderNodes.java

@ -0,0 +1,47 @@
package jme3test.material;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.material.Technique;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.plugins.blender.materials.MaterialHelper;
import com.jme3.scene.shape.Box;
import com.jme3.shader.Glsl100ShaderGenerator;
import com.jme3.shader.MaterialDefBuilder;
import com.jme3.shader.Shader;
import com.jme3.shader.VarType;
import com.jme3.texture.Texture;
import java.util.logging.Level;
import java.util.logging.Logger;
public class TestShaderNodes extends SimpleApplication {
public static void main(String[] args) {
TestShaderNodes app = new TestShaderNodes();
app.start();
}
@Override
public void simpleInitApp() {
flyCam.setMoveSpeed(20);
Logger.getLogger("com.jme3").setLevel(Level.WARNING);
Box boxshape1 = new Box(1f, 1f, 1f);
Geometry cube_tex = new Geometry("A Textured Box", boxshape1);
Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
Material mat = new Material(assetManager, "Common/MatDefs/Misc/UnshadedNodes.j3md");
mat.selectTechnique("Default", renderManager);
Technique t = mat.getActiveTechnique();
for (Shader.ShaderSource shaderSource : t.getShader().getSources()) {
System.out.println(shaderSource.getSource());
}
mat.setColor("Color", ColorRGBA.Yellow);
mat.setTexture("ColorMap", tex);
cube_tex.setMaterial(mat);
rootNode.attachChild(cube_tex);
}
}
Loading…
Cancel
Save