Minor fixes

This commit is contained in:
SirLynix 2023-08-31 18:01:59 +02:00
parent b1487a04fd
commit 1b9c19fd78
5 changed files with 35 additions and 24 deletions

View File

@ -363,7 +363,7 @@ namespace Nz
}
// If we arrive here, the extent is invalid
NazaraError("Invalid extent type (From) ({0:#x})", UnderlyingCast(from.extent));
NazaraError("invalid extent type (From) ({0:#x})", UnderlyingCast(from.extent));
return Null();
}
@ -390,7 +390,7 @@ namespace Nz
}
// If we arrive here, the extent is invalid
NazaraError("Invalid extent type (From) ({0:#x})", UnderlyingCast(from.extent));
NazaraError("invalid extent type (From) ({0:#x})", UnderlyingCast(from.extent));
return Null();
}
}

View File

@ -1226,10 +1226,10 @@ namespace Nz
{
// http://msdn.microsoft.com/en-us/library/windows/desktop/bb204942(v=vs.85).aspx
return Matrix4(
T(2.0) / (right - left), T(0.0), T(0.0), T(0.0),
T(0.0), T(2.0) / (top - bottom), T(0.0), T(0.0),
T(0.0), T(0.0), T(1.0) / (zNear - zFar), T(0.0),
(left + right) / (left - right), (top + bottom) / (bottom - top), zNear / (zNear - zFar), T(1.0)
T(2.0) / (right - left), T(0.0), T(0.0), T(0.0),
T(0.0), T(2.0) / (top - bottom), T(0.0), T(0.0),
T(0.0), T(0.0), T(1.0) / (zNear - zFar), T(0.0),
(left + right) / (left - right), (top + bottom) / (bottom - top), zNear / (zNear - zFar), T(1.0)
);
}

View File

@ -44,7 +44,7 @@ namespace Nz
inline void DrawFrustum(const Frustumf& frustum, const Color& color);
inline void DrawLine(const Vector3f& start, const Vector3f& end, const Color& color);
inline void DrawLine(const Vector3f& start, const Vector3f& end, const Color& startColor, const Color& endColor);
inline void DrawPoint(const Vector3f& point, const Color& color, float boxSize = 0.1f);
inline void DrawPoint(const Vector3f& point, const Color& color, float boxSize = 0.01f);
void DrawSkeleton(const Skeleton& skeleton, const Color& color);
void Prepare(RenderFrame& renderFrame);

View File

@ -21,8 +21,8 @@ namespace Nz
Quaternionf::RotationBetween(Vector3f::Forward(), -Vector3f::UnitX()),
Quaternionf::RotationBetween(Vector3f::Forward(), Vector3f::UnitY()),
Quaternionf::RotationBetween(Vector3f::Forward(), -Vector3f::UnitY()),
Quaternionf::Identity(),
Quaternionf(0.f, 0.f, 1.f, 0.f)
Quaternionf::RotationBetween(Vector3f::Forward(), -Vector3f::UnitZ()), //< FIXME: Find out why Z is reversed
Quaternionf::RotationBetween(Vector3f::Forward(), Vector3f::UnitZ()),
};
constexpr std::array<std::string_view, 6> s_dirNames = {
@ -30,8 +30,8 @@ namespace Nz
"Point-light shadow mapping -X",
"Point-light shadow mapping +Y",
"Point-light shadow mapping -Y",
"Point-light shadow mapping +Z",
"Point-light shadow mapping -Z"
"Point-light shadow mapping -Z",
"Point-light shadow mapping +Z"
};
}
@ -63,6 +63,8 @@ namespace Nz
std::size_t shadowPassIndex = Graphics::Instance()->GetMaterialPassRegistry().GetPassIndex("ShadowPass");
Matrix4f projectionMatrix = Matrix4f::Perspective(RadianAnglef(HalfPi<float>), 1.f, 0.01f, m_light.GetRadius());
UInt32 shadowMapSize = light.GetShadowMapSize();
for (std::size_t i = 0; i < m_directions.size(); ++i)
{
@ -72,8 +74,8 @@ namespace Nz
viewer.UpdateViewport(Recti(0, 0, SafeCast<int>(shadowMapSize), SafeCast<int>(shadowMapSize)));
ViewerInstance& viewerInstance = viewer.GetViewerInstance();
viewerInstance.UpdateProjectionMatrix(Matrix4f::Perspective(RadianAnglef(HalfPi<float>), 1.f, 0.01f, m_light.GetRadius()));
viewerInstance.UpdateEyePosition(m_light.GetPosition());
viewerInstance.UpdateProjectionMatrix(projectionMatrix);
viewerInstance.UpdateViewMatrix(Matrix4f::TransformInverse(m_light.GetPosition(), s_dirRotations[i]));
m_pipeline.QueueTransfer(&viewerInstance);

View File

@ -207,7 +207,7 @@ if is_plat("wasm") then
end
if not has_config("embed_rendererbackends", "static") then
-- Register backends as separate modules
-- Register renderer backends as separate modules
for name, module in pairs(rendererBackends) do
if (modules[name] ~= nil) then
os.raise("overriding module " .. name)
@ -219,6 +219,13 @@ end
NazaraModules = modules
-- add_extrafiles was added in xmake 2.8.2 but was broken for wildcard
if xmake.version():lt("2.8.3") then
add_extrafiles = function (...)
add_headerfiles(..., { install = false })
end
end
set_project("NazaraEngine")
set_xmakever("2.7.3")
@ -234,8 +241,8 @@ option("link_curl", { description = "Link libcurl in the executable instead of d
option("link_openal", { description = "Link OpenAL in the executable instead of dynamically loading it", default = is_plat("wasm") or false })
option("static", { description = "Build the engine statically (implies embed_rendererbackends and embed_plugins)", default = is_plat("wasm") or false })
option("override_runtime", { description = "Override vs runtime to MD in release and MDd in debug", default = true })
option("usepch", { description = "Use precompiled headers to speedup compilation", default = false })
option("unitybuild", { description = "Build the engine using unity build", default = false })
option("usepch", { description = "Use precompiled headers to speedup compilation", default = false })
-- Allow to disable some modules
for name, module in pairs(modules) do
@ -443,16 +450,21 @@ function ModuleTargetConfig(name, module)
end
-- Add header and source files
local headerExts = {".h", ".hpp", ".inl", ".natvis"}
for _, ext in ipairs(headerExts) do
for _, ext in ipairs({".h", ".hpp", ".inl"}) do
add_headerfiles("include/(Nazara/" .. name .. "/**" .. ext .. ")")
add_headerfiles("src/Nazara/" .. name .. "/**" .. ext, { prefixdir = "private", install = false })
add_headerfiles("src/Nazara/" .. name .. "/Resources/**.nzsl", { prefixdir = "private", install = false })
end
remove_headerfiles("src/Nazara/" .. name .. "/Resources/**.h")
-- Add extra files for projects
for _, ext in ipairs({".natvis", ".nzsl"}) do
add_extrafiles("include/Nazara/" .. name .. "/**" .. ext)
add_extrafiles("src/Nazara/" .. name .. "/**" .. ext)
end
add_files("src/Nazara/" .. name .. "/**.cpp")
if has_config("embed_resources") then
local embedResourceRule = false
for _, filepath in pairs(os.files("src/Nazara/" .. name .. "/Resources/**|**.h|**.nzsl|**.nzslb")) do
@ -512,16 +524,16 @@ for name, module in pairs(modules) do
else
set_kind("shared")
end
add_defines("NAZARA_BUILD")
add_includedirs("src")
add_packages("fmt") -- fmt is a special package that is not public but required by all Nazara modules
add_rpathdirs("$ORIGIN")
if module.Deps then
add_deps(table.unpack(module.Deps))
end
-- fmt is a special package that is not public but required by all Nazara modules
add_packages("fmt")
if module.Packages then
add_packages(table.unpack(module.Packages))
end
@ -540,13 +552,10 @@ for name, module in pairs(modules) do
add_rules("c++.unity_build", {uniqueid = "NAZARA_UNITY_ID", batchsize = 12})
end
add_defines("NAZARA_BUILD")
if is_plat("windows", "mingw") then
add_defines("NAZARA_UTILS_WINDOWS_NT6=1")
end
add_includedirs("src")
ModuleTargetConfig(name, module)
end)