use of com.jme3.scene.Geometry in project jmonkeyengine by jMonkeyEngine.
the class TestCylinder method simpleInitApp.
@Override
public void simpleInitApp() {
Cylinder t = new Cylinder(20, 50, 1, 2, true);
Geometry geom = new Geometry("Cylinder", t);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
TextureKey key = new TextureKey("Interface/Logo/Monkey.jpg", true);
key.setGenerateMips(true);
Texture tex = assetManager.loadTexture(key);
tex.setMinFilter(Texture.MinFilter.Trilinear);
mat.setTexture("ColorMap", tex);
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
use of com.jme3.scene.Geometry 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.Geometry in project jmonkeyengine by jMonkeyEngine.
the class TestToneMapFilter method createHDRBox.
public Geometry createHDRBox() {
Box boxMesh = new Box(1, 1, 1);
Geometry box = new Geometry("Box", boxMesh);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", assetManager.loadTexture("Textures/HdrTest/Memorial.hdr"));
box.setMaterial(mat);
return box;
}
use of com.jme3.scene.Geometry in project jmonkeyengine by jMonkeyEngine.
the class TestTransparentCartoonEdge method simpleInitApp.
public void simpleInitApp() {
renderManager.setAlphaToCoverage(true);
cam.setLocation(new Vector3f(0.14914267f, 0.58147097f, 4.7686534f));
cam.setRotation(new Quaternion(-0.0044764364f, 0.9767943f, 0.21314798f, 0.020512417f));
// cam.setLocation(new Vector3f(2.0606942f, 3.20342f, 6.7860126f));
// cam.setRotation(new Quaternion(-0.017481906f, 0.98241085f, -0.12393151f, -0.13857932f));
viewPort.setBackgroundColor(ColorRGBA.DarkGray);
Quad q = new Quad(20, 20);
q.scaleTextureCoordinates(Vector2f.UNIT_XY.mult(5));
Geometry geom = new Geometry("floor", q);
Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
geom.setMaterial(mat);
geom.rotate(-FastMath.HALF_PI, 0, 0);
geom.center();
geom.setShadowMode(ShadowMode.Receive);
rootNode.attachChild(geom);
// create the geometry and attach it
Spatial teaGeom = assetManager.loadModel("Models/Tree/Tree.mesh.j3o");
teaGeom.setQueueBucket(Bucket.Transparent);
teaGeom.setShadowMode(ShadowMode.Cast);
makeToonish(teaGeom);
AmbientLight al = new AmbientLight();
al.setColor(ColorRGBA.White.mult(2));
rootNode.addLight(al);
DirectionalLight dl1 = new DirectionalLight();
dl1.setDirection(new Vector3f(1, -1, 1).normalizeLocal());
dl1.setColor(new ColorRGBA(0.965f, 0.949f, 0.772f, 1f).mult(0.7f));
rootNode.addLight(dl1);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
dl.setColor(new ColorRGBA(0.965f, 0.949f, 0.772f, 1f).mult(0.7f));
rootNode.addLight(dl);
rootNode.attachChild(teaGeom);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
CartoonEdgeFilter toon = new CartoonEdgeFilter();
toon.setEdgeWidth(0.5f);
toon.setEdgeIntensity(1.0f);
toon.setNormalThreshold(0.8f);
fpp.addFilter(toon);
viewPort.addProcessor(fpp);
}
use of com.jme3.scene.Geometry 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