Example #1
0
  private void addObjects() {
    final Box box1 = new Box("box", Vector3.ZERO, 5, 15, 5);
    box1.setTranslation(0, box1.getYExtent(), 0);
    TextureState ts = new TextureState();
    ts.setTexture(
        TextureManager.load("images/skybox/1.jpg", Texture.MinificationFilter.Trilinear, true));
    box1.setRenderState(ts);
    box1.getSceneHints().setPickingHint(PickingHint.Pickable, true);
    box1.setModelBound(new BoundingBox());

    final Node base = new Node();
    base.setTranslation(0, 0, 0);
    base.attachChild(box1);
    _root.attachChild(base);

    final Sphere sphere = new Sphere("sphere", Vector3.ZERO, 16, 16, 8);
    ts = new TextureState();
    ts.setTexture(
        TextureManager.load(
            "images/water/dudvmap.png", Texture.MinificationFilter.Trilinear, true));
    sphere.setRenderState(ts);
    sphere.getSceneHints().setPickingHint(PickingHint.Pickable, true);
    sphere.setModelBound(new BoundingSphere());

    final Node joint = new Node();
    joint.setTranslation(0, sphere.getRadius() + 2 * box1.getYExtent(), 0);
    joint.attachChild(sphere);
    base.attachChild(joint);

    final Box box2 = new Box("box", Vector3.ZERO, 5, 15, 5);
    box2.setTranslation(0, box2.getYExtent(), 0);
    ts = new TextureState();
    ts.setTexture(
        TextureManager.load("images/skybox/3.jpg", Texture.MinificationFilter.Trilinear, true));
    box2.setRenderState(ts);
    box2.getSceneHints().setPickingHint(PickingHint.Pickable, true);
    box2.setModelBound(new BoundingBox());

    final Node arm = new Node();
    arm.setTranslation(0, sphere.getRadius(), 0);
    arm.attachChild(box2);
    joint.attachChild(arm);

    // auto select the joint
    _root.updateGeometricState(0);
    manager.setSpatialTarget(joint);
  }
  private Node createModel() {
    final Node node = new Node("Node");

    final Box box = new Box("Box", new Vector3(), 5, 5, 5);
    box.setModelBound(new BoundingBox());
    box.setTranslation(new Vector3(-3, 0, 0));
    box.setRandomColors();
    node.attachChild(box);

    final Teapot teapot = new Teapot("Teapot");
    teapot.setScale(2.0);
    teapot.setTranslation(new Vector3(3, 0, 0));
    node.attachChild(teapot);

    final Torus torus = new Torus("Torus", 128, 128, 2, 4);
    torus.setTranslation(new Vector3(-8, 3, 0));
    node.attachChild(torus);

    return node;
  }
Example #4
0
 public static void attachToScene(Node root, LogicalLayer logicalLayer) {
   detachFromScene();
   REF = new Analyzer(root, logicalLayer);
   root.attachChild(REF);
 }