Player12
An open source football management simulator
Loading...
Searching...
No Matches
RenderMath::Projection Struct Reference

#include <match_render_math.h>

Public Member Functions

Vec4 toClip (Vec3 point) const
 
ScreenPoint clipToScreen (Vec4 clip) const
 
bool project (Vec3 point, ScreenPoint &out) const
 
float depth (Vec3 point) const
 
Vec3 rayThrough (float pixelX, float pixelY) const
 
bool groundPointAt (float pixelX, float pixelY, Vec3 &out, float planeHeight=0.0f) const
 

Static Public Member Functions

static Projection make (Vec3 eye, Vec3 target, float verticalFovRadians, float nearPlane, float farPlane, ScreenRect rect)
 

Public Attributes

Mat4 viewProjection = Mat4::identity()
 
Vec3 eye
 
Vec3 forward {0.0f, 1.0f, 0.0f}
 
Vec3 side {1.0f, 0.0f, 0.0f}
 
Vec3 up {0.0f, 0.0f, 1.0f}
 
ScreenRect rect
 
float nearPlane = 0.5f
 
float focalPixels = 1.0f
 

Detailed Description

Everything needed to project world points for one frame.

Member Function Documentation

◆ clipToScreen()

ScreenPoint RenderMath::Projection::clipToScreen ( Vec4  clip) const
inline

Converts a clip-space point with w >= nearPlane to pixels.

◆ depth()

float RenderMath::Projection::depth ( Vec3  point) const
inline

◆ groundPointAt()

bool RenderMath::Projection::groundPointAt ( float  pixelX,
float  pixelY,
Vec3 &  out,
float  planeHeight = 0.0f 
) const
inline

Intersects the ray through a pixel with the horizontal plane at planeHeight; false when the ray points away from it (sky pixels).

◆ make()

static Projection RenderMath::Projection::make ( Vec3  eye,
Vec3  target,
float  verticalFovRadians,
float  nearPlane,
float  farPlane,
ScreenRect  rect 
)
inlinestatic

◆ project()

bool RenderMath::Projection::project ( Vec3  point,
ScreenPoint &  out 
) const
inline

Projects a point; returns false when it lies behind the near plane.

◆ rayThrough()

Vec3 RenderMath::Projection::rayThrough ( float  pixelX,
float  pixelY 
) const
inline

World-space direction (not normalised) of the ray through a pixel.

◆ toClip()

Vec4 RenderMath::Projection::toClip ( Vec3  point) const
inline

Member Data Documentation

◆ eye

Vec3 RenderMath::Projection::eye

◆ focalPixels

float RenderMath::Projection::focalPixels = 1.0f

Pixels per metre at one metre depth (for sizing billboards).

◆ forward

Vec3 RenderMath::Projection::forward {0.0f, 1.0f, 0.0f}

◆ nearPlane

float RenderMath::Projection::nearPlane = 0.5f

◆ rect

ScreenRect RenderMath::Projection::rect

◆ side

Vec3 RenderMath::Projection::side {1.0f, 0.0f, 0.0f}

Camera right and up axes in world space (for un-projecting).

◆ up

Vec3 RenderMath::Projection::up {0.0f, 0.0f, 1.0f}

◆ viewProjection

Mat4 RenderMath::Projection::viewProjection = Mat4::identity()

The documentation for this struct was generated from the following file: