Interface Screen
public interface Screen
The plane a
DocumentView
exists on.
Screen coordinates exist in one of 3 spaces
- World space coordinates
- They denote the actual size and dimensions of a screen in a minecraft world.
- Intermediate coordinates
-
Set with the
screen-width
andscreen-height
document options. They may not always be actual sizes of the screen. - Screen coordinates
0
to1
coordinates relative to the width and height of the screen.
Transformation
that is applied to the screen.
This may mean that (if scaling is involved) world and intermediate coordinates may differ in
sizes.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
Default height of the screen:2
static final float
Default width of the screen:3
static final float
Maximum screen size:10
static final float
Minimum screen size:1
-
Method Summary
Modifier and TypeMethodDescriptionorg.joml.Vector3f
center()
Gets the center point of the screenorg.joml.Vector2f
Gets the width and height of the screenfloat
Gets the height of the screenorg.joml.Vector3f
Gets the lower left corner of the screen from the viewer's perspectiveorg.joml.Vector3f
Gets the lower right corner of the screen from the viewer's perspectiveorg.joml.Vector3f
Gets the upper left corner of the screen from the viewer's perspectiveorg.joml.Vector3f
Gets the upper right corner of the screen from the viewer's perspectivefloat
getWidth()
Gets the width of the screenfloat
Get the actual height of the screen in the world space sizefloat
Get the actual width of the screen in world space sizeorg.joml.Vector3f
normal()
Gets the normal (direction) of the screen's planevoid
project
(org.bukkit.util.Transformation transformation) Transform the specifiedtransformation
so that it is aligned, rotated and scaled to match the screen.void
screenspaceToScreen
(org.joml.Vector2f in, org.joml.Vector2f out) Maps screen coordinates in range [0..1] to [0..getDimensions()
] space and stores the result in theout
argument.void
screenspaceToWorld
(org.joml.Vector2f screenPoint, org.joml.Vector3f out) Maps screen coordinates in range [0..1] to world coordinates and stores the result in theout
argument.void
screenToScreenspace
(org.joml.Vector2f in, org.joml.Vector2f out) Maps screen coordinates in range [0..getDimensions()
] to [0..1] space and stores the result in theout
argument.void
screenToWorld
(org.joml.Vector2f screenPoint, org.joml.Vector3f out) Maps screen coordinates in range [0..getDimensions()
] to world coordinates and stores the result in theout
argument.
-
Field Details
-
DEFAULT_WIDTH
static final float DEFAULT_WIDTHDefault width of the screen:3
- See Also:
-
DEFAULT_HEIGHT
static final float DEFAULT_HEIGHTDefault height of the screen:2
- See Also:
-
MIN_SCREEN_SIZE
static final float MIN_SCREEN_SIZEMinimum screen size:1
- See Also:
-
MAX_SCREEN_SIZE
static final float MAX_SCREEN_SIZEMaximum screen size:10
- See Also:
-
-
Method Details
-
getWidth
float getWidth()Gets the width of the screen- Returns:
- Screen width
-
getWorldWidth
float getWorldWidth()Get the actual width of the screen in world space size- Returns:
- Actual screen width
-
getHeight
float getHeight()Gets the height of the screen- Returns:
- Screen height
-
getWorldHeight
float getWorldHeight()Get the actual height of the screen in the world space size- Returns:
- Actual screen height
-
normal
org.joml.Vector3f normal()Gets the normal (direction) of the screen's plane- Returns:
- Screen normal
-
center
org.joml.Vector3f center()Gets the center point of the screen- Returns:
- Screen center
-
getDimensions
org.joml.Vector2f getDimensions()Gets the width and height of the screen- Returns:
- Screen dimensions, (width, height)
-
getLowerLeft
org.joml.Vector3f getLowerLeft()Gets the lower left corner of the screen from the viewer's perspective- Returns:
- Lower left corner
-
getLowerRight
org.joml.Vector3f getLowerRight()Gets the lower right corner of the screen from the viewer's perspective- Returns:
- Lower right corner
-
getUpperLeft
org.joml.Vector3f getUpperLeft()Gets the upper left corner of the screen from the viewer's perspective- Returns:
- Upper left corner
-
getUpperRight
org.joml.Vector3f getUpperRight()Gets the upper right corner of the screen from the viewer's perspective- Returns:
- Upper right corner
-
screenToWorld
void screenToWorld(org.joml.Vector2f screenPoint, org.joml.Vector3f out) Maps screen coordinates in range [0..getDimensions()
] to world coordinates and stores the result in theout
argument.- Parameters:
screenPoint
- Screen point, in space [0..getDimensions()
]out
- Result destination
-
screenToScreenspace
void screenToScreenspace(org.joml.Vector2f in, org.joml.Vector2f out) Maps screen coordinates in range [0..getDimensions()
] to [0..1] space and stores the result in theout
argument.- Parameters:
in
- Input in range [0..getDimensions()
]out
- Result output, in range [0..1]
-
screenspaceToScreen
void screenspaceToScreen(org.joml.Vector2f in, org.joml.Vector2f out) Maps screen coordinates in range [0..1] to [0..getDimensions()
] space and stores the result in theout
argument.- Parameters:
in
- Input in range [0..1]out
- Result output, in range [0..getDimensions()
]
-
screenspaceToWorld
void screenspaceToWorld(org.joml.Vector2f screenPoint, org.joml.Vector3f out) Maps screen coordinates in range [0..1] to world coordinates and stores the result in theout
argument.- Parameters:
screenPoint
- Screen point, in space [0..1]out
- Result destination
-
project
void project(org.bukkit.util.Transformation transformation) Transform the specifiedtransformation
so that it is aligned, rotated and scaled to match the screen.- Parameters:
transformation
- Input transformation
-