Examples of Spatial


Examples of com.jme3.scene.Spatial

    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

Examples of com.jme3.scene.Spatial

        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

Examples of com.jme3.scene.Spatial

//      }
     
      //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

Examples of com.jme3.scene.Spatial

    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

Examples of com.jme3.scene.Spatial

    }
    @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

Examples of com.jme3.scene.Spatial

    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

Examples of com.jme3.scene.Spatial

//    if (charSelection != null) {
      if (baseNode == null) { 
//        Asset a = new Asset("troll2/troll.xml.mesh.xml","troll");
//        com.l2client.asset.Singleton.get().getAssetManager().loadAsset(a,true);
        Spatial s = Singleton.get().getAssetManager().getJmeAssetMan().loadModel("models/troll2/troll.xml.mesh.xml");
//        baseNode = (Node) a.getBaseAsset();
        if(s instanceof Node ){
        baseNode = (Node) s;
        baseNode.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));
        baseNode.setName(name);
View Full Code Here

Examples of com.jme3.scene.Spatial

     * initialize gui
     */
    private void setupScene() {

        /** Load a Ninja model (OgreXML + material + texture from test_data) */
        Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");
        ninja.scale(0.05f, 0.05f, 0.05f);
        ninja.rotate(0.0f, -3.0f, 0.0f);
        ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);
        rootNode.attachChild(ninja);
        /** You must add a light to make the model visible */
        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
        rootNode.addLight(sun);
View Full Code Here

Examples of com.tankz.systems.rendering.spatials.Spatial

    graphics.translate(-cameraSystem.getStartX(), -cameraSystem.getStartY());
  }

  @Override
  protected void process(Entity e) {
    Spatial spatial = spatials.get(e.getId());
    spatial.render(graphics);
  }
View Full Code Here

Examples of com.tankz.systems.rendering.spatials.Spatial

    graphics.resetTransform();
  }

  @Override
  protected void added(Entity e) {
    Spatial spatial = getSpatial(e);
    if (spatial != null) {
      spatial.initalize();
      spatials.set(e.getId(), spatial);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.