Package org.jdesktop.mtgame

Examples of org.jdesktop.mtgame.RenderComponent


        }, sceneRoot);
    }

    @Override
    protected void cleanupSceneGraph(Entity entity) {
        RenderComponent rc = entity.getComponent(RenderComponent.class);
        if (rc!=null) {
            ClientContextJME.getWorldManager().addRenderUpdater(new RenderUpdater() {

                public void update(Object arg0) {
                    TreeScan.findNode((Spatial) arg0, new ProcessNodeInterface() {
                        public boolean processNode(Spatial node) {
                            if (node instanceof Geometry) {
                                ((Geometry)node).clearBuffers();
                                TextureState ts = (TextureState) node.getRenderState(RenderState.RS_TEXTURE);
                                // deleteAll is too aggressive, it deletes other copies of the same texture
//                                if (ts!=null)
//                                    ts.deleteAll(false);
                            }
                            return true;
                        }
                    });
                }
            }, rc.getSceneRoot());
        }

        deployedModel = null;
    }
View Full Code Here


                        ClientContextJME.getWorldManager().addEntity(thisEntity);
                    }

                    // Figure out the correct parent entity for this cells entity.
                    if (parentEntity!=null && thisEntity!=null) {
                        RenderComponent parentRendComp = (RenderComponent) parentEntity.getComponent(RenderComponent.class);
                        RenderComponent thisRendComp = (RenderComponent)thisEntity.getComponent(RenderComponent.class);
                        if (parentRendComp!=null && parentRendComp.getSceneRoot()!=null && thisRendComp!=null) {
                            thisRendComp.setAttachPoint(parentRendComp.getSceneRoot());
                        }
                    }

                    // enable the collision listener
                    collisionListener.enable();
View Full Code Here

     * @param parentEntity
     * @param child
     */
    public static void entityAddChild(Entity parentEntity, Entity child) {
        if (parentEntity!=null && child!=null) {
            RenderComponent parentRendComp = (RenderComponent) parentEntity.getComponent(RenderComponent.class);
            RenderComponent thisRendComp = (RenderComponent)child.getComponent(RenderComponent.class);
            if (parentRendComp!=null && parentRendComp.getSceneRoot()!=null && thisRendComp!=null) {
                thisRendComp.setAttachPoint(parentRendComp.getSceneRoot());
            }
            parentEntity.addEntity(child);
        }
    }
View Full Code Here

        if (rootNode!=null) {
            rootNode.updateWorldBound();

            // Some subclasses (like the imi collada renderer) already add
            // a render component
            RenderComponent rc = entity.getComponent(RenderComponent.class);
            if (rc==null) {
                rc = ClientContextJME.getWorldManager().getRenderManager().createRenderComponent(rootNode);
                entity.addComponent(RenderComponent.class, rc);
            } else {
                rc.setSceneRoot(rootNode);
            }

            // TODO: shouldn't this just be a call to adjustCollisionSystem()?
            WonderlandSession session = cell.getCellCache().getSession();
            CollisionSystem collisionSystem = ClientContextJME.getCollisionSystem(session.getSessionManager(), "Default");
View Full Code Here

            return;

        this.backfaceCullingEnabled = backfaceCullingEnabled;

        if (entity!=null) {
            final RenderComponent rc = entity.getComponent(RenderComponent.class);
            final CullState.Face face = backfaceCullingEnabled ? CullState.Face.Back : CullState.Face.None;
            if (rc!=null && rc.getSceneRoot()!=null) {
                ClientContextJME.getWorldManager().addRenderUpdater(new RenderUpdater() {

                    public void update(Object arg0) {
                        TreeScan.findNode(rc.getSceneRoot(), new ProcessNodeInterface() {
                            public boolean processNode(Spatial node) {
                                CullState cs = (CullState) node.getRenderState(RenderState.RS_CULL);
                                if (cs==null) {
                                    cs = (CullState) ClientContextJME.getWorldManager().getRenderManager().createRendererState(RenderState.RS_CULL);
                                    node.setRenderState(cs);
                                }
                                cs.setCullFace(face);

                                return true;
                            }
                        });
                        ClientContextJME.getWorldManager().addToUpdateList(rc.getSceneRoot());
                    }
                }, null);
            }
        }
    }
View Full Code Here

            }
        }
    }

    private void adjustLighting(final Entity entity) {
        RenderComponent rc = entity.getComponent(RenderComponent.class);
        rc.setLightingEnabled(lightingEnabled);
    }
View Full Code Here

     * @param color
     */
    public void highlightCell(final Cell cell, final boolean highlight, final ColorRGBA color) {
        CellRendererJME r = (CellRendererJME) cell.getCellRenderer(Cell.RendererType.RENDERER_JME);
        Entity entity = r.getEntity();
        RenderComponent rc = entity.getComponent(RenderComponent.class);

        //check if object has Navigate-To capability
        final NewInteractionComponent hc = cell.getComponent(NewInteractionComponent.class);
        if (hc != null && hc.isHighlightEnable()) {
            if (rc == null) {
                return;
            }
            TreeScan.findNode(rc.getSceneRoot(), Geometry.class, new ProcessNodeInterface() {
                public boolean processNode(final Spatial s) {
                    s.setGlowEnabled(highlight);
                    float comps[] = hc.getHighlightColor().getColorComponents(null);
                    ColorRGBA newcolor = new ColorRGBA((float) comps[0],
                            (float) comps[1],
View Full Code Here

            }
        });

        ConfigInstance ci[] = ClientContextJME.getWorldManager().getAllConfigInstances();
        for (int i=0; i<ci.length; i++) {
            RenderComponent rc = ci[i].getEntity().getComponent(RenderComponent.class);
            if (rc!=null)
                rc.setAttachPoint(rootNode);
            rootEntity.addEntity(ci[i].getEntity());
        }
        return rootNode;
    }
View Full Code Here

        // from the cell
        Node cellRoot = new Node();
        cellRoot.attachChild(importedModel.getModelBG());
        cellRoot.updateGeometricState(0, true);
        Entity entity = new Entity("Fake");
        RenderComponent rc = ClientContextJME.getWorldManager().getRenderManager().createRenderComponent(cellRoot);
        entity.addComponent(RenderComponent.class, rc);
        importedModel.setEntity(entity);
        importedModel.setDeploymentBaseURL("wlcontent://users/" + loginInfo.getUsername() + "/art/");
        String filename = file.getAbsolutePath();
        filename = filename.substring(
View Full Code Here

  void stop () {
      setArmingCondition(null);
  }

  static Node getNode (Entity entity) throws InstantiationException {
      RenderComponent renderComp = (RenderComponent) entity.getComponent(RenderComponent.class);
      if (renderComp == null) {
    throw new InstantiationException("Enity has no render component");
      }
      Node node = renderComp.getSceneRoot();
      if (node == null) {
    throw new InstantiationException("Entity has no scene graph");
      }
      return node;
  }
View Full Code Here

TOP

Related Classes of org.jdesktop.mtgame.RenderComponent

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.