public class OBBViewportTransform

  1. Object
  2. OBBViewportTransform

ImplementsIViewportTransform

Orientated bounding box viewport transform

Nested types

class OBBViewportTransform.OBB

Fields

protected final OBBViewportTransform.OBB box

Constructors

public OBBViewportTransform()

Methods

public void set(OBBViewportTransform vpt)
public 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.
public Vec2 getExtents()This is the half-width and half-height.
public void setExtents(Vec2 argExtents)This sets the half-width and half-height.
public void setExtents(float argHalfWidth, float argHalfHeight)This sets the half-width and half-height of the viewport.
public Vec2 getCenter()center of the viewport.
public void setCenter(Vec2 argPos)sets the center of the viewport.
public void setCenter(float x, float y)sets the center of the viewport.
public Mat22 getTransform()gets the transform of the viewport, transforms around the center.
public void setTransform(Mat22 transform)Sets the transform of the viewport.
public void mulByTransform(Mat22 argTransform)Multiplies the obb transform by the given transform
public boolean isYFlip()
public void setYFlip(boolean yFlip)
public void getScreenVectorToWorld(Vec2 argScreen, Vec2 argWorld)Transforms the given directional screen vector back to the world direction.
public void getWorldVectorToScreen(Vec2 argWorld, Vec2 argScreen)Transforms the given directional vector by the viewport transform (not positional)
public void getWorldToScreen(Vec2 argWorld, Vec2 argScreen)takes the world coordinate (argWorld) puts the corresponding screen coordinate in argScreen.
public void getScreenToWorld(Vec2 argScreen, Vec2 argWorld)takes the screen coordinates (argScreen) and puts the corresponding world coordinates in argWorld.

Inherited methods

Field details

box

protected final OBBViewportTransform.OBB box

Constructor details

OBBViewportTransform

public OBBViewportTransform()

Method details

set

public void set(OBBViewportTransform vpt)

setCamera

public 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.

getExtents

public 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

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

setExtents

public void setExtents(float argHalfWidth, float argHalfHeight)
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

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

setCenter

public void setCenter(Vec2 argPos)
sets the center of the viewport.

setCenter

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

getTransform

public Mat22 getTransform()
gets the transform of the viewport, transforms around the center. Not a copy.

setTransform

public void setTransform(Mat22 transform)
Sets the transform of the viewport. Transforms about the center.

mulByTransform

public void mulByTransform(Mat22 argTransform)
Multiplies the obb transform by the given transform

isYFlip

public boolean isYFlip()

Returns

if the transform flips the y axis

setYFlip

public void setYFlip(boolean yFlip)

Parameters

yFlip boolean
if we flip the y axis when transforming

getScreenVectorToWorld

public void getScreenVectorToWorld(Vec2 argScreen, Vec2 argWorld)
Transforms the given directional screen vector back to the world direction.

getWorldVectorToScreen

public void getWorldVectorToScreen(Vec2 argWorld, Vec2 argScreen)
Transforms the given directional vector by the viewport transform (not positional)

getWorldToScreen

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

getScreenToWorld

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