Package com.badlogic.gdx.math

Examples of com.badlogic.gdx.math.Vector3


  };

  private final static Array<Matrix4> matrices4Array = new Array<Matrix4>();

  private Vector3 tmp (float x, float y, float z) {
    final Vector3 result = vectorPool.obtain().set(x, y, z);
    vectorArray.add(result);
    return result;
  }
View Full Code Here


        vertTmp3.set(corner100, null, null, null), vertTmp4.set(corner110, null, null, null),
        vertTmp5.set(corner001, null, null, null), vertTmp6.set(corner011, null, null, null),
        vertTmp7.set(corner101, null, null, null), vertTmp8.set(corner111, null, null, null));
    } else {
      ensureRectangles(6);
      Vector3 nor = tempV1.set(corner000).lerp(corner110, 0.5f).sub(tempV2.set(corner001).lerp(corner111, 0.5f)).nor();
      rect(corner000, corner010, corner110, corner100, nor);
      rect(corner011, corner001, corner101, corner111, nor.scl(-1));
      nor = tempV1.set(corner000).lerp(corner101, 0.5f).sub(tempV2.set(corner010).lerp(corner111, 0.5f)).nor();
      rect(corner001, corner000, corner100, corner101, nor);
      rect(corner010, corner011, corner111, corner110, nor.scl(-1));
      nor = tempV1.set(corner000).lerp(corner011, 0.5f).sub(tempV2.set(corner100).lerp(corner111, 0.5f)).nor();
      rect(corner001, corner011, corner010, corner000, nor);
      rect(corner100, corner110, corner111, corner101, nor.scl(-1));
    }
  }
View Full Code Here

      ensureRectangles((divisions + 1) * 2, divisions + 1);
    }

    final float ao = MathUtils.degreesToRadians * angleFrom;
    final float step = (MathUtils.degreesToRadians * (angleTo - angleFrom)) / divisions;
    final Vector3 sxEx = tempV1.set(tangentX, tangentY, tangentZ).scl(width * 0.5f);
    final Vector3 syEx = tempV2.set(binormalX, binormalY, binormalZ).scl(height * 0.5f);
    final Vector3 sxIn = tempV3.set(tangentX, tangentY, tangentZ).scl(innerWidth * 0.5f);
    final Vector3 syIn = tempV4.set(binormalX, binormalY, binormalZ).scl(innerHeight * 0.5f);
    VertexInfo currIn = vertTmp3.set(null, null, null, null);
    currIn.hasUV = currIn.hasPosition = currIn.hasNormal = true;
    currIn.uv.set(.5f, .5f);
    currIn.position.set(centerX, centerY, centerZ);
    currIn.normal.set(normalX, normalY, normalZ);
View Full Code Here

    sphere(matTmp1.setToTranslation(0, -.5f * (height - d), 0), d, d, d, divisions, divisions, 0, 360, 90, 180);
  }

  @Override
  public void arrow (float x1, float y1, float z1, float x2, float y2, float z2, float capLength, float stemThickness, int divisions) {
    Vector3 begin = tmp(x1, y1, z1), end = tmp(x2, y2, z2);
    float length = begin.dst(end);
    float coneHeight = length * capLength;
    float coneDiameter = 2 * (float)(coneHeight * Math.sqrt(1f / 3));
    float stemLength = length - coneHeight;
    float stemDiameter = coneDiameter * stemThickness;

    Vector3 up = tmp(end).sub(begin).nor();
    Vector3 forward = tmp(up).crs(Vector3.Z);
    if (forward.isZero()) forward.set(Vector3.X);
    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;
View Full Code Here

  /** Constructs a sphere with the given center and radius
   * @param center The center
   * @param radius The radius */
  public Sphere (Vector3 center, float radius) {
    this.center = new Vector3(center);
    this.radius = radius;
  }
View Full Code Here

   *             startpoint + distance * direction.
   * @param distance The distance from the end point to the start point.
   * @return The end point */
  @Deprecated
  public Vector3 getEndPoint (float distance) {
    return getEndPoint(new Vector3(), distance);
  }
View Full Code Here

    public void update () {
      for(int   i=0, accelOffset = 0, c = i +controller.particles.size *rotationChannel.strideSize;
        i < c;
        i +=rotationChannel.strideSize, accelOffset += accellerationChannel.strideSize){
       
        Vector3   axisZ = TMP_V1.setaccellerationChannel.data[accelOffset +ParticleChannels.XOffset],
                                        accellerationChannel.data[accelOffset +ParticleChannels.YOffset],
                                        accellerationChannel.data[accelOffset +ParticleChannels.ZOffset]).nor(),
          axisY = TMP_V2.set(TMP_V1).crs(Vector3.Y).nor().crs(TMP_V1).nor(),
          axisX = TMP_V3.set(axisY).crs(axisZ).nor();
        TMP_Q.setFromAxes(false,   axisX.x,  axisY.x, axisZ.x,
View Full Code Here

  /** Time step, DO NOT CHANGE MANUALLY */
  public float deltaTime, deltaTimeSqr;
 
  public ParticleController(){
    transform = new Matrix4();
    scale = new Vector3(1,1,1);
    influencers = new Array<Influencer>(true, 3, Influencer.class);
    setTimeStep(DEFAULT_TIME_STEP);
  }
View Full Code Here

        float g = colorChannel.data[colorOffset +ParticleChannels.GreenOffset];
        float b = colorChannel.data[colorOffset +ParticleChannels.BlueOffset];
        float a = colorChannel.data[colorOffset +ParticleChannels.AlphaOffset];
        float cosRotation = rotationChannel.data[rotationOffset +ParticleChannels.CosineOffset];
        float sinRotation = rotationChannel.data[rotationOffset +ParticleChannels.SineOffset];
        Vector3 look = TMP_V3.set(camera.position).sub(px, py, pz).nor(), //normal
                right = TMP_V1.set(camera.up).crs(look).nor(), //tangent
                up = TMP_V2.set(look).crs(right);
        right.scl(sx);
        up.scl(sy);
View Full Code Here

      }
    }
  }

  private void fillVerticesToScreenCPU (int[] particlesOffset) {
    Vector3 look = TMP_V3.set(camera.direction).scl(-1)//normal
      right = TMP_V4.set(camera.up).crs(look).nor(), //tangent
      up = camera.up;

    int tp=0;
    for(BillboardControllerRenderData data : renderData){
View Full Code Here

TOP

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

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.