Split engine to packages NazaraUtils and NZSL (#375)

* Move code to NazaraUtils and NZSL packages

* Reorder includes

* Tests: Remove glslang and spirv-tools deps

* Tests: Remove glslang init

* Remove NazaraUtils tests and fix Vector4Test

* Fix Linux compilation

* Update msys2-build.yml

* Fix assimp package

* Update xmake.lua

* Update xmake.lua

* Fix shader compilation on MinGW

* Final fixes

* The final fix 2: the fix strikes back!

* Disable cache on CI

* The return of the fix™️
This commit is contained in:
Jérôme Leclercq
2022-05-25 19:36:10 +02:00
committed by GitHub
parent 3f8f1c4653
commit 03e2801dbe
483 changed files with 1139 additions and 59112 deletions

View File

@@ -13,7 +13,7 @@ m_width(width)
m_values.resize(m_width * m_height); //< RGBA
}
void PreviewValues::Fill(const Nz::Vector4f& value)
void PreviewValues::Fill(const nzsl::Vector4f& value)
{
std::fill(m_values.begin(), m_values.end(), value);
}
@@ -24,7 +24,7 @@ QImage PreviewValues::GenerateImage() const
Nz::UInt8* ptr = preview.bits();
const Nz::Vector4f* src = m_values.data();
const nzsl::Vector4f* src = m_values.data();
for (std::size_t i = 0; i < m_values.size(); ++i)
{
for (std::size_t y = 0; y < 4; ++y)
@@ -52,7 +52,7 @@ PreviewValues PreviewValues::Resized(std::size_t newWidth, std::size_t newHeight
return resizedPreview;
}
Nz::Vector4f PreviewValues::Sample(float u, float v) const
nzsl::Vector4f PreviewValues::Sample(float u, float v) const
{
// Bilinear filtering
float x = std::clamp(u * m_width, 0.f, m_width - 1.f);
@@ -64,7 +64,7 @@ Nz::Vector4f PreviewValues::Sample(float u, float v) const
float dX = x - iX;
float dY = y - iY;
auto ColorAt = [&](std::size_t x, std::size_t y) -> Nz::Vector4f
auto ColorAt = [&](std::size_t x, std::size_t y) -> nzsl::Vector4f
{
x = std::min(x, m_width - 1);
y = std::min(y, m_height - 1);
@@ -72,22 +72,22 @@ Nz::Vector4f PreviewValues::Sample(float u, float v) const
return m_values[y * m_width + x];
};
Nz::Vector4f d00 = ColorAt(iX, iY);
Nz::Vector4f d10 = ColorAt(iX + 1, iY);
Nz::Vector4f d01 = ColorAt(iX, iY + 1);
Nz::Vector4f d11 = ColorAt(iX + 1, iY + 1);
nzsl::Vector4f d00 = ColorAt(iX, iY);
nzsl::Vector4f d10 = ColorAt(iX + 1, iY);
nzsl::Vector4f d01 = ColorAt(iX, iY + 1);
nzsl::Vector4f d11 = ColorAt(iX + 1, iY + 1);
return Nz::Lerp(Nz::Lerp(d00, d10, dX), Nz::Lerp(d01, d11, dX), dY);
}
Nz::Vector4f& PreviewValues::operator()(std::size_t x, std::size_t y)
nzsl::Vector4f& PreviewValues::operator()(std::size_t x, std::size_t y)
{
assert(x < m_width);
assert(y < m_height);
return m_values[y * m_width + x];
}
Nz::Vector4f PreviewValues::operator()(std::size_t x, std::size_t y) const
nzsl::Vector4f PreviewValues::operator()(std::size_t x, std::size_t y) const
{
assert(x < m_width);
assert(y < m_height);

View File

@@ -4,8 +4,8 @@
#define NAZARA_SHADERNODES_PREVIEWVALUES_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Math/Vector4.hpp>
#include <ShaderNode/Enums.hpp>
#include <NZSL/Vector.hpp>
#include <array>
#include <vector>
@@ -20,21 +20,21 @@ class PreviewValues
PreviewValues(PreviewValues&&) = default;
~PreviewValues() = default;
void Fill(const Nz::Vector4f& value);
void Fill(const nzsl::Vector4f& value);
QImage GenerateImage() const;
inline Nz::Vector4f* GetData();
inline const Nz::Vector4f* GetData() const;
inline nzsl::Vector4f* GetData();
inline const nzsl::Vector4f* GetData() const;
inline std::size_t GetHeight() const;
inline std::size_t GetWidth() const;
PreviewValues Resized(std::size_t newWidth, std::size_t newHeight) const;
Nz::Vector4f Sample(float u, float v) const;
nzsl::Vector4f Sample(float u, float v) const;
Nz::Vector4f& operator()(std::size_t x, std::size_t y);
Nz::Vector4f operator()(std::size_t x, std::size_t y) const;
nzsl::Vector4f& operator()(std::size_t x, std::size_t y);
nzsl::Vector4f operator()(std::size_t x, std::size_t y) const;
PreviewValues& operator=(const PreviewValues&) = default;
PreviewValues& operator=(PreviewValues&&) = default;
@@ -42,7 +42,7 @@ class PreviewValues
private:
std::size_t m_height;
std::size_t m_width;
std::vector<Nz::Vector4f> m_values;
std::vector<nzsl::Vector4f> m_values;
};
#include <ShaderNode/Previews/PreviewValues.inl>

View File

@@ -1,11 +1,11 @@
#include <ShaderNode/Previews/PreviewValues.hpp>
inline Nz::Vector4f* PreviewValues::GetData()
inline nzsl::Vector4f* PreviewValues::GetData()
{
return m_values.data();
}
inline const Nz::Vector4f* PreviewValues::GetData() const
inline const nzsl::Vector4f* PreviewValues::GetData() const
{
return m_values.data();
}

View File

@@ -6,7 +6,7 @@ PreviewValues QuadPreview::GetPreview(InputRole role, std::size_t roleIndex) con
if (role != InputRole::TexCoord)
{
PreviewValues dummy(1, 1);
dummy(0, 0) = Nz::Vector4f::Zero();
dummy(0, 0) = nzsl::Vector4f(0.f, 0.f, 0.f, 0.f);
return dummy;
}
@@ -19,7 +19,7 @@ PreviewValues QuadPreview::GetPreview(InputRole role, std::size_t roleIndex) con
for (std::size_t y = 0; y < uv.GetHeight(); ++y)
{
for (std::size_t x = 0; x < uv.GetWidth(); ++x)
uv(x, y) = Nz::Vector4f(x * invWidth, y * invHeight, 0.f, 1.f);
uv(x, y) = nzsl::Vector4f(x * invWidth, y * invHeight, 0.f, 1.f);
}
return uv;