Adjustments for #3338
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "Config.h"
|
||||
#include "Types.h"
|
||||
|
||||
#include "Engine/Core/Math/Vector3.h"
|
||||
#include "Engine/Core/Types/BaseTypes.h"
|
||||
|
||||
/// <summary>
|
||||
@@ -85,8 +83,7 @@ public:
|
||||
|
||||
FORCE_INLINE static void VelocityChanged(const Vector3& velocity)
|
||||
{
|
||||
if (!velocity.IsNanOrInfinity())
|
||||
Instance->Listener_VelocityChanged(velocity);
|
||||
Instance->Listener_VelocityChanged(velocity);
|
||||
}
|
||||
|
||||
FORCE_INLINE static void TransformChanged(const Vector3& position, const Quaternion& orientation)
|
||||
|
||||
@@ -23,11 +23,11 @@ void AudioListener::Update()
|
||||
{
|
||||
// Update the velocity
|
||||
const Vector3 pos = GetPosition();
|
||||
const float dt = Time::Update.UnscaledDeltaTime.GetTotalSeconds();
|
||||
const float dt = Math::Max(Time::Update.UnscaledDeltaTime.GetTotalSeconds(), 0.00001f);
|
||||
const auto prevVelocity = _velocity;
|
||||
_velocity = (pos - _prevPos) / dt;
|
||||
_prevPos = pos;
|
||||
if (_velocity != prevVelocity)
|
||||
if (_velocity != prevVelocity && !_velocity.IsNanOrInfinity())
|
||||
{
|
||||
AudioBackend::Listener::VelocityChanged(_velocity);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace Flax.Deps.Dependencies
|
||||
RunCmake(cmakeFolder, platform, architecture, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + cmakeArgs, envVars);
|
||||
|
||||
// Run build
|
||||
BuildCmake(cmakeFolder, envVars: envVars);
|
||||
BuildCmake(cmakeFolder, envVars);
|
||||
|
||||
// Deploy binaries
|
||||
var libs = new[]
|
||||
|
||||
@@ -50,8 +50,7 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
var root = options.IntermediateFolder;
|
||||
var version = "1.24.3";
|
||||
string configuration = "Release";
|
||||
int concurrency = Math.Min(Math.Max(1, (int)(Environment.ProcessorCount * Configuration.ConcurrencyProcessorScale)), Configuration.MaxConcurrency);
|
||||
var configuration = "Release";
|
||||
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "OpenAL");
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
@@ -123,7 +122,7 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
{ "CC", "clang-" + Configuration.LinuxClangMinVer },
|
||||
{ "CC_FOR_BUILD", "clang-" + Configuration.LinuxClangMinVer },
|
||||
{ "CMAKE_BUILD_PARALLEL_LEVEL", concurrency.ToString() },
|
||||
{ "CMAKE_BUILD_PARALLEL_LEVEL", CmakeBuildParallel },
|
||||
};
|
||||
var config = $"-DALSOFT_REQUIRE_ALSA=ON " +
|
||||
$"-DALSOFT_REQUIRE_OSS=ON " +
|
||||
@@ -158,7 +157,11 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
"libopenal.a",
|
||||
};
|
||||
var config = "-DALSOFT_REQUIRE_OBOE=OFF -DALSOFT_REQUIRE_OPENSL=ON -DALSOFT_EMBED_HRTF_DATA=YES";
|
||||
var envVars = new Dictionary<string, string>
|
||||
{
|
||||
{ "CMAKE_BUILD_PARALLEL_LEVEL", CmakeBuildParallel },
|
||||
};
|
||||
var config = " -DALSOFT_REQUIRE_OBOE=OFF -DALSOFT_REQUIRE_OPENSL=ON -DALSOFT_EMBED_HRTF_DATA=YES";
|
||||
|
||||
// Get the source
|
||||
var packagePath = Path.Combine(root, "package.zip");
|
||||
@@ -181,8 +184,8 @@ namespace Flax.Deps.Dependencies
|
||||
SetupDirectory(buildDir, true);
|
||||
|
||||
// Build
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=Release " + config);
|
||||
BuildCmake(buildDir);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
||||
BuildCmake(buildDir, envVars);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||
foreach (var file in binariesToCopy)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
|
||||
@@ -194,7 +197,11 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
"libopenal.a",
|
||||
};
|
||||
var config = "-DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES";
|
||||
var envVars = new Dictionary<string, string>
|
||||
{
|
||||
{ "CMAKE_BUILD_PARALLEL_LEVEL", CmakeBuildParallel },
|
||||
};
|
||||
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES";
|
||||
|
||||
// Get the source
|
||||
var packagePath = Path.Combine(root, "package.zip");
|
||||
@@ -210,8 +217,8 @@ namespace Flax.Deps.Dependencies
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, architecture, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=Release " + config);
|
||||
BuildCmake(buildDir);
|
||||
RunCmake(buildDir, platform, architecture, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
||||
BuildCmake(buildDir, envVars);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in binariesToCopy)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
|
||||
@@ -224,7 +231,11 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
"libopenal.a",
|
||||
};
|
||||
var config = "-DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES";
|
||||
var envVars = new Dictionary<string, string>
|
||||
{
|
||||
{ "CMAKE_BUILD_PARALLEL_LEVEL", CmakeBuildParallel },
|
||||
};
|
||||
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES";
|
||||
|
||||
// Get the source
|
||||
var packagePath = Path.Combine(root, "package.zip");
|
||||
@@ -240,8 +251,8 @@ namespace Flax.Deps.Dependencies
|
||||
|
||||
// Build for iOS
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_SYSTEM_NAME=iOS -DALSOFT_OSX_FRAMEWORK=ON -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=Release " + config);
|
||||
BuildCmake(buildDir);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_SYSTEM_NAME=iOS -DALSOFT_OSX_FRAMEWORK=ON -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
||||
BuildCmake(buildDir, envVars);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||
foreach (var file in binariesToCopy)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
|
||||
|
||||
@@ -248,6 +248,21 @@ namespace Flax.Deps
|
||||
Utilities.Run("git", "reset --hard", null, path, Utilities.RunOptions.DefaultTool);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum concurrency level for a cmake command. See CMAKE_BUILD_PARALLEL_LEVEL or -j docs.
|
||||
/// </summary>
|
||||
public static string CmakeBuildParallel => Math.Min(Math.Max(1, (int)(Environment.ProcessorCount * Configuration.ConcurrencyProcessorScale)), Configuration.MaxConcurrency).ToString();
|
||||
|
||||
/// <summary>
|
||||
/// Builds the cmake project.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="envVars">Custom environment variables to pass to the child process.</param>
|
||||
public static void BuildCmake(string path, Dictionary<string, string> envVars)
|
||||
{
|
||||
BuildCmake(path, "Release", envVars);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the cmake project.
|
||||
/// </summary>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Flax.Deps
|
||||
/// </summary>
|
||||
static class Downloader
|
||||
{
|
||||
private static bool IgnoreSSL = false;
|
||||
private const string GoogleDriveDomain = "drive.google.com";
|
||||
private const string GoogleDriveDomain2 = "https://drive.google.com";
|
||||
|
||||
@@ -54,7 +55,7 @@ namespace Flax.Deps
|
||||
{
|
||||
if (httpClient == null)
|
||||
{
|
||||
using (httpClient = new HttpClient())
|
||||
using (httpClient = GetHttpClient())
|
||||
{
|
||||
return DownloadFileFromUrlToPathRaw(url, path, httpClient);
|
||||
}
|
||||
@@ -130,7 +131,7 @@ namespace Flax.Deps
|
||||
// You can comment the statement below if the provided url is guaranteed to be in the following format:
|
||||
// https://drive.google.com/uc?id=FILEID&export=download
|
||||
url = GetGoogleDriveDownloadLinkFromUrl(url);
|
||||
using (var httpClient = new HttpClient())
|
||||
using (var httpClient = GetHttpClient())
|
||||
{
|
||||
FileInfo downloadedFile;
|
||||
|
||||
@@ -209,5 +210,18 @@ namespace Flax.Deps
|
||||
|
||||
return string.Format("https://drive.google.com/uc?id={0}&export=download", url.Substring(index, closingIndex - index));
|
||||
}
|
||||
|
||||
private static HttpClient GetHttpClient()
|
||||
{
|
||||
if (IgnoreSSL)
|
||||
{
|
||||
Log.Warning("Accessing HTTP with SSL certificate validation disabled!");
|
||||
var handler = new HttpClientHandler();
|
||||
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
|
||||
handler.ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => true;
|
||||
return new HttpClient(handler);
|
||||
}
|
||||
return new HttpClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user