Java Code Examples for com.jme3.scene.Geometry#setLocalTranslation()

The following examples show how to use com.jme3.scene.Geometry#setLocalTranslation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorldOfInception.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private Geometry getRandomBall(Vector3f location) {
    Vector3f localLocation = new Vector3f();
    localLocation.set(location);
    localLocation.addLocal(new Vector3f(random.nextFloat() - 0.5f, random.nextFloat() - 0.5f, random.nextFloat() - 0.5f).normalize().mult(3));
    Geometry poiGeom = new Geometry("ball", ballMesh);
    poiGeom.setLocalTranslation(localLocation);
    poiGeom.setMaterial(ballMaterial);
    RigidBodyControl control = new RigidBodyControl(ballCollisionShape, 1);
    //!!! Important
    control.setApplyPhysicsLocal(true);
    poiGeom.addControl(control);
    float x = (random.nextFloat() - 0.5f) * 100;
    float y = (random.nextFloat() - 0.5f) * 100;
    float z = (random.nextFloat() - 0.5f) * 100;
    control.setLinearVelocity(new Vector3f(x, y, z));
    return poiGeom;
}
 
Example 2
Source File: EditorPresentableNode.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
/**
 * Update position and rotation of a model.
 */
@JmeThread
public void updateModel() {

    final ScenePresentable object = getObject();
    final Geometry model = getModel();
    if (model == null || object == null) return;

    // TODO implement getting parent
    /*final Node parent = object.getParent();

    if (parent != null) {
        setLocalTranslation(parent.getWorldTranslation());
        setLocalRotation(parent.getWorldRotation());
        setLocalScale(parent.getWorldScale());
    }*/

    final Node editedNode = getEditedNode();
    model.setLocalTranslation(editedNode.getWorldTranslation());
    model.setLocalRotation(editedNode.getWorldRotation());
    model.setLocalScale(editedNode.getWorldScale());
}
 
Example 3
Source File: TestSimpleWater.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void initScene() {
    //init cam location
    cam.setLocation(new Vector3f(0, 10, 10));
    cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
    //init scene
    sceneNode = new Node("Scene");
    mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    geom.setMaterial(mat);
    sceneNode.attachChild(geom);

    // load sky
    sceneNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
    rootNode.attachChild(sceneNode);

    //add lightPos Geometry
    Sphere lite=new Sphere(8, 8, 3.0f);
    lightSphere=new Geometry("lightsphere", lite);
    lightSphere.setMaterial(mat);
    lightSphere.setLocalTranslation(lightPos);
    rootNode.attachChild(lightSphere);
}
 
Example 4
Source File: TestPostWater.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void createBox() {
        //creating a transluscent box
        box = new Geometry("box", new Box(50, 50, 50));
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", new ColorRGBA(1.0f, 0, 0, 0.3f));
        mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
        //mat.getAdditionalRenderState().setDepthWrite(false);
        //mat.getAdditionalRenderState().setDepthTest(false);
        box.setMaterial(mat);
        box.setQueueBucket(Bucket.Translucent);


        //creating a post view port
//        ViewPort post=renderManager.createPostView("transpPost", cam);
//        post.setClearFlags(false, true, true);


        box.setLocalTranslation(-600, 0, 300);

        //attaching the box to the post viewport
        //Don't forget to updateGeometricState() the box in the simpleUpdate
        //  post.attachScene(box);

        rootNode.attachChild(box);
    }
 
Example 5
Source File: HelloPicking.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** A floor to show that the "shot" can go through several objects. */
protected Geometry makeFloor() {
  Box box = new Box(15, .2f, 15);
  Geometry floor = new Geometry("the Floor", box);
  floor.setLocalTranslation(0, -4, -5);
  Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat1.setColor("Color", ColorRGBA.Gray);
  floor.setMaterial(mat1);
  return floor;
}
 
Example 6
Source File: HelloNode.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {

    /** create a blue box at coordinates (1,-1,1) */
    Box box1 = new Box(1,1,1);
    Geometry blue = new Geometry("Box", box1);
    blue.setLocalTranslation(new Vector3f(1,-1,1));
    Material mat1 = new Material(assetManager, 
            "Common/MatDefs/Misc/Unshaded.j3md");
    mat1.setColor("Color", ColorRGBA.Blue);
    blue.setMaterial(mat1);

    /** create a red box straight above the blue one at (1,3,1) */
    Box box2 = new Box(1,1,1);      
    Geometry red = new Geometry("Box", box2);
    red.setLocalTranslation(new Vector3f(1,3,1));
    Material mat2 = new Material(assetManager, 
            "Common/MatDefs/Misc/Unshaded.j3md");
    mat2.setColor("Color", ColorRGBA.Red);
    red.setMaterial(mat2);

    /** Create a pivot node at (0,0,0) and attach it to the root node */
    Node pivot = new Node("pivot");
    rootNode.attachChild(pivot); // put this node in the scene

    /** Attach the two boxes to the *pivot* node. (And transitively to the root node.) */
    pivot.attachChild(blue);
    pivot.attachChild(red);
    /** Rotate the pivot node: Note that both boxes have rotated! */
    pivot.rotate(.4f,.4f,0f);
}
 
Example 7
Source File: TestBatchedTower.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void addBrick(Vector3f ori) {
    Geometry reBoxg = new Geometry("brick", brick);
    reBoxg.setLocalTranslation(ori);
    reBoxg.rotate(0f, (float) Math.toRadians(angle), 0f);
    geoms.add(reBoxg);

}
 
Example 8
Source File: TestLodStress.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void simpleInitApp() {
        DirectionalLight dl = new DirectionalLight();
        dl.setDirection(new Vector3f(-1,-1,-1).normalizeLocal());
        rootNode.addLight(dl);

        Node teapotNode = (Node) assetManager.loadModel("Models/Teapot/Teapot.mesh.xml");
        Geometry teapot = (Geometry) teapotNode.getChild(0);
        
//        Sphere sph = new Sphere(16, 16, 4);
//        Geometry teapot = new Geometry("teapot", sph);

        Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
        mat.setFloat("Shininess", 16f);
        mat.setBoolean("VertexLighting", true);
        teapot.setMaterial(mat);
        
       // show normals as material
        //Material mat = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");

        for (int y = -10; y < 10; y++){
            for (int x = -10; x < 10; x++){
                Geometry clonePot = teapot.clone();
                
                //clonePot.setMaterial(mat);
                clonePot.setLocalTranslation(x * .5f, 0, y * .5f);
                clonePot.setLocalScale(.15f);
                
                LodControl control = new LodControl();
                clonePot.addControl(control);
                rootNode.attachChild(clonePot);
            }
        }

        cam.setLocation(new Vector3f(8.378951f, 5.4324f, 8.795956f));
        cam.setRotation(new Quaternion(-0.083419204f, 0.90370524f, -0.20599906f, -0.36595422f));
    }
 
Example 9
Source File: TestInstanceNode.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Geometry createInstance(float x, float z) {
    Mesh mesh; 
    if (FastMath.nextRandomInt(0, 1) == 1) mesh = mesh2;
    else mesh = mesh1;
    Geometry geometry = new Geometry("randomGeom", mesh);
    geometry.setMaterial(materials[FastMath.nextRandomInt(0, materials.length - 1)]);
    geometry.setLocalTranslation(x, 0, z);
    return geometry;
}
 
Example 10
Source File: TestMotionPath.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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);
}
 
Example 11
Source File: TestRagdollCharacter.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void initWall(float bLength, float bWidth, float bHeight) {
    Box brick = new Box(Vector3f.ZERO, bLength, bHeight, bWidth);
    brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
    Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg");
    key.setGenerateMips(true);
    Texture tex = assetManager.loadTexture(key);
    mat2.setTexture("ColorMap", tex);
    
    float startpt = bLength / 4;
    float height = -5;
    for (int j = 0; j < 15; j++) {
        for (int i = 0; i < 4; i++) {
            Vector3f ori = new Vector3f(i * bLength * 2 + startpt, bHeight + height, -10);
            Geometry reBoxg = new Geometry("brick", brick);
            reBoxg.setMaterial(mat2);
            reBoxg.setLocalTranslation(ori);
            //for geometry with sphere mesh the physics system automatically uses a sphere collision shape
            reBoxg.addControl(new RigidBodyControl(1.5f));
            reBoxg.setShadowMode(ShadowMode.CastAndReceive);
            reBoxg.getControl(RigidBodyControl.class).setFriction(0.6f);
            this.rootNode.attachChild(reBoxg);
            this.getPhysicsSpace().add(reBoxg);
        }
        startpt = -startpt;
        height += 2 * bHeight;
    }
}
 
Example 12
Source File: TestShaderNodesStress.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {

    Quad q = new Quad(1, 1);
    Geometry g = new Geometry("quad", q);
    g.setLocalTranslation(-500, -500, 0);
    g.setLocalScale(1000);

    rootNode.attachChild(g);
    cam.setLocation(new Vector3f(0.0f, 0.0f, 0.40647888f));
    cam.setRotation(new Quaternion(0.0f, 1.0f, 0.0f, 0.0f));

    Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/UnshadedNodes.j3md");
  //Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

    mat.setColor("Color", ColorRGBA.Yellow);
    mat.setTexture("ColorMap", tex);
    g.setMaterial(mat);
    //place the geoms in the transparent bucket so that they are rendered back to front for maximum overdraw
    g.setQueueBucket(RenderQueue.Bucket.Transparent);

    for (int i = 0; i < 1000; i++) {
        Geometry cl = g.clone(false);
        cl.move(0, 0, -(i + 1));
        rootNode.attachChild(cl);
    }

    flyCam.setMoveSpeed(20);
    Logger.getLogger("com.jme3").setLevel(Level.WARNING);

    this.setAppProfiler(new Profiler());

}
 
Example 13
Source File: TestBetterCharacter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void setupPlanet() {
    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    //immovable sphere with mesh collision shape
    Sphere sphere = new Sphere(64, 64, 20);
    planet = new Geometry("Sphere", sphere);
    planet.setMaterial(material);
    planet.setLocalTranslation(30, -15, 30);
    planet.addControl(new RigidBodyControl(new MeshCollisionShape(sphere), 0));
    rootNode.attachChild(planet);
    getPhysicsSpace().add(planet);
}
 
Example 14
Source File: WireBox.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create a geometry suitable for visualizing the specified bounding box.
 *
 * @param bbox the bounding box (not null)
 * @return a new Geometry instance in world space
 */
public static Geometry makeGeometry(BoundingBox bbox) {
    float xExtent = bbox.getXExtent();
    float yExtent = bbox.getYExtent();
    float zExtent = bbox.getZExtent();
    WireBox mesh = new WireBox(xExtent, yExtent, zExtent);
    Geometry result = new Geometry("bounding box", mesh);

    Vector3f center = bbox.getCenter();
    result.setLocalTranslation(center);

    return result;
}
 
Example 15
Source File: MapDrawer.java    From OpenRTS with MIT License 5 votes vote down vote up
private void attachBuggedCliff(Cliff c) {
	Geometry g = new Geometry();
	g.setMesh(new Box(0.5f, 0.5f, 1));
	g.setMaterial(MaterialManager.redMaterial);
	g.setLocalTranslation((float)c.getTile().getCoord().x + 0.5f, (float)c.getTile().getCoord().y + 0.5f, (float) (c.level * Tile.STAGE_HEIGHT) + 1);

	Node n = new Node();
	n.attachChild(g);
	tilesSpatial.get(c.getTile()).add(n);
	castAndReceiveNode.attachChild(n);
}
 
Example 16
Source File: TestBatchNodeTower.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void addBrick(Vector3f ori) {
    Geometry reBoxg = new Geometry("brick", brick);
    reBoxg.setMaterial(mat);
    reBoxg.setLocalTranslation(ori);
    reBoxg.rotate(0f, (float)Math.toRadians(angle) , 0f );
    reBoxg.addControl(new RigidBodyControl(1.5f));
    reBoxg.setShadowMode(ShadowMode.CastAndReceive);
    reBoxg.getControl(RigidBodyControl.class).setFriction(1.6f);
    this.batchNode.attachChild(reBoxg);
    this.getPhysicsSpace().add(reBoxg);
    nbBrick++;
}
 
Example 17
Source File: TestChaseCamera.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
  // Load a teapot model
  teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
  Material mat_tea = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
  teaGeom.setMaterial(mat_tea);
  rootNode.attachChild(teaGeom);

  // Load a floor model
  Material mat_ground = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat_ground.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
  Geometry ground = new Geometry("ground", new Quad(50, 50));
  ground.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));
  ground.setLocalTranslation(-25, -1, 25);
  ground.setMaterial(mat_ground);
  rootNode.attachChild(ground);
  
  // Disable the default first-person cam!
  flyCam.setEnabled(false);

  // Enable a chase cam
  chaseCam = new ChaseCamera(cam, teaGeom, inputManager);

  //Uncomment this to invert the camera's vertical rotation Axis 
  //chaseCam.setInvertVerticalAxis(true);

  //Uncomment this to invert the camera's horizontal rotation Axis
  //chaseCam.setInvertHorizontalAxis(true);

  //Comment this to disable smooth camera motion
  chaseCam.setSmoothMotion(true);

  //Uncomment this to disable trailing of the camera 
  //WARNING, trailing only works with smooth motion enabled. It is true by default.
  //chaseCam.setTrailingEnabled(false);

  //Uncomment this to look 3 world units above the target
  //chaseCam.setLookAtOffset(Vector3f.UNIT_Y.mult(3));

  //Uncomment this to enable rotation when the middle mouse button is pressed (like Blender)
  //WARNING : setting this trigger disable the rotation on right and left mouse button click
  //chaseCam.setToggleRotationTrigger(new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));

  //Uncomment this to set multiple triggers to enable rotation of the cam
  //Here spade bar and middle mouse button
  //chaseCam.setToggleRotationTrigger(new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE),new KeyTrigger(KeyInput.KEY_SPACE));

  //registering inputs for target's movement
  registerInput();

}
 
Example 18
Source File: TestBatchNode.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
    public void simpleInitApp() {
        timer = new NanoTimer();
        batch = new BatchNode("theBatchNode");

        /**
         * A cube with a color "bleeding" through transparent texture. Uses
         * Texture from jme3-test-data library!
         */
        Box boxshape4 = new Box(Vector3f.ZERO, 1f, 1f, 1f );
        cube = new Geometry("cube1", boxshape4);
        Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");     
        cube.setMaterial(mat);
//        Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");        
//        mat.setColor("Diffuse", ColorRGBA.Blue);
//        mat.setBoolean("UseMaterialColors", true);
        /**
         * A cube with a color "bleeding" through transparent texture. Uses
         * Texture from jme3-test-data library!
         */
        Box box = new Box(Vector3f.ZERO, 1f, 1f, 1f);
        cube2 = new Geometry("cube2", box);
        cube2.setMaterial(mat);
        
        TangentBinormalGenerator.generate(cube);
        TangentBinormalGenerator.generate(cube2);


         n = new Node("aNode");
       // n.attachChild(cube2);
        batch.attachChild(cube);
        batch.attachChild(cube2);
      //  batch.setMaterial(mat);
        batch.batch();
        rootNode.attachChild(batch);
        cube.setLocalTranslation(3, 0, 0);
        cube2.setLocalTranslation(0, 3, 0);


        dl=new DirectionalLight();
        dl.setColor(ColorRGBA.White.mult(2));
        dl.setDirection(new Vector3f(1, -1, -1));
        rootNode.addLight(dl);
        flyCam.setMoveSpeed(10);
    }
 
Example 19
Source File: EnvMapUtils.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Creates a debug Node of the given cube map to attach to the gui node
 *
 * the cube map is layered this way :
 * <pre>
 *         _____
 *        |     |
 *        | +Y  |
 *   _____|_____|_____ _____
 *  |     |     |     |     |
 *  | -X  | +Z  | +X  | -Z  |
 *  |_____|_____|_____|_____|
 *        |     |
 *        | -Y  |
 *        |_____|
 *
 *</pre>
 *
 * @param cubeMap the cube map
 * @param assetManager the asset Manager
 * @return a new Node
 */
public static Node getCubeMapCrossDebugView(TextureCubeMap cubeMap, AssetManager assetManager) {
    Node n = new Node("CubeMapDebug" + cubeMap.getName());
    int size = cubeMap.getImage().getWidth();
    Picture[] pics = new Picture[6];

    float ratio = 128f / size;

    for (int i = 0; i < 6; i++) {
        pics[i] = new Picture("bla");
        Texture2D tex = new Texture2D(new Image(cubeMap.getImage().getFormat(), size, size, cubeMap.getImage().getData(i), cubeMap.getImage().getColorSpace()));

        pics[i].setTexture(assetManager, tex, true);
        pics[i].setWidth(size);
        pics[i].setHeight(size);
        n.attachChild(pics[i]);
    }

    pics[0].setLocalTranslation(size, size * 2, 1);
    pics[0].setLocalRotation(new Quaternion().fromAngleAxis(PI, Vector3f.UNIT_Z));
    pics[1].setLocalTranslation(size * 3, size * 2, 1);
    pics[1].setLocalRotation(new Quaternion().fromAngleAxis(PI, Vector3f.UNIT_Z));
    pics[2].setLocalTranslation(size * 2, size * 3, 1);
    pics[2].setLocalRotation(new Quaternion().fromAngleAxis(PI, Vector3f.UNIT_Z));
    pics[3].setLocalTranslation(size * 2, size, 1);
    pics[3].setLocalRotation(new Quaternion().fromAngleAxis(PI, Vector3f.UNIT_Z));
    pics[4].setLocalTranslation(size * 2, size * 2, 1);
    pics[4].setLocalRotation(new Quaternion().fromAngleAxis(PI, Vector3f.UNIT_Z));
    pics[5].setLocalTranslation(size * 4, size * 2, 1);
    pics[5].setLocalRotation(new Quaternion().fromAngleAxis(PI, Vector3f.UNIT_Z));

    Quad q = new Quad(size * 4, size * 3);
    Geometry g = new Geometry("bg", q);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Black);
    g.setMaterial(mat);
    g.setLocalTranslation(0, 0, 0);

    n.attachChild(g);
    n.setLocalScale(ratio);
    return n;
}
 
Example 20
Source File: TestBatchNode.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
    public void simpleInitApp() {
        timer = new NanoTimer();
        batch = new BatchNode("theBatchNode");



        /**
         * A cube with a color "bleeding" through transparent texture. Uses
         * Texture from jme3-test-data library!
         */
        Box boxshape4 = new Box(1f, 1f, 1f);
        cube = new Geometry("cube1", boxshape4);
        Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
        cube.setMaterial(mat);
//        Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");        
//        mat.setColor("Diffuse", ColorRGBA.Blue);
//        mat.setBoolean("UseMaterialColors", true);
        /**
         * A cube with a color "bleeding" through transparent texture. Uses
         * Texture from jme3-test-data library!
         */
        Box box = new Box(1f, 1f, 1f);
        cube2 = new Geometry("cube2", box);
        cube2.setMaterial(mat);

        TangentBinormalGenerator.generate(cube);
        TangentBinormalGenerator.generate(cube2);


        n = new Node("aNode");
        // n.attachChild(cube2);
        batch.attachChild(cube);
        //  batch.attachChild(cube2);
        //  batch.setMaterial(mat);
        batch.batch();
        rootNode.attachChild(batch);
        cube.setLocalTranslation(3, 0, 0);
        cube2.setLocalTranslation(0, 20, 0);


        updateBoindPoints(points);
        frustum = new WireFrustum(points);
        frustumMdl = new Geometry("f", frustum);
        frustumMdl.setCullHint(Spatial.CullHint.Never);
        frustumMdl.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
        frustumMdl.getMaterial().getAdditionalRenderState().setWireframe(true);
        frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red);
        rootNode.attachChild(frustumMdl);
        dl = new DirectionalLight();
        dl.setColor(ColorRGBA.White.mult(2));
        dl.setDirection(new Vector3f(1, -1, -1));
        rootNode.addLight(dl);
        flyCam.setMoveSpeed(10);
    }