Examples of Vector4f


Examples of org.lwjgl.util.vector.Vector4f

   
  }
 
  public Vector3f right() {
   
    Vector4f right = MatrixMath.multiply((Matrix4f) orientation().invert(), new Vector4f(1, 0, 0, 1));
   
    return new Vector3f(right.x, right.y, right.z);
   
  }
View Full Code Here

Examples of org.lwjgl.util.vector.Vector4f

public class MatrixMath {
 
  public static Vector4f multiply(Matrix4f matrix, Vector4f vector) {
   
    Vector4f output = new Vector4f();
   
    output.x = matrix.m00 * vector.x + matrix.m10 * vector.y + matrix.m20 * vector.z + matrix.m30 * vector.w;
    output.y = matrix.m01 * vector.x + matrix.m11 * vector.y + matrix.m21 * vector.z + matrix.m31 * vector.w;
    output.z = matrix.m02 * vector.x + matrix.m12 * vector.y + matrix.m22 * vector.z + matrix.m32 * vector.w;
    output.w = matrix.m03 * vector.x + matrix.m13 * vector.y + matrix.m23 * vector.z + matrix.m33 * vector.w;
 
View Full Code Here

Examples of org.lwjgl.util.vector.Vector4f

    return new Vector3f((float)x, (float)y, (float)z);
  }

  @SideOnly(Side.CLIENT)
  public Vector4f vector4f() {
    return new Vector4f((float)x, (float)y, (float)z, 1);
  }
View Full Code Here

Examples of org.spout.math.vector.Vector4f

      y = yForce;
      z = zForce;
    }

    float sunWeight;
    Vector4f skyColor;

    float yAbs = Math.abs(y);
    if (yAbs < sunSize) {
      sunWeight = (y + sunSize) / sunSize / 2.0f;
      Vector4f weightedSun;
      if (y < 0) {
        weightedSun = dawnColor;
      } else {
        float dawnWeight = y / sunSize;
        weightedSun = sunColor.mul(dawnWeight).add(dawnColor.mul(1 - dawnWeight));
      }
      skyColor = weightedSun.mul(sunWeight).add(moonColor.mul((1 - sunWeight)));
    } else {
      if (y < 0) {
        sunWeight = 0;
        skyColor = moonColor;
      } else {
        sunWeight = 1;
        skyColor = sunColor;
      }
    }

    snapshotRender.getMaterial().getShader().setUniform("ambient", ambient);
    snapshotRender.getMaterial().getShader().setUniform("skyColor", skyColor);
    snapshotRender.getMaterial().getShader().setUniform("sunColor", sunColor.mul(sunWeight));
    snapshotRender.getMaterial().getShader().setUniform("moonColor", moonColor.mul(1 - sunWeight));

    Vector4f sunDir = new Vector4f(x * size, y * size, z * size, 1.0f);

    //Spout.getLogger().info("f = " + f + " rads = " + rads + " vector " + sunDir);

    snapshotRender.getMaterial().getShader().setUniform("sunDir", sunDir);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.