Add CaptureOffset to Environment Probe
This commit is contained in:
@@ -218,6 +218,12 @@ void EnvironmentProbe::OnDebugDrawSelected()
|
||||
// Draw influence range
|
||||
DEBUG_DRAW_WIRE_SPHERE(_sphere, Color::CornflowerBlue, 0, true);
|
||||
|
||||
// Draw capture point (if offset)
|
||||
if (!CaptureOffset.IsZero())
|
||||
{
|
||||
DEBUG_DRAW_WIRE_SPHERE(BoundingSphere(_transform.LocalToWorld(CaptureOffset), 10.0f), Color::Blue, 0, false);
|
||||
}
|
||||
|
||||
// Base
|
||||
Actor::OnDebugDrawSelected();
|
||||
}
|
||||
@@ -243,6 +249,7 @@ void EnvironmentProbe::Serialize(SerializeStream& stream, const void* otherObj)
|
||||
SERIALIZE(SortOrder);
|
||||
SERIALIZE(UpdateMode);
|
||||
SERIALIZE(CaptureNearPlane);
|
||||
SERIALIZE(CaptureOffset);
|
||||
SERIALIZE_MEMBER(IsCustomProbe, _isUsingCustomProbe);
|
||||
SERIALIZE_MEMBER(ProbeID, _probe);
|
||||
}
|
||||
@@ -258,6 +265,7 @@ void EnvironmentProbe::Deserialize(DeserializeStream& stream, ISerializeModifier
|
||||
DESERIALIZE(SortOrder);
|
||||
DESERIALIZE(UpdateMode);
|
||||
DESERIALIZE(CaptureNearPlane);
|
||||
DESERIALIZE(CaptureOffset);
|
||||
DESERIALIZE_MEMBER(IsCustomProbe, _isUsingCustomProbe);
|
||||
DESERIALIZE_MEMBER(ProbeID, _probe);
|
||||
|
||||
|
||||
@@ -69,6 +69,12 @@ public:
|
||||
API_FIELD(Attributes="EditorOrder(25), Limit(0, float.MaxValue, 0.01f), EditorDisplay(\"Probe\")")
|
||||
float CaptureNearPlane = 10.0f;
|
||||
|
||||
/// <summary>
|
||||
/// Probe position offset to apply before capturing which can be used to adjust reflections.
|
||||
/// </summary>
|
||||
API_FIELD(Attributes = "EditorOrder(40), EditorDisplay(\"Probe\")")
|
||||
Float3 CaptureOffset = Float3(0, 0, 0);
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Gets the probe radius.
|
||||
|
||||
@@ -448,7 +448,7 @@ void ProbesRendererService::OnRender(RenderTask* task, GPUContext* context)
|
||||
if (_current.Type == ProbeEntry::Types::EnvProbe)
|
||||
{
|
||||
auto envProbe = (EnvironmentProbe*)_current.Actor.Get();
|
||||
Vector3 position = envProbe->GetPosition();
|
||||
Vector3 position = envProbe->GetTransform().LocalToWorld(envProbe->CaptureOffset);
|
||||
float radius = envProbe->GetScaledRadius();
|
||||
float nearPlane = Math::Max(0.1f, envProbe->CaptureNearPlane);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user