Package se.llbit.math

Examples of se.llbit.math.Quad.intersect()


  };

  public static boolean intersect(Ray ray) {
    Quad quad = quads[ray.getBlockData() % 4];
    ray.t = Double.POSITIVE_INFINITY;
    if (quad.intersect(ray)) {
      float[] color = Texture.ladder.getColor(ray.u, ray.v);
      if (color[3] > Ray.EPSILON) {
        ray.color.set(color);
        ray.n.set(quad.n);
        ray.distance += ray.tNear;
View Full Code Here


  public static boolean intersect(Ray ray) {
    ray.t = Double.POSITIVE_INFINITY;
    boolean hit = false;
    for (int i = 0; i < quads.length; ++i) {
      Quad quad = quads[i];
      if (quad.intersect(ray)) {
        float[] color = tex[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

        extended[(ray.getBlockData() & 7) % 6] :
        retracted[(ray.getBlockData() & 7) % 6];
    ray.t = Double.POSITIVE_INFINITY;
    for (int i = 0; i < rot.length; ++i) {
      Quad side = rot[i];
      if (side.intersect(ray)) {
        texture[isExtended][isSticky][i].getColor(ray);
        ray.n.set(side.n);
        ray.t = ray.tNear;
        hit = true;
      }
View Full Code Here

    int isSticky = ray.getBlockData() >> 3;
    Quad[] rot = extension[(ray.getBlockData() & 7) % 6];
    ray.t = Double.POSITIVE_INFINITY;
    for (int i = 0; i < rot.length; ++i) {
      Quad side = rot[i];
      if (side.intersect(ray)) {
        texture[isSticky][i].getColor(ray);
        ray.n.set(side.n);
        ray.t = ray.tNear;
        hit = true;
      }
View Full Code Here

    boolean hit = false;
    ray.t = Double.POSITIVE_INFINITY;
    for (int i = 0; i < quads.length; ++i) {
      if ((data & (1<<i)) != 0) {
        Quad quad = quads[i];
        if (quad.intersect(ray)) {
          float[] color = Texture.vines.getColor(ray.u, ray.v);
          if (color[3] > Ray.EPSILON) {
            ray.color.set(color);
            float[] biomeColor = ray.getBiomeFoliageColor(scene);
            ray.color.x *= biomeColor[0];
View Full Code Here

        }
      }
    }
    if (data == 0 || (ray.currentMaterial & (1 << BlockData.VINE_TOP)) != 0) {
      Quad quad = quads[4];
      if (quad.intersect(ray)) {
        float[] color = Texture.vines.getColor(ray.u, ray.v);
        if (color[3] > Ray.EPSILON) {
          ray.color.set(color);
          float[] biomeColor = ray.getBiomeFoliageColor(scene);
          ray.color.x *= biomeColor[0];
View Full Code Here

    int direction = data >> 2;
    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[direction][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

    ray.t = Double.POSITIVE_INFINITY;
    for (int i = 0; i < 4; ++i) {
      if (metadata == 0 || ((metadata & (1 << i)) != 0)) {
        for (int j = 0; j < panes[i].length; ++j) {
          Quad quad = panes[i][j];
          if (quad.intersect(ray)) {
            float[] color;
            if (j < 2)
              color = texture.getColor(ray.u, ray.v);
            else
              color = sideTexture.getColor(ray.u, ray.v);
View Full Code Here

            hit = true;
          }
        }
      }
      Quad quad = ripe[connected-1];
      if (quad.intersect(ray)) {
        float[] color = Texture.stemBent.getColor(ray.u, ray.v);
        if (color[3] > Ray.EPSILON) {
          ray.color.set(color);
          ray.color.x *= stemColor[7][0];
          ray.color.y *= stemColor[7][1];
View Full Code Here

    Quad[] rot = variants[(ray.currentMaterial >> 16) % 3]
        [ray.getBlockData() % 6];
    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

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.