com.badlogic.gdx.math.Matrix4.prj()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中com.badlogic.gdx.math.Matrix4.prj()方法的一些代码示例,展示了Matrix4.prj()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix4.prj()方法的具体详情如下:
包路径:com.badlogic.gdx.math.Matrix4
类名称:Matrix4
方法名:prj

Matrix4.prj介绍

[英]Multiplies the vector with the given matrix, performing a division by w. The matrix array is assumed to hold a 4x4 column major matrix as you can get from Matrix4#val. The vector array is assumed to hold a 3-component vector, with x being the first element, y being the second and z being the last component. The result is stored in the vector array. This is the same as Vector3#prj(Matrix4).
[中]将向量与给定的矩阵相乘,执行除以w的运算。假设矩阵数组包含一个4x4列主矩阵,正如您可以从Matrix4#val中获得的那样。假设向量数组包含一个三分量向量,其中x是第一个元素,y是第二个元素,z是最后一个分量。结果存储在向量数组中。这与Vector3#prj(Matrix4)相同。

代码示例

代码示例来源:origin: libgdx/libgdx

/** Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g. from an
 * {@link OrthographicCamera} or {@link PerspectiveCamera}.
 * @param inverseProjectionView the combined projection and view matrices. */
public void update (Matrix4 inverseProjectionView) {
  System.arraycopy(clipSpacePlanePointsArray, 0, planePointsArray, 0, clipSpacePlanePointsArray.length);
  Matrix4.prj(inverseProjectionView.val, planePointsArray, 0, 8, 3);
  for (int i = 0, j = 0; i < 8; i++) {
    Vector3 v = planePoints[i];
    v.x = planePointsArray[j++];
    v.y = planePointsArray[j++];
    v.z = planePointsArray[j++];
  }
  planes[0].set(planePoints[1], planePoints[0], planePoints[2]);
  planes[1].set(planePoints[4], planePoints[5], planePoints[7]);
  planes[2].set(planePoints[0], planePoints[4], planePoints[3]);
  planes[3].set(planePoints[5], planePoints[1], planePoints[6]);
  planes[4].set(planePoints[2], planePoints[3], planePoints[6]);
  planes[5].set(planePoints[4], planePoints[0], planePoints[1]);
}

代码示例来源:origin: libgdx/libgdx

/** Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g. from an
 * {@link OrthographicCamera} or {@link PerspectiveCamera}.
 * @param inverseProjectionView the combined projection and view matrices. */
public void update (Matrix4 inverseProjectionView) {
  System.arraycopy(clipSpacePlanePointsArray, 0, planePointsArray, 0, clipSpacePlanePointsArray.length);
  Matrix4.prj(inverseProjectionView.val, planePointsArray, 0, 8, 3);
  for (int i = 0, j = 0; i < 8; i++) {
    Vector3 v = planePoints[i];
    v.x = planePointsArray[j++];
    v.y = planePointsArray[j++];
    v.z = planePointsArray[j++];
  }
  planes[0].set(planePoints[1], planePoints[0], planePoints[2]);
  planes[1].set(planePoints[4], planePoints[5], planePoints[7]);
  planes[2].set(planePoints[0], planePoints[4], planePoints[3]);
  planes[3].set(planePoints[5], planePoints[1], planePoints[6]);
  planes[4].set(planePoints[2], planePoints[3], planePoints[6]);
  planes[5].set(planePoints[4], planePoints[0], planePoints[1]);
}

代码示例来源:origin: libgdx/libgdx

Matrix4.prj(mat1.val, fvec);
Matrix4.prj(mat1.val, fvecs, 0, 3, 5);
check(vec, fvec);
check(vec, fvecs, 3, 5);

代码示例来源:origin: com.badlogicgames.gdx/gdx

/** Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g. from an
 * {@link OrthographicCamera} or {@link PerspectiveCamera}.
 * @param inverseProjectionView the combined projection and view matrices. */
public void update (Matrix4 inverseProjectionView) {
  System.arraycopy(clipSpacePlanePointsArray, 0, planePointsArray, 0, clipSpacePlanePointsArray.length);
  Matrix4.prj(inverseProjectionView.val, planePointsArray, 0, 8, 3);
  for (int i = 0, j = 0; i < 8; i++) {
    Vector3 v = planePoints[i];
    v.x = planePointsArray[j++];
    v.y = planePointsArray[j++];
    v.z = planePointsArray[j++];
  }
  planes[0].set(planePoints[1], planePoints[0], planePoints[2]);
  planes[1].set(planePoints[4], planePoints[5], planePoints[7]);
  planes[2].set(planePoints[0], planePoints[4], planePoints[3]);
  planes[3].set(planePoints[5], planePoints[1], planePoints[6]);
  planes[4].set(planePoints[2], planePoints[3], planePoints[6]);
  planes[5].set(planePoints[4], planePoints[0], planePoints[1]);
}

相关文章