refactor: update show flag settings in BPC_PlanarCapture for UE5.7 compatibility; enhance SS_PlanarCaptureManager with FTickableGameObject interface

This commit is contained in:
Lefteris Notas
2026-05-22 16:02:01 +03:00
parent d16c661022
commit 9fd679fd5b
3 changed files with 37 additions and 10 deletions

View File

@@ -2,6 +2,7 @@
// UE5 Modular Game Framework — PlanarCaptureCameraUtils implementation
#include "Capture/PlanarCaptureCameraUtils.h"
#include "Kismet/KismetMathLibrary.h"
FTransform UPlanarCaptureCameraUtils::ComputeMirroredTransform(
const FTransform& ViewerCameraTransform,
@@ -24,7 +25,7 @@ FTransform UPlanarCaptureCameraUtils::ComputeMirroredTransform(
const FVector ViewerUp = ViewerCameraTransform.GetUnitAxis(EAxis::Z);
const FVector ReflectedUp = ViewerUp - 2.0f * FVector::DotProduct(ViewerUp, MirrorNormal) * MirrorNormal;
FRotator ReflectedRotation = UKismetMathLibrary::MakeRotFromXZ(ReflectedForward, ReflectedUp);
const FRotator ReflectedRotation = FRotationMatrix::MakeFromXZ(ReflectedForward, ReflectedUp).Rotator();
return FTransform(ReflectedRotation, ReflectedPosition, ViewerCameraTransform.GetScale3D());
}
@@ -73,8 +74,8 @@ FMatrix UPlanarCaptureCameraUtils::ComputeObliqueProjectionMatrix(
ProjectionMatrix.M[3][3] = 0.0f;
// Transform clip plane into view space (inverse of surface transform)
const FTransform ViewTransform = SurfaceTransform.Inverse();
const FPlane ViewSpaceClipPlane = ClipPlane.TransformBy(ViewTransform);
const FMatrix ViewMatrix = SurfaceTransform.ToMatrixNoScale().Inverse();
const FPlane ViewSpaceClipPlane = ClipPlane.TransformBy(ViewMatrix);
// Compute oblique near-plane using the standard technique:
// Calculate the clip-space corner that maximizes the dot product with the plane normal.
@@ -90,7 +91,8 @@ FMatrix UPlanarCaptureCameraUtils::ComputeObliqueProjectionMatrix(
Q.W = (1.0f + ProjectionMatrix.M[2][2]) / ProjectionMatrix.M[3][2];
// Scale the clip plane so its distance from the origin matches the Q vertex
const float Scale = 2.0f / FVector4::DotProduct(ClipPlaneVec, Q);
const float DotVal = ClipPlaneVec.X * Q.X + ClipPlaneVec.Y * Q.Y + ClipPlaneVec.Z * Q.Z + ClipPlaneVec.W * Q.W;
const float Scale = 2.0f / DotVal;
ClipPlaneVec *= Scale;
// Replace the third row of the projection matrix with the clip plane