Package com.jme.scene

Examples of com.jme.scene.Node


    public Frame2DCell (View2DCell view) {
        this.view = view;
        name = "Frame for " + view.getName();

        frameEntity = new Entity("Entity for " + name);
        frameNode = new Node("Node for " + name);
        RenderComponent rc =
                ClientContextJME.getWorldManager().getRenderManager().createRenderComponent(frameNode);
        frameEntity.addComponent(RenderComponent.class, rc);

        header = new FrameHeaderSwing(view);
View Full Code Here


        name = "View for " + window.getName();

        // Create entity and node
        entity = new Entity("Entity for " + name);
        viewNode = new Node("Node for " + name);
        RenderComponent rc =
            ClientContextJME.getWorldManager().getRenderManager().createRenderComponent(viewNode);
        entity.addComponent(RenderComponent.class, rc);
        entityMakePickable(entity);
View Full Code Here

                        } else {
                            RenderComponent rc = (RenderComponent) entity.getComponent(RenderComponent.class);
                            // TODO: these two statements appear to be obsolete.
                            RenderComponent rcParent =
                                (RenderComponent) parentEntity.getComponent(RenderComponent.class);
                            Node attachNode = rcParent.getSceneRoot();

                            // Note: we need to attach non-primaries to the parent geometry node in
                            // ortho mode, rather than the view node. This way it picks up the parent's
                            // offset translation, which contains locationOrtho
                            // TODO: do this cleaner. Convert attach node to a view and get the
                            // geometry node for this view.
                            attachNode = (Node) attachNode.getChild(0);

                            sgChangeAttachPointSetAddEntity(rc, attachNode, parentEntity, entity);
                            attachState = AttachState.ATTACHED_TO_ENTITY;
                            logger.fine("Attach ortho entity " + entity + " to geometry node of parent entity " + parentEntity);
                        }
                    }
                } else {
                    logger.fine("View is not ortho for view " + this);
                    parentEntity = getParentEntity();
                    if (parentEntity == null) {
                        logger.warning("getParentEntity() returns null; must be non-null");
                    } else {
                        logger.fine("Attach entity " + entity + " to parent entity " + parentEntity);

                        RenderComponent rc = (RenderComponent) entity.getComponent(RenderComponent.class);
                        RenderComponent rcParent =
                            (RenderComponent) parentEntity.getComponent(RenderComponent.class);
                        Node attachNode = rcParent.getSceneRoot();

                        // SPECIAL NOTE: Here is where special surgery is done on header windows so
                        // that they are parented to the *geometry node* of their parent view instead of
                        // the view node, as windows normally are. This way it picks up the offset
                        // translation in the geometry node and stays in sync with the rest of the frame.
                        // See also: SPECIAL NOTE in Frame2DCell.attachViewToEntity.
                        if (window instanceof WindowSwingHeader) {
                            WindowSwingHeader wsh = (WindowSwingHeader) window;
                            if (wsh.getView().getType() == View2D.Type.SECONDARY) {
                                // TODO: do this cleaner. Convert attach node to a view and get the
                                // geometry node for this view.
                                attachNode = (Node) attachNode.getChild(0);
                            }
                        }

                        sgChangeAttachPointSetAddEntity(rc, attachNode, parentEntity, entity);
                        attachState = AttachState.ATTACHED_TO_ENTITY;
View Full Code Here

     * parentEntity attachPoint -> localToCellNode -> Spatial, Spatial, etc. (subclass provided)
     */
    protected void initSceneGraph() {

        // Attach the localToCell node to the entity
        localToCellNode = new Node("Local-to-cell node for frame component " + name);
        RenderComponent rc = ClientContextJME.getWorldManager().getRenderManager().
                createRenderComponent(localToCellNode);
        entity.addComponent(RenderComponent.class, rc);
        rc.setEntity(entity);

View Full Code Here

     * @param cell The cell to be rendered.
     */
    public App2DCellRendererJME(App2DCell cell) {
        super(cell);

        acrjRootNode = new Node("Root node for cell " + cell.getCellID().toString());

        initLightState();
        acrjRootNode.setRenderState(lightState);

        // For debug
View Full Code Here

        System.err.print("sceneRoot = ");
        RenderComponent rc = (RenderComponent) entity.getComponent(RenderComponent.class);
        if (rc == null) {
            System.err.println("null");
        } else {
            Node sceneRoot = rc.getSceneRoot();
            System.err.println(sceneRoot);
            if (sceneRoot != null) {
                GraphicsUtils.printNode(sceneRoot);
            }
View Full Code Here

    public ResizeRectangle (View2DCell view) {
        // Rectangle's size is initialized but set to something sensible later.
        // Rectangle doesn't receive events (no GUI object).
        super("ResizeRect", view, null, 1, 1);

        nodeZTrans = new Node("Node Z Trans for View " + view);

        final Spatial[] spatials = getSpatials();

        ClientContextJME.getWorldManager().addRenderUpdater(new RenderUpdater() {
            public void update(Object arg0) {
View Full Code Here

        super(cell);
    }
   
    protected Node createSceneGraph(Entity entity) {

        Node node = new Node();
        try {
            attachModel(node);
        } catch (IOException ex) {
            Logger.getLogger(ConeOfSilenceCellRenderer.class.getName()).log(Level.SEVERE, "Failed to load cone of silence", ex);
        }
View Full Code Here

    private void attachModel(Node aNode) throws IOException {
        LoaderManager manager = LoaderManager.getLoaderManager();
        URL url = AssetUtils.getAssetURL("wla://coneofsilence/pwl_3d_coneofsilence_016d.dae/pwl_3d_coneofsilence_016d.dae.gz.dep", this.getCell());
        DeployedModel dm = manager.getLoaderFromDeployment(url);
        Node cosModel = dm.getModelLoader().loadDeployedModel(dm, entity);
        aNode.attachChild(cosModel);
    }
View Full Code Here

        // Turn on an indication that the avatar is being loaded
        LoadingInfo.startedLoading(cell.getCellID(), newAvatar.getName());

        // Fetch the name tag node. There should be only one of these in the
        // system.
        Node nameTagNode = getNameTagNode();

        // If there is an existing avatar character, then remove it, but store
        // away its position. Remove the name tag, turn off input and destroy
        // the avatar character.
        PMatrix currentLocation = null;
        if (avatarCharacter != null) {
            currentLocation = avatarCharacter.getModelInst().getTransform().getWorldMatrix(true);
            rootEntity.removeEntity(avatarCharacter);
            avatarCharacter.getJScene().getExternalKidsRoot().detachChild(nameTagNode);
            selectForInput(false);
            avatarCharacter.destroy();
            flg=1;
        }

        // Set the new avatar character. If there is none (when would that happen?)
        // then just return.
        avatarCharacter = newAvatar;
        if (newAvatar == null) {
            return;
        }

        // Add all of the default components to the renderer, but remove the
        // collision component, since we use our own collision graph
        RenderComponent rc = (RenderComponent) avatarCharacter.getComponent(RenderComponent.class);
        addDefaultComponents(avatarCharacter, rc.getSceneRoot());
        avatarCharacter.removeComponent(CollisionComponent.class);

        // Set the initial location of the avatar if there is one
        if (currentLocation != null && avatarCharacter.getModelInst() != null) {
            logger.fine(cell.getCellID() + " Using current location: " + currentLocation);
            avatarCharacter.getModelInst().setTransform(new PTransform(currentLocation));
        } else if (delayedMove != null && avatarCharacter.getModelInst() != null) {
            // there was no previous avatar, but there was a move that
            // happened while the avatar was null. Apply the move now
            logger.fine(cell.getCellID() + " using delayed move: " + delayedMove.toString());
            PTransform trans = new PTransform(delayedMove.getRotation(null),
                                              delayedMove.getTranslation(null),
                                              new Vector3f(1, 1, 1));
            avatarCharacter.getModelInst().setTransform(trans);
        }

        // Attach the name tag to the new avatar and add the avatar entity to
        // the cell renderer root entity and turn on input.
        Node externalRoot = avatarCharacter.getJScene().getExternalKidsRoot();
        if (nameTagNode!=null) {
            externalRoot.attachChild(nameTagNode);
            externalRoot.setModelBound(new BoundingSphere());
            externalRoot.updateModelBound();
            externalRoot.updateGeometricState(0, true);
        }
        rootEntity.addEntity(avatarCharacter);

        // Turn on input handle for the renderer, if we wish. Check for AvatarCell
        // to allow NPC's to work
View Full Code Here

TOP

Related Classes of com.jme.scene.Node

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.