vault backup: 2025-06-26 18:45:35
This commit is contained in:
parent
421030faf3
commit
32b737a665
@ -154,6 +154,22 @@ void AShaderWorldActor::ReadbacksManagement()
|
|||||||
```
|
```
|
||||||
|
|
||||||
### CollisionManagement()
|
### CollisionManagement()
|
||||||
|
- ThreadSafe
|
||||||
|
- bool
|
||||||
|
- bProcessingGroundCollision
|
||||||
|
- bPreprocessingCollisionUpdate
|
||||||
|
- EditRebuild:传递Bool值给 rebuild。
|
||||||
|
- FSWCollisionManagementShareableData
|
||||||
|
- CollisionShareable
|
||||||
|
- FRenderCommandFence
|
||||||
|
- 1
|
||||||
|
- bool
|
||||||
|
- RedbuildCollisionContext
|
||||||
|
- Array
|
||||||
|
- CollisionWorkQueue:类型为FCollisionProcessingWork。
|
||||||
|
- CollisionReadToProcess
|
||||||
|
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
void AShaderWorldActor::CollisionManagement(float& DeltaT)
|
void AShaderWorldActor::CollisionManagement(float& DeltaT)
|
||||||
{
|
{
|
||||||
@ -211,9 +227,86 @@ void AShaderWorldActor::CollisionManagement(float& DeltaT)
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#
|
|
||||||
|
|
||||||
#### SetupCollisions()
|
#### SetupCollisions()
|
||||||
|
```c++
|
||||||
|
bool AShaderWorldActor::SetupCollisions()
|
||||||
|
{
|
||||||
|
SW_FCT_CYCLE()
|
||||||
|
|
||||||
|
if (!bHadGeneratorAtRebuildTime)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!Shareable_ID.IsValid() || Meshes.Num() <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//初始化线程安全变量
|
||||||
|
if (!bProcessingGroundCollision.IsValid())
|
||||||
|
bProcessingGroundCollision = MakeShared<FThreadSafeBool, ESPMode::ThreadSafe>();
|
||||||
|
if (!bPreprocessingCollisionUpdate.IsValid())
|
||||||
|
bPreprocessingCollisionUpdate = MakeShared<FThreadSafeBool, ESPMode::ThreadSafe>();
|
||||||
|
|
||||||
|
if (EditRebuild)
|
||||||
|
{
|
||||||
|
EditRebuild.AtomicSet(false);
|
||||||
|
rebuild = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rebuild)
|
||||||
|
RedbuildCollisionContext = true;
|
||||||
|
//重建相关变量初始化
|
||||||
|
if (RedbuildCollisionContext)
|
||||||
|
{
|
||||||
|
if (!(*bProcessingGroundCollision.Get()) && !(*bPreprocessingCollisionUpdate.Get())
|
||||||
|
&& CollisionProcess.IsFenceComplete()
|
||||||
|
&& (CollisionMesh.Num() <= 0)
|
||||||
|
&& (UsedCollisionMesh.Num() <= 0))
|
||||||
|
{
|
||||||
|
|
||||||
|
CollisionShareable = nullptr;
|
||||||
|
|
||||||
|
CollisionWorkQueue.Empty();
|
||||||
|
CollisionReadToProcess.Empty();
|
||||||
|
|
||||||
|
RedbuildCollisionContext = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RedbuildCollisionContext)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!GenerateCollision)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!CollisionShareable.IsValid())
|
||||||
|
CollisionShareable = MakeShared<FSWCollisionManagementShareableData, ESPMode::ThreadSafe>(CollisionResolution, CollisionVerticesPerPatch);
|
||||||
|
|
||||||
|
if ((*bProcessingGroundCollision.Get()) || (*bPreprocessingCollisionUpdate.Get()) || !CameraSet || (Meshes.Num() == 0))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Let the data layer be computed before generating collisions and trying to extract material IDs
|
||||||
|
if (bExportPhysicalMaterialID && (WorldCycle < 2))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
if (CollisionVisibleChanged)
|
||||||
|
{
|
||||||
|
if (GetWorld())
|
||||||
|
{
|
||||||
|
for (auto& ColM : CollisionMesh)
|
||||||
|
{
|
||||||
|
if (auto& Mesh = ColM.Value.Mesh)
|
||||||
|
{
|
||||||
|
Mesh->SetMeshSectionVisible(0, CollisionVisible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CollisionVisibleChanged.AtomicSet(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### SpawnablesManagement()
|
### SpawnablesManagement()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user