Package com.jme.math

Examples of com.jme.math.Vector2f


        }

        this.app = app;
        this.size = new Dimension(width, height);
        this.decorated = decorated;
        this.pixelScale = new Vector2f(pixelScale);
        this.name = name;

        try {
            setType(type);
        } catch (IllegalStateException ise) {
View Full Code Here


        View2DEntity view = (View2DEntity) it.next();

        if (ortho) {

            // In this test, the view in the ortho plane is at a fixed location.
            view.setLocationOrtho(new Vector2f(500f, 300f), false);

            // Test
            //view.setPixelScaleOrtho(2.0f, 2.0f);
            //view.setPixelScaleOrtho(0.5f, 0.5f);
View Full Code Here

        // Calculate an arbitrary point on the plane (in this case, the top left corner)
        int width = (int) v2e.getDisplayerLocalWidth();
        int height = (int) v2e.getDisplayerLocalHeight();

        Vector2f locOrtho = calcLocationOrtho();

        // Compute top left in canvas coords
        int canvasHeight = JmeClientMain.getFrame().getCanvas().getHeight();
        Point topLeft = new Point();
        topLeft.x = (int)locOrtho.x - width/2;
        topLeft.y = canvasHeight - (int)locOrtho.y - height/2;
        Point bottomRight = new Point(topLeft.x + width - 1, topLeft.y + height - 1);

        // Convert to view local coords
        float xLocal = x - topLeft.x;
        float yLocal = y - topLeft.y;

        // Convert to pixel coords
        Vector2f pixelScale = v2e.getPixelScaleOrtho();
        int xPixel = (int)(xLocal / pixelScale.x);
        int yPixel = (int)(yLocal / pixelScale.y);

        Point pt = new Point(xPixel, yPixel);
        logger.fine("pixel position = " + pt);
View Full Code Here

            parent = view.getParent();
        }

        // Convert pixel offset to an offset in local coords
        View2DEntity v2e = (View2DEntity) view;
        Vector2f pixelScale = v2e.getPixelScaleOrtho();
        Vector2f locationOrtho = new Vector2f((float) pixelOffsetTotal.x, (float) pixelOffsetTotal.y);
        locationOrtho.x *= pixelScale.x;
        locationOrtho.y *= pixelScale.y;

        // Now add in the location of the ultimate parent in ortho coordinates.
        locationOrtho = locationOrtho.add(v2e.getLocationOrtho());

        return locationOrtho;
    }
View Full Code Here

    protected void updateLayout(final float newWidth3D, final float newHeight3D) {
        updateTheLayout(newWidth3D, newHeight3D);
    }

    private void updateTheLayout (float newWidth3D, float newHeight3D) {
        Vector2f pixelScale = view.getPixelScale();

        // Calculate size. This is essentially the same as for FrameSide TOP, but
        // converted to pixels.
        float innerWidth = newWidth3D;
        float innerHeight = newHeight3D;
View Full Code Here

            //System.err.println("dragVectorLocal = " + dragVectorLocal);
            App2D.invokeLater(new Runnable() {
                public void run () {
                    if (view != null) {
                        view.userMovePlanarUpdate(new Vector2f(dragVectorLocal.x, dragVectorLocal.y));
                    }
                }
            });
        }
    }
View Full Code Here

    /**
     * Returns the width of this component in local coordinates.
     */
    float getWidth () {
        Vector2f pixelScale = view.getPixelScale();
        return width * pixelScale.x;
    }
View Full Code Here

    /**
     * Returns the height of this component in local coordinates.
     */
    float getHeight () {
        Vector2f pixelScale = view.getPixelScale();
        return height * pixelScale.y;
    }
View Full Code Here

    public Vector2f getPixelScale () {
        if (pixelScaleCell == null) {
            if (window != null) {
                return window.getPixelScale();
            } else {
                return new Vector2f(0.01f, 0.01f);
            }
        } else {
            return pixelScaleCell.clone();
        }
    }
View Full Code Here

    }

    /** Return the pixel scale used when the view is displayed in ortho mode. */
    public Vector2f getPixelScaleOrtho () {
        if (pixelScaleOrtho == null) {
            return new Vector2f(1f, 1f);
        } else {
            return pixelScaleOrtho.clone();
        }
    }
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.