Package com.jme.math

Examples of com.jme.math.Vector2f


  // The current world position of the eye
  Vector3f eyeWorld = InputPicker3D.getInputPicker().getCameraPosition(null);
  logger.fine("eyeWorld = " + eyeWorld);

  // The float movement vector in screen space
  Vector2f scrPos = new Vector2f((float)(eventX - dragStartScreen.x),
                                       (float)(eventY - dragStartScreen.y));
  logger.fine("scrPos = " + scrPos);

  Vector2f pressXY = new Vector2f((float)dragStartScreen.x, (float)dragStartScreen.y);
  Vector3f pressWorld = ((InputManager3D)InputManager3D.getInputManager()).
      getCamera().getWorldCoordinates(pressXY, 0f);

  Vector2f dragXY = new Vector2f((float)eventX, (float)eventY);
  Vector3f dragWorld = ((InputManager3D)InputManager3D.getInputManager()).
      getCamera().getWorldCoordinates(dragXY, 0f);

  // The world position of this event (in the view plane)
  Vector3f thisWorld = ((InputManager3D)InputManager3D.getInputManager()).
View Full Code Here


        return ret;
    }

    private Quad getQuad() {
        Vector2f scales = new Vector2f();
        BufferedImage img = getImage(scales);

        float w = img.getWidth();
        float h = img.getHeight();
        float factor = height / h;
View Full Code Here

* @author nsimpson
*/
public class Vector2fInterpolator implements PropertyInterpolator {

    public Vector2f interpolate(Object from, Object to, float timelinePosition) {
        Vector2f f = (Vector2f) from;
        Vector2f t = (Vector2f) to;
        Vector2f position = new Vector2f();

        position.x = f.x + timelinePosition * (t.x - f.x);
        position.y = f.y + timelinePosition * (t.y - f.y);

        return position;
View Full Code Here

     */
    public void setInitialPlacementSize(Vector2f size) {
        if (size == null) {
            initialPlacementSize = size;
        } else {
            initialPlacementSize = new Vector2f(size);
        }
        if (fvi != null) {
            fvi.setInitialPlacementSize(initialPlacementSize);
        }
    }
View Full Code Here

    public FirstVisibleInitializerCell (App2DCell cell, CellTransform creatorViewTransform,
                                        Vector2f initialPlacementSize) {
        this.cell = cell;
        this.creatorViewTransform = creatorViewTransform;
        if (initialPlacementSize != null) {
            this.initialPlacementSize = new Vector2f(initialPlacementSize);
        }
        logger.info("creatorViewTransform = " + creatorViewTransform);
    }
View Full Code Here

     * Returns the pixel scale
     */
    public Vector2f getPixelScale() {
        // Note: pixelScale may be null (e.g. on the SAS)
        if (pixelScale == null) return null;
        return new Vector2f(pixelScale);
    }
View Full Code Here

    batch.getVertexBuffer().rewind();
    float firstX = -1.0f;
    float firstY = -1.0f;
    for (int i = 0; i < batch.getVertexCount(); i++) {
      Vector2f mapCoord = new Vector2f();
      mapCoord.x = (batch.getVertexBuffer().get() + offsetX) / (getStepScale().x);
      batch.getVertexBuffer().get(); // ignore vert y coord.
      mapCoord.y = (batch.getVertexBuffer().get() + offsetY) / (getStepScale().z);
   
      if( firstX == -1.0f ) {
        firstX = mapCoord.x;
      }
      if( firstY == -1.0f ) {
        firstY = mapCoord.y;
      }
   
      float up = 1.0f;//((float)TILE_SIZE+1.0f) / (float)TILE_SIZE;
      float tileIndexX = (mapCoord.x % TILE_SIZE) / TILE_SIZE;
      float tileIndexY = (mapCoord.y % TILE_SIZE) / TILE_SIZE;
     
     
     
      float oX = tileIndexX * up;
      float oY = tileIndexY * up;

      if( tileIndexX == 0.0f ) {
        ifmapCoord.x != firstX ) {
          oX = 1.0f;
        } else {
          oX = 0.00f;
        }
      }
     
      if( tileIndexY == 0.0f ) {
        if( mapCoord.y != firstY ) {
          oY = 1.0f;
        } else {
          oY = 0.00f;
        }
      }
           
      Vector2f texCoord = materialMap.textureForMap(mapCoord);

     
      float fX = texCoord.x + (0.5f * oX);
      float fY = texCoord.y + (0.5f * oY);
      texs.put(fX);
 
View Full Code Here

    for (int x = 0; x < getSize(); x++) {
      for (int y = 0; y < getSize(); y++) {
       
        Vector3f newPoint = new Vector3f();
        Vector2f mapCoord = new Vector2f( x + offsetX, y + offsetY );
        int indexMain = (x + (y * getSize()));
        Vector2f texCoord = materialMap.textureForMap(mapCoord);
       
       
        BufferUtils.populateFromBuffer( newPoint, batch.getVertexBuffer(), indexMain);
        newPoint.y = averageHeight( batch, x, y );
        BufferUtils.setInBuffer( newPoint, fb, indexMain);
View Full Code Here

      Vector3f above = new Vector3f();
      int indexAbove = (x2 + ((y2) * getSize()));
      BufferUtils.populateFromBuffer( above, tb.getVertexBuffer(), indexAbove);

      Vector2f mapHere = new Vector2f( x + offsetX, y + offsetY );
      Vector2f mapAbove = new Vector2f( x2 + offsetX, y2 + offsetY );

      Vector2f textureHere = materialMap.textureForMap( mapHere );
      Vector2f textureAbove = materialMap.textureForMap( mapAbove );
     
     
      if( ! textureHere.equals( textureAbove )) {
        System.out.println("The points " + here.toString() + "and " + above.toString() + " are on different textures " );
        Vector3f avg = new Vector3f();
View Full Code Here

    float x = (float) (index) * TILE_SIZE / (float) size;
    float y = (float) (index) * TILE_SIZE / (float) size;
    x += a;
    y += b;
    return new Vector2f(a, b);
  }
View Full Code Here

TOP

Related Classes of com.jme.math.Vector2f

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.