Package com.jme.scene

Examples of com.jme.scene.Node


      System.out.println( TileTexture.TILE_WIDTH + "x" + TileTexture.TILE_HEIGHT );
     
      Node[][] nodes = new Node[10][10];
      for( int n = 0; n < 10; n++ ) {
        for( int j = 0; j < 10; j++ ) {
          nodes[n][j] = new Node();
        }
      }
     
      for( int x = 0; x < tileMap.getTilesWide(); x++ ) {
        for( int y = 0; y < tileMap.getTilesHigh(); y++ ) {
View Full Code Here


    setupKeyBindings();

    setupFog();

    Node reflectedNode = new Node( "reflectNode" );

    buildSkyBox();
    reflectedNode.attachChild( skybox );
    reflectedNode.attachChild( createObjects() );

    rootNode.attachChild( reflectedNode );

    waterEffectRenderPass = new WaterRenderPass( cam, 1
        , false, true );
View Full Code Here

    skybox.lockBounds();
    skybox.lockMeshes();
  }

  private Node createObjects() {
    Node objects = new Node( "objects" );

    //Torus torus = new Torus( "Torus", 50, 50, 10, 20 );
    //torus.setLocalTranslation( new Vector3f( 50, -5, 20 ) );
    TextureState ts = display.getRenderer().createTextureState();
    Texture t0 = TextureManager.loadTexture(
        TestQuadWater.class.getClassLoader().getResource(
            "jmetest/data/images/Monkey.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    Texture t1 = TextureManager.loadTexture(
        TestQuadWater.class.getClassLoader().getResource(
            "jmetest/data/texture/north.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t1.setEnvironmentalMapMode( Texture.EM_SPHERE );
    ts.setTexture( t0, 0 );
    ts.setTexture( t1, 1 );
    ts.setEnabled( true );
    //torus.setRenderState( ts );
    //objects.attachChild( torus );

    ts = display.getRenderer().createTextureState();
    t0 = TextureManager.loadTexture(
        TestQuadWater.class.getClassLoader().getResource(
            "jmetest/data/texture/wall.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    Box box = new Box( "box1", new Vector3f( -10, -10, -10 ), new Vector3f( 10, 10, 10 ) );
    box.setLocalTranslation( new Vector3f( 0, -7, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box2", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 15, 10, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box3", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 0, -10, 15 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box4", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 20, 0, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    ts = display.getRenderer().createTextureState();
    t0 = TextureManager.loadTexture(
        TestSimpleQuadWater.class.getClassLoader().getResource(
            "jmetest/data/images/Monkey.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    box = new Box( "box5", new Vector3f( -50, -2, -50 ), new Vector3f( 50, 2, 50 ) );
    box.setLocalTranslation( new Vector3f( 0, -15, 0 ) );
    box.setRenderState( ts );
    box.setModelBound( new BoundingBox() );
    box.updateModelBound();
    objects.attachChild( box );

    return objects;
  }
View Full Code Here

      debugQuadsNode.setCullMode( SceneElement.CULL_NEVER );
    }
  }

  private void createDebugQuads() {
    debugQuadsNode = new Node( "quadNode" );
    debugQuadsNode.setCullMode( SceneElement.CULL_NEVER );

    float quadWidth = display.getWidth() / 8;
    float quadHeight = display.getWidth() / 8;
       
View Full Code Here

    setupKeyBindings();

    setupFog();

    Node reflectedNode = new Node( "reflectNode" );

    buildSkyBox();
    reflectedNode.attachChild( skybox );
    reflectedNode.attachChild( createObjects() );

    rootNode.attachChild( reflectedNode );

    waterEffectRenderPass = new WaterRenderPass( cam, 4, false, true );
    //set equations to use z axis as up
View Full Code Here

    skybox.lockBounds();
    skybox.lockMeshes();
  }

  private Node createObjects() {
    Node objects = new Node( "objects" );

    Torus torus = new Torus( "Torus", 50, 50, 10, 20 );
    torus.setLocalTranslation( new Vector3f( 50, -5, 20 ) );
    TextureState ts = display.getRenderer().createTextureState();
    Texture t0 = TextureManager.loadTexture(
        TestSimpleQuadWater.class.getClassLoader().getResource(
            "jmetest/data/images/Monkey.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    Texture t1 = TextureManager.loadTexture(
        TestSimpleQuadWater.class.getClassLoader().getResource(
            "jmetest/data/texture/north.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t1.setEnvironmentalMapMode( Texture.EM_SPHERE );
    ts.setTexture( t0, 0 );
    ts.setTexture( t1, 1 );
    ts.setEnabled( true );
    torus.setRenderState( ts );
    objects.attachChild( torus );

    ts = display.getRenderer().createTextureState();
    t0 = TextureManager.loadTexture(
        TestSimpleQuadWater.class.getClassLoader().getResource(
            "jmetest/data/texture/wall.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    Box box = new Box( "box1", new Vector3f( -10, -10, -10 ), new Vector3f( 10, 10, 10 ) );
    box.setLocalTranslation( new Vector3f( 0, -7, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box2", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 15, 10, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box3", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 0, -10, 15 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box4", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 20, 0, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    ts = display.getRenderer().createTextureState();
    t0 = TextureManager.loadTexture(
        TestSimpleQuadWater.class.getClassLoader().getResource(
            "jmetest/data/images/Monkey.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    box = new Box( "box5", new Vector3f( -50, -2, -50 ), new Vector3f( 50, 2, 50 ) );
    box.setLocalTranslation( new Vector3f( 0, -15, 0 ) );
    box.setRenderState( ts );
    box.setModelBound( new BoundingBox() );
    box.updateModelBound();
    objects.attachChild( box );

    return objects;
  }
View Full Code Here

      debugQuadsNode.setCullMode( SceneElement.CULL_NEVER );
    }
  }

  private void createDebugQuads() {
    debugQuadsNode = new Node( "quadNode" );
    debugQuadsNode.setCullMode( SceneElement.CULL_NEVER );

    float quadWidth = display.getWidth() / 8;
    float quadHeight = display.getWidth() / 8;
    Quad debugQuad = new Quad( "reflectionQuad", quadWidth, quadHeight );
View Full Code Here

    model = loadModel(this.filename);
    this.attachChild(getClodNodeFromParent((Node)model));
  }
 
  public static Node getModelNode(String filename) throws MalformedURLException {
    Node parent = new Node();
    parent.attachChild(loadModel(new File(filename).toURI().toURL()));
    System.out.println("Model " + filename + " loaded");
    if(parent == null) {
      System.out.println(" model is null");
    }
    Node clod = getClodNodeFromParent(parent);
    if(clod == null) {
      System.out.println(" clod is null");
    }
    return clod;
  }
View Full Code Here

   * @see SimpleGame
   */
  @Override
  protected void simpleInitGame() {
    //create a node for our GUI and change which render queue it's in
    guiNode = new Node("gui node");
    guiNode.setRenderQueueMode(Renderer.QUEUE_ORTHO); //this is make sure it is drawn correctly
   
    //create the actual desktop object and attach it to our node
    final JMEDesktop gui = new JMEDesktop("GUI", 500, 400, input);
    guiNode.attachChild(gui);
View Full Code Here

   *             </code> as a child
   *
   */
  public static Node getClodNodeFromParent(Node meshParent) {
        // Create a node to hold my cLOD mesh objects
        Node clodNode = new Node("Clod node");
        // For each mesh in maggie
        for (int i = 0; i < meshParent.getQuantity(); i++){
            final Spatial child = meshParent.getChild(i);
            if(child instanceof Node) {
                clodNode.attachChild(getClodNodeFromParent((Node)child));
            }
            else if ( child instanceof TriMesh ) {
                // Create an AreaClodMesh for that mesh.  Let it compute records automatically
                AreaClodMesh acm = new AreaClodMesh("part"+i,(TriMesh)child, null);
                acm.setModelBound(new BoundingSphere());
                acm.updateModelBound();

                // Allow 1/2 of a triangle in every pixel on the screen in the bounds.
                acm.setTrisPerPixel(.5f);

                // Force a move of 2 units before updating the mesh geometry
                acm.setDistanceTolerance(2);

                // Give the clodMesh node the material state that the original had.
                acm.setRenderState(child.getRenderState(RenderState.RS_MATERIAL));

                // Attach clod node.
                clodNode.attachChild(acm);
            }
            else
            {
                System.err.println("Unhandled Spatial type: " + child.getClass());
            }
View Full Code Here

TOP

Related Classes of com.jme.scene.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.