38 #include <cugar/linalg/vector.h> 39 #include <cugar/bsdf/differential_geometry.h> 41 #include <cuda_fp16.h> 64 #if defined(OPTIX_COMPILATION) 84 r.normal_s = normal_s;
85 r.normal_g = normal_g;
87 r.binormal = binormal;
114 VertexGeometryId(
const uint32 _prim_id,
const float _u,
const float _v) : prim_id(_prim_id), uv(_u, _v) {}
117 VertexGeometryId(
const uint32 _prim_id,
const cugar::Vector2f _uv) : prim_id(_prim_id), uv(_uv) {}
122 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
132 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
136 float((packed_dir >> 0) & 0xFFFFu) /
float(0xFFFFu),
137 float((packed_dir >> 16) & 0xFFFFu) /
float(0xFFFFu));
142 #if defined(__CUDACC__) 146 FERMAT_DEVICE FERMAT_FORCEINLINE
150 cugar::Vector2f enc = cugar::normalize(dir.xy()) * sqrtf(-dir.z*0.5f + 0.5f);
152 half2 h = __floats2half2_rn(enc.x, enc.y);
157 FERMAT_DEVICE FERMAT_FORCEINLINE
158 cugar::Vector3f unpack_hemispherical_direction(
const uint32 packed_dir)
161 float2 u = __half22float2( cugar::binary_cast<half2>(packed_dir) );
166 const float l = 1 - u.x*u.x - u.y*u.y;
167 const float m = 2 * sqrtf(l);
CUGAR_HOST_DEVICE uint32 quantize(const float x, const uint32 n)
Definition: numbers.h:600
Defines various spherical mappings.
CUGAR_HOST CUGAR_DEVICE Vector2f uniform_sphere_to_square(const Vector3f &vec)
Definition: mappings_inline.h:174
Definition: differential_geometry.h:59
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE uint32 pack_direction(const cugar::Vector3f &dir)
Definition: vertex.h:123
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Out binary_cast(const In in)
Definition: types.h:288
CUGAR_HOST CUGAR_DEVICE Vector3f uniform_square_to_sphere(const Vector2f &uv)
Definition: mappings_inline.h:162
FERMAT_HOST_DEVICE FERMAT_FORCEINLINE cugar::Vector3f unpack_direction(const uint32 packed_dir)
Definition: vertex.h:133