/
redgpu
/
r500
Обзор
Документация
Войти
/
redgpu
/
r500
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
drm/math/vec.hpp
29 строк
570 B
Zack Buhman
drm: add matrix
30 окт 2025, 07:18
30 окт 2025, 07:18
5716b2b
Код
Авторство
О чём код?
#pragma once template <int L, typename T> struct vec; template <int L, typename T> inline constexpr T magnitude(vec<L, T> const& v) { return sqrt(dot(v, v)); } template <int L, typename T> inline constexpr T magnitude_squared(vec<L, T> const& v) { return dot(v, v); } template <int L, typename T> inline constexpr vec<L, T> normalize(vec<L, T> const& v) { T d = 1.0f / magnitude(v); return v * d; } template <int L, typename T> inline constexpr vec<3, T> reflect(vec<L, T> const& i, vec<L, T> const& n) { return i - dot(n, i) * n * static_cast<T>(2.0); }