Package com.jme3.scene.control

Examples of com.jme3.scene.control.BillboardControl


        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


     * @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());
View Full Code Here

        app.start();
    }

    @Override
    public void simpleInitApp() {
        Spatial teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
      
        teapot.setLocalScale(2f);
        Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
        mat.setFloat("m_Shininess", 32f);
        mat.setBoolean("m_UseMaterialColors", true);

        mat.setColor("m_Ambient",  ColorRGBA.Black);
        mat.setColor("m_Diffuse",  ColorRGBA.Green);
        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();
View Full Code Here

        label.setBox(new Rectangle(0, 0, 12, 8));
        label.setQueueBucket(Bucket.Transparent);
        label.setSize( size );
        label.setText(t);
        label.setColor(ColorRGBA.White);
        label.addControl(new BillboardControl());
        label.setLocalTranslation(x, y, z);
        return label;
    }
View Full Code Here

          float w = txt.getLineWidth()+20f;
          float off = w*0.5f;
          txt.setBox(new Rectangle(-off, 0f, w, txt.getHeight()));
          txt.setAlignment(Align.Center);
          txt.setQueueBucket(Bucket.Transparent);
          txt.addControl(new BillboardControl());
     
      label = new Node("label");
          if(vis.getWorldBound() instanceof BoundingBox){
            BoundingBox bbox = (BoundingBox)vis.getWorldBound();
            label.setLocalTranslation(0f, bbox.getYExtent()+bbox.getYExtent()+0.5f, 0f);
View Full Code Here

        }
        else {
          n.setLocalTranslation(0f, 2.8f, 0f);
          logger.finest("Healthbar by Code @ "+n.getLocalTranslation());
        }
        n.addControl(new BillboardControl());
//        n.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.HALF_PI, Vector3f.UNIT_X));
//        n.updateGeometricState();

      return n; 
  }
View Full Code Here

    public static Node createVertIds(Vector3f[] vertices, BitmapFont guiFont) {
        if (vertices != null) {
            int n = vertices.length;
            if (n > 2) {
                Node node = new Node("vertIds");
                BillboardControl bc;
                BitmapText vertId;
                for (int i = 0; i < n; i++) {
                    bc = new BillboardControl();
                    vertId = new BitmapText(guiFont, false);
                    vertId.setSize(.1f);
                    vertId.setText("vert " + i + " " + vertices[i]);
                    vertId.setLocalTranslation(vertices[i]);
                    vertId.addControl(bc);
View Full Code Here

    }

    public static Node createTriIds(ArrayList<Vector2f> vertices, BitmapFont guiFont) {
        if ((vertices.size() > 2) && ((vertices.size() % 3) == 0)) {
            Node node = new Node("triIds");
            BillboardControl bc;
            BitmapText vertId;
            for (int i = 0; i < vertices.size(); i += 3) {
                tri.set(0, vertices.get(i).x, vertices.get(i).y, 0);
                tri.set(1, vertices.get(i + 1).x, vertices.get(i + 1).y, 0);
                tri.set(2, vertices.get(i + 2).x, vertices.get(i + 2).y, 0);
                tri.calculateCenter();

                bc = new BillboardControl();
                vertId = new BitmapText(guiFont, false);
                vertId.setSize(.1f);
                vertId.setText("tri " + (i / 3));
                vertId.setLocalTranslation(tri.getCenter());
                vertId.addControl(bc);
View Full Code Here

    }

    public static Node createTriIds3d(ArrayList<Vector3f> vertices, BitmapFont guiFont) {
        if ((vertices.size() > 2) && ((vertices.size() % 3) == 0)) {
            Node node = new Node("triIds");
            BillboardControl bc;
            BitmapText vertId;
            for (int i = 0; i < vertices.size(); i += 3) {
                tri.set1(vertices.get(i));
                tri.set2(vertices.get(i + 1));
                tri.set3(vertices.get(i + 2));
                tri.calculateCenter();

                bc = new BillboardControl();
                vertId = new BitmapText(guiFont, false);
                vertId.setSize(.1f);
                vertId.setText("tri " + (i / 3));
                vertId.setLocalTranslation(tri.getCenter());
                vertId.addControl(bc);
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of com.jme3.scene.control.BillboardControl

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.