Various fixes and improvements

This commit is contained in:
2026-04-14 16:00:53 +02:00
parent 04260f4551
commit 5b7af2e10c
6 changed files with 7 additions and 5 deletions
+2 -1
View File
@@ -596,7 +596,8 @@ namespace Math
/// <param name="toMin">The destination range minimum.</param> /// <param name="toMin">The destination range minimum.</param>
/// <param name="toMax">The destination range maximum.</param> /// <param name="toMax">The destination range maximum.</param>
/// <returns>The remapped value.</returns> /// <returns>The remapped value.</returns>
static float Remap(float value, float fromMin, float fromMax, float toMin, float toMax) template<typename T>
static float Remap(T value, T fromMin, T fromMax, T toMin, T toMax)
{ {
return (value - fromMin) / (fromMax - fromMin) * (toMax - toMin) + toMin; return (value - fromMin) / (fromMax - fromMin) * (toMax - toMin) + toMin;
} }
+1
View File
@@ -5,3 +5,4 @@
#define METERS_TO_UNITS(meters) (meters * 100.0f) #define METERS_TO_UNITS(meters) (meters * 100.0f)
#define UNITS_TO_METERS(units) (units * 0.01f) #define UNITS_TO_METERS(units) (units * 0.01f)
#define UNITS_TO_METERS_SCALE 0.01f #define UNITS_TO_METERS_SCALE 0.01f
#define METERS_TO_UNITS_SCALE 100.0f
@@ -188,7 +188,7 @@ void EnvironmentProbe::Draw(RenderContext& renderContext)
{ {
// Size culling // Size culling
const Float3 position = _sphere.Center - renderContext.View.Origin; const Float3 position = _sphere.Center - renderContext.View.Origin;
const float radius = _sphere.Radius; const float radius = (float)_sphere.Radius;
const float drawMinScreenSize = 0.02f; const float drawMinScreenSize = 0.02f;
const auto lodView = (renderContext.LodProxyView ? renderContext.LodProxyView : &renderContext.View); const auto lodView = (renderContext.LodProxyView ? renderContext.LodProxyView : &renderContext.View);
const float screenRadiusSquared = RenderTools::ComputeBoundsScreenRadiusSquared(position, radius, *lodView) * renderContext.View.ModelLODDistanceFactorSqrt; const float screenRadiusSquared = RenderTools::ComputeBoundsScreenRadiusSquared(position, radius, *lodView) * renderContext.View.ModelLODDistanceFactorSqrt;
@@ -43,7 +43,7 @@ public:
float GravityScale = 1.0f; float GravityScale = 1.0f;
/// <summary> /// <summary>
/// The scale of velocity applied to rope. The greater the value, the more suppressed the movement. /// The scale of velocity applied to rope. The greater the value, the more suppressed the movement. Lower values increase movement freedom.
/// </summary> /// </summary>
API_FIELD(Attributes="EditorOrder(15), EditorDisplay(\"Rope\"), Limit(0, 0.99f, 0.001f)") API_FIELD(Attributes="EditorOrder(15), EditorDisplay(\"Rope\"), Limit(0, 0.99f, 0.001f)")
float Drag = 0.1f; float Drag = 0.1f;
+1 -1
View File
@@ -450,7 +450,7 @@ void ProbesRendererService::OnRender(RenderTask* task, GPUContext* context)
{ {
auto envProbe = (EnvironmentProbe*)_current.Actor.Get(); auto envProbe = (EnvironmentProbe*)_current.Actor.Get();
Vector3 position = envProbe->GetTransform().LocalToWorld(envProbe->CaptureOffset); Vector3 position = envProbe->GetTransform().LocalToWorld(envProbe->CaptureOffset);
float radius = envProbe->GetSphere().Radius; float radius = (float)envProbe->GetSphere().Radius;
float nearPlane = Math::Max(METERS_TO_UNITS(0.001f), envProbe->CaptureNearPlane); float nearPlane = Math::Max(METERS_TO_UNITS(0.001f), envProbe->CaptureNearPlane);
// Adjust far plane distance // Adjust far plane distance
+1 -1
View File
@@ -307,7 +307,7 @@ public:
// Whether to do a sloppy mesh optimization. This is faster but does not follow the topology of the original mesh. // Whether to do a sloppy mesh optimization. This is faster but does not follow the topology of the original mesh.
API_FIELD(Attributes="EditorOrder(1140), EditorDisplay(\"Level Of Detail\"), VisibleIf(nameof(ShowGeometry))") API_FIELD(Attributes="EditorOrder(1140), EditorDisplay(\"Level Of Detail\"), VisibleIf(nameof(ShowGeometry))")
bool SloppyOptimization = false; bool SloppyOptimization = false;
// Only used if Sloppy is false. Target error is an approximate measure of the deviation from the original mesh using distance normalized to [0..1] range (e.g. 1e-2f means that simplifier will try to maintain the error to be below 1% of the mesh extents). // Target error is an approximate measure of the deviation from the original mesh using distance normalized to [0,1] range (e.g. 0.01 means that simplifier will try to maintain the error to be below 1% of the mesh extents). Only used if Sloppy is unchecked.
API_FIELD(Attributes="EditorOrder(1150), EditorDisplay(\"Level Of Detail\"), VisibleIf(nameof(SloppyOptimization), true), VisibleIf(nameof(ShowGeometry)), Limit(0.01f, 1, 0.001f)") API_FIELD(Attributes="EditorOrder(1150), EditorDisplay(\"Level Of Detail\"), VisibleIf(nameof(SloppyOptimization), true), VisibleIf(nameof(ShowGeometry)), Limit(0.01f, 1, 0.001f)")
float LODTargetError = 0.05f; float LODTargetError = 0.05f;