Navigation
API > API/Plugins > API/Plugins/DynamicMesh
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.
| Name | TMeshSurfaceUVSampler |
| Type | class |
| Header File | /Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/Sampling/MeshSurfaceSampler.h |
| Include Path | #include "Sampling/MeshSurfaceSampler.h" |
Syntax
template<typename SampleType>
class TMeshSurfaceUVSampler : public UE::Geometry::FMeshSurfaceUVSamplerFixLayout
Inheritance Hierarchy
- FMeshSurfaceUVSamplerFixLayout → TMeshSurfaceUVSampler
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual 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() | Sampling/MeshSurfaceSampler.h | |
virtual void Initialize
(
const FDynamicMesh3* MeshIn, |
Configure the sampler. | Sampling/MeshSurfaceSampler.h | |
virtual bool SampleUV
(
const FVector2d& UV, |
Compute a sample at the given UV location | Sampling/MeshSurfaceSampler.h | |
virtual bool SampleUV
(
int32 UVTriangleID, |
Compute a sample at the given UV location in the given Triangle | Sampling/MeshSurfaceSampler.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void InitializeBVTree() |
Sampling/MeshSurfaceSampler.h |