Add worldToDisplayCoordinates method

This commit is contained in:
schmelczerandras 2020-10-18 15:42:38 +02:00
parent da2ae108df
commit 184d1a1e39
4 changed files with 37 additions and 7 deletions

View file

@ -30,7 +30,8 @@ export interface Renderer {
setViewArea(topLeft: vec2, size: vec2): void;
/**
* Return the world coordinates from a pixel's position.
* The inverse of `worldToDisplayCoordinates`, returns the world coordinates
* from a pixel's position.
*
* The view area coordinates are also given in world coordinates.
*
@ -41,6 +42,17 @@ export interface Renderer {
*/
displayToWorldCoordinates(displayCoordinates: vec2): vec2;
/**
* The inverse of `displayToWorldCoordinates`, returns the screen space position
* of a point given in world space cooridnates.
*
* While the origin for worldCoordinates resides in the bottom-left corner,
* the origin of the returned display coordinates is placed in the top left.
*
* @param worldCoordinates Coordinates used when drawing objects.
*/
worldToDisplayCoordinates(worldCoordinates: vec2): vec2;
/**
* Patch the current runtime settings with new values.
* @param overrides