Package crazypants.vecmath

Examples of crazypants.vecmath.Vertex


    applyLighting(vert, corner, vertices);
    vertices.add(vert);
  }

  private void applyLighting(Vertex vert, Vector3d samplePoint, List<Vertex> litVertices) {
    Vertex closest = getClosestVertex(litVertices, samplePoint);
    if(closest == null) {
      return;
    }
    vert.setBrightness(closest.brightness);
    Vector4f col = closest.getColor();
    if(col != null) {
      vert.setColor(col);
    }
  }
View Full Code Here


        coord.xyz.add(ForgeDirectionOffsets.offsetScaled(gb.face, 0.001f));
        Vector3d xyz = new Vector3d(coord.xyz);
        xyz.x += x;
        xyz.y += y;
        xyz.z += z;
        Vertex v = getClosestVertex(vertices, xyz);
        if(v != null) {
          if(v.color != null) {
            tes.setColorRGBA_F(v.color.x, v.color.y, v.color.z, v.color.w);
          } else {
            tes.setColorOpaque_F(0.7f, 0.7f, 0.7f);
View Full Code Here

        Vector3d xyz = new Vector3d(coord.xyz);
        xyz.x += x;
        xyz.y += y;
        xyz.z += z;
        Vertex v = getClosestVertex(vertices, xyz);
        if(v != null) {
          if(v.color != null) {
            tes.setColorRGBA_F(v.color.x, v.color.y, v.color.z, v.color.w);
          } else {
            tes.setColorOpaque_F(0.7f, 0.7f, 0.7f);
View Full Code Here

      }
      return myRightVal == max;
    }

    private Vertex getClosestVertex(List<Vertex> vertices, Vector3d corner) {
      Vertex result = null;
      double d2 = Double.MAX_VALUE;
      for (Vertex v : vertices) {
        double tmp = corner.distanceSquared(v.xyz);
        if(tmp <= d2) {
          result = v;
View Full Code Here

      for (Vertex c : corners) {
        addVecWithUV(c.xyz, c.uv.x, c.uv.y);
      }
      //back face
      for (int i = corners.size() - 1; i >= 0; i--) {
        Vertex c = corners.get(i);
        addVecWithUV(c.xyz, c.uv.x, c.uv.y);
      }
    }
  }
View Full Code Here

        for (Vertex c : corners) {
          addVecWithUV(c.xyz, c.uv.x, c.uv.y);
        }
        //back face
        for (int i = corners.size() - 1; i >= 0; i--) {
          Vertex c = corners.get(i);
          addVecWithUV(c.xyz, c.uv.x, c.uv.y);
        }
      }

    }
View Full Code Here

  }

  private static void createCaps(Vertex[][] segments, double circ, double halfLength) {
    Vertex[] refCrossSection = createUnitCrossSection(0, 0, halfLength, 16, 0);

    Vertex center = new Vertex(new Vector3d(0, 0, halfLength), new Vector3f(0, 0, 1), new Vector2f(0.5f, 0.5f));

    Vertex[] refCoords = new Vertex[refCrossSection.length * 4];
    int index = 0;
    for (int i = 0; i < refCrossSection.length; i++) {
      refCoords[index] = new Vertex(center);
      refCoords[index + 1] = new Vertex(refCrossSection[i]);

      int next = i + 1;
      if(next >= refCrossSection.length - 1) {
        next = 0;
      }
      refCoords[index + 2] = new Vertex(refCrossSection[next]);
      refCoords[index + 3] = new Vertex(center);
      index += 4;
    }

    createSegmentsForDirections(segments, circ, halfLength, refCoords);

View Full Code Here

  }

  private static Vertex[] xformCoords(Vertex[] refCoords, Matrix4d rotMat, Vector3d trans) {
    Vertex[] res = new Vertex[refCoords.length];
    for (int i = 0; i < res.length; i++) {
      res[i] = new Vertex(refCoords[i]);
      res[i].transform(rotMat);
      res[i].translate(trans);
    }
    return res;
  }
View Full Code Here

  }

  private static Vertex[] xformCoords(List<Vertex> refCoords, Matrix4d rotMat, Vector3d trans) {
    Vertex[] res = new Vertex[refCoords.size()];
    for (int i = 0; i < res.length; i++) {
      res[i] = new Vertex(refCoords.get(i));
      res[i].transform(rotMat);
      res[i].translate(trans);
    }
    return res;
  }
View Full Code Here

    double inc = (Math.PI * 2) / (crossSection.length - 1);
    for (int i = 0; i < crossSection.length; i++) {
      double x = Math.cos(angle) * 0.5;
      double y = Math.sin(angle) * 0.5;
      angle += inc;
      crossSection[i] = new Vertex();
      crossSection[i].setXYZ(xOffset + x, yOffset + y, zOffset);
      crossSection[i].setNormal(x, y, 0);
      crossSection[i].setUV(u, y + 0.5);
    }
    return crossSection;
View Full Code Here

TOP

Related Classes of crazypants.vecmath.Vertex

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.