Examples of Spatial


Examples of com.ardor3d.scenegraph.Spatial

    }

    protected void clearOver() {
        _openButton.switchState(_openButton.getDefaultState());
        for (int i = _valuesMenu.getNumberOfChildren(); --i >= 0;) {
            final Spatial item = _valuesMenu.getChild(i);
            if (item instanceof UIButton) {
                final UIButton over = (UIButton) item;
                over.switchState(over.getDefaultState());
            }
        }
View Full Code Here

Examples of com.jme.scene.Spatial

        if (children == null) {
            return;
        }
        indentBuffer.append('\t');
        for (Iterator<Spatial> it = children.iterator(); it.hasNext();) {
            Spatial spatial = it.next();
            if (spatial instanceof Node) {
                printChildren((Node) spatial, buffer, indent +1);
            } else {
                buffer.append(indentBuffer.toString());
                buffer.append(spatial.toString());
                buffer.append('\n');
            }
        }
    }
View Full Code Here

Examples of com.jme.scene.Spatial

    public static void getNamedNodes(Node rootNode, final HashMap<String, Spatial> nodeMap) {
        TreeScan.findNode(rootNode, new ProcessNodeInterface() {

            public boolean processNode(Spatial node) {
                if (node.getName()!=null) {
                    Spatial old = nodeMap.put(node.getName(), node);
                    if (old!=null)
                        Logger.getLogger(ScenegraphUtils.class.getName()).warning("Duplicate node name in scene "+node.getName());
                }
                return true;
            }
View Full Code Here

Examples of com.jme.scene.Spatial

        }
    }

    private static void testNamedNode(Node testNode, String string) {
        System.out.println("TEST: FINDING NAMED NODE");
        Spatial found = findNamedNode(testNode, string);
        if (found != null) {
            System.out.println("Found spatial for " + string + " --> " + found);
        } else {
            System.err.println("Failed to find node for " + string);
        }
View Full Code Here

Examples of com.jme.scene.Spatial

        System.out.println(buffer.toString());
    }

    private static void testPrintParents(Node testNode, String string) {
        System.out.println("TEST: PRINT PARENTS");
        Spatial found = findNamedNode(testNode, string);
        if (found != null) {
            StringBuffer buffer = new StringBuffer();
            printParents(found, buffer);
            System.out.println(buffer.toString());
        } else {
View Full Code Here

Examples of com.jme.scene.Spatial

   *
   * @return  a <code>Spatial</code> representing the model or <code>null</code> if
   *       it cannot load the specified model
   */
  public static Spatial loadModel(URL name) {
    Spatial model;
   
    FormatConverter converter = new ObjToJme();
    converter.setProperty("mtllib", name); //tell converter where to find the mtl file
   
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
View Full Code Here

Examples of com.jme.scene.Spatial

  public static Node getClodNodeFromParent(Node meshParent) {
        // Create a node to hold my cLOD mesh objects
        Node clodNode = new Node("Clod node");
        // For each mesh in maggie
        for (int i = 0; i < meshParent.getQuantity(); i++){
            final Spatial child = meshParent.getChild(i);
            if(child instanceof Node) {
                clodNode.attachChild(getClodNodeFromParent((Node)child));
            }
            else if ( child instanceof TriMesh ) {
                // Create an AreaClodMesh for that mesh.  Let it compute records automatically
                AreaClodMesh acm = new AreaClodMesh("part"+i,(TriMesh)child, null);
                acm.setModelBound(new BoundingSphere());
                acm.updateModelBound();

                // Allow 1/2 of a triangle in every pixel on the screen in the bounds.
                acm.setTrisPerPixel(.5f);

                // Force a move of 2 units before updating the mesh geometry
                acm.setDistanceTolerance(2);

                // Give the clodMesh node the material state that the original had.
                acm.setRenderState(child.getRenderState(RenderState.RS_MATERIAL));

                // Attach clod node.
                clodNode.attachChild(acm);
            }
            else
            {
                System.err.println("Unhandled Spatial type: " + child.getClass());
            }
        }
        return clodNode;
    }
View Full Code Here

Examples of com.jme.scene.Spatial

   * by JGN.
   */
  public boolean remove(SynchronizeRemoveMessage srm, Object obj) {
    System.out.println("REMOVING: " + obj);
    //cast to a Spatial and remove from the scene graph
    Spatial s = (Spatial) obj;
    TankGame.GAME.lock();
    boolean removed = s.removeFromParent();
    TankGame.GAME.unlock();
    return removed;
  }
View Full Code Here

Examples of com.jme.scene.Spatial

    public void onDraw(Renderer r) {
        if ( children == null || !VEGETATION_RENDER ) {
            return;
        }
        super.onDraw(r);
        Spatial child;
        for ( int i = 0, cSize = children.size(); i < cSize; i++ ) {
            child = children.get( i );
            if ( child != null ) {
                float distSquared = tmpVec.set( camera.getLocation() ).distance(child.getLocalTranslation());
                if ( distSquared <= VEGETATION_DISTANCE  ) {
                    child.onDraw( r );
                }
            }
        }
    }
View Full Code Here

Examples of com.jme.scene.Spatial

    protected void simpleInitGame() {
        display.getRenderer().setBackgroundColor(ColorRGBA.black);

        rootNode.attachChild(new Grid(new Vector3f(), new Vector3f(), 10, 10, 1000, true));

        Spatial ship = ModelLoader.loadTriMesh("/model/max3ds/final05.3ds");
        ship.setRenderState(Tool.createUsualTS("/model/max3ds/final05.jpg"));
        rootNode.attachChild(ship);

        cam.setFrustumPerspective(70.0f, (float) display.getWidth() / (float) display.getHeight(), 1, 5000);
        cam.setLocation(new Vector3f(600, 400, 800));
        //cam.setAxes(new Vector3f(-0.7899924f, 0.0f, 0.6131166f), new Vector3f(-0.2993097f, 0.8727445f, -0.38565624f), new Vector3f(-0.5350943f, -0.48817745f, -0.68946123f));
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.