31 #include <mesh/MeshView.h> 32 #include <cugar/basic/vector.h> 35 #include <uv_bvh_view.h> 44 n_vtls(0), vtls(NULL), uvbvh(), mesh(), textures(NULL) {}
48 n_vtls(_n_vtls), vtls(_vtls), uvbvh(_uvbvh), mesh(_mesh), textures(_textures) {}
66 *prim_id = vtls[vtl_idx].prim_id;
67 *uv = vtls[vtl_idx].interpolate_uv( vtl_uv );
68 *pdf = 1.0f / vtls[vtl_idx].area;
70 FERMAT_ASSERT(*prim_id < uint32(mesh.num_triangles));
73 const int material_id = mesh.material_indices[*prim_id];
76 material.emissive =
cugar::Vector4f(material.emissive) * texture_lookup(geom->texture_coords, material.emissive_map, textures,
cugar::Vector4f(1.0f));
91 FERMAT_ASSERT(prim_id < uint32(mesh.num_triangles));
92 const int material_id = mesh.material_indices[prim_id];
95 material.emissive =
cugar::Vector4f(material.emissive) * texture_lookup(geom.texture_coords, material.emissive_map, textures,
cugar::Vector4f(1.0f));
100 const uint32 vtl_idx = locate( uvbvh, vtls, prim_id, uv );
101 *pdf = vtl_idx != uint32(-1) ? 1.0f / vtls[vtl_idx].area : 0.0f;
113 uint32 vtl_count()
const {
return n_vtls; }
116 VTL get_vtl(
const uint32 i)
const {
return vtls[i]; }
FERMAT_HOST_DEVICE uint32 map(const uint32_t prim_id, const cugar::Vector2f &uv, const VertexGeometry &geom, float *pdf, Edf *edf) const
Definition: vtl_mesh_view.h:87
Entry point to the generic Bounding Volume Hierarchy library.
Defines various spherical mappings.
Definition: MeshView.h:55
FERMAT_HOST_DEVICE void setup_differential_geometry(const MeshView &mesh, const uint32 tri_id, const float u, const float v, VertexGeometry *geom, float *pdf=0)
Definition: mesh_utils.h:185
FERMAT_HOST_DEVICE void sample(const uint32 vtl_idx, const cugar::Vector2f vtl_uv, uint32_t *prim_id, cugar::Vector2f *uv, VertexGeometry *geom, float *pdf, Edf *edf) const
Definition: vtl_mesh_view.h:54
Definition: vtl_mesh_view.h:40
Definition: MeshView.h:96
Definition: texture_view.h:73
Definition: uv_bvh_view.h:97