/** <p> * Flushes the batch and realigns the real matrix on the GPU. Subsequent draws won't need adjustment and will be slightly * faster as long as the transform matrix is not {@link #setTransformMatrix(Matrix4) changed}. * </p> * <p> * Note: The real transform matrix <em>must</em> be invertible. If a singular matrix is detected, GdxRuntimeException will be * thrown. * </p> * @see SpriteBatch#flush() */ public void flushAndSyncTransformMatrix () { flush(); if (adjustNeeded) { // vertices flushed, safe now to replace matrix haveIdentityRealMatrix = checkIdt(virtualMatrix); if (!haveIdentityRealMatrix && virtualMatrix.det() == 0) throw new GdxRuntimeException("Transform matrix is singular, can't sync"); adjustNeeded = false; super.setTransformMatrix(virtualMatrix); } }
/** <p> * Flushes the batch and realigns the real matrix on the GPU. Subsequent draws won't need adjustment and will be slightly * faster as long as the transform matrix is not {@link #setTransformMatrix(Matrix4) changed}. * </p> * <p> * Note: The real transform matrix <em>must</em> be invertible. If a singular matrix is detected, GdxRuntimeException will be * thrown. * </p> * @see SpriteBatch#flush() */ public void flushAndSyncTransformMatrix () { flush(); if (adjustNeeded) { // vertices flushed, safe now to replace matrix haveIdentityRealMatrix = checkIdt(virtualMatrix); if (!haveIdentityRealMatrix && virtualMatrix.det() == 0) throw new GdxRuntimeException("Transform matrix is singular, can't sync"); adjustNeeded = false; super.setTransformMatrix(virtualMatrix); } }
/** 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); } } }
/** 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); } } }
/** 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); } } }
/** 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); } } }
/** <p> * Flushes the batch and realigns the real matrix on the GPU. Subsequent draws won't need adjustment and will be slightly * faster as long as the transform matrix is not {@link #setTransformMatrix(Matrix4) changed}. * </p> * <p> * Note: The real transform matrix <em>must</em> be invertible. If a singular matrix is detected, GdxRuntimeException will be * thrown. * </p> * @see SpriteBatch#flush() */ public void flushAndSyncTransformMatrix () { flush(); if (adjustNeeded) { // vertices flushed, safe now to replace matrix haveIdentityRealMatrix = checkIdt(virtualMatrix); if (!haveIdentityRealMatrix && virtualMatrix.det() == 0) throw new GdxRuntimeException("Transform matrix is singular, can't sync"); adjustNeeded = false; super.setTransformMatrix(virtualMatrix); } }
/** 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); } } }
/** 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); } } }