use of com.jme3.light.AmbientLight in project jmonkeyengine by jMonkeyEngine.
the class PhysicsTestHelper method createPhysicsTestWorldSoccer.
public static void createPhysicsTestWorldSoccer(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(20, 0.25f, 20);
Geometry floorGeometry = new Geometry("Floor", floorBox);
floorGeometry.setMaterial(material);
floorGeometry.setLocalTranslation(0, -0.25f, 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 spheres
for (int i = 0; i < 5; i++) {
Sphere sphere = new Sphere(16, 16, .5f);
Geometry ballGeometry = new Geometry("Soccer ball", sphere);
ballGeometry.setMaterial(material);
ballGeometry.setLocalTranslation(i, 2, -3);
//RigidBodyControl automatically uses Sphere collision shapes when attached to single geometry with sphere mesh
ballGeometry.addControl(new RigidBodyControl(.001f));
ballGeometry.getControl(RigidBodyControl.class).setRestitution(1);
rootNode.attachChild(ballGeometry);
space.add(ballGeometry);
}
{
//immovable Box with mesh collision shape
Box box = new Box(1, 1, 1);
Geometry boxGeometry = new Geometry("Box", box);
boxGeometry.setMaterial(material);
boxGeometry.setLocalTranslation(4, 1, 2);
boxGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(box), 0));
rootNode.attachChild(boxGeometry);
space.add(boxGeometry);
}
{
//immovable Box with mesh collision shape
Box box = new Box(1, 1, 1);
Geometry boxGeometry = new Geometry("Box", box);
boxGeometry.setMaterial(material);
boxGeometry.setLocalTranslation(4, 3, 4);
boxGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(box), 0));
rootNode.attachChild(boxGeometry);
space.add(boxGeometry);
}
}
use of com.jme3.light.AmbientLight in project jmonkeyengine by jMonkeyEngine.
the class TerrainTestTile method simpleInitApp.
@Override
public void simpleInitApp() {
loadHintText();
setupKeys();
// WIREFRAME material
matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
matWire.getAdditionalRenderState().setWireframe(true);
matWire.setColor("Color", ColorRGBA.Green);
terrain = new TiledTerrain();
rootNode.attachChild(terrain);
DirectionalLight light = new DirectionalLight();
light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
rootNode.addLight(light);
AmbientLight ambLight = new AmbientLight();
ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f));
rootNode.addLight(ambLight);
cam.setLocation(new Vector3f(0, 256, 0));
cam.lookAtDirection(new Vector3f(0, -1, -1).normalizeLocal(), Vector3f.UNIT_Y);
Sphere s = new Sphere(12, 12, 3);
Geometry g = new Geometry("marker");
g.setMesh(s);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Red);
g.setMaterial(mat);
g.setLocalTranslation(0, -100, 0);
rootNode.attachChild(g);
Geometry g2 = new Geometry("marker");
g2.setMesh(s);
mat.setColor("Color", ColorRGBA.Red);
g2.setMaterial(mat);
g2.setLocalTranslation(10, -100, 0);
rootNode.attachChild(g2);
Geometry g3 = new Geometry("marker");
g3.setMesh(s);
mat.setColor("Color", ColorRGBA.Red);
g3.setMaterial(mat);
g3.setLocalTranslation(0, -100, 10);
rootNode.attachChild(g3);
}
use of com.jme3.light.AmbientLight in project jmonkeyengine by jMonkeyEngine.
the class TerrainTestModifyHeight method simpleInitApp.
@Override
public void simpleInitApp() {
loadHintText();
initCrossHairs();
setupKeys();
createMarker();
// WIREFRAME material
matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
matWire.getAdditionalRenderState().setWireframe(true);
matWire.setColor("Color", ColorRGBA.Green);
createTerrain();
//createTerrainGrid();
DirectionalLight light = new DirectionalLight();
light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
rootNode.addLight(light);
AmbientLight ambLight = new AmbientLight();
ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f));
rootNode.addLight(ambLight);
cam.setLocation(new Vector3f(0, 256, 0));
cam.lookAtDirection(new Vector3f(0, -1f, 0).normalizeLocal(), Vector3f.UNIT_X);
}
use of com.jme3.light.AmbientLight in project jmonkeyengine by jMonkeyEngine.
the class TestJaime method setupLights.
public void setupLights() {
AmbientLight al = new AmbientLight();
al.setColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1));
rootNode.addLight(al);
SpotLight sl = new SpotLight();
sl.setColor(ColorRGBA.White.mult(1.0f));
sl.setPosition(new Vector3f(1.2074411f, 10.6868908f, 4.1489987f));
sl.setDirection(sl.getPosition().mult(-1));
sl.setSpotOuterAngle(0.1f);
sl.setSpotInnerAngle(0.004f);
rootNode.addLight(sl);
//pointlight to fake indirect light coming from the ground
PointLight pl = new PointLight();
pl.setColor(ColorRGBA.White.mult(1.5f));
pl.setPosition(new Vector3f(0, 0, 1));
pl.setRadius(2);
rootNode.addLight(pl);
SpotLightShadowRenderer shadows = new SpotLightShadowRenderer(assetManager, 1024);
shadows.setLight(sl);
shadows.setShadowIntensity(0.3f);
shadows.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
viewPort.addProcessor(shadows);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
SSAOFilter filter = new SSAOFilter(0.10997847f, 0.440001f, 0.39999998f, -0.008000026f);
;
fpp.addFilter(filter);
fpp.addFilter(new FXAAFilter());
fpp.addFilter(new FXAAFilter());
viewPort.addProcessor(fpp);
}
use of com.jme3.light.AmbientLight in project jmonkeyengine by jMonkeyEngine.
the class LightFilterTest method testAmbientFiltering.
@Test
public void testAmbientFiltering() {
geom.addLight(new AmbientLight());
// Ambient lights must never be filtered
checkFilteredLights(1);
// Test for bounding Sphere
geom.setModelBound(new BoundingSphere(0.5f, Vector3f.ZERO));
// Ambient lights must never be filtered
checkFilteredLights(1);
}
Aggregations