VPP  0.7
A high-level modern C++ API for Vulkan
Public Member Functions | List of all members
vpp::Mat4 Class Reference

Shader (GPU-side) data type for 4x4 32-bit float matrices. More...

#include <vppLangMatrixTypes.hpp>

Public Member Functions

 Mat4 (const std::initializer_list< float > &init)
 Matrix initialization (by constants) with curly braces syntax.
 
 Mat4 (const std::initializer_list< Vec4 > &init)
 Matrix initialization (by vector expressions) with curly braces syntax.
 
 Mat4 (const std::initializer_list< Float > &init)
 Matrix initialization (by scalar expressions) with curly braces syntax.
 
Mat4 operator+ (const Mat4 &rhs) const
 Addition operation on matrix components.
 
Mat4 operator- (const Mat4 &rhs) const
 Subtraction operation on matrix components.
 
Mat2x4 operator* (const Mat2x4 &rhs) const
 Matrix multiplication by 2-column matrix.
 
Mat3x4 operator* (const Mat3x4 &rhs) const
 Matrix multiplication by 3-column matrix.
 
Mat4 operator* (const Mat4 &rhs) const
 Matrix multiplication by 4-column matrix.
 
Vec4 operator* (const Vec4 &rhs) const
 Matrix multiplication by vector.
 
Mat4 operator* (const Float &rhs) const
 Matrix multiplication by scalar.
 
Mat4 operator/ (const Mat4 &rhs) const
 Division operation on matrix components.
 
Mat4 operator% (const Mat4 &rhs) const
 Remainder operation on matrix components.
 
Mat4 operator- () const
 Negation operation on matrix components.
 
template<typename IndexT >
auto operator[] (IndexT index) const
 Retrieves a column vector from matrix variable.
 

Detailed Description

Shader (GPU-side) data type for 4x4 32-bit float matrices.

This is a r-value type. You must initialize it with value, either CPU-side one (an explicit constant array), or an expression computed on GPU side. The value can not be changed.

Constant initialization can be performed using initializer list syntax, i.e.:

float s = 1.0f;
Mat4 u = Mat4 {
s, 0.0f, 0.0f, 0.0f,
0.0f, s, 0.0f, 0.0f,
0.0f, 0.0f, s, 0.0f,
0.0f, 0.0f, 0.0f, s
};

Note that from the GPU point of view, CPU-side variables are constants and can be used in initializers.

For mutable variable type, see VMat4. Beware that mutable variables can degrade performance on GPU, therefore Mat4 is preferable, unless you really want a mutable variable.


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