Functions and macros for XAC programs. More...
Macros | |
#define | printf_condition(PRINT_CONDITION, ...) |
Conditional printf. More... | |
#define | printf_thread(THREAD_ID_X, THREAD_ID_Y, ...) |
Conditional printf, thread id comparison. More... | |
#define | printf_block(BLOCK_ID_X, BLOCK_ID_Y, ...) |
Conditional printf, block id comparison. More... | |
#define | printf_pixel(STATE, PX, PY, ...) |
Conditional printf, pixel position More... | |
#define | printf_box(BOX_MIN, BOX_MAX, POSITION, ...) |
Conditional printf, inside bounding box More... | |
Enumerations | |
enum | NV_IDX_kernel_program_return_codes { NV_IDX_PROG_OK = 0x00 , NV_IDX_PROG_DISCARD_SAMPLE = 0x01 , NV_IDX_PROG_TERMINATE_PROGRAM_INSTANCE = 0x02 } |
Return codes for XAC programs. More... | |
Functions | |
float4 | nv::index::xaclib::gamma_correct (const float4 &color, float gamma_exp) |
Compute gamma correction of a given input color. More... | |
bool | nv::index::xaclib::is_inside_bounding_box (const float3 &box_min, const float3 &box_max, const float3 &position) |
Check if a given position inside an axis aligned bounding box. More... | |
uint2 | nv::index::xaclib::get_pixel_position (const xac::Scene &scene) |
Retrieve the pixel position for the current thread. More... | |
xac::Ray | nv::index::xaclib::transform_ray (const cuda::Mat4x4f &m, const xac::Ray &r) |
Transform a ray using the given matrix. More... | |
template<const xac::NV_IDX_volume_filter_types filter_type> | |
float3 | nv::index::xaclib::volume_gradient (const xac::Sparse_volume &volume, const float3 &sample_position, float dh=1.0f) |
Sample the gradient vector of a scalar volume using the reference volume. More... | |
template<const xac::Volume_filter_mode filter_mode, const xac::Volume_classification_mode classification_mode> | |
float3 | nv::index::xaclib::volume_gradient (const xac::Sparse_volume_sampler<float, filter_mode, classification_mode> &sampler, const float3 &sample_position, float dh=1.0f) |
Sample the gradient vector of a scalar volume using a given sampler reference (avoids sampler re-generation) More... | |
template<xac::Volume_filter_mode filter_mode, xac::Volume_classification_mode classification_mode> | |
NV_IDX_DEVICE_INLINE_MEMBER float3 | nv::index::xaclib::volume_gradient (const xac::Sparse_volume &sparse_volume, const xac::Sparse_volume_sample_context &sparse_volume_sample_context, const float3 &sample_position, unsigned sparse_volume_attrib_idx=0u, float dh=1.0f) |
Sample the gradient vector of a scalar volume with a given sample context (regenerates sampler) More... | |
float4 | nv::index::xaclib::headlight_shading (const xac::Scene &scene, const float3 &normal, const float3 &view_direction, const float4 &sample_color, const float4 &specular_color, const float diffuse_falloff=1.0f, const float shininess=100.0f, const float ambient_factor=0.f) |
Compute fixed headlight shading (light direction is view direction) More... | |
float4 | nv::index::xaclib::phong_shading (const xac::Scene &scene, const xac::Material_phong &material, const xac::Light &light, const float3 &view_direction, const float3 &normal, const bool two_sided=false) |
Compute Phong shaded color with predefined colors (ambient, diffuse, specular) More... | |
float4 | nv::index::xaclib::phong_shading (const xac::Scene &scene, const uint material_id, const uint light_id, const float3 &view_direction, const float3 &normal, const bool two_sided=false) |
Default Phong shading model. More... | |
bool | nv::index::xaclib::intersect_ray_plane (const xac::Ray &ray, const xac::Plane &plane, float &t_hit, float2 &tex_coord_hit) |
Ray-plane intersection. More... | |
bool | nv::index::xaclib::intersect_ray_box (const xac::Ray &ray, const float3 &box_min, const float3 &box_max, float &t_near, float &t_far) |
Ray-box intersection tests. More... | |
bool | nv::index::xaclib::intersect_ray_cylinder (const xac::Ray &ray, const xac::Cylinder &cylinder, float &t_hit, float3 &hit_normal) |
Ray-cylinder intersection tests. More... | |
bool | nv::index::xaclib::intersect_ray_ellipsoid (const xac::Ray &ray, const xac::Ellipsoid &ellipsoid, float &t_hit, float3 &hit_normal) |
Ray-cylinder intersection tests. More... | |
bool | nv::index::xaclib::intersect_ray_cone (const xac::Ray &ray, const xac::Cone &cone, float &t_hit, float3 &hit_normal) |
Ray-cylinder intersection tests. More... | |
template<typename TYPE> | |
const TYPE * | nv::index::xaclib::bind_device_buffer (uint slot_id, uint buffer_index) const |
Retrieve a CUDA buffer that has been assigned to the XAC program. More... | |
bool | nv::index::xaclib::device_buffer_available (uint slot_id) const |
Determines if a CUDA buffer that has been assigned to the XAC program. More... | |
Functions and macros for XAC programs.
The XAC interface also provides a set of convenience macros and functions for printing debugging information, transformation handling, basic shading operations and generic gradient operators.
#define printf_block | ( | BLOCK_ID_X, | |
BLOCK_ID_Y, | |||
... | |||
) |
Conditional printf, block id comparison.
#define printf_box | ( | BOX_MIN, | |
BOX_MAX, | |||
POSITION, | |||
... | |||
) |
Conditional printf, inside bounding box
#define printf_condition | ( | PRINT_CONDITION, | |
... | |||
) |
Conditional printf.
#define printf_pixel | ( | STATE, | |
PX, | |||
PY, | |||
... | |||
) |
Conditional printf, pixel position
#define printf_thread | ( | THREAD_ID_X, | |
THREAD_ID_Y, | |||
... | |||
) |
Conditional printf, thread id comparison.
Return codes for XAC programs.
const TYPE * nv::index::xaclib::bind_device_buffer | ( | uint | slot_id, |
uint | buffer_index | ||
) | const |
Retrieve a CUDA buffer that has been assigned to the XAC program.
The NVIDIA IndeX system can bind a buffer to an XAC program, e.g., to pass results of an inference operation to the subsequent rendering. For that, the contents of the buffer may contain arbitrary information to deal with the plethora of information that an inference operation produces.
The following illustrates the binding process of inference results when using an NVIDIA IndeX's inference technique:
Once passed to the NVIDIA IndeX system, the XAC progam can access the data as follows:
bool nv::index::xaclib::device_buffer_available | ( | uint | slot_id | ) | const |
Determines if a CUDA buffer that has been assigned to the XAC program.
float4 nv::index::xaclib::gamma_correct | ( | const float4 & | color, |
float | gamma_exp | ||
) |
Compute gamma correction of a given input color.
uint2 nv::index::xaclib::get_pixel_position | ( | const xac::Scene & | scene | ) |
Retrieve the pixel position for the current thread.
float4 nv::index::xaclib::headlight_shading | ( | const xac::Scene & | scene, |
const float3 & | normal, | ||
const float3 & | view_direction, | ||
const float4 & | sample_color, | ||
const float4 & | specular_color, | ||
const float | diffuse_falloff = 1.0f , |
||
const float | shininess = 100.0f , |
||
const float | ambient_factor = 0.f |
||
) |
Compute fixed headlight shading (light direction is view direction)
bool nv::index::xaclib::intersect_ray_box | ( | const xac::Ray & | ray, |
const float3 & | box_min, | ||
const float3 & | box_max, | ||
float & | t_near, | ||
float & | t_far | ||
) |
Ray-box intersection tests.
bool nv::index::xaclib::intersect_ray_cone | ( | const xac::Ray & | ray, |
const xac::Cone & | cone, | ||
float & | t_hit, | ||
float3 & | hit_normal | ||
) |
Ray-cylinder intersection tests.
bool nv::index::xaclib::intersect_ray_cylinder | ( | const xac::Ray & | ray, |
const xac::Cylinder & | cylinder, | ||
float & | t_hit, | ||
float3 & | hit_normal | ||
) |
Ray-cylinder intersection tests.
bool nv::index::xaclib::intersect_ray_ellipsoid | ( | const xac::Ray & | ray, |
const xac::Ellipsoid & | ellipsoid, | ||
float & | t_hit, | ||
float3 & | hit_normal | ||
) |
Ray-cylinder intersection tests.
bool nv::index::xaclib::intersect_ray_plane | ( | const xac::Ray & | ray, |
const xac::Plane & | plane, | ||
float & | t_hit, | ||
float2 & | tex_coord_hit | ||
) |
Ray-plane intersection.
bool nv::index::xaclib::is_inside_bounding_box | ( | const float3 & | box_min, |
const float3 & | box_max, | ||
const float3 & | position | ||
) |
Check if a given position inside an axis aligned bounding box.
float4 nv::index::xaclib::phong_shading | ( | const xac::Scene & | scene, |
const uint | material_id, | ||
const uint | light_id, | ||
const float3 & | view_direction, | ||
const float3 & | normal, | ||
const bool | two_sided = false |
||
) |
Default Phong shading model.
float4 nv::index::xaclib::phong_shading | ( | const xac::Scene & | scene, |
const xac::Material_phong & | material, | ||
const xac::Light & | light, | ||
const float3 & | view_direction, | ||
const float3 & | normal, | ||
const bool | two_sided = false |
||
) |
Compute Phong shaded color with predefined colors (ambient, diffuse, specular)
Transform a ray using the given matrix.
NV_IDX_DEVICE_INLINE_MEMBER float3 nv::index::xaclib::volume_gradient | ( | const xac::Sparse_volume & | sparse_volume, |
const xac::Sparse_volume_sample_context & | sparse_volume_sample_context, | ||
const float3 & | sample_position, | ||
unsigned | sparse_volume_attrib_idx = 0u , |
||
float | dh = 1.0f |
||
) |
Sample the gradient vector of a scalar volume with a given sample context (regenerates sampler)
float3 nv::index::xaclib::volume_gradient | ( | const xac::Sparse_volume & | volume, |
const float3 & | sample_position, | ||
float | dh = 1.0f |
||
) |
Sample the gradient vector of a scalar volume using the reference volume.
float3 nv::index::xaclib::volume_gradient | ( | const xac::Sparse_volume_sampler<float, filter_mode, classification_mode> & | sampler, |
const float3 & | sample_position, | ||
float | dh = 1.0f |
||
) |
Sample the gradient vector of a scalar volume using a given sampler reference (avoids sampler re-generation)