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


Java Matrix4f.setIdentity方法代碼示例

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


在下文中一共展示了Matrix4f.setIdentity方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: setSphereMatrix

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
protected void setSphereMatrix(Point3f center, float rx, float ry, float rz,
                               AxisAngle4f a, Matrix4f sphereMatrix) {
  if (a != null) {
    Matrix3f mq = new Matrix3f();
    Matrix3f m = new Matrix3f();
    m.m00 = rx;
    m.m11 = ry;
    m.m22 = rz;
    mq.set(a);
    mq.mul(m);
    sphereMatrix.set(mq);
  } else {
    sphereMatrix.setIdentity();
    sphereMatrix.m00 = rx;
    sphereMatrix.m11 = ry;
    sphereMatrix.m22 = rz;
  }
  sphereMatrix.m03 = center.x;
  sphereMatrix.m13 = center.y;
  sphereMatrix.m23 = center.z;
  sphereMatrix.m33 = 1;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:23,代碼來源:__CartesianExporter.java

示例4: 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

示例5: handlePerspective

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType type) {
    Matrix4f m = new Matrix4f();
    m.setIdentity();
    TRSRTransformation trsrt = new TRSRTransformation(m);


    switch(type){
        case FIRST_PERSON_RIGHT_HAND:
            trsrt = new TRSRTransformation(new Vector3f( 0.1f, 0.2f, 0.05f ), new Quat4f(-0.15304594f, -0.6903456f, 0.15304594f, 0.6903456f), new Vector3f(0.68f, 0.68f, 0.68f),  new Quat4f(0.0f, 0.0f, 0.0f, 1.0f));
            break;
        case FIRST_PERSON_LEFT_HAND:
            trsrt = new TRSRTransformation(new Vector3f( 0.1f, 0.2f, 0.05f ), new Quat4f(0.15304594f, -0.6903456f, 0.15304594f, -0.6903456f), new Vector3f(0.68f, 0.68f, 0.68f),  new Quat4f(0.0f, 0.0f, 0.0f, 1.0f));
            break;
        case THIRD_PERSON_RIGHT_HAND:
            trsrt = new TRSRTransformation(new Vector3f( 0.0f, 0.25f, 0.03f ), new Quat4f(-0.3265056f, -0.6272113f, 0.32650554f, 0.62721133f), new Vector3f(0.85f, 0.85f, 0.85f),  new Quat4f(0.0f, 0.0f, 0.0f, 1.0f));
            break;
        case THIRD_PERSON_LEFT_HAND:
            trsrt = new TRSRTransformation(new Vector3f( 0.0f, 0.25f, 0.03f ), new Quat4f(-0.3265056f, 0.6272113f, -0.32650554f, 0.62721133f), new Vector3f(0.85f, 0.85f, 0.85f),  new Quat4f(0.0f, 0.0f, 0.0f, 1.0f));
            break;
        case GROUND:
            trsrt = new TRSRTransformation(new Vector3f( 0.0f, 0.0f, 0.0f ), new Quat4f(0.0f, 0.0f, 0.0f, 1.0f), new Vector3f(0.5f, 0.5f, 0.5f),  new Quat4f(0.0f, 0.0f, 0.0f, 1.0f));
            break;

        default:
            break;
    }

    return Pair.of(this,trsrt.getMatrix());
}
 
開發者ID:Ohrm,項目名稱:Malgra,代碼行數:31,代碼來源:ExtractorModel.java

示例6: 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

示例7: getEquationForQuadricWithCenter

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public static void getEquationForQuadricWithCenter(float x, float y, float z, Matrix3f mToElliptical, 
                                           Vector3f vTemp, Matrix3f mTemp, double[] coef, Matrix4f mDeriv) {
  /* Starting with a center point and a matrix that converts cartesian 
   * or screen coordinates to ellipsoidal coordinates, 
   * this method fills a float[10] with the terms for the 
   * equation for the ellipsoid:
   * 
   * c0 x^2 + c1 y^2 + c2 z^2 + c3 xy + c4 xz + c5 yz + c6 x + c7 y + c8 z - 1 = 0 
   * 
   * I made this up; I haven't seen it in print. -- Bob Hanson, 4/2008
   * 
   */
  
  vTemp.set(x, y, z);
  mToElliptical.transform(vTemp);
  double f = 1 - vTemp.dot(vTemp); // J
  mTemp.transpose(mToElliptical);
  mTemp.transform(vTemp);
  mTemp.mul(mToElliptical);
  coef[0] = mTemp.m00 / f;     // A = aXX
  coef[1] = mTemp.m11 / f;     // B = aYY
  coef[2] = mTemp.m22 / f;     // C = aZZ
  coef[3] = mTemp.m01 * 2 / f; // D = aXY
  coef[4] = mTemp.m02 * 2 / f; // E = aXZ
  coef[5] = mTemp.m12 * 2 / f; // F = aYZ
  coef[6] = -2 * vTemp.x / f;  // G = aX
  coef[7] = -2 * vTemp.y / f;  // H = aY
  coef[8] = -2 * vTemp.z / f;  // I = aZ
  coef[9] = -1;                // J = -1
  
  /*
   * f = Ax^2 + By^2 + Cz^2 + Dxy + Exz + Fyz + Gx + Hy + Iz + J
   * df/dx = 2Ax +  Dy +  Ez + G
   * df/dy =  Dx + 2By +  Fz + H
   * df/dz =  Ex +  Fy + 2Cz + I
   */
  
  if (mDeriv == null)
    return;
  mDeriv.setIdentity();
  mDeriv.m00 = (float) (2 * coef[0]);
  mDeriv.m11 = (float) (2 * coef[1]);
  mDeriv.m22 = (float) (2 * coef[2]);

  mDeriv.m01 = mDeriv.m10 = (float) coef[3];
  mDeriv.m02 = mDeriv.m20 = (float) coef[4];
  mDeriv.m12 = mDeriv.m21 = (float) coef[5];

  mDeriv.m03 = (float) coef[6];
  mDeriv.m13 = (float) coef[7];
  mDeriv.m23 = (float) coef[8];
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:53,代碼來源:Quadric.java

示例8: outputTriangle1

import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
/**
 * Local implementation of outputCylinder.
 * 
 * @param pt1
 *          Vertex 1.
 * @param pt2
 *          Vertex 2.
 * @param pt3
 *          Vertex 3.
 * @param colix
 *          The colix.
 */
private void outputTriangle1(Point3f pt1, Point3f pt2, Point3f pt3,
                             short colix) {
  MeshSurface data = MeshData.getTriangleData(pt1, pt2, pt3);
  Matrix4f matrix = new Matrix4f();
  addTexture(colix, null);
  String name = "Triangle" + triangleNum++;
  matrix.setIdentity();
  addMesh(name, data, matrix, matrix, colix, null, null);
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:22,代碼來源:_ObjExporter.java


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