Package crazypants.vecmath

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


  @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

    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

    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

  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

TOP

Related Classes of crazypants.vecmath.Matrix4d

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.