Skip to main content

Establishing the Transformation Library

· 2 min read

This weekend's development on the helios engine centered on finalizing transformation logic within helios.math.

The transformation functions translate, rotate, scale were implemented within helios.math.transform. A key decision was to standardize on post-multiplication (M' = M * T) for all transformations, to provide parity with glm: This convention ensures that new transformations are applied in the local space of a model matrix M.

Implementation Notes: constexpr and Performance

To maximize performance and enable compile-time computation, all transformation functions were designed as constexpr operations. The notable exception is rotate(), which depends on trigonometric functions (sin, cos) and vector normalization (sqrt), none of which are constexpr in the standard library. Future work may include implementing constexpr variants of these mathematical primitives, depending on how benchmarks fare in specific rendering scenarios.

The translate and scale functions were implemented as direct, element-wise modifications of the input matrix, avoiding the creation of temporary matrices. This optimized approach is mathematically equivalent to the full matrix multiplication but results in more efficient code.

On to the rendering pipeline!