NVIDIA IndeX API nvidia_logo_transpbg.gif Up
nv::index::IRendering_kernel_program_scene_element_mapping Class Referenceabstract

Scene attribute to map scene elements to slots that are accessible by user-programmable rendering kernel components. More...

#include <irendering_kernel_programs.h>

Inherits mi::base::Interface_declare< 0x8ecf51a1, ... >.

Public Types

enum  Query_reference {
  RELATIVE_QUERY_BOUNDING_BOX = 0 ,
  ABSOLUTE_QUERY_BOUNDING_BOX = 1
}
 A query bounding box may be applied relative to the data point or given in absolute spatial 3D values.
More...
 

Public Member Functions

virtual mi::Uint32 get_nb_slots () const =0
 Returns the number of slots available to assign mappings to. More...
 
virtual bool set_mapping (mi::Uint32 slot_idx, mi::neuraylib::Tag_struct data_tag)=0
 Maps a scene element to a slot. More...
 
virtual bool set_mapping (mi::Uint32 slot_idx, mi::neuraylib::Tag_struct data_tag, const mi::math::Bbox_struct< mi::Float32, 3 > &query_bbox, Query_reference reference=RELATIVE_QUERY_BOUNDING_BOX)=0
 Maps a scene element to a slot. More...
 
virtual mi::neuraylib::Tag_struct get_mapping (mi::Uint32 slot_idx) const =0
 Returns the mapping of a given slot. More...
 

Detailed Description

Scene attribute to map scene elements to slots that are accessible by user-programmable rendering kernel components.

The attribute is similar to IRendering_kernel_program_parameters, but instead of providing a user-defined buffer, it provides a fixed number of slots, where scene elements can be mapped to. These scene elements (e.g., ISparse_volume_scene_element can then be accessed inside a user-defined program using state.scene.access().

For example, consider the mapping attribute is applied to IPlane, mapping an existing ISparse_volume_scene_element to slot 1 by calling mapping_attribute.set_mapping(1, volume_tag). A IVolume_sample_program also applied to the plane may then access the volume data as follows:

NV_IDX_XAC_VERSION_1_0
class Volume_sample_program
{
public:
void initialize() {}
int execute(
const Sample_info_self& sample_info,
Sample_output& sample_output)
{
const int SLOT_ID = 1;
const auto volume = state.scene.access<xac::Regular_volume>(SLOT_ID);
const float v = volume.sample(sample_info.sample_position);
sample_output.color = make_float4(v, v, v, 1.f);
}
};
@ NV_IDX_PROG_OK
Indicate the sucessfull execution of the sampling program.
Definition: xac_interface_return_codes_doc.h:12
#define NV_IDX_DEVICE_INLINE_MEMBER
A member method's qualifier macro.
Definition: xac_interface_standard_lib_doc.h:15
#define NV_IDX_VOLUME_SAMPLE_PROGRAM
An initializing macro of a volume sample program.
Definition: xac_interface_standard_lib_doc.h:23

The scene element that should be mapped to a slot must be part of the scene description. When mapping attributes (IAttribute), they must be enabled and also assigned to the scene element to which this mapping attribute is assigned.

Member Enumeration Documentation

 Query_reference

A query bounding box may be applied relative to the data point or given in absolute spatial 3D values.

Enumerator
RELATIVE_QUERY_BOUNDING_BOX 

! Relative to the given data points of a distributed dataset.

ABSOLUTE_QUERY_BOUNDING_BOX 

! Spatial 3D bounding box given in absolute values in the local space.

Member Function Documentation

 get_mapping()

virtual mi::neuraylib::Tag_struct nv::index::IRendering_kernel_program_scene_element_mapping::get_mapping ( mi::Uint32  slot_idx) const
pure virtual

Returns the mapping of a given slot.

Parameters
[in]slot_idxSlot index, must be less than get_nb_slots().
Returns
Tag of the scene element that is mapped to the slot, or NULL_TAG if it is not mapped or the slot index is invalid.

 get_nb_slots()

virtual mi::Uint32 nv::index::IRendering_kernel_program_scene_element_mapping::get_nb_slots ( ) const
pure virtual

Returns the number of slots available to assign mappings to.

Returns
Number of slots available.

 set_mapping() [1/2]

virtual bool nv::index::IRendering_kernel_program_scene_element_mapping::set_mapping ( mi::Uint32  slot_idx,
mi::neuraylib::Tag_struct  data_tag 
)
pure virtual

Maps a scene element to a slot.

Parameters
[in]slot_idxSlot index, must be less than get_nb_slots().
[in]data_tagTag of a scene element. If NULL_TAG, an existing mapping is removed.
Returns
True is slot_idx is valid.

 set_mapping() [2/2]

virtual bool nv::index::IRendering_kernel_program_scene_element_mapping::set_mapping ( mi::Uint32  slot_idx,
mi::neuraylib::Tag_struct  data_tag,
const mi::math::Bbox_struct< mi::Float32, 3 > &  query_bbox,
Query_reference  reference = RELATIVE_QUERY_BOUNDING_BOX 
)
pure virtual

Maps a scene element to a slot.

Parameters
[in]slot_idxSlot index, must be less than get_nb_slots().
[in]data_tagTag of a scene element. If NULL_TAG, an existing mapping is removed.
[in]query_bboxBounding box ensuring that all data inside becomes available for use by the kernel program through the given slot id.
[in]referenceThe query reference indicates whether the query bounding box shall be applied relative to each data point or whether the bounding box represents a absolute spatial area for distributed data accessing.
Returns
Returns true if slot_idx is valid.

The documentation for this class was generated from the following file: