Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::billboard Namespace Reference

Classes

struct  ViewAxes
 The view's right, up and toward-the-viewer axes in the world, read off its view-projection. More...

Functions

ViewAxes viewAxes (const glm::mat4 &viewProjection)
 The axes a view looks along.
glm::quat facing (i32 mode, const glm::mat4 &viewProjection, const glm::vec4 &eye, const glm::vec3 &position)
 The rotation a card standing at position is drawn with in this view.

Function Documentation

◆ facing()

glm::quat esengine::billboard::facing ( i32 mode,
const glm::mat4 & viewProjection,
const glm::vec4 & eye,
const glm::vec3 & position )
inline

The rotation a card standing at position is drawn with in this view.

Parameters
mode0 lies flat in the view plane; 1 turns about world up only.
viewProjectionThe view's, which is where the view plane comes from.
eyeThe view's eye in FrameConstants::camera's convention: a position when w = 1, the direction toward the viewer when w = 0 (an orthographic view, which has no position).

Definition at line 57 of file BillboardFacing.hpp.

References esengine::billboard::ViewAxes::back, esengine::billboard::ViewAxes::right, esengine::billboard::ViewAxes::up, and viewAxes().

Referenced by esengine::MeshPlugin::collect().

◆ viewAxes()

ViewAxes esengine::billboard::viewAxes ( const glm::mat4 & viewProjection)
inline

The axes a view looks along.

NDC x and y are the view's right and up scaled by the projection, so the first two rows of the view-projection point along them under both projections (a jittered or off-centre frustum leans them by its tiny skew, and the cross products below take that out). Toward the viewer is their cross product: the camera looks down its own -Z.

Definition at line 35 of file BillboardFacing.hpp.

References esengine::billboard::ViewAxes::back, esengine::billboard::ViewAxes::right, and esengine::billboard::ViewAxes::up.

Referenced by facing().