Skip to content

UE 5.3 Fix #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void FPointCloudStreamingCore::Initialize(unsigned int pointCount)
if (pointCount == 0)
return;

int32 pointsPerAxis = FMath::CeilToInt(FMath::Sqrt(pointCount));
int32 pointsPerAxis = FMath::CeilToInt(FMath::Sqrt(static_cast<float>(pointCount)));
// Ensure even-sized, power-of-two textures to avoid inaccuracies
if (pointsPerAxis % 2 == 1) pointsPerAxis++;
pointsPerAxis = GetUpperPowerOfTwo(pointsPerAxis);
Expand Down Expand Up @@ -321,4 +321,4 @@ FPointCloudStreamingCore::~FPointCloudStreamingCore() {
// delete mPointScalingTexture;
//if (mColorTexture)
// delete mColorTexture;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void UGPUPointCloudRendererComponent::CreateStreamingBaseMesh(int32 pointCount)
CHECK_PCR_STATUS

// Dirty fix: Avoid recreation of point cloud mesh every frame
int32 pointsPerAxis = FMath::CeilToInt(FMath::Sqrt(pointCount));
int32 pointsPerAxis = FMath::CeilToInt(FMath::Sqrt(static_cast<float>(pointCount)));
if (pointsPerAxis % 2 == 1) pointsPerAxis++;
pointsPerAxis = GetUpperPowerOfTwo(pointsPerAxis);
auto totalPointCount = pointsPerAxis* pointsPerAxis;
Expand Down Expand Up @@ -202,7 +202,7 @@ void UGPUPointCloudRendererComponent::BuildTriangleStack(TArray<FCustomMeshTrian

// construct equilateral triangle with x, y, z as center and normal facing z
float a = 1.0f; // side lenght
float sqrt3 = FMath::Sqrt(3);
float sqrt3 = FMath::Sqrt(3.0);
float r = sqrt3 / 6 * a; // radius of inscribed circle
//float h_minus_r = a / sqrt3; // from center to tip. height - r
float x = 0;
Expand Down Expand Up @@ -237,4 +237,4 @@ void UGPUPointCloudRendererComponent::UpdateShaderProperties()
mPointCloudMaterial->SetScalarParameterValue("DistanceScaling", mDistanceScaling);
//mPointCloudMaterial->SetScalarParameterValue("DistanceFalloff", mDistanceFalloff);
mPointCloudMaterial->SetScalarParameterValue("ShouldOverrideColor", (int)mShouldOverrideColor);
}
}