Navigation
API > API/Plugins > API/Plugins/DynamicMesh > API/Plugins/DynamicMesh/Sampling
References
| Module | DynamicMesh |
| Header | /Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/Sampling/MeshSurfaceSampler.h |
| Include | #include "Sampling/MeshSurfaceSampler.h" |
Syntax
template<typename SampleType>
class TMeshSurfaceUVSampler
Remarks
Consider using FMeshSurfaceUVSampler instead, it is more flexible and easier to understand!
TMeshSurfaceUVSampler computes point samples of the given SampleType at positions on the mesh based on UV-space positions. The standard use case for this class is to compute samples used in building Normal Maps, AO Maps, etc.
Note that for UVOnly sample type, an internal UV-space BVTree will be constructed, and each sample will query that to find the UV/3D correspondence. If you already know the TriangleID, you can use the TriangleAndUV type to avoid the BVTree construction and queries.
Note that if you need to sample multiple things, rather than building up an uber-SampleType, you can first compute a sample with SampleType=FMeshUVSampleInfo to find the correspondence information, and then construction additional samplers of type EMeshSurfaceSamplerQueryType::TriangleAndUV, and call CachedSampleUV(), to avoid expensive BVTree constructions and UV-to-3D recalculation.
Variables
| Type | Name | Description | |
|---|---|---|---|
| bool | bUVSpatialValid | ||
| const FDynamicMesh3 * | Mesh | ||
| EMeshSurfaceSamplerQueryType | QueryType | ||
| TMeshAABBTree3< FDynamicMeshUVMesh > | UVBVTree | ||
| FDynamicMeshUVMesh | UVMeshAdapter | BV tree for finding triangle for a given UV. Not always initialized. | |
| const FDynamicMeshUVOverlay * | UVOverlay | ||
| TUniqueFunction< void(const FMeshUVSampleInfo &SampleInfo, SampleType &SampleValueOut)> | ValueFunction | ||
| SampleType | ZeroValue |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | CachedSampleUV
(
const FMeshUVSampleInfo& CachedSampleInfo, |
Compute a sample at the given UV/3D location specified by CachedSampleInfo, which presumably was produced by previous calls to SampleUV() | |
| void | Initialize
(
const FDynamicMesh3* MeshIn, |
Configure the sampler. | |
| void | |||
| bool | SampleUV
(
const FVector2d& UV, |
Compute a sample at the given UV location | |
| bool | SampleUV
(
int32 UVTriangleID, |
Compute a sample at the given UV location in the given Triangle |