mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 17:27:46 +00:00
LibGL: Implement glLightModel
integer normalization
For the ambient light model, integers need to be remapped to a range of `-1.` through `1.`. Add the `+` and `-` operators to `VectorN` to make it a bit easier to normalize 4 values at once.
This commit is contained in:
parent
a074b7e871
commit
8c094699db
2 changed files with 36 additions and 19 deletions
|
@ -158,6 +158,26 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
[[nodiscard]] constexpr VectorN operator+(U f) const
|
||||
{
|
||||
VectorN result;
|
||||
UNROLL_LOOP
|
||||
for (auto i = 0u; i < N; ++i)
|
||||
result.m_data[i] = m_data[i] + f;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
[[nodiscard]] constexpr VectorN operator-(U f) const
|
||||
{
|
||||
VectorN result;
|
||||
UNROLL_LOOP
|
||||
for (auto i = 0u; i < N; ++i)
|
||||
result.m_data[i] = m_data[i] - f;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
[[nodiscard]] constexpr VectorN operator*(U f) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue