Navigation
API > API/Plugins > API/Plugins/ModelingComponents > API/Plugins/ModelingComponents/FMeshSceneAdapter
The data structures used for supporting spatial queries in FMeshSceneAdapter are somewhat complex. Externally, the user adds Actors/Components, which results in FActorAdapter objects, each with list of FActorChildMesh. Each FActorChildMesh is a /reference/ to a mesh, not a mesh itself, as well as a transform. This allows unique mesh data to be shared across many usages, eg similar to StaticMeshActor / ISMComponent / Asset. (However there is no required 1-1 correspondence between FActorChildMesh and an actual Component, and in the case of an InstancedStaticMeshComponent, there will be an FActorChildMesh for each Component)
Each FActorChildMesh has a pointer to an IMeshSpatialWrapper, this is where unique mesh data, and any spatial data structures, will be stored. Each unique IMeshSpatialWrapper instance is owned by a FSpatialWrapperInfo, which are stored in the SpatialAdapters map below. Each FSpatialWrapperInfo also knows which parent FActorChildMesh objects own it.
The main action inside a FSpatialWrapperInfo (ie unique mesh) is inside the IMeshSpatialWrapper implementation, this is where mesh data is unpacked and things like an AABBTree will be built if required. The top-level Build() will do this work.
However evaluating spatial queries across a large set of actors / scene meshes would require testing each mesh instance one-by-one. To speed this up, BuildSpatialEvaluationCache() can be called to build an Octree across mesh instances. FSpatialCacheInfo is a separate representation of each unique (actor, chlidmesh, spatial, boundingbox) tuple, a list of these is built and then inserted into an Octree.
| Name | FSpatialWrapperInfo |
| Type | struct |
| Header File | /Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Scene/MeshSceneAdapter.h |
| Include Path | #include "Scene/MeshSceneAdapter.h" |
Syntax
struct FSpatialWrapperInfo
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| NonUniformScaleCount | int32 | Number of non-uniform scales applied to this mesh by parent instances | Scene/MeshSceneAdapter.h | |
| ParentMeshes | TArray< FActorChildMesh * > | List of scene mesh instances that reference this unique mehs | Scene/MeshSceneAdapter.h | |
| SourceContainer | FMeshTypeContainer | Identifier for mesh, including source pointer, mesh type, etc | Scene/MeshSceneAdapter.h | |
| SpatialWrapper | TUniquePtr< IMeshSpatialWrapper > | Implementation of IMeshSpatialWrapper for this mesh, that provides spatial and other mesh data queries NOTE that each FActorChildMesh in ParentMeshes has a pointer to this object, so if SpatialWrapper is replaced, the FActorChildMesh objects must also be updated | Scene/MeshSceneAdapter.h |