use of com.jme3.light.DirectionalLight in project jmonkeyengine by jMonkeyEngine.
the class TestBloom method simpleInitApp.
@Override
public void simpleInitApp() {
// put the camera in a bad position
cam.setLocation(new Vector3f(-2.336393f, 11.91392f, -7.139601f));
cam.setRotation(new Quaternion(0.23602544f, 0.11321983f, -0.027698677f, 0.96473104f));
//cam.setFrustumFar(1000);
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat.setFloat("Shininess", 15f);
mat.setBoolean("UseMaterialColors", true);
mat.setColor("Ambient", ColorRGBA.Yellow.mult(0.2f));
mat.setColor("Diffuse", ColorRGBA.Yellow.mult(0.2f));
mat.setColor("Specular", ColorRGBA.Yellow.mult(0.8f));
Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
matSoil.setFloat("Shininess", 15f);
matSoil.setBoolean("UseMaterialColors", true);
matSoil.setColor("Ambient", ColorRGBA.Gray);
matSoil.setColor("Diffuse", ColorRGBA.Black);
matSoil.setColor("Specular", ColorRGBA.Gray);
teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
teapot.setLocalTranslation(0, 0, 10);
teapot.setMaterial(mat);
teapot.setShadowMode(ShadowMode.CastAndReceive);
teapot.setLocalScale(10.0f);
rootNode.attachChild(teapot);
Geometry soil = new Geometry("soil", new Box(800, 10, 700));
soil.setLocalTranslation(0, -13, 550);
soil.setMaterial(matSoil);
soil.setShadowMode(ShadowMode.CastAndReceive);
rootNode.attachChild(soil);
DirectionalLight light = new DirectionalLight();
light.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
light.setColor(ColorRGBA.White.mult(1.5f));
rootNode.addLight(light);
// load sky
Spatial sky = SkyFactory.createSky(assetManager, "Textures/Sky/Bright/FullskiesBlueClear03.dds", false);
sky.setCullHint(Spatial.CullHint.Never);
rootNode.attachChild(sky);
fpp = new FilterPostProcessor(assetManager);
// fpp.setNumSamples(4);
int numSamples = getContext().getSettings().getSamples();
if (numSamples > 0) {
fpp.setNumSamples(numSamples);
}
BloomFilter bloom = new BloomFilter();
bloom.setDownSamplingFactor(2);
bloom.setBlurScale(1.37f);
bloom.setExposurePower(3.30f);
bloom.setExposureCutOff(0.2f);
bloom.setBloomIntensity(2.45f);
BloomUI ui = new BloomUI(inputManager, bloom);
viewPort.addProcessor(fpp);
fpp.addFilter(bloom);
initInputs();
}
use of com.jme3.light.DirectionalLight in project jmonkeyengine by jMonkeyEngine.
the class TestCartoonEdge method setupLighting.
public void setupLighting() {
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-1, -1, 1).normalizeLocal());
dl.setColor(new ColorRGBA(2, 2, 2, 1));
rootNode.addLight(dl);
}
use of com.jme3.light.DirectionalLight in project jmonkeyengine by jMonkeyEngine.
the class TestCrossHatch method simpleInitApp.
@Override
public void simpleInitApp() {
// put the camera in a bad position
cam.setLocation(new Vector3f(-2.336393f, 11.91392f, -7.139601f));
cam.setRotation(new Quaternion(0.23602544f, 0.11321983f, -0.027698677f, 0.96473104f));
//cam.setFrustumFar(1000);
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat.setFloat("Shininess", 15f);
mat.setBoolean("UseMaterialColors", true);
mat.setColor("Ambient", ColorRGBA.Yellow.mult(0.2f));
mat.setColor("Diffuse", ColorRGBA.Yellow.mult(0.2f));
mat.setColor("Specular", ColorRGBA.Yellow.mult(0.8f));
Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
matSoil.setFloat("Shininess", 15f);
matSoil.setBoolean("UseMaterialColors", true);
matSoil.setColor("Ambient", ColorRGBA.Gray);
matSoil.setColor("Diffuse", ColorRGBA.Black);
matSoil.setColor("Specular", ColorRGBA.Gray);
teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
teapot.setLocalTranslation(0, 0, 10);
teapot.setMaterial(mat);
teapot.setShadowMode(ShadowMode.CastAndReceive);
teapot.setLocalScale(10.0f);
rootNode.attachChild(teapot);
Geometry soil = new Geometry("soil", new Box(800, 10, 700));
soil.setLocalTranslation(0, -13, 550);
soil.setMaterial(matSoil);
soil.setShadowMode(ShadowMode.CastAndReceive);
rootNode.attachChild(soil);
DirectionalLight light = new DirectionalLight();
light.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
light.setColor(ColorRGBA.White.mult(1.5f));
rootNode.addLight(light);
// load sky
Spatial sky = SkyFactory.createSky(assetManager, "Textures/Sky/Bright/FullskiesBlueClear03.dds", false);
sky.setCullHint(Spatial.CullHint.Never);
rootNode.attachChild(sky);
fpp = new FilterPostProcessor(assetManager);
int numSamples = getContext().getSettings().getSamples();
if (numSamples > 0) {
fpp.setNumSamples(numSamples);
}
CrossHatchFilter chf = new CrossHatchFilter();
viewPort.addProcessor(fpp);
fpp.addFilter(chf);
initInputs();
}
use of com.jme3.light.DirectionalLight in project jmonkeyengine by jMonkeyEngine.
the class TestHWSkinning method simpleInitApp.
@Override
public void simpleInitApp() {
flyCam.setMoveSpeed(10f);
cam.setLocation(new Vector3f(3.8664846f, 6.2704787f, 9.664585f));
cam.setRotation(new Quaternion(-0.054774776f, 0.94064945f, -0.27974048f, -0.18418397f));
makeHudText();
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
rootNode.addLight(dl);
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
Spatial model = (Spatial) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
model.setLocalScale(0.1f);
model.setLocalTranslation(i - SIZE / 2, 0, j - SIZE / 2);
control = model.getControl(AnimControl.class);
channel = control.createChannel();
channel.setAnim(animNames[(i + j) % 4]);
SkeletonControl skeletonControl = model.getControl(SkeletonControl.class);
skeletonControl.setHardwareSkinningPreferred(hwSkinningEnable);
skControls.add(skeletonControl);
rootNode.attachChild(model);
}
}
inputManager.addListener(this, "toggleHWS");
inputManager.addMapping("toggleHWS", new KeyTrigger(KeyInput.KEY_SPACE));
}
use of com.jme3.light.DirectionalLight in project jmonkeyengine by jMonkeyEngine.
the class TestModelExportingCloning method simpleInitApp.
@Override
public void simpleInitApp() {
cam.setLocation(new Vector3f(10f, 3f, 40f));
cam.lookAtDirection(Vector3f.UNIT_Z.negate(), Vector3f.UNIT_Y);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
rootNode.addLight(dl);
AnimControl control;
AnimChannel channel;
Spatial originalModel = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
control = originalModel.getControl(AnimControl.class);
channel = control.createChannel();
channel.setAnim("Walk");
rootNode.attachChild(originalModel);
Spatial clonedModel = originalModel.clone();
clonedModel.move(10, 0, 0);
control = clonedModel.getControl(AnimControl.class);
channel = control.createChannel();
channel.setAnim("push");
rootNode.attachChild(clonedModel);
Spatial exportedModel = BinaryExporter.saveAndLoad(assetManager, originalModel);
exportedModel.move(20, 0, 0);
control = exportedModel.getControl(AnimControl.class);
channel = control.createChannel();
channel.setAnim("pull");
rootNode.attachChild(exportedModel);
}
Aggregations