Package org.jdesktop.mtgame

Examples of org.jdesktop.mtgame.Entity


            HashSet<Entity> focusSet = focusSets.get(clazz);
            StringBuffer sb = new StringBuffer();
            sb.append("Class = " + clazz + ": ");
            Iterator<Entity> it = focusSet.iterator();
            while (it.hasNext()) {
            Entity entity = it.next();
            sb.append(entity.toString() + ", ");
            }
            logger.warning(sb.toString());
        }
    }
View Full Code Here


    @Override
    public void commitEvent (Event event) {
  if (!((MouseButtonEvent3D)event).isPressed()) {
      return;
  }
  Entity entity = event.getEntity();
  SpinProcessor spinner = (SpinProcessor) entity.getComponent(SpinProcessor.class);
  if (spinner != null) {
      // Stop the spinning
      spinner.stop();
      entity.removeComponent(SpinProcessor.class);
  } else {
      // Start the spinning
      try {
    entity.addComponent(SpinProcessor.class, new SpinProcessor(entity));
      } catch (InstantiationException ex) {
    // Can't spin an unspinnable entity
      }
  }
    }
View Full Code Here

        // Create a fake entity, which will be used to calculate the model offset
        // 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(
                filename.lastIndexOf(File.separatorChar) + 1);
View Full Code Here

        protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,
                                            int condition, boolean pressed)
        {
            // OWL issue #124: ignore keyboard accelerators if anything but
            // the global entity has keyboard focus
            Entity global = InputManager.inputManager().getGlobalFocusEntity();

            if (!InputManager.entityHasFocus(e, global)) {
                // if the global entity does not have focus, ignore the event
                return false;
            }
View Full Code Here

            }

            avatarControls.attach((ViewCell) cell);
        }

        Entity entity = ((CellRendererJME) cell.getCellRenderer(RendererType.RENDERER_JME)).getEntity();

        CellRendererJME renderer = (CellRendererJME) cell.getCellRenderer(Cell.RendererType.RENDERER_JME);
        avatarControls.setEnabled(true);

        // TODO move this into the SimpleAvatarControls
        if (renderer != null) {
            if (renderer instanceof BasicRenderer) {
                BasicRenderer.MoveProcessor moveProc = (MoveProcessor) renderer.getEntity().getComponent(BasicRenderer.MoveProcessor.class);
                if (moveProc != null) {
                    moveProc.addToChain(cameraProcessor);
                    avatarControls.addToChain(moveProc);
                }
            }
        }

        // Set initial camera position
        cameraProcessor.viewMoved(cell.getWorldTransform());

        entity.addComponent(ViewControls.class, avatarControls);
        attachCell = cell;
        attachCell.addTransformChangeListener(listener);
    }
View Full Code Here

        if (attachCell == null) {
            Logger.getAnonymousLogger().warning("VIEW NOT ATTACHED TO A CELL (BUT CONTINUE ANYWAY)");
            return;
        }

        Entity entity = ((CellRendererJME) attachCell.getCellRenderer(RendererType.RENDERER_JME)).getEntity();
        entity.removeComponent(ViewControls.class);

        CellRendererJME renderer = (CellRendererJME) attachCell.getCellRenderer(Cell.RendererType.RENDERER_JME);
        if (renderer != null) {
//            if (renderer instanceof ViewControls.AvatarInputSelector) {
//                ((ViewControls.AvatarInputSelector)renderer).selectForInput(false);
//            }

            if (renderer instanceof BasicRenderer) {
                BasicRenderer.MoveProcessor moveProc = (MoveProcessor) renderer.getEntity().getComponent(BasicRenderer.MoveProcessor.class);
                if (moveProc != null) {
                    moveProc.removeFromChain(cameraProcessor);
                    avatarControls.removeFromChain(moveProc);
                }
            }
        }

        entity.removeComponent(ViewControls.class);
        avatarControls.setEnabled(false);
        avatarControls = null;
        attachCell.removeTransformChangeListener(listener);
        attachCell = null;
    }
View Full Code Here

        float fov = viewProperties.getFieldOfView();
        float frontClip = viewProperties.getFrontClip();
        float backClip = viewProperties.getBackClip();

        // Add the camera
        Entity camera = new Entity("DefaultCamera");
        cameraComponent = wm.getRenderManager().createCameraComponent(cameraSG,
                cameraNode, width, height, fov, aspect, frontClip, backClip,
                true);
        cameraComponent.setCameraSceneGraph(cameraSG);
        cameraComponent.setCameraNode(cameraNode);
        camera.addComponent(CameraComponent.class, cameraComponent);

        cameraController = getDefaultCamera();
        cameraProcessor = new CameraProcessor(cameraNode, cameraController);
        camera.addComponent(ProcessorComponent.class, cameraProcessor);

        rb.setCameraComponent(cameraComponent);

        wm.addEntity(camera);
    }
View Full Code Here

    /**
     * Initialize the global focus wildcard entity.
     */
    private void initializeGlobalFocus (WorldManager wm) {
  globalFocusEntity = new Entity("Global Focus");
  wm.addEntity(globalFocusEntity);
    }
View Full Code Here

        rotation.toAngles(angles);
       
        // Create a tube to rotate about the X axis. The tube is drawn in the
        // X-Z plane, so we must rotate 90 degrees about the +z axis so that the
        // axis of rotation is about +x axis.
        xEntity = new Entity("Tube X");
        xNode = createTube("Tube X", outerRadius, innerRadius, THICKNESS, ColorRGBA.red);
        Quaternion xQ = new Quaternion().fromAngleAxis(1.5707f, new Vector3f(0, 0, 1));
        xNode.setLocalRotation(xQ);
        xNode.setLocalScale(new Vector3f(currentScale, 1.0f, currentScale));
        xNode.setRenderState(zbuf);
        addSubEntity(xEntity, xNode);
        xListener = addRotateListener(xEntity, xNode, RotateAxis.X_AXIS);

        // Create a tube to rotate about the Y axis. The tube is drawn in the
        // X-Z plane already.
        yEntity = new Entity("Tube Y");
        yNode = createTube("Tube Y", outerRadius, innerRadius, THICKNESS, ColorRGBA.green);
        yNode.setLocalScale(new Vector3f(currentScale, 1.0f, currentScale));
        yNode.setRenderState(zbuf);
        addSubEntity(yEntity, yNode);
        yListener = addRotateListener(yEntity, yNode, RotateAxis.Y_AXIS);

        // Create a tube to rotate about the Z axis. The tube is drawn in the
        // X-Z plane, so we must rotate 90 degrees about the +x axis so that the
        // axis of rotation is about +z axis.
        zEntity = new Entity("Tube Z");
        zNode = createTube("Tube Z", outerRadius, innerRadius, THICKNESS, ColorRGBA.blue);
        Quaternion zQ = new Quaternion().fromAngleAxis(1.5707f, new Vector3f(1, 0, 0));
        zNode.setLocalRotation(zQ);
        zNode.setLocalScale(new Vector3f(currentScale, 1.0f, currentScale));
        zNode.setRenderState(zbuf);
View Full Code Here

        sessionFrame.asyncLoadModel(
                importSettings, new ImportSessionFrame.LoadCompleteListener() {

            public void loadComplete(ImportedModel importedModel) {
                ModelImporterFrame.this.importedModel = importedModel;
                Entity entity = importedModel.getEntity();
                transformProcessor =
                        (TransformProcessorComponent) entity.getComponent(
                        TransformProcessorComponent.class);
                setSpinners(
                        importedModel.getModelBG(), importedModel.getRootBG());

                entity.addComponent(LoadCompleteProcessor.class,
                        new LoadCompleteProcessor(importedModel));

                String dir = origFile.getAbsolutePath();
                dir = dir.substring(0, dir.lastIndexOf(File.separatorChar));
                dir = dir.substring(dir.lastIndexOf(File.separatorChar) + 1);
View Full Code Here

TOP

Related Classes of org.jdesktop.mtgame.Entity

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.