R2 Core Shaders

Data Structures | Functions
R2Viewport.h File Reference

Viewport types and functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | R2_viewport_t
| The type of viewports. More...

## Functions
vec2 | R2_viewportFragmentPositionToUV (const R2_viewport_t v, const vec2 f_pos)

## Detailed Description

Viewport types and functions.

Definition in file R2Viewport.h.

## Function Documentation

## § R2_viewportFragmentPositionToUV()

vec2 R2_viewportFragmentPositionToUV | ( | const R2_viewport_t | v,
|  | const vec2 | f_pos
| ) |  |

Transform the fragment coordinate f_pos to UV coordinates based on the given viewport v.

Parameters

  v | The viewport
  f_pos | The current fragment coordinate (in window coordinates)

Definition at line 24 of file R2Viewport.h.

27 {
28 return vec2 (
29 f_pos.x * v.inverse_width,
30 f_pos.y * v.inverse_height
31 );
32 }
R2_viewport_t::inverse_width
float inverse_width
1.0 / width of viewport
Definition: R2Viewport.h:11
R2_viewport_t::inverse_height
float inverse_height
1.0 / height of viewport
Definition: R2Viewport.h:13