| optix.h | | optix.h | |
| | | | |
| skipping to change at line 22 | | skipping to change at line 22 | |
| * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR
IMPLIED, | | * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR
IMPLIED, | |
| * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A | | * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A | |
| * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE
FOR ANY | | * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE
FOR ANY | |
| * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCL
UDING, WITHOUT | | * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCL
UDING, WITHOUT | |
| * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
LOSS OF | | * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
LOSS OF | |
| * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE US
E OF OR | | * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE US
E OF OR | |
| * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE P
OSSIBILITY OF | | * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE P
OSSIBILITY OF | |
| * SUCH DAMAGES | | * SUCH DAMAGES | |
| */ | | */ | |
| | | | |
|
| | | /************************************************************************** | |
| | | ****\ | |
| | | * | |
| | | * Primary OptiX include file -- includes the host api if compiling host co | |
| | | de, | |
| | | * includes the cuda api if compiling device | |
| | | code | |
| | | * | |
| | | * For the math library routines include optix_math.h. | |
| | | * | |
| | | \************************************************************************** | |
| | | ****/ | |
| | | | |
| #ifndef __optix_optix_h__ | | #ifndef __optix_optix_h__ | |
| #define __optix_optix_h__ | | #define __optix_optix_h__ | |
| | | | |
|
| #define OPTIX_VERSION 1000 /* 1.0.0 (major = OPTIX_VERSION/1000, minor = (O | | #define OPTIX_VERSION 2000 /* 2.0.0 (major = OPTIX_VERSION/1000, * | |
| PTIX_VERSION%1000)/10, micro = OPTIX_VERSION%10 */ | | * minor = (OPTIX_VERSION%1000)/10, * | |
| | | * micro = OPTIX_VERSION%10 */ | |
| #ifndef RTAPI | | | |
| #if defined( _WIN32 ) | | | |
| #define RTAPI __declspec(dllimport) | | | |
| #else | | | |
| #define RTAPI | | | |
| #endif | | | |
| #endif | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Platform-Dependent Types | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| #if defined( _WIN64 ) | | | |
| typedef unsigned __int64 RTsize; | | | |
| #elif defined( _WIN32 ) | | | |
| typedef unsigned int RTsize; | | | |
| #else | | | |
| typedef long unsigned int RTsize; | | | |
| #endif | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Opaque Object Types | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| #ifdef __cplusplus | | | |
| namespace optix { | | | |
| class Acceleration; | | | |
| class Buffer; | | | |
| class Context; | | | |
| class Geometry; | | | |
| class GeometryInstance; | | | |
| class GeometryGroup; | | | |
| class Group; | | | |
| class Material; | | | |
| class Program; | | | |
| class Selector; | | | |
| class TextureSampler; | | | |
| class Transform; | | | |
| class Variable; | | | |
| }; | | | |
| | | | |
|
| typedef optix::Acceleration * RTacceleration; | | #ifdef __CUDACC__ | |
| typedef optix::Buffer * RTbuffer; | | # include "optix_device.h" | |
| typedef optix::Context * RTcontext; | | | |
| typedef optix::Geometry * RTgeometry; | | | |
| typedef optix::GeometryInstance * RTgeometryinstance; | | | |
| typedef optix::GeometryGroup * RTgeometrygroup; | | | |
| typedef optix::Group * RTgroup; | | | |
| typedef optix::Material * RTmaterial; | | | |
| typedef optix::Program * RTprogram; | | | |
| typedef optix::Selector * RTselector; | | | |
| typedef optix::TextureSampler * RTtexturesampler; | | | |
| typedef optix::Transform * RTtransform; | | | |
| typedef optix::Variable * RTvariable; | | | |
| #else | | #else | |
|
| /* C opaque types */ | | # include "optix_host.h" | |
| typedef struct RTacceleration_api * RTacceleration; | | | |
| typedef struct RTbuffer_api * RTbuffer; | | | |
| typedef struct RTcontext_api * RTcontext; | | | |
| typedef struct RTgeometry_api * RTgeometry; | | | |
| typedef struct RTgeometryinstance_api * RTgeometryinstance; | | | |
| typedef struct RTgeometrygroup_api * RTgeometrygroup; | | | |
| typedef struct RTgroup_api * RTgroup; | | | |
| typedef struct RTmaterial_api * RTmaterial; | | | |
| typedef struct RTprogram_api * RTprogram; | | | |
| typedef struct RTselector_api * RTselector; | | | |
| typedef struct RTtexturesampler_api * RTtexturesampler; | | | |
| typedef struct RTtransform_api * RTtransform; | | | |
| typedef struct RTvariable_api * RTvariable; | | | |
| #endif | | | |
| | | | |
| typedef void * RTobject; | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Enumerated values | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| #ifdef __cplusplus | | | |
| extern "C" { | | | |
| #endif | | | |
| | | | |
| typedef enum | | | |
| { | | | |
| RT_FORMAT_UNKNOWN = 0x100, | | | |
| RT_FORMAT_FLOAT, | | | |
| RT_FORMAT_FLOAT2, | | | |
| RT_FORMAT_FLOAT3, | | | |
| RT_FORMAT_FLOAT4, | | | |
| RT_FORMAT_BYTE, | | | |
| RT_FORMAT_BYTE2, | | | |
| RT_FORMAT_BYTE3, | | | |
| RT_FORMAT_BYTE4, | | | |
| RT_FORMAT_UNSIGNED_BYTE, | | | |
| RT_FORMAT_UNSIGNED_BYTE2, | | | |
| RT_FORMAT_UNSIGNED_BYTE3, | | | |
| RT_FORMAT_UNSIGNED_BYTE4, | | | |
| RT_FORMAT_SHORT, | | | |
| RT_FORMAT_SHORT2, | | | |
| RT_FORMAT_SHORT3, | | | |
| RT_FORMAT_SHORT4, | | | |
| RT_FORMAT_UNSIGNED_SHORT, | | | |
| RT_FORMAT_UNSIGNED_SHORT2, | | | |
| RT_FORMAT_UNSIGNED_SHORT3, | | | |
| RT_FORMAT_UNSIGNED_SHORT4, | | | |
| RT_FORMAT_INT, | | | |
| RT_FORMAT_INT2, | | | |
| RT_FORMAT_INT3, | | | |
| RT_FORMAT_INT4, | | | |
| RT_FORMAT_UNSIGNED_INT, | | | |
| RT_FORMAT_UNSIGNED_INT2, | | | |
| RT_FORMAT_UNSIGNED_INT3, | | | |
| RT_FORMAT_UNSIGNED_INT4, | | | |
| RT_FORMAT_USER | | | |
| } RTformat; | | | |
| | | | |
| typedef enum | | | |
| { | | | |
| RT_OBJECTTYPE_UNKNOWN = 0x200, | | | |
| RT_OBJECTTYPE_GROUP, | | | |
| RT_OBJECTTYPE_GEOMETRY_GROUP, | | | |
| RT_OBJECTTYPE_TRANSFORM, | | | |
| RT_OBJECTTYPE_SELECTOR, | | | |
| RT_OBJECTTYPE_GEOMETRY_INSTANCE, | | | |
| RT_OBJECTTYPE_BUFFER, | | | |
| RT_OBJECTTYPE_TEXTURE_SAMPLER, | | | |
| RT_OBJECTTYPE_OBJECT, | | | |
| | | | |
| RT_OBJECTTYPE_MATRIX_FLOAT2x2, | | | |
| RT_OBJECTTYPE_MATRIX_FLOAT2x3, | | | |
| RT_OBJECTTYPE_MATRIX_FLOAT2x4, | | | |
| RT_OBJECTTYPE_MATRIX_FLOAT3x2, | | | |
| RT_OBJECTTYPE_MATRIX_FLOAT3x3, | | | |
| RT_OBJECTTYPE_MATRIX_FLOAT3x4, | | | |
| RT_OBJECTTYPE_MATRIX_FLOAT4x2, | | | |
| RT_OBJECTTYPE_MATRIX_FLOAT4x3, | | | |
| RT_OBJECTTYPE_MATRIX_FLOAT4x4, | | | |
| | | | |
| RT_OBJECTTYPE_FLOAT, | | | |
| RT_OBJECTTYPE_FLOAT2, | | | |
| RT_OBJECTTYPE_FLOAT3, | | | |
| RT_OBJECTTYPE_FLOAT4, | | | |
| RT_OBJECTTYPE_INT, | | | |
| RT_OBJECTTYPE_INT2, | | | |
| RT_OBJECTTYPE_INT3, | | | |
| RT_OBJECTTYPE_INT4, | | | |
| RT_OBJECTTYPE_UNSIGNED_INT, | | | |
| RT_OBJECTTYPE_UNSIGNED_INT2, | | | |
| RT_OBJECTTYPE_UNSIGNED_INT3, | | | |
| RT_OBJECTTYPE_UNSIGNED_INT4, | | | |
| RT_OBJECTTYPE_USER | | | |
| } RTobjecttype; | | | |
| | | | |
| typedef enum | | | |
| { | | | |
| RT_WRAP_REPEAT, | | | |
| RT_WRAP_CLAMP_TO_EDGE | | | |
| } RTwrapmode; | | | |
| | | | |
| typedef enum | | | |
| { | | | |
| RT_FILTER_NEAREST, | | | |
| RT_FILTER_LINEAR, | | | |
| RT_FILTER_NONE | | | |
| } RTfiltermode; | | | |
| | | | |
| typedef enum | | | |
| { | | | |
| RT_TEXTURE_READ_ELEMENT_TYPE, | | | |
| RT_TEXTURE_READ_NORMALIZED_FLOAT | | | |
| } RTtexturereadmode; | | | |
| | | | |
| typedef enum | | | |
| { | | | |
| RT_TEXTURE_INDEX_NORMALIZED_COORDINATES, | | | |
| RT_TEXTURE_INDEX_ARRAY_INDEX | | | |
| } RTtextureindexmode; | | | |
| | | | |
| typedef enum | | | |
| { | | | |
| RT_BUFFER_INPUT = 0x1, | | | |
| RT_BUFFER_OUTPUT = 0x2, | | | |
| RT_BUFFER_INPUT_OUTPUT = RT_BUFFER_INPUT | RT_BUFFER_OUTPUT | | | |
| } RTbuffertype; | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Error codes | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| typedef enum | | | |
| { | | | |
| RT_SUCCESS = 0, | | | |
| | | | |
| RT_ERROR_INVALID_CONTEXT = 0x500, | | | |
| RT_ERROR_INVALID_VALUE = 0x501, | | | |
| RT_ERROR_MEMORY_ALLOCATION_FAILED = 0x502, | | | |
| RT_ERROR_TYPE_MISMATCH = 0x503, | | | |
| RT_ERROR_VARIABLE_NOT_FOUND = 0x504, | | | |
| RT_ERROR_VARIABLE_REDECLARED = 0x505, | | | |
| RT_ERROR_ILLEGAL_SYMBOL = 0x506, | | | |
| RT_ERROR_INVALID_SOURCE = 0x507, | | | |
| RT_ERROR_VERSION_MISMATCH = 0x508, | | | |
| | | | |
| RT_ERROR_OBJECT_CREATION_FAILED = 0x600, | | | |
| RT_ERROR_NO_DEVICE = 0x601, | | | |
| RT_ERROR_INVALID_DEVICE = 0x602, | | | |
| RT_ERROR_INVALID_IMAGE = 0x603, | | | |
| RT_ERROR_FILE_NOT_FOUND = 0x604, | | | |
| RT_ERROR_ALREADY_MAPPED = 0x605, | | | |
| RT_ERROR_INVALID_DRIVER_VERSION = 0x606, | | | |
| | | | |
| RT_ERROR_LAUNCH_FAILED = 0x900, | | | |
| | | | |
| RT_ERROR_UNKNOWN = ~0, | | | |
| } RTresult; | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Context-free functions | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtGetVersion(unsigned int* version); | | | |
| RTresult RTAPI rtDeviceGetDeviceCount(unsigned int* count); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Object Variable Accessors | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| /* Sets */ | | | |
| RTresult RTAPI rtVariableSet1f (RTvariable v, float f1); | | | |
| RTresult RTAPI rtVariableSet2f (RTvariable v, float f1, float f2); | | | |
| RTresult RTAPI rtVariableSet3f (RTvariable v, float f1, float f2, float f | | | |
| 3); | | | |
| RTresult RTAPI rtVariableSet4f (RTvariable v, float f1, float f2, float f | | | |
| 3, float f4); | | | |
| RTresult RTAPI rtVariableSet1fv(RTvariable v, const float* f); | | | |
| RTresult RTAPI rtVariableSet2fv(RTvariable v, const float* f); | | | |
| RTresult RTAPI rtVariableSet3fv(RTvariable v, const float* f); | | | |
| RTresult RTAPI rtVariableSet4fv(RTvariable v, const float* f); | | | |
| | | | |
| RTresult RTAPI rtVariableSet1i (RTvariable v, int i1); | | | |
| RTresult RTAPI rtVariableSet2i (RTvariable v, int i1, int i2); | | | |
| RTresult RTAPI rtVariableSet3i (RTvariable v, int i1, int i2, int i3); | | | |
| RTresult RTAPI rtVariableSet4i (RTvariable v, int i1, int i2, int i3, int | | | |
| i4); | | | |
| RTresult RTAPI rtVariableSet1iv(RTvariable v, const int* i); | | | |
| RTresult RTAPI rtVariableSet2iv(RTvariable v, const int* i); | | | |
| RTresult RTAPI rtVariableSet3iv(RTvariable v, const int* i); | | | |
| RTresult RTAPI rtVariableSet4iv(RTvariable v, const int* i); | | | |
| | | | |
| RTresult RTAPI rtVariableSet1ui (RTvariable v, unsigned int u1); | | | |
| RTresult RTAPI rtVariableSet2ui (RTvariable v, unsigned int u1, unsigned | | | |
| int u2); | | | |
| RTresult RTAPI rtVariableSet3ui (RTvariable v, unsigned int u1, unsigned | | | |
| int u2, unsigned int u3); | | | |
| RTresult RTAPI rtVariableSet4ui (RTvariable v, unsigned int u1, unsigned | | | |
| int u2, unsigned int u3, unsigned int u4); | | | |
| RTresult RTAPI rtVariableSet1uiv(RTvariable v, const unsigned int* u); | | | |
| RTresult RTAPI rtVariableSet2uiv(RTvariable v, const unsigned int* u); | | | |
| RTresult RTAPI rtVariableSet3uiv(RTvariable v, const unsigned int* u); | | | |
| RTresult RTAPI rtVariableSet4uiv(RTvariable v, const unsigned int* u); | | | |
| | | | |
| RTresult RTAPI rtVariableSetMatrix2x2fv(RTvariable v, int transpose, cons | | | |
| t float* m); | | | |
| RTresult RTAPI rtVariableSetMatrix2x3fv(RTvariable v, int transpose, cons | | | |
| t float* m); | | | |
| RTresult RTAPI rtVariableSetMatrix2x4fv(RTvariable v, int transpose, cons | | | |
| t float* m); | | | |
| RTresult RTAPI rtVariableSetMatrix3x2fv(RTvariable v, int transpose, cons | | | |
| t float* m); | | | |
| RTresult RTAPI rtVariableSetMatrix3x3fv(RTvariable v, int transpose, cons | | | |
| t float* m); | | | |
| RTresult RTAPI rtVariableSetMatrix3x4fv(RTvariable v, int transpose, cons | | | |
| t float* m); | | | |
| RTresult RTAPI rtVariableSetMatrix4x2fv(RTvariable v, int transpose, cons | | | |
| t float* m); | | | |
| RTresult RTAPI rtVariableSetMatrix4x3fv(RTvariable v, int transpose, cons | | | |
| t float* m); | | | |
| RTresult RTAPI rtVariableSetMatrix4x4fv(RTvariable v, int transpose, cons | | | |
| t float* m); | | | |
| | | | |
| RTresult RTAPI rtVariableSetObject (RTvariable v, RTobject object); | | | |
| RTresult RTAPI rtVariableSetUserData(RTvariable v, RTsize size, const voi | | | |
| d* ptr); | | | |
| | | | |
| /* Gets */ | | | |
| RTresult RTAPI rtVariableGet1f (RTvariable v, float* f1); | | | |
| RTresult RTAPI rtVariableGet2f (RTvariable v, float* f1, float* f2); | | | |
| RTresult RTAPI rtVariableGet3f (RTvariable v, float* f1, float* f2, float | | | |
| * f3); | | | |
| RTresult RTAPI rtVariableGet4f (RTvariable v, float* f1, float* f2, float | | | |
| * f3, float* f4); | | | |
| RTresult RTAPI rtVariableGet1fv(RTvariable v, float* f); | | | |
| RTresult RTAPI rtVariableGet2fv(RTvariable v, float* f); | | | |
| RTresult RTAPI rtVariableGet3fv(RTvariable v, float* f); | | | |
| RTresult RTAPI rtVariableGet4fv(RTvariable v, float* f); | | | |
| | | | |
| RTresult RTAPI rtVariableGet1i (RTvariable v, int* i1); | | | |
| RTresult RTAPI rtVariableGet2i (RTvariable v, int* i1, int* i2); | | | |
| RTresult RTAPI rtVariableGet3i (RTvariable v, int* i1, int* i2, int* i3); | | | |
| RTresult RTAPI rtVariableGet4i (RTvariable v, int* i1, int* i2, int* i3, | | | |
| int* i4); | | | |
| RTresult RTAPI rtVariableGet1iv(RTvariable v, int* i); | | | |
| RTresult RTAPI rtVariableGet2iv(RTvariable v, int* i); | | | |
| RTresult RTAPI rtVariableGet3iv(RTvariable v, int* i); | | | |
| RTresult RTAPI rtVariableGet4iv(RTvariable v, int* i); | | | |
| | | | |
| RTresult RTAPI rtVariableGet1ui (RTvariable v, unsigned int* u1); | | | |
| RTresult RTAPI rtVariableGet2ui (RTvariable v, unsigned int* u1, unsigned | | | |
| int* u2); | | | |
| RTresult RTAPI rtVariableGet3ui (RTvariable v, unsigned int* u1, unsigned | | | |
| int* u2, unsigned int* u3); | | | |
| RTresult RTAPI rtVariableGet4ui (RTvariable v, unsigned int* u1, unsigned | | | |
| int* u2, unsigned int* u3, unsigned int* u4); | | | |
| RTresult RTAPI rtVariableGet1uiv(RTvariable v, unsigned int* u); | | | |
| RTresult RTAPI rtVariableGet2uiv(RTvariable v, unsigned int* u); | | | |
| RTresult RTAPI rtVariableGet3uiv(RTvariable v, unsigned int* u); | | | |
| RTresult RTAPI rtVariableGet4uiv(RTvariable v, unsigned int* u); | | | |
| | | | |
| RTresult RTAPI rtVariableGetMatrix2x2fv(RTvariable v, int transpose, floa | | | |
| t* m); | | | |
| RTresult RTAPI rtVariableGetMatrix2x3fv(RTvariable v, int transpose, floa | | | |
| t* m); | | | |
| RTresult RTAPI rtVariableGetMatrix2x4fv(RTvariable v, int transpose, floa | | | |
| t* m); | | | |
| RTresult RTAPI rtVariableGetMatrix3x2fv(RTvariable v, int transpose, floa | | | |
| t* m); | | | |
| RTresult RTAPI rtVariableGetMatrix3x3fv(RTvariable v, int transpose, floa | | | |
| t* m); | | | |
| RTresult RTAPI rtVariableGetMatrix3x4fv(RTvariable v, int transpose, floa | | | |
| t* m); | | | |
| RTresult RTAPI rtVariableGetMatrix4x2fv(RTvariable v, int transpose, floa | | | |
| t* m); | | | |
| RTresult RTAPI rtVariableGetMatrix4x3fv(RTvariable v, int transpose, floa | | | |
| t* m); | | | |
| RTresult RTAPI rtVariableGetMatrix4x4fv(RTvariable v, int transpose, floa | | | |
| t* m); | | | |
| | | | |
| RTresult RTAPI rtVariableGetObject (RTvariable v, RTobject* object); | | | |
| RTresult RTAPI rtVariableGetUserData(RTvariable v, RTsize size, void* ptr | | | |
| ); | | | |
| | | | |
| /* Other */ | | | |
| RTresult RTAPI rtVariableGetName(RTvariable v, const char** name_return); | | | |
| RTresult RTAPI rtVariableGetAnnotation(RTvariable v, const char** annotat | | | |
| ion_return); | | | |
| RTresult RTAPI rtVariableGetType(RTvariable v, RTobjecttype* type_return) | | | |
| ; | | | |
| RTresult RTAPI rtVariableGetContext(RTvariable v, RTcontext* context); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Context object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtContextCreate (RTcontext* context); | | | |
| RTresult RTAPI rtContextDestroy (RTcontext context); | | | |
| RTresult RTAPI rtContextValidate(RTcontext context); | | | |
| | | | |
| void RTAPI rtContextGetErrorString(RTcontext context, RTresult code, cons | | | |
| t char** return_string); | | | |
| | | | |
| RTresult RTAPI rtContextSetDevices (RTcontext context, unsigned int coun | | | |
| t, const int* devices); | | | |
| | | | |
| RTresult RTAPI rtContextSetStackSize(RTcontext context, RTsize stack_siz | | | |
| e_bytes); | | | |
| RTresult RTAPI rtContextGetStackSize(RTcontext context, RTsize* stack_siz | | | |
| e_bytes); | | | |
| | | | |
| RTresult RTAPI rtContextSetEntryPointCount(RTcontext context, unsigned in | | | |
| t num_entry_points); | | | |
| RTresult RTAPI rtContextGetEntryPointCount(RTcontext context, unsigned in | | | |
| t* num_entry_points); | | | |
| | | | |
| RTresult RTAPI rtContextSetRayGenerationProgram(RTcontext context, unsign | | | |
| ed int entry_point_index, RTprogram program); | | | |
| RTresult RTAPI rtContextGetRayGenerationProgram(RTcontext context, unsign | | | |
| ed int entry_point_index, RTprogram* program); | | | |
| | | | |
| RTresult RTAPI rtContextSetExceptionProgram(RTcontext context, unsigned i | | | |
| nt entry_point_index, RTprogram program); | | | |
| RTresult RTAPI rtContextGetExceptionProgram(RTcontext context, unsigned i | | | |
| nt entry_point_index, RTprogram* program); | | | |
| | | | |
| RTresult RTAPI rtContextSetRayTypeCount(RTcontext context, unsigned int | | | |
| num_ray_types); | | | |
| RTresult RTAPI rtContextGetRayTypeCount(RTcontext context, unsigned int* | | | |
| num_ray_types); | | | |
| | | | |
| RTresult RTAPI rtContextSetMissProgram(RTcontext context, unsigned int ra | | | |
| y_type_index, RTprogram program); | | | |
| RTresult RTAPI rtContextGetMissProgram(RTcontext context, unsigned int ra | | | |
| y_type_index, RTprogram* program); | | | |
| | | | |
| RTresult RTAPI rtContextCompile (RTcontext context); | | | |
| | | | |
| RTresult RTAPI rtContextLaunch1D(RTcontext context, unsigned int entry_po | | | |
| int_index, RTsize image_width); | | | |
| RTresult RTAPI rtContextLaunch2D(RTcontext context, unsigned int entry_po | | | |
| int_index, RTsize image_width, RTsize image_height); | | | |
| RTresult RTAPI rtContextLaunch3D(RTcontext context, unsigned int entry_po | | | |
| int_index, RTsize image_width, RTsize image_height, RTsize image_depth); | | | |
| | | | |
| RTresult RTAPI rtContextGetRunningState(RTcontext context, int* running); | | | |
| | | | |
| RTresult RTAPI rtContextSetPrintEnabled(RTcontext context, int enabled); | | | |
| RTresult RTAPI rtContextGetPrintEnabled(RTcontext context, int* enabled); | | | |
| RTresult RTAPI rtContextSetPrintBufferSize(RTcontext context, RTsize buf | | | |
| fer_size_bytes); | | | |
| RTresult RTAPI rtContextGetPrintBufferSize(RTcontext context, RTsize* buf | | | |
| fer_size_bytes); | | | |
| RTresult RTAPI rtContextSetPrintLaunchIndex(RTcontext context, int x, in | | | |
| t y, int z); | | | |
| RTresult RTAPI rtContextGetPrintLaunchIndex(RTcontext context, int* x, in | | | |
| t* y, int* z); | | | |
| | | | |
| RTresult RTAPI rtContextDeclareVariable (RTcontext context, const char* n | | | |
| ame, RTvariable* v); | | | |
| RTresult RTAPI rtContextQueryVariable (RTcontext context, const char* n | | | |
| ame, RTvariable* v); | | | |
| RTresult RTAPI rtContextRemoveVariable (RTcontext context, RTvariable v) | | | |
| ; | | | |
| RTresult RTAPI rtContextGetVariableCount(RTcontext context, unsigned int* | | | |
| count); | | | |
| RTresult RTAPI rtContextGetVariable (RTcontext context, unsigned int | | | |
| index, RTvariable* v); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Program object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtProgramCreateFromPTXString(RTcontext context, const char | | | |
| * ptx, const char* program_name, RTprogram* program); | | | |
| RTresult RTAPI rtProgramCreateFromPTXFile (RTcontext context, const char | | | |
| * filename, const char* program_name, RTprogram* program); | | | |
| RTresult RTAPI rtProgramDestroy (RTprogram program); | | | |
| RTresult RTAPI rtProgramValidate (RTprogram program); | | | |
| RTresult RTAPI rtProgramGetContext (RTprogram program, RTcontext* | | | |
| context); | | | |
| | | | |
| RTresult RTAPI rtProgramDeclareVariable (RTprogram program, const char* n | | | |
| ame, RTvariable* v); | | | |
| RTresult RTAPI rtProgramQueryVariable (RTprogram program, const char* n | | | |
| ame, RTvariable* v); | | | |
| RTresult RTAPI rtProgramRemoveVariable (RTprogram program, RTvariable v) | | | |
| ; | | | |
| RTresult RTAPI rtProgramGetVariableCount(RTprogram program, unsigned int* | | | |
| count); | | | |
| RTresult RTAPI rtProgramGetVariable (RTprogram program, unsigned int | | | |
| index, RTvariable* v); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Group object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtGroupCreate (RTcontext context, RTgroup* group); | | | |
| RTresult RTAPI rtGroupDestroy (RTgroup group); | | | |
| RTresult RTAPI rtGroupValidate (RTgroup group); | | | |
| RTresult RTAPI rtGroupGetContext(RTgroup group, RTcontext* context); | | | |
| | | | |
| RTresult RTAPI rtGroupSetAcceleration(RTgroup group, RTacceleration acce | | | |
| leration); | | | |
| RTresult RTAPI rtGroupGetAcceleration(RTgroup group, RTacceleration* acce | | | |
| leration); | | | |
| | | | |
| RTresult RTAPI rtGroupSetChildCount(RTgroup group, unsigned int count); | | | |
| RTresult RTAPI rtGroupGetChildCount(RTgroup group, unsigned int* count); | | | |
| RTresult RTAPI rtGroupSetChild (RTgroup group, unsigned int index, RT | | | |
| object child); | | | |
| RTresult RTAPI rtGroupGetChild (RTgroup group, unsigned int index, RT | | | |
| object* child); | | | |
| RTresult RTAPI rtGroupGetChildType (RTgroup group, unsigned int index, RT | | | |
| objecttype* type); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Selector object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtSelectorCreate (RTcontext context, RTselector* select | | | |
| or); | | | |
| RTresult RTAPI rtSelectorDestroy (RTselector selector); | | | |
| RTresult RTAPI rtSelectorValidate (RTselector selector); | | | |
| RTresult RTAPI rtSelectorGetContext(RTselector selector, RTcontext* conte | | | |
| xt); | | | |
| | | | |
| RTresult RTAPI rtSelectorSetVisitProgram(RTselector selector, RTprogram | | | |
| program); | | | |
| RTresult RTAPI rtSelectorGetVisitProgram(RTselector selector, RTprogram* | | | |
| program); | | | |
| | | | |
| RTresult RTAPI rtSelectorSetChildCount(RTselector selector, unsigned int | | | |
| count); | | | |
| RTresult RTAPI rtSelectorGetChildCount(RTselector selector, unsigned int* | | | |
| count); | | | |
| RTresult RTAPI rtSelectorSetChild (RTselector selector, unsigned int | | | |
| index, RTobject child); | | | |
| RTresult RTAPI rtSelectorGetChild (RTselector selector, unsigned int | | | |
| index, RTobject* child); | | | |
| RTresult RTAPI rtSelectorGetChildType (RTselector selector, unsigned int | | | |
| index, RTobjecttype* type); | | | |
| | | | |
| RTresult RTAPI rtSelectorDeclareVariable (RTselector selector, const char | | | |
| * name, RTvariable* v); | | | |
| RTresult RTAPI rtSelectorQueryVariable (RTselector selector, const char | | | |
| * name, RTvariable* v); | | | |
| RTresult RTAPI rtSelectorRemoveVariable (RTselector selector, RTvariable | | | |
| v); | | | |
| RTresult RTAPI rtSelectorGetVariableCount(RTselector selector, unsigned i | | | |
| nt* count); | | | |
| RTresult RTAPI rtSelectorGetVariable (RTselector selector, unsigned i | | | |
| nt index, RTvariable* v); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Transform object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtTransformCreate (RTcontext context, RTtransform* tran | | | |
| sform); | | | |
| RTresult RTAPI rtTransformDestroy (RTtransform transform); | | | |
| RTresult RTAPI rtTransformValidate (RTtransform transform); | | | |
| RTresult RTAPI rtTransformGetContext(RTtransform transform, RTcontext* co | | | |
| ntext); | | | |
| | | | |
| RTresult RTAPI rtTransformSetMatrix (RTtransform transform, int transpose | | | |
| , const float* matrix, const float* inverse_matrix); | | | |
| RTresult RTAPI rtTransformGetMatrix (RTtransform transform, int transpose | | | |
| , float* matrix, float* inverse_matrix); | | | |
| | | | |
| RTresult RTAPI rtTransformSetChild (RTtransform transform, RTobject c | | | |
| hild); | | | |
| RTresult RTAPI rtTransformGetChild (RTtransform transform, RTobject* c | | | |
| hild); | | | |
| RTresult RTAPI rtTransformGetChildType(RTtransform transform, RTobjecttyp | | | |
| e* type); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** GeometryGroup object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtGeometryGroupCreate (RTcontext context, RTgeometrygro | | | |
| up* geometrygroup); | | | |
| RTresult RTAPI rtGeometryGroupDestroy (RTgeometrygroup geometrygroup); | | | |
| RTresult RTAPI rtGeometryGroupValidate (RTgeometrygroup geometrygroup); | | | |
| RTresult RTAPI rtGeometryGroupGetContext(RTgeometrygroup geometrygroup, R | | | |
| Tcontext* context); | | | |
| | | | |
| RTresult RTAPI rtGeometryGroupSetAcceleration(RTgeometrygroup geometrygro | | | |
| up, RTacceleration acceleration); | | | |
| RTresult RTAPI rtGeometryGroupGetAcceleration(RTgeometrygroup geometrygro | | | |
| up, RTacceleration* acceleration); | | | |
| | | | |
| RTresult RTAPI rtGeometryGroupSetChildCount(RTgeometrygroup geometrygroup | | | |
| , unsigned int count); | | | |
| RTresult RTAPI rtGeometryGroupGetChildCount(RTgeometrygroup geometrygroup | | | |
| , unsigned int* count); | | | |
| RTresult RTAPI rtGeometryGroupSetChild (RTgeometrygroup geometrygroup | | | |
| , unsigned int index, RTgeometryinstance geometryinstance); | | | |
| RTresult RTAPI rtGeometryGroupGetChild (RTgeometrygroup geometrygroup | | | |
| , unsigned int index, RTgeometryinstance* geometryinstance); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Acceleration object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtAccelerationCreate (RTcontext context, RTacceleration | | | |
| * acceleration); | | | |
| RTresult RTAPI rtAccelerationDestroy (RTacceleration acceleration); | | | |
| RTresult RTAPI rtAccelerationValidate (RTacceleration acceleration); | | | |
| RTresult RTAPI rtAccelerationGetContext(RTacceleration acceleration, RTco | | | |
| ntext* context); | | | |
| | | | |
| RTresult RTAPI rtAccelerationSetBuilder(RTacceleration acceleration, cons | | | |
| t char* builder); | | | |
| RTresult RTAPI rtAccelerationGetBuilder(RTacceleration acceleration, cons | | | |
| t char** return_string); | | | |
| RTresult RTAPI rtAccelerationSetTraverser(RTacceleration acceleration, co | | | |
| nst char* traverser); | | | |
| RTresult RTAPI rtAccelerationGetTraverser(RTacceleration acceleration, co | | | |
| nst char** return_string); | | | |
| RTresult RTAPI rtAccelerationSetProperty(RTacceleration acceleration, con | | | |
| st char* name, const char* value); | | | |
| RTresult RTAPI rtAccelerationGetProperty(RTacceleration acceleration, con | | | |
| st char* name, const char** return_string); | | | |
| | | | |
| RTresult RTAPI rtAccelerationGetDataSize(RTacceleration acceleration, RTs | | | |
| ize* size); | | | |
| RTresult RTAPI rtAccelerationGetData (RTacceleration acceleration, voi | | | |
| d* data); | | | |
| RTresult RTAPI rtAccelerationSetData (RTacceleration acceleration, con | | | |
| st void* data, RTsize size); | | | |
| | | | |
| RTresult RTAPI rtAccelerationMarkDirty(RTacceleration acceleration); | | | |
| RTresult RTAPI rtAccelerationIsDirty(RTacceleration acceleration, int* di | | | |
| rty); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** GeometryInstance object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtGeometryInstanceCreate (RTcontext context, RTgeometry | | | |
| instance* geometryinstance); | | | |
| RTresult RTAPI rtGeometryInstanceDestroy (RTgeometryinstance geometryin | | | |
| stance); | | | |
| RTresult RTAPI rtGeometryInstanceValidate (RTgeometryinstance geometryin | | | |
| stance); | | | |
| RTresult RTAPI rtGeometryInstanceGetContext(RTgeometryinstance geometryin | | | |
| stance, RTcontext* context); | | | |
| | | | |
| RTresult RTAPI rtGeometryInstanceSetGeometry(RTgeometryinstance geometryi | | | |
| nstance, RTgeometry geometry); | | | |
| RTresult RTAPI rtGeometryInstanceGetGeometry(RTgeometryinstance geometryi | | | |
| nstance, RTgeometry* geometry); | | | |
| | | | |
| RTresult RTAPI rtGeometryInstanceSetMaterialCount(RTgeometryinstance geom | | | |
| etryinstance, unsigned int count); | | | |
| RTresult RTAPI rtGeometryInstanceGetMaterialCount(RTgeometryinstance geom | | | |
| etryinstance, unsigned int* count); | | | |
| | | | |
| RTresult RTAPI rtGeometryInstanceSetMaterial(RTgeometryinstance geometryi | | | |
| nstance, unsigned int idx, RTmaterial material); | | | |
| RTresult RTAPI rtGeometryInstanceGetMaterial(RTgeometryinstance geometryi | | | |
| nstance, unsigned int idx, RTmaterial* material); | | | |
| | | | |
| RTresult RTAPI rtGeometryInstanceDeclareVariable (RTgeometryinstance geom | | | |
| etryinstance, const char* name, RTvariable* v); | | | |
| RTresult RTAPI rtGeometryInstanceQueryVariable (RTgeometryinstance geom | | | |
| etryinstance, const char* name, RTvariable* v); | | | |
| RTresult RTAPI rtGeometryInstanceRemoveVariable (RTgeometryinstance geom | | | |
| etryinstance, RTvariable v); | | | |
| RTresult RTAPI rtGeometryInstanceGetVariableCount(RTgeometryinstance geom | | | |
| etryinstance, unsigned int* count); | | | |
| RTresult RTAPI rtGeometryInstanceGetVariable (RTgeometryinstance geom | | | |
| etryinstance, unsigned int index, RTvariable* v); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Geometry object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtGeometryCreate (RTcontext context, RTgeometry* geomet | | | |
| ry); | | | |
| RTresult RTAPI rtGeometryDestroy (RTgeometry geometry); | | | |
| RTresult RTAPI rtGeometryValidate (RTgeometry geometry); | | | |
| RTresult RTAPI rtGeometryGetContext(RTgeometry geometry, RTcontext* conte | | | |
| xt); | | | |
| | | | |
| RTresult RTAPI rtGeometrySetPrimitiveCount(RTgeometry geometry, unsigned | | | |
| int num_primitives); | | | |
| RTresult RTAPI rtGeometryGetPrimitiveCount(RTgeometry geometry, unsigned | | | |
| int* num_primitives); | | | |
| | | | |
| RTresult RTAPI rtGeometrySetBoundingBoxProgram(RTgeometry geometry, RTpro | | | |
| gram program); | | | |
| RTresult RTAPI rtGeometryGetBoundingBoxProgram(RTgeometry geometry, RTpro | | | |
| gram* program); | | | |
| | | | |
| RTresult RTAPI rtGeometrySetIntersectionProgram(RTgeometry geometry, RTpr | | | |
| ogram program); | | | |
| RTresult RTAPI rtGeometryGetIntersectionProgram(RTgeometry geometry, RTpr | | | |
| ogram* program); | | | |
| | | | |
| RTresult RTAPI rtGeometryMarkDirty(RTgeometry geometry); | | | |
| RTresult RTAPI rtGeometryIsDirty(RTgeometry geometry, int* dirty); | | | |
| | | | |
| RTresult RTAPI rtGeometryDeclareVariable (RTgeometry geometry, const char | | | |
| * name, RTvariable* v); | | | |
| RTresult RTAPI rtGeometryQueryVariable (RTgeometry geometry, const char | | | |
| * name, RTvariable* v); | | | |
| RTresult RTAPI rtGeometryRemoveVariable (RTgeometry geometry, RTvariable | | | |
| v); | | | |
| RTresult RTAPI rtGeometryGetVariableCount(RTgeometry geometry, unsigned i | | | |
| nt* count); | | | |
| RTresult RTAPI rtGeometryGetVariable (RTgeometry geometry, unsigned i | | | |
| nt index, RTvariable* v); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Material object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtMaterialCreate (RTcontext context, RTmaterial* materi | | | |
| al); | | | |
| RTresult RTAPI rtMaterialDestroy (RTmaterial material); | | | |
| RTresult RTAPI rtMaterialValidate (RTmaterial material); | | | |
| RTresult RTAPI rtMaterialGetContext(RTmaterial material, RTcontext* conte | | | |
| xt); | | | |
| | | | |
| RTresult RTAPI rtMaterialSetClosestHitProgram(RTmaterial material, unsign | | | |
| ed int ray_type_index, RTprogram program); | | | |
| RTresult RTAPI rtMaterialGetClosestHitProgram(RTmaterial material, unsign | | | |
| ed int ray_type_index, RTprogram* program); | | | |
| | | | |
| RTresult RTAPI rtMaterialSetAnyHitProgram(RTmaterial material, unsigned i | | | |
| nt ray_type_index, RTprogram program); | | | |
| RTresult RTAPI rtMaterialGetAnyHitProgram(RTmaterial material, unsigned i | | | |
| nt ray_type_index, RTprogram* program); | | | |
| | | | |
| RTresult RTAPI rtMaterialDeclareVariable (RTmaterial material, const char | | | |
| * name, RTvariable* v); | | | |
| RTresult RTAPI rtMaterialQueryVariable (RTmaterial material, const char | | | |
| * name, RTvariable* v); | | | |
| RTresult RTAPI rtMaterialRemoveVariable (RTmaterial material, RTvariable | | | |
| v); | | | |
| RTresult RTAPI rtMaterialGetVariableCount(RTmaterial material, unsigned i | | | |
| nt* count); | | | |
| RTresult RTAPI rtMaterialGetVariable (RTmaterial material, unsigned i | | | |
| nt index, RTvariable* v); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** TextureSampler object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtTextureSamplerCreate (RTcontext context, RTtexturesam | | | |
| pler* texturesampler); | | | |
| RTresult RTAPI rtTextureSamplerDestroy (RTtexturesampler texturesampler | | | |
| ); | | | |
| RTresult RTAPI rtTextureSamplerValidate (RTtexturesampler texturesampler | | | |
| ); | | | |
| RTresult RTAPI rtTextureSamplerGetContext(RTtexturesampler texturesampler | | | |
| , RTcontext* context); | | | |
| | | | |
| RTresult RTAPI rtTextureSamplerSetMipLevelCount (RTtexturesampler texture | | | |
| sampler, unsigned int num_mip_levels); | | | |
| RTresult RTAPI rtTextureSamplerGetMipLevelCount (RTtexturesampler texture | | | |
| sampler, unsigned int* num_mip_levels); | | | |
| | | | |
| RTresult RTAPI rtTextureSamplerSetArraySize(RTtexturesampler texturesampl | | | |
| er, unsigned int num_textures_in_array); | | | |
| RTresult RTAPI rtTextureSamplerGetArraySize(RTtexturesampler texturesampl | | | |
| er, unsigned int* num_textures_in_array); | | | |
| | | | |
| RTresult RTAPI rtTextureSamplerSetWrapMode(RTtexturesampler texturesample | | | |
| r, unsigned int dimension, RTwrapmode wrapmode); | | | |
| RTresult RTAPI rtTextureSamplerGetWrapMode(RTtexturesampler texturesample | | | |
| r, unsigned int dimension, RTwrapmode* wrapmode); | | | |
| | | | |
| RTresult RTAPI rtTextureSamplerSetFilteringModes(RTtexturesampler texture | | | |
| sampler, RTfiltermode minification, RTfiltermode magnification, RTfilterm | | | |
| ode mipmapping); | | | |
| RTresult RTAPI rtTextureSamplerGetFilteringModes(RTtexturesampler texture | | | |
| sampler, RTfiltermode* minification, RTfiltermode* magnification, RTfilterm | | | |
| ode* mipmapping); | | | |
| | | | |
| RTresult RTAPI rtTextureSamplerSetMaxAnisotropy(RTtexturesampler textures | | | |
| ampler, float value); | | | |
| RTresult RTAPI rtTextureSamplerGetMaxAnisotropy(RTtexturesampler textures | | | |
| ampler, float* value); | | | |
| | | | |
| RTresult RTAPI rtTextureSamplerSetReadMode(RTtexturesampler texturesample | | | |
| r, RTtexturereadmode readmode); | | | |
| RTresult RTAPI rtTextureSamplerGetReadMode(RTtexturesampler texturesample | | | |
| r, RTtexturereadmode* readmode); | | | |
| | | | |
| RTresult RTAPI rtTextureSamplerSetIndexingMode(RTtexturesampler texturesa | | | |
| mpler, RTtextureindexmode indexmode); | | | |
| RTresult RTAPI rtTextureSamplerGetIndexingMode(RTtexturesampler texturesa | | | |
| mpler, RTtextureindexmode* indexmode); | | | |
| | | | |
| RTresult RTAPI rtTextureSamplerSetBuffer(RTtexturesampler texturesampler, | | | |
| unsigned int texture_array_idx, unsigned int mip_level, RTbuffer buffer); | | | |
| RTresult RTAPI rtTextureSamplerGetBuffer(RTtexturesampler texturesampler, | | | |
| unsigned int texture_array_idx, unsigned int mip_level, RTbuffer* buffer); | | | |
| | | | |
| /************************************ | | | |
| ** | | | |
| ** Buffer object | | | |
| ** | | | |
| ***********************************/ | | | |
| | | | |
| RTresult RTAPI rtBufferCreate (RTcontext context, RTbuffertype ty | | | |
| pe, RTbuffer* buffer); | | | |
| RTresult RTAPI rtBufferDestroy (RTbuffer buffer); | | | |
| RTresult RTAPI rtBufferValidate (RTbuffer buffer); | | | |
| RTresult RTAPI rtBufferGetContext (RTbuffer buffer, RTcontext* contex | | | |
| t); | | | |
| | | | |
| RTresult RTAPI rtBufferSetFormat (RTbuffer buffer, RTformat format); | | | |
| RTresult RTAPI rtBufferGetFormat (RTbuffer buffer, RTformat* format); | | | |
| RTresult RTAPI rtBufferSetElementSize(RTbuffer buffer, RTsize size_of_el | | | |
| ement); | | | |
| RTresult RTAPI rtBufferGetElementSize(RTbuffer buffer, RTsize* size_of_el | | | |
| ement); | | | |
| | | | |
| RTresult RTAPI rtBufferSetSize1D(RTbuffer buffer, RTsize width); | | | |
| RTresult RTAPI rtBufferGetSize1D(RTbuffer buffer, RTsize* width); | | | |
| RTresult RTAPI rtBufferSetSize2D(RTbuffer buffer, RTsize width, RTsize | | | |
| height); | | | |
| RTresult RTAPI rtBufferGetSize2D(RTbuffer buffer, RTsize* width, RTsize* | | | |
| height); | | | |
| RTresult RTAPI rtBufferSetSize3D(RTbuffer buffer, RTsize width, RTsize | | | |
| height, RTsize depth); | | | |
| RTresult RTAPI rtBufferGetSize3D(RTbuffer buffer, RTsize* width, RTsize* | | | |
| height, RTsize* depth); | | | |
| RTresult RTAPI rtBufferSetSizev (RTbuffer buffer, unsigned int dimensiona | | | |
| lity, const RTsize* dims); | | | |
| RTresult RTAPI rtBufferGetSizev (RTbuffer buffer, unsigned int dimensiona | | | |
| lity, RTsize* dims); | | | |
| | | | |
| RTresult RTAPI rtBufferGetDimensionality(RTbuffer buffer, unsigned int* d | | | |
| imensionality); | | | |
| | | | |
| RTresult RTAPI rtBufferMap (RTbuffer buffer, void** user_pointer); | | | |
| RTresult RTAPI rtBufferUnmap(RTbuffer buffer); | | | |
| | | | |
| #ifdef __cplusplus | | | |
| } | | | |
| #endif | | #endif | |
| | | | |
| #endif /* __optix_optix_h__ */ | | #endif /* __optix_optix_h__ */ | |
| | | | |
End of changes. 4 change blocks. |
| 837 lines changed or deleted | | 19 lines changed or added | |
|
| optix_cuda.h | | optix_cuda.h | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE P
OSSIBILITY OF | | * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE P
OSSIBILITY OF | |
| * SUCH DAMAGES | | * SUCH DAMAGES | |
| */ | | */ | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * optix_cuda.h | | * optix_cuda.h | |
| * | | * | |
| * This file provides the nvcc interface for generating PTX that the RT API | | * This file provides the nvcc interface for generating PTX that the RT API | |
| * is capable of parsing and weaving into the final kernel. | | * is capable of parsing and weaving into the final kernel. | |
| * | | * | |
|
| | | * This file is now deprecated -- the optix_cuda interface should now be in | |
| | | cluded | |
| | | * via optix.h and, if desired, optix_math.h. | |
| | | * | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| #ifndef __optix_optix_cuda_h__ | | #ifndef __optix_optix_cuda_h__ | |
| #define __optix_optix_cuda_h__ | | #define __optix_optix_cuda_h__ | |
| | | | |
|
| #include "optix_datatypes.h" | | #include "optix_math.h" | |
| #include "optix_internal.h" | | #include "optix_device.h" | |
| | | | |
| /* | | | |
| Augment vector types | | | |
| */ | | | |
| | | | |
| namespace optix { | | | |
| template<typename T, int Dim> struct VectorTypes {}; | | | |
| template<> struct VectorTypes<int, 1> { | | | |
| typedef int Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_int(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<int, 2> { | | | |
| typedef int2 Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_int2(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<int, 3> { | | | |
| typedef int3 Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_int3(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<int, 4> { | | | |
| typedef int4 Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_int4(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<unsigned int, 1> { | | | |
| typedef unsigned int Type; | | | |
| static __device__ Type make(unsigned int s) { return s; } | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return (unsigned int)s.x; } | | | |
| }; | | | |
| template<> struct VectorTypes<unsigned int, 2> { | | | |
| typedef uint2 Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_uint2(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<unsigned int, 3> { | | | |
| typedef uint3 Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_uint3(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<unsigned int, 4> { | | | |
| typedef uint4 Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_uint4(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<float, 1> { | | | |
| typedef float Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_float(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<float, 2> { | | | |
| typedef float2 Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_float2(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<float, 3> { | | | |
| typedef float3 Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_float3(s); } | | | |
| }; | | | |
| template<> struct VectorTypes<float, 4> { | | | |
| typedef float4 Type; | | | |
| template<class S> static __device__ | | | |
| Type make(S s) { return make_float4(s); } | | | |
| }; | | | |
| | | | |
| } | | | |
| | | | |
| /* | | | |
| Variables | | | |
| */ | | | |
| | | | |
| struct rtObject { | | | |
| private: | | | |
| unsigned int handle; | | | |
| }; | | | |
| | | | |
| #define rtDeclareVariable(type, name, semantic, annotation) \ | | | |
| namespace rti_internal_typeinfo { \ | | | |
| __device__ rti_typeinfo name = { _OPTIX_VARIABLE, sizeof(type)}; \ | | | |
| } \ | | | |
| namespace rti_internal_typename { \ | | | |
| __device__ char name[] = #type; \ | | | |
| } \ | | | |
| namespace rti_internal_semantic { \ | | | |
| __device__ char name[] = #semantic; \ | | | |
| } \ | | | |
| namespace rti_internal_annotation { \ | | | |
| __device__ char name[] = #annotation; \ | | | |
| } \ | | | |
| __device__ type name | | | |
| | | | |
| #define rtDeclareAnnotation(variable, annotation) \ | | | |
| namespace rti_internal_annotation { \ | | | |
| __device__ char variable[] = #annotation; \ | | | |
| } | | | |
| | | | |
| /* | | | |
| Buffer | | | |
| */ | | | |
| | | | |
| namespace optix { | | | |
| template<typename T, int Dim = 1> struct buffer { | | | |
| typedef VectorTypes<unsigned int, Dim> WrapperType; | | | |
| typedef typename VectorTypes<unsigned int, Dim>::Type IndexType; | | | |
| | | | |
| __device__ IndexType size() const { | | | |
| return WrapperType::make(rt_buffer_get_size(this, Dim, sizeof(T))); | | | |
| } | | | |
| __device__ T& operator[](IndexType i) { | | | |
| uint4 c = make_index(i); | | | |
| return *(T*)rt_buffer_get(this, Dim, sizeof(T), c.x, c.y, c.z, c.w); | | | |
| } | | | |
| private: | | | |
| __inline__ __device__ uint4 make_index(unsigned int v0) { return make_u | | | |
| int4(v0, 0, 0, 0); } | | | |
| __inline__ __device__ uint4 make_index(uint2 v0) { return make_uint4(v0 | | | |
| .x, v0.y, 0, 0); } | | | |
| __inline__ __device__ uint4 make_index(uint3 v0) { return make_uint4(v0 | | | |
| .x, v0.y, v0.z, 0); } | | | |
| __inline__ __device__ uint4 make_index(uint4 v0) { return make_uint4(v0 | | | |
| .x, v0.y, v0.z, v0.w); } | | | |
| }; | | | |
| } | | | |
| #define rtBuffer __device__ optix::buffer | | | |
| | | | |
| /* | | | |
| Texture - they are defined in CUDA | | | |
| */ | | | |
| | | | |
| #define rtTextureSampler texture | | | |
| | | | |
| /* | | | |
| Program | | | |
| */ | | | |
| | | | |
| #define RT_PROGRAM __global__ | | | |
| | | | |
| /* | | | |
| Functions | | | |
| */ | | | |
| | | | |
| template<class T> | | | |
| inline __device__ void rtTrace( rtObject topNode, optix::Ray ray, T& prd ) | | | |
| { | | | |
| optix::rt_trace(*(unsigned int*)&topNode, ray.origin, ray.direction, ray. | | | |
| ray_type, ray.tmin, ray.tmax, &prd, sizeof(T)); | | | |
| } | | | |
| | | | |
| inline __device__ bool rtPotentialIntersection( float tmin ) | | | |
| { | | | |
| return optix::rt_potential_intersection( tmin ); | | | |
| } | | | |
| | | | |
| inline __device__ bool rtReportIntersection( unsigned int material ) | | | |
| { | | | |
| return optix::rt_report_intersection( material ); | | | |
| } | | | |
| | | | |
| inline __device__ void rtIgnoreIntersection() | | | |
| { | | | |
| optix::rt_ignore_intersection(); | | | |
| } | | | |
| | | | |
| inline __device__ void rtTerminateRay() | | | |
| { | | | |
| optix::rt_terminate_ray(); | | | |
| } | | | |
| | | | |
| inline __device__ void rtIntersectChild( unsigned int index ) | | | |
| { | | | |
| optix::rt_intersect_child( index ); | | | |
| } | | | |
| | | | |
| inline __device__ float3 rtTransformPoint( RTtransformkind kind, const floa | | | |
| t3& p ) | | | |
| { | | | |
| return optix::rt_transform_point( kind, p ); | | | |
| } | | | |
| | | | |
| inline __device__ float3 rtTransformVector( RTtransformkind kind, const flo | | | |
| at3& v ) | | | |
| { | | | |
| return optix::rt_transform_vector( kind, v ); | | | |
| } | | | |
| | | | |
| inline __device__ float3 rtTransformNormal( RTtransformkind kind, const flo | | | |
| at3& n ) | | | |
| { | | | |
| return optix::rt_transform_normal( kind, n ); | | | |
| } | | | |
| | | | |
| inline __device__ void rtGetTransform( RTtransformkind kind, float matrix[1 | | | |
| 6] ) | | | |
| { | | | |
| return optix::rt_get_transform( kind, matrix ); | | | |
| } | | | |
| | | | |
| /* | | | |
| Printing | | | |
| */ | | | |
| | | | |
| inline __device__ void rtPrintf( const char* fmt ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| optix::rt_print_start(fmt,sz); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| inline __device__ void rtPrintf( const char* fmt, T1 arg1 ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| _RT_PRINTF_ARG_1( arg1 ); | | | |
| _RT_PRINTF_2(); | | | |
| _RT_PRINTF_ARG_2( arg1 ); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2> | | | |
| inline __device__ void rtPrintf( const char* fmt, T1 arg1, T2 arg2 ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| _RT_PRINTF_ARG_1( arg1 ); | | | |
| _RT_PRINTF_ARG_1( arg2 ); | | | |
| _RT_PRINTF_2(); | | | |
| _RT_PRINTF_ARG_2( arg1 ); | | | |
| _RT_PRINTF_ARG_2( arg2 ); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2, typename T3> | | | |
| inline __device__ void rtPrintf( const char* fmt, T1 arg1, T2 arg2, T3 arg3 | | | |
| ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| _RT_PRINTF_ARG_1( arg1 ); | | | |
| _RT_PRINTF_ARG_1( arg2 ); | | | |
| _RT_PRINTF_ARG_1( arg3 ); | | | |
| _RT_PRINTF_2(); | | | |
| _RT_PRINTF_ARG_2( arg1 ); | | | |
| _RT_PRINTF_ARG_2( arg2 ); | | | |
| _RT_PRINTF_ARG_2( arg3 ); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2, typename T3, typename T4> | | | |
| inline __device__ void rtPrintf( const char* fmt, T1 arg1, T2 arg2, T3 arg3 | | | |
| , T4 arg4 ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| _RT_PRINTF_ARG_1( arg1 ); | | | |
| _RT_PRINTF_ARG_1( arg2 ); | | | |
| _RT_PRINTF_ARG_1( arg3 ); | | | |
| _RT_PRINTF_ARG_1( arg4 ); | | | |
| _RT_PRINTF_2(); | | | |
| _RT_PRINTF_ARG_2( arg1 ); | | | |
| _RT_PRINTF_ARG_2( arg2 ); | | | |
| _RT_PRINTF_ARG_2( arg3 ); | | | |
| _RT_PRINTF_ARG_2( arg4 ); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2, typename T3, typename T4, typename T5> | | | |
| inline __device__ void rtPrintf( const char* fmt, T1 arg1, T2 arg2, T3 arg3 | | | |
| , T4 arg4, T5 arg5 ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| _RT_PRINTF_ARG_1( arg1 ); | | | |
| _RT_PRINTF_ARG_1( arg2 ); | | | |
| _RT_PRINTF_ARG_1( arg3 ); | | | |
| _RT_PRINTF_ARG_1( arg4 ); | | | |
| _RT_PRINTF_ARG_1( arg5 ); | | | |
| _RT_PRINTF_2(); | | | |
| _RT_PRINTF_ARG_2( arg1 ); | | | |
| _RT_PRINTF_ARG_2( arg2 ); | | | |
| _RT_PRINTF_ARG_2( arg3 ); | | | |
| _RT_PRINTF_ARG_2( arg4 ); | | | |
| _RT_PRINTF_ARG_2( arg5 ); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2, typename T3, typename T4, typename T5, t | | | |
| ypename T6> | | | |
| inline __device__ void rtPrintf( const char* fmt, T1 arg1, T2 arg2, T3 arg3 | | | |
| , T4 arg4, T5 arg5, T6 arg6 ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| _RT_PRINTF_ARG_1( arg1 ); | | | |
| _RT_PRINTF_ARG_1( arg2 ); | | | |
| _RT_PRINTF_ARG_1( arg3 ); | | | |
| _RT_PRINTF_ARG_1( arg4 ); | | | |
| _RT_PRINTF_ARG_1( arg5 ); | | | |
| _RT_PRINTF_ARG_1( arg6 ); | | | |
| _RT_PRINTF_2(); | | | |
| _RT_PRINTF_ARG_2( arg1 ); | | | |
| _RT_PRINTF_ARG_2( arg2 ); | | | |
| _RT_PRINTF_ARG_2( arg3 ); | | | |
| _RT_PRINTF_ARG_2( arg4 ); | | | |
| _RT_PRINTF_ARG_2( arg5 ); | | | |
| _RT_PRINTF_ARG_2( arg6 ); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2, typename T3, typename T4, typename T5, t | | | |
| ypename T6, typename T7> | | | |
| inline __device__ void rtPrintf( const char* fmt, T1 arg1, T2 arg2, T3 arg3 | | | |
| , T4 arg4, T5 arg5, T6 arg6, T7 arg7 ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| _RT_PRINTF_ARG_1( arg1 ); | | | |
| _RT_PRINTF_ARG_1( arg2 ); | | | |
| _RT_PRINTF_ARG_1( arg3 ); | | | |
| _RT_PRINTF_ARG_1( arg4 ); | | | |
| _RT_PRINTF_ARG_1( arg5 ); | | | |
| _RT_PRINTF_ARG_1( arg6 ); | | | |
| _RT_PRINTF_ARG_1( arg7 ); | | | |
| _RT_PRINTF_2(); | | | |
| _RT_PRINTF_ARG_2( arg1 ); | | | |
| _RT_PRINTF_ARG_2( arg2 ); | | | |
| _RT_PRINTF_ARG_2( arg3 ); | | | |
| _RT_PRINTF_ARG_2( arg4 ); | | | |
| _RT_PRINTF_ARG_2( arg5 ); | | | |
| _RT_PRINTF_ARG_2( arg6 ); | | | |
| _RT_PRINTF_ARG_2( arg7 ); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2, typename T3, typename T4, typename T5, t | | | |
| ypename T6, typename T7, typename T8> | | | |
| inline __device__ void rtPrintf( const char* fmt, T1 arg1, T2 arg2, T3 arg3 | | | |
| , T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8 ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| _RT_PRINTF_ARG_1( arg1 ); | | | |
| _RT_PRINTF_ARG_1( arg2 ); | | | |
| _RT_PRINTF_ARG_1( arg3 ); | | | |
| _RT_PRINTF_ARG_1( arg4 ); | | | |
| _RT_PRINTF_ARG_1( arg5 ); | | | |
| _RT_PRINTF_ARG_1( arg6 ); | | | |
| _RT_PRINTF_ARG_1( arg7 ); | | | |
| _RT_PRINTF_ARG_1( arg8 ); | | | |
| _RT_PRINTF_2(); | | | |
| _RT_PRINTF_ARG_2( arg1 ); | | | |
| _RT_PRINTF_ARG_2( arg2 ); | | | |
| _RT_PRINTF_ARG_2( arg3 ); | | | |
| _RT_PRINTF_ARG_2( arg4 ); | | | |
| _RT_PRINTF_ARG_2( arg5 ); | | | |
| _RT_PRINTF_ARG_2( arg6 ); | | | |
| _RT_PRINTF_ARG_2( arg7 ); | | | |
| _RT_PRINTF_ARG_2( arg8 ); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2, typename T3, typename T4, typename T5, t | | | |
| ypename T6, typename T7, typename T8, typename T9> | | | |
| inline __device__ void rtPrintf( const char* fmt, T1 arg1, T2 arg2, T3 arg3 | | | |
| , T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9 ) | | | |
| { | | | |
| _RT_PRINTF_1(); | | | |
| _RT_PRINTF_ARG_1( arg1 ); | | | |
| _RT_PRINTF_ARG_1( arg2 ); | | | |
| _RT_PRINTF_ARG_1( arg3 ); | | | |
| _RT_PRINTF_ARG_1( arg4 ); | | | |
| _RT_PRINTF_ARG_1( arg5 ); | | | |
| _RT_PRINTF_ARG_1( arg6 ); | | | |
| _RT_PRINTF_ARG_1( arg7 ); | | | |
| _RT_PRINTF_ARG_1( arg8 ); | | | |
| _RT_PRINTF_ARG_1( arg9 ); | | | |
| _RT_PRINTF_2(); | | | |
| _RT_PRINTF_ARG_2( arg1 ); | | | |
| _RT_PRINTF_ARG_2( arg2 ); | | | |
| _RT_PRINTF_ARG_2( arg3 ); | | | |
| _RT_PRINTF_ARG_2( arg4 ); | | | |
| _RT_PRINTF_ARG_2( arg5 ); | | | |
| _RT_PRINTF_ARG_2( arg6 ); | | | |
| _RT_PRINTF_ARG_2( arg7 ); | | | |
| _RT_PRINTF_ARG_2( arg8 ); | | | |
| _RT_PRINTF_ARG_2( arg9 ); | | | |
| } | | | |
| | | | |
| #undef _RT_PRINTF_1 | | | |
| #undef _RT_PRINTF_2 | | | |
| #undef _RT_PRINTF_ARG_1 | | | |
| #undef _RT_PRINTF_ARG_2 | | | |
| | | | |
| #endif /* __optix_optix_cuda_h__ */ | | #endif /* __optix_optix_cuda_h__ */ | |
| | | | |
End of changes. 2 change blocks. |
| 381 lines changed or deleted | | 6 lines changed or added | |
|
| optix_math.h | | optix_math.h | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| The syntax is modelled on the Cg standard library. | | The syntax is modelled on the Cg standard library. | |
| | | | |
| This file has also been modified from the original cutil_math.h file. | | This file has also been modified from the original cutil_math.h file. | |
| cutil_math.h is a subset of this file, and you should use this file in
place | | cutil_math.h is a subset of this file, and you should use this file in
place | |
| of any cutil_math.h file you wish to use. | | of any cutil_math.h file you wish to use. | |
| */ | | */ | |
| | | | |
| #ifndef CUTIL_MATH_H | | #ifndef CUTIL_MATH_H | |
| #define CUTIL_MATH_H | | #define CUTIL_MATH_H | |
| | | | |
|
| #include "cuda_runtime.h" | | #include "internal/optix_declarations.h" // For RT_HOSTDEVICE | |
| | | #include <vector_functions.h> // from cuda toolkit | |
| | | | |
| // #define these constants such that we are sure | | // #define these constants such that we are sure | |
| // 32b floats are emitted in ptx | | // 32b floats are emitted in ptx | |
| #ifndef M_Ef | | #ifndef M_Ef | |
| #define M_Ef 2.71828182845904523536f | | #define M_Ef 2.71828182845904523536f | |
| #endif | | #endif | |
| #ifndef M_LOG2Ef | | #ifndef M_LOG2Ef | |
| #define M_LOG2Ef 1.44269504088896340736f | | #define M_LOG2Ef 1.44269504088896340736f | |
| #endif | | #endif | |
| #ifndef M_LOG10Ef | | #ifndef M_LOG10Ef | |
| | | | |
| skipping to change at line 98 | | skipping to change at line 99 | |
| #define M_SQRT2f 1.41421356237309504880f | | #define M_SQRT2f 1.41421356237309504880f | |
| #endif | | #endif | |
| #ifndef M_SQRT1_2f | | #ifndef M_SQRT1_2f | |
| #define M_SQRT1_2f 0.707106781186547524401f | | #define M_SQRT1_2f 0.707106781186547524401f | |
| #endif | | #endif | |
| | | | |
| /**************************************************************************
****/ | | /**************************************************************************
****/ | |
| typedef unsigned int uint; | | typedef unsigned int uint; | |
| typedef unsigned short ushort; | | typedef unsigned short ushort; | |
| | | | |
|
| /*** defines ***/ | | | |
| #define RT_HOSTDEVICE __host__ __device__ | | | |
| | | | |
| #ifndef __CUDACC__ | | #ifndef __CUDACC__ | |
|
| | | /* Functions that CUDA provides for device code but are lacking on some hos | |
| | | t platform */ | |
| | | | |
| #include <math.h> | | #include <math.h> | |
| | | | |
| inline float fminf(float a, float b) | | inline float fminf(float a, float b) | |
| { | | { | |
| return a < b ? a : b; | | return a < b ? a : b; | |
| } | | } | |
| | | | |
| inline float fmaxf(float a, float b) | | inline float fmaxf(float a, float b) | |
| { | | { | |
| return a > b ? a : b; | | return a > b ? a : b; | |
| | | | |
| skipping to change at line 123 | | skipping to change at line 123 | |
| | | | |
| inline int max(int a, int b) | | inline int max(int a, int b) | |
| { | | { | |
| return a > b ? a : b; | | return a > b ? a : b; | |
| } | | } | |
| | | | |
| inline int min(int a, int b) | | inline int min(int a, int b) | |
| { | | { | |
| return a < b ? a : b; | | return a < b ? a : b; | |
| } | | } | |
|
| #endif | | | |
| | | | |
| /* float functions */ | | | |
| /************************************************************************** | | | |
| ****/ | | | |
| | | | |
| /* copy sign-bit from src value to dst value */ | | /* copy sign-bit from src value to dst value */ | |
|
| static __inline__ RT_HOSTDEVICE float copy_sign(float dst, float src) | | inline float copysignf(float dst, float src) | |
| { | | { | |
| union { | | union { | |
| float f; | | float f; | |
| unsigned int i; | | unsigned int i; | |
| } v1, v2, v3; | | } v1, v2, v3; | |
| v1.f = src; | | v1.f = src; | |
| v2.f = dst; | | v2.f = dst; | |
| v3.i = (v2.i & 0x7fffffff) | (v1.i & 0x80000000); | | v3.i = (v2.i & 0x7fffffff) | (v1.i & 0x80000000); | |
| | | | |
| return v3.f; | | return v3.f; | |
| } | | } | |
|
| | | #endif | |
| | | | |
| | | /* float functions */ | |
| | | /************************************************************************** | |
| | | ****/ | |
| | | | |
| /* lerp */ | | /* lerp */ | |
| inline RT_HOSTDEVICE float lerp(float a, float b, float t) | | inline RT_HOSTDEVICE float lerp(float a, float b, float t) | |
| { | | { | |
| return a + t*(b-a); | | return a + t*(b-a); | |
| } | | } | |
| | | | |
| /* clamp */ | | /* clamp */ | |
| inline RT_HOSTDEVICE float clamp(float f, float a, float b) | | inline RT_HOSTDEVICE float clamp(float f, float a, float b) | |
| { | | { | |
| | | | |
| skipping to change at line 353 | | skipping to change at line 353 | |
| | | | |
| /* reflect */ | | /* reflect */ | |
| inline RT_HOSTDEVICE float2 reflect(float2 i, float2 n) | | inline RT_HOSTDEVICE float2 reflect(float2 i, float2 n) | |
| { | | { | |
| return i - 2.0f * n * dot(n,i); | | return i - 2.0f * n * dot(n,i); | |
| } | | } | |
| | | | |
| /* faceforward */ | | /* faceforward */ | |
| inline RT_HOSTDEVICE float2 faceforward(float2 n, float2 i, float2 nref) | | inline RT_HOSTDEVICE float2 faceforward(float2 n, float2 i, float2 nref) | |
| { | | { | |
|
| return n * copy_sign( 1.0f, dot(i, nref) ); | | return n * copysignf( 1.0f, dot(i, nref) ); | |
| | | } | |
| | | | |
| | | /* exp */ | |
| | | inline RT_HOSTDEVICE float2 expf(float2 v) | |
| | | { | |
| | | return make_float2(expf(v.x), expf(v.y)); | |
| } | | } | |
| | | | |
| /* float3 functions */ | | /* float3 functions */ | |
| /**************************************************************************
****/ | | /**************************************************************************
****/ | |
| | | | |
| /* additional constructors */ | | /* additional constructors */ | |
| inline RT_HOSTDEVICE float3 make_float3(float s) | | inline RT_HOSTDEVICE float3 make_float3(float s) | |
| { | | { | |
| return make_float3(s, s, s); | | return make_float3(s, s, s); | |
| } | | } | |
| | | | |
| skipping to change at line 382 | | skipping to change at line 388 | |
| inline RT_HOSTDEVICE float3 make_float3(float4 a) | | inline RT_HOSTDEVICE float3 make_float3(float4 a) | |
| { | | { | |
| return make_float3(a.x, a.y, a.z); /* discards w */ | | return make_float3(a.x, a.y, a.z); /* discards w */ | |
| } | | } | |
| inline RT_HOSTDEVICE float3 make_float3(int3 a) | | inline RT_HOSTDEVICE float3 make_float3(int3 a) | |
| { | | { | |
| return make_float3(float(a.x), float(a.y), float(a.z)); | | return make_float3(float(a.x), float(a.y), float(a.z)); | |
| } | | } | |
| | | | |
| /* negate */ | | /* negate */ | |
|
| inline RT_HOSTDEVICE float3 operator-(float3 &a) | | inline RT_HOSTDEVICE float3 operator-(const float3 &a) | |
| { | | { | |
| return make_float3(-a.x, -a.y, -a.z); | | return make_float3(-a.x, -a.y, -a.z); | |
| } | | } | |
| | | | |
| /* min */ | | /* min */ | |
| static __inline__ RT_HOSTDEVICE float3 fminf(float3 a, float3 b) | | static __inline__ RT_HOSTDEVICE float3 fminf(float3 a, float3 b) | |
| { | | { | |
| return make_float3(fminf(a.x,b.x), fminf(a.y,b.y), fminf(a.z,b.z)); | | return make_float3(fminf(a.x,b.x), fminf(a.y,b.y), fminf(a.z,b.z)); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 534 | | skipping to change at line 540 | |
| | | | |
| /* reflect */ | | /* reflect */ | |
| inline RT_HOSTDEVICE float3 reflect(float3 i, float3 n) | | inline RT_HOSTDEVICE float3 reflect(float3 i, float3 n) | |
| { | | { | |
| return i - 2.0f * n * dot(n,i); | | return i - 2.0f * n * dot(n,i); | |
| } | | } | |
| | | | |
| /* faceforward */ | | /* faceforward */ | |
| inline RT_HOSTDEVICE float3 faceforward(float3 n, float3 i, float3 nref) | | inline RT_HOSTDEVICE float3 faceforward(float3 n, float3 i, float3 nref) | |
| { | | { | |
|
| return n * copy_sign( 1.0f, dot(i, nref) ); | | return n * copysignf( 1.0f, dot(i, nref) ); | |
| | | } | |
| | | | |
| | | /* exp */ | |
| | | inline RT_HOSTDEVICE float3 expf(float3 v) | |
| | | { | |
| | | return make_float3(expf(v.x), expf(v.y), expf(v.z)); | |
| } | | } | |
| | | | |
| /* float4 functions */ | | /* float4 functions */ | |
| /**************************************************************************
****/ | | /**************************************************************************
****/ | |
| | | | |
| /* additional constructors */ | | /* additional constructors */ | |
| inline RT_HOSTDEVICE float4 make_float4(float s) | | inline RT_HOSTDEVICE float4 make_float4(float s) | |
| { | | { | |
| return make_float4(s, s, s, s); | | return make_float4(s, s, s, s); | |
| } | | } | |
| | | | |
| skipping to change at line 705 | | skipping to change at line 717 | |
| | | | |
| /* reflect */ | | /* reflect */ | |
| inline RT_HOSTDEVICE float4 reflect(float4 i, float4 n) | | inline RT_HOSTDEVICE float4 reflect(float4 i, float4 n) | |
| { | | { | |
| return i - 2.0f * n * dot(n,i); | | return i - 2.0f * n * dot(n,i); | |
| } | | } | |
| | | | |
| /* faceforward */ | | /* faceforward */ | |
| inline RT_HOSTDEVICE float4 faceforward(float4 n, float4 i, float4 nref) | | inline RT_HOSTDEVICE float4 faceforward(float4 n, float4 i, float4 nref) | |
| { | | { | |
|
| return n * copy_sign( 1.0f, dot(i, nref) ); | | return n * copysignf( 1.0f, dot(i, nref) ); | |
| | | } | |
| | | | |
| | | /* exp */ | |
| | | inline RT_HOSTDEVICE float4 expf(float4 v) | |
| | | { | |
| | | return make_float4(expf(v.x), expf(v.y), expf(v.z), expf(v.w)); | |
| } | | } | |
| | | | |
| /* int3 functions */ | | /* int3 functions */ | |
| /**************************************************************************
****/ | | /**************************************************************************
****/ | |
| | | | |
| /* additional constructors */ | | /* additional constructors */ | |
| inline RT_HOSTDEVICE int3 make_int3(int s) | | inline RT_HOSTDEVICE int3 make_int3(int s) | |
| { | | { | |
| return make_int3(s, s, s); | | return make_int3(s, s, s); | |
| } | | } | |
| | | | |
| skipping to change at line 910 | | skipping to change at line 928 | |
| inline RT_HOSTDEVICE uint3 clamp(uint3 v, uint a, uint b) | | inline RT_HOSTDEVICE uint3 clamp(uint3 v, uint a, uint b) | |
| { | | { | |
| return make_uint3(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b))
; | | return make_uint3(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b))
; | |
| } | | } | |
| | | | |
| inline RT_HOSTDEVICE uint3 clamp(uint3 v, uint3 a, uint3 b) | | inline RT_HOSTDEVICE uint3 clamp(uint3 v, uint3 a, uint3 b) | |
| { | | { | |
| return make_uint3(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z
, a.z, b.z)); | | return make_uint3(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z
, a.z, b.z)); | |
| } | | } | |
| | | | |
|
| | | /* int4 functions */ | |
| | | /************************************************************************** | |
| | | ****/ | |
| | | | |
| | | /* additional constructors */ | |
| | | inline RT_HOSTDEVICE int4 make_int4(int s) | |
| | | { | |
| | | return make_int4(s, s, s, s); | |
| | | } | |
| | | | |
| | | /* equality */ | |
| | | inline RT_HOSTDEVICE bool operator==(int4 a, int4 b) | |
| | | { | |
| | | return a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w; | |
| | | } | |
| | | | |
| | | /* uint4 functions */ | |
| | | /************************************************************************** | |
| | | ****/ | |
| | | | |
| | | /* additional constructors */ | |
| | | inline RT_HOSTDEVICE uint4 make_uint4(uint s) | |
| | | { | |
| | | return make_uint4(s, s, s, s); | |
| | | } | |
| | | | |
| /* Narrowing */ | | /* Narrowing */ | |
| inline RT_HOSTDEVICE int2 make_int2(int3 v0) { return make_int2( v0.x, v0.y
); } | | inline RT_HOSTDEVICE int2 make_int2(int3 v0) { return make_int2( v0.x, v0.y
); } | |
| inline RT_HOSTDEVICE int2 make_int2(int4 v0) { return make_int2( v0.x, v0.y
); } | | inline RT_HOSTDEVICE int2 make_int2(int4 v0) { return make_int2( v0.x, v0.y
); } | |
| inline RT_HOSTDEVICE int3 make_int3(int4 v0) { return make_int3( v0.x, v0.y
, v0.z ); } | | inline RT_HOSTDEVICE int3 make_int3(int4 v0) { return make_int3( v0.x, v0.y
, v0.z ); } | |
| inline RT_HOSTDEVICE uint2 make_uint2(uint3 v0) { return make_uint2( v0.x,
v0.y ); } | | inline RT_HOSTDEVICE uint2 make_uint2(uint3 v0) { return make_uint2( v0.x,
v0.y ); } | |
| inline RT_HOSTDEVICE uint2 make_uint2(uint4 v0) { return make_uint2( v0.x,
v0.y ); } | | inline RT_HOSTDEVICE uint2 make_uint2(uint4 v0) { return make_uint2( v0.x,
v0.y ); } | |
| inline RT_HOSTDEVICE uint3 make_uint3(uint4 v0) { return make_uint3( v0.x,
v0.y, v0.z ); } | | inline RT_HOSTDEVICE uint3 make_uint3(uint4 v0) { return make_uint3( v0.x,
v0.y, v0.z ); } | |
| inline RT_HOSTDEVICE float2 make_float2(float3 v0) { return make_float2( v0
.x, v0.y ); } | | inline RT_HOSTDEVICE float2 make_float2(float3 v0) { return make_float2( v0
.x, v0.y ); } | |
| inline RT_HOSTDEVICE float2 make_float2(float4 v0) { return make_float2( v0
.x, v0.y ); } | | inline RT_HOSTDEVICE float2 make_float2(float4 v0) { return make_float2( v0
.x, v0.y ); } | |
| | | | |
| | | | |
| skipping to change at line 1038 | | skipping to change at line 1080 | |
| negNdotV = -negNdotV; | | negNdotV = -negNdotV; | |
| } | | } | |
| else | | else | |
| { | | { | |
| eta = 1.f / ior; | | eta = 1.f / ior; | |
| } | | } | |
| | | | |
| const float k = 1.f - eta*eta * (1.f - negNdotV * negNdotV); | | const float k = 1.f - eta*eta * (1.f - negNdotV * negNdotV); | |
| | | | |
| if (k < 0.0f) { | | if (k < 0.0f) { | |
|
| r = make_float3(0); | | | |
| return false; | | return false; | |
| } else { | | } else { | |
| r = normalize(eta*i - (eta*negNdotV + sqrtf(k)) * nn); | | r = normalize(eta*i - (eta*negNdotV + sqrtf(k)) * nn); | |
| return true; | | return true; | |
| } | | } | |
| } | | } | |
| | | | |
| /* Schlick approximation of Fresnel reflectance */ | | /* Schlick approximation of Fresnel reflectance */ | |
| inline RT_HOSTDEVICE float fresnel_schlick(float cos_theta, float exponent
= 5.0f, | | inline RT_HOSTDEVICE float fresnel_schlick(float cos_theta, float exponent
= 5.0f, | |
| float minimum
= 0.0f, | | float minimum
= 0.0f, | |
| | | | |
| skipping to change at line 1074 | | skipping to change at line 1115 | |
| } | | } | |
| | | | |
| inline RT_HOSTDEVICE float3 fresnel_schlick(float cos_theta, float exponent
, | | inline RT_HOSTDEVICE float3 fresnel_schlick(float cos_theta, float exponent
, | |
| float3 minimum, float3 maximum) | | float3 minimum, float3 maximum) | |
| { | | { | |
| return make_float3(fresnel_schlick(cos_theta, exponent, minimum.x, maximu
m.x), | | return make_float3(fresnel_schlick(cos_theta, exponent, minimum.x, maximu
m.x), | |
| fresnel_schlick(cos_theta, exponent, minimum.y, maximu
m.y), | | fresnel_schlick(cos_theta, exponent, minimum.y, maximu
m.y), | |
| fresnel_schlick(cos_theta, exponent, minimum.z, maximu
m.z)); | | fresnel_schlick(cos_theta, exponent, minimum.z, maximu
m.z)); | |
| } | | } | |
| | | | |
|
| | | /* orthonormal basis */ | |
| | | namespace optix { | |
| | | struct Onb | |
| | | { | |
| | | inline RT_HOSTDEVICE Onb( const float3& normal ) | |
| | | { | |
| | | m_normal = normal; | |
| | | | |
| | | if( fabs(m_normal.x) > fabs(m_normal.z) ) | |
| | | { | |
| | | m_binormal.x = -m_normal.y; | |
| | | m_binormal.y = m_normal.x; | |
| | | m_binormal.z = 0; | |
| | | } | |
| | | else | |
| | | { | |
| | | m_binormal.x = 0; | |
| | | m_binormal.y = -m_normal.z; | |
| | | m_binormal.z = m_normal.y; | |
| | | } | |
| | | | |
| | | m_binormal = normalize(m_binormal); | |
| | | m_tangent = cross( m_binormal, m_normal ); | |
| | | } | |
| | | | |
| | | inline RT_HOSTDEVICE void inverse_transform( float3& p ) | |
| | | { | |
| | | p = p.x*m_tangent + p.y*m_binormal + p.z*m_normal; | |
| | | } | |
| | | | |
| | | float3 m_tangent; | |
| | | float3 m_binormal; | |
| | | float3 m_normal; | |
| | | }; | |
| | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 13 change blocks. |
| 15 lines changed or deleted | | 95 lines changed or added | |
|
| optixpp.h | | optixpp.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
LOSS OF | | * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
LOSS OF | |
| * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE US
E OF OR | | * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE US
E OF OR | |
| * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE P
OSSIBILITY OF | | * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE P
OSSIBILITY OF | |
| * SUCH DAMAGES | | * SUCH DAMAGES | |
| */ | | */ | |
| | | | |
| #ifndef __optixu_optixpp_h__ | | #ifndef __optixu_optixpp_h__ | |
| #define __optixu_optixpp_h__ | | #define __optixu_optixpp_h__ | |
| | | | |
| #include <optix.h> | | #include <optix.h> | |
|
| | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| # ifndef WIN32_LEAN_AND_MEAN | | # ifndef WIN32_LEAN_AND_MEAN | |
| # define WIN32_LEAN_AND_MEAN | | # define WIN32_LEAN_AND_MEAN | |
| # endif | | # endif | |
| # include<windows.h> | | # include<windows.h> | |
|
| | | # include<optix_d3d9_interop.h> | |
| | | # include<optix_d3d10_interop.h> | |
| | | # include<optix_d3d11_interop.h> | |
| #endif | | #endif | |
|
| #include <optix_gl_interop.h> | | | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| #include <optix_math.h> | | #include <optix_math.h> | |
|
| | | #include <optix_gl_interop.h> | |
| | | | |
| | | //------------------------------------------------------------------------- | |
| | | ---- | |
| | | // | |
| | | // C++ API | |
| | | // | |
| | | //------------------------------------------------------------------------- | |
| | | ---- | |
| | | | |
| namespace optixu { | | namespace optixu { | |
| class AccelerationObj; | | class AccelerationObj; | |
| class BufferObj; | | class BufferObj; | |
| class ContextObj; | | class ContextObj; | |
| class GeometryObj; | | class GeometryObj; | |
| class GeometryGroupObj; | | class GeometryGroupObj; | |
| class GeometryInstanceObj; | | class GeometryInstanceObj; | |
| class GroupObj; | | class GroupObj; | |
| class MaterialObj; | | class MaterialObj; | |
| | | | |
| skipping to change at line 197 | | skipping to change at line 208 | |
| void setMatrix3x2fv(bool transpose, const float* m); | | void setMatrix3x2fv(bool transpose, const float* m); | |
| void setMatrix3x3fv(bool transpose, const float* m); | | void setMatrix3x3fv(bool transpose, const float* m); | |
| void setMatrix3x4fv(bool transpose, const float* m); | | void setMatrix3x4fv(bool transpose, const float* m); | |
| void setMatrix4x2fv(bool transpose, const float* m); | | void setMatrix4x2fv(bool transpose, const float* m); | |
| void setMatrix4x3fv(bool transpose, const float* m); | | void setMatrix4x3fv(bool transpose, const float* m); | |
| void setMatrix4x4fv(bool transpose, const float* m); | | void setMatrix4x4fv(bool transpose, const float* m); | |
| | | | |
| /* gets */ | | /* gets */ | |
| float getFloat(); | | float getFloat(); | |
| unsigned int getUint(); | | unsigned int getUint(); | |
|
| | | int getInt(); | |
| #if 0 | | #if 0 | |
| // Not implemented yet... | | // Not implemented yet... | |
| | | | |
| // The getFloat functions can be overloaded by paramter type. | | // The getFloat functions can be overloaded by paramter type. | |
| void getFloat(float* f); | | void getFloat(float* f); | |
| void getFloat(float* f1, float* f2); | | void getFloat(float* f1, float* f2); | |
| void getFloat(float2* f); | | void getFloat(float2* f); | |
| void getFloat(float* f1, float* f2, float* f3); | | void getFloat(float* f1, float* f2, float* f3); | |
| void getFloat(float3* f); | | void getFloat(float3* f); | |
| void getFloat(float* f1, float* f2, float* f3, float* f4); | | void getFloat(float* f1, float* f2, float* f3, float* f4); | |
| | | | |
| skipping to change at line 272 | | skipping to change at line 284 | |
| TextureSampler getTextureSampler(); | | TextureSampler getTextureSampler(); | |
| | | | |
| void setUserData(RTsize size, const void* ptr); | | void setUserData(RTsize size, const void* ptr); | |
| void getUserData(RTsize size, void* ptr); | | void getUserData(RTsize size, void* ptr); | |
| | | | |
| std::string getName(); | | std::string getName(); | |
| std::string getAnnotation(); | | std::string getAnnotation(); | |
| RTobjecttype getType(); | | RTobjecttype getType(); | |
| RTvariable get(); | | RTvariable get(); | |
| void checkError(RTresult code); | | void checkError(RTresult code); | |
|
| | | RTsize getSize(); | |
| | | | |
| private: | | private: | |
| RTvariable m_variable; | | RTvariable m_variable; | |
| VariableObj(RTvariable variable) : m_variable(variable) {} | | VariableObj(RTvariable variable) : m_variable(variable) {} | |
| friend class Handle<VariableObj>; | | friend class Handle<VariableObj>; | |
| | | | |
| }; | | }; | |
| | | | |
| template<class T> | | template<class T> | |
| Handle<VariableObj> Handle<T>::operator[](const std::string& varname) | | Handle<VariableObj> Handle<T>::operator[](const std::string& varname) | |
| | | | |
| skipping to change at line 299 | | skipping to change at line 312 | |
| class ContextObj : public ScopedObj { | | class ContextObj : public ScopedObj { | |
| public: | | public: | |
| static unsigned int getDeviceCount(); | | static unsigned int getDeviceCount(); | |
| | | | |
| static Context create(); | | static Context create(); | |
| void destroy(); | | void destroy(); | |
| void validate(); | | void validate(); | |
| | | | |
| Acceleration createAcceleration(const char* builder, const char* traver
ser); | | Acceleration createAcceleration(const char* builder, const char* traver
ser); | |
| | | | |
|
| Buffer createBuffer(RTbuffertype type); | | Buffer createBuffer(unsigned int type); | |
| Buffer createBuffer(RTbuffertype type, RTformat format, RTsize width); | | Buffer createBuffer(unsigned int type, RTformat format, RTsize width); | |
| Buffer createBuffer(RTbuffertype type, RTformat format, RTsize width, R | | Buffer createBuffer(unsigned int type, RTformat format, RTsize width, R | |
| Tsize height); | | Tsize height); | |
| Buffer createBuffer(RTbuffertype type, RTformat format, RTsize width, R | | Buffer createBuffer(unsigned int type, RTformat format, RTsize width, R | |
| Tsize height, RTsize depth); | | Tsize height, RTsize depth); | |
| Buffer createBufferFromGLBO(RTbuffertype type, unsigned int vbo); | | | |
| | | Buffer createBufferFromGLBO(unsigned int type, unsigned int vbo); | |
| | | TextureSampler createTextureSamplerFromGLImage(unsigned int id, RTgltar | |
| | | get target ); | |
| | | | |
| | | #ifdef _WIN32 | |
| | | | |
| | | Buffer createBufferFromD3D9Resource(unsigned int type, IDirect3DResourc | |
| | | e9 *pResource); | |
| | | Buffer createBufferFromD3D10Resource(unsigned int type, ID3D10Resource | |
| | | *pResource); | |
| | | Buffer createBufferFromD3D11Resource(unsigned int type, ID3D11Resource | |
| | | *pResource); | |
| | | | |
| | | TextureSampler createTextureSamplerFromD3D9Resource(IDirect3DResource9 | |
| | | *pResource); | |
| | | TextureSampler createTextureSamplerFromD3D10Resource(ID3D10Resource *pR | |
| | | esource); | |
| | | TextureSampler createTextureSamplerFromD3D11Resource(ID3D11Resource *pR | |
| | | esource); | |
| | | | |
| | | void setD3D9Device(IDirect3DDevice9* device); | |
| | | void setD3D10Device(ID3D10Device* device); | |
| | | void setD3D11Device(ID3D11Device* device); | |
| | | | |
| | | #endif | |
| | | | |
| Geometry createGeometry(); | | Geometry createGeometry(); | |
| GeometryInstance createGeometryInstance(); | | GeometryInstance createGeometryInstance(); | |
| template<class Iterator> | | template<class Iterator> | |
| GeometryInstance createGeometryInstance( Geometry geometry, Iterator
matlbegin, Iterator matlend); | | GeometryInstance createGeometryInstance( Geometry geometry, Iterator
matlbegin, Iterator matlend); | |
| Group createGroup(); | | Group createGroup(); | |
| template<class Iterator> | | template<class Iterator> | |
| Group createGroup( Iterator childbegin, Iterator childend ); | | Group createGroup( Iterator childbegin, Iterator childend ); | |
| GeometryGroup createGeometryGroup(); | | GeometryGroup createGeometryGroup(); | |
| template<class Iterator> | | template<class Iterator> | |
| | | | |
| skipping to change at line 338 | | skipping to change at line 369 | |
| | | | |
| void setEntryPointCount(unsigned int num_entry_points); | | void setEntryPointCount(unsigned int num_entry_points); | |
| unsigned int getEntryPointCount(); | | unsigned int getEntryPointCount(); | |
| | | | |
| void setRayGenerationProgram(unsigned int entry_point_index, Program p
rogram); | | void setRayGenerationProgram(unsigned int entry_point_index, Program p
rogram); | |
| Program getRayGenerationProgram(unsigned int entry_point_index); | | Program getRayGenerationProgram(unsigned int entry_point_index); | |
| | | | |
| void setExceptionProgram(unsigned int entry_point_index, Program progr
am); | | void setExceptionProgram(unsigned int entry_point_index, Program progr
am); | |
| Program getExceptionProgram(unsigned int entry_point_index); | | Program getExceptionProgram(unsigned int entry_point_index); | |
| | | | |
|
| | | void setExceptionEnabled( RTexception exception, bool enabled ); | |
| | | bool getExceptionEnabled( RTexception exception ); | |
| | | | |
| void setRayTypeCount(unsigned int num_ray_types); | | void setRayTypeCount(unsigned int num_ray_types); | |
| unsigned int getRayTypeCount(); | | unsigned int getRayTypeCount(); | |
| | | | |
| void setMissProgram(unsigned int ray_type_index, Program program); | | void setMissProgram(unsigned int ray_type_index, Program program); | |
| Program getMissProgram(unsigned int ray_type_index); | | Program getMissProgram(unsigned int ray_type_index); | |
| | | | |
| void compile(); | | void compile(); | |
| | | | |
| void launch(unsigned int entry_point_index, RTsize image_width); | | void launch(unsigned int entry_point_index, RTsize image_width); | |
| void launch(unsigned int entry_point_index, RTsize image_width, RTsize
image_height); | | void launch(unsigned int entry_point_index, RTsize image_width, RTsize
image_height); | |
| void launch(unsigned int entry_point_index, RTsize image_width, RTsize
image_height, RTsize image_depth); | | void launch(unsigned int entry_point_index, RTsize image_width, RTsize
image_height, RTsize image_depth); | |
| | | | |
| int getRunningState(); | | int getRunningState(); | |
| | | | |
| void setPrintEnabled(bool enabled); | | void setPrintEnabled(bool enabled); | |
| bool getPrintEnabled(); | | bool getPrintEnabled(); | |
| void setPrintBufferSize(RTsize buffer_size_bytes); | | void setPrintBufferSize(RTsize buffer_size_bytes); | |
| RTsize getPrintBufferSize(); | | RTsize getPrintBufferSize(); | |
|
| void setPrintLaunchIndex(int x, int y, int z); | | void setPrintLaunchIndex(int x, int y=-1, int z=-1); | |
| int3 getPrintLaunchIndex(); | | int3 getPrintLaunchIndex(); | |
| | | | |
| Variable declareVariable (const std::string& name); | | Variable declareVariable (const std::string& name); | |
| Variable queryVariable (const std::string& name); | | Variable queryVariable (const std::string& name); | |
| void removeVariable (Variable v); | | void removeVariable (Variable v); | |
| unsigned int getVariableCount(); | | unsigned int getVariableCount(); | |
| Variable getVariable (unsigned int index); | | Variable getVariable (unsigned int index); | |
| | | | |
| void checkError(RTresult code); | | void checkError(RTresult code); | |
| | | | |
| | | | |
| skipping to change at line 525 | | skipping to change at line 559 | |
| friend class Handle<SelectorObj>; | | friend class Handle<SelectorObj>; | |
| }; | | }; | |
| | | | |
| class AccelerationObj : public DestroyableObj { | | class AccelerationObj : public DestroyableObj { | |
| public: | | public: | |
| void destroy(); | | void destroy(); | |
| void validate(); | | void validate(); | |
| Context getContext(); | | Context getContext(); | |
| | | | |
| void markDirty(); | | void markDirty(); | |
|
| | | bool isDirty(); | |
| | | | |
| void setProperty( const std::string& name, const std::string& va
lue ); | | void setProperty( const std::string& name, const std::string& va
lue ); | |
| std::string getProperty( const std::string& name ); | | std::string getProperty( const std::string& name ); | |
| void setBuilder(const std::string& builder); | | void setBuilder(const std::string& builder); | |
| std::string getBuilder(); | | std::string getBuilder(); | |
| void setTraverser(const std::string& traverser); | | void setTraverser(const std::string& traverser); | |
| std::string getTraverser(); | | std::string getTraverser(); | |
| | | | |
| RTsize getDataSize(); | | RTsize getDataSize(); | |
| void getData( void* data ); | | void getData( void* data ); | |
| | | | |
| skipping to change at line 590 | | skipping to change at line 625 | |
| friend class Handle<GeometryInstanceObj>; | | friend class Handle<GeometryInstanceObj>; | |
| }; | | }; | |
| | | | |
| class GeometryObj : public ScopedObj { | | class GeometryObj : public ScopedObj { | |
| public: | | public: | |
| void destroy(); | | void destroy(); | |
| void validate(); | | void validate(); | |
| Context getContext(); | | Context getContext(); | |
| | | | |
| void markDirty(); | | void markDirty(); | |
|
| | | bool isDirty(); | |
| | | | |
| void setPrimitiveCount(unsigned int num_primitives); | | void setPrimitiveCount(unsigned int num_primitives); | |
| unsigned int getPrimitiveCount(); | | unsigned int getPrimitiveCount(); | |
| | | | |
| void setBoundingBoxProgram(Program program); | | void setBoundingBoxProgram(Program program); | |
| Program getBoundingBoxProgram(); | | Program getBoundingBoxProgram(); | |
| | | | |
| void setIntersectionProgram(Program program); | | void setIntersectionProgram(Program program); | |
| Program getIntersectionProgram(); | | Program getIntersectionProgram(); | |
| | | | |
| | | | |
| skipping to change at line 677 | | skipping to change at line 713 | |
| RTtexturereadmode getReadMode(); | | RTtexturereadmode getReadMode(); | |
| | | | |
| void setIndexingMode(RTtextureindexmode indexmode); | | void setIndexingMode(RTtextureindexmode indexmode); | |
| RTtextureindexmode getIndexingMode(); | | RTtextureindexmode getIndexingMode(); | |
| | | | |
| void setBuffer(unsigned int texture_array_idx, unsigned int mip_level,
Buffer buffer); | | void setBuffer(unsigned int texture_array_idx, unsigned int mip_level,
Buffer buffer); | |
| Buffer getBuffer(unsigned int texture_array_idx, unsigned int mip_level
); | | Buffer getBuffer(unsigned int texture_array_idx, unsigned int mip_level
); | |
| | | | |
| RTtexturesampler get(); | | RTtexturesampler get(); | |
| void checkError(RTresult code); | | void checkError(RTresult code); | |
|
| | | | |
| | | void registerGLTexture(); | |
| | | void unregisterGLTexture(); | |
| | | | |
| | | #ifdef _WIN32 | |
| | | | |
| | | void registerD3D9Texture(); | |
| | | void registerD3D10Texture(); | |
| | | void registerD3D11Texture(); | |
| | | | |
| | | void unregisterD3D9Texture(); | |
| | | void unregisterD3D10Texture(); | |
| | | void unregisterD3D11Texture(); | |
| | | | |
| | | #endif | |
| | | | |
| private: | | private: | |
| typedef RTtexturesampler api_t; | | typedef RTtexturesampler api_t; | |
| virtual ~TextureSamplerObj() {} | | virtual ~TextureSamplerObj() {} | |
| RTtexturesampler m_texturesampler; | | RTtexturesampler m_texturesampler; | |
| TextureSamplerObj(RTtexturesampler texturesampler) : m_texturesampler(t
exturesampler) {} | | TextureSamplerObj(RTtexturesampler texturesampler) : m_texturesampler(t
exturesampler) {} | |
| friend class Handle<TextureSamplerObj>; | | friend class Handle<TextureSamplerObj>; | |
| }; | | }; | |
| | | | |
| class BufferObj : public DestroyableObj { | | class BufferObj : public DestroyableObj { | |
| public: | | public: | |
| | | | |
| skipping to change at line 710 | | skipping to change at line 762 | |
| void getSize(RTsize& width, RTsize& height); | | void getSize(RTsize& width, RTsize& height); | |
| void setSize(RTsize width, RTsize height, RTsize depth); | | void setSize(RTsize width, RTsize height, RTsize depth); | |
| void getSize(RTsize& width, RTsize& height, RTsize& depth); | | void getSize(RTsize& width, RTsize& height, RTsize& depth); | |
| void setSize(unsigned int dimensionality, const RTsize* dims); | | void setSize(unsigned int dimensionality, const RTsize* dims); | |
| void getSize(unsigned int dimensionality, RTsize* dims); | | void getSize(unsigned int dimensionality, RTsize* dims); | |
| | | | |
| unsigned int getDimensionality(); | | unsigned int getDimensionality(); | |
| | | | |
| unsigned int getGLBOId(); | | unsigned int getGLBOId(); | |
| | | | |
|
| | | void registerGLBuffer(); | |
| | | void unregisterGLBuffer(); | |
| | | | |
| | | #ifdef _WIN32 | |
| | | | |
| | | void registerD3D9Buffer(); | |
| | | void registerD3D10Buffer(); | |
| | | void registerD3D11Buffer(); | |
| | | | |
| | | void unregisterD3D9Buffer(); | |
| | | void unregisterD3D10Buffer(); | |
| | | void unregisterD3D11Buffer(); | |
| | | | |
| | | IDirect3DResource9* getD3D9Resource(); | |
| | | ID3D10Resource* getD3D10Resource(); | |
| | | ID3D11Resource* getD3D11Resource(); | |
| | | | |
| | | #endif | |
| | | | |
| void* map(); | | void* map(); | |
| void unmap(); | | void unmap(); | |
| | | | |
| RTbuffer get(); | | RTbuffer get(); | |
| void checkError(RTresult code); | | void checkError(RTresult code); | |
| public: | | public: | |
| typedef RTbuffer api_t; | | typedef RTbuffer api_t; | |
| virtual ~BufferObj() {} | | virtual ~BufferObj() {} | |
| RTbuffer m_buffer; | | RTbuffer m_buffer; | |
| BufferObj(RTbuffer buffer) : m_buffer(buffer) {} | | BufferObj(RTbuffer buffer) : m_buffer(buffer) {} | |
| | | | |
| skipping to change at line 774 | | skipping to change at line 845 | |
| | | | |
| inline Acceleration ContextObj::createAcceleration(const char* builder, c
onst char* traverser) | | inline Acceleration ContextObj::createAcceleration(const char* builder, c
onst char* traverser) | |
| { | | { | |
| RTacceleration acceleration; | | RTacceleration acceleration; | |
| checkError( rtAccelerationCreate( m_context, &acceleration ) ); | | checkError( rtAccelerationCreate( m_context, &acceleration ) ); | |
| checkError( rtAccelerationSetBuilder( acceleration, builder ) ); | | checkError( rtAccelerationSetBuilder( acceleration, builder ) ); | |
| checkError( rtAccelerationSetTraverser( acceleration, traverser ) ); | | checkError( rtAccelerationSetTraverser( acceleration, traverser ) ); | |
| return Acceleration::take(acceleration); | | return Acceleration::take(acceleration); | |
| } | | } | |
| | | | |
|
| inline Buffer ContextObj::createBuffer(RTbuffertype type) | | inline Buffer ContextObj::createBuffer(unsigned int type) | |
| { | | { | |
| RTbuffer buffer; | | RTbuffer buffer; | |
| checkError( rtBufferCreate( m_context, type, &buffer ) ); | | checkError( rtBufferCreate( m_context, type, &buffer ) ); | |
| return Buffer::take(buffer); | | return Buffer::take(buffer); | |
| } | | } | |
| | | | |
|
| inline Buffer ContextObj::createBuffer(RTbuffertype type, RTformat format
, RTsize width) | | inline Buffer ContextObj::createBuffer(unsigned int type, RTformat format
, RTsize width) | |
| { | | { | |
| RTbuffer buffer; | | RTbuffer buffer; | |
| checkError( rtBufferCreate( m_context, type, &buffer ) ); | | checkError( rtBufferCreate( m_context, type, &buffer ) ); | |
| checkError( rtBufferSetFormat( buffer, format ) ); | | checkError( rtBufferSetFormat( buffer, format ) ); | |
| checkError( rtBufferSetSize1D( buffer, width ) ); | | checkError( rtBufferSetSize1D( buffer, width ) ); | |
| return Buffer::take(buffer); | | return Buffer::take(buffer); | |
| } | | } | |
| | | | |
|
| inline Buffer ContextObj::createBuffer(RTbuffertype type, RTformat format
, RTsize width, RTsize height) | | inline Buffer ContextObj::createBuffer(unsigned int type, RTformat format
, RTsize width, RTsize height) | |
| { | | { | |
| RTbuffer buffer; | | RTbuffer buffer; | |
| checkError( rtBufferCreate( m_context, type, &buffer ) ); | | checkError( rtBufferCreate( m_context, type, &buffer ) ); | |
| checkError( rtBufferSetFormat( buffer, format ) ); | | checkError( rtBufferSetFormat( buffer, format ) ); | |
| checkError( rtBufferSetSize2D( buffer, width, height ) ); | | checkError( rtBufferSetSize2D( buffer, width, height ) ); | |
| return Buffer::take(buffer); | | return Buffer::take(buffer); | |
| } | | } | |
| | | | |
|
| inline Buffer ContextObj::createBuffer(RTbuffertype type, RTformat format
, RTsize width, RTsize height, RTsize depth) | | inline Buffer ContextObj::createBuffer(unsigned int type, RTformat format
, RTsize width, RTsize height, RTsize depth) | |
| { | | { | |
| RTbuffer buffer; | | RTbuffer buffer; | |
| checkError( rtBufferCreate( m_context, type, &buffer ) ); | | checkError( rtBufferCreate( m_context, type, &buffer ) ); | |
| checkError( rtBufferSetFormat( buffer, format ) ); | | checkError( rtBufferSetFormat( buffer, format ) ); | |
| checkError( rtBufferSetSize3D( buffer, width, height, depth ) ); | | checkError( rtBufferSetSize3D( buffer, width, height, depth ) ); | |
| return Buffer::take(buffer); | | return Buffer::take(buffer); | |
| } | | } | |
| | | | |
|
| inline Buffer ContextObj::createBufferFromGLBO(RTbuffertype type, unsigne
d int vbo) | | inline Buffer ContextObj::createBufferFromGLBO(unsigned int type, unsigne
d int vbo) | |
| { | | { | |
| RTbuffer buffer; | | RTbuffer buffer; | |
| checkError( rtBufferCreateFromGLBO( m_context, type, vbo, &buffer ) ); | | checkError( rtBufferCreateFromGLBO( m_context, type, vbo, &buffer ) ); | |
| return Buffer::take(buffer); | | return Buffer::take(buffer); | |
| } | | } | |
| | | | |
|
| | | #ifdef _WIN32 | |
| | | | |
| | | inline Buffer ContextObj::createBufferFromD3D9Resource(unsigned int type, | |
| | | IDirect3DResource9 *pResource) | |
| | | { | |
| | | RTbuffer buffer; | |
| | | checkError( rtBufferCreateFromD3D9Resource( m_context, type, pResource, | |
| | | &buffer ) ); | |
| | | return Buffer::take(buffer); | |
| | | } | |
| | | | |
| | | inline Buffer ContextObj::createBufferFromD3D10Resource(unsigned int type | |
| | | , ID3D10Resource *pResource) | |
| | | { | |
| | | RTbuffer buffer; | |
| | | checkError( rtBufferCreateFromD3D10Resource( m_context, type, pResource | |
| | | , &buffer ) ); | |
| | | return Buffer::take(buffer); | |
| | | } | |
| | | | |
| | | inline Buffer ContextObj::createBufferFromD3D11Resource(unsigned int type | |
| | | , ID3D11Resource *pResource) | |
| | | { | |
| | | RTbuffer buffer; | |
| | | checkError( rtBufferCreateFromD3D11Resource( m_context, type, pResource | |
| | | , &buffer ) ); | |
| | | return Buffer::take(buffer); | |
| | | } | |
| | | | |
| | | inline TextureSampler ContextObj::createTextureSamplerFromD3D9Resource(ID | |
| | | irect3DResource9 *pResource) | |
| | | { | |
| | | RTtexturesampler textureSampler; | |
| | | checkError( rtTextureSamplerCreateFromD3D9Resource(m_context, pResource | |
| | | , &textureSampler)); | |
| | | return TextureSampler::take(textureSampler); | |
| | | } | |
| | | | |
| | | inline TextureSampler ContextObj::createTextureSamplerFromD3D10Resource(I | |
| | | D3D10Resource *pResource) | |
| | | { | |
| | | RTtexturesampler textureSampler; | |
| | | checkError( rtTextureSamplerCreateFromD3D10Resource(m_context, pResourc | |
| | | e, &textureSampler)); | |
| | | return TextureSampler::take(textureSampler); | |
| | | } | |
| | | | |
| | | inline TextureSampler ContextObj::createTextureSamplerFromD3D11Resource(I | |
| | | D3D11Resource *pResource) | |
| | | { | |
| | | RTtexturesampler textureSampler; | |
| | | checkError( rtTextureSamplerCreateFromD3D11Resource(m_context, pResourc | |
| | | e, &textureSampler)); | |
| | | return TextureSampler::take(textureSampler); | |
| | | } | |
| | | | |
| | | inline void ContextObj::setD3D9Device(IDirect3DDevice9* device) | |
| | | { | |
| | | checkError( rtContextSetD3D9Device( m_context, device ) ); | |
| | | } | |
| | | | |
| | | inline void ContextObj::setD3D10Device(ID3D10Device* device) | |
| | | { | |
| | | checkError( rtContextSetD3D10Device( m_context, device ) ); | |
| | | } | |
| | | | |
| | | inline void ContextObj::setD3D11Device(ID3D11Device* device) | |
| | | { | |
| | | checkError( rtContextSetD3D11Device( m_context, device ) ); | |
| | | } | |
| | | | |
| | | #endif | |
| | | | |
| | | inline TextureSampler ContextObj::createTextureSamplerFromGLImage(unsigne | |
| | | d int id, RTgltarget target) | |
| | | { | |
| | | RTtexturesampler textureSampler; | |
| | | checkError( rtTextureSamplerCreateFromGLImage(m_context, id, target, &t | |
| | | extureSampler)); | |
| | | return TextureSampler::take(textureSampler); | |
| | | } | |
| | | | |
| inline Geometry ContextObj::createGeometry() | | inline Geometry ContextObj::createGeometry() | |
| { | | { | |
| RTgeometry geometry; | | RTgeometry geometry; | |
| checkError( rtGeometryCreate( m_context, &geometry ) ); | | checkError( rtGeometryCreate( m_context, &geometry ) ); | |
| return Geometry::take(geometry); | | return Geometry::take(geometry); | |
| } | | } | |
| | | | |
| inline GeometryInstance ContextObj::createGeometryInstance() | | inline GeometryInstance ContextObj::createGeometryInstance() | |
| { | | { | |
| RTgeometryinstance geometryinstance; | | RTgeometryinstance geometryinstance; | |
| | | | |
| skipping to change at line 991 | | skipping to change at line 1130 | |
| checkError( rtContextSetExceptionProgram( m_context, entry_point_index,
program->get() ) ); | | checkError( rtContextSetExceptionProgram( m_context, entry_point_index,
program->get() ) ); | |
| } | | } | |
| | | | |
| inline Program ContextObj::getExceptionProgram(unsigned int entry_point_i
ndex) | | inline Program ContextObj::getExceptionProgram(unsigned int entry_point_i
ndex) | |
| { | | { | |
| RTprogram result; | | RTprogram result; | |
| checkError( rtContextGetExceptionProgram( m_context, entry_point_index,
&result ) ); | | checkError( rtContextGetExceptionProgram( m_context, entry_point_index,
&result ) ); | |
| return Program::take( result ); | | return Program::take( result ); | |
| } | | } | |
| | | | |
|
| | | inline void ContextObj::setExceptionEnabled( RTexception exception, bool | |
| | | enabled ) | |
| | | { | |
| | | checkError( rtContextSetExceptionEnabled( m_context, exception, enabled | |
| | | ) ); | |
| | | } | |
| | | | |
| | | inline bool ContextObj::getExceptionEnabled( RTexception exception ) | |
| | | { | |
| | | int enabled; | |
| | | checkError( rtContextGetExceptionEnabled( m_context, exception, &enable | |
| | | d ) ); | |
| | | return enabled != 0; | |
| | | } | |
| | | | |
| inline void ContextObj::setRayTypeCount(unsigned int num_ray_types) | | inline void ContextObj::setRayTypeCount(unsigned int num_ray_types) | |
| { | | { | |
| checkError( rtContextSetRayTypeCount( m_context, num_ray_types ) ); | | checkError( rtContextSetRayTypeCount( m_context, num_ray_types ) ); | |
| } | | } | |
| | | | |
| inline unsigned int ContextObj::getRayTypeCount() | | inline unsigned int ContextObj::getRayTypeCount() | |
| { | | { | |
| unsigned int result; | | unsigned int result; | |
| checkError( rtContextGetRayTypeCount( m_context, &result ) ); | | checkError( rtContextGetRayTypeCount( m_context, &result ) ); | |
| return result; | | return result; | |
| | | | |
| skipping to change at line 1490 | | skipping to change at line 1641 | |
| RTcontext c; | | RTcontext c; | |
| checkError( rtAccelerationGetContext(m_acceleration, &c ) ); | | checkError( rtAccelerationGetContext(m_acceleration, &c ) ); | |
| return Context::take( c ); | | return Context::take( c ); | |
| } | | } | |
| | | | |
| inline void AccelerationObj::markDirty() | | inline void AccelerationObj::markDirty() | |
| { | | { | |
| checkError( rtAccelerationMarkDirty(m_acceleration) ); | | checkError( rtAccelerationMarkDirty(m_acceleration) ); | |
| } | | } | |
| | | | |
|
| | | inline bool AccelerationObj::isDirty() | |
| | | { | |
| | | int dirty; | |
| | | checkError( rtAccelerationIsDirty(m_acceleration,&dirty) ); | |
| | | return dirty != 0; | |
| | | } | |
| | | | |
| inline void AccelerationObj::setProperty( const std::string& name, const
std::string& value ) | | inline void AccelerationObj::setProperty( const std::string& name, const
std::string& value ) | |
| { | | { | |
| checkError( rtAccelerationSetProperty(m_acceleration, name.c_str(), val
ue.c_str() ) ); | | checkError( rtAccelerationSetProperty(m_acceleration, name.c_str(), val
ue.c_str() ) ); | |
| } | | } | |
| | | | |
| inline std::string AccelerationObj::getProperty( const std::string& name
) | | inline std::string AccelerationObj::getProperty( const std::string& name
) | |
| { | | { | |
| const char* s; | | const char* s; | |
| checkError( rtAccelerationGetProperty(m_acceleration, name.c_str(), &s
) ); | | checkError( rtAccelerationGetProperty(m_acceleration, name.c_str(), &s
) ); | |
| return std::string( s ); | | return std::string( s ); | |
| | | | |
| skipping to change at line 1755 | | skipping to change at line 1913 | |
| RTvariable v; | | RTvariable v; | |
| checkError( rtGeometryGetVariable( m_geometry, index, &v ) ); | | checkError( rtGeometryGetVariable( m_geometry, index, &v ) ); | |
| return Variable::take( v ); | | return Variable::take( v ); | |
| } | | } | |
| | | | |
| inline void GeometryObj::markDirty() | | inline void GeometryObj::markDirty() | |
| { | | { | |
| checkError( rtGeometryMarkDirty(m_geometry) ); | | checkError( rtGeometryMarkDirty(m_geometry) ); | |
| } | | } | |
| | | | |
|
| | | inline bool GeometryObj::isDirty() | |
| | | { | |
| | | int dirty; | |
| | | checkError( rtGeometryIsDirty(m_geometry,&dirty) ); | |
| | | return dirty != 0; | |
| | | } | |
| | | | |
| inline RTgeometry GeometryObj::get() | | inline RTgeometry GeometryObj::get() | |
| { | | { | |
| return m_geometry; | | return m_geometry; | |
| } | | } | |
| | | | |
| inline void GeometryObj::checkError(RTresult code) | | inline void GeometryObj::checkError(RTresult code) | |
| { | | { | |
| if( code != RT_SUCCESS) { | | if( code != RT_SUCCESS) { | |
| RTcontext c; | | RTcontext c; | |
| throw APIObj::makeException( code, rtGeometryGetContext( m_geometry,
&c) == RT_SUCCESS? c : 0 ); | | throw APIObj::makeException( code, rtGeometryGetContext( m_geometry,
&c) == RT_SUCCESS? c : 0 ); | |
| | | | |
| skipping to change at line 1979 | | skipping to change at line 2144 | |
| } | | } | |
| | | | |
| inline void TextureSamplerObj::checkError(RTresult code) | | inline void TextureSamplerObj::checkError(RTresult code) | |
| { | | { | |
| if( code != RT_SUCCESS) { | | if( code != RT_SUCCESS) { | |
| RTcontext c; | | RTcontext c; | |
| throw APIObj::makeException( code, rtTextureSamplerGetContext( m_text
uresampler, &c) == RT_SUCCESS? c : 0 ); | | throw APIObj::makeException( code, rtTextureSamplerGetContext( m_text
uresampler, &c) == RT_SUCCESS? c : 0 ); | |
| } | | } | |
| } | | } | |
| | | | |
|
| | | inline void TextureSamplerObj::registerGLTexture() | |
| | | { | |
| | | checkError( rtTextureSamplerGLRegister( m_texturesampler ) ); | |
| | | } | |
| | | | |
| | | inline void TextureSamplerObj::unregisterGLTexture() | |
| | | { | |
| | | checkError( rtTextureSamplerGLUnregister( m_texturesampler ) ); | |
| | | } | |
| | | | |
| | | #ifdef _WIN32 | |
| | | | |
| | | inline void TextureSamplerObj::registerD3D9Texture() | |
| | | { | |
| | | checkError( rtTextureSamplerD3D9Register( m_texturesampler ) ); | |
| | | } | |
| | | | |
| | | inline void TextureSamplerObj::registerD3D10Texture() | |
| | | { | |
| | | checkError( rtTextureSamplerD3D10Register( m_texturesampler ) ); | |
| | | } | |
| | | | |
| | | inline void TextureSamplerObj::registerD3D11Texture() | |
| | | { | |
| | | checkError( rtTextureSamplerD3D11Register( m_texturesampler ) ); | |
| | | } | |
| | | | |
| | | inline void TextureSamplerObj::unregisterD3D9Texture() | |
| | | { | |
| | | checkError( rtTextureSamplerD3D9Unregister( m_texturesampler ) ); | |
| | | } | |
| | | | |
| | | inline void TextureSamplerObj::unregisterD3D10Texture() | |
| | | { | |
| | | checkError( rtTextureSamplerD3D10Unregister( m_texturesampler ) ); | |
| | | } | |
| | | | |
| | | inline void TextureSamplerObj::unregisterD3D11Texture() | |
| | | { | |
| | | checkError( rtTextureSamplerD3D11Unregister( m_texturesampler ) ); | |
| | | } | |
| | | | |
| | | #endif | |
| | | | |
| inline void BufferObj::destroy() | | inline void BufferObj::destroy() | |
| { | | { | |
| checkError( rtBufferDestroy( m_buffer ) ); | | checkError( rtBufferDestroy( m_buffer ) ); | |
| } | | } | |
| | | | |
| inline void BufferObj::validate() | | inline void BufferObj::validate() | |
| { | | { | |
| checkError( rtBufferValidate( m_buffer ) ); | | checkError( rtBufferValidate( m_buffer ) ); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 2074 | | skipping to change at line 2283 | |
| return result; | | return result; | |
| } | | } | |
| | | | |
| inline unsigned int BufferObj::getGLBOId() | | inline unsigned int BufferObj::getGLBOId() | |
| { | | { | |
| unsigned int result; | | unsigned int result; | |
| checkError( rtBufferGetGLBOId( m_buffer, &result ) ); | | checkError( rtBufferGetGLBOId( m_buffer, &result ) ); | |
| return result; | | return result; | |
| } | | } | |
| | | | |
|
| | | inline void BufferObj::registerGLBuffer() | |
| | | { | |
| | | checkError( rtBufferGLRegister( m_buffer ) ); | |
| | | } | |
| | | | |
| | | inline void BufferObj::unregisterGLBuffer() | |
| | | { | |
| | | checkError( rtBufferGLUnregister( m_buffer ) ); | |
| | | } | |
| | | | |
| | | #ifdef _WIN32 | |
| | | | |
| | | inline void BufferObj::registerD3D9Buffer() | |
| | | { | |
| | | checkError( rtBufferD3D9Register( m_buffer ) ); | |
| | | } | |
| | | | |
| | | inline void BufferObj::registerD3D10Buffer() | |
| | | { | |
| | | checkError( rtBufferD3D10Register( m_buffer ) ); | |
| | | } | |
| | | | |
| | | inline void BufferObj::registerD3D11Buffer() | |
| | | { | |
| | | checkError( rtBufferD3D11Register( m_buffer ) ); | |
| | | } | |
| | | | |
| | | inline void BufferObj::unregisterD3D9Buffer() | |
| | | { | |
| | | checkError( rtBufferD3D9Unregister( m_buffer ) ); | |
| | | } | |
| | | | |
| | | inline void BufferObj::unregisterD3D10Buffer() | |
| | | { | |
| | | checkError( rtBufferD3D10Unregister( m_buffer ) ); | |
| | | } | |
| | | | |
| | | inline void BufferObj::unregisterD3D11Buffer() | |
| | | { | |
| | | checkError( rtBufferD3D11Unregister( m_buffer ) ); | |
| | | } | |
| | | | |
| | | inline IDirect3DResource9* BufferObj::getD3D9Resource() | |
| | | { | |
| | | IDirect3DResource9* result = NULL; | |
| | | checkError( rtBufferGetD3D9Resource( m_buffer, &result ) ); | |
| | | return result; | |
| | | } | |
| | | | |
| | | inline ID3D10Resource* BufferObj::getD3D10Resource() | |
| | | { | |
| | | ID3D10Resource* result = NULL; | |
| | | checkError( rtBufferGetD3D10Resource( m_buffer, &result ) ); | |
| | | return result; | |
| | | } | |
| | | | |
| | | inline ID3D11Resource* BufferObj::getD3D11Resource() | |
| | | { | |
| | | ID3D11Resource* result = NULL; | |
| | | checkError( rtBufferGetD3D11Resource( m_buffer, &result ) ); | |
| | | return result; | |
| | | } | |
| | | | |
| | | #endif | |
| | | | |
| inline void* BufferObj::map() | | inline void* BufferObj::map() | |
| { | | { | |
| void* result; | | void* result; | |
| checkError( rtBufferMap( m_buffer, &result ) ); | | checkError( rtBufferMap( m_buffer, &result ) ); | |
| return result; | | return result; | |
| } | | } | |
| | | | |
| inline void BufferObj::unmap() | | inline void BufferObj::unmap() | |
| { | | { | |
| checkError( rtBufferUnmap( m_buffer ) ); | | checkError( rtBufferUnmap( m_buffer ) ); | |
| | | | |
| skipping to change at line 2309 | | skipping to change at line 2583 | |
| return f; | | return f; | |
| } | | } | |
| | | | |
| inline unsigned int VariableObj::getUint() | | inline unsigned int VariableObj::getUint() | |
| { | | { | |
| unsigned int i; | | unsigned int i; | |
| checkError( rtVariableGet1ui( m_variable, &i ) ); | | checkError( rtVariableGet1ui( m_variable, &i ) ); | |
| return i; | | return i; | |
| } | | } | |
| | | | |
|
| | | inline int VariableObj::getInt() | |
| | | { | |
| | | int i; | |
| | | checkError( rtVariableGet1i( m_variable, &i ) ); | |
| | | return i; | |
| | | } | |
| | | | |
| inline void VariableObj::checkError(RTresult code) | | inline void VariableObj::checkError(RTresult code) | |
| { | | { | |
| if( code != RT_SUCCESS) { | | if( code != RT_SUCCESS) { | |
| RTcontext c; | | RTcontext c; | |
| throw APIObj::makeException( code, rtVariableGetContext( m_variable,
&c) == RT_SUCCESS? c : 0 ); | | throw APIObj::makeException( code, rtVariableGetContext( m_variable,
&c) == RT_SUCCESS? c : 0 ); | |
| } | | } | |
| } | | } | |
| | | | |
| inline void VariableObj::setBuffer(Buffer buffer) | | inline void VariableObj::setBuffer(Buffer buffer) | |
| { | | { | |
| | | | |
| skipping to change at line 2411 | | skipping to change at line 2692 | |
| RTobjecttype type; | | RTobjecttype type; | |
| checkError( rtVariableGetType( m_variable, &type ) ); | | checkError( rtVariableGetType( m_variable, &type ) ); | |
| return type; | | return type; | |
| } | | } | |
| | | | |
| inline RTvariable VariableObj::get() | | inline RTvariable VariableObj::get() | |
| { | | { | |
| return m_variable; | | return m_variable; | |
| } | | } | |
| | | | |
|
| | | inline RTsize VariableObj::getSize() | |
| | | { | |
| | | RTsize size; | |
| | | checkError( rtVariableGetSize( m_variable, &size ) ); | |
| | | return size; | |
| | | } | |
| | | | |
| } | | } | |
| | | | |
| #endif /* __optixu_optixpp_h__ */ | | #endif /* __optixu_optixpp_h__ */ | |
| | | | |
End of changes. 26 change blocks. |
| 14 lines changed or deleted | | 328 lines changed or added | |
|
| optixu_matrix.h | | optixu_matrix.h | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 101 | |
| | | | |
| // Access the specified column 0..N. Returns float, float2, float3 or
float4 depending on the matrix size. | | // Access the specified column 0..N. Returns float, float2, float3 or
float4 depending on the matrix size. | |
| RT_HOSTDEVICE floatM getCol( unsigned int n )const; | | RT_HOSTDEVICE floatM getCol( unsigned int n )const; | |
| | | | |
| // Returns a pointer to the internal data array. The data array is sto
red in row-major order. | | // Returns a pointer to the internal data array. The data array is sto
red in row-major order. | |
| RT_HOSTDEVICE float* getData(); | | RT_HOSTDEVICE float* getData(); | |
| | | | |
| // Returns a const pointer to the internal data array. The data array
is stored in row-major order. | | // Returns a const pointer to the internal data array. The data array
is stored in row-major order. | |
| RT_HOSTDEVICE const float* getData()const; | | RT_HOSTDEVICE const float* getData()const; | |
| | | | |
|
| | | // Assign the specified row 0..M. Takes a float, float2, float3 or flo | |
| | | at4 depending on the matrix size. | |
| | | RT_HOSTDEVICE void setRow( unsigned int m, const floatN &r ); | |
| | | | |
| | | // Assign the specified column 0..N. Takes a float, float2, float3 or | |
| | | float4 depending on the matrix size. | |
| | | RT_HOSTDEVICE void setCol( unsigned int n, const floatM &c ); | |
| | | | |
| // Returns the transpose of the matrix. | | // Returns the transpose of the matrix. | |
| RT_HOSTDEVICE Matrix<N,M> transpose() const; | | RT_HOSTDEVICE Matrix<N,M> transpose() const; | |
| | | | |
| // Returns the inverse of the matrix. | | // Returns the inverse of the matrix. | |
| RT_HOSTDEVICE Matrix<4,4> inverse() const; | | RT_HOSTDEVICE Matrix<4,4> inverse() const; | |
| | | | |
|
| | | // Returns the determinant of the matrix. | |
| | | RT_HOSTDEVICE float det() const; | |
| | | | |
| // Returns a rotation matrix. | | // Returns a rotation matrix. | |
|
| RT_HOSTDEVICE static Matrix<4,4> rotate(const float angle, const float
3& axis); | | RT_HOSTDEVICE static Matrix<4,4> rotate(const float radians, const flo
at3& axis); | |
| | | | |
| // Returns a translation matrix. | | // Returns a translation matrix. | |
| RT_HOSTDEVICE static Matrix<4,4> translate(const float3& vec); | | RT_HOSTDEVICE static Matrix<4,4> translate(const float3& vec); | |
| | | | |
|
| | | // Returns a scale matrix. | |
| | | RT_HOSTDEVICE static Matrix<4,4> scale(const float3& vec); | |
| | | | |
| // Returns the identity matrix. | | // Returns the identity matrix. | |
| RT_HOSTDEVICE static Matrix<N,N> identity(); | | RT_HOSTDEVICE static Matrix<N,N> identity(); | |
| | | | |
| // Ordered comparison operator so that the matrix can be used in an STL
container. | | // Ordered comparison operator so that the matrix can be used in an STL
container. | |
| RT_HOSTDEVICE bool operator<( const Matrix<M, N>& rhs ) const; | | RT_HOSTDEVICE bool operator<( const Matrix<M, N>& rhs ) const; | |
| private: | | private: | |
|
| float _data[M*N]; | | float _data[M*N]; // The data array is stored in row-major order. | |
| }; | | }; | |
| | | | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
| RT_HOSTDEVICE Matrix<M,N>::Matrix() | | RT_HOSTDEVICE Matrix<M,N>::Matrix() | |
| { | | { | |
| } | | } | |
| | | | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
| RT_HOSTDEVICE Matrix<M,N>::Matrix( const Matrix<M,N>& m ) | | RT_HOSTDEVICE Matrix<M,N>::Matrix( const Matrix<M,N>& m ) | |
| { | | { | |
| | | | |
| skipping to change at line 170 | | skipping to change at line 182 | |
| typename Matrix<M,N>::floatN temp; | | typename Matrix<M,N>::floatN temp; | |
| float* v = reinterpret_cast<float*>( &temp ); | | float* v = reinterpret_cast<float*>( &temp ); | |
| const float* row = &( _data[m*N] ); | | const float* row = &( _data[m*N] ); | |
| for(unsigned int i = 0; i < N; ++i) | | for(unsigned int i = 0; i < N; ++i) | |
| v[i] = row[i]; | | v[i] = row[i]; | |
| | | | |
| return temp; | | return temp; | |
| } | | } | |
| | | | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
|
| typename Matrix<M,N>::floatM Matrix<M,N>::getCol( unsigned int n )const | | RT_HOSTDEVICE typename Matrix<M,N>::floatM Matrix<M,N>::getCol( unsigned
int n )const | |
| { | | { | |
| typename Matrix<M,N>::floatM temp; | | typename Matrix<M,N>::floatM temp; | |
| float* v = reinterpret_cast<float*>( &temp ); | | float* v = reinterpret_cast<float*>( &temp ); | |
| for ( unsigned int i = 0; i < M; ++i ) | | for ( unsigned int i = 0; i < M; ++i ) | |
| v[i] = MATRIX_ACCESS( _data, i, n ); | | v[i] = MATRIX_ACCESS( _data, i, n ); | |
| | | | |
| return temp; | | return temp; | |
| } | | } | |
| | | | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
|
| float* Matrix<M,N>::getData() | | RT_HOSTDEVICE float* Matrix<M,N>::getData() | |
| { | | { | |
| return _data; | | return _data; | |
| } | | } | |
| | | | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
|
| const float* Matrix<M,N>::getData() const | | RT_HOSTDEVICE const float* Matrix<M,N>::getData() const | |
| { | | { | |
| return _data; | | return _data; | |
| } | | } | |
| | | | |
|
| | | template<unsigned int M, unsigned int N> | |
| | | RT_HOSTDEVICE void Matrix<M,N>::setRow( unsigned int m, const typename Ma | |
| | | trix<M,N>::floatN &r ) | |
| | | { | |
| | | const float* v = reinterpret_cast<const float*>( &r ); | |
| | | float* row = &( _data[m*N] ); | |
| | | for(unsigned int i = 0; i < N; ++i) | |
| | | row[i] = v[i]; | |
| | | } | |
| | | | |
| | | template<unsigned int M, unsigned int N> | |
| | | RT_HOSTDEVICE void Matrix<M,N>::setCol( unsigned int n, const typename Ma | |
| | | trix<M,N>::floatM &c ) | |
| | | { | |
| | | const float* v = reinterpret_cast<const float*>( &c ); | |
| | | for ( unsigned int i = 0; i < M; ++i ) | |
| | | MATRIX_ACCESS( _data, i, n ) = v[i]; | |
| | | } | |
| | | | |
| // Subtract two matrices of the same size. | | // Subtract two matrices of the same size. | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
| RT_HOSTDEVICE Matrix<M,N> operator-(const Matrix<M,N>& m1, const Matrix<M
,N>& m2) | | RT_HOSTDEVICE Matrix<M,N> operator-(const Matrix<M,N>& m1, const Matrix<M
,N>& m2) | |
| { | | { | |
| Matrix<M,N> temp( m1 ); | | Matrix<M,N> temp( m1 ); | |
| temp -= m2; | | temp -= m2; | |
| return temp; | | return temp; | |
| } | | } | |
| | | | |
| // Subtract two matrices of the same size. | | // Subtract two matrices of the same size. | |
| | | | |
| skipping to change at line 221 | | skipping to change at line 250 | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
| RT_HOSTDEVICE Matrix<M,N> operator+(const Matrix<M,N>& m1, const Matrix<M
,N>& m2) | | RT_HOSTDEVICE Matrix<M,N> operator+(const Matrix<M,N>& m1, const Matrix<M
,N>& m2) | |
| { | | { | |
| Matrix<M,N> temp( m1 ); | | Matrix<M,N> temp( m1 ); | |
| temp += m2; | | temp += m2; | |
| return temp; | | return temp; | |
| } | | } | |
| | | | |
| // Add two matrices of the same size. | | // Add two matrices of the same size. | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
|
| RT_HOSTDEVICE Matrix<M,N>& operator+=(Matrix<M,N>& m1, const Matrix<M,N
>& m2) | | RT_HOSTDEVICE Matrix<M,N>& operator+=(Matrix<M,N>& m1, const Matrix<M,N>&
m2) | |
| { | | { | |
| for ( unsigned int i = 0; i < M*N; ++i ) | | for ( unsigned int i = 0; i < M*N; ++i ) | |
| m1[i] += m2[i]; | | m1[i] += m2[i]; | |
| return m1; | | return m1; | |
| } | | } | |
| | | | |
| // Multiply two compatible matrices. | | // Multiply two compatible matrices. | |
| template<unsigned int M, unsigned int N, unsigned int R> | | template<unsigned int M, unsigned int N, unsigned int R> | |
| RT_HOSTDEVICE Matrix<M,R> operator*( const Matrix<M,N>& m1, const Matrix<
N,R>& m2) | | RT_HOSTDEVICE Matrix<M,R> operator*( const Matrix<M,N>& m1, const Matrix<
N,R>& m2) | |
| { | | { | |
| | | | |
| skipping to change at line 439 | | skipping to change at line 468 | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
| RT_HOSTDEVICE inline Matrix<N,M> Matrix<M,N>::transpose() const | | RT_HOSTDEVICE inline Matrix<N,M> Matrix<M,N>::transpose() const | |
| { | | { | |
| Matrix<N,M> ret; | | Matrix<N,M> ret; | |
| for( unsigned int row = 0; row < M; ++row ) | | for( unsigned int row = 0; row < M; ++row ) | |
| for( unsigned int col = 0; col < N; ++col ) | | for( unsigned int col = 0; col < N; ++col ) | |
| ret._data[col*M+row] = _data[row*N+col]; | | ret._data[col*M+row] = _data[row*N+col]; | |
| return ret; | | return ret; | |
| } | | } | |
| | | | |
|
| // Returns the inverse of the matrix. | | // Returns the determinant of the matrix. | |
| template<> | | template<> | |
|
| RT_HOSTDEVICE inline Matrix<4,4> Matrix<4,4>::inverse() const | | RT_HOSTDEVICE inline float Matrix<3,3>::det() const | |
| { | | { | |
|
| Matrix<4,4> dst; | | | |
| const float* m = _data; | | const float* m = _data; | |
|
| const float det = | | float d = m[0]*m[4]*m[8] + m[1]*m[5]*m[6] + m[2]*m[3]*m[7] | |
| | | - m[0]*m[5]*m[7] - m[1]*m[3]*m[8] - m[2]*m[4]*m[6]; | |
| | | return d; | |
| | | } | |
| | | | |
| | | // Returns the determinant of the matrix. | |
| | | template<> | |
| | | RT_HOSTDEVICE inline float Matrix<4,4>::det() const | |
| | | { | |
| | | const float* m = _data; | |
| | | float d = | |
| m[0]*m[5]*m[10]*m[15]- | | m[0]*m[5]*m[10]*m[15]- | |
| m[0]*m[5]*m[11]*m[14]+m[0]*m[9]*m[14]*m[7]- | | m[0]*m[5]*m[11]*m[14]+m[0]*m[9]*m[14]*m[7]- | |
| m[0]*m[9]*m[6]*m[15]+m[0]*m[13]*m[6]*m[11]- | | m[0]*m[9]*m[6]*m[15]+m[0]*m[13]*m[6]*m[11]- | |
| m[0]*m[13]*m[10]*m[7]-m[4]*m[1]*m[10]*m[15]+m[4]*m[1]*m[11]*m[14]- | | m[0]*m[13]*m[10]*m[7]-m[4]*m[1]*m[10]*m[15]+m[4]*m[1]*m[11]*m[14]- | |
| m[4]*m[9]*m[14]*m[3]+m[4]*m[9]*m[2]*m[15]- | | m[4]*m[9]*m[14]*m[3]+m[4]*m[9]*m[2]*m[15]- | |
| m[4]*m[13]*m[2]*m[11]+m[4]*m[13]*m[10]*m[3]+m[8]*m[1]*m[6]*m[15]- | | m[4]*m[13]*m[2]*m[11]+m[4]*m[13]*m[10]*m[3]+m[8]*m[1]*m[6]*m[15]- | |
| m[8]*m[1]*m[14]*m[7]+m[8]*m[5]*m[14]*m[3]- | | m[8]*m[1]*m[14]*m[7]+m[8]*m[5]*m[14]*m[3]- | |
| m[8]*m[5]*m[2]*m[15]+m[8]*m[13]*m[2]*m[7]- | | m[8]*m[5]*m[2]*m[15]+m[8]*m[13]*m[2]*m[7]- | |
| m[8]*m[13]*m[6]*m[3]- | | m[8]*m[13]*m[6]*m[3]- | |
| m[12]*m[1]*m[6]*m[11]+m[12]*m[1]*m[10]*m[7]- | | m[12]*m[1]*m[6]*m[11]+m[12]*m[1]*m[10]*m[7]- | |
| m[12]*m[5]*m[10]*m[3]+m[12]*m[5]*m[2]*m[11]- | | m[12]*m[5]*m[10]*m[3]+m[12]*m[5]*m[2]*m[11]- | |
| m[12]*m[9]*m[2]*m[7]+m[12]*m[9]*m[6]*m[3]; | | m[12]*m[9]*m[2]*m[7]+m[12]*m[9]*m[6]*m[3]; | |
|
| | | return d; | |
| | | } | |
| | | | |
|
| const float d = 1.0f / det; | | // Returns the inverse of the matrix. | |
| | | template<> | |
| | | RT_HOSTDEVICE inline Matrix<4,4> Matrix<4,4>::inverse() const | |
| | | { | |
| | | Matrix<4,4> dst; | |
| | | const float* m = _data; | |
| | | const float d = 1.0f / det(); | |
| | | | |
| dst[0] = d * (m[5] * (m[10] * m[15] - m[14] * m[11]) + m[9] * (m[14] *
m[7] - m[6] * m[15]) + m[13] * (m[6] * m[11] - m[10] * m[7])); | | dst[0] = d * (m[5] * (m[10] * m[15] - m[14] * m[11]) + m[9] * (m[14] *
m[7] - m[6] * m[15]) + m[13] * (m[6] * m[11] - m[10] * m[7])); | |
| dst[4] = d * (m[6] * (m[8] * m[15] - m[12] * m[11]) + m[10] * (m[12] *
m[7] - m[4] * m[15]) + m[14] * (m[4] * m[11] - m[8] * m[7])); | | dst[4] = d * (m[6] * (m[8] * m[15] - m[12] * m[11]) + m[10] * (m[12] *
m[7] - m[4] * m[15]) + m[14] * (m[4] * m[11] - m[8] * m[7])); | |
| dst[8] = d * (m[7] * (m[8] * m[13] - m[12] * m[9]) + m[11] * (m[12] *
m[5] - m[4] * m[13]) + m[15] * (m[4] * m[9] - m[8] * m[5])); | | dst[8] = d * (m[7] * (m[8] * m[13] - m[12] * m[9]) + m[11] * (m[12] *
m[5] - m[4] * m[13]) + m[15] * (m[4] * m[9] - m[8] * m[5])); | |
| dst[12] = d * (m[4] * (m[13] * m[10] - m[9] * m[14]) + m[8] * (m[5] * m
[14] - m[13] * m[6]) + m[12] * (m[9] * m[6] - m[5] * m[10])); | | dst[12] = d * (m[4] * (m[13] * m[10] - m[9] * m[14]) + m[8] * (m[5] * m
[14] - m[13] * m[6]) + m[12] * (m[9] * m[6] - m[5] * m[10])); | |
| dst[1] = d * (m[9] * (m[2] * m[15] - m[14] * m[3]) + m[13] * (m[10] *
m[3] - m[2] * m[11]) + m[1] * (m[14] * m[11] - m[10] * m[15])); | | dst[1] = d * (m[9] * (m[2] * m[15] - m[14] * m[3]) + m[13] * (m[10] *
m[3] - m[2] * m[11]) + m[1] * (m[14] * m[11] - m[10] * m[15])); | |
| dst[5] = d * (m[10] * (m[0] * m[15] - m[12] * m[3]) + m[14] * (m[8] *
m[3] - m[0] * m[11]) + m[2] * (m[12] * m[11] - m[8] * m[15])); | | dst[5] = d * (m[10] * (m[0] * m[15] - m[12] * m[3]) + m[14] * (m[8] *
m[3] - m[0] * m[11]) + m[2] * (m[12] * m[11] - m[8] * m[15])); | |
| dst[9] = d * (m[11] * (m[0] * m[13] - m[12] * m[1]) + m[15] * (m[8] *
m[1] - m[0] * m[9]) + m[3] * (m[12] * m[9] - m[8] * m[13])); | | dst[9] = d * (m[11] * (m[0] * m[13] - m[12] * m[1]) + m[15] * (m[8] *
m[1] - m[0] * m[9]) + m[3] * (m[12] * m[9] - m[8] * m[13])); | |
| dst[13] = d * (m[8] * (m[13] * m[2] - m[1] * m[14]) + m[12] * (m[1] * m
[10] - m[9] * m[2]) + m[0] * (m[9] * m[14] - m[13] * m[10])); | | dst[13] = d * (m[8] * (m[13] * m[2] - m[1] * m[14]) + m[12] * (m[1] * m
[10] - m[9] * m[2]) + m[0] * (m[9] * m[14] - m[13] * m[10])); | |
| dst[2] = d * (m[13] * (m[2] * m[7] - m[6] * m[3]) + m[1] * (m[6] * m[1
5] - m[14] * m[7]) + m[5] * (m[14] * m[3] - m[2] * m[15])); | | dst[2] = d * (m[13] * (m[2] * m[7] - m[6] * m[3]) + m[1] * (m[6] * m[1
5] - m[14] * m[7]) + m[5] * (m[14] * m[3] - m[2] * m[15])); | |
| | | | |
| skipping to change at line 483 | | skipping to change at line 529 | |
| dst[3] = d * (m[1] * (m[10] * m[7] - m[6] * m[11]) + m[5] * (m[2] * m[
11] - m[10] * m[3]) + m[9] * (m[6] * m[3] - m[2] * m[7])); | | dst[3] = d * (m[1] * (m[10] * m[7] - m[6] * m[11]) + m[5] * (m[2] * m[
11] - m[10] * m[3]) + m[9] * (m[6] * m[3] - m[2] * m[7])); | |
| dst[7] = d * (m[2] * (m[8] * m[7] - m[4] * m[11]) + m[6] * (m[0] * m[1
1] - m[8] * m[3]) + m[10] * (m[4] * m[3] - m[0] * m[7])); | | dst[7] = d * (m[2] * (m[8] * m[7] - m[4] * m[11]) + m[6] * (m[0] * m[1
1] - m[8] * m[3]) + m[10] * (m[4] * m[3] - m[0] * m[7])); | |
| dst[11] = d * (m[3] * (m[8] * m[5] - m[4] * m[9]) + m[7] * (m[0] * m[9]
- m[8] * m[1]) + m[11] * (m[4] * m[1] - m[0] * m[5])); | | dst[11] = d * (m[3] * (m[8] * m[5] - m[4] * m[9]) + m[7] * (m[0] * m[9]
- m[8] * m[1]) + m[11] * (m[4] * m[1] - m[0] * m[5])); | |
| dst[15] = d * (m[0] * (m[5] * m[10] - m[9] * m[6]) + m[4] * (m[9] * m[2
] - m[1] * m[10]) + m[8] * (m[1] * m[6] - m[5] * m[2])); | | dst[15] = d * (m[0] * (m[5] * m[10] - m[9] * m[6]) + m[4] * (m[9] * m[2
] - m[1] * m[10]) + m[8] * (m[1] * m[6] - m[5] * m[2])); | |
| return dst; | | return dst; | |
| } | | } | |
| | | | |
| // Returns a rotation matrix. | | // Returns a rotation matrix. | |
| // This is a static member. | | // This is a static member. | |
| template<> | | template<> | |
|
| RT_HOSTDEVICE Matrix<4,4> inline Matrix<4,4>::rotate(const float angle, c
onst float3& axis) | | RT_HOSTDEVICE Matrix<4,4> inline Matrix<4,4>::rotate(const float radians,
const float3& axis) | |
| { | | { | |
| Matrix<4,4> Mat = Matrix<4,4>::identity(); | | Matrix<4,4> Mat = Matrix<4,4>::identity(); | |
| float *m = Mat.getData(); | | float *m = Mat.getData(); | |
| | | | |
| // NOTE: Element 0,1 is wrong in Foley and Van Dam, Pg 227! | | // NOTE: Element 0,1 is wrong in Foley and Van Dam, Pg 227! | |
|
| float sintheta=sinf(angle); | | float sintheta=sinf(radians); | |
| float costheta=cosf(angle); | | float costheta=cosf(radians); | |
| float ux=axis.x; | | float ux=axis.x; | |
| float uy=axis.y; | | float uy=axis.y; | |
| float uz=axis.z; | | float uz=axis.z; | |
| m[0*4+0]=ux*ux+costheta*(1-ux*ux); | | m[0*4+0]=ux*ux+costheta*(1-ux*ux); | |
| m[0*4+1]=ux*uy*(1-costheta)-uz*sintheta; | | m[0*4+1]=ux*uy*(1-costheta)-uz*sintheta; | |
| m[0*4+2]=uz*ux*(1-costheta)+uy*sintheta; | | m[0*4+2]=uz*ux*(1-costheta)+uy*sintheta; | |
| m[0*4+3]=0; | | m[0*4+3]=0; | |
| | | | |
| m[1*4+0]=ux*uy*(1-costheta)+uz*sintheta; | | m[1*4+0]=ux*uy*(1-costheta)+uz*sintheta; | |
| m[1*4+1]=uy*uy+costheta*(1-uy*uy); | | m[1*4+1]=uy*uy+costheta*(1-uy*uy); | |
| | | | |
| skipping to change at line 532 | | skipping to change at line 578 | |
| Matrix<4,4> Mat = Matrix<4,4>::identity(); | | Matrix<4,4> Mat = Matrix<4,4>::identity(); | |
| float *m = Mat.getData(); | | float *m = Mat.getData(); | |
| | | | |
| m[3] = vec.x; | | m[3] = vec.x; | |
| m[7] = vec.y; | | m[7] = vec.y; | |
| m[11]= vec.z; | | m[11]= vec.z; | |
| | | | |
| return Matrix<4,4>( m ); | | return Matrix<4,4>( m ); | |
| } | | } | |
| | | | |
|
| | | // Returns a scale matrix. | |
| | | // This is a static member. | |
| | | template<> | |
| | | RT_HOSTDEVICE Matrix<4,4> inline Matrix<4,4>::scale(const float3& vec) | |
| | | { | |
| | | Matrix<4,4> Mat = Matrix<4,4>::identity(); | |
| | | float *m = Mat.getData(); | |
| | | | |
| | | m[0] = vec.x; | |
| | | m[5] = vec.y; | |
| | | m[10]= vec.z; | |
| | | | |
| | | return Matrix<4,4>( m ); | |
| | | } | |
| | | | |
| // Returns the identity matrix. | | // Returns the identity matrix. | |
|
| | | // This is a static member. | |
| template<unsigned int M, unsigned int N> | | template<unsigned int M, unsigned int N> | |
| RT_HOSTDEVICE Matrix<N,N> Matrix<M,N>::identity() | | RT_HOSTDEVICE Matrix<N,N> Matrix<M,N>::identity() | |
| { | | { | |
| float temp[N*N]; | | float temp[N*N]; | |
| for(unsigned int i = 0; i < N*N; ++i) | | for(unsigned int i = 0; i < N*N; ++i) | |
| temp[i] = 0; | | temp[i] = 0; | |
| for( unsigned int i = 0; i < N; ++i ) | | for( unsigned int i = 0; i < N; ++i ) | |
| MATRIX_ACCESS( temp,i,i ) = 1.0f; | | MATRIX_ACCESS( temp,i,i ) = 1.0f; | |
| return Matrix<N,N>( temp ); | | return Matrix<N,N>( temp ); | |
| } | | } | |
| | | | |
End of changes. 20 change blocks. |
| 14 lines changed or deleted | | 80 lines changed or added | |
|