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

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

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

Matrix4.setAsAffine介绍

[英]Assumes that this matrix is a 2D affine transformation, copying only the relevant components. The values are mapped as follows:

[  M00  M01   _   M02  ] 
[  M10  M11   _   M12  ] 
[   _    _    _    _   ] 
[   _    _    _    _   ]

[中]假设该矩阵是二维仿射变换,仅复制相关组件。这些值映射如下:

[  M00  M01   _   M02  ] 
[  M10  M11   _   M12  ] 
[   _    _    _    _   ] 
[   _    _    _    _   ]

代码示例

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

/** Sets the transform matrix to be used by this Batch. Even if this is called inside a {@link #begin()}/{@link #end()} block,
 * the current batch is <em>not</em> flushed to the GPU. Instead, for every subsequent draw() the vertices will be transformed
 * on the CPU to match the original batch matrix. This adjustment must be performed until the matrices are realigned by
 * restoring the original matrix, or by calling {@link #flushAndSyncTransformMatrix()} or {@link #end()}. */
public void setTransformMatrix (Affine2 transform) {
  Matrix4 realMatrix = super.getTransformMatrix();
  if (checkEqual(realMatrix, transform)) {
    adjustNeeded = false;
  } else {
    virtualMatrix.setAsAffine(transform);
    if (isDrawing()) {
      adjustNeeded = true;
      // adjust = inverse(real) x virtual
      // real x adjust x vertex = virtual x vertex
      if (haveIdentityRealMatrix) {
        adjustAffine.set(transform);
      } else {
        adjustAffine.set(realMatrix).inv().mul(transform);
      }
    } else {
      realMatrix.setAsAffine(transform);
      haveIdentityRealMatrix = checkIdt(realMatrix);
    }
  }
}

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

/** Sets the transform matrix to be used by this Batch. Even if this is called inside a {@link #begin()}/{@link #end()} block,
 * the current batch is <em>not</em> flushed to the GPU. Instead, for every subsequent draw() the vertices will be transformed
 * on the CPU to match the original batch matrix. This adjustment must be performed until the matrices are realigned by
 * restoring the original matrix, or by calling {@link #flushAndSyncTransformMatrix()} or {@link #end()}. */
public void setTransformMatrix (Affine2 transform) {
  Matrix4 realMatrix = super.getTransformMatrix();
  if (checkEqual(realMatrix, transform)) {
    adjustNeeded = false;
  } else {
    virtualMatrix.setAsAffine(transform);
    if (isDrawing()) {
      adjustNeeded = true;
      // adjust = inverse(real) x virtual
      // real x adjust x vertex = virtual x vertex
      if (haveIdentityRealMatrix) {
        adjustAffine.set(transform);
      } else {
        adjustAffine.set(realMatrix).inv().mul(transform);
      }
    } else {
      realMatrix.setAsAffine(transform);
      haveIdentityRealMatrix = checkIdt(realMatrix);
    }
  }
}

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

/** Sets the transform matrix to be used by this Batch. Even if this is called inside a {@link #begin()}/{@link #end()} block,
 * the current batch is <em>not</em> flushed to the GPU. Instead, for every subsequent draw() the vertices will be transformed
 * on the CPU to match the original batch matrix. This adjustment must be performed until the matrices are realigned by
 * restoring the original matrix, or by calling {@link #flushAndSyncTransformMatrix()}. */
@Override
public void setTransformMatrix (Matrix4 transform) {
  Matrix4 realMatrix = super.getTransformMatrix();
  if (checkEqual(realMatrix, transform)) {
    adjustNeeded = false;
  } else {
    if (isDrawing()) {
      virtualMatrix.setAsAffine(transform);
      adjustNeeded = true;
      // adjust = inverse(real) x virtual
      // real x adjust x vertex = virtual x vertex
      if (haveIdentityRealMatrix) {
        adjustAffine.set(transform);
      } else {
        tmpAffine.set(transform);
        adjustAffine.set(realMatrix).inv().mul(tmpAffine);
      }
    } else {
      realMatrix.setAsAffine(transform);
      haveIdentityRealMatrix = checkIdt(realMatrix);
    }
  }
}

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

/** Sets the transform matrix to be used by this Batch. Even if this is called inside a {@link #begin()}/{@link #end()} block,
 * the current batch is <em>not</em> flushed to the GPU. Instead, for every subsequent draw() the vertices will be transformed
 * on the CPU to match the original batch matrix. This adjustment must be performed until the matrices are realigned by
 * restoring the original matrix, or by calling {@link #flushAndSyncTransformMatrix()}. */
@Override
public void setTransformMatrix (Matrix4 transform) {
  Matrix4 realMatrix = super.getTransformMatrix();
  if (checkEqual(realMatrix, transform)) {
    adjustNeeded = false;
  } else {
    if (isDrawing()) {
      virtualMatrix.setAsAffine(transform);
      adjustNeeded = true;
      // adjust = inverse(real) x virtual
      // real x adjust x vertex = virtual x vertex
      if (haveIdentityRealMatrix) {
        adjustAffine.set(transform);
      } else {
        tmpAffine.set(transform);
        adjustAffine.set(realMatrix).inv().mul(tmpAffine);
      }
    } else {
      realMatrix.setAsAffine(transform);
      haveIdentityRealMatrix = checkIdt(realMatrix);
    }
  }
}

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

/** Sets the transform matrix to be used by this Batch. Even if this is called inside a {@link #begin()}/{@link #end()} block,
 * the current batch is <em>not</em> flushed to the GPU. Instead, for every subsequent draw() the vertices will be transformed
 * on the CPU to match the original batch matrix. This adjustment must be performed until the matrices are realigned by
 * restoring the original matrix, or by calling {@link #flushAndSyncTransformMatrix()} or {@link #end()}. */
public void setTransformMatrix (Affine2 transform) {
  Matrix4 realMatrix = super.getTransformMatrix();
  if (checkEqual(realMatrix, transform)) {
    adjustNeeded = false;
  } else {
    virtualMatrix.setAsAffine(transform);
    if (isDrawing()) {
      adjustNeeded = true;
      // adjust = inverse(real) x virtual
      // real x adjust x vertex = virtual x vertex
      if (haveIdentityRealMatrix) {
        adjustAffine.set(transform);
      } else {
        adjustAffine.set(realMatrix).inv().mul(transform);
      }
    } else {
      realMatrix.setAsAffine(transform);
      haveIdentityRealMatrix = checkIdt(realMatrix);
    }
  }
}

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

/** Sets the transform matrix to be used by this Batch. Even if this is called inside a {@link #begin()}/{@link #end()} block,
 * the current batch is <em>not</em> flushed to the GPU. Instead, for every subsequent draw() the vertices will be transformed
 * on the CPU to match the original batch matrix. This adjustment must be performed until the matrices are realigned by
 * restoring the original matrix, or by calling {@link #flushAndSyncTransformMatrix()}. */
@Override
public void setTransformMatrix (Matrix4 transform) {
  Matrix4 realMatrix = super.getTransformMatrix();
  if (checkEqual(realMatrix, transform)) {
    adjustNeeded = false;
  } else {
    if (isDrawing()) {
      virtualMatrix.setAsAffine(transform);
      adjustNeeded = true;
      // adjust = inverse(real) x virtual
      // real x adjust x vertex = virtual x vertex
      if (haveIdentityRealMatrix) {
        adjustAffine.set(transform);
      } else {
        tmpAffine.set(transform);
        adjustAffine.set(realMatrix).inv().mul(tmpAffine);
      }
    } else {
      realMatrix.setAsAffine(transform);
      haveIdentityRealMatrix = checkIdt(realMatrix);
    }
  }
}

相关文章