Interface IViewportTransform

All Known Implementing Classes:
OBBViewportTransform

public interface IViewportTransform
This is the viewport transform used from drawing. Use yFlip if you are drawing from the top-left corner.
Author:
Daniel Murphy
  • Method Summary

    Modifier and Type
    Method
    Description
    center of the viewport.
    This is the half-width and half-height.
     
    void
    getScreenToWorld(Vec2 screen, Vec2 world)
    takes the screen coordinates (screen) and puts the corresponding world coordinates in world.
    void
    Transforms the given directional screen vector back to the world direction.
    void
    getWorldToScreen(Vec2 world, Vec2 screen)
    takes the world coordinate (world) puts the corresponding screen coordinate in screen.
    void
    Transforms the given directional vector by the viewport transform (not positional)
    boolean
     
    void
    mulByTransform(Mat22 transform)
    Multiplies the viewport transform by the given Mat22
    void
    setCamera(float x, float y, float scale)
    Sets the transform's center to the given x and y coordinates, and using the given scale.
    void
    setCenter(float x, float y)
    sets the center of the viewport.
    void
    sets the center of the viewport.
    void
    setExtents(float halfWidth, float halfHeight)
    This sets the half-width and half-height of the viewport.
    void
    setExtents(Vec2 extents)
    This sets the half-width and half-height.
    void
    setYFlip(boolean yFlip)
     
  • Method Details

    • isYFlip

      boolean isYFlip()
      Returns:
      If the transform flips the y-axis.
    • setYFlip

      void setYFlip(boolean yFlip)
      Parameters:
      yFlip - If we flip the y-axis when transforming.
    • getExtents

      Vec2 getExtents()
      This is the half-width and half-height. This should be the actual half-width and half-height, not anything transformed or scaled. Not a copy.
    • setExtents

      void setExtents(Vec2 extents)
      This sets the half-width and half-height. This should be the actual half-width and half-height, not anything transformed or scaled.
    • setExtents

      void setExtents(float halfWidth, float halfHeight)
      This sets the half-width and half-height of the viewport. This should be the actual half-width and half-height, not anything transformed or scaled.
    • getCenter

      Vec2 getCenter()
      center of the viewport. Not a copy.
    • setCenter

      void setCenter(Vec2 pos)
      sets the center of the viewport.
    • setCenter

      void setCenter(float x, float y)
      sets the center of the viewport.
    • setCamera

      void setCamera(float x, float y, float scale)
      Sets the transform's center to the given x and y coordinates, and using the given scale.
    • getWorldVectorToScreen

      void getWorldVectorToScreen(Vec2 world, Vec2 screen)
      Transforms the given directional vector by the viewport transform (not positional)
    • getScreenVectorToWorld

      void getScreenVectorToWorld(Vec2 screen, Vec2 world)
      Transforms the given directional screen vector back to the world direction.
    • getMat22Representation

      Mat22 getMat22Representation()
    • getWorldToScreen

      void getWorldToScreen(Vec2 world, Vec2 screen)
      takes the world coordinate (world) puts the corresponding screen coordinate in screen. It should be safe to give the same object as both parameters.
    • getScreenToWorld

      void getScreenToWorld(Vec2 screen, Vec2 world)
      takes the screen coordinates (screen) and puts the corresponding world coordinates in world. It should be safe to give the same object as both parameters.
    • mulByTransform

      void mulByTransform(Mat22 transform)
      Multiplies the viewport transform by the given Mat22