cangine
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | List of all members
cangine::Position Class Reference

Helper for converting screen-space positions into normalized device coordinates. More...

#include <position.hpp>

Collaboration diagram for cangine::Position:
Collaboration graph
[legend]

Static Public Member Functions

static Vector3 normalize (const Vector3 &v)
 Normalizes a 3D position into clip space.
 
static Vector2 normalize (const Vector2 &v)
 Normalizes a 2D position into clip space.
 
static Vertex normalize (const Vertex &v)
 Normalizes a vertex's position into clip space.
 

Static Public Attributes

static Window * window_instance = nullptr
 Window used as the reference frame for normalization.
 

Detailed Description

Helper for converting screen-space positions into normalized device coordinates.

Normalization maps pixel coordinates (relative to the active window) into the [-1, 1] clip-space range expected by the renderer.

Member Function Documentation

◆ normalize() [1/3]

Vector2 cangine::Position::normalize ( const Vector2 &  v)
static

Normalizes a 2D position into clip space.

Parameters
vPosition in screen/pixel space.
Returns
The position in normalized device coordinates.

◆ normalize() [2/3]

Vector3 cangine::Position::normalize ( const Vector3 &  v)
static

Normalizes a 3D position into clip space.

Parameters
vPosition in screen/pixel space (z is the layer).
Returns
The position in normalized device coordinates.

◆ normalize() [3/3]

Vertex cangine::Position::normalize ( const Vertex &  v)
static

Normalizes a vertex's position into clip space.

Parameters
vVertex whose position is in screen/pixel space.
Returns
A copy of the vertex with its position normalized.

Member Data Documentation

◆ window_instance

Window * cangine::Position::window_instance = nullptr
static

Window used as the reference frame for normalization.


The documentation for this class was generated from the following files: