Package crazypants.vecmath

Examples of crazypants.vecmath.Vector3d


    for (ForgeDirection face : ForgeDirection.VALID_DIRECTIONS) {
      if(face != component.dir && face != component.dir.getOpposite()) {

        Tessellator tes = Tessellator.instance;
        tes.setNormal(face.offsetX, face.offsetY, face.offsetZ);
        Vector3d offset = ForgeDirectionOffsets.offsetScaled(face, -0.005);

        Vector2f uv = new Vector2f();
        List<ForgeDirection> edges = RenderUtil.getEdgesForFace(face);
        for (ForgeDirection edge : edges) {
          if(edge != component.dir && edge != component.dir.getOpposite()) {
            float xLen = 1 - Math.abs(edge.offsetX) * outlineWidth;
            float yLen = 1 - Math.abs(edge.offsetY) * outlineWidth;
            float zLen = 1 - Math.abs(edge.offsetZ) * outlineWidth;
            BoundingBox bb = bbb.scale(xLen, yLen, zLen);

            List<Vector3f> corners = bb.getCornersForFace(face);

            for (Vector3f unitCorn : corners) {
              Vector3d corner = new Vector3d(unitCorn);
              corner.add(offset);

              corner.x += (float) (edge.offsetX * 0.5 * bbb.sizeX()) - (Math.signum(edge.offsetX) * xLen / 2f * bbb.sizeX()) * 2f;
              corner.y += (float) (edge.offsetY * 0.5 * bbb.sizeY()) - (Math.signum(edge.offsetY) * yLen / 2f * bbb.sizeY()) * 2f;
              corner.z += (float) (edge.offsetZ * 0.5 * bbb.sizeZ()) - (Math.signum(edge.offsetZ) * zLen / 2f * bbb.sizeZ()) * 2f;

 
View Full Code Here


    float sizeY = bound.sizeY();
    bound = bound.scale(xs, ys, zs);
    float transY = (bound.sizeY() - sizeY) / 2;

    Vector3d translation = new Vector3d(0, transY, 0);
    setupVertices(bound.translate(translation));
  }
View Full Code Here

        tessellator.setColorOpaque_I(c);

        Offset offset = conduit.getBundle().getOffset(IPowerConduit.class, component.dir);
        BoundingBox bound = component.bound;
        if(conMode != ConnectionMode.IN_OUT) {
          Vector3d trans = ForgeDirectionOffsets.offsetScaled(component.dir, -0.075);
          bound = bound.translate(trans);
        }
        CubeRenderer.render(bound, tex);
        tessellator.setColorOpaque(255, 255, 255);
      }
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);
View Full Code Here

  public static void renderSegment(ForgeDirection dir, BoundingBox bounds, float minU, float maxU, float minV, float maxV, boolean isStub) {
    float uScale = maxU - minU;
    float vScale = maxV - minV;

    Vector3d offset = calcOffset(dir, bounds);

    Tessellator tes = Tessellator.instance;
    Vertex[] coords;
    if(isStub) {
      coords = DIR_STUB_COORDS[dir.ordinal()];
View Full Code Here

      }
    }
  }

  private static Vector3d calcOffset(ForgeDirection dir, BoundingBox bounds) {
    Vector3d res = new Vector3d();
    Vector3d center = bounds.getCenter();
    Axis axis = Offsets.getAxisForDir(dir);
    if(axis == Axis.X) {
      res.set(0, center.y - REF_TRANS.y, center.z - REF_TRANS.z);
    } else if(axis == Axis.Y) {
      res.set(center.x - REF_TRANS.x, 0, center.z - REF_TRANS.z);
View Full Code Here

    if(collidables != null && !collidablesDirty) {
      return collidables;
    }

    Offset o = getBundle().getOffset(getBaseConduitType(), ForgeDirection.UNKNOWN);
    Vector3d trans = ConduitGeometryUtil.instance.getTranslation(ForgeDirection.UNKNOWN, o);

    List<CollidableComponent> result = super.getCollidableComponents();
    BoundingBox[] aabb = RedstoneSwitchBounds.getInstance().getAABB();

    for (BoundingBox bb : aabb) {
View Full Code Here

    float connectorHalfWidth = (float) Math.max(0.015, conduitScale * 0.05);
    connectorBounds = new BoundingBox(0.5 - connectorHalfWidth, 0.5 - connectorHalfWidth, 0.5 - connectorHalfWidth, 0.5 + connectorHalfWidth,
        0.5 + connectorHalfWidth, 0.5 + distance);

    Vector3d axis = new Vector3d(0, 1, 0);
    Vector3d p = new Vector3d(0.5, 0.5, 0.5);
    xForms = new VertexTransform[4];
    double angle = Math.toRadians(45);
    for (int i = 0; i < xForms.length; i++) {
      xForms[i] = new VertexRotation(angle, axis, p);
      angle += Math.toRadians(90);
View Full Code Here

    for (int i = 0; i < icons.length; i++) {
      icons[i] = EnderIO.blockConduitBundle.getConnectorIcon();
    }
    icons[3] = sw.getSwitchIcon();   

    Vector3d trans = ConduitGeometryUtil.instance.getTranslation(ForgeDirection.UNKNOWN, bundle.getOffset(IRedstoneConduit.class, ForgeDirection.UNKNOWN));
    BoundingBox bb = switchBounds.translate(trans);

    for (VertexTransform tf : xForms) {
      CubeRenderer.render(bb, icons, tf,null);
    }
View Full Code Here

    List<Vertex> verts = VERTS.get(dir);
    if(verts == null) {
      return;
    }

    Vector3d trans = ConduitGeometryUtil.instance.getTranslation(dir, offset);

    float uWidth = tex.getMaxU() - tex.getMinU();
    float uScale = uWidth * 0.64f;
    float minU = tex.getMinU() + (uWidth - uScale);
    float vScale = tex.getMaxV() - tex.getMinV();
View Full Code Here

TOP

Related Classes of crazypants.vecmath.Vector3d

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.