Examples of Matrix4d


Examples of crazypants.vecmath.Matrix4d

  }

  public static Matrix4d createBillboardMatrix(Vector3d lookAt, EntityLivingBase entityPlayer) {
    Vector3d playerEye = new Vector3d(entityPlayer.posX, entityPlayer.posY + 1.62 - entityPlayer.yOffset, entityPlayer.posZ);
    Vector3d blockOrigin = new Vector3d(lookAt.x, lookAt.y, lookAt.z);
    Matrix4d lookMat = VecmathUtil.createMatrixAsLookAt(blockOrigin, playerEye, RenderUtil.UP_V);
    lookMat.setTranslation(new Vector3d());
    lookMat.invert();
    return lookMat;
  }
View Full Code Here

Examples of crazypants.vecmath.Matrix4d

  @Override
  public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {

   
    EntityLivingBase entityPlayer = Minecraft.getMinecraft().thePlayer;
    Matrix4d lookMat = RenderUtil.createBillboardMatrix(te, entityPlayer);

    int brightness = RenderUtil.setTesselatorBrightness(entityPlayer.worldObj, te.xCoord, te.yCoord, te.zCoord);
    render(x, y, z, lookMat, brightness);

    selectionRenderer.renderTileEntityAt(te, x, y, z, f);
View Full Code Here

Examples of crazypants.vecmath.Matrix4d

    return true;
  }

  @Override
  public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    Matrix4d lookMat = new Matrix4d();
    lookMat.setIdentity();

    lookMat = VecmathUtil.createMatrixAsLookAt(RenderUtil.ZERO_V, new Vector3d(1, 0, 0), RenderUtil.UP_V);

    render(0, 0, 0, lookMat, 0xF000F0);
View Full Code Here

Examples of crazypants.vecmath.Matrix4d

    Minecraft mc = Minecraft.getMinecraft();
    Vector3d eye = Util.getEyePositionEio(mc.thePlayer);
    Vector3d lookAt = Util.getLookVecEio(mc.thePlayer);
    lookAt.add(eye);
    Matrix4d mv = VecmathUtil.createMatrixAsLookAt(eye, lookAt, new Vector3d(0, 1, 0));

    float fov = Minecraft.getMinecraft().gameSettings.fovSetting;       
    Matrix4d pr = VecmathUtil.createProjectionMatrixAsPerspective(fov, 0.05f, mc.gameSettings.renderDistanceChunks * 16, mc.displayWidth,
        mc.displayHeight);      
    currentView.setProjectionMatrix(pr);
    currentView.setViewMatrix(mv);
    currentView.setViewport(0, 0, mc.displayWidth, mc.displayHeight);

View Full Code Here

Examples of crazypants.vecmath.Matrix4d

  private static void createSegmentsForDirections(Vertex[][] segments, double circ, double halfLength, Vertex[] refCoords) {
    for (Vertex coord : refCoords) {
      coord.xyz.x = coord.xyz.x * circ;
      coord.xyz.y = coord.xyz.y * circ;
    }
    Matrix4d rotMat = new Matrix4d();
    rotMat.setIdentity();
    rotMat.setTranslation(REF_TRANS);

    segments[SOUTH.ordinal()] = xformCoords(refCoords, rotMat, offsetScaled(ForgeDirection.SOUTH, halfLength));

    rotMat.makeRotationY(Math.PI);
    rotMat.setTranslation(REF_TRANS);
    segments[ForgeDirection.NORTH.ordinal()] = xformCoords(refCoords, rotMat, offsetScaled(ForgeDirection.NORTH, halfLength));

    rotMat.makeRotationY(Math.PI / 2);
    rotMat.setTranslation(REF_TRANS);
    segments[ForgeDirection.EAST.ordinal()] = xformCoords(refCoords, rotMat, offsetScaled(ForgeDirection.EAST, halfLength));

    rotMat.makeRotationY(-Math.PI / 2);
    rotMat.setTranslation(REF_TRANS);
    segments[ForgeDirection.WEST.ordinal()] = xformCoords(refCoords, rotMat, offsetScaled(ForgeDirection.WEST, halfLength));

    rotMat.makeRotationX(-Math.PI / 2);
    rotMat.setTranslation(REF_TRANS);
    segments[ForgeDirection.UP.ordinal()] = xformCoords(refCoords, rotMat, offsetScaled(ForgeDirection.UP, halfLength));

    rotMat.makeRotationX(Math.PI / 2);
    rotMat.setTranslation(REF_TRANS);
    segments[ForgeDirection.DOWN.ordinal()] = xformCoords(refCoords, rotMat, offsetScaled(ForgeDirection.DOWN, halfLength));
  }
View Full Code Here

Examples of javax.vecmath.Matrix4d

        // Correctly compute the inversion, use Vecmath as the matrix invert
        // in JME does not function when scale!=1
        Quat4d q = new Quat4d(rotation.x, rotation.y, rotation.z, rotation.w);
        Vector3d t = new Vector3d(translation.x, translation.y, translation.z);
        Matrix4d m = new Matrix4d(q,t,scale);
        m.invert();

        m.get(q);
        m.get(t);
        scale = (float)m.getScale();
        rotation.set((float)q.x, (float)q.y, (float)q.z, (float)q.w);
        translation.set((float)t.x, (float)t.y, (float)t.z);

        return this;
    }
View Full Code Here

Examples of javax.vecmath.Matrix4d

/* 260 */       if (this.elements.size() == 3) {
/* 261 */         if ((!(this.elements.get(1) instanceof Point4d)) || (!(this.elements.get(2) instanceof Point4d)))
/*     */         {
/* 263 */           syntaxError(st, file, "All rows must have four elements");
/*     */         }
/* 265 */         return new Matrix4d(((Point4d)this.elements.get(0)).x, ((Point4d)this.elements.get(0)).y, ((Point4d)this.elements.get(0)).z, ((Point4d)this.elements.get(0)).w, ((Point4d)this.elements.get(1)).x, ((Point4d)this.elements.get(1)).y, ((Point4d)this.elements.get(1)).z, ((Point4d)this.elements.get(1)).w, ((Point4d)this.elements.get(2)).x, ((Point4d)this.elements.get(2)).y, ((Point4d)this.elements.get(2)).z, ((Point4d)this.elements.get(2)).w, 0.0D, 0.0D, 0.0D, 1.0D);
/*     */       }
/*     */
/* 279 */       if (this.elements.size() != 4) {
/* 280 */         syntaxError(st, file, "Matrix must have three or four rows");
/*     */       }
/* 282 */       if ((!(this.elements.get(1) instanceof Point4d)) || (!(this.elements.get(2) instanceof Point4d)) || (!(this.elements.get(3) instanceof Point4d)))
/*     */       {
/* 285 */         syntaxError(st, file, "All rows must have four elements");
/*     */       }
/* 287 */       return new Matrix4d(((Point4d)this.elements.get(0)).x, ((Point4d)this.elements.get(0)).y, ((Point4d)this.elements.get(0)).z, ((Point4d)this.elements.get(0)).w, ((Point4d)this.elements.get(1)).x, ((Point4d)this.elements.get(1)).y, ((Point4d)this.elements.get(1)).z, ((Point4d)this.elements.get(1)).w, ((Point4d)this.elements.get(2)).x, ((Point4d)this.elements.get(2)).y, ((Point4d)this.elements.get(2)).z, ((Point4d)this.elements.get(2)).w, ((Point4d)this.elements.get(3)).x, ((Point4d)this.elements.get(3)).y, ((Point4d)this.elements.get(3)).z, ((Point4d)this.elements.get(3)).w);
/*     */     }
/*     */
/* 306 */     syntaxError(st, file, "Syntax error");
/* 307 */     return null;
/*     */   }
View Full Code Here

Examples of javax.vecmath.Matrix4d

/* 405 */     if ((!(elements.get(1) instanceof Double)) || (!(elements.get(2) instanceof Double)) || (!(elements.get(3) instanceof Double)))
/*     */     {
/* 408 */       throw new IllegalArgumentException("All arguments to Translate must be numbers");
/*     */     }
/*     */
/* 412 */     Matrix4d m4d = new Matrix4d();
/* 413 */     m4d.set(new Vector3d(((Double)elements.get(1)).doubleValue(), ((Double)elements.get(2)).doubleValue(), ((Double)elements.get(3)).doubleValue()));
/*     */
/* 417 */     return m4d;
/*     */   }
View Full Code Here

Examples of javax.vecmath.Matrix4d

/* 446 */     double z = Math.toRadians(((Double)elements.get(3)).doubleValue());
/*     */
/* 448 */     Transform3D t3d = new Transform3D();
/* 449 */     t3d.setEuler(new Vector3d(x, y, z));
/*     */
/* 451 */     Matrix4d m4d = new Matrix4d();
/* 452 */     t3d.get(m4d);
/*     */
/* 454 */     return m4d;
/*     */   }
View Full Code Here

Examples of javax.vecmath.Matrix4d

/* 478 */     if ((!(elements.get(1) instanceof Matrix4d)) || (!(elements.get(2) instanceof Matrix4d)))
/*     */     {
/* 480 */       throw new IllegalArgumentException("Both arguments to " + functionName + " must be Matrix4d");
/*     */     }
/*     */
/* 488 */     Matrix4d m4d = new Matrix4d((Matrix4d)elements.get(2));
/* 489 */     m4d.mul((Matrix4d)elements.get(1));
/*     */
/* 491 */     return m4d;
/*     */   }
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.