Package com.jme3.scene

Examples of com.jme3.scene.Mesh


        return geom;
    }

    public static final Geometry createFace(Vector3f extent) {
        Mesh m;
        Geometry g;

        Vector3f[] verts = new Vector3f[] { faceVertices[0],
                                            faceVertices[1].mult(extent),
                                            faceVertices[2].mult(extent),
                                            faceVertices[3].mult(extent) };

        m = new Mesh();
        m.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(verts));
        m.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(sqrNormals));
        m.setBuffer(Type.Index, 1, BufferUtils.createIntBuffer(sqrIndexes));
        m.setMode(Mode.Lines);
        m.updateCounts();
        m.updateBound();

        g = new Geometry("Face(" + verts[0] + ", " + verts[1]
                + ", " + verts[2] + ", " + verts[3] + ")", m);
        g.updateModelBound();
View Full Code Here


    public static final Geometry createBox(float xExtent, float yExtent, float zExtent) {
        return createBox(v3f_0.set(xExtent, yExtent, zExtent));
    }

    public static final Geometry createBox(Vector3f extent) {
        Mesh m;
        Geometry g;

        Vector3f[] vertices = new Vector3f[] { cubeVertices[0],
                                               cubeVertices[1].mult(extent),
                                               cubeVertices[2].mult(extent),
                                               cubeVertices[3].mult(extent),
                                               cubeVertices[4].mult(extent),
                                               cubeVertices[5].mult(extent),
                                               cubeVertices[6].mult(extent),
                                               cubeVertices[7].mult(extent) };

        m = new Mesh();
        m.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));
        m.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(normals));
        m.setBuffer(Type.Index, 1, BufferUtils.createIntBuffer(indexes));
        m.setMode(Mode.Lines);
        m.updateCounts();
        m.updateBound();

        g = new Geometry("Box" + extent, m);
        g.updateModelBound();

        return g;
View Full Code Here

        boundGeometry.setMaterial(showChunkLODs == true ? lodMat
                                                        : DebugMaterials.boundMat);
    }

    public Geometry createGeometry(VoxelSurface s) {
        Mesh mesh = new Mesh();

        mesh.setBuffer(Type.Index, 1, s.getIndexes());
        mesh.setBuffer(Type.Position, 3, s.getVertices());
        mesh.setBuffer(Type.Normal, 3, s.getNormals());
        mesh.setBuffer(Type.Tangent, 4, s.getTangents());
        mesh.setBuffer(Type.Binormal, 3, s.getBinormals());
        mesh.setBuffer(Type.TexCoord, 2, s.getTexCoords());

        mesh.updateBound();

        Geometry g = new Geometry("VoxelGeometry", mesh);

        return g;
    }
View Full Code Here

        return g;
    }

    public Geometry createGeometry2(VoxelSurface s) {
        Mesh mesh = new Mesh();

        mesh.setBuffer(Type.Index, 1, s.getIndexes());
        mesh.setBuffer(Type.Position, 3, s.getVertices());
        mesh.setBuffer(Type.Normal, 3, s.getNormals());
        mesh.setBuffer(Type.Tangent, 4, s.getTangents());
        mesh.setBuffer(Type.Binormal, 3, s.getBinormals());
        mesh.setBuffer(Type.TexCoord, 2, s.getTexCoords());

        mesh.updateBound();

        Geometry g = new Geometry("VoxelGeometry", mesh);

        return g;
    }
View Full Code Here

        vertList.clear();
        normList.clear();
        indexList.clear();
        components.clear();

        Mesh m = new Mesh();
        m.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));
        m.setBuffer(Type.TexCoord, 2, BufferUtils.createFloatBuffer(texCoords));
        m.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(normals));
        m.setBuffer(Type.Index, 1, BufferUtils.createIntBuffer(indexes));
        m.updateBound();

        return new Geometry("Terrain", m);
    }
View Full Code Here

    /**
    @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

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.