OptiX  3.9
NVIDIA OptiX Acceleration Engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions
optixu.h File Reference

Detailed Description

Simple API for performing raytracing queries using OptiX or the CPU.

Go to the source code of this file.

Macros

#define RTU_INLINE   static inline
 
#define RTU_CHECK_ERROR(func)
 
#define RTU_GROUP_ADD_CHILD(_parent, _child, _index)
 
#define RTU_SELECTOR_ADD_CHILD(_parent, _child, _index)
 

Functions

RTresult RTAPI rtuNameForType (RTobjecttype type, char *buffer, RTsize bufferSize)
 
RTresult RTAPI rtuGetSizeForRTformat (RTformat format, size_t *size)
 
RTresult RTAPI rtuCUDACompileString (const char *source, const char **preprocessorArguments, unsigned int numPreprocessorArguments, RTsize *resultSize, RTsize *errorSize)
 
RTresult RTAPI rtuCUDACompileFile (const char *filename, const char **preprocessorArguments, unsigned int numPreprocessorArguments, RTsize *resultSize, RTsize *errorSize)
 
RTresult RTAPI rtuCUDAGetCompileResult (char *result, char *error)
 
RTresult RTAPI rtuCreateClusteredMesh (RTcontext context, unsigned int usePTX32InHost64, RTgeometry *mesh, unsigned int num_verts, const float *verts, unsigned int num_tris, const unsigned *indices, const unsigned *mat_indices)
 
RTresult RTAPI rtuCreateClusteredMeshExt (RTcontext context, unsigned int usePTX32InHost64, RTgeometry *mesh, unsigned int num_verts, const float *verts, unsigned int num_tris, const unsigned *indices, const unsigned *mat_indices, RTbuffer norms, const unsigned *norm_indices, RTbuffer tex_coords, const unsigned *tex_indices)
 
RTU_INLINE RTresult rtuGroupAddChild (RTgroup group, RTobject child, unsigned int *index)
 
RTU_INLINE RTresult rtuSelectorAddChild (RTselector selector, RTobject child, unsigned int *index)
 
RTU_INLINE RTresult rtuGeometryGroupAddChild (RTgeometrygroup geometrygroup, RTgeometryinstance child, unsigned int *index)
 
RTU_INLINE RTresult rtuTransformSetChild (RTtransform transform, RTobject child)
 
RTU_INLINE RTresult rtuTransformGetChild (RTtransform transform, RTobject *type)
 
RTU_INLINE RTresult rtuTransformGetChildType (RTtransform transform, RTobjecttype *type)
 
RTU_INLINE RTresult rtuGroupRemoveChild (RTgroup group, RTobject child)
 
RTU_INLINE RTresult rtuSelectorRemoveChild (RTselector selector, RTobject child)
 
RTU_INLINE RTresult rtuGeometryGroupRemoveChild (RTgeometrygroup geometrygroup, RTgeometryinstance child)
 
RTU_INLINE RTresult rtuGroupRemoveChildByIndex (RTgroup group, unsigned int index)
 
RTU_INLINE RTresult rtuSelectorRemoveChildByIndex (RTselector selector, unsigned int index)
 
RTU_INLINE RTresult rtuGeometryGroupRemoveChildByIndex (RTgeometrygroup geometrygroup, unsigned int index)
 
RTU_INLINE RTresult rtuGroupGetChildIndex (RTgroup group, RTobject child, unsigned int *index)
 
RTU_INLINE RTresult rtuSelectorGetChildIndex (RTselector selector, RTobject child, unsigned int *index)
 
RTU_INLINE RTresult rtuGeometryGroupGetChildIndex (RTgeometrygroup geometrygroup, RTgeometryinstance child, unsigned int *index)
 

Macro Definition Documentation

#define RTU_CHECK_ERROR (   func)
Value:
do { \
RTresult code = func; \
if( code != RT_SUCCESS ) \
return code; \
} while(0)
RTresult
Definition: optix_declarations.h:236
Definition: optix_declarations.h:238
#define RTU_GROUP_ADD_CHILD (   _parent,
  _child,
  _index 
)
Value:
unsigned int _count; \
RTU_CHECK_ERROR( rtGroupGetChildCount( (_parent), &_count ) ); \
RTU_CHECK_ERROR( rtGroupSetChildCount( (_parent), _count+1 ) ); \
RTU_CHECK_ERROR( rtGroupSetChild( (_parent), _count, (_child) ) ); \
if( _index ) *(_index) = _count; \
return RT_SUCCESS
RTresult RTAPI rtGroupGetChildCount(RTgroup group, unsigned int *count)
Returns the number of child slots for a group.
RTresult RTAPI rtGroupSetChild(RTgroup group, unsigned int index, RTobject child)
Attaches a child node to a group.
RTresult RTAPI rtGroupSetChildCount(RTgroup group, unsigned int count)
Sets the number of child nodes to be attached to the group.
Definition: optix_declarations.h:238
#define RTU_SELECTOR_ADD_CHILD (   _parent,
  _child,
  _index 
)
Value:
unsigned int _count; \
RTU_CHECK_ERROR( rtSelectorGetChildCount( (_parent), &_count ) ); \
RTU_CHECK_ERROR( rtSelectorSetChildCount( (_parent), _count+1 ) ); \
RTU_CHECK_ERROR( rtSelectorSetChild( (_parent), _count, (_child) ) ); \
if( _index ) *(_index) = _count; \
return RT_SUCCESS
RTresult RTAPI rtSelectorSetChild(RTselector selector, unsigned int index, RTobject child)
Attaches a child node to a Selector node.
RTresult RTAPI rtSelectorGetChildCount(RTselector selector, unsigned int *count)
Returns the number of child node slots of a Selector node.
Definition: optix_declarations.h:238
RTresult RTAPI rtSelectorSetChildCount(RTselector selector, unsigned int count)
Specifies the number of child nodes to be attached to a Selector node.

Function Documentation

RTresult RTAPI rtuCreateClusteredMesh ( RTcontext  context,
unsigned int  usePTX32InHost64,
RTgeometry mesh,
unsigned int  num_verts,
const float *  verts,
unsigned int  num_tris,
const unsigned *  indices,
const unsigned *  mat_indices 
)

Create clustered triangle mesh for good memory coherence with paging on. Vertex, index and material buffers are created and attached to the mesh. Cluster's bounding box and intersection programs are attached to the mesh. The intersection program has the following attributes:

Created RTgeometry mesh expects there to be placed into a RTgeometryinstance where the mat_indices specified map into materials attached to the RTgeometryinstance

In the event of an error, please query the error string from the RTcontext.

Parameters
contextContext
usePTX32InHost64Use 32bit PTX bounding box and intersection programs in 64bit application. Takes effect only with 64bit host.
meshOutput geometry
num_vertsVertex count
vertsVertices (num_verts*float*3) [ v1_x, v1_y, v1_z, v2.x, ... ]
num_trisTriangle count
indicesVertex indices (num_tris*unsigned*3) [ tri1_index1, tr1_index2, ... ]
mat_indicesIndices of materials (num_tris*unsigned) [ tri1_mat_index, tri2_mat_index, ... ]
RTresult RTAPI rtuCreateClusteredMeshExt ( RTcontext  context,
unsigned int  usePTX32InHost64,
RTgeometry mesh,
unsigned int  num_verts,
const float *  verts,
unsigned int  num_tris,
const unsigned *  indices,
const unsigned *  mat_indices,
RTbuffer  norms,
const unsigned *  norm_indices,
RTbuffer  tex_coords,
const unsigned *  tex_indices 
)

Create clustered triangle mesh for good memory coherence with paging on. Buffers for vertices, indices, normals, indices of normals, texture coordinates, indices of texture coordinates and materials are created and attached to the mesh. Cluster's bounding box and intersection programs are attached to the mesh. The intersection program has the following attributes:

Created RTgeometry mesh expects there to be placed into a RTgeometryinstance where the mat_indices specified map into materials attached to the RTgeometryinstance

Vertex, normal and texture coordinate buffers can be shared between many geometry objects

In the event of an error, please query the error string from the RTcontext.

Parameters
contextContext
usePTX32InHost64Use 32bit PTX bounding box and intersection programs in 64bit application. Takes effect only with 64bit host.
meshOutput geometry
num_vertsVertex count
vertsVertices (num_verts*float*3) [ v1_x, v1_y, v1_z, v2.x, ... ]
num_trisTriangle count
indicesVertex indices (num_tris*unsigned*3) [ tri1_index1, tr1_index2, ... ]
mat_indicesIndices of materials (num_tris*unsigned) [ tri1_mat_index, tri2_mat_index, ... ]
normsNormals (num_norms*float*3) [ v1_x, v1_y, v1_z, v2.x, ... ]
norm_indicesIndices of vertex normals (num_tris*unsigned*3) [ tri1_norm_index1, tri1_norm_index2 ... ]
tex_coordsTexture uv coords (num_tex_coords*float*2) [ t1_u, t1_v, t2_u ... ]
tex_indicesIndices of texture uv (num_tris*unsigned*3) [ tri1_tex_index1, tri1_tex_index2 ... ]
RTresult RTAPI rtuCUDACompileFile ( const char *  filename,
const char **  preprocessorArguments,
unsigned int  numPreprocessorArguments,
RTsize *  resultSize,
RTsize *  errorSize 
)

Compile a cuda source file.

Parameters
[in]filenamesource code file name
[in]preprocessorArgumentslist of preprocessor arguments
[in]numPreprocessorArgumentsnumber of preprocessor arguments
[out]resultSizesize required to hold compiled result string
[out]errorSizesize required to hold error string
Return values
RTresultReturn code
RTresult RTAPI rtuCUDACompileString ( const char *  source,
const char **  preprocessorArguments,
unsigned int  numPreprocessorArguments,
RTsize *  resultSize,
RTsize *  errorSize 
)

Compile a cuda source string.

Parameters
[in]sourcesource code string
[in]preprocessorArgumentslist of preprocessor arguments
[in]numPreprocessorArgumentsnumber of preprocessor arguments
[out]resultSizesize required to hold compiled result string
[out]errorSizesize required to hold error string
Return values
RTresultReturn code
RTresult RTAPI rtuCUDAGetCompileResult ( char *  result,
char *  error 
)

Get the result of the most recent call to one of the above compile functions. The 'result' and 'error' parameters must point to memory large enough to hold the respective strings, as returned by the compile function.

Parameters
[out]resultcompiled result string
[out]errorerror string
Return values
RTresultReturn code
RTU_INLINE RTresult rtuGeometryGroupAddChild ( RTgeometrygroup  geometrygroup,
RTgeometryinstance  child,
unsigned int *  index 
)

Add an entry to the end of the child array. Fills 'index' with the index of the added child, if the pointer is non-NULL.

RTU_INLINE RTresult rtuGeometryGroupGetChildIndex ( RTgeometrygroup  geometrygroup,
RTgeometryinstance  child,
unsigned int *  index 
)

Use a linear search to find the child in the child array, and return its index. Returns RT_SUCCESS if the child was found, RT_ERROR_INVALID_VALUE otherwise.

RTU_INLINE RTresult rtuGeometryGroupRemoveChild ( RTgeometrygroup  geometrygroup,
RTgeometryinstance  child 
)

Find the given child using a linear search in the child array and remove it. If it's not the last entry in the child array, the last entry in the array will replace the deleted entry, in order to shrink the array size by one.

RTU_INLINE RTresult rtuGeometryGroupRemoveChildByIndex ( RTgeometrygroup  geometrygroup,
unsigned int  index 
)

Remove the child at the given index in the child array. If it's not the last entry in the child array, the last entry in the array will replace the deleted entry, in order to shrink the array size by one.

RTresult RTAPI rtuGetSizeForRTformat ( RTformat  format,
size_t *  size 
)

Return the size of a given RTformat. RT_FORMAT_USER and RT_FORMAT_UNKNOWN return 0. Returns RT_ERROR_INVALID_VALUE if the format isn't recognized, RT_SUCCESS otherwise.

Parameters
[in]formatOptiX format
[out]sizeSize of the format
Return values
RTresultReturn code
RTU_INLINE RTresult rtuGroupAddChild ( RTgroup  group,
RTobject  child,
unsigned int *  index 
)

Add an entry to the end of the child array. Fills 'index' with the index of the added child, if the pointer is non-NULL.

RTU_INLINE RTresult rtuGroupGetChildIndex ( RTgroup  group,
RTobject  child,
unsigned int *  index 
)

Use a linear search to find the child in the child array, and return its index. Returns RT_SUCCESS if the child was found, RT_ERROR_INVALID_VALUE otherwise.

RTU_INLINE RTresult rtuGroupRemoveChild ( RTgroup  group,
RTobject  child 
)

Find the given child using a linear search in the child array and remove it. If it's not the last entry in the child array, the last entry in the array will replace the deleted entry, in order to shrink the array size by one.

RTU_INLINE RTresult rtuGroupRemoveChildByIndex ( RTgroup  group,
unsigned int  index 
)

Remove the child at the given index in the child array. If it's not the last entry in the child array, the last entry in the array will replace the deleted entry, in order to shrink the array size by one.

RTresult RTAPI rtuNameForType ( RTobjecttype  type,
char *  buffer,
RTsize  bufferSize 
)

Get the name string of a given type. See RTobjecttype for more information.

Parameters
[in]typeType requested
[out]bufferBuffer to output the name string
[in]bufferSizeSize of the provided buffer
Return values
RTresultReturn code
RTU_INLINE RTresult rtuSelectorAddChild ( RTselector  selector,
RTobject  child,
unsigned int *  index 
)

Add an entry to the end of the child array. Fills 'index' with the index of the added child, if the pointer is non-NULL.

RTU_INLINE RTresult rtuSelectorGetChildIndex ( RTselector  selector,
RTobject  child,
unsigned int *  index 
)

Use a linear search to find the child in the child array, and return its index. Returns RT_SUCCESS if the child was found, RT_ERROR_INVALID_VALUE otherwise.

RTU_INLINE RTresult rtuSelectorRemoveChild ( RTselector  selector,
RTobject  child 
)

Find the given child using a linear search in the child array and remove it. If it's not the last entry in the child array, the last entry in the array will replace the deleted entry, in order to shrink the array size by one.

RTU_INLINE RTresult rtuSelectorRemoveChildByIndex ( RTselector  selector,
unsigned int  index 
)

Remove the child at the given index in the child array. If it's not the last entry in the child array, the last entry in the array will replace the deleted entry, in order to shrink the array size by one.

RTU_INLINE RTresult rtuTransformGetChild ( RTtransform  transform,
RTobject type 
)

Wrap rtTransformGetChild and rtTransformGetChildType in order to provide a type-safe version for C++.

RTU_INLINE RTresult rtuTransformGetChildType ( RTtransform  transform,
RTobjecttype type 
)

Wrap rtTransformGetChild and rtTransformGetChildType in order to provide a type-safe version for C++.

RTU_INLINE RTresult rtuTransformSetChild ( RTtransform  transform,
RTobject  child 
)

Wrap rtTransformSetChild in order to provide a type-safe version for C++.