Package se.llbit.math

Examples of se.llbit.math.Quad


  public static boolean intersect(Ray ray, Texture[] texture) {
    boolean hit = false;
    Quad[] rot = sides[ray.getBlockData() % 4];
    ray.t = Double.POSITIVE_INFINITY;
    for (int i = 0; i < rot.length; ++i) {
      Quad side = rot[i];
      if (side.intersect(ray)) {
        texture[i].getColor(ray);
        ray.n.set(side.n);
        ray.t = ray.tNear;
        hit = true;
      }
View Full Code Here


  };

  public static boolean intersection(Ray ray) {
    int direction = (ray.currentMaterial >> 12) & 1;
    ray.t = Double.POSITIVE_INFINITY;
    Quad quad = wire[direction];
    if (quad.intersect(ray)) {
      ray.u *= 4;
      ray.u -= (int) ray.u;
      float[] color = Texture.tripwire.getColor(ray.u, ray.v);
      if (color[3] > Ray.EPSILON) {
        ray.color.set(color);
View Full Code Here

        }
      }
    }
    if (kind == 0 && top == 1) {
      for (int i = 0; i < sunflower.length; ++i) {
        Quad quad = sunflower[i];
        if (quad.intersect(ray)) {
          float[] color = sunflowerTex[i].getColor(ray.u, ray.v);
          if (color[3] > Ray.EPSILON) {
            ray.color.set(color);
            ray.t = ray.tNear;
            ray.n.set(quad.n);
View Full Code Here

    int data = ray.getBlockData();
    int type = data % 5;
    boolean hit = false;
    ray.t = Double.POSITIVE_INFINITY;
    for (int i = 0; i < sides.length; ++i) {
      Quad side = sides[i];

      if (side.intersect(ray)) {

        double u = ray.u;
        int uv_x = uv[type][i];
        ray.u = (1-uv_x) * ray.u + uv_x * ray.v;
        ray.v = uv_x * u  + (1-uv_x) * ray.v;
 
View Full Code Here

    int data = ray.currentMaterial;
    boolean hit = false;
    int power = ray.getBlockData();
    int connection = 0xF & (data >> BlockData.RSW_EAST_CONNECTION);
    ray.t = Double.POSITIVE_INFINITY;
    Quad quad = quads[connection];
    if (quad.intersect(ray)) {
      float[] color = tex[connection].getColor(ray.u, ray.v);
      if (color[3] > Ray.EPSILON) {
        ray.color.x = color[0] * wireColor[power][0];
        ray.color.y = color[1] * wireColor[power][1];
        ray.color.z = color[2] * wireColor[power][2];
 
View Full Code Here

   * @return Quads rotated minus 90 degrees around the X axis
   */
  public static final Quad[] rotateNegX(Quad[] src) {
    Quad[] rot = new Quad[src.length];
    for (int i = 0; i < src.length; ++i) {
      rot[i] = new Quad(src[i], Transform.NONE.rotateNegX());
    }
    return rot;
  }
View Full Code Here

   * @return Quads rotated 90 degrees around the X axis
   */
  public static final Quad[] rotateX(Quad[] src) {
    Quad[] rot = new Quad[src.length];
    for (int i = 0; i < src.length; ++i) {
      rot[i] = new Quad(src[i], Transform.NONE.rotateX());
    }
    return rot;
  }
View Full Code Here

   * @return Quads rotated about the X axis by some angle
   */
  public static final Quad[] rotateX(Quad[] src, double angle) {
    Quad[] rot = new Quad[src.length];
    for (int i = 0; i < src.length; ++i) {
      rot[i] = new Quad(src[i], Transform.NONE.rotateX(angle));
    }
    return rot;
  }
View Full Code Here

   * @return Quads rotated 90 degrees around the Y axis
   */
  public static final Quad[] rotateY(Quad[] src) {
    Quad[] rot = new Quad[src.length];
    for (int i = 0; i < src.length; ++i) {
      rot[i] = new Quad(src[i], Transform.NONE.rotateY());
    }
    return rot;
  }
View Full Code Here

   * @return Quads rotated about the Y axis by some angle
   */
  public static final Quad[] rotateY(Quad[] src, double angle) {
    Quad[] rot = new Quad[src.length];
    for (int i = 0; i < src.length; ++i) {
      rot[i] = new Quad(src[i], Transform.NONE.rotateY(angle));
    }
    return rot;
  }
View Full Code Here

TOP

Related Classes of se.llbit.math.Quad

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.