Example usage for com.badlogic.gdx.math Matrix4 Matrix4

List of usage examples for com.badlogic.gdx.math Matrix4 Matrix4

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Matrix4 Matrix4.

Prototype

public Matrix4() 

Source Link

Document

Constructs an identity matrix

Usage

From source file:CB_Locator.Map.MapViewBase.java

License:Open Source License

protected void renderDebugInfo(Batch batch) {

    CB_RectF r = this.thisWorldRec;

    Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST);

    BitmapFont font = Fonts.getNormal();

    font.setColor(Color.BLACK);/*w  w  w  .  ja  v a 2s.  c  o  m*/

    Matrix4 def = new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    def.translate(r.getX(), r.getY(), 1);
    batch.setProjectionMatrix(def);

    // str = debugString;
    font.draw(batch, str, 20, 120);

    str = "fps: " + Gdx.graphics.getFramesPerSecond();
    font.draw(batch, str, 20, 100);

    str = String.valueOf(aktZoom) + " - camzoom: " + Math.round(camera.zoom * 100) / 100;
    font.draw(batch, str, 20, 80);

    str = "lTiles: " + mapTileLoader.LoadedTilesSize() + " - qTiles: " + mapTileLoader.QueuedTilesSize();
    font.draw(batch, str, 20, 60);

    str = "lastMove: " + lastMovement.x + " - " + lastMovement.y;
    font.draw(batch, str, 20, 20);
    Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST);
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

public GL_Matrix() {
    matrix4 = new Matrix4();
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

/**
 * Preconcats the matrix with the specified translation. M' = M * T(x, y)
 *///from  ww w .j a  v  a  2  s  .c  om
@Override
public void preTranslate(float x, float y) {
    Matrix4 m = new Matrix4();
    m.translate(x, y, 0);
    m.mul(this.matrix4);
    set(m);
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

/**
 * Preconcats the matrix with the specified scale. M' = M * S(x, y)
 *//*from  w  w w.  jav  a 2s  . c  o  m*/
@Override
public void preScale(float x, float y) {
    Matrix4 m = new Matrix4();
    m.scale(x, y, 1);
    m.mul(this.matrix4);
    set(m);
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

/**
 * Preconcats the matrix with the specified scale. M' = M * S(sx, sy, px, py)
 *//*  w ww  . j  a v  a  2  s .  c o m*/
@Override
public void preScale(float sx, float sy, float px, float py) {
    Matrix4 m = new Matrix4();
    // set Scale sx,sy,px,py
    {

        m.val[Matrix4.M00] = sx;
        m.val[Matrix4.M11] = sy;
        m.val[Matrix4.M03] = px - sx * px;
        m.val[Matrix4.M13] = py - sy * py;

    }

    this.matrix4.mul(m);
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

/**
 * Postconcats the matrix with the specified rotation. M' = R(degrees) * M
 *//*from w  w  w  .j  av  a  2  s.  com*/
@Override
public void postRotate(float angle) {
    Matrix4 m = new Matrix4();
    m.rotate(0, 0, 1, angle);
    m.mul(this.matrix4);
    set(m);
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

@Override
public void postScale(float rx, float ry) {
    Matrix4 m = new Matrix4();
    m.scale(rx, ry, 1);//  w w  w  . ja  v a2  s .  co  m
    m.mul(this.matrix4);
    set(m);
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

@Override
public void postTranslate(float cx, float cy) {
    Matrix4 m = new Matrix4();
    m.translate(cx, cy, 0);/*from   www .  j ava  2  s .co  m*/
    m.mul(this.matrix4);
    set(m);
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

@Override
public void preRotate(float angle) {
    Matrix4 m = new Matrix4();
    m.rotate(0, 0, 1, angle);/*from  w  w w  . j av  a2s  .c  o  m*/
    m.mul(this.matrix4);
    set(m);
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

@Override
public void preRotate(Float angle, Float px, Float py) {

    // ## native android ##
    // const SkScalar oneMinusCosV = 1 - cosV;
    ///* ww  w. ja  v a 2  s. c  om*/
    // fMat[kMScaleX] = cosV;
    // fMat[kMSkewX] = -sinV;
    // fMat[kMTransX] = sdot(sinV, py, oneMinusCosV, px);
    //
    // fMat[kMSkewY] = sinV;
    // fMat[kMScaleY] = cosV;
    // fMat[kMTransY] = sdot(-sinV, px, oneMinusCosV, py);
    //
    // fMat[kMPersp0] = fMat[kMPersp1] = 0;
    // fMat[kMPersp2] = 1;

    Matrix4 m = new Matrix4();
    m.rotate(0, 0, 1, angle);
    float oneMinusCosV = 1 - m.val[Matrix4.M00];
    float sinV = m.val[Matrix4.M10];
    m.val[Matrix4.M03] = sdot(sinV, py, oneMinusCosV, px);
    m.val[Matrix4.M13] = sdot(-sinV, px, oneMinusCosV, py);

    this.matrix4.mul(m);
}