use of com.jme3.scene.shape.Sphere in project jmonkeyengine by jMonkeyEngine.
the class LightFilterTest method testDirectionalFiltering.
@Test
public void testDirectionalFiltering() {
geom.addLight(new DirectionalLight(Vector3f.UNIT_Y));
// Directional lights must never be filtered
checkFilteredLights(1);
// Test for bounding Sphere
geom.setModelBound(new BoundingSphere(0.5f, Vector3f.ZERO));
// Directional lights must never be filtered
checkFilteredLights(1);
}
use of com.jme3.scene.shape.Sphere in project jmonkeyengine by jMonkeyEngine.
the class UVCoordinatesGenerator method getBoundingSphere.
/**
* This method returns the bounding sphere of the given geometries.
*
* @param geometries
* the list of geometries
* @return bounding sphere of the given geometries
*/
/* package */
static BoundingSphere getBoundingSphere(Geometry... geometries) {
BoundingSphere result = null;
for (Geometry geometry : geometries) {
geometry.updateModelBound();
BoundingVolume bv = geometry.getModelBound();
if (bv instanceof BoundingBox) {
BoundingBox bb = (BoundingBox) bv;
float r = Math.max(bb.getXExtent(), bb.getYExtent());
r = Math.max(r, bb.getZExtent());
return new BoundingSphere(r, bb.getCenter());
} else if (bv instanceof BoundingSphere) {
return (BoundingSphere) bv;
} else {
throw new IllegalStateException("Unknown bounding volume type: " + bv.getClass().getName());
}
}
return result;
}
use of com.jme3.scene.shape.Sphere in project jmonkeyengine by jMonkeyEngine.
the class TestMonkeyHead method simpleInitApp.
@Override
public void simpleInitApp() {
viewPort.setBackgroundColor(ColorRGBA.DarkGray);
Spatial bumpy = (Spatial) assetManager.loadModel("Models/MonkeyHead/MonkeyHead.mesh.xml");
rootNode.attachChild(bumpy);
lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(lightMdl);
// flourescent main light
pl = new PointLight();
pl.setColor(new ColorRGBA(0.88f, 0.92f, 0.95f, 1.0f));
rootNode.addLight(pl);
// sunset light
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.1f, -0.7f, 1).normalizeLocal());
dl.setColor(new ColorRGBA(0.44f, 0.30f, 0.20f, 1.0f));
rootNode.addLight(dl);
// skylight
dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.6f, -1, -0.6f).normalizeLocal());
dl.setColor(new ColorRGBA(0.10f, 0.22f, 0.44f, 1.0f));
rootNode.addLight(dl);
// white ambient light
dl = new DirectionalLight();
dl.setDirection(new Vector3f(1, -0.5f, -0.1f).normalizeLocal());
dl.setColor(new ColorRGBA(0.50f, 0.40f, 0.50f, 1.0f));
rootNode.addLight(dl);
}
use of com.jme3.scene.shape.Sphere in project jmonkeyengine by jMonkeyEngine.
the class TestSphere method simpleInitApp.
@Override
public void simpleInitApp() {
Sphere sphMesh = new Sphere(14, 14, 1);
Material solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
for (int y = -5; y < 5; y++) {
for (int x = -5; x < 5; x++) {
Geometry sphere = new Geometry("sphere", sphMesh);
sphere.setMaterial(solidColor);
sphere.setLocalTranslation(x * 2, 0, y * 2);
rootNode.attachChild(sphere);
}
}
cam.setLocation(new Vector3f(0, 5, 0));
cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
}
use of com.jme3.scene.shape.Sphere in project jmonkeyengine by jMonkeyEngine.
the class TestSimpleBumps method simpleInitApp.
@Override
public void simpleInitApp() {
Quad quadMesh = new Quad(1, 1);
Geometry sphere = new Geometry("Rock Ball", quadMesh);
Material mat = assetManager.loadMaterial("Textures/BumpMapTest/SimpleBump.j3m");
sphere.setMaterial(mat);
TangentBinormalGenerator.generate(sphere);
rootNode.attachChild(sphere);
lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(lightMdl);
pl = new PointLight();
pl.setColor(ColorRGBA.White);
pl.setPosition(new Vector3f(0f, 0f, 4f));
rootNode.addLight(pl);
// DirectionalLight dl = new DirectionalLight();
// dl.setDirection(new Vector3f(1, -1, -1).normalizeLocal());
// dl.setColor(new ColorRGBA(0.22f, 0.15f, 0.1f, 1.0f));
// rootNode.addLight(dl);
}
Aggregations