Package com.badlogic.gdx.math

Examples of com.badlogic.gdx.math.Matrix4


    if (child.visible) child.draw(batch, parentAlpha * color.a);
    if (transform) batch.flush();
  }

  protected void applyTransform (SpriteBatch batch) {
    Matrix4 newBatchTransform = updateTransform();
    batch.end();
    oldBatchTransform.set(batch.getTransformMatrix());
    batch.setTransformMatrix(newBatchTransform);
    batch.begin();
  }
View Full Code Here


    Vector2 d = new Vector2(vec.x - orig.x, -(vec.y - orig.y));
    return d.angle();
  }

  private Vector3 calculateDirection (float angle) {
    Matrix4 transform = new Matrix4();
    Vector3 dir = new Vector3(-1, 0, 1).nor();
    float rotAngle = (float)Math.toDegrees(Math.asin(Math.tan(Math.toRadians(angle))));
    transform.setToRotation(new Vector3(1, 0, 1).nor(), angle);
    dir.mul(transform).nor();
    return dir;
  }
View Full Code Here

  /** Calculates window scissor coordinates from local coordinates using the batch's current transformation matrix.
   * @see ScissorStack#calculateScissors(Camera, float, float, float, float, Matrix4, Rectangle, Rectangle) */
  public void calculateScissors (Rectangle localRect, Rectangle scissorRect) {
    viewport.calculateScissors(batch.getTransformMatrix(), localRect, scissorRect);
    Matrix4 transformMatrix;
    if (debugShapes != null && debugShapes.isDrawing())
      transformMatrix = debugShapes.getTransformMatrix();
    else
      transformMatrix = batch.getTransformMatrix();
    viewport.calculateScissors(transformMatrix, localRect, scissorRect);
View Full Code Here

    Color color = getColor();

    Drawable handle = style.handle;
    applyTransform(batch, computeTransform());
    Matrix4 transform = batch.getTransformMatrix();
    if (firstWidget != null) {
      getStage().calculateScissors(firstWidgetBounds, firstScissors);
      if (ScissorStack.pushScissors(firstScissors)) {
        if (firstWidget.isVisible()) firstWidget.draw(batch, parentAlpha * color.a);
        batch.flush();
 
View Full Code Here

  private Vector3 tmp (Vector3 copyFrom) {
    return tmp(copyFrom.x, copyFrom.y, copyFrom.z);
  }

  private Matrix4 tmp () {
    final Matrix4 result = matrices4Pool.obtain().idt();
    matrices4Array.add(result);
    return result;
  }
View Full Code Here

    forward.crs(up).nor();
    Vector3 left = tmp(up).crs(forward).nor();
    Vector3 direction = tmp(end).sub(begin).nor();

    // Matrices
    Matrix4 userTransform = getVertexTransform(tmp());
    Matrix4 transform = tmp();
    float[]val = transform.val;
    val[Matrix4.M00] = left.x; val[Matrix4.M01] = up.x; val[Matrix4.M02] = forward.x;
    val[Matrix4.M10] = left.y; val[Matrix4.M11] = up.y; val[Matrix4.M12] = forward.y;
    val[Matrix4.M20] = left.z; val[Matrix4.M21] = up.z; val[Matrix4.M22] = forward.z;
    Matrix4 temp = tmp();

    // Stem
    transform.setTranslation(tmp(direction).scl(stemLength / 2).add(x1, y1, z1));
    setVertexTransform(temp.set(transform).mul(userTransform));
    cylinder(stemDiameter, stemLength, stemDiameter, divisions);

    // Cap
    transform.setTranslation(tmp(direction).scl(stemLength).add(x1, y1, z1));
    setVertexTransform(temp.set(transform).mul(userTransform));
    cone(coneDiameter, coneHeight, coneDiameter, divisions);

    setVertexTransform(userTransform);
    cleanup();
  }
View Full Code Here

      x += page.width + 20;
    }
  }

  public void resize (int width, int height) {
    renderer.setProjectionMatrix(new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
  }
View Full Code Here

      x += page.width + 20;
    }
  }

  public void resize (int width, int height) {
    renderer.setProjectionMatrix(new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
  }
View Full Code Here

  private Vector3 tmp (Vector3 copyFrom) {
    return tmp(copyFrom.x, copyFrom.y, copyFrom.z);
  }

  private Matrix4 tmp () {
    final Matrix4 result = matrices4Pool.obtain().idt();
    matrices4Array.add(result);
    return result;
  }
View Full Code Here

    forward.crs(up).nor();
    Vector3 left = tmp(up).crs(forward).nor();
    Vector3 direction = tmp(end).sub(begin).nor();

    // Matrices
    Matrix4 userTransform = getVertexTransform(tmp());
    Matrix4 transform = tmp();
    float[]val = transform.val;
    val[Matrix4.M00] = left.x; val[Matrix4.M01] = up.x; val[Matrix4.M02] = forward.x;
    val[Matrix4.M10] = left.y; val[Matrix4.M11] = up.y; val[Matrix4.M12] = forward.y;
    val[Matrix4.M20] = left.z; val[Matrix4.M21] = up.z; val[Matrix4.M22] = forward.z;
    Matrix4 temp = tmp();

    // Stem
    transform.setTranslation(tmp(direction).scl(stemLength / 2).add(x1, y1, z1));
    setVertexTransform(temp.set(transform).mul(userTransform));
    cylinder(stemDiameter, stemLength, stemDiameter, divisions);

    // Cap
    transform.setTranslation(tmp(direction).scl(stemLength).add(x1, y1, z1));
    setVertexTransform(temp.set(transform).mul(userTransform));
    cone(coneDiameter, coneHeight, coneDiameter, divisions);

    setVertexTransform(userTransform);
    cleanup();
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.math.Matrix4

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.