Package com.jme3.scene

Examples of com.jme3.scene.Node


    /**
    @Override
     **/
    public void simpleInitApp(){
       
  Node node = new Node("My Root node");
  //Box b = new Box("MyBox",new Vector3f(0,0,0),new Vector3f(1,1,1));
  //rootNode.attachChild(b);

  AvatarXMLParser parser = new AvatarXMLParser();
  Avatar avatar = parser.getAvatarFromFile("art/mii/defaultBoy.xml");
  System.out.println(avatar);

  Avatar3DLoader loader = new Avatar3DLoader();
  Model model = loader.loadModel(avatar);

  // remove default light to see the colors
  //rootNode.setLightCombineMode(Spatial.LightCombineMode.Off);
        /*
  // Create a point light
  PointLight l = new PointLight();
  // Give it a location
  l.setLocation(new Vector3f(0, 10, 5));
  // Make it a red light
  //l.setDiffuse(ColorRGBA.red.clone());
  // Enable it
  l.setEnabled(true);
  // Create a LightState to put my light in
  LightState ls = display.getRenderer().createLightState();
  // Attach the light
  ls.attach(l);
  node.setRenderState(ls);
        */


  node.attachChild(model.root);
  rootNode.attachChild(node);

  //lightState.detachAll();
    }
View Full Code Here


    public Node shirt;
    public Node skin;

// ============= Constructors ============== //
    public Model(){
  root = new Node("Model");
    }
View Full Code Here

    }
// ============= Public Methods ============== //
    public Model loadModel(Avatar avatar){
  // TEST, just load
  Model model = new Model();
  Node node = null;
  // load the body
  Node body = baseTable.loadBody(avatar.skin.color,avatar.shirt.color);
  Node head = baseTable.loadHead(avatar.head.type,avatar.skin.color);
        baseTable.loadEyes(avatar.eye,head);
  if(head != null && body != null){
      model.load(head,body);
  }
View Full Code Here

    /**
     * Handles loading a single node from file.
     * @param obj the path to the object.
     **/
    public Node loadNode(String obj){
  Node node = new Node();
  try{
            Spatial spatial = assetManager.loadModel(obj);
            //Material mat = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
            //spatial.setMaterial(mat);
            node.attachChild(spatial);

      node.setModelBound(new BoundingSphere());
      node.updateModelBound();
  } catch (Exception e) {
            e.printStackTrace();
      //logger.logp(Level.SEVERE, this.getClass().toString(),"loadNode()", "Exception", e);
      node = null;
  }
View Full Code Here

   
    setPointLight(true);
   
    guiNode.detachChildNamed("Statistics View");

    camNode = new Node("Cam Node");

    flyCam.setEnabled(false);
    ChaseCamera chaseCam = new ChaseCamera(cam, camNode, inputManager);
    chaseCam.setSmoothMotion(true);
    chaseCam.setMaxDistance(100000);
View Full Code Here

        if (path.startsWith(File.separator)) {
          relPath = path.substring(1);
        } else {
          relPath = path;
        }
        Node model = (Node) assetManager.loadModel(relPath);
        if (model == null) {
          assetLogger.modelFinished();
          logger.log(Level.SEVERE, "Couldn't load model "+path);
          return null;
        }
        Geometry modelGeom = (Geometry) model.getChild(0);

        try {
          // trows an Exception if lod is not supported
          modelGeom.setLodLevel(0);
View Full Code Here

        rootNode.attachChild(loadWord("HGFEBCA"));

  }
 
  private Node loadWord(String text) {
    Node word = new Node("word");
    int i = 0;
    float size = 0.65f;
    for (char c : text.toCharArray()) {
      Spatial letter = loadLetter(String.valueOf(c));
      letter.setLocalTranslation(size*i, 0, 0);
      word.attachChild(letter);
      i++;
    }
    return word;
  }
View Full Code Here

    // Load water
    // Load common sounds
    // Load filters for it
    public void loadCommon() {
       
        Node mainScene = new Node("Main Scene");
        rootNode.attachChild(mainScene);
       
        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(lightDir);
        sun.setColor(ColorRGBA.White.clone().multLocal(1.7f));
        rootNode.addLight(sun);
       
        Spatial sky = SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false);
        sky.setLocalScale(350);
       
        mainScene.attachChild(sky);
       
        water = new WaterFilter(rootNode, lightDir);
       
        FilterPostProcessor fpp = myApp.getFpp();
       
View Full Code Here

        BulletAppState bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);

        // Load Island
        Node island = (Node) assetManager.loadModel("Scenes/island2_1.j3o");
        rootNode.attachChild(island);

        bulletAppState.getPhysicsSpace().addAll(island);

        island.getChild("SpawningPoints").setCullHint(Spatial.CullHint.Always);

        Node mainScene = new Node("Main Scene");
        rootNode.attachChild(mainScene);

        Spatial sky = SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false);
        sky.setLocalScale(350);

        mainScene.attachChild(sky);

        water = new WaterFilter(rootNode, lightDir);

        FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
View Full Code Here

        stateManager.attach(bulletAppState);
//        bulletAppState.getPhysicsSpace().setAccuracy(1f/30f);
        bulletAppState.getPhysicsSpace().enableDebug(assetManager);

        // Load Island
        Node island = (Node) assetManager.loadModel("Models/Islands/ogre/island_01.j3o");
        rootNode.attachChild(island);

        // Load Island CollisionMesh
        Node islandCollision = (Node) assetManager.loadModel("Models/Islands/ogre/island_01_collision.j3o");
        Geometry geoCollision = (Geometry) islandCollision.getChild(0);
        CollisionShape colShape = new MeshCollisionShape(geoCollision.getMesh());
        colShape.setMargin(0.005f);
        RigidBodyControl rigControl = new RigidBodyControl(colShape, 0);
        island.addControl(rigControl);
        bulletAppState.getPhysicsSpace().add(rigControl);


        // Load trees
        Node trees = (Node) assetManager.loadModel("Models/Islands/ogre/trees_01.j3o");
        rootNode.attachChild(trees);
        for (Spatial sp : trees.getChildren()) {
            Node nd = (Node) sp;
            nd.detachAllChildren();

            if (nd.getName().indexOf("plant_01") == 0) {
                // Load Tree
                Node tree_1 = (Node) assetManager.loadModel("Models/Plants/ogre/plant_01.j3o");
                tree_1.getChild(1).setQueueBucket(Bucket.Transparent);
                nd.attachChild(tree_1);
            }
            else if (nd.getName().indexOf("plant_02") == 0) {
                // Load Tree
                Node tree_1 = (Node) assetManager.loadModel("Models/Plants/ogre/plant_02.j3o");
                tree_1.getChild(1).setQueueBucket(Bucket.Transparent);
                nd.attachChild(tree_1);
            }
            else if (nd.getName().indexOf("plant_03") == 0) {
                // Load Tree
                Node tree_1 = (Node) assetManager.loadModel("Models/Plants/ogre/plant_03.j3o");
                tree_1.getChild(1).setQueueBucket(Bucket.Transparent);
                nd.attachChild(tree_1);
            }           
            else if (nd.getName().indexOf("plant_04") == 0) {
                // Load Tree
                Node tree_1 = (Node) assetManager.loadModel("Models/Plants/ogre/plant_04.j3o");
                tree_1.getChild(1).setQueueBucket(Bucket.Transparent);
                nd.attachChild(tree_1);
            }
        }

        DirectionalLight dl = new DirectionalLight();
View Full Code Here

TOP

Related Classes of com.jme3.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.