SaturnRingLibrary 0.9.1
SGL wrapper
 
Loading...
Searching...
No Matches

◆ CreateBillboard()

template<Precision P = Precision::Default>
static constexpr Matrix43 SRL::Math::Types::Matrix43::CreateBillboard ( const Vector3D & position,
const Vector3D & cameraPosition,
const Vector3D & up = Vector3D::UnitY() )
inlinestaticconstexpr

Create a billboard matrix that always faces the camera.

This static method generates a billboard matrix that ensures an object always faces the camera. The resulting matrix can be used for rendering objects like sprites that should always face the camera.

Template Parameters
PPrecision level for calculation, allowing users to choose the desired precision for the calculations.
Parameters
positionThe position of the billboard in world coordinates.
cameraPositionThe position of the camera in world coordinates.
upThe up vector (usually Vector3D::UnitY()), defining the vertical orientation of the billboard.
Returns
The billboard matrix that transforms points from world space to the billboard's local space.
Vector3D(0, 0, 0), // Billboard position
Vector3D(0, 0, 5), // Camera position
Vector3D(0, 1, 0) // Up vector
);
constexpr Matrix43()
Default constructor initializing to a zero matrix.
Definition mat43.hpp:85
static constexpr Matrix43 CreateBillboard(const Vector3D &position, const Vector3D &cameraPosition, const Vector3D &up=Vector3D::UnitY())
Create a billboard matrix that always faces the camera.
Definition mat43.hpp:381
A high-performance three-dimensional vector implementation optimized for Saturn hardware.
Definition vector3d.hpp:51
Note
Ensure that the up vector is not collinear with the look vector to avoid undefined behavior.