Package com.jme.math

Examples of com.jme.math.Vector3f


        // Include the frame header and footer
        float height = height3D + Frame2DCell.HEADER_HEIGHT + Frame2DCell.SIDE_THICKNESS;

        // Determine the "first visible bounds" based on the size of the first-visible window
        BoundingBox bbox = new BoundingBox(new Vector3f(), width3D/2.0f, height/2.0f, 1f);
        logger.info("new bbox = " + bbox);
       
        // Calculate the "best" initial cell transform, based on the size of the first
        // window made visible.
        CellTransform ct = CellPlacementUtils.getCellTransform(null, bbox, creatorViewTransform);
View Full Code Here


        CreateWindowMsgArgs crtMsgArgs = new CreateWindowMsgArgs();
        WindowXrw win;
        int controllingUserLen;
        int desiredZOrder;
        float rotY; // Currently ignored
        Vector3f userTranslation = new Vector3f();

        crtMsgArgs.wid = bufQueue.nextInt();
        crtMsgArgs.x = (short) bufQueue.nextInt();
        crtMsgArgs.y = (short) bufQueue.nextInt();
        crtMsgArgs.wAndBorder = bufQueue.nextInt();
View Full Code Here

        msgArgs.clientId = bufQueue.nextInt();
        msgArgs.wid = bufQueue.nextInt();
        int ix = bufQueue.nextInt();
        int iy = bufQueue.nextInt();
        int iz = bufQueue.nextInt();
        msgArgs.userDispl = new Vector3f(Float.intBitsToFloat(ix),
                Float.intBitsToFloat(iy),
                Float.intBitsToFloat(iz));
    }
View Full Code Here

    public GroupUserManagerImpl() {
    }

    public void initialize(Properties props) {
        userGroups.add(new UserGroup(new Vector3f(0, 0, 0)));
    }
View Full Code Here

                return group;
            }
        }

        UserGroup lastGroup = userGroups.get(userGroups.size() - 1);
        UserGroup out = new UserGroup(lastGroup.getCenter().add(new Vector3f(GROUP_SPACING, 0, 0)));
        userGroups.add(out);

        return out;
    }
View Full Code Here

        private Vector3f[] walkPattern;

        public UserGroup(Vector3f center) {
            this.center = center;
            walkPattern = new Vector3f[]{
                        new Vector3f(0, 0, 0).add(center),
                        new Vector3f(4, 0, 0).add(center),
                        new Vector3f(2, 0, 4).add(center)
                    };
        }
View Full Code Here

          v[1] = o.getY();
          v[2] = o.getZ();
          return v;
      }
      public Vector3f compose(double[] v) {
          return new Vector3f((float)v[0], (float)v[1], (float)v[2]);
      }
View Full Code Here

            // coordinates of the Cell. First find the Cell Transform of the
            // parent Cell (if there is one) and the world root transform.
            CellTransform cellWorldTransform = new CellTransform();
            if (cell.getParent() != null) {
                cellWorldTransform = cell.getParent().getWorldTransform();
                cellWorldTransform.setTranslation(new Vector3f());
            }
            CellTransform worldTransform = new CellTransform();

            // Formulate a new transform that just has the new world translation
            // of the Cell.
            CellTransform transform = new CellTransform(null, translation);

            // Convert into a Cell's local coordinations.
            CellTransform newTransform = CellPlacementUtils.transform(
                    transform, worldTransform, cellWorldTransform);

            // Find out how much to add to the transform. This is done in
            // world coordinates.
            Vector3f newTranslation = translationOnPress.add(newTransform.getTranslation(null));

            // Set the translation back on the Cell using the movable component
            CellTransform cellTransform = cell.getLocalTransform();
            cellTransform.setTranslation(newTranslation);
            movableComp.localMoveRequest(cellTransform);
View Full Code Here

            extent = Math.max(xExtent, Math.max(yExtent, zExtent));
        }
       
        // Fetch the world translation for the root node of the cell and set
        // the translation for this entity root node
        Vector3f translation = sceneRoot.getWorldTranslation();
        rootNode.setLocalTranslation(translation);
       
        // Create a red arrow in the +x direction. We arrow we get back is
        // pointed in the +y direction, so we rotate around the -z axis to
        // orient the arrow properly.
        xEntity = new Entity("Entity X");
        xNode = createArrow("Arrow X", extent + LENGTH_OFFSET, THICKNESS, ColorRGBA.red);
        Quaternion xRotation = new Quaternion().fromAngleAxis((float)Math.PI / 2, new Vector3f(0, 0, -1));
        xNode.setLocalRotation(xRotation);
        xNode.setLocalScale(new Vector3f(1.0f, LENGTH_SCALE, 1.0f));
        xNode.setRenderState(zbuf);
        addSubEntity(xEntity, xNode);
        xListener = addDragListener(xEntity, xNode, TranslateAxis.X_AXIS);

        // Create a green arrow in the +y direction. We arrow we get back is
        // pointed in the +y direction.
        yEntity = new Entity("Entity Y");
        yNode = createArrow("Arrow Y", extent + LENGTH_OFFSET, THICKNESS, ColorRGBA.green);
        yNode.setLocalScale(new Vector3f(1.0f, LENGTH_SCALE, 1.0f));
        yNode.setRenderState(zbuf);
        addSubEntity(yEntity, yNode);
        yListener = addDragListener(yEntity, yNode, TranslateAxis.Y_AXIS);

        // Create a red arrow in the +z direction. We arrow we get back is
        // pointed in the +y direction, so we rotate around the +x axis to
        // orient the arrow properly.
        zEntity = new Entity("Entity Z");
        zNode = createArrow("Arrow Z", extent + LENGTH_OFFSET, THICKNESS, ColorRGBA.blue);
        Quaternion zRotation = new Quaternion().fromAngleAxis((float)Math.PI / 2, new Vector3f(1, 0, 0));
        zNode.setLocalRotation(zRotation);
        zNode.setRenderState(zbuf);
        zNode.setLocalScale(new Vector3f(1.0f, LENGTH_SCALE, 1.0f));
        addSubEntity(zEntity, zNode);
        zListener = addDragListener(zEntity, zNode, TranslateAxis.Z_AXIS);

        // Listen for changes to the cell's translation and apply the same
        // update to the root node of the affordances. We also re-set the size
        // of the affordances: this handles the case where the bounds of the
        // scene graph has changed and we need to update the affordances
        // accordingly.
        sceneRoot.addGeometricUpdateListener(updateListener = new GeometricUpdateListener() {
            public void geometricDataChanged(final Spatial spatial) {
                // We need to perform this work inside a proper updater, to
                // make sure we are MT thread safe
                RenderUpdater u = new RenderUpdater() {
                    public void update(Object obj) {
                        Vector3f translation = spatial.getWorldTranslation();
                        rootNode.setLocalTranslation(translation);
                        setSizeInternal(currentScale);
                        ClientContextJME.getWorldManager().addToUpdateList(rootNode);
                    }
                };
View Full Code Here

        }

        // In order to set the size of the arrows, we just set the scaling. Note
        // that we set the scaling along the +y axis since all arrows are
        // created facing that direction.
        xNode.setLocalScale(new Vector3f(1.0f, xScale, 1.0f));
        yNode.setLocalScale(new Vector3f(1.0f, yScale, 1.0f));
        zNode.setLocalScale(new Vector3f(1.0f, zScale, 1.0f));
        ClientContextJME.getWorldManager().addToUpdateList(xNode);
        ClientContextJME.getWorldManager().addToUpdateList(yNode);
        ClientContextJME.getWorldManager().addToUpdateList(zNode);
    }
View Full Code Here

TOP

Related Classes of com.jme.math.Vector3f

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.