Package k8.wt

Source Code of k8.wt.Layer

package k8.wt;

import k8.SceneNode;
import k8.util.Camera;

/**
* A Layer is an object used to get the available width and height at a defined
* depth.
*/

public final class Layer extends SceneNode
{

  private float depth;
  private float width;
  private float height;

  private static float RadDeg = 57.2957795f;

  /** Creates a new instance of Layer */
  public Layer(float depth)
  {
    setDepth(depth);
  }

  /** Sets the depth */
  public void setDepth(float depth)
  {
    Camera camera = Camera.getInstance();
    float aspect = camera.getAspectRatio();
    int fov = camera.getFOV();
   
    this.depth = depth;
    this.width = (float) (depth * (fov / RadDeg));
    this.height = width / aspect;

    this.moveRight(-this.width / 2);
    this.moveUp(-this.height / 2);
    this.moveForward(depth);
  }

  /** Gets the depth */
  public float getDepth()
  {
    return depth;
  }

  /** Gets the width */
  public float getWidth()
  {
    return width;
  }

  /** Gets the height */
  public float getHeight()
  {
    return height;
  }

  @Override
  protected void transform()
  {
    // TODO Auto-generated method stub
  }

}
TOP

Related Classes of k8.wt.Layer

TOP
Copyright © 2018 www.massapi.com. 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.