Skip to content
Snippets Groups Projects
Commit 9fcb94e5 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

- Fixed a bad line in RemovePoint.

- Removed RemovedPoints function for now as it is broken and the implementation is more complex than expected.
parent 8a394c54
No related branches found
No related tags found
No related merge requests found
...@@ -958,7 +958,6 @@ bool UGPUInstancedLineComponent::RemovePoint(int32 LineId, int32 PointId) ...@@ -958,7 +958,6 @@ bool UGPUInstancedLineComponent::RemovePoint(int32 LineId, int32 PointId)
const GPULineIndices& Indices = Line[PointId]; const GPULineIndices& Indices = Line[PointId];
const int32 LineTextureIndex = Indices.Value; const int32 LineTextureIndex = Indices.Value;
const int32 RemovedInstanceId = Indices.Key; const int32 RemovedInstanceId = Indices.Key;
RemoveInstance(10);
if (PointId == 0) if (PointId == 0)
{ {
...@@ -1017,68 +1016,12 @@ bool UGPUInstancedLineComponent::RemovePoint(int32 LineId, int32 PointId) ...@@ -1017,68 +1016,12 @@ bool UGPUInstancedLineComponent::RemovePoint(int32 LineId, int32 PointId)
return true; return true;
} }
// todo
bool UGPUInstancedLineComponent::RemovePoints(int32 LineId, int32 StartingPointId, int32 NumberOfPoints) bool UGPUInstancedLineComponent::RemovePoints(int32 LineId, int32 StartingPointId, int32 NumberOfPoints)
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("UGPUInstancedLineComponent::RemoveLine")) TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("UGPUInstancedLineComponent::RemoveLine"))
GPULineArray& Line = LineMap[LineId];
const GPULineIndices& Indices = Line[StartingPointId];
const int32 LineTextureIndex = Indices.Value;
if(StartingPointId == 0)
{
Line[StartingPointId + NumberOfPoints].Value = 0;
}
LinearLineData.RemoveAt(LineTextureIndex, NumberOfPoints);
// Segment at the end of the line?
if (StartingPointId + NumberOfPoints == Line.Num())
{
RemoveInstance(Line[StartingPointId - 1].Key);
Line[StartingPointId - 1].Key = -1;
for(int32 i = 0; i < NumberOfPoints - 1; ++i)
{
RemoveInstance(Line[StartingPointId + i].Key);
}
}
else
{
for (int32 i = 0; i < NumberOfPoints; ++i)
{
RemoveInstance(Line[StartingPointId + i].Key);
}
// Update the following segments in this line:
for (int32 i = StartingPointId + NumberOfPoints + 1; i < Line.Num(); ++i)
{
Line[i].Value -= NumberOfPoints;
Line[i].Key -= NumberOfPoints;
SetCustomDataValue(Line[i].Key, 4, Line[i].Value);
}
}
Line.RemoveAt(StartingPointId, NumberOfPoints);
// Update all following lines
for (TPair<int32, GPULineArray>& Pair : LineMap)
{
GPULineArray& LineArray = Pair.Value;
if (LineArray[0].Value > LineTextureIndex) // todo test, maybe needs to be >=
{
for (int32 i = 0; i < LineArray.Num(); ++i)
{
LineArray[i].Value -= NumberOfPoints;
LineArray[i].Key -= NumberOfPoints;
SetCustomDataValue(LineArray[i].Key, 4, LineArray[i].Value, false);
}
}
}
CurrentTextureIndex -= NumberOfPoints;
CurrentTextureMarker.X = CurrentTextureIndex % TextureWidth;
CurrentTextureMarker.Y = CurrentTextureIndex / TextureWidth;
UpdateWholeTexture();
return true; return false;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment