34 #include <mesh_utils.h> 46 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
49 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
50 VTL(
const uint32 _prim_id,
const float2 _uv0,
const float2 _uv1,
const float2 _uv2,
const float _area)
59 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
63 const MeshStorage::vertex_triangle tri =
reinterpret_cast<const MeshStorage::vertex_triangle*
>(mesh.vertex_indices)[prim_id];
69 p0 = vtp2 * (1.0f - uv0.x - uv0.y) + vtp0 * uv0.x + vtp1 * uv0.y;
70 p1 = vtp2 * (1.0f - uv1.x - uv1.y) + vtp0 * uv1.x + vtp1 * uv1.y;
71 p2 = vtp2 * (1.0f - uv2.x - uv2.y) + vtp0 * uv2.x + vtp1 * uv2.y;
74 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
78 const MeshStorage::texture_triangle tri =
reinterpret_cast<const MeshStorage::texture_triangle*
>(mesh.texture_indices)[prim_id];
84 t0 = vtt2 * (1.0f - uv0.x - uv0.y) + vtt0 * uv0.x + vtt1 * uv0.y;
85 t1 = vtt2 * (1.0f - uv1.x - uv1.y) + vtt0 * uv1.x + vtt1 * uv1.y;
86 t2 = vtt2 * (1.0f - uv2.x - uv2.y) + vtt0 * uv2.x + vtt1 * uv2.y;
89 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
92 return uv2 * (1.0f - uv.x - uv.y) + uv0 * uv.x + uv1 * uv.y;
95 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
98 return (uv0 + uv1 + uv2) / 3.0f;
101 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
Definition: MeshView.h:96
FERMAT_HOST_DEVICE cugar::Vector3f interpolate_position(const MeshView &mesh, const uint32 tri_id, const float u, const float v, float *pdf=0)
Definition: mesh_utils.h:323