Package org.spout.math.vector

Examples of org.spout.math.vector.Vector2f


  public void preRender(SnapshotRender snapshotRender) {
    float x = (float) (GenericMath.mod(TrigMath.TWO_PI * freqX / 1000.0 * System.currentTimeMillis(), TrigMath.TWO_PI) - TrigMath.PI);
    x = amplX * (TrigMath.sin(x) + 1.0f);
    float y = (float) (GenericMath.mod(TrigMath.TWO_PI * freqY / 1000.0 * System.currentTimeMillis(), TrigMath.TWO_PI) - TrigMath.PI);
    y = amplY * (TrigMath.sin(y) + 1.0f);
    snapshotRender.getMaterial().getShader().setUniform("animation", new Vector2f(x * size, y * size));
  }
 
View Full Code Here


   */
  @Override
  public void placeObject(World world, int originX, int originY, int originZ) {
    final int clusterSize = type.clusterSize;
    final float angle = random.nextFloat() * (float) Math.PI;
    final Vector2f offset = Vector2f.createDirection(angle).mul(clusterSize).div(8);
    final float x1 = ((originX + 8) + offset.getX());
    final float x2 = ((originX + 8) - offset.getX());
    final float z1 = ((originZ + 8) + offset.getY());
    final float z2 = ((originZ + 8) - offset.getY());
    final float y1 = (originY + random.nextInt(3) + 2);
    final float y2 = (originY + random.nextInt(3) + 2);

    for (int count = 0; count <= clusterSize; count++) {
      final float seedX = x1 + (x2 - x1) * count / clusterSize;
View Full Code Here

  @Override
  public void placeObject(World w, int x, int y, int z) {
    generateLeaves(w, x, y + totalHeight, z, (byte) 2);
    final byte leavesEnd = (byte) (totalHeight - 2 - random.nextInt(4));
    for (byte yy = (byte) (totalHeight / 2); yy < leavesEnd; yy += random.nextInt(4) + 2) {
      final Vector2f randomOffset = Vector2f.createRandomDirection(random);
      generateLeaves(w, (int) (x + (randomOffset.getX() * 4f + 0.5f)), y + yy, (int) (z + (randomOffset.getY() * 4f + 0.5f)), (byte) 0);
      for (byte branchLengthCount = 0; branchLengthCount < branchLength; branchLengthCount++) {
        final int bx = (int) (randomOffset.getX() * branchLengthCount + 1.5f);
        final int by = -3 + branchLengthCount / 2;
        final int bz = (int) (randomOffset.getY() * branchLengthCount + 1.5f);
        final Block block = w.getBlock(x + bx, y + yy + by, z + bz);
        block.setMaterial(VanillaMaterials.LOG);
        block.setData(logMetadata);
        VanillaMaterials.LOG.setFacing(block, BlockFace.fromYaw(MathHelper.getLookAtYaw(new Vector3f(bx, by, bz))));
      }
View Full Code Here

    return findClosest(humidityValue * temperatureValue * (minTemperature - maxTemperature) + maxTemperature,
        (1 - humidityValue) * (maxHumidity - minHumidity) + minHumidity);
  }

  private LayeredBiomeSelectorElement findClosest(double temperature, double humidity) {
    final Vector2f position = new Vector2f(temperature, humidity);
    WhittakerElement closestElement = null;
    float smallestDistance = 0;
    for (WhittakerElement element : elements) {
      final float distance = element.getPosition().sub(position).lengthSquared();
      if (closestElement == null) {
View Full Code Here

    public float getHumidity() {
      return humidity;
    }

    public Vector2f getPosition() {
      return new Vector2f(temperature, humidity);
    }
View Full Code Here

        continue;
      }

      for (byte count = 0; count < groupsPerLayer; count++) {
        final float scale = widthScale * layerSize * (random.nextFloat() + 0.328f);
        Vector2f randomOffset = Vector2f.createRandomDirection(random).mul(scale);
        final int groupX = (int) (randomOffset.getX() + x + 0.5);
        final int groupZ = (int) (randomOffset.getY() + z + 0.5);
        final Point group = new Point(world, groupX, groupY, groupZ);
        if (getAvailableBlockSpace(group, group.add(0, leafDistanceLimit, 0)) != -1) {
          continue;
        }
        final byte xOff = (byte) (x - groupX);
View Full Code Here

TOP

Related Classes of org.spout.math.vector.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.