當前位置: 首頁>>代碼示例>>Java>>正文


Java Matrix4f.mul方法代碼示例

本文整理匯總了Java中javax.vecmath.Matrix4f.mul方法的典型用法代碼示例。如果您正苦於以下問題:Java Matrix4f.mul方法的具體用法?Java Matrix4f.mul怎麽用?Java Matrix4f.mul使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.vecmath.Matrix4f的用法示例。


在下文中一共展示了Matrix4f.mul方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isInteger

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public static boolean isInteger(Matrix4f matrix)
{
    Matrix4f m = new Matrix4f();
    m.setIdentity();
    m.m30 = m.m31 = m.m32 = 1;
    m.m33 = 0;
    m.mul(matrix, m);
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < 3; j++)
        {
            float v = m.getElement(i, j) / m.getElement(3, j);
            if(Math.abs(v - Math.round(v)) > 1e-5) return false;
        }
    }
    return true;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:TRSRTransformation.java

示例2: getBlockTransforms

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
/** Get the default transformations for inside inventories and third person */
    protected static ImmutableMap<TransformType, TRSRTransformation> getBlockTransforms() {
        ImmutableMap.Builder<TransformType, TRSRTransformation> builder = ImmutableMap.builder();

        // Copied from ForgeBlockStateV1
        /*builder.put(TransformType.THIRD_PERSON, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, 1.5f / 16, -2.75f / 16),
                TRSRTransformation.quatFromYXZDegrees(new Vector3f(10, -45, 170)), new Vector3f(0.375f, 0.375f, 0.375f), null)));
*/
        // Gui
        {
            Matrix4f rotationMatrix = new Matrix4f();
            rotationMatrix.setIdentity();
            rotationMatrix = rotateTowardsFace(EnumFacing.SOUTH, EnumFacing.EAST);

            Matrix4f result = new Matrix4f();
            result.setIdentity();
            // Multiply by the last matrix transformation FIRST
            result.mul(rotationMatrix);

            TRSRTransformation trsr = new TRSRTransformation(result);

            builder.put(TransformType.GUI, trsr);
        }

        return builder.build();
    }
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:27,代碼來源:Fixed3DBlockModel.java

示例3: handleCameraTransforms

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery)
{
    if(model instanceof IPerspectiveAwareModel)
    {
        Pair<? extends IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType);

        if(pair.getRight() != null)
        {
            Matrix4f matrix = new Matrix4f(pair.getRight());
            if(leftHandHackery)
            {
                matrix.mul(flipX, matrix);
                matrix.mul(matrix, flipX);
            }
            multiplyCurrentGlMatrix(matrix);
        }
        return pair.getLeft();
    }
    else
    {
        //if(leftHandHackery) GlStateManager.scale(-1, 1, 1);
        ItemCameraTransforms.applyTransformSide(model.getItemCameraTransforms().getTransform(cameraTransformType), leftHandHackery);
        //if(leftHandHackery) GlStateManager.scale(-1, 1, 1);
    }
    return model;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:28,代碼來源:ForgeHooksClient.java

示例4: toAffine

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public static Pair<Matrix3f, Vector3f> toAffine(Matrix4f m)
{
    m.mul(1.f / m.m33);
    Vector3f trans = new Vector3f(m.m03, m.m13, m.m23);
    Matrix3f linear = new Matrix3f(m.m00, m.m01, m.m02, m.m10, m.m11, m.m12, m.m20, m.m21, m.m22);
    return Pair.of(linear, trans);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:8,代碼來源:TRSRTransformation.java

示例5: rotateTowardsFace

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
/** Rotates towards the given face, from the specified face */
public static Matrix4f rotateTowardsFace(EnumFacing from, EnumFacing to) {
    Matrix4f fromMatrix = new Matrix4f(rotateTowardsFace(from));
    // Because we want to do the opposite of what this does
    fromMatrix.invert();

    Matrix4f toMatrix = rotateTowardsFace(to);
    Matrix4f result = new Matrix4f(toMatrix);
    result.mul(fromMatrix);
    return result;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:12,代碼來源:Fixed3DBlockModel.java

示例6: generateAllOperators

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
private void generateAllOperators(HallInfo h) {
  if (h == null) {
    h = hallInfo;
    if (operationCount > 0)
      return;
    operations = new SymmetryOperation[4];
    operationCount = 0;
    if (hallInfo == null || hallInfo.nRotations == 0)
      h = hallInfo = new HallInfo(hallSymbol);
    setLattice(hallInfo.latticeCode, hallInfo.isCentrosymmetric);
    addOperation(null, 0);
    addSymmetry("x,y,z", 0);
  }
  Matrix4f mat1 = new Matrix4f();
  Matrix4f operation = new Matrix4f();
  Matrix4f[] newOps = new Matrix4f[7];
  for (int i = 0; i < 7; i++)
    newOps[i] = new Matrix4f();
  // prior to Jmol 11.7.36/11.6.23 this was setting nOps within the loop
  // and setIdentity() outside the loop. That caused a multiplication of
  // operations, not a resetting of them each time. 
  for (int i = 0; i < h.nRotations; i++) {
    mat1.set(h.rotationTerms[i].seitzMatrix12ths);
    int nRot = h.rotationTerms[i].order;
    // this would iterate int nOps = operationCount;
    newOps[0].setIdentity();
    int nOps = operationCount;
    for (int j = 1; j <= nRot; j++) {
      newOps[j].mul(mat1, newOps[0]);
      newOps[0].set(newOps[j]);
      for (int k = 0; k < nOps; k++) {
        
        operation.mul(newOps[j], operations[k]);
        SymmetryOperation.normalizeTranslation(operation);
        String xyz = SymmetryOperation.getXYZFromMatrix(operation, true, true, true);
        addSymmetry(xyz, operation);
      }
    }
  }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:41,代碼來源:SpaceGroup.java

示例7: getUnscaledTransformMatrix

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
Matrix4f getUnscaledTransformMatrix() {
  //for povray only
  Matrix4f unscaled = new Matrix4f();
  unscaled.setIdentity();
  vectorTemp.set(fixedRotationCenter);
  matrixTemp.setZero();
  matrixTemp.setTranslation(vectorTemp);
  unscaled.sub(matrixTemp);
  matrixTemp.set(matrixRotate);
  unscaled.mul(matrixTemp, unscaled);
  return unscaled;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:13,代碼來源:TransformManager.java

示例8: getMatrix

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public void getMatrix(Matrix4f matrix, float time) {
	matrix.setIdentity();
	
	Matrix4f rot = new Matrix4f();
	for(SkyLayerRotation roti : rotation) {
		roti.getMatrix(rot, time);
		matrix.mul(rot);
	}
	
	matrix.setTranslation(new Vector3f(offset[0], offset[1], offset[2]));
	matrix.setScale(scale);
}
 
開發者ID:tiffit,項目名稱:TaleCraft,代碼行數:13,代碼來源:Environment.java

示例9: compose

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public TRSRTransformation compose(TRSRTransformation b)
{
    Matrix4f m = getMatrix();
    m.mul(b.getMatrix());
    return new TRSRTransformation(m);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:7,代碼來源:TRSRTransformation.java


注:本文中的javax.vecmath.Matrix4f.mul方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。