Package com.jme3.scene

Examples of com.jme3.scene.Spatial


    @Override
    public void simpleInitApp() {
        viewPort.setBackgroundColor(ColorRGBA.DarkGray);

        Spatial bumpy = (Spatial) assetManager.loadModel("Models/MonkeyHead/MonkeyHead.mesh.xml");
        rootNode.attachChild(bumpy);

        lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
        lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
        rootNode.attachChild(lightMdl);
View Full Code Here


        0.32999992f, 0.6059958f);
    fpp.addFilter(ssaoFilter);
    SSAOUI ui = new SSAOUI(inputManager, ssaoFilter);
    viewPort.addProcessor(fpp);
   
    Spatial n = assetManager
        .loadModel("scenes/create/create.j3o");
    rootNode.attachChild(n);

    for(Light l :n.getLocalLightList())
      if(l instanceof AmbientLight)
        l.setColor(new ColorRGBA(0.5f,0.5f,0.5f,1.0f));
   
    PartSetManager man = PartSetManager.get();
    man.loadParts("dwarf.csv");
    Spatial n2 = Assembler2.getModel3("DwarfWarriorM");
//    n.setLocalTranslation(.126f,-.1224f, 5.76f);
    n2.setLocalTranslation(.126f, -0.1224f, 7.76f);
    ((Node)n).attachChild(n2);
   
    /**
     * Camera Position: (2.1353703, 0.10786462, 14.364603)
Camera Rotation: (0.0127822235, 0.98611915, 0.13812076, -0.091258995)
View Full Code Here

        Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
        Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
        Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
        Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");

        Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
        rootNode.attachChild(sky);

    }
View Full Code Here

  /**
   * Returns an item model
   */
  protected Node createVisuals() {
    if (vis == null) { 
      Spatial s = Singleton.get().getAssetManager().getJmeAssetMan().loadModel("items/bottle/HealthFlask.j3o");
      if(s instanceof Node ){
        vis = (Node) s.clone(false);
        vis.setName(name);
//        vis.setLocalTranslation(0f, 1f, 0f);
      }
    }
   
View Full Code Here

    try {
      Geometry g;
      // need to load vial loadModel, JME does not see obj, etc as
      // Assets..
      t.reset();
      Spatial n = (Spatial) assetMan.loadModel(from.getAbsolutePath());
      time = t.getTimeInSeconds();
      System.out.println("File " + from.getAbsolutePath() + " loaded in "
          + time + " seconds");
      if (n instanceof Geometry) {
        g = (Geometry) n;
        n = new Node(g.getName());
        ((Node)n).attachChild(g);
      } else if (n instanceof Node) {
        if (((Node) n).getChildren().size() > 1)
          throw new Throwable(
              "Mesh with more children detected than one on "
                  + from.getName());
        g = (Geometry) ((Node) n).getChild(0);
      } else
        throw new Throwable("Spatial loaded was unexpected type "
            + n.getClass());
      // jme fucked up the model names, and ignores any object name
      // entries so we fix a bit
      String fName = from.getName().substring(0,
          from.getName().length() - fileEnding.length());// without .nav
      g.setName(fName.toLowerCase());
View Full Code Here

    try {
//      System.out.println("-------------------------------------------------------");
      // need to load vial loadModel, JME does not see obj, etc as
      // Assets..
      t.reset();
      Spatial model = assetMan.loadModel(from.getAbsolutePath());
      Node n = new Node("dummy");
      if(!(model instanceof Node))
        n.attachChild(model);
      time = t.getTimeInSeconds();
//      System.out.println("File " + from.getAbsolutePath() + " loaded in "
View Full Code Here

        String fName = name.getName().substring(0,name.getName().length()-".mesh.xml".length());
        Node n =  (Node) assetMan.loadAsset(name.getAbsolutePath());
        if(n.getChildren().size() > 1)
          throw new Throwable("Mesh with more children detected than one on "+name.getName());
       
        Spatial s = n.getChild(0);
        String mat = "default";
        if(s instanceof Geometry) {
          Geometry g = ((Geometry)s);
          g.setName(fName);
          g.updateModelBound();
View Full Code Here

//      }
     
      //ARGH !! the troll in the sdk is a standard jme anim troll,
      //it does not work without being loaded by the standard animation package using animationproviders
      //so relaping it here
      Spatial troll = n.getChild("troll")
      if(troll != null){
        n.detachChild(troll);
        VisibleModel newtroll = new VisibleModel(null);
        newtroll.attachVisuals();
        newtroll.setLocalTranslation(troll.getLocalTranslation());
        n.attachChild(newtroll);
      }
      //this is needed as the chars are on a different node and would not be rendered
      //just add, do not remove here..
      for(Light l : n.getLocalLightList()){
View Full Code Here

    float time = 0f;

    // new loader each time, yes
    try {
      t.reset();
      Spatial n = (Spatial) assetMan.loadModel(from.getAbsolutePath());
      if(n != null) {
        String fName = from.getName().substring(0,
            from.getName().length() - fileEnding.length());
        fName = from.getParent()+"/"+fName+".j3o";
        n.updateModelBound();
        n.updateGeometricState();
        BinaryExporter.getInstance().save(n,new File(fName));
        time = t.getTimeInSeconds();
        System.out.println("File "+fName+".saved in "+ time +" seconds");
      } else {
        System.out.println("Failed to load model "+from);
View Full Code Here

    }
    @Override
    public void afterLoad(){
      if(baseAsset != null && baseAsset instanceof Spatial){
        log.finer("DeferredTerrainAsset afterLoad of:"+this.name);
        Spatial n = (Spatial)baseAsset;
          if(moveNonNavToOrigin)
            n.setLocalTranslation(Tile.getWorldPositionOfXTile(x), 0f,Tile.getWorldPositionOfZTile(z));

////this is just for demonstration, move this out, should be detail1 or grass1
//log.finer("TerrainTile loaded at:"+n.getWorldTranslation());
//
//if(!(n instanceof Node)){
View Full Code Here

TOP

Related Classes of com.jme3.scene.Spatial

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.