Package javax.vecmath

Examples of javax.vecmath.Vector2f


    private Texture effectsTexture;

    @Override
    public void initialise() {
        this.effectsTexture = Assets.getTexture("engine:effects");
        Vector2f texPos = new Vector2f(0.0f, 0.0f);
        Vector2f texWidth = new Vector2f(0.0624f, 0.0624f);

        Tessellator tessellator = new Tessellator();
        TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1, 1, 1, 1), texPos, texWidth, 1.001f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f);
        overlayMesh = tessellator.generateMesh();
    }
View Full Code Here


        return getTexCoords(getTileIndex(uri, warnOnError));
    }

    private Vector2f getTexCoords(int id) {
        int tilesPerDim = atlasSize / tileSize;
        return new Vector2f((id % tilesPerDim) * getRelativeTileSize(), (id / tilesPerDim) * getRelativeTileSize());
    }
View Full Code Here

        createTextureAtlas(terrainTex);
    }

    private void createTextureAtlas(final Texture texture) {
        final Map<Name, Map<Name, SubtextureData>> textureAtlases = Maps.newHashMap();
        final Vector2f texSize = new Vector2f(getRelativeTileSize(), getRelativeTileSize());
        tileIndexes.forEachEntry(new TObjectIntProcedure<AssetUri>() {
            @Override
            public boolean execute(AssetUri tileUri, int index) {
                Vector2f coords = getTexCoords(index);
                SubtextureData subtextureData = new SubtextureData(texture, Rect2f.createFromMinAndSize(coords, texSize));

                Map<Name, SubtextureData> textureAtlas = textureAtlases.get(tileUri.getModuleName());
                if (textureAtlas == null) {
                    textureAtlas = Maps.newHashMap();
View Full Code Here

        return 0;
    }

    @Override
    public Vector2f getTexCoords(AssetUri uri, boolean warnOnError) {
        return new Vector2f();
    }
View Full Code Here

            textureMat.setFloat4(CROPPING_BOUNDARIES_PARAM, requestedCropRegion.minX(), requestedCropRegion.maxX() + 1,
                    requestedCropRegion.minY(), requestedCropRegion.maxY() + 1);
            currentTextureCropRegion = requestedCropRegion;
        }

        Vector2f scale = mode.scaleForRegion(absoluteRegion, texture.getWidth(), texture.getHeight());
        Rect2f textureArea = texture.getRegion();
        Mesh mesh = billboard;
        switch (mode) {
            case TILED: {
                TextureCacheKey key = new TextureCacheKey(texture.size(), absoluteRegion.size());
View Full Code Here

        }
        if (freeform.getSize() == null && freeform.getMax() == null) {
            logger.error("Bad subimage definition '{}' - requires one of max or size", freeform.getName());
            return;
        }
        Vector2f min = new Vector2f((float) freeform.getMin().x / size.x, (float) freeform.getMin().y / size.y);
        if (freeform.getSize() != null) {
            Vector2f itemSize = new Vector2f((float) freeform.getSize().x / size.x, (float) freeform.getSize().y / size.y);
            out.put(new Name(freeform.getName()), new SubtextureData(texture, Rect2f.createFromMinAndSize(min, itemSize)));
        } else if (freeform.getMax() != null) {
            Vector2f max = new Vector2f((float) freeform.getMax().x / size.x, (float) freeform.getMax().y / size.y);
            out.put(new Name(freeform.getName()), new SubtextureData(texture, Rect2f.createFromMinAndMax(min, max)));
        }
    }
View Full Code Here

        if (grid.getGridDimensions() == null) {
            logger.error("Bad grid definition - missing mandatory property gridDimensions");
            return;
        }

        Vector2f offset = new Vector2f(0, 0);
        if (grid.getGridOffset() != null) {
            offset.set((float) grid.getGridOffset().x / size.x, (float) grid.getGridOffset().y / size.y);
        }
        Vector2f tileSize = new Vector2f((float) grid.getTileSize().x / size.x, (float) grid.getTileSize().y / size.y);
        int tileX = 0;
        int tileY = 0;
        for (String name : grid.getTileNames()) {
            if (!name.isEmpty()) {
                Vector2f pos = new Vector2f(offset);
                pos.x += tileX * tileSize.x;
                pos.y += tileY * tileSize.y;
                Rect2f tileLocation = Rect2f.createFromMinAndSize(offset.x + tileX * tileSize.x, offset.y + tileY * tileSize.y, tileSize.x, tileSize.y);
                out.put(new Name(name), new SubtextureData(texture, tileLocation));
            }
View Full Code Here

        CORRECTION_QUATERNION = new Quat4f(0, 0, 0, 1);
        CORRECTION_QUATERNION.set(CORRECTION_MATRIX);
    }

    public static Vector2f readUV(String u, String v) throws NumberFormatException {
        return new Vector2f(Float.parseFloat(u), Float.parseFloat(v));
    }
View Full Code Here

    for(int i = 0; i < pool.length; i++) {
      pool[i] = new Triangle();
      pool[i].setColor(0, new Color4f());
      pool[i].setColor(1, new Color4f());
      pool[i].setColor(2, new Color4f());
      pool[i].setTextureCoordinate(0, new Vector2f());
      pool[i].setTextureCoordinate(1, new Vector2f());
      pool[i].setTextureCoordinate(2, new Vector2f());
    }
  }
View Full Code Here

        renderer.translate(-randomPointsX1, -randomPointsY1 + 30);
        renderer.drawText("" + pointCount + " Random Points");
        renderer.clearTransform();
        float randomPointsWidth = randomPointsX2 - randomPointsX1;
        float randomPointsHeight = randomPointsY2 - randomPointsY1;
        Vector2f point;
        if(points.size() == pointCount) {
          point = points.remove(0);
        } else {
          point = new Vector2f();
        }
        points.add(point);
        point.x = random.nextFloat() * randomPointsWidth + randomPointsX1;
        point.y = random.nextFloat() * randomPointsHeight + randomPointsY1;
       
        for(int i = 0; i < points.size(); i++) {
          Vector2f p = points.get(i);
          renderer.drawPoint(p.x, p.y);
        }
       
        // Random Lines
        float randomLinesX1 = 50;
View Full Code Here

TOP

Related Classes of javax.vecmath.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.