Fermat
Classes | Macros | Enumerations | Functions
MeshModule

Detailed Description

Classes

struct  MeshMaterial
 
struct  MeshView
 
struct  load_triangle_dispatch< T >
 
struct  load_triangle_dispatch< int3 >
 
struct  load_triangle_dispatch< int4 >
 
struct  load_vertex_dispatch< T >
 
struct  load_vertex_dispatch< float3 >
 
struct  load_vertex_dispatch< float4 >
 

Macros

#define SUTILCLASSAPI
 
#define SUTILAPI
 
#define TEX_COORD_COMPRESSION_FIXED   0
 
#define TEX_COORD_COMPRESSION_HALF   1
 
#define TEX_COORD_COMPRESSION_MODE   TEX_COORD_COMPRESSION_HALF
 

Enumerations

enum  TextureSet { kTextureCoords0 = 0, kLightmapCoords = 1 }
 

Functions

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE const MeshView::vertex_type & fetch_vertex (const MeshView &mesh, const uint32 vert_idx)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE const MeshView::normal_type & fetch_normal (const MeshView &mesh, const uint32 vert_idx)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE const MeshView::texture_coord_type & fetch_tex_coord (const MeshView &mesh, const uint32 vert_idx)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE cugar::Vector3f vertex_comp (const cugar::Vector3f &v)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE cugar::Vector3f vertex_comp (const cugar::Vector4f &v)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE cugar::Vector3f load_vertex (const MeshView &mesh, const uint32 vert_idx)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE cugar::Vector4f load_full_vertex (const MeshView &mesh, const uint32 vert_idx)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE int3 load_vertex_triangle (const int *triangle_indices, const uint32 tri_idx)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE int3 load_normal_triangle (const int *triangle_indices, const uint32 tri_idx)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE int3 load_texture_triangle (const int *triangle_indices, const uint32 tri_idx)
 
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE int3 load_lightmap_triangle (const int *triangle_indices, const uint32 tri_idx)
 
FERMAT_HOST_DEVICE float prim_area (const MeshView &mesh, const uint32 tri_id)
 
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)
 
FERMAT_HOST_DEVICE void setup_differential_geometry (const MeshView &mesh, const VertexGeometryId v, VertexGeometry *geom, float *pdf=0)
 
FERMAT_HOST_DEVICE cugar::Vector3f interpolate_position (const MeshView &mesh, const uint32 tri_id, const float u, const float v, float *pdf=0)
 
FERMAT_HOST_DEVICE cugar::Vector3f interpolate_position (const MeshView &mesh, const VertexGeometryId v, float *pdf=0)
 
FERMAT_HOST_DEVICE cugar::Vector3f interpolate_normal (const MeshView &mesh, const uint32 tri_id, const float u, const float v)
 
FERMAT_HOST_DEVICE cugar::Vector3f interpolate_normal (const MeshView &mesh, const VertexGeometryId v)
 
template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_dst_duv (const MeshView &mesh, const uint32 tri_id)
 
template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_duv_dst (const MeshView &mesh, const uint32 tri_id)
 
FERMAT_HOST_DEVICE cugar::Matrix3x2f prim_dp_duv (const MeshView &mesh, const uint32 tri_id)
 
FERMAT_HOST_DEVICE cugar::Matrix3x3f prim_dp_duvw (const MeshView &mesh, const uint32 tri_id)
 
template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix3x2f prim_dp_dst (const MeshView &mesh, const uint32 tri_id)
 
FERMAT_HOST_DEVICE cugar::Matrix3x3f prim_duvw_dp (const MeshView &mesh, const uint32 tri_id)
 
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_dtb_duv (const MeshView &mesh, const uint32 tri_id)
 
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_duv_dtb (const MeshView &mesh, const uint32 tri_id)
 
FERMAT_HOST_DEVICE cugar::Matrix2x3f prim_duv_dp (const MeshView &mesh, const uint32 tri_id)
 
template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x3f prim_dst_dp (const MeshView &mesh, const uint32 tri_id)
 
template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_dst_dtb (const MeshView &mesh, const uint32 tri_id)
 
template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_dtb_dst (const MeshView &mesh, const uint32 tri_id)
 
template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Vector2f prim_dst_ellipse_size (const MeshView &mesh, const uint32 tri_id)
 
template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE void prim_dst_ellipse (const MeshView &mesh, const uint32 tri_id, cugar::Matrix2x2f &u, cugar::Vector2f &s)
 

Function Documentation

◆ fetch_normal()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE const MeshView::normal_type& fetch_normal ( const MeshView mesh,
const uint32  vert_idx 
)

helper method to fetch a normal vertex

◆ fetch_tex_coord()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE const MeshView::texture_coord_type& fetch_tex_coord ( const MeshView mesh,
const uint32  vert_idx 
)

helper method to fetch a texture coordinate vertex

◆ fetch_vertex()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE const MeshView::vertex_type& fetch_vertex ( const MeshView mesh,
const uint32  vert_idx 
)

helper method to fetch a vertex

◆ interpolate_normal() [1/2]

FERMAT_HOST_DEVICE cugar::Vector3f interpolate_normal ( const MeshView mesh,
const uint32  tri_id,
const float  u,
const float  v 
)
inline

return the interpolated normal at a given point on the mesh, specified by a (prim_id, uv) pair

◆ interpolate_normal() [2/2]

FERMAT_HOST_DEVICE cugar::Vector3f interpolate_normal ( const MeshView mesh,
const VertexGeometryId  v 
)
inline

return the interpolated normal at a given point on the mesh, specified by a (prim_id, uv) pair

◆ interpolate_position() [1/2]

FERMAT_HOST_DEVICE cugar::Vector3f interpolate_position ( const MeshView mesh,
const uint32  tri_id,
const float  u,
const float  v,
float *  pdf = 0 
)
inline

return the interpolated position at a given point on the mesh, specified by a (prim_id, uv) pair

◆ interpolate_position() [2/2]

FERMAT_HOST_DEVICE cugar::Vector3f interpolate_position ( const MeshView mesh,
const VertexGeometryId  v,
float *  pdf = 0 
)
inline

return the interpolated position at a given point on the mesh, specified by a (prim_id, uv) pair

◆ load_lightmap_triangle()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE int3 load_lightmap_triangle ( const int *  triangle_indices,
const uint32  tri_idx 
)

helper method to fetch the lightmap coordinate indices of a given triangle

◆ load_normal_triangle()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE int3 load_normal_triangle ( const int *  triangle_indices,
const uint32  tri_idx 
)

helper method to fetch the normal indices of a given triangle

◆ load_texture_triangle()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE int3 load_texture_triangle ( const int *  triangle_indices,
const uint32  tri_idx 
)

helper method to fetch the texture coordinate indices of a given triangle

◆ load_vertex_triangle()

FERMAT_HOST_DEVICE FERMAT_FORCEINLINE int3 load_vertex_triangle ( const int *  triangle_indices,
const uint32  tri_idx 
)

helper method to fetch the vertex indices of a given triangle

◆ prim_area()

FERMAT_HOST_DEVICE float prim_area ( const MeshView mesh,
const uint32  tri_id 
)
inline

return the area of a given primitive

◆ prim_dp_dst()

template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix3x2f prim_dp_dst ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of dp wrt to (s,t) coordinates; specifically, the matrix which sends:

s=(1,0) in dp_ds t=(0,1) in dp_dt

◆ prim_dp_duv()

FERMAT_HOST_DEVICE cugar::Matrix3x2f prim_dp_duv ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of dp wrt to (u,v,w) coordinates; specifically, the matrix which sends:

u=(1,0) in dp_du v=(0,1) in dp_dv

◆ prim_dp_duvw()

FERMAT_HOST_DEVICE cugar::Matrix3x3f prim_dp_duvw ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of dp wrt to (u,v,w) coordinates; specifically, the matrix which sends:

u=(1,0,0) in dp_du v=(0,1,0) in dp_dv w=(0,0,1) in dp_dw

◆ prim_dst_dp()

template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x3f prim_dst_dp ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of (s,t) wrt to dp, where dp is expressed in the world coordinates; specifically, the matrix which sends:

dp_du in dst_du dp_dv in dst_dv

◆ prim_dst_dtb()

template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_dst_dtb ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of (s,t) wrt to dp, where dp is expressed in the local tangent frame (t,b); specifically, the matrix which sends:

t=(1,0) in dst_dt b=(0,1) in dst_db

◆ prim_dst_duv()

template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_dst_duv ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of (s,t) wrt to (u,v) coordinates; specifically, the matrix which sends:

u=(1,0) in dst_du v=(0,1) in dst_dv

◆ prim_dst_ellipse()

template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE void prim_dst_ellipse ( const MeshView mesh,
const uint32  tri_id,
cugar::Matrix2x2f u,
cugar::Vector2f s 
)
inline

return the the semi-axes of the differential texture-space (s,t) ellipse corresponding to a unit-radius circle on the local tangent plane.

Parameters
uoutput matrix storing the two semi-axes in the columns
soutput vector storing the length of the two semi-axes

◆ prim_dst_ellipse_size()

template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Vector2f prim_dst_ellipse_size ( const MeshView mesh,
const uint32  tri_id 
)
inline

return the length of the semi-axes of the differential texture-space (s,t) ellipse corresponding to a unit-radius circle on the local tangent plane.

◆ prim_dtb_dst()

template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_dtb_dst ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of dp wrt (s,t), where dp is expressed in the local tangent frame (t,b); specifically, the matrix which sends:

dst_dt in t=(1,0) dst_db in b=(0,1)

◆ prim_dtb_duv()

FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_dtb_duv ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of dp wrt to (u,v,w) coordinates, where dp is expressed in the local tangent frame (t,b); specifically, the matrix which sends:

u=(1,0) in the coordinates of dp_dpu wrt (t,b), and v=(0,1) in the coordinates of dp_dpv wrt (t,b)

◆ prim_duv_dp()

FERMAT_HOST_DEVICE cugar::Matrix2x3f prim_duv_dp ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of (u,v) wrt to dp; specifically, the matrix which sends:

dp_du in u=(1,0) dp_dv in v=(0,1)

◆ prim_duv_dst()

template<TextureSet TEXTURE_SET>
FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_duv_dst ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of (u,v) wrt (s,t) coordinates; specifically, the matrix which sends:

dst_du in u=(1,0) dst_dv in v=(0,1)

◆ prim_duv_dtb()

FERMAT_HOST_DEVICE cugar::Matrix2x2f prim_duv_dtb ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of (u,v) wrt to dp, where dp is expressed in the local tangent frame (t,b); specifically, the matrix which sends:

dp_du wrt (t,b) in u=(1,0) dp_dv wrt (t,b) in v=(0,1)

◆ prim_duvw_dp()

FERMAT_HOST_DEVICE cugar::Matrix3x3f prim_duvw_dp ( const MeshView mesh,
const uint32  tri_id 
)
inline

build a matrix representing the rate of change of (u,v,w) wrt to world coordinates; specifically, the matrix which sends:

dp_du in u=(1,0,0) dp_dv in v=(0,1,0) dp_dw in w=(0,0,1)

◆ setup_differential_geometry() [1/2]

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 
)
inline

return the differential geometry of a given point on the mesh, specified by a (prim_id, uv) pair

◆ setup_differential_geometry() [2/2]

FERMAT_HOST_DEVICE void setup_differential_geometry ( const MeshView mesh,
const VertexGeometryId  v,
VertexGeometry geom,
float *  pdf = 0 
)
inline

return the differential geometry of a given point on the mesh, specified by a (prim_id, uv) pair