Package com.jme3.scene

Examples of com.jme3.scene.Mesh


    }

    @Override
    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
        geom.updateModelBound();

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        mat.setColor("m_Color", ColorRGBA.Blue);
        geom.setMaterial(mat);

        rootNode.attachChild(geom);
    }
View Full Code Here


        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);

          LodControl control = new LodControl();
          modelGeom.addControl(control);
        } catch (Exception e) {}
        assetLogger.modelFinished();
        camNode.detachAllChildren();
        camNode.attachChild(model);
        return null;
View Full Code Here

  public void simpleInitApp() {
    Sphere atmoSphere = new Sphere(48, 48, radius, false, true);
    mat = new Material(assetManager, "MatDefs/SimpleAtmoshere.j3md");
   
    mat.setFloat("radius", radius);
    atmo = new Geometry("atmo_Planet", atmoSphere);
   
    Vector3f pos = new Vector3f(5,0,0);
    atmo.setLocalTranslation(pos);
    mat.setVector3("v3Center", pos);
   
   
    atmo.setMaterial(mat);
      rootNode.attachChild(atmo);
     
      Sphere planetSphere = new Sphere(48, 48, radius * 0.8f);
      Material planteMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      planteMat.setColor("Color", ColorRGBA.Green);
      Geometry planet = new Geometry("geo_Planet", planetSphere);
      planet.setLocalTranslation(pos);
      planet.setMaterial(planteMat);
      rootNode.attachChild(planet);
     
     
     
  }
View Full Code Here

        mat.setColor("m_Specular", ColorRGBA.Red);
       
        teapot.setMaterial(mat);
        rootNode.attachChild(teapot);

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

        pl = new PointLight();
View Full Code Here

    /*
    b.setMode(Mesh.Mode.Points);
    b.setPointSize(10f);
    b.setStatic();
    */
    Geometry g = new Geometry("Bubble", b);
    g.rotate(FastMath.HALF_PI, 0, FastMath.HALF_PI);
    //g.scale(1, 1, -1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    Texture tex = assetManager.loadTexture("Textures/test3.png");
    mat.setTexture("ColorMap", tex);
    //mat.setColor("Color", ColorRGBA.Blue);
    //mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    g.setMaterial(mat);
   
    rootNode.attachChild(g);
   
    /*
    DirectionalLight sun = new DirectionalLight();
View Full Code Here

  /**
   * All cells of the navmesh as a renderable Geometry
   * @return Geometry containing all cells
   */
  public Geometry getDebugMesh(){
    Mesh m = new Mesh();
    m.setMode(Mode.Triangles);
    IntBuffer ib = BufferUtils.createIntBuffer(this.mCellArray.length*3*3);
    FloatBuffer vb = BufferUtils.createFloatBuffer(this.mCellArray.length*3*3);
        vb.rewind();
        int i=0;
        for(Cell c : mCellArray){
          for(int v= 0;v<3;v++){
            vb.put(c.m_Vertex[v].x);
            vb.put(c.m_Vertex[v].y);
            vb.put(c.m_Vertex[v].z);
            ib.put(i++);
          }
        }
    m.setBuffer(Type.Position, 3, vb);
    m.setBuffer(Type.Index, 3, ib);
    m.updateBound();
   
    Geometry g = new Geometry("Debug_NavMesh_"+this.toString(),m);
    g.updateModelBound();
    return g;
  }
View Full Code Here

  /**
   * Packs all border cells into a renderable mesh
   * @return Geometry containing the boder cells
   */
  public Geometry getDebugBorderMesh(){
    Mesh m = new Mesh();
    m.setMode(Mode.Triangles);
    int size = 0;
    for(HashSet<com.l2client.navigation.Cell>  set : allBorders){
      size += set.size();
    }
    IntBuffer ib = BufferUtils.createIntBuffer(size*3*3);
    FloatBuffer vb = BufferUtils.createFloatBuffer(size*3*3);
        vb.rewind();
        int i=0;
        for(HashSet<com.l2client.navigation.Cell>  set : allBorders){
          for(Cell c : set){
            for(int v= 0;v<3;v++){
              vb.put(c.m_Vertex[v].x);
              vb.put(c.m_Vertex[v].y);
              vb.put(c.m_Vertex[v].z);
              ib.put(i++);
            }
          }
        }
        log.severe("Debug Borders for:"+this.toString());
        if(i <= 0){
          log.warning("Navmesh without any bordercells:"+this);
        }
    m.setBuffer(Type.Position, 3, vb);
    m.setBuffer(Type.Index, 3, ib);
    m.updateBound();
   
    Geometry g = new Geometry("Debug_NavBorderMesh_"+this.toString(),m);
    g.updateModelBound();
    return g;
  }
View Full Code Here

   
    l = new Line(new Vector3f(left.EndPointA().x, y, left.EndPointA().y),
          new Vector3f(left.EndPointB().x, y, left.EndPointB().y));
    geometries.add(new Geometry("left", l));

    Mesh m = new Mesh();
    GeometryBatchFactory.mergeGeometries(geometries, m);
    Geometry g = new Geometry("bounds of "+toString(), m);
    g.updateModelBound();
    return g;
View Full Code Here

      // center is in top left corner for nav mesh to be consistent with
      // this for borders move x right, move y up by half size
      Vector3f offset = new Vector3f(xd + 128, 0, yd - 128);
     
      t.reset();   
      Mesh mesh = NavMeshGenerator.buildNavmesh(n);
      if(mesh != null) {
      TiledNavMesh navMesh = new TiledNavMesh();
      navMesh.loadFromMesh(mesh, offset, isMeshRelative);
      time = t.getTimeInSeconds();
      System.out.println("File " + from.getAbsolutePath()
View Full Code Here

        if (spatial == null) {
            return;
        }
        if (spatial instanceof Geometry) {
            Geometry geom = (Geometry) spatial;
            Mesh mesh = geom.getMesh();
            if (mesh instanceof Sphere) {
                collisionShape = new SphereCollisionShape(((Sphere) mesh).getRadius());
                return;
            } else if (mesh instanceof Box) {
                collisionShape = new BoxCollisionShape(new Vector3f(((Box) mesh).getXExtent(), ((Box) mesh).getYExtent(), ((Box) mesh).getZExtent()));
View Full Code Here

TOP

Related Classes of com.jme3.scene.Mesh

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.