use of com.jme3.light.Light in project jmonkeyengine by jMonkeyEngine.
the class OpaqueComparatorTest method testSortByTechnique.
@Test
public void testSortByTechnique() {
Material lightingMatDefault = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
Material lightingPreShadow = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
Material lightingPostShadow = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
Material lightingMatPreNormalPass = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
Material lightingMatGBuf = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
Material lightingMatGlow = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
lightingMatDefault.setName("TechDefault");
lightingMatDefault.selectTechnique(TechniqueDef.DEFAULT_TECHNIQUE_NAME, renderManager);
lightingPostShadow.setName("TechPostShad");
lightingPostShadow.selectTechnique("PostShadow", renderManager);
lightingPreShadow.setName("TechPreShad");
lightingPreShadow.selectTechnique("PreShadow", renderManager);
lightingMatPreNormalPass.setName("TechNorm");
lightingMatPreNormalPass.selectTechnique("PreNormalPass", renderManager);
lightingMatGlow.setName("TechGlow");
lightingMatGlow.selectTechnique("Glow", renderManager);
testSort(lightingMatGlow, lightingPreShadow, lightingMatPreNormalPass, lightingMatDefault, lightingPostShadow);
}
use of com.jme3.light.Light 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.light.Light 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);
}
use of com.jme3.light.Light in project jmonkeyengine by jMonkeyEngine.
the class TestBatchNode method simpleInitApp.
@Override
public void simpleInitApp() {
timer = new NanoTimer();
batch = new BatchNode("theBatchNode");
/**
* A cube with a color "bleeding" through transparent texture. Uses
* Texture from jme3-test-data library!
*/
Box boxshape4 = new Box(1f, 1f, 1f);
cube = new Geometry("cube1", boxshape4);
Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
cube.setMaterial(mat);
// Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
// mat.setColor("Diffuse", ColorRGBA.Blue);
// mat.setBoolean("UseMaterialColors", true);
/**
* A cube with a color "bleeding" through transparent texture. Uses
* Texture from jme3-test-data library!
*/
Box box = new Box(1f, 1f, 1f);
cube2 = new Geometry("cube2", box);
cube2.setMaterial(mat);
TangentBinormalGenerator.generate(cube);
TangentBinormalGenerator.generate(cube2);
n = new Node("aNode");
// n.attachChild(cube2);
batch.attachChild(cube);
// batch.attachChild(cube2);
// batch.setMaterial(mat);
batch.batch();
rootNode.attachChild(batch);
cube.setLocalTranslation(3, 0, 0);
cube2.setLocalTranslation(0, 20, 0);
updateBoindPoints(points);
frustum = new WireFrustum(points);
frustumMdl = new Geometry("f", frustum);
frustumMdl.setCullHint(Spatial.CullHint.Never);
frustumMdl.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
frustumMdl.getMaterial().getAdditionalRenderState().setWireframe(true);
frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red);
rootNode.attachChild(frustumMdl);
dl = new DirectionalLight();
dl.setColor(ColorRGBA.White.mult(2));
dl.setDirection(new Vector3f(1, -1, -1));
rootNode.addLight(dl);
flyCam.setMoveSpeed(10);
}
use of com.jme3.light.Light in project jmonkeyengine by jMonkeyEngine.
the class PhysicsTestHelper method createPhysicsTestWorld.
/**
* creates a simple physics test world with a floor, an obstacle and some test boxes
* @param rootNode
* @param assetManager
* @param space
*/
public static void createPhysicsTestWorld(Node rootNode, AssetManager assetManager, PhysicsSpace space) {
AmbientLight light = new AmbientLight();
light.setColor(ColorRGBA.LightGray);
rootNode.addLight(light);
Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
Box floorBox = new Box(140, 0.25f, 140);
Geometry floorGeometry = new Geometry("Floor", floorBox);
floorGeometry.setMaterial(material);
floorGeometry.setLocalTranslation(0, -5, 0);
// Plane plane = new Plane();
// plane.setOriginNormal(new Vector3f(0, 0.25f, 0), Vector3f.UNIT_Y);
// floorGeometry.addControl(new RigidBodyControl(new PlaneCollisionShape(plane), 0));
floorGeometry.addControl(new RigidBodyControl(0));
rootNode.attachChild(floorGeometry);
space.add(floorGeometry);
//movable boxes
for (int i = 0; i < 12; i++) {
Box box = new Box(0.25f, 0.25f, 0.25f);
Geometry boxGeometry = new Geometry("Box", box);
boxGeometry.setMaterial(material);
boxGeometry.setLocalTranslation(i, 5, -3);
//RigidBodyControl automatically uses box collision shapes when attached to single geometry with box mesh
boxGeometry.addControl(new RigidBodyControl(2));
rootNode.attachChild(boxGeometry);
space.add(boxGeometry);
}
//immovable sphere with mesh collision shape
Sphere sphere = new Sphere(8, 8, 1);
Geometry sphereGeometry = new Geometry("Sphere", sphere);
sphereGeometry.setMaterial(material);
sphereGeometry.setLocalTranslation(4, -4, 2);
sphereGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(sphere), 0));
rootNode.attachChild(sphereGeometry);
space.add(sphereGeometry);
}
Aggregations