vault backup: 2025-07-15 23:58:06
This commit is contained in:
parent
40943af304
commit
65d043ec2b
@ -652,9 +652,6 @@ bool AShaderWorldActor::CollisionPreprocessGPU()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### CollisionGPU()
|
#### CollisionGPU()
|
||||||
```c++
|
```c++
|
||||||
|
|
||||||
@ -1481,7 +1478,7 @@ void AShaderWorldActor::UpdateCollisionMeshData(FCollisionMeshElement& Mesh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
### CollisionCPU
|
#### CollisionCPU
|
||||||
```c++
|
```c++
|
||||||
|
|
||||||
void AShaderWorldActor::CollisionCPU()
|
void AShaderWorldActor::CollisionCPU()
|
||||||
@ -1512,22 +1509,24 @@ void AShaderWorldActor::CollisionCPU()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//通过AShaderWorldActor::UpdateCollisionInRegion()来添加碰撞重建区域
|
||||||
bool bExternalCollisionRebuildRequest = !CollisionUpdateRequest.IsEmpty();
|
bool bExternalCollisionRebuildRequest = !CollisionUpdateRequest.IsEmpty();
|
||||||
FBox2D BPCollisionRebuildRequest(ForceInit);
|
FBox2D BPCollisionRebuildRequest(ForceInit);
|
||||||
|
//从CollisionUpdateRequest队列中取出碰撞更新范围
|
||||||
if (bExternalCollisionRebuildRequest)
|
if (bExternalCollisionRebuildRequest)
|
||||||
CollisionUpdateRequest.Dequeue(BPCollisionRebuildRequest);
|
CollisionUpdateRequest.Dequeue(BPCollisionRebuildRequest);
|
||||||
|
|
||||||
TArray<ShaderWorld::FVisitor> VisitorLocations;
|
TArray<ShaderWorld::FVisitor> VisitorLocations;
|
||||||
|
|
||||||
// Use latest camera we know if current array is empty
|
// Use latest camera we know if current array is empty
|
||||||
|
//在BeginPlay()会将ShaderWorld Actor的Location添加到CameraLocations中。
|
||||||
|
//在UpdateCameraLocation()中会将,这个函数会在Setup()中调用。
|
||||||
|
// USWorldSubsystem::Tick()中会调用UpdateVisitors()获取所有USW_CollisionComponent。
|
||||||
if (CameraLocations.Num() <= 0)
|
if (CameraLocations.Num() <= 0)
|
||||||
VisitorLocations.Add(CamLocation);
|
VisitorLocations.Add(CamLocation);
|
||||||
|
|
||||||
VisitorLocations.Append(CameraLocations);
|
VisitorLocations.Append(CameraLocations);
|
||||||
|
//将bPreprocessingCollisionUpdate线程安全变量设置为true
|
||||||
(*bPreprocessingCollisionUpdate.Get()) = true;
|
(*bPreprocessingCollisionUpdate.Get()) = true;
|
||||||
|
|
||||||
Async(EAsyncExecution::TaskGraph, [Completion = bPreprocessingCollisionUpdate, CollData = CollisionShareable,
|
Async(EAsyncExecution::TaskGraph, [Completion = bPreprocessingCollisionUpdate, CollData = CollisionShareable,
|
||||||
@ -1547,7 +1546,6 @@ void AShaderWorldActor::CollisionCPU()
|
|||||||
double CollisionWidth = CollData->CollisionResolution * (CollData->VerticePerPatch - 1);
|
double CollisionWidth = CollData->CollisionResolution * (CollData->VerticePerPatch - 1);
|
||||||
|
|
||||||
TMap<FIntVector, FVector> BrushRedraws;
|
TMap<FIntVector, FVector> BrushRedraws;
|
||||||
|
|
||||||
for (const FBox2d& B : BrushScope)
|
for (const FBox2d& B : BrushScope)
|
||||||
{
|
{
|
||||||
const int32 MinBoxX_local = FMath::FloorToInt(((double)(B.Min.X + LocalOriginLocation.X)) / CollisionWidth + 0.45);
|
const int32 MinBoxX_local = FMath::FloorToInt(((double)(B.Min.X + LocalOriginLocation.X)) / CollisionWidth + 0.45);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user