Search in sources :

Example 71 with Box

use of com.jme3.scene.shape.Box in project jmonkeyengine by jMonkeyEngine.

the class TestMotionPath method createScene.

private void createScene() {
    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    mat.setFloat("Shininess", 1f);
    mat.setBoolean("UseMaterialColors", true);
    mat.setColor("Ambient", ColorRGBA.Black);
    mat.setColor("Diffuse", ColorRGBA.DarkGray);
    mat.setColor("Specular", ColorRGBA.White.mult(0.6f));
    Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    matSoil.setBoolean("UseMaterialColors", true);
    matSoil.setColor("Ambient", ColorRGBA.Black);
    matSoil.setColor("Diffuse", ColorRGBA.Black);
    matSoil.setColor("Specular", ColorRGBA.Black);
    teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
    teapot.setName("Teapot");
    teapot.setLocalScale(3);
    teapot.setMaterial(mat);
    rootNode.attachChild(teapot);
    Geometry soil = new Geometry("soil", new Box(50, 1, 50));
    soil.setLocalTranslation(0, -1, 0);
    soil.setMaterial(matSoil);
    rootNode.attachChild(soil);
    DirectionalLight light = new DirectionalLight();
    light.setDirection(new Vector3f(0, -1, 0).normalizeLocal());
    light.setColor(ColorRGBA.White.mult(1.5f));
    rootNode.addLight(light);
}
Also used : Geometry(com.jme3.scene.Geometry) DirectionalLight(com.jme3.light.DirectionalLight) Vector3f(com.jme3.math.Vector3f) Material(com.jme3.material.Material) Box(com.jme3.scene.shape.Box)

Example 72 with Box

use of com.jme3.scene.shape.Box in project jmonkeyengine by jMonkeyEngine.

the class TestAppStateLifeCycle method simpleInitApp.

@Override
public void simpleInitApp() {
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    geom.setMaterial(mat);
    rootNode.attachChild(geom);
    System.out.println("Attaching test state.");
    stateManager.attach(new TestState());
}
Also used : Geometry(com.jme3.scene.Geometry) Box(com.jme3.scene.shape.Box) Material(com.jme3.material.Material)

Example 73 with Box

use of com.jme3.scene.shape.Box in project jmonkeyengine by jMonkeyEngine.

the class TestEnqueueRunnable method simpleInitApp.

@Override
public void simpleInitApp() {
    Geometry geom = new Geometry("Box", new Box(1, 1, 1));
    Material material = new Material(getAssetManager(), "/Common/MatDefs/Misc/Unshaded.j3md");
    //a color is needed to start with
    material.setColor("Color", ColorRGBA.Blue);
    geom.setMaterial(material);
    getRootNode().attachChild(geom);
    exampleAsyncTask = new ExampleAsyncTask(material);
    exampleAsyncTask.getThread().start();
}
Also used : Geometry(com.jme3.scene.Geometry) Box(com.jme3.scene.shape.Box) Material(com.jme3.material.Material)

Example 74 with Box

use of com.jme3.scene.shape.Box in project jmonkeyengine by jMonkeyEngine.

the class TestResizableApp method simpleInitApp.

public void simpleInitApp() {
    flyCam.setDragToRotate(true);
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    geom.setMaterial(mat);
    rootNode.attachChild(geom);
    txt = new BitmapText(loadGuiFont(), false);
    txt.setText("Drag the corners of the application to resize it.\n" + "Current Size: " + settings.getWidth() + "x" + settings.getHeight());
    txt.setLocalTranslation(0, settings.getHeight(), 0);
    guiNode.attachChild(txt);
}
Also used : Geometry(com.jme3.scene.Geometry) BitmapText(com.jme3.font.BitmapText) TestBox(jme3test.model.shape.TestBox) Box(com.jme3.scene.shape.Box) Material(com.jme3.material.Material)

Example 75 with Box

use of com.jme3.scene.shape.Box in project jmonkeyengine by jMonkeyEngine.

the class TestUseAfterFree method simpleInitApp.

@Override
public void simpleInitApp() {
    Box box = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", box);
    mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    geom.setMaterial(mat);
    rootNode.attachChild(geom);
}
Also used : Geometry(com.jme3.scene.Geometry) Box(com.jme3.scene.shape.Box) Material(com.jme3.material.Material)

Aggregations

Geometry (com.jme3.scene.Geometry)106 Box (com.jme3.scene.shape.Box)99 Material (com.jme3.material.Material)83 Vector3f (com.jme3.math.Vector3f)77 Node (com.jme3.scene.Node)31 DirectionalLight (com.jme3.light.DirectionalLight)27 Sphere (com.jme3.scene.shape.Sphere)23 Quaternion (com.jme3.math.Quaternion)20 RigidBodyControl (com.jme3.bullet.control.RigidBodyControl)19 Spatial (com.jme3.scene.Spatial)19 BoundingBox (com.jme3.bounding.BoundingBox)17 Vector2f (com.jme3.math.Vector2f)15 Texture (com.jme3.texture.Texture)15 AmbientLight (com.jme3.light.AmbientLight)13 TempVars (com.jme3.util.TempVars)12 BulletAppState (com.jme3.bullet.BulletAppState)11 KeyTrigger (com.jme3.input.controls.KeyTrigger)11 FilterPostProcessor (com.jme3.post.FilterPostProcessor)11 BoundingSphere (com.jme3.bounding.BoundingSphere)8 BoxCollisionShape (com.jme3.bullet.collision.shapes.BoxCollisionShape)8