NVIDIA OptiX 8.0 nvidia_logo_transpbg.gif Up
optix_device_impl_transformations.h
Go to the documentation of this file.
1/*
2* Copyright (c) 2023 NVIDIA Corporation. All rights reserved.
3*
4* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
5* rights in and to this software, related documentation and any modifications thereto.
6* Any use, reproduction, disclosure or distribution of this software and related
7* documentation without an express license agreement from NVIDIA Corporation is strictly
8* prohibited.
9*
10* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
11* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
12* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
13* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
14* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
15* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
16* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
17* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
18* SUCH DAMAGES
19*/
20
29#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ )
30#error("optix_device_impl_transformations.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.")
31#endif
32
33#ifndef OPTIX_OPTIX_DEVICE_IMPL_TRANSFORMATIONS_H
34#define OPTIX_OPTIX_DEVICE_IMPL_TRANSFORMATIONS_H
35
36namespace optix_impl {
37
38static __forceinline__ __device__ float4 optixAddFloat4( const float4& a, const float4& b )
39{
40 return make_float4( a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w );
41}
42
43static __forceinline__ __device__ float4 optixMulFloat4( const float4& a, float b )
44{
45 return make_float4( a.x * b, a.y * b, a.z * b, a.w * b );
46}
47
48static __forceinline__ __device__ uint4 optixLdg( unsigned long long addr )
49{
50 const uint4* ptr;
51 asm volatile( "cvta.to.global.u64 %0, %1;" : "=l"( ptr ) : "l"( addr ) );
52 uint4 ret;
53 asm volatile( "ld.global.v4.u32 {%0,%1,%2,%3}, [%4];"
54 : "=r"( ret.x ), "=r"( ret.y ), "=r"( ret.z ), "=r"( ret.w )
55 : "l"( ptr ) );
56 return ret;
57}
58
59template <class T>
60static __forceinline__ __device__ T optixLoadReadOnlyAlign16( const T* ptr )
61{
62 // Debug mode may keep this temporary variable
63 // If T does not enforce 16B alignment, v may not be 16B aligned and storing the loaded data from ptr fails
64 __align__(16) T v;
65 for( int ofs = 0; ofs < sizeof( T ); ofs += 16 )
66 *(uint4*)( (char*)&v + ofs ) = optixLdg( (unsigned long long)( (char*)ptr + ofs ) );
67 return v;
68}
69
70// Multiplies the row vector vec with the 3x4 matrix with rows m0, m1, and m2
71static __forceinline__ __device__ float4 optixMultiplyRowMatrix( const float4 vec, const float4 m0, const float4 m1, const float4 m2 )
72{
73 float4 result;
74
75 result.x = vec.x * m0.x + vec.y * m1.x + vec.z * m2.x;
76 result.y = vec.x * m0.y + vec.y * m1.y + vec.z * m2.y;
77 result.z = vec.x * m0.z + vec.y * m1.z + vec.z * m2.z;
78 result.w = vec.x * m0.w + vec.y * m1.w + vec.z * m2.w + vec.w;
79
80 return result;
81}
82
83// Converts the SRT transformation srt into a 3x4 matrix with rows m0, m1, and m2
84static __forceinline__ __device__ void optixGetMatrixFromSrt( float4& m0, float4& m1, float4& m2, const OptixSRTData& srt )
85{
86 const float4 q = {srt.qx, srt.qy, srt.qz, srt.qw};
87
88 // normalize
89 const float inv_sql = 1.f / ( srt.qx * srt.qx + srt.qy * srt.qy + srt.qz * srt.qz + srt.qw * srt.qw );
90 const float4 nq = optixMulFloat4( q, inv_sql );
91
92 const float sqw = q.w * nq.w;
93 const float sqx = q.x * nq.x;
94 const float sqy = q.y * nq.y;
95 const float sqz = q.z * nq.z;
96
97 const float xy = q.x * nq.y;
98 const float zw = q.z * nq.w;
99 const float xz = q.x * nq.z;
100 const float yw = q.y * nq.w;
101 const float yz = q.y * nq.z;
102 const float xw = q.x * nq.w;
103
104 m0.x = ( sqx - sqy - sqz + sqw );
105 m0.y = 2.0f * ( xy - zw );
106 m0.z = 2.0f * ( xz + yw );
107
108 m1.x = 2.0f * ( xy + zw );
109 m1.y = ( -sqx + sqy - sqz + sqw );
110 m1.z = 2.0f * ( yz - xw );
111
112 m2.x = 2.0f * ( xz - yw );
113 m2.y = 2.0f * ( yz + xw );
114 m2.z = ( -sqx - sqy + sqz + sqw );
115
116 m0.w = m0.x * srt.pvx + m0.y * srt.pvy + m0.z * srt.pvz + srt.tx;
117 m1.w = m1.x * srt.pvx + m1.y * srt.pvy + m1.z * srt.pvz + srt.ty;
118 m2.w = m2.x * srt.pvx + m2.y * srt.pvy + m2.z * srt.pvz + srt.tz;
119
120 m0.z = m0.x * srt.b + m0.y * srt.c + m0.z * srt.sz;
121 m1.z = m1.x * srt.b + m1.y * srt.c + m1.z * srt.sz;
122 m2.z = m2.x * srt.b + m2.y * srt.c + m2.z * srt.sz;
123
124 m0.y = m0.x * srt.a + m0.y * srt.sy;
125 m1.y = m1.x * srt.a + m1.y * srt.sy;
126 m2.y = m2.x * srt.a + m2.y * srt.sy;
127
128 m0.x = m0.x * srt.sx;
129 m1.x = m1.x * srt.sx;
130 m2.x = m2.x * srt.sx;
131}
132
133// Inverts a 3x4 matrix in place
134static __forceinline__ __device__ void optixInvertMatrix( float4& m0, float4& m1, float4& m2 )
135{
136 const float det3 =
137 m0.x * ( m1.y * m2.z - m1.z * m2.y ) - m0.y * ( m1.x * m2.z - m1.z * m2.x ) + m0.z * ( m1.x * m2.y - m1.y * m2.x );
138
139 const float inv_det3 = 1.0f / det3;
140
141 float inv3[3][3];
142 inv3[0][0] = inv_det3 * ( m1.y * m2.z - m2.y * m1.z );
143 inv3[0][1] = inv_det3 * ( m0.z * m2.y - m2.z * m0.y );
144 inv3[0][2] = inv_det3 * ( m0.y * m1.z - m1.y * m0.z );
145
146 inv3[1][0] = inv_det3 * ( m1.z * m2.x - m2.z * m1.x );
147 inv3[1][1] = inv_det3 * ( m0.x * m2.z - m2.x * m0.z );
148 inv3[1][2] = inv_det3 * ( m0.z * m1.x - m1.z * m0.x );
149
150 inv3[2][0] = inv_det3 * ( m1.x * m2.y - m2.x * m1.y );
151 inv3[2][1] = inv_det3 * ( m0.y * m2.x - m2.y * m0.x );
152 inv3[2][2] = inv_det3 * ( m0.x * m1.y - m1.x * m0.y );
153
154 const float b[3] = {m0.w, m1.w, m2.w};
155
156 m0.x = inv3[0][0];
157 m0.y = inv3[0][1];
158 m0.z = inv3[0][2];
159 m0.w = -inv3[0][0] * b[0] - inv3[0][1] * b[1] - inv3[0][2] * b[2];
160
161 m1.x = inv3[1][0];
162 m1.y = inv3[1][1];
163 m1.z = inv3[1][2];
164 m1.w = -inv3[1][0] * b[0] - inv3[1][1] * b[1] - inv3[1][2] * b[2];
165
166 m2.x = inv3[2][0];
167 m2.y = inv3[2][1];
168 m2.z = inv3[2][2];
169 m2.w = -inv3[2][0] * b[0] - inv3[2][1] * b[1] - inv3[2][2] * b[2];
170}
171
172static __forceinline__ __device__ void optixLoadInterpolatedMatrixKey( float4& m0, float4& m1, float4& m2, const float4* matrix, const float t1 )
173{
174 m0 = optixLoadReadOnlyAlign16( &matrix[0] );
175 m1 = optixLoadReadOnlyAlign16( &matrix[1] );
176 m2 = optixLoadReadOnlyAlign16( &matrix[2] );
177
178 // The conditional prevents concurrent loads leading to spills
179 if( t1 > 0.0f )
180 {
181 const float t0 = 1.0f - t1;
182 m0 = optixAddFloat4( optixMulFloat4( m0, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &matrix[3] ), t1 ) );
183 m1 = optixAddFloat4( optixMulFloat4( m1, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &matrix[4] ), t1 ) );
184 m2 = optixAddFloat4( optixMulFloat4( m2, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &matrix[5] ), t1 ) );
185 }
186}
187
188static __forceinline__ __device__ void optixLoadInterpolatedSrtKey( float4& srt0,
189 float4& srt1,
190 float4& srt2,
191 float4& srt3,
192 const float4* srt,
193 const float t1 )
194{
195 srt0 = optixLoadReadOnlyAlign16( &srt[0] );
196 srt1 = optixLoadReadOnlyAlign16( &srt[1] );
197 srt2 = optixLoadReadOnlyAlign16( &srt[2] );
198 srt3 = optixLoadReadOnlyAlign16( &srt[3] );
199
200 // The conditional prevents concurrent loads leading to spills
201 if( t1 > 0.0f )
202 {
203 const float t0 = 1.0f - t1;
204 srt0 = optixAddFloat4( optixMulFloat4( srt0, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[4] ), t1 ) );
205 srt1 = optixAddFloat4( optixMulFloat4( srt1, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[5] ), t1 ) );
206 srt2 = optixAddFloat4( optixMulFloat4( srt2, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[6] ), t1 ) );
207 srt3 = optixAddFloat4( optixMulFloat4( srt3, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[7] ), t1 ) );
208
209 float inv_length = 1.f / sqrt( srt2.y * srt2.y + srt2.z * srt2.z + srt2.w * srt2.w + srt3.x * srt3.x );
210 srt2.y *= inv_length;
211 srt2.z *= inv_length;
212 srt2.w *= inv_length;
213 srt3.x *= inv_length;
214 }
215}
216
217static __forceinline__ __device__ void optixResolveMotionKey( float& localt, int& key, const OptixMotionOptions& options, const float globalt )
218{
219 const float timeBegin = options.timeBegin;
220 const float timeEnd = options.timeEnd;
221 const float numIntervals = (float)( options.numKeys - 1 );
222
223 // No need to check the motion flags. If data originates from a valid transform list handle, then globalt is in
224 // range, or vanish flags are not set.
225
226 // should be NaN or in [0,numIntervals]
227 float time = max( 0.f, min( numIntervals, numIntervals * __fdividef( globalt - timeBegin, timeEnd - timeBegin ) ) );
228
229 // catch NaN (for example when timeBegin=timeEnd)
230 if( time != time )
231 time = 0.f;
232
233 const float fltKey = fminf( floorf(time), numIntervals - 1 );
234
235 localt = time - fltKey;
236 key = (int)fltKey;
237}
238
239// Returns the interpolated transformation matrix for a particular matrix motion transformation and point in time.
240static __forceinline__ __device__ void optixGetInterpolatedTransformation( float4& trf0,
241 float4& trf1,
242 float4& trf2,
243 const OptixMatrixMotionTransform* transformData,
244 const float time )
245{
246 // Compute key and intra key time
247 float keyTime;
248 int key;
249 optixResolveMotionKey( keyTime, key, optixLoadReadOnlyAlign16( transformData ).motionOptions, time );
250
251 // Get pointer to left key
252 const float4* transform = (const float4*)( &transformData->transform[key][0] );
253
254 // Load and interpolate matrix keys
255 optixLoadInterpolatedMatrixKey( trf0, trf1, trf2, transform, keyTime );
256}
257
258// Returns the interpolated transformation matrix for a particular SRT motion transformation and point in time.
259static __forceinline__ __device__ void optixGetInterpolatedTransformation( float4& trf0,
260 float4& trf1,
261 float4& trf2,
262 const OptixSRTMotionTransform* transformData,
263 const float time )
264{
265 // Compute key and intra key time
266 float keyTime;
267 int key;
268 optixResolveMotionKey( keyTime, key, optixLoadReadOnlyAlign16( transformData ).motionOptions, time );
269
270 // Get pointer to left key
271 const float4* dataPtr = reinterpret_cast<const float4*>( &transformData->srtData[key] );
272
273 // Load and interpolated SRT keys
274 float4 data[4];
275 optixLoadInterpolatedSrtKey( data[0], data[1], data[2], data[3], dataPtr, keyTime );
276
277 OptixSRTData srt = {data[0].x, data[0].y, data[0].z, data[0].w, data[1].x, data[1].y, data[1].z, data[1].w,
278 data[2].x, data[2].y, data[2].z, data[2].w, data[3].x, data[3].y, data[3].z, data[3].w};
279
280 // Convert SRT into a matrix
281 optixGetMatrixFromSrt( trf0, trf1, trf2, srt );
282}
283
284// Returns the interpolated transformation matrix for a particular traversable handle and point in time.
285static __forceinline__ __device__ void optixGetInterpolatedTransformationFromHandle( float4& trf0,
286 float4& trf1,
287 float4& trf2,
288 const OptixTraversableHandle handle,
289 const float time,
290 const bool objectToWorld )
291{
293
295 {
297 {
299 optixGetInterpolatedTransformation( trf0, trf1, trf2, transformData, time );
300 }
301 else
302 {
303 const OptixSRTMotionTransform* transformData = optixGetSRTMotionTransformFromHandle( handle );
304 optixGetInterpolatedTransformation( trf0, trf1, trf2, transformData, time );
305 }
306
307 if( !objectToWorld )
308 optixInvertMatrix( trf0, trf1, trf2 );
309 }
311 {
312 const float4* transform;
313
315 {
316 transform = ( objectToWorld ) ? optixGetInstanceTransformFromHandle( handle ) :
318 }
319 else
320 {
321 const OptixStaticTransform* traversable = optixGetStaticTransformFromHandle( handle );
322 transform = (const float4*)( ( objectToWorld ) ? traversable->transform : traversable->invTransform );
323 }
324
325 trf0 = optixLoadReadOnlyAlign16( &transform[0] );
326 trf1 = optixLoadReadOnlyAlign16( &transform[1] );
327 trf2 = optixLoadReadOnlyAlign16( &transform[2] );
328 }
329 else
330 {
331 trf0 = {1.0f, 0.0f, 0.0f, 0.0f};
332 trf1 = {0.0f, 1.0f, 0.0f, 0.0f};
333 trf2 = {0.0f, 0.0f, 1.0f, 0.0f};
334 }
335}
336
337// Returns the world-to-object transformation matrix resulting from the current transform stack and current ray time.
338static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( float4& m0, float4& m1, float4& m2 )
339{
340 const unsigned int size = optixGetTransformListSize();
341 const float time = optixGetRayTime();
342
343#pragma unroll 1
344 for( unsigned int i = 0; i < size; ++i )
345 {
347
348 float4 trf0, trf1, trf2;
349 optixGetInterpolatedTransformationFromHandle( trf0, trf1, trf2, handle, time, /*objectToWorld*/ false );
350
351 if( i == 0 )
352 {
353 m0 = trf0;
354 m1 = trf1;
355 m2 = trf2;
356 }
357 else
358 {
359 // m := trf * m
360 float4 tmp0 = m0, tmp1 = m1, tmp2 = m2;
361 m0 = optixMultiplyRowMatrix( trf0, tmp0, tmp1, tmp2 );
362 m1 = optixMultiplyRowMatrix( trf1, tmp0, tmp1, tmp2 );
363 m2 = optixMultiplyRowMatrix( trf2, tmp0, tmp1, tmp2 );
364 }
365 }
366}
367
368// Returns the object-to-world transformation matrix resulting from the current transform stack and current ray time.
369static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( float4& m0, float4& m1, float4& m2 )
370{
371 const int size = optixGetTransformListSize();
372 const float time = optixGetRayTime();
373
374#pragma unroll 1
375 for( int i = size - 1; i >= 0; --i )
376 {
378
379 float4 trf0, trf1, trf2;
380 optixGetInterpolatedTransformationFromHandle( trf0, trf1, trf2, handle, time, /*objectToWorld*/ true );
381
382 if( i == size - 1 )
383 {
384 m0 = trf0;
385 m1 = trf1;
386 m2 = trf2;
387 }
388 else
389 {
390 // m := trf * m
391 float4 tmp0 = m0, tmp1 = m1, tmp2 = m2;
392 m0 = optixMultiplyRowMatrix( trf0, tmp0, tmp1, tmp2 );
393 m1 = optixMultiplyRowMatrix( trf1, tmp0, tmp1, tmp2 );
394 m2 = optixMultiplyRowMatrix( trf2, tmp0, tmp1, tmp2 );
395 }
396 }
397}
398
399// Multiplies the 3x4 matrix with rows m0, m1, m2 with the point p.
400static __forceinline__ __device__ float3 optixTransformPoint( const float4& m0, const float4& m1, const float4& m2, const float3& p )
401{
402 float3 result;
403 result.x = m0.x * p.x + m0.y * p.y + m0.z * p.z + m0.w;
404 result.y = m1.x * p.x + m1.y * p.y + m1.z * p.z + m1.w;
405 result.z = m2.x * p.x + m2.y * p.y + m2.z * p.z + m2.w;
406 return result;
407}
408
409// Multiplies the 3x3 linear submatrix of the 3x4 matrix with rows m0, m1, m2 with the vector v.
410static __forceinline__ __device__ float3 optixTransformVector( const float4& m0, const float4& m1, const float4& m2, const float3& v )
411{
412 float3 result;
413 result.x = m0.x * v.x + m0.y * v.y + m0.z * v.z;
414 result.y = m1.x * v.x + m1.y * v.y + m1.z * v.z;
415 result.z = m2.x * v.x + m2.y * v.y + m2.z * v.z;
416 return result;
417}
418
419// Multiplies the transpose of the 3x3 linear submatrix of the 3x4 matrix with rows m0, m1, m2 with the normal n.
420// Note that the given matrix is supposed to be the inverse of the actual transformation matrix.
421static __forceinline__ __device__ float3 optixTransformNormal( const float4& m0, const float4& m1, const float4& m2, const float3& n )
422{
423 float3 result;
424 result.x = m0.x * n.x + m1.x * n.y + m2.x * n.z;
425 result.y = m0.y * n.x + m1.y * n.y + m2.y * n.z;
426 result.z = m0.z * n.x + m1.z * n.y + m2.z * n.z;
427 return result;
428}
429
430} // namespace optix_impl
431
432#endif // OPTIX_OPTIX_DEVICE_IMPL_TRANSFORMATIONS_H
OptixTransformType
Transform.
Definition: optix_types.h:1855
unsigned long long OptixTraversableHandle
Traversable handle.
Definition: optix_types.h:77
@ OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM
Definition: optix_types.h:1859
@ OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM
Definition: optix_types.h:1857
@ OPTIX_TRANSFORM_TYPE_INSTANCE
Definition: optix_types.h:1860
@ OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM
Definition: optix_types.h:1858
Definition: optix_device_impl_transformations.h:36
static __forceinline__ __device__ void optixGetMatrixFromSrt(float4 &m0, float4 &m1, float4 &m2, const OptixSRTData &srt)
Definition: optix_device_impl_transformations.h:84
static __forceinline__ __device__ void optixResolveMotionKey(float &localt, int &key, const OptixMotionOptions &options, const float globalt)
Definition: optix_device_impl_transformations.h:217
static __forceinline__ __device__ float4 optixAddFloat4(const float4 &a, const float4 &b)
Definition: optix_device_impl_transformations.h:38
static __forceinline__ __device__ float4 optixMulFloat4(const float4 &a, float b)
Definition: optix_device_impl_transformations.h:43
static __forceinline__ __device__ T optixLoadReadOnlyAlign16(const T *ptr)
Definition: optix_device_impl_transformations.h:60
static __forceinline__ __device__ void optixLoadInterpolatedMatrixKey(float4 &m0, float4 &m1, float4 &m2, const float4 *matrix, const float t1)
Definition: optix_device_impl_transformations.h:172
static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix(float4 &m0, float4 &m1, float4 &m2)
Definition: optix_device_impl_transformations.h:369
static __forceinline__ __device__ float3 optixTransformPoint(const float4 &m0, const float4 &m1, const float4 &m2, const float3 &p)
Definition: optix_device_impl_transformations.h:400
static __forceinline__ __device__ void optixInvertMatrix(float4 &m0, float4 &m1, float4 &m2)
Definition: optix_device_impl_transformations.h:134
static __forceinline__ __device__ float3 optixTransformVector(const float4 &m0, const float4 &m1, const float4 &m2, const float3 &v)
Definition: optix_device_impl_transformations.h:410
static __forceinline__ __device__ void optixLoadInterpolatedSrtKey(float4 &srt0, float4 &srt1, float4 &srt2, float4 &srt3, const float4 *srt, const float t1)
Definition: optix_device_impl_transformations.h:188
static __forceinline__ __device__ float3 optixTransformNormal(const float4 &m0, const float4 &m1, const float4 &m2, const float3 &n)
Definition: optix_device_impl_transformations.h:421
static __forceinline__ __device__ uint4 optixLdg(unsigned long long addr)
Definition: optix_device_impl_transformations.h:48
static __forceinline__ __device__ float4 optixMultiplyRowMatrix(const float4 vec, const float4 m0, const float4 m1, const float4 m2)
Definition: optix_device_impl_transformations.h:71
static __forceinline__ __device__ void optixGetInterpolatedTransformationFromHandle(float4 &trf0, float4 &trf1, float4 &trf2, const OptixTraversableHandle handle, const float time, const bool objectToWorld)
Definition: optix_device_impl_transformations.h:285
static __forceinline__ __device__ void optixGetInterpolatedTransformation(float4 &trf0, float4 &trf1, float4 &trf2, const OptixMatrixMotionTransform *transformData, const float time)
Definition: optix_device_impl_transformations.h:240
static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix(float4 &m0, float4 &m1, float4 &m2)
Definition: optix_device_impl_transformations.h:338
static __forceinline__ __device__ const OptixStaticTransform * optixGetStaticTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:1660
static __forceinline__ __device__ const OptixMatrixMotionTransform * optixGetMatrixMotionTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:1674
static __forceinline__ __device__ OptixTraversableHandle optixGetTransformListHandle(unsigned int index)
Definition: optix_device_impl.h:1646
static __forceinline__ __device__ const float4 * optixGetInstanceTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:1695
static __forceinline__ __device__ unsigned int optixGetTransformListSize()
Definition: optix_device_impl.h:1639
static __forceinline__ __device__ const OptixSRTMotionTransform * optixGetSRTMotionTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:1667
static __forceinline__ __device__ float optixGetRayTime()
Definition: optix_device_impl.h:1298
static __forceinline__ __device__ OptixTransformType optixGetTransformTypeFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:1653
static __forceinline__ __device__ const float4 * optixGetInstanceInverseTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:1702
Represents a matrix motion transformation.
Definition: optix_types.h:1454
float transform[2][12]
Affine object-to-world transformation as 3x4 matrix in row-major layout.
Definition: optix_types.h:1466
Motion options.
Definition: optix_types.h:1317
unsigned short numKeys
If numKeys > 1, motion is enabled. timeBegin, timeEnd and flags are all ignored when motion is disabl...
Definition: optix_types.h:1320
float timeBegin
Point in time where motion starts. Must be lesser than timeEnd.
Definition: optix_types.h:1326
float timeEnd
Point in time where motion ends. Must be greater than timeBegin.
Definition: optix_types.h:1329
Represents an SRT transformation.
Definition: optix_types.h:1500
float qz
Definition: optix_types.h:1503
float b
Definition: optix_types.h:1503
float tz
Definition: optix_types.h:1503
float qx
Definition: optix_types.h:1503
float sz
Definition: optix_types.h:1503
float c
Definition: optix_types.h:1503
float sy
Definition: optix_types.h:1503
float pvz
Definition: optix_types.h:1503
float qw
Definition: optix_types.h:1503
float ty
Definition: optix_types.h:1503
float pvy
Definition: optix_types.h:1503
float pvx
Definition: optix_types.h:1503
float sx
Definition: optix_types.h:1503
float a
Definition: optix_types.h:1503
float qy
Definition: optix_types.h:1503
float tx
Definition: optix_types.h:1503
Represents an SRT motion transformation.
Definition: optix_types.h:1537
OptixSRTData srtData[2]
The actual SRT data describing the transformation.
Definition: optix_types.h:1549
Static transform.
Definition: optix_types.h:1414
float invTransform[12]
Affine world-to-object transformation as 3x4 matrix in row-major layout Must be the inverse of the tr...
Definition: optix_types.h:1426
float transform[12]
Affine object-to-world transformation as 3x4 matrix in row-major layout.
Definition: optix_types.h:1422