Package com.jme3.scene

Examples of com.jme3.scene.Geometry


  }

  public void registerGeometries() {
    for (Spatial s : mesh.getChildren()) {
      if (s instanceof Geometry) {
        Geometry g = (Geometry) s;
        Pollux.get().getGeometryManager().registerGeometry(g, this);
      }
    }
  }
View Full Code Here


        bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);

        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry g = new Geometry("b", b);
        BoxCollisionShape boxCollisionShape = new BoxCollisionShape(new Vector3f(1, 1, 1));
        g.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md" ));
        g.addControl(new RigidBodyControl(boxCollisionShape, 1));
        g.getControl(RigidBodyControl.class).setKinematic(true);
        bulletAppState.getPhysicsSpace().add(g);
        rootNode.attachChild(g);

        Geometry g1 = g.clone(false);
        g1.addControl(new RigidBodyControl(boxCollisionShape, 1));
        g1.getControl(RigidBodyControl.class).setKinematic(true);
        bulletAppState.getPhysicsSpace().add(g1);
        rootNode.attachChild(g1);

        bulletAppState.getPhysicsSpace().enableDebug(assetManager);
View Full Code Here

        updateTexture();
    }

    private void updateTexture() {
        Geometry g = Util.getGeometryFromNode(spatial);
        if (g != null) {
            Material m = g.getMaterial();
            m.setColor("Ambient", color);
            m.setColor("Diffuse", color);
        }
    }
View Full Code Here

        Node island = (Node) assetManager.loadModel("Models/Islands/ogre/island_01.j3o");
        rootNode.attachChild(island);

        // Load Island CollisionMesh
        Node islandCollision = (Node) assetManager.loadModel("Models/Islands/ogre/island_01_collision.j3o");
        Geometry geoCollision = (Geometry) islandCollision.getChild(0);
        CollisionShape colShape = new MeshCollisionShape(geoCollision.getMesh());
        colShape.setMargin(0.005f);
        RigidBodyControl rigControl = new RigidBodyControl(colShape, 0);
        island.addControl(rigControl);
        bulletAppState.getPhysicsSpace().add(rigControl);
View Full Code Here

    }

    public void createBlock (Vector3f extents) {
        this.extents = extents;
        Box b = new Box(new Vector3f(-extents.x, -extents.y, -extents.z), extents);
        Geometry box = new Geometry("block", b);
        spatial = box;
    }
View Full Code Here

      "Pollux3D loading...";
 
  @Override
  public Node create(AssetManager assetManager, Camera cam) {
        Quad q = new Quad(20, 10);
        Geometry g = new Geometry("quad", q);
        g.setLocalTranslation(-10, -5, -0.0001f);
        Material bg = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        bg.setColor("Color", ColorRGBA.Black);
        g.setMaterial(bg);
        sceneNode.attachChild(g);

        Quad q_small = new Quad(9.0f, 3.0f);
        Geometry logo = new Geometry("quad", q_small);
        logo.setLocalTranslation(-4.5f, -1.5f, 1);
        Material logo_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Texture logo_tex = assetManager.loadTexture("Textures/pollux.jpg");
        logo_mat.setTexture("ColorMap", logo_tex);
        logo.setMaterial(logo_mat);
        sceneNode.attachChild(logo);
       
       
        BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
        BitmapText txt = new BitmapText(fnt, false);
View Full Code Here

  private void genSunClickGeo() {
    Sphere s = new Sphere(16, 16, size);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
    mat.setColor("Color", ColorRGBA.Yellow);
    mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack);
      sun = new Geometry("geo_"+name, s);
      sun.setMaterial(mat);
      sun.setShadowMode(ShadowMode.Off);
     
  }
View Full Code Here

    System.out.println(indent+n.getName()+":"+n.getClass().getSimpleName()+" at "+n.getWorldTranslation()+ " bounds:"+n.getWorldBound()+" buck:"+n.getQueueBucket());
    for(Light l :n.getLocalLightList()){
      System.out.println(indent+"  + Light:"+l.getType()+" Color:"+l.getColor());
    }
    if(n instanceof Geometry){
      Geometry g = (Geometry) n;
      System.out.println(indent+"   - mat:"+g.getMaterial().getName()+" buck:"+g.getQueueBucket()+", blend:"+g.getMaterial().getAdditionalRenderState().getBlendMode());
    }
    if(n instanceof Node)
      for(Spatial c : ((Node)n).getChildren()){
//        if(c instanceof Geometry){
//          c.setCullHint(Spatial.CullHint.Dynamic);
View Full Code Here

        Node a = s.getParent();
        if(a==null)return;
        BoundingVolume bound = ((Geometry) s).getModelBound();
        if(bound instanceof BoundingBox) {
          WireBox b = new WireBox(((BoundingBox) bound).getXExtent(), ((BoundingBox) bound).getYExtent(), ((BoundingBox) bound).getZExtent());
          Geometry g = new Geometry(null, b);
          g.setLocalTransform(s.getWorldTransform());
          g.setMaterial(matWireframe);
          bboxes.attachChild(g);
        }
      }
      if(s instanceof Node) {
        addBBoxes((Node) s);
View Full Code Here

        navs.detachChildNamed("NavMeshes");
      } else {
        Node node = new Node("NavMeshes");
        TiledNavMesh[] array = Singleton.get().getNavManager().getNavMeshes();;
        for(TiledNavMesh t : array){
          Geometry g = t.getDebugMesh();
          g.setMaterial(matWireframe);
          node.attachChild(g);
        }
        navs.attachChild(node);   
      }
    }
View Full Code Here

TOP

Related Classes of com.jme3.scene.Geometry

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.