OptiX  3.9
NVIDIA OptiX Acceleration Engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
optixpp_namespace.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
4  *
5  * NVIDIA Corporation and its licensors retain all intellectual property and proprietary
6  * rights in and to this software, related documentation and any modifications thereto.
7  * Any use, reproduction, disclosure or distribution of this software and related
8  * documentation without an express license agreement from NVIDIA Corporation is strictly
9  * prohibited.
10  *
11  * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
12  * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
13  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14  * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
15  * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
16  * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
17  * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
18  * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
19  * SUCH DAMAGES
20  */
21 
26 
27 
28 #ifndef __optixu_optixpp_namespace_h__
29 #define __optixu_optixpp_namespace_h__
30 
31 #include "../optix.h"
32 
33 #ifdef _WIN32
34 # ifndef WIN32_LEAN_AND_MEAN
35 # define WIN32_LEAN_AND_MEAN
36 # endif
37 # include <windows.h>
38 # include "../optix_d3d9_interop.h"
39 # include "../optix_d3d10_interop.h"
40 # include "../optix_d3d11_interop.h"
41 #endif
42 #include "../optix_gl_interop.h"
43 #include "../optix_cuda_interop.h"
44 
45 #include <string>
46 #include <vector>
47 #include <iterator>
48 #include "optixu_vector_types.h"
49 
50 //-----------------------------------------------------------------------------
51 //
52 // Doxygen group specifications
53 //
54 //-----------------------------------------------------------------------------
55 
56 //-----------------------------------------------------------------------------
57 //
58 // C++ API
59 //
60 //-----------------------------------------------------------------------------
61 
62 namespace optix {
63 
64  class AccelerationObj;
65  class BufferObj;
66  class ContextObj;
67  class GeometryObj;
68  class GeometryGroupObj;
69  class GeometryInstanceObj;
70  class GroupObj;
71  class MaterialObj;
72  class ProgramObj;
73  class RemoteDeviceObj;
74  class SelectorObj;
75  class TextureSamplerObj;
76  class TransformObj;
77  class VariableObj;
78 
79  class APIObj;
80  class ScopedObj;
81 
82 
91  template<class T>
92  class Handle {
93  public:
95  Handle() : ptr(0) {}
96 
98  Handle(T* ptr) : ptr(ptr) { ref(); }
99 
101  template<class U>
102  Handle(U* ptr) : ptr(ptr) { ref(); }
103 
105  Handle(const Handle<T>& copy) : ptr(copy.ptr) { ref(); }
106 
108  template<class U>
109  Handle(const Handle<U>& copy) : ptr(copy.ptr) { ref(); }
110 
113  { if(ptr != copy.ptr) { unref(); ptr = copy.ptr; ref(); } return *this; }
114 
116  template<class U>
118  { if(ptr != copy.ptr) { unref(); ptr = copy.ptr; ref(); } return *this; }
119 
121  ~Handle() { unref(); }
122 
124  static Handle<T> take( typename T::api_t p ) { return p? new T(p) : 0; }
127  static Handle<T> take( RTobject p ) { return p? new T(static_cast<typename T::api_t>(p)) : 0; }
128 
130  T* operator->() { return ptr; }
131  const T* operator->() const { return ptr; }
132 
134  T* get() { return ptr; }
135  const T* get() const { return ptr; }
136 
138  operator bool() const { return ptr != 0; }
139 
143  Handle<VariableObj> operator[](const std::string& varname);
144 
163  Handle<VariableObj> operator[](const char* varname);
164 
166  static Handle<T> create() { return T::create(); }
167 
169  static Handle<T> create(const std::string& a, const std::string& b, const std::string& c) { return T::create(a,b,c); }
170 
172  static unsigned int getDeviceCount() { return T::getDeviceCount(); }
173 
174  private:
175  inline void ref() { if(ptr) ptr->addReference(); }
176  inline void unref() { if(ptr && ptr->removeReference() == 0) delete ptr; }
177  T* ptr;
178  };
179 
180 
181  //----------------------------------------------------------------------------
182 
185  typedef Handle<AccelerationObj> Acceleration;
186  typedef Handle<BufferObj> Buffer;
187  typedef Handle<ContextObj> Context;
188  typedef Handle<GeometryObj> Geometry;
189  typedef Handle<GeometryGroupObj> GeometryGroup;
190  typedef Handle<GeometryInstanceObj> GeometryInstance;
191  typedef Handle<GroupObj> Group;
192  typedef Handle<MaterialObj> Material;
193  typedef Handle<ProgramObj> Program;
194  typedef Handle<RemoteDeviceObj> RemoteDevice;
195  typedef Handle<SelectorObj> Selector;
196  typedef Handle<TextureSamplerObj> TextureSampler;
197  typedef Handle<TransformObj> Transform;
198  typedef Handle<VariableObj> Variable;
199 
201 
202  //----------------------------------------------------------------------------
203 
204 
212  class Exception: public std::exception {
213  public:
215  Exception( const std::string& message, RTresult error_code = RT_ERROR_UNKNOWN )
216  : m_message(message), m_error_code( error_code ) {}
217 
220  virtual ~Exception() throw() {}
221 
223  const std::string& getErrorString() const { return m_message; }
224 
226  RTresult getErrorCode() const { return m_error_code; }
227 
230  static Exception makeException( RTresult code, RTcontext context );
231 
233  virtual const char* what() const throw() { return getErrorString().c_str(); }
234  private:
235  std::string m_message;
236  RTresult m_error_code;
237  };
238 
240  {
241  const char* str;
242  rtContextGetErrorString( context, code, &str);
243  return Exception( std::string(str), code );
244  }
245 
246 
247  //----------------------------------------------------------------------------
248 
249 
269  class APIObj {
270  public:
271  APIObj() : ref_count(0) {}
272  virtual ~APIObj() {}
273 
275  void addReference() { ++ref_count; }
277  int removeReference() { return --ref_count; }
278 
280  virtual Context getContext()const=0;
281 
284  virtual void checkError(RTresult code)const;
285  virtual void checkError(RTresult code, Context context )const;
286 
287  void checkErrorNoGetContext(RTresult code)const;
288 
290  static Exception makeException( RTresult code, RTcontext context );
291  private:
292  int ref_count;
293  };
294 
296  {
297  return Exception::makeException( code, context );
298  }
299 
300 
301  //----------------------------------------------------------------------------
302 
303 
320  class DestroyableObj : public APIObj {
321  public:
322  virtual ~DestroyableObj() {}
323 
325  virtual void destroy() = 0;
326 
328  virtual void validate() = 0;
329  };
330 
331 
332 
333  //----------------------------------------------------------------------------
334 
335 
347  class ScopedObj : public DestroyableObj {
348  public:
349  virtual ~ScopedObj() {}
350 
353  virtual Variable declareVariable(const std::string& name) = 0;
356  virtual Variable queryVariable(const std::string& name) const = 0;
358  virtual void removeVariable(Variable v) = 0;
362  virtual unsigned int getVariableCount() const = 0;
364  virtual Variable getVariable(unsigned int index) const = 0;
365  };
366 
367 
368 
369  //----------------------------------------------------------------------------
370 
371 
387  class VariableObj : public APIObj {
388  public:
389 
390  Context getContext() const;
391 
394 
395  void setFloat(float f1);
398  void setFloat(optix::float2 f);
400  void setFloat(float f1, float f2);
402  void setFloat(optix::float3 f);
404  void setFloat(float f1, float f2, float f3);
406  void setFloat(optix::float4 f);
408  void setFloat(float f1, float f2, float f3, float f4);
410  void set1fv(const float* f);
412  void set2fv(const float* f);
414  void set3fv(const float* f);
416  void set4fv(const float* f);
418 
421 
422  void setInt(int i1);
423  void setInt(int i1, int i2);
424  void setInt(optix::int2 i);
425  void setInt(int i1, int i2, int i3);
426  void setInt(optix::int3 i);
427  void setInt(int i1, int i2, int i3, int i4);
428  void setInt(optix::int4 i);
429  void set1iv(const int* i);
430  void set2iv(const int* i);
431  void set3iv(const int* i);
432  void set4iv(const int* i);
434 
437 
438  void setUint(unsigned int u1);
439  void setUint(unsigned int u1, unsigned int u2);
440  void setUint(unsigned int u1, unsigned int u2, unsigned int u3);
441  void setUint(unsigned int u1, unsigned int u2, unsigned int u3, unsigned int u4);
442  void setUint(optix::uint2 u);
443  void setUint(optix::uint3 u);
444  void setUint(optix::uint4 u);
445  void set1uiv(const unsigned int* u);
446  void set2uiv(const unsigned int* u);
447  void set3uiv(const unsigned int* u);
448  void set4uiv(const unsigned int* u);
450 
453 
454  void setMatrix2x2fv(bool transpose, const float* m);
455  void setMatrix2x3fv(bool transpose, const float* m);
456  void setMatrix2x4fv(bool transpose, const float* m);
457  void setMatrix3x2fv(bool transpose, const float* m);
458  void setMatrix3x3fv(bool transpose, const float* m);
459  void setMatrix3x4fv(bool transpose, const float* m);
460  void setMatrix4x2fv(bool transpose, const float* m);
461  void setMatrix4x3fv(bool transpose, const float* m);
462  void setMatrix4x4fv(bool transpose, const float* m);
464 
467 
468 
469  float getFloat() const;
470  optix::float2 getFloat2() const;
471  optix::float3 getFloat3() const;
472  optix::float4 getFloat4() const;
473  void getFloat(float& f1) const;
474  void getFloat(float& f1, float& f2) const;
475  void getFloat(float& f1, float& f2, float& f3) const;
476  void getFloat(float& f1, float& f2, float& f3, float& f4) const;
477 
478  unsigned getUint() const;
479  optix::uint2 getUint2() const;
480  optix::uint3 getUint3() const;
481  optix::uint4 getUint4() const;
482  void getUint(unsigned& u1) const;
483  void getUint(unsigned& u1, unsigned& u2) const;
484  void getUint(unsigned& u1, unsigned& u2, unsigned& u3) const;
485  void getUint(unsigned& u1, unsigned& u2, unsigned& u3,
486  unsigned& u4) const;
487 
488  int getInt() const;
489  optix::int2 getInt2() const;
490  optix::int3 getInt3() const;
491  optix::int4 getInt4() const;
492  void getInt(int& i1) const;
493  void getInt(int& i1, int& i2) const;
494  void getInt(int& i1, int& i2, int& i3) const;
495  void getInt(int& i1, int& i2, int& i3, int& i4) const;
496 
497  void getMatrix2x2(bool transpose, float* m) const;
498  void getMatrix2x3(bool transpose, float* m) const;
499  void getMatrix2x4(bool transpose, float* m) const;
500  void getMatrix3x2(bool transpose, float* m) const;
501  void getMatrix3x3(bool transpose, float* m) const;
502  void getMatrix3x4(bool transpose, float* m) const;
503  void getMatrix4x2(bool transpose, float* m) const;
504  void getMatrix4x3(bool transpose, float* m) const;
505  void getMatrix4x4(bool transpose, float* m) const;
506 
508 
509 
512 
513  void setBuffer(Buffer buffer);
514  void set(Buffer buffer);
515  void setTextureSampler(TextureSampler texturesample);
516  void set(TextureSampler texturesample);
517  void set(GeometryGroup group);
518  void set(Group group);
519  void set(Program program);
520  void setProgramId(Program program);
521  void set(Selector selector);
522  void set(Transform transform);
524 
527 
528  Buffer getBuffer() const;
529  GeometryGroup getGeometryGroup() const;
530  GeometryInstance getGeometryInstance() const;
531  Group getGroup() const;
532  Program getProgram() const;
533  Selector getSelector() const;
534  TextureSampler getTextureSampler() const;
535  Transform getTransform() const;
537 
539 
540  void setUserData(RTsize size, const void* ptr);
543  void getUserData(RTsize size, void* ptr) const;
545 
547  std::string getName() const;
548 
550  std::string getAnnotation() const;
551 
553  RTobjecttype getType() const;
554 
556  RTvariable get();
557 
559  RTsize getSize() const;
560 
561  private:
562  typedef RTvariable api_t;
563 
564  RTvariable m_variable;
565  VariableObj(RTvariable variable) : m_variable(variable) {}
566  friend class Handle<VariableObj>;
567 
568  };
569 
570  template<class T>
571  Handle<VariableObj> Handle<T>::operator[](const std::string& varname)
572  {
573  Variable v = ptr->queryVariable( varname );
574  if( v.operator->() == 0)
575  v = ptr->declareVariable( varname );
576  return v;
577  }
578 
579  template<class T>
581  {
582  return (*this)[ std::string( varname ) ];
583  }
584 
585 
586  //----------------------------------------------------------------------------
587 
588 
593  class ContextObj : public ScopedObj {
594  public:
595 
597  static unsigned int getDeviceCount();
598 
600  static std::string getDeviceName(int ordinal);
601 
603  static void getDeviceAttribute(int ordinal, RTdeviceattribute attrib, RTsize size, void* p);
604 
606  static Context create();
607 
609  void destroy();
610 
612  void validate();
613 
616  Context getContext() const;
617 
620  void checkError(RTresult code)const;
621 
623  std::string getErrorString( RTresult code ) const;
625 
628  Acceleration createAcceleration(const char* builder, const char* traverser);
629 
631  Buffer createBuffer(unsigned int type);
633  Buffer createBuffer(unsigned int type, RTformat format);
636  Buffer createBuffer(unsigned int type, RTformat format, RTsize width);
639  Buffer createMipmappedBuffer(unsigned int type, RTformat format, RTsize width, unsigned int levels);
642  Buffer createBuffer(unsigned int type, RTformat format, RTsize width, RTsize height);
645  Buffer createMipmappedBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, unsigned int levels);
648  Buffer createBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize depth);
651  Buffer createMipmappedBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize depth, unsigned int levels);
652 
655  Buffer create1DLayeredBuffer(unsigned int type, RTformat format, RTsize width, RTsize layers, unsigned int levels);
658  Buffer create2DLayeredBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize layers, unsigned int levels);
661  Buffer createCubeBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, unsigned int levels);
664  Buffer createCubeLayeredBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize faces, unsigned int levels);
665 
667  Buffer createBufferForCUDA(unsigned int type);
669  Buffer createBufferForCUDA(unsigned int type, RTformat format);
672  Buffer createBufferForCUDA(unsigned int type, RTformat format, RTsize width);
675  Buffer createBufferForCUDA(unsigned int type, RTformat format, RTsize width, RTsize height);
678  Buffer createBufferForCUDA(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize depth);
679 
681  Buffer createBufferFromGLBO(unsigned int type, unsigned int vbo);
682 
685 
686 #ifdef _WIN32
687  Buffer createBufferFromD3D9Resource(unsigned int type, IDirect3DResource9 *pResource);
690  Buffer createBufferFromD3D10Resource(unsigned int type, ID3D10Resource *pResource);
692  Buffer createBufferFromD3D11Resource(unsigned int type, ID3D11Resource *pResource);
693 
697  TextureSampler createTextureSamplerFromD3D10Resource(ID3D10Resource *pResource);
699  TextureSampler createTextureSamplerFromD3D11Resource(ID3D11Resource *pResource);
700 #endif
701 
704  Buffer getBufferFromId(int buffer_id);
705 
708  Program getProgramFromId(int program_id);
709 
712  TextureSampler getTextureSamplerFromId(int sampler_id);
713 
720  template<class Iterator>
721  GeometryInstance createGeometryInstance( Geometry geometry, Iterator matlbegin, Iterator matlend );
722 
724  Group createGroup();
727  template<class Iterator>
728  Group createGroup( Iterator childbegin, Iterator childend );
729 
734  template<class Iterator>
735  GeometryGroup createGeometryGroup( Iterator childbegin, Iterator childend );
736 
739 
742 
744  Program createProgramFromPTXFile ( const std::string& ptx, const std::string& program_name );
746  Program createProgramFromPTXString( const std::string& ptx, const std::string& program_name );
747 
750 
754 
757  template<class Iterator>
758  void setDevices(Iterator begin, Iterator end);
759 
760 #ifdef _WIN32
761  void setD3D9Device(IDirect3DDevice9* device);
764  void setD3D10Device(ID3D10Device* device);
766  void setD3D11Device(ID3D11Device* device);
767 #endif
768 
770  std::vector<int> getEnabledDevices() const;
771 
774  unsigned int getEnabledDeviceCount() const;
776 
779  int getMaxTextureCount() const;
780 
782  int getCPUNumThreads() const;
783 
785  RTsize getUsedHostMemory() const;
786 
788  int getGPUPagingActive() const;
789 
791  int getGPUPagingForcedOff() const;
792 
794  RTsize getAvailableDeviceMemory(int ordinal) const;
796 
799  void setCPUNumThreads(int cpu_num_threads);
800 
802  void setGPUPagingForcedOff(int gpu_paging_forced_off);
803 
805  template<class T>
806  void setAttribute(RTcontextattribute attribute, const T& val);
808 
811  void setStackSize(RTsize stack_size_bytes);
813  RTsize getStackSize() const;
814 
817  void setTimeoutCallback(RTtimeoutcallback callback, double min_polling_seconds);
818 
820  void setEntryPointCount(unsigned int num_entry_points);
822  unsigned int getEntryPointCount() const;
823 
825  void setRayTypeCount(unsigned int num_ray_types);
827  unsigned int getRayTypeCount() const;
829 
832  void setRayGenerationProgram(unsigned int entry_point_index, Program program);
834  Program getRayGenerationProgram(unsigned int entry_point_index) const;
835 
837  void setExceptionProgram(unsigned int entry_point_index, Program program);
839  Program getExceptionProgram(unsigned int entry_point_index) const;
840 
842  void setExceptionEnabled( RTexception exception, bool enabled );
844  bool getExceptionEnabled( RTexception exception ) const;
845 
847  void setMissProgram(unsigned int ray_type_index, Program program);
849  Program getMissProgram(unsigned int ray_type_index) const;
851 
853  void compile();
854 
857  void launch(unsigned int entry_point_index, RTsize image_width);
859  void launch(unsigned int entry_point_index, RTsize image_width, RTsize image_height);
861  void launch(unsigned int entry_point_index, RTsize image_width, RTsize image_height, RTsize image_depth);
863 
866  void launchProgressive(unsigned int entry_point_index, RTsize image_width, RTsize image_height, unsigned int max_subframes);
867 
869  void stopProgressive();
871 
873  void setRemoteDevice( RemoteDevice remote_device );
874 
876  int getRunningState() const;
877 
880  void setPrintEnabled(bool enabled);
882  bool getPrintEnabled() const;
884  void setPrintBufferSize(RTsize buffer_size_bytes);
886  RTsize getPrintBufferSize() const;
888  void setPrintLaunchIndex(int x, int y=-1, int z=-1);
890  optix::int3 getPrintLaunchIndex() const;
892 
894  Variable declareVariable (const std::string& name);
895  Variable queryVariable (const std::string& name) const;
896  void removeVariable (Variable v);
897  unsigned int getVariableCount() const;
898  Variable getVariable (unsigned int index) const;
900 
902  RTcontext get();
903  private:
904  typedef RTcontext api_t;
905 
906  virtual ~ContextObj() {}
907  RTcontext m_context;
908  ContextObj(RTcontext context) : m_context(context) {}
909  friend class Handle<ContextObj>;
910  };
911 
912 
913  //----------------------------------------------------------------------------
914 
915 
920  class ProgramObj : public ScopedObj {
921  public:
922  void destroy();
923  void validate();
924 
925  Context getContext() const;
926 
927  Variable declareVariable (const std::string& name);
928  Variable queryVariable (const std::string& name) const;
929  void removeVariable (Variable v);
930  unsigned int getVariableCount() const;
931  Variable getVariable (unsigned int index) const;
934  int getId() const;
936 
937  RTprogram get();
938  private:
939  typedef RTprogram api_t;
940  virtual ~ProgramObj() {}
941  RTprogram m_program;
942  ProgramObj(RTprogram program) : m_program(program) {}
943  friend class Handle<ProgramObj>;
944  };
945 
946 
947  //----------------------------------------------------------------------------
948 
949 
954  class GroupObj : public DestroyableObj {
955  public:
956  void destroy();
957  void validate();
958 
959  Context getContext() const;
960 
963  void setAcceleration(Acceleration acceleration);
967 
970  void setChildCount(unsigned int count);
972  unsigned int getChildCount() const;
973 
975  template< typename T > void setChild(unsigned int index, T child);
977  template< typename T > T getChild(unsigned int index) const;
979  RTobjecttype getChildType(unsigned int index) const;
980 
982  template< typename T > unsigned int addChild(T child);
986  template< typename T > unsigned int removeChild(T child);
989  void removeChild(int index);
992  void removeChild(unsigned int index);
994  template< typename T > unsigned int getChildIndex(T child) const;
996 
998  RTgroup get();
999 
1000  private:
1001  typedef RTgroup api_t;
1002  virtual ~GroupObj() {}
1003  RTgroup m_group;
1004  GroupObj(RTgroup group) : m_group(group) {}
1005  friend class Handle<GroupObj>;
1006  };
1007 
1008 
1009  //----------------------------------------------------------------------------
1010 
1011 
1017  public:
1018  void destroy();
1019  void validate();
1020  Context getContext() const;
1021 
1024  void setAcceleration(Acceleration acceleration);
1026  Acceleration getAcceleration() const;
1028 
1031  void setChildCount(unsigned int count);
1033  unsigned int getChildCount() const;
1034 
1036  void setChild(unsigned int index, GeometryInstance geometryinstance);
1038  GeometryInstance getChild(unsigned int index) const;
1039 
1041  unsigned int addChild(GeometryInstance child);
1045  unsigned int removeChild(GeometryInstance child);
1048  void removeChild(int index);
1051  void removeChild(unsigned int index);
1053  unsigned int getChildIndex(GeometryInstance child) const;
1055 
1057  RTgeometrygroup get();
1058 
1059  private:
1060  typedef RTgeometrygroup api_t;
1061  virtual ~GeometryGroupObj() {}
1062  RTgeometrygroup m_geometrygroup;
1063  GeometryGroupObj(RTgeometrygroup geometrygroup) : m_geometrygroup(geometrygroup) {}
1064  friend class Handle<GeometryGroupObj>;
1065  };
1066 
1067 
1068  //----------------------------------------------------------------------------
1069 
1070 
1075  class TransformObj : public DestroyableObj {
1076  public:
1077  void destroy();
1078  void validate();
1079  Context getContext() const;
1080 
1083  template< typename T > void setChild(T child);
1085  template< typename T > T getChild() const;
1087  RTobjecttype getChildType() const;
1089 
1092  void setMatrix(bool transpose, const float* matrix, const float* inverse_matrix);
1094  void getMatrix(bool transpose, float* matrix, float* inverse_matrix) const;
1096 
1098  RTtransform get();
1099 
1100  private:
1101  typedef RTtransform api_t;
1102  virtual ~TransformObj() {}
1103  RTtransform m_transform;
1104  TransformObj(RTtransform transform) : m_transform(transform) {}
1105  friend class Handle<TransformObj>;
1106  };
1107 
1108 
1109  //----------------------------------------------------------------------------
1110 
1111 
1116  class SelectorObj : public DestroyableObj {
1117  public:
1118  void destroy();
1119  void validate();
1120  Context getContext() const;
1121 
1124  void setVisitProgram(Program program);
1126  Program getVisitProgram() const;
1128 
1131  void setChildCount(unsigned int count);
1133  unsigned int getChildCount() const;
1134 
1136  template< typename T > void setChild(unsigned int index, T child);
1138  template< typename T > T getChild(unsigned int index) const;
1140  RTobjecttype getChildType(unsigned int index) const;
1141 
1143  template< typename T > unsigned int addChild(T child);
1147  template< typename T > unsigned int removeChild(T child);
1151  void removeChild(int index);
1155  void removeChild(unsigned int index);
1157  template< typename T > unsigned int getChildIndex(T child) const;
1159 
1161  Variable declareVariable (const std::string& name);
1162  Variable queryVariable (const std::string& name) const;
1163  void removeVariable (Variable v);
1164  unsigned int getVariableCount() const;
1165  Variable getVariable (unsigned int index) const;
1167 
1169  RTselector get();
1170 
1171  private:
1172  typedef RTselector api_t;
1173  virtual ~SelectorObj() {}
1174  RTselector m_selector;
1175  SelectorObj(RTselector selector) : m_selector(selector) {}
1176  friend class Handle<SelectorObj>;
1177  };
1178 
1179 
1180  //----------------------------------------------------------------------------
1181 
1182 
1188  public:
1189  void destroy();
1190  void validate();
1191  Context getContext() const;
1192 
1195  void markDirty();
1197  bool isDirty() const;
1199 
1203  void setProperty( const std::string& name, const std::string& value );
1206  std::string getProperty( const std::string& name ) const;
1207 
1209  void setBuilder(const std::string& builder);
1211  std::string getBuilder() const;
1213  void setTraverser(const std::string& traverser);
1215  std::string getTraverser() const;
1217 
1220  RTsize getDataSize() const;
1222  void getData( void* data ) const;
1224  void setData( const void* data, RTsize size );
1226 
1228  RTacceleration get();
1229 
1230  private:
1231  typedef RTacceleration api_t;
1232  virtual ~AccelerationObj() {}
1233  RTacceleration m_acceleration;
1234  AccelerationObj(RTacceleration acceleration) : m_acceleration(acceleration) {}
1235  friend class Handle<AccelerationObj>;
1236  };
1237 
1238 
1239  //----------------------------------------------------------------------------
1240 
1241 
1248  public:
1249  void destroy();
1250  void validate();
1251  Context getContext() const;
1252 
1255  void setGeometry(Geometry geometry);
1257  Geometry getGeometry() const;
1258 
1260  void setMaterialCount(unsigned int count);
1262  unsigned int getMaterialCount() const;
1263 
1265  void setMaterial(unsigned int idx, Material material);
1267  Material getMaterial(unsigned int idx) const;
1268 
1270  unsigned int addMaterial(Material material);
1272 
1274  Variable declareVariable (const std::string& name);
1275  Variable queryVariable (const std::string& name) const;
1276  void removeVariable (Variable v);
1277  unsigned int getVariableCount() const;
1278  Variable getVariable (unsigned int index) const;
1280 
1282  RTgeometryinstance get();
1283 
1284  private:
1285  typedef RTgeometryinstance api_t;
1286  virtual ~GeometryInstanceObj() {}
1287  RTgeometryinstance m_geometryinstance;
1288  GeometryInstanceObj(RTgeometryinstance geometryinstance) : m_geometryinstance(geometryinstance) {}
1289  friend class Handle<GeometryInstanceObj>;
1290  };
1291 
1292 
1293  //----------------------------------------------------------------------------
1294 
1295 
1300  class GeometryObj : public ScopedObj {
1301  public:
1302  void destroy();
1303  void validate();
1304  Context getContext() const;
1305 
1308  void markDirty();
1310  bool isDirty() const;
1312 
1316  void setPrimitiveCount(unsigned int num_primitives);
1319  unsigned int getPrimitiveCount() const;
1321 
1325  void setPrimitiveIndexOffset(unsigned int index_offset);
1328  unsigned int getPrimitiveIndexOffset() const;
1330 
1333  void setBoundingBoxProgram(Program program);
1336 
1338  void setIntersectionProgram(Program program);
1342 
1344  Variable declareVariable (const std::string& name);
1345  Variable queryVariable (const std::string& name) const;
1346  void removeVariable (Variable v);
1347  unsigned int getVariableCount() const;
1348  Variable getVariable (unsigned int index) const;
1350 
1352  RTgeometry get();
1353 
1354  private:
1355  typedef RTgeometry api_t;
1356  virtual ~GeometryObj() {}
1357  RTgeometry m_geometry;
1358  GeometryObj(RTgeometry geometry) : m_geometry(geometry) {}
1359  friend class Handle<GeometryObj>;
1360  };
1361 
1362 
1363  //----------------------------------------------------------------------------
1364 
1365 
1370  class MaterialObj : public ScopedObj {
1371  public:
1372  void destroy();
1373  void validate();
1374  Context getContext() const;
1375 
1378  void setClosestHitProgram(unsigned int ray_type_index, Program program);
1380  Program getClosestHitProgram(unsigned int ray_type_index) const;
1381 
1383  void setAnyHitProgram(unsigned int ray_type_index, Program program);
1385  Program getAnyHitProgram(unsigned int ray_type_index) const;
1387 
1389  Variable declareVariable (const std::string& name);
1390  Variable queryVariable (const std::string& name) const;
1391  void removeVariable (Variable v);
1392  unsigned int getVariableCount() const;
1393  Variable getVariable (unsigned int index) const;
1395 
1397  RTmaterial get();
1398  private:
1399  typedef RTmaterial api_t;
1400  virtual ~MaterialObj() {}
1401  RTmaterial m_material;
1402  MaterialObj(RTmaterial material) : m_material(material) {}
1403  friend class Handle<MaterialObj>;
1404  };
1405 
1406 
1407  //----------------------------------------------------------------------------
1408 
1409 
1415  public:
1416  void destroy();
1417  void validate();
1418  Context getContext() const;
1419 
1422  void setMipLevelCount (unsigned int num_mip_levels);
1424  unsigned int getMipLevelCount () const;
1425 
1427  void setArraySize(unsigned int num_textures_in_array);
1429  unsigned int getArraySize() const;
1430 
1432  void setWrapMode(unsigned int dim, RTwrapmode wrapmode);
1434  RTwrapmode getWrapMode(unsigned int dim) const;
1435 
1437  void setFilteringModes(RTfiltermode minification, RTfiltermode magnification, RTfiltermode mipmapping);
1439  void getFilteringModes(RTfiltermode& minification, RTfiltermode& magnification, RTfiltermode& mipmapping) const;
1440 
1442  void setMaxAnisotropy(float value);
1444  float getMaxAnisotropy() const;
1445 
1447  void setMipLevelClamp(float minLevel, float maxLevel);
1449  void getMipLevelClamp(float &minLevel, float &maxLevel) const;
1450 
1452  void setMipLevelBias(float value);
1454  float getMipLevelBias() const;
1455 
1457  void setReadMode(RTtexturereadmode readmode);
1460 
1462  void setIndexingMode(RTtextureindexmode indexmode);
1466 
1469  int getId() const;
1471 
1474  void setBuffer(unsigned int texture_array_idx, unsigned int mip_level, Buffer buffer);
1476  Buffer getBuffer(unsigned int texture_array_idx, unsigned int mip_level) const;
1478  void setBuffer(Buffer buffer);
1480  Buffer getBuffer() const;
1482 
1484  RTtexturesampler get();
1485 
1488  void registerGLTexture();
1490  void unregisterGLTexture();
1492 
1493 #ifdef _WIN32
1494 
1497  void registerD3D9Texture();
1499  void registerD3D10Texture();
1501  void registerD3D11Texture();
1502 
1504  void unregisterD3D9Texture();
1506  void unregisterD3D10Texture();
1508  void unregisterD3D11Texture();
1510 
1511 #endif
1512 
1513  private:
1514  typedef RTtexturesampler api_t;
1515  virtual ~TextureSamplerObj() {}
1516  RTtexturesampler m_texturesampler;
1517  TextureSamplerObj(RTtexturesampler texturesampler) : m_texturesampler(texturesampler) {}
1518  friend class Handle<TextureSamplerObj>;
1519  };
1520 
1521 
1522  //----------------------------------------------------------------------------
1523 
1524 
1529  class BufferObj : public DestroyableObj {
1530  public:
1531  void destroy();
1532  void validate();
1533  Context getContext() const;
1534 
1537  void setFormat (RTformat format);
1539  RTformat getFormat() const;
1540 
1542  void setElementSize (RTsize size_of_element);
1544  RTsize getElementSize() const;
1545 
1547  void getDevicePointer( unsigned int optix_device_number, CUdeviceptr *device_pointer );
1548  CUdeviceptr getDevicePointer( unsigned int optix_device_number );
1549 
1551  void setDevicePointer( unsigned int optix_device_number, CUdeviceptr device_pointer );
1552 
1554  void markDirty();
1555 
1557  void setSize(RTsize width);
1559  void getSize(RTsize& width) const;
1561  void getMipLevelSize(unsigned int level, RTsize& width) const;
1563  void setSize(RTsize width, RTsize height);
1565  void getSize(RTsize& width, RTsize& height) const;
1567  void getMipLevelSize(unsigned int level, RTsize& width, RTsize& height) const;
1570  void setSize(RTsize width, RTsize height, RTsize depth);
1572  void getSize(RTsize& width, RTsize& height, RTsize& depth) const;
1574  void getMipLevelSize(unsigned int level, RTsize& width, RTsize& height, RTsize& depth) const;
1575 
1577  void setSize(unsigned int dimensionality, const RTsize* dims);
1579  void getSize(unsigned int dimensionality, RTsize* dims) const;
1580 
1582  unsigned int getDimensionality() const;
1583 
1585  void setMipLevelCount(unsigned int levels);
1587  unsigned int getMipLevelCount() const;
1589 
1592  int getId() const;
1594 
1597  unsigned int getGLBOId() const;
1598 
1600  void registerGLBuffer();
1602  void unregisterGLBuffer();
1604 
1607  void setAttribute( RTbufferattribute attrib, RTsize size, void *p );
1609  void getAttribute( RTbufferattribute attrib, RTsize size, void *p );
1611 
1612 #ifdef _WIN32
1613 
1616  void registerD3D9Buffer();
1618  void registerD3D10Buffer();
1620  void registerD3D11Buffer();
1621 
1623  void unregisterD3D9Buffer();
1625  void unregisterD3D10Buffer();
1627  void unregisterD3D11Buffer();
1628 
1632  ID3D10Resource* getD3D10Resource();
1634  ID3D11Resource* getD3D11Resource();
1636 
1637 #endif
1638 
1641  void* map();
1643  void unmap();
1644 
1646  void* map(unsigned int level);
1648  void unmap(unsigned int level);
1649 
1651 
1654  void bindProgressiveStream( Buffer source );
1656  void getProgressiveUpdateReady( int* ready, unsigned int* subframe_count, unsigned int* max_subframes );
1658 
1660  RTbuffer get();
1661 
1662  private:
1663  typedef RTbuffer api_t;
1664  virtual ~BufferObj() {}
1665  RTbuffer m_buffer;
1666  BufferObj(RTbuffer buffer) : m_buffer(buffer) {}
1667  friend class Handle<BufferObj>;
1668  };
1669 
1670 #if !defined(__CUDACC__)
1671  template<typename T, int Dim=1>
1716  struct bufferId {
1717  bufferId() {}
1718  bufferId(int id) : m_id(id) {}
1719  int getId() const { return m_id; }
1720  private:
1721  int m_id;
1722  };
1723 #define rtBufferId optix::bufferId
1724 
1769 
1770 #define RT_INTERNAL_CALLABLE_PROGRAM_DEFS() \
1771  { \
1772  public: \
1773  callableProgramId() {} \
1774  callableProgramId(int id) : m_id(id) {} \
1775  int getId() const { return m_id; } \
1776  private: \
1777  int m_id; \
1778  }
1779 
1780  //
1781  template<typename T>
1782  class callableProgramId;
1783  template<typename ReturnT>
1784  class callableProgramId<ReturnT()> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1785  template<typename ReturnT, typename Arg0T>
1786  class callableProgramId<ReturnT(Arg0T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1787  template<typename ReturnT, typename Arg0T, typename Arg1T>
1788  class callableProgramId<ReturnT(Arg0T,Arg1T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1789  template<typename ReturnT, typename Arg0T, typename Arg1T, typename Arg2T>
1790  class callableProgramId<ReturnT(Arg0T,Arg1T,Arg2T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1791  template<typename ReturnT, typename Arg0T, typename Arg1T, typename Arg2T, typename Arg3T>
1792  class callableProgramId<ReturnT(Arg0T,Arg1T,Arg2T,Arg3T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1793  template<typename ReturnT, typename Arg0T, typename Arg1T, typename Arg2T, typename Arg3T,
1794  typename Arg4T>
1795  class callableProgramId<ReturnT(Arg0T,Arg1T,Arg2T,Arg3T,Arg4T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1796  template<typename ReturnT, typename Arg0T, typename Arg1T, typename Arg2T, typename Arg3T,
1797  typename Arg4T, typename Arg5T>
1798  class callableProgramId<ReturnT(Arg0T,Arg1T,Arg2T,Arg3T,Arg4T,Arg5T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1799  template<typename ReturnT, typename Arg0T, typename Arg1T, typename Arg2T, typename Arg3T,
1800  typename Arg4T, typename Arg5T, typename Arg6T>
1801  class callableProgramId<ReturnT(Arg0T,Arg1T,Arg2T,Arg3T,Arg4T,Arg5T,Arg6T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1802  template<typename ReturnT, typename Arg0T, typename Arg1T, typename Arg2T, typename Arg3T,
1803  typename Arg4T, typename Arg5T, typename Arg6T, typename Arg7T>
1804  class callableProgramId<ReturnT(Arg0T,Arg1T,Arg2T,Arg3T,Arg4T,Arg5T,Arg6T,Arg7T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1805  template<typename ReturnT, typename Arg0T, typename Arg1T, typename Arg2T, typename Arg3T,
1806  typename Arg4T, typename Arg5T, typename Arg6T, typename Arg7T, typename Arg8T>
1807  class callableProgramId<ReturnT(Arg0T,Arg1T,Arg2T,Arg3T,Arg4T,Arg5T,Arg6T,Arg7T,Arg8T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1808  template<typename ReturnT, typename Arg0T, typename Arg1T, typename Arg2T, typename Arg3T,
1809  typename Arg4T, typename Arg5T, typename Arg6T, typename Arg7T, typename Arg8T, typename Arg9T>
1810  class callableProgramId<ReturnT(Arg0T,Arg1T,Arg2T,Arg3T,Arg4T,Arg5T,Arg6T,Arg7T,Arg8T,Arg9T)> RT_INTERNAL_CALLABLE_PROGRAM_DEFS();
1811 
1812  // template <typename ReturnT
1813  // ,typename Arg0T=optix::CPArgVoid
1814  // ,typename Arg1T=optix::CPArgVoid
1815  // ,typename Arg2T=optix::CPArgVoid
1816  // ,typename Arg3T=optix::CPArgVoid
1817  // ,typename Arg4T=optix::CPArgVoid
1818  // ,typename Arg5T=optix::CPArgVoid
1819  // ,typename Arg6T=optix::CPArgVoid
1820  // ,typename Arg7T=optix::CPArgVoid
1821  // ,typename Arg8T=optix::CPArgVoid
1822  // ,typename Arg9T=optix::CPArgVoid
1823  // >
1824  // struct callableProgramId {
1825  // callableProgramId() {}
1826  // callableProgramId(int id) : m_id(id) {}
1827  // int getId() const { return m_id; }
1828  // private:
1829  // int m_id;
1830  // };
1831 #define rtCallableProgramId optix::callableProgramId
1832 #endif
1833 
1834 
1835  //----------------------------------------------------------------------------
1836 
1841  class RemoteDeviceObj : public APIObj {
1842  public:
1843  static RemoteDevice create( const std::string& url, const std::string& username, const std::string& password );
1844 
1845  void destroy();
1846 
1847  void reserve( unsigned int num_nodes, unsigned int configuration_idx );
1848 
1849  void release();
1850 
1851  void getAttribute( RTremotedeviceattribute attrib, RTsize size, void *p );
1852 
1853  std::string getConfiguration(unsigned int index);
1854 
1856  RTremotedevice get();
1857  private:
1858  typedef RTremotedevice api_t;
1859 
1860  Context getContext() const;
1861 
1862  RemoteDeviceObj(RTremotedevice rdev) : m_rdev(rdev) {}
1863  virtual ~RemoteDeviceObj() {}
1864  friend class Handle<RemoteDeviceObj>;
1865 
1866  RTremotedevice m_rdev;
1867  };
1868 
1869  //----------------------------------------------------------------------------
1870 
1871  inline void APIObj::checkError( RTresult code ) const
1872  {
1873  if( code != RT_SUCCESS) {
1874  RTcontext c = this->getContext()->get();
1875  throw Exception::makeException( code, c );
1876  }
1877  }
1878 
1879  inline void APIObj::checkError( RTresult code, Context context ) const
1880  {
1881  if( code != RT_SUCCESS) {
1882  RTcontext c = context->get();
1883  throw Exception::makeException( code, c );
1884  }
1885  }
1886 
1887  inline void APIObj::checkErrorNoGetContext( RTresult code ) const
1888  {
1889  if( code != RT_SUCCESS) {
1890  throw Exception::makeException( code, 0u );
1891  }
1892  }
1893 
1895  {
1896  return Context::take( m_context );
1897  }
1898 
1899  inline void ContextObj::checkError(RTresult code) const
1900  {
1901  if( code != RT_SUCCESS && code != RT_TIMEOUT_CALLBACK )
1902  throw Exception::makeException( code, m_context );
1903  }
1904 
1905  inline unsigned int ContextObj::getDeviceCount()
1906  {
1907  unsigned int count;
1908  if( RTresult code = rtDeviceGetDeviceCount(&count) )
1909  throw Exception::makeException( code, 0 );
1910 
1911  return count;
1912  }
1913 
1914  inline std::string ContextObj::getDeviceName(int ordinal)
1915  {
1916  const RTsize max_string_size = 256;
1917  char name[max_string_size];
1919  max_string_size, name) )
1920  throw Exception::makeException( code, 0 );
1921  return std::string(name);
1922  }
1923 
1924  inline void ContextObj::getDeviceAttribute(int ordinal, RTdeviceattribute attrib, RTsize size, void* p)
1925  {
1926  if( RTresult code = rtDeviceGetAttribute(ordinal, attrib, size, p) )
1927  throw Exception::makeException( code, 0 );
1928  }
1929 
1931  {
1932  RTcontext c;
1933  if( RTresult code = rtContextCreate(&c) )
1934  throw Exception::makeException( code, 0 );
1935 
1936  return Context::take(c);
1937  }
1938 
1939  inline void ContextObj::destroy()
1940  {
1941  checkErrorNoGetContext( rtContextDestroy( m_context ) );
1942  m_context = 0;
1943  }
1944 
1945  inline void ContextObj::validate()
1946  {
1947  checkError( rtContextValidate( m_context ) );
1948  }
1949 
1950  inline Acceleration ContextObj::createAcceleration(const char* builder, const char* traverser)
1951  {
1952  RTacceleration acceleration;
1953  checkError( rtAccelerationCreate( m_context, &acceleration ) );
1954  checkError( rtAccelerationSetBuilder( acceleration, builder ) );
1955  checkError( rtAccelerationSetTraverser( acceleration, traverser ) );
1956  return Acceleration::take(acceleration);
1957  }
1958 
1959 
1960  inline Buffer ContextObj::createBuffer(unsigned int type)
1961  {
1962  RTbuffer buffer;
1963  checkError( rtBufferCreate( m_context, type, &buffer ) );
1964  return Buffer::take(buffer);
1965  }
1966 
1967  inline Buffer ContextObj::createBuffer(unsigned int type, RTformat format)
1968  {
1969  RTbuffer buffer;
1970  checkError( rtBufferCreate( m_context, type, &buffer ) );
1971  checkError( rtBufferSetFormat( buffer, format ) );
1972  return Buffer::take(buffer);
1973  }
1974 
1975  inline Buffer ContextObj::createBuffer(unsigned int type, RTformat format, RTsize width)
1976  {
1977  RTbuffer buffer;
1978  checkError( rtBufferCreate( m_context, type, &buffer ) );
1979  checkError( rtBufferSetFormat( buffer, format ) );
1980  checkError( rtBufferSetSize1D( buffer, width ) );
1981  return Buffer::take(buffer);
1982  }
1983 
1984  inline Buffer ContextObj::createMipmappedBuffer(unsigned int type, RTformat format, RTsize width, unsigned int levels)
1985  {
1986  RTbuffer buffer;
1987  checkError( rtBufferCreate( m_context, type, &buffer ) );
1988  checkError( rtBufferSetFormat( buffer, format ) );
1989  checkError( rtBufferSetMipLevelCount( buffer, levels ) );
1990  checkError( rtBufferSetSize1D( buffer, width ) );
1991  return Buffer::take(buffer);
1992  }
1993 
1994  inline Buffer ContextObj::createBuffer(unsigned int type, RTformat format, RTsize width, RTsize height)
1995  {
1996  RTbuffer buffer;
1997  checkError( rtBufferCreate( m_context, type, &buffer ) );
1998  checkError( rtBufferSetFormat( buffer, format ) );
1999  checkError( rtBufferSetSize2D( buffer, width, height ) );
2000  return Buffer::take(buffer);
2001  }
2002 
2003  inline Buffer ContextObj::createMipmappedBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, unsigned int levels)
2004  {
2005  RTbuffer buffer;
2006  checkError( rtBufferCreate( m_context, type, &buffer ) );
2007  checkError( rtBufferSetFormat( buffer, format ) );
2008  checkError( rtBufferSetMipLevelCount( buffer, levels ) );
2009  checkError( rtBufferSetSize2D( buffer, width, height ) );
2010  return Buffer::take(buffer);
2011  }
2012 
2013  inline Buffer ContextObj::createBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize depth)
2014  {
2015  RTbuffer buffer;
2016  checkError( rtBufferCreate( m_context, type, &buffer ) );
2017  checkError( rtBufferSetFormat( buffer, format ) );
2018  checkError( rtBufferSetSize3D( buffer, width, height, depth ) );
2019  return Buffer::take(buffer);
2020  }
2021 
2022  inline Buffer ContextObj::createMipmappedBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize depth, unsigned int levels)
2023  {
2024  RTbuffer buffer;
2025  checkError( rtBufferCreate( m_context, type, &buffer ) );
2026  checkError( rtBufferSetFormat( buffer, format ) );
2027  checkError( rtBufferSetMipLevelCount( buffer, levels ) );
2028  checkError( rtBufferSetSize3D( buffer, width, height, depth ) );
2029  return Buffer::take(buffer);
2030  }
2031 
2032  inline Buffer ContextObj::create1DLayeredBuffer(unsigned int type, RTformat format, RTsize width, RTsize layers, unsigned int levels)
2033  {
2034  RTbuffer buffer;
2035  checkError( rtBufferCreate( m_context, type | RT_BUFFER_LAYERED, &buffer ) );
2036  checkError( rtBufferSetFormat( buffer, format ) );
2037  checkError( rtBufferSetMipLevelCount( buffer, levels ) );
2038  checkError( rtBufferSetSize3D( buffer, width, 1, layers ) );
2039  return Buffer::take(buffer);
2040  }
2041 
2042  inline Buffer ContextObj::create2DLayeredBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize layers, unsigned int levels)
2043  {
2044  RTbuffer buffer;
2045  checkError( rtBufferCreate( m_context, type | RT_BUFFER_LAYERED, &buffer ) );
2046  checkError( rtBufferSetFormat( buffer, format ) );
2047  checkError( rtBufferSetMipLevelCount( buffer, levels ) );
2048  checkError( rtBufferSetSize3D( buffer, width, height, layers ) );
2049  return Buffer::take(buffer);
2050  }
2051 
2052  inline Buffer ContextObj::createCubeBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, unsigned int levels)
2053  {
2054  RTbuffer buffer;
2055  checkError( rtBufferCreate( m_context, type | RT_BUFFER_CUBEMAP, &buffer ) );
2056  checkError( rtBufferSetFormat( buffer, format ) );
2057  checkError( rtBufferSetMipLevelCount( buffer, levels ) );
2058  checkError( rtBufferSetSize3D( buffer, width, height, 6 ) );
2059  return Buffer::take(buffer);
2060  }
2061 
2062  inline Buffer ContextObj::createCubeLayeredBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize faces, unsigned int levels)
2063  {
2064  RTbuffer buffer;
2065  checkError( rtBufferCreate( m_context, type | RT_BUFFER_CUBEMAP | RT_BUFFER_LAYERED, &buffer ) );
2066  checkError( rtBufferSetFormat( buffer, format ) );
2067  checkError( rtBufferSetMipLevelCount( buffer, levels ) );
2068  checkError( rtBufferSetSize3D( buffer, width, height, faces ) );
2069  return Buffer::take(buffer);
2070  }
2071 
2072  inline Buffer ContextObj::createBufferForCUDA(unsigned int type)
2073  {
2074  RTbuffer buffer;
2075  checkError( rtBufferCreateForCUDA( m_context, type, &buffer ) );
2076  return Buffer::take(buffer);
2077  }
2078 
2079  inline Buffer ContextObj::createBufferForCUDA(unsigned int type, RTformat format)
2080  {
2081  RTbuffer buffer;
2082  checkError( rtBufferCreateForCUDA( m_context, type, &buffer ) );
2083  checkError( rtBufferSetFormat( buffer, format ) );
2084  return Buffer::take(buffer);
2085  }
2086 
2087  inline Buffer ContextObj::createBufferForCUDA(unsigned int type, RTformat format, RTsize width)
2088  {
2089  RTbuffer buffer;
2090  checkError( rtBufferCreateForCUDA( m_context, type, &buffer ) );
2091  checkError( rtBufferSetFormat( buffer, format ) );
2092  checkError( rtBufferSetSize1D( buffer, width ) );
2093  return Buffer::take(buffer);
2094  }
2095 
2096  inline Buffer ContextObj::createBufferForCUDA(unsigned int type, RTformat format, RTsize width, RTsize height)
2097  {
2098  RTbuffer buffer;
2099  checkError( rtBufferCreateForCUDA( m_context, type, &buffer ) );
2100  checkError( rtBufferSetFormat( buffer, format ) );
2101  checkError( rtBufferSetSize2D( buffer, width, height ) );
2102  return Buffer::take(buffer);
2103  }
2104 
2105  inline Buffer ContextObj::createBufferForCUDA(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize depth)
2106  {
2107  RTbuffer buffer;
2108  checkError( rtBufferCreateForCUDA( m_context, type, &buffer ) );
2109  checkError( rtBufferSetFormat( buffer, format ) );
2110  checkError( rtBufferSetSize3D( buffer, width, height, depth ) );
2111  return Buffer::take(buffer);
2112  }
2113 
2114  inline Buffer ContextObj::createBufferFromGLBO(unsigned int type, unsigned int vbo)
2115  {
2116  RTbuffer buffer;
2117  checkError( rtBufferCreateFromGLBO( m_context, type, vbo, &buffer ) );
2118  return Buffer::take(buffer);
2119  }
2120 
2121 #ifdef _WIN32
2122 
2124  {
2125  RTbuffer buffer;
2126  checkError( rtBufferCreateFromD3D9Resource( m_context, type, pResource, &buffer ) );
2127  return Buffer::take(buffer);
2128  }
2129 
2130  inline Buffer ContextObj::createBufferFromD3D10Resource(unsigned int type, ID3D10Resource *pResource)
2131  {
2132  RTbuffer buffer;
2133  checkError( rtBufferCreateFromD3D10Resource( m_context, type, pResource, &buffer ) );
2134  return Buffer::take(buffer);
2135  }
2136 
2137  inline Buffer ContextObj::createBufferFromD3D11Resource(unsigned int type, ID3D11Resource *pResource)
2138  {
2139  RTbuffer buffer;
2140  checkError( rtBufferCreateFromD3D11Resource( m_context, type, pResource, &buffer ) );
2141  return Buffer::take(buffer);
2142  }
2143 
2145  {
2146  RTtexturesampler textureSampler;
2147  checkError( rtTextureSamplerCreateFromD3D9Resource(m_context, pResource, &textureSampler));
2148  return TextureSampler::take(textureSampler);
2149  }
2150 
2152  {
2153  RTtexturesampler textureSampler;
2154  checkError( rtTextureSamplerCreateFromD3D10Resource(m_context, pResource, &textureSampler));
2155  return TextureSampler::take(textureSampler);
2156  }
2157 
2159  {
2160  RTtexturesampler textureSampler;
2161  checkError( rtTextureSamplerCreateFromD3D11Resource(m_context, pResource, &textureSampler));
2162  return TextureSampler::take(textureSampler);
2163  }
2164 
2166  {
2167  checkError( rtContextSetD3D9Device( m_context, device ) );
2168  }
2169 
2170  inline void ContextObj::setD3D10Device(ID3D10Device* device)
2171  {
2172  checkError( rtContextSetD3D10Device( m_context, device ) );
2173  }
2174 
2175  inline void ContextObj::setD3D11Device(ID3D11Device* device)
2176  {
2177  checkError( rtContextSetD3D11Device( m_context, device ) );
2178  }
2179 
2180 #endif
2181 
2183  {
2184  RTtexturesampler textureSampler;
2185  checkError( rtTextureSamplerCreateFromGLImage(m_context, id, target, &textureSampler));
2186  return TextureSampler::take(textureSampler);
2187  }
2188 
2189  inline Buffer ContextObj::getBufferFromId(int buffer_id)
2190  {
2191  RTbuffer buffer;
2192  checkError( rtContextGetBufferFromId( m_context, buffer_id, &buffer ) );
2193  return Buffer::take(buffer);
2194  }
2195 
2196  inline Program ContextObj::getProgramFromId(int program_id)
2197  {
2198  RTprogram program;
2199  checkError( rtContextGetProgramFromId( m_context, program_id, &program ) );
2200  return Program::take(program);
2201  }
2202 
2204  {
2205  RTtexturesampler sampler;
2206  checkError( rtContextGetTextureSamplerFromId( m_context, sampler_id, &sampler ) );
2207  return TextureSampler::take(sampler);
2208  }
2209 
2211  {
2212  RTgeometry geometry;
2213  checkError( rtGeometryCreate( m_context, &geometry ) );
2214  return Geometry::take(geometry);
2215  }
2216 
2218  {
2219  RTgeometryinstance geometryinstance;
2220  checkError( rtGeometryInstanceCreate( m_context, &geometryinstance ) );
2221  return GeometryInstance::take(geometryinstance);
2222  }
2223 
2224  template<class Iterator>
2225  GeometryInstance ContextObj::createGeometryInstance( Geometry geometry, Iterator matlbegin, Iterator matlend)
2226  {
2228  result->setGeometry( geometry );
2229  unsigned int count = 0;
2230  for( Iterator iter = matlbegin; iter != matlend; ++iter )
2231  ++count;
2232  result->setMaterialCount( count );
2233  unsigned int index = 0;
2234  for(Iterator iter = matlbegin; iter != matlend; ++iter, ++index )
2235  result->setMaterial( index, *iter );
2236  return result;
2237  }
2238 
2240  {
2241  RTgroup group;
2242  checkError( rtGroupCreate( m_context, &group ) );
2243  return Group::take(group);
2244  }
2245 
2246  template<class Iterator>
2247  inline Group ContextObj::createGroup( Iterator childbegin, Iterator childend )
2248  {
2249  Group result = createGroup();
2250  unsigned int count = 0;
2251  for(Iterator iter = childbegin; iter != childend; ++iter )
2252  ++count;
2253  result->setChildCount( count );
2254  unsigned int index = 0;
2255  for(Iterator iter = childbegin; iter != childend; ++iter, ++index )
2256  result->setChild( index, *iter );
2257  return result;
2258  }
2259 
2261  {
2262  RTgeometrygroup gg;
2263  checkError( rtGeometryGroupCreate( m_context, &gg ) );
2264  return GeometryGroup::take( gg );
2265  }
2266 
2267  template<class Iterator>
2268  inline GeometryGroup ContextObj::createGeometryGroup( Iterator childbegin, Iterator childend )
2269  {
2271  unsigned int count = 0;
2272  for(Iterator iter = childbegin; iter != childend; ++iter )
2273  ++count;
2274  result->setChildCount( count );
2275  unsigned int index = 0;
2276  for(Iterator iter = childbegin; iter != childend; ++iter, ++index )
2277  result->setChild( index, *iter );
2278  return result;
2279  }
2280 
2282  {
2283  RTtransform t;
2284  checkError( rtTransformCreate( m_context, &t ) );
2285  return Transform::take( t );
2286  }
2287 
2289  {
2290  RTmaterial material;
2291  checkError( rtMaterialCreate( m_context, &material ) );
2292  return Material::take(material);
2293  }
2294 
2295  inline Program ContextObj::createProgramFromPTXFile( const std::string& filename, const std::string& program_name )
2296  {
2297  RTprogram program;
2298  checkError( rtProgramCreateFromPTXFile( m_context, filename.c_str(), program_name.c_str(), &program ) );
2299  return Program::take(program);
2300  }
2301 
2302  inline Program ContextObj::createProgramFromPTXString( const std::string& ptx, const std::string& program_name )
2303  {
2304  RTprogram program;
2305  checkError( rtProgramCreateFromPTXString( m_context, ptx.c_str(), program_name.c_str(), &program ) );
2306  return Program::take(program);
2307  }
2308 
2310  {
2311  RTselector selector;
2312  checkError( rtSelectorCreate( m_context, &selector ) );
2313  return Selector::take(selector);
2314  }
2315 
2317  {
2318  RTtexturesampler texturesampler;
2319  checkError( rtTextureSamplerCreate( m_context, &texturesampler ) );
2320  return TextureSampler::take(texturesampler);
2321  }
2322 
2323  inline std::string ContextObj::getErrorString( RTresult code ) const
2324  {
2325  const char* str;
2326  rtContextGetErrorString( m_context, code, &str);
2327  return std::string(str);
2328  }
2329 
2330  template<class Iterator> inline
2331  void ContextObj::setDevices(Iterator begin, Iterator end)
2332  {
2333  std::vector<int> devices;
2334  std::copy( begin, end, std::insert_iterator<std::vector<int> >( devices, devices.begin() ) );
2335  checkError( rtContextSetDevices( m_context, static_cast<unsigned int>(devices.size()), &devices[0]) );
2336  }
2337 
2338  inline std::vector<int> ContextObj::getEnabledDevices() const
2339  {
2340  // Initialize with the number of enabled devices
2341  std::vector<int> devices(getEnabledDeviceCount());
2342  checkError( rtContextGetDevices( m_context, &devices[0] ) );
2343  return devices;
2344  }
2345 
2346  inline unsigned int ContextObj::getEnabledDeviceCount() const
2347  {
2348  unsigned int num;
2349  checkError( rtContextGetDeviceCount( m_context, &num ) );
2350  return num;
2351  }
2352 
2354  {
2355  int tex_count;
2356  checkError( rtContextGetAttribute( m_context, RT_CONTEXT_ATTRIBUTE_MAX_TEXTURE_COUNT, sizeof(tex_count), &tex_count) );
2357  return tex_count;
2358  }
2359 
2360  inline int ContextObj::getCPUNumThreads() const
2361  {
2362  int cpu_num_threads;
2363  checkError( rtContextGetAttribute( m_context, RT_CONTEXT_ATTRIBUTE_CPU_NUM_THREADS, sizeof(cpu_num_threads), &cpu_num_threads) );
2364  return cpu_num_threads;
2365  }
2366 
2367  inline RTsize ContextObj::getUsedHostMemory() const
2368  {
2369  RTsize used_mem;
2370  checkError( rtContextGetAttribute( m_context, RT_CONTEXT_ATTRIBUTE_USED_HOST_MEMORY, sizeof(used_mem), &used_mem) );
2371  return used_mem;
2372  }
2373 
2375  {
2376  int gpu_paging_active;
2377  checkError( rtContextGetAttribute( m_context, RT_CONTEXT_ATTRIBUTE_GPU_PAGING_ACTIVE, sizeof(gpu_paging_active), &gpu_paging_active) );
2378  return gpu_paging_active;
2379  }
2380 
2382  {
2383  int gpu_paging_forced_off;
2384  checkError( rtContextGetAttribute( m_context, RT_CONTEXT_ATTRIBUTE_GPU_PAGING_FORCED_OFF, sizeof(gpu_paging_forced_off), &gpu_paging_forced_off) );
2385  return gpu_paging_forced_off;
2386  }
2387 
2388  inline RTsize ContextObj::getAvailableDeviceMemory(int ordinal) const
2389  {
2390  RTsize free_mem;
2391  checkError( rtContextGetAttribute( m_context,
2392  static_cast<RTcontextattribute>(RT_CONTEXT_ATTRIBUTE_AVAILABLE_DEVICE_MEMORY + ordinal),
2393  sizeof(free_mem), &free_mem) );
2394  return free_mem;
2395  }
2396 
2397  inline void ContextObj::setCPUNumThreads(int cpu_num_threads)
2398  {
2399  checkError( rtContextSetAttribute( m_context, RT_CONTEXT_ATTRIBUTE_CPU_NUM_THREADS, sizeof(cpu_num_threads), &cpu_num_threads) );
2400  }
2401 
2402  inline void ContextObj::setGPUPagingForcedOff(int gpu_paging_forced_off)
2403  {
2404  checkError( rtContextSetAttribute( m_context, RT_CONTEXT_ATTRIBUTE_GPU_PAGING_FORCED_OFF, sizeof(gpu_paging_forced_off), &gpu_paging_forced_off) );
2405  }
2406 
2407  template<class T>
2408  inline void ContextObj::setAttribute(RTcontextattribute attribute, const T& val)
2409  {
2410  checkError( rtContextSetAttribute( m_context, attribute, sizeof(T), const_cast<T*>(&val)) );
2411  }
2412 
2413  inline void ContextObj::setStackSize(RTsize stack_size_bytes)
2414  {
2415  checkError(rtContextSetStackSize(m_context, stack_size_bytes) );
2416  }
2417 
2418  inline RTsize ContextObj::getStackSize() const
2419  {
2420  RTsize result;
2421  checkError( rtContextGetStackSize( m_context, &result ) );
2422  return result;
2423  }
2424 
2425  inline void ContextObj::setTimeoutCallback(RTtimeoutcallback callback, double min_polling_seconds)
2426  {
2427  checkError( rtContextSetTimeoutCallback( m_context, callback, min_polling_seconds ) );
2428  }
2429 
2430  inline void ContextObj::setEntryPointCount(unsigned int num_entry_points)
2431  {
2432  checkError( rtContextSetEntryPointCount( m_context, num_entry_points ) );
2433  }
2434 
2435  inline unsigned int ContextObj::getEntryPointCount() const
2436  {
2437  unsigned int result;
2438  checkError( rtContextGetEntryPointCount( m_context, &result ) );
2439  return result;
2440  }
2441 
2442 
2443  inline void ContextObj::setRayGenerationProgram(unsigned int entry_point_index, Program program)
2444  {
2445  checkError( rtContextSetRayGenerationProgram( m_context, entry_point_index, program->get() ) );
2446  }
2447 
2448  inline Program ContextObj::getRayGenerationProgram(unsigned int entry_point_index) const
2449  {
2450  RTprogram result;
2451  checkError( rtContextGetRayGenerationProgram( m_context, entry_point_index, &result ) );
2452  return Program::take( result );
2453  }
2454 
2455 
2456  inline void ContextObj::setExceptionProgram(unsigned int entry_point_index, Program program)
2457  {
2458  checkError( rtContextSetExceptionProgram( m_context, entry_point_index, program->get() ) );
2459  }
2460 
2461  inline Program ContextObj::getExceptionProgram(unsigned int entry_point_index) const
2462  {
2463  RTprogram result;
2464  checkError( rtContextGetExceptionProgram( m_context, entry_point_index, &result ) );
2465  return Program::take( result );
2466  }
2467 
2468 
2469  inline void ContextObj::setExceptionEnabled( RTexception exception, bool enabled )
2470  {
2471  checkError( rtContextSetExceptionEnabled( m_context, exception, enabled ) );
2472  }
2473 
2474  inline bool ContextObj::getExceptionEnabled( RTexception exception ) const
2475  {
2476  int enabled;
2477  checkError( rtContextGetExceptionEnabled( m_context, exception, &enabled ) );
2478  return enabled != 0;
2479  }
2480 
2481 
2482  inline void ContextObj::setRayTypeCount(unsigned int num_ray_types)
2483  {
2484  checkError( rtContextSetRayTypeCount( m_context, num_ray_types ) );
2485  }
2486 
2487  inline unsigned int ContextObj::getRayTypeCount() const
2488  {
2489  unsigned int result;
2490  checkError( rtContextGetRayTypeCount( m_context, &result ) );
2491  return result;
2492  }
2493 
2494  inline void ContextObj::setMissProgram(unsigned int ray_type_index, Program program)
2495  {
2496  checkError( rtContextSetMissProgram( m_context, ray_type_index, program->get() ) );
2497  }
2498 
2499  inline Program ContextObj::getMissProgram(unsigned int ray_type_index) const
2500  {
2501  RTprogram result;
2502  checkError( rtContextGetMissProgram( m_context, ray_type_index, &result ) );
2503  return Program::take( result );
2504  }
2505 
2506  inline void ContextObj::compile()
2507  {
2508  checkError( rtContextCompile( m_context ) );
2509  }
2510 
2511  inline void ContextObj::launch(unsigned int entry_point_index, RTsize image_width)
2512  {
2513  checkError( rtContextLaunch1D( m_context, entry_point_index, image_width ) );
2514  }
2515 
2516  inline void ContextObj::launch(unsigned int entry_point_index, RTsize image_width, RTsize image_height)
2517  {
2518  checkError( rtContextLaunch2D( m_context, entry_point_index, image_width, image_height ) );
2519  }
2520 
2521  inline void ContextObj::launch(unsigned int entry_point_index, RTsize image_width, RTsize image_height, RTsize image_depth)
2522  {
2523  checkError( rtContextLaunch3D( m_context, entry_point_index, image_width, image_height, image_depth ) );
2524  }
2525 
2526 
2527  // Progressive API
2528  inline void ContextObj::launchProgressive(unsigned int entry_point_index, RTsize image_width, RTsize image_height, unsigned int max_subframes)
2529  {
2530  checkError( rtContextLaunchProgressive2D( m_context, entry_point_index, image_width, image_height, max_subframes ) );
2531  }
2532 
2534  {
2535  checkError( rtContextStopProgressive( m_context ) );
2536  }
2537 
2538  inline void ContextObj::setRemoteDevice( RemoteDevice remote_device )
2539  {
2540  checkError( rtContextSetRemoteDevice( m_context, remote_device->get() ) );
2541  }
2542 
2543  inline int ContextObj::getRunningState() const
2544  {
2545  int result;
2546  checkError( rtContextGetRunningState( m_context, &result ) );
2547  return result;
2548  }
2549 
2550  inline void ContextObj::setPrintEnabled(bool enabled)
2551  {
2552  checkError( rtContextSetPrintEnabled( m_context, enabled ) );
2553  }
2554 
2555  inline bool ContextObj::getPrintEnabled() const
2556  {
2557  int enabled;
2558  checkError( rtContextGetPrintEnabled( m_context, &enabled ) );
2559  return enabled != 0;
2560  }
2561 
2562  inline void ContextObj::setPrintBufferSize(RTsize buffer_size_bytes)
2563  {
2564  checkError( rtContextSetPrintBufferSize( m_context, buffer_size_bytes ) );
2565  }
2566 
2567  inline RTsize ContextObj::getPrintBufferSize() const
2568  {
2569  RTsize result;
2570  checkError( rtContextGetPrintBufferSize( m_context, &result ) );
2571  return result;
2572  }
2573 
2574  inline void ContextObj::setPrintLaunchIndex(int x, int y, int z)
2575  {
2576  checkError( rtContextSetPrintLaunchIndex( m_context, x, y, z ) );
2577  }
2578 
2579  inline optix::int3 ContextObj::getPrintLaunchIndex() const
2580  {
2581  optix::int3 result;
2582  checkError( rtContextGetPrintLaunchIndex( m_context, &result.x, &result.y, &result.z ) );
2583  return result;
2584  }
2585 
2586  inline Variable ContextObj::declareVariable(const std::string& name)
2587  {
2588  RTvariable v;
2589  checkError( rtContextDeclareVariable( m_context, name.c_str(), &v ) );
2590  return Variable::take( v );
2591  }
2592 
2593  inline Variable ContextObj::queryVariable(const std::string& name) const
2594  {
2595  RTvariable v;
2596  checkError( rtContextQueryVariable( m_context, name.c_str(), &v ) );
2597  return Variable::take( v );
2598  }
2599 
2601  {
2602  checkError( rtContextRemoveVariable( m_context, v->get() ) );
2603  }
2604 
2605  inline unsigned int ContextObj::getVariableCount() const
2606  {
2607  unsigned int result;
2608  checkError( rtContextGetVariableCount( m_context, &result ) );
2609  return result;
2610  }
2611 
2612  inline Variable ContextObj::getVariable(unsigned int index) const
2613  {
2614  RTvariable v;
2615  checkError( rtContextGetVariable( m_context, index, &v ) );
2616  return Variable::take( v );
2617  }
2618 
2619 
2621  {
2622  return m_context;
2623  }
2624 
2625  inline void ProgramObj::destroy()
2626  {
2627  Context context = getContext();
2628  checkError( rtProgramDestroy( m_program ), context );
2629  m_program = 0;
2630  }
2631 
2632  inline void ProgramObj::validate()
2633  {
2634  checkError( rtProgramValidate( m_program ) );
2635  }
2636 
2638  {
2639  RTcontext c;
2640  checkErrorNoGetContext( rtProgramGetContext( m_program, &c ) );
2641  return Context::take( c );
2642  }
2643 
2644  inline Variable ProgramObj::declareVariable(const std::string& name)
2645  {
2646  RTvariable v;
2647  checkError( rtProgramDeclareVariable( m_program, name.c_str(), &v ) );
2648  return Variable::take( v );
2649  }
2650 
2651  inline Variable ProgramObj::queryVariable(const std::string& name) const
2652  {
2653  RTvariable v;
2654  checkError( rtProgramQueryVariable( m_program, name.c_str(), &v ) );
2655  return Variable::take( v );
2656  }
2657 
2659  {
2660  checkError( rtProgramRemoveVariable( m_program, v->get() ) );
2661  }
2662 
2663  inline unsigned int ProgramObj::getVariableCount() const
2664  {
2665  unsigned int result;
2666  checkError( rtProgramGetVariableCount( m_program, &result ) );
2667  return result;
2668  }
2669 
2670  inline Variable ProgramObj::getVariable(unsigned int index) const
2671  {
2672  RTvariable v;
2673  checkError( rtProgramGetVariable( m_program, index, &v ) );
2674  return Variable::take(v);
2675  }
2676 
2677  inline int ProgramObj::getId() const
2678  {
2679  int result;
2680  checkError( rtProgramGetId( m_program, &result ) );
2681  return result;
2682  }
2683 
2684  inline RTprogram ProgramObj::get()
2685  {
2686  return m_program;
2687  }
2688 
2689  inline void GroupObj::destroy()
2690  {
2691  Context context = getContext();
2692  checkError( rtGroupDestroy( m_group ), context );
2693  m_group = 0;
2694  }
2695 
2696  inline void GroupObj::validate()
2697  {
2698  checkError( rtGroupValidate( m_group ) );
2699  }
2700 
2702  {
2703  RTcontext c;
2704  checkErrorNoGetContext( rtGroupGetContext( m_group, &c) );
2705  return Context::take(c);
2706  }
2707 
2708  inline void SelectorObj::destroy()
2709  {
2710  Context context = getContext();
2711  checkError( rtSelectorDestroy( m_selector ), context );
2712  m_selector = 0;
2713  }
2714 
2716  {
2717  checkError( rtSelectorValidate( m_selector ) );
2718  }
2719 
2721  {
2722  RTcontext c;
2723  checkErrorNoGetContext( rtSelectorGetContext( m_selector, &c ) );
2724  return Context::take( c );
2725  }
2726 
2728  {
2729  checkError( rtSelectorSetVisitProgram( m_selector, program->get() ) );
2730  }
2731 
2733  {
2734  RTprogram result;
2735  checkError( rtSelectorGetVisitProgram( m_selector, &result ) );
2736  return Program::take( result );
2737  }
2738 
2739  inline void SelectorObj::setChildCount(unsigned int count)
2740  {
2741  checkError( rtSelectorSetChildCount( m_selector, count) );
2742  }
2743 
2744  inline unsigned int SelectorObj::getChildCount() const
2745  {
2746  unsigned int result;
2747  checkError( rtSelectorGetChildCount( m_selector, &result ) );
2748  return result;
2749  }
2750 
2751  template< typename T >
2752  inline void SelectorObj::setChild(unsigned int index, T child)
2753  {
2754  checkError( rtSelectorSetChild( m_selector, index, child->get() ) );
2755  }
2756 
2757  template< typename T >
2758  inline T SelectorObj::getChild(unsigned int index) const
2759  {
2760  RTobject result;
2761  checkError( rtSelectorGetChild( m_selector, index, &result ) );
2762  return T::take( result );
2763  }
2764 
2765  inline RTobjecttype SelectorObj::getChildType(unsigned int index) const
2766  {
2767  RTobjecttype type;
2768  checkError( rtSelectorGetChildType( m_selector, index, &type) );
2769  return type;
2770  }
2771 
2772  template< typename T >
2773  inline unsigned int SelectorObj::addChild(T child)
2774  {
2775  unsigned int index;
2776  checkError( rtSelectorGetChildCount( m_selector, &index ) );
2777  checkError( rtSelectorSetChildCount( m_selector, index+1 ) );
2778  checkError( rtSelectorSetChild( m_selector, index, child->get() ) );
2779  return index;
2780  }
2781 
2782  template< typename T >
2783  inline unsigned int SelectorObj::removeChild(T child)
2784  {
2785  unsigned int index = getChildIndex( child );
2786  removeChild( index );
2787  return index;
2788  }
2789 
2790  inline void SelectorObj::removeChild(int index)
2791  {
2792  removeChild(static_cast<unsigned int>(index));
2793  }
2794 
2795  inline void SelectorObj::removeChild(unsigned int index)
2796  {
2797  // Shift down all elements in O(n)
2798  unsigned int count;
2799  RTobject temp;
2800  checkError( rtSelectorGetChildCount( m_selector, &count ) );
2801  if(index >= count) {
2802  RTcontext c = this->getContext()->get();
2804  }
2805  for(unsigned int i=index+1; i<count; i++) {
2806  checkError( rtSelectorGetChild( m_selector, i, &temp ) );
2807  checkError( rtSelectorSetChild( m_selector, i-1, temp ) );
2808  }
2809  checkError( rtSelectorSetChildCount( m_selector, count-1 ) );
2810  }
2811 
2812  template< typename T >
2813  inline unsigned int SelectorObj::getChildIndex(T child) const
2814  {
2815  unsigned int count;
2816  RTobject temp;
2817  checkError( rtSelectorGetChildCount( m_selector, &count ) );
2818  for( unsigned int index = 0; index < count; index++ ) {
2819  checkError( rtSelectorGetChild( m_selector, index, &temp ) );
2820  if( child->get() == temp ) return index; // Found
2821  }
2822  RTcontext c = this->getContext()->get();
2824  }
2825 
2826  inline Variable SelectorObj::declareVariable(const std::string& name)
2827  {
2828  RTvariable v;
2829  checkError( rtSelectorDeclareVariable( m_selector, name.c_str(), &v ) );
2830  return Variable::take( v );
2831  }
2832 
2833  inline Variable SelectorObj::queryVariable(const std::string& name) const
2834  {
2835  RTvariable v;
2836  checkError( rtSelectorQueryVariable( m_selector, name.c_str(), &v ) );
2837  return Variable::take( v );
2838  }
2839 
2840  inline void SelectorObj::removeVariable(Variable v)
2841  {
2842  checkError( rtSelectorRemoveVariable( m_selector, v->get() ) );
2843  }
2844 
2845  inline unsigned int SelectorObj::getVariableCount() const
2846  {
2847  unsigned int result;
2848  checkError( rtSelectorGetVariableCount( m_selector, &result ) );
2849  return result;
2850  }
2851 
2852  inline Variable SelectorObj::getVariable(unsigned int index) const
2853  {
2854  RTvariable v;
2855  checkError( rtSelectorGetVariable( m_selector, index, &v ) );
2856  return Variable::take( v );
2857  }
2858 
2860  {
2861  return m_selector;
2862  }
2863 
2864  inline void GroupObj::setAcceleration(Acceleration acceleration)
2865  {
2866  checkError( rtGroupSetAcceleration( m_group, acceleration->get() ) );
2867  }
2868 
2870  {
2871  RTacceleration result;
2872  checkError( rtGroupGetAcceleration( m_group, &result ) );
2873  return Acceleration::take( result );
2874  }
2875 
2876  inline void GroupObj::setChildCount(unsigned int count)
2877  {
2878  checkError( rtGroupSetChildCount( m_group, count ) );
2879  }
2880 
2881  inline unsigned int GroupObj::getChildCount() const
2882  {
2883  unsigned int result;
2884  checkError( rtGroupGetChildCount( m_group, &result ) );
2885  return result;
2886  }
2887 
2888  template< typename T >
2889  inline void GroupObj::setChild(unsigned int index, T child)
2890  {
2891  checkError( rtGroupSetChild( m_group, index, child->get() ) );
2892  }
2893 
2894  template< typename T >
2895  inline T GroupObj::getChild(unsigned int index) const
2896  {
2897  RTobject result;
2898  checkError( rtGroupGetChild( m_group, index, &result) );
2899  return T::take( result );
2900  }
2901 
2902  inline RTobjecttype GroupObj::getChildType(unsigned int index) const
2903  {
2904  RTobjecttype type;
2905  checkError( rtGroupGetChildType( m_group, index, &type) );
2906  return type;
2907  }
2908 
2909  template< typename T >
2910  inline unsigned int GroupObj::addChild(T child)
2911  {
2912  unsigned int index;
2913  checkError( rtGroupGetChildCount( m_group, &index ) );
2914  checkError( rtGroupSetChildCount( m_group, index+1 ) );
2915  checkError( rtGroupSetChild( m_group, index, child->get() ) );
2916  return index;
2917  }
2918 
2919  template< typename T >
2920  inline unsigned int GroupObj::removeChild(T child)
2921  {
2922  unsigned int index = getChildIndex( child );
2923  removeChild( index );
2924  return index;
2925  }
2926 
2927  inline void GroupObj::removeChild(int index)
2928  {
2929  removeChild(static_cast<unsigned int>(index));
2930  }
2931 
2932  inline void GroupObj::removeChild(unsigned int index)
2933  {
2934  unsigned int count;
2935  checkError( rtGroupGetChildCount( m_group, &count ) );
2936  if(index >= count) {
2937  RTcontext c = this->getContext()->get();
2939  }
2940 
2941  // Replace to-be-removed child with last child.
2942  RTobject temp;
2943  checkError( rtGroupGetChild( m_group, count-1, &temp ) );
2944  checkError( rtGroupSetChild( m_group, index, temp ) );
2945  checkError( rtGroupSetChildCount( m_group, count-1 ) );
2946  }
2947 
2948  template< typename T >
2949  inline unsigned int GroupObj::getChildIndex(T child) const
2950  {
2951  unsigned int count;
2952  RTobject temp;
2953  checkError( rtGroupGetChildCount( m_group, &count ) );
2954  for( unsigned int index = 0; index < count; index++ ) {
2955  checkError( rtGroupGetChild( m_group, index, &temp ) );
2956  if( child->get() == temp ) return index; // Found
2957  }
2958  RTcontext c = this->getContext()->get();
2960  }
2961 
2963  {
2964  return m_group;
2965  }
2966 
2968  {
2969  Context context = getContext();
2970  checkError( rtGeometryGroupDestroy( m_geometrygroup ), context );
2971  m_geometrygroup = 0;
2972  }
2973 
2975  {
2976  checkError( rtGeometryGroupValidate( m_geometrygroup ) );
2977  }
2978 
2980  {
2981  RTcontext c;
2982  checkErrorNoGetContext( rtGeometryGroupGetContext( m_geometrygroup, &c) );
2983  return Context::take(c);
2984  }
2985 
2987  {
2988  checkError( rtGeometryGroupSetAcceleration( m_geometrygroup, acceleration->get() ) );
2989  }
2990 
2992  {
2993  RTacceleration result;
2994  checkError( rtGeometryGroupGetAcceleration( m_geometrygroup, &result ) );
2995  return Acceleration::take( result );
2996  }
2997 
2998  inline void GeometryGroupObj::setChildCount(unsigned int count)
2999  {
3000  checkError( rtGeometryGroupSetChildCount( m_geometrygroup, count ) );
3001  }
3002 
3003  inline unsigned int GeometryGroupObj::getChildCount() const
3004  {
3005  unsigned int result;
3006  checkError( rtGeometryGroupGetChildCount( m_geometrygroup, &result ) );
3007  return result;
3008  }
3009 
3010  inline void GeometryGroupObj::setChild(unsigned int index, GeometryInstance child)
3011  {
3012  checkError( rtGeometryGroupSetChild( m_geometrygroup, index, child->get() ) );
3013  }
3014 
3015  inline GeometryInstance GeometryGroupObj::getChild(unsigned int index) const
3016  {
3017  RTgeometryinstance result;
3018  checkError( rtGeometryGroupGetChild( m_geometrygroup, index, &result) );
3019  return GeometryInstance::take( result );
3020  }
3021 
3023  {
3024  unsigned int index;
3025  checkError( rtGeometryGroupGetChildCount( m_geometrygroup, &index ) );
3026  checkError( rtGeometryGroupSetChildCount( m_geometrygroup, index+1 ) );
3027  checkError( rtGeometryGroupSetChild( m_geometrygroup, index, child->get() ) );
3028  return index;
3029  }
3030 
3032  {
3033  unsigned int index = getChildIndex( child );
3034  removeChild( index );
3035  return index;
3036  }
3037 
3038  inline void GeometryGroupObj::removeChild(int index)
3039  {
3040  removeChild(static_cast<unsigned int>(index));
3041  }
3042 
3043  inline void GeometryGroupObj::removeChild(unsigned int index)
3044  {
3045  unsigned int count;
3046  checkError( rtGeometryGroupGetChildCount( m_geometrygroup, &count ) );
3047  if(index >= count) {
3048  RTcontext c = this->getContext()->get();
3050  }
3051 
3052  // Replace to-be-removed child with last child.
3053  RTgeometryinstance temp;
3054  checkError( rtGeometryGroupGetChild( m_geometrygroup, count-1, &temp ) );
3055  checkError( rtGeometryGroupSetChild( m_geometrygroup, index, temp ) );
3056  checkError( rtGeometryGroupSetChildCount( m_geometrygroup, count-1 ) );
3057  }
3058 
3059  inline unsigned int GeometryGroupObj::getChildIndex(GeometryInstance child) const
3060  {
3061  unsigned int count;
3062  RTgeometryinstance temp;
3063  checkError( rtGeometryGroupGetChildCount( m_geometrygroup, &count ) );
3064  for( unsigned int index = 0; index < count; index++ ) {
3065  checkError( rtGeometryGroupGetChild( m_geometrygroup, index, &temp ) );
3066  if( child->get() == temp ) return index; // Found
3067  }
3068  RTcontext c = this->getContext()->get();
3070  }
3071 
3073  {
3074  return m_geometrygroup;
3075  }
3076 
3078  {
3079  Context context = getContext();
3080  checkError( rtTransformDestroy( m_transform ), context );
3081  m_transform = 0;
3082  }
3083 
3085  {
3086  checkError( rtTransformValidate( m_transform ) );
3087  }
3088 
3090  {
3091  RTcontext c;
3092  checkErrorNoGetContext( rtTransformGetContext( m_transform, &c) );
3093  return Context::take(c);
3094  }
3095 
3096  template< typename T >
3097  inline void TransformObj::setChild(T child)
3098  {
3099  checkError( rtTransformSetChild( m_transform, child->get() ) );
3100  }
3101 
3102  template< typename T >
3103  inline T TransformObj::getChild() const
3104  {
3105  RTobject result;
3106  checkError( rtTransformGetChild( m_transform, &result) );
3107  return T::take( result );
3108  }
3109 
3111  {
3112 
3113  RTobjecttype type;
3114  checkError( rtTransformGetChildType( m_transform, &type) );
3115  return type;
3116  }
3117 
3118  inline void TransformObj::setMatrix(bool transpose, const float* matrix, const float* inverse_matrix)
3119  {
3120  rtTransformSetMatrix( m_transform, transpose, matrix, inverse_matrix );
3121  }
3122 
3123  inline void TransformObj::getMatrix(bool transpose, float* matrix, float* inverse_matrix) const
3124  {
3125  rtTransformGetMatrix( m_transform, transpose, matrix, inverse_matrix );
3126  }
3127 
3129  {
3130  return m_transform;
3131  }
3132 
3134  {
3135  Context context = getContext();
3136  checkError( rtAccelerationDestroy(m_acceleration), context );
3137  m_acceleration = 0;
3138  }
3139 
3141  {
3142  checkError( rtAccelerationValidate(m_acceleration) );
3143  }
3144 
3146  {
3147  RTcontext c;
3148  checkErrorNoGetContext( rtAccelerationGetContext(m_acceleration, &c ) );
3149  return Context::take( c );
3150  }
3151 
3153  {
3154  checkError( rtAccelerationMarkDirty(m_acceleration) );
3155  }
3156 
3157  inline bool AccelerationObj::isDirty() const
3158  {
3159  int dirty;
3160  checkError( rtAccelerationIsDirty(m_acceleration,&dirty) );
3161  return dirty != 0;
3162  }
3163 
3164  inline void AccelerationObj::setProperty( const std::string& name, const std::string& value )
3165  {
3166  checkError( rtAccelerationSetProperty(m_acceleration, name.c_str(), value.c_str() ) );
3167  }
3168 
3169  inline std::string AccelerationObj::getProperty( const std::string& name ) const
3170  {
3171  const char* s;
3172  checkError( rtAccelerationGetProperty(m_acceleration, name.c_str(), &s ) );
3173  return std::string( s );
3174  }
3175 
3176  inline void AccelerationObj::setBuilder(const std::string& builder)
3177  {
3178  checkError( rtAccelerationSetBuilder(m_acceleration, builder.c_str() ) );
3179  }
3180 
3181  inline std::string AccelerationObj::getBuilder() const
3182  {
3183  const char* s;
3184  checkError( rtAccelerationGetBuilder(m_acceleration, &s ) );
3185  return std::string( s );
3186  }
3187 
3188  inline void AccelerationObj::setTraverser(const std::string& traverser)
3189  {
3190  checkError( rtAccelerationSetTraverser(m_acceleration, traverser.c_str() ) );
3191  }
3192 
3193  inline std::string AccelerationObj::getTraverser() const
3194  {
3195  const char* s;
3196  checkError( rtAccelerationGetTraverser(m_acceleration, &s ) );
3197  return std::string( s );
3198  }
3199 
3200  inline RTsize AccelerationObj::getDataSize() const
3201  {
3202  RTsize sz;
3203  checkError( rtAccelerationGetDataSize(m_acceleration, &sz) );
3204  return sz;
3205  }
3206 
3207  inline void AccelerationObj::getData( void* data ) const
3208  {
3209  checkError( rtAccelerationGetData(m_acceleration,data) );
3210  }
3211 
3212  inline void AccelerationObj::setData( const void* data, RTsize size )
3213  {
3214  checkError( rtAccelerationSetData(m_acceleration,data,size) );
3215  }
3216 
3218  {
3219  return m_acceleration;
3220  }
3221 
3223  {
3224  Context context = getContext();
3225  checkError( rtGeometryInstanceDestroy( m_geometryinstance ), context );
3226  m_geometryinstance = 0;
3227  }
3228 
3230  {
3231  checkError( rtGeometryInstanceValidate( m_geometryinstance ) );
3232  }
3233 
3235  {
3236  RTcontext c;
3237  checkErrorNoGetContext( rtGeometryInstanceGetContext( m_geometryinstance, &c ) );
3238  return Context::take( c );
3239  }
3240 
3242  {
3243  checkError( rtGeometryInstanceSetGeometry( m_geometryinstance, geometry->get() ) );
3244  }
3245 
3247  {
3248  RTgeometry result;
3249  checkError( rtGeometryInstanceGetGeometry( m_geometryinstance, &result ) );
3250  return Geometry::take( result );
3251  }
3252 
3253  inline void GeometryInstanceObj::setMaterialCount(unsigned int count)
3254  {
3255  checkError( rtGeometryInstanceSetMaterialCount( m_geometryinstance, count ) );
3256  }
3257 
3258  inline unsigned int GeometryInstanceObj::getMaterialCount() const
3259  {
3260  unsigned int result;
3261  checkError( rtGeometryInstanceGetMaterialCount( m_geometryinstance, &result ) );
3262  return result;
3263  }
3264 
3265  inline void GeometryInstanceObj::setMaterial(unsigned int idx, Material material)
3266  {
3267  checkError( rtGeometryInstanceSetMaterial( m_geometryinstance, idx, material->get()) );
3268  }
3269 
3270  inline Material GeometryInstanceObj::getMaterial(unsigned int idx) const
3271  {
3272  RTmaterial result;
3273  checkError( rtGeometryInstanceGetMaterial( m_geometryinstance, idx, &result ) );
3274  return Material::take( result );
3275  }
3276 
3277  // Adds the material and returns the index to the added material.
3278  inline unsigned int GeometryInstanceObj::addMaterial(Material material)
3279  {
3280  unsigned int old_count = getMaterialCount();
3281  setMaterialCount(old_count+1);
3282  setMaterial(old_count, material);
3283  return old_count;
3284  }
3285 
3286  inline Variable GeometryInstanceObj::declareVariable(const std::string& name)
3287  {
3288  RTvariable v;
3289  checkError( rtGeometryInstanceDeclareVariable( m_geometryinstance, name.c_str(), &v ) );
3290  return Variable::take( v );
3291  }
3292 
3293  inline Variable GeometryInstanceObj::queryVariable(const std::string& name) const
3294  {
3295  RTvariable v;
3296  checkError( rtGeometryInstanceQueryVariable( m_geometryinstance, name.c_str(), &v ) );
3297  return Variable::take( v );
3298  }
3299 
3301  {
3302  checkError( rtGeometryInstanceRemoveVariable( m_geometryinstance, v->get() ) );
3303  }
3304 
3305  inline unsigned int GeometryInstanceObj::getVariableCount() const
3306  {
3307  unsigned int result;
3308  checkError( rtGeometryInstanceGetVariableCount( m_geometryinstance, &result ) );
3309  return result;
3310  }
3311 
3312  inline Variable GeometryInstanceObj::getVariable(unsigned int index) const
3313  {
3314  RTvariable v;
3315  checkError( rtGeometryInstanceGetVariable( m_geometryinstance, index, &v ) );
3316  return Variable::take( v );
3317  }
3318 
3320  {
3321  return m_geometryinstance;
3322  }
3323 
3324  inline void GeometryObj::destroy()
3325  {
3326  Context context = getContext();
3327  checkError( rtGeometryDestroy( m_geometry ), context );
3328  m_geometry = 0;
3329  }
3330 
3332  {
3333  checkError( rtGeometryValidate( m_geometry ) );
3334  }
3335 
3337  {
3338  RTcontext c;
3339  checkErrorNoGetContext( rtGeometryGetContext( m_geometry, &c ) );
3340  return Context::take( c );
3341  }
3342 
3343  inline void GeometryObj::setPrimitiveCount(unsigned int num_primitives)
3344  {
3345  checkError( rtGeometrySetPrimitiveCount( m_geometry, num_primitives ) );
3346  }
3347 
3348  inline unsigned int GeometryObj::getPrimitiveCount() const
3349  {
3350  unsigned int result;
3351  checkError( rtGeometryGetPrimitiveCount( m_geometry, &result ) );
3352  return result;
3353  }
3354 
3355  inline void GeometryObj::setPrimitiveIndexOffset(unsigned int index_offset)
3356  {
3357  checkError( rtGeometrySetPrimitiveIndexOffset( m_geometry, index_offset) );
3358  }
3359 
3360  inline unsigned int GeometryObj::getPrimitiveIndexOffset() const
3361  {
3362  unsigned int result;
3363  checkError( rtGeometryGetPrimitiveIndexOffset( m_geometry, &result ) );
3364  return result;
3365  }
3366 
3368  {
3369  checkError( rtGeometrySetBoundingBoxProgram( m_geometry, program->get() ) );
3370  }
3371 
3373  {
3374  RTprogram result;
3375  checkError( rtGeometryGetBoundingBoxProgram( m_geometry, &result ) );
3376  return Program::take( result );
3377  }
3378 
3380  {
3381  checkError( rtGeometrySetIntersectionProgram( m_geometry, program->get() ) );
3382  }
3383 
3385  {
3386  RTprogram result;
3387  checkError( rtGeometryGetIntersectionProgram( m_geometry, &result ) );
3388  return Program::take( result );
3389  }
3390 
3391  inline Variable GeometryObj::declareVariable(const std::string& name)
3392  {
3393  RTvariable v;
3394  checkError( rtGeometryDeclareVariable( m_geometry, name.c_str(), &v ) );
3395  return Variable::take( v );
3396  }
3397 
3398  inline Variable GeometryObj::queryVariable(const std::string& name) const
3399  {
3400  RTvariable v;
3401  checkError( rtGeometryQueryVariable( m_geometry, name.c_str(), &v ) );
3402  return Variable::take( v );
3403  }
3404 
3406  {
3407  checkError( rtGeometryRemoveVariable( m_geometry, v->get() ) );
3408  }
3409 
3410  inline unsigned int GeometryObj::getVariableCount() const
3411  {
3412  unsigned int result;
3413  checkError( rtGeometryGetVariableCount( m_geometry, &result ) );
3414  return result;
3415  }
3416 
3417  inline Variable GeometryObj::getVariable(unsigned int index) const
3418  {
3419  RTvariable v;
3420  checkError( rtGeometryGetVariable( m_geometry, index, &v ) );
3421  return Variable::take( v );
3422  }
3423 
3425  {
3426  checkError( rtGeometryMarkDirty(m_geometry) );
3427  }
3428 
3429  inline bool GeometryObj::isDirty() const
3430  {
3431  int dirty;
3432  checkError( rtGeometryIsDirty(m_geometry,&dirty) );
3433  return dirty != 0;
3434  }
3435 
3437  {
3438  return m_geometry;
3439  }
3440 
3441  inline void MaterialObj::destroy()
3442  {
3443  Context context = getContext();
3444  checkError( rtMaterialDestroy( m_material ), context );
3445  m_material = 0;
3446  }
3447 
3449  {
3450  checkError( rtMaterialValidate( m_material ) );
3451  }
3452 
3454  {
3455  RTcontext c;
3456  checkErrorNoGetContext( rtMaterialGetContext( m_material, &c ) );
3457  return Context::take( c );
3458  }
3459 
3460  inline void MaterialObj::setClosestHitProgram(unsigned int ray_type_index, Program program)
3461  {
3462  checkError( rtMaterialSetClosestHitProgram( m_material, ray_type_index, (program.get() != 0 ? program->get() : 0) ) );
3463  }
3464 
3465  inline Program MaterialObj::getClosestHitProgram(unsigned int ray_type_index) const
3466  {
3467  RTprogram result;
3468  checkError( rtMaterialGetClosestHitProgram( m_material, ray_type_index, &result ) );
3469  return Program::take( result );
3470  }
3471 
3472  inline void MaterialObj::setAnyHitProgram(unsigned int ray_type_index, Program program)
3473  {
3474  checkError( rtMaterialSetAnyHitProgram( m_material, ray_type_index, program->get() ) );
3475  }
3476 
3477  inline Program MaterialObj::getAnyHitProgram(unsigned int ray_type_index) const
3478  {
3479  RTprogram result;
3480  checkError( rtMaterialGetAnyHitProgram( m_material, ray_type_index, &result ) );
3481  return Program::take( result );
3482  }
3483 
3484  inline Variable MaterialObj::declareVariable(const std::string& name)
3485  {
3486  RTvariable v;
3487  checkError( rtMaterialDeclareVariable( m_material, name.c_str(), &v ) );
3488  return Variable::take( v );
3489  }
3490 
3491  inline Variable MaterialObj::queryVariable(const std::string& name) const
3492  {
3493  RTvariable v;
3494  checkError( rtMaterialQueryVariable( m_material, name.c_str(), &v) );
3495  return Variable::take( v );
3496  }
3497 
3499  {
3500  checkError( rtMaterialRemoveVariable( m_material, v->get() ) );
3501  }
3502 
3503  inline unsigned int MaterialObj::getVariableCount() const
3504  {
3505  unsigned int result;
3506  checkError( rtMaterialGetVariableCount( m_material, &result ) );
3507  return result;
3508  }
3509 
3510  inline Variable MaterialObj::getVariable(unsigned int index) const
3511  {
3512  RTvariable v;
3513  checkError( rtMaterialGetVariable( m_material, index, &v) );
3514  return Variable::take( v );
3515  }
3516 
3518  {
3519  return m_material;
3520  }
3521 
3523  {
3524  Context context = getContext();
3525  checkError( rtTextureSamplerDestroy( m_texturesampler ), context );
3526  m_texturesampler = 0;
3527  }
3528 
3530  {
3531  checkError( rtTextureSamplerValidate( m_texturesampler ) );
3532  }
3533 
3535  {
3536  RTcontext c;
3537  checkErrorNoGetContext( rtTextureSamplerGetContext( m_texturesampler, &c ) );
3538  return Context::take( c );
3539  }
3540 
3541  inline void TextureSamplerObj::setMipLevelCount(unsigned int num_mip_levels)
3542  {
3543  checkError( rtTextureSamplerSetMipLevelCount(m_texturesampler, num_mip_levels ) );
3544  }
3545 
3546  inline unsigned int TextureSamplerObj::getMipLevelCount() const
3547  {
3548  unsigned int result;
3549  checkError( rtTextureSamplerGetMipLevelCount( m_texturesampler, &result ) );
3550  return result;
3551  }
3552 
3553  inline void TextureSamplerObj::setArraySize(unsigned int num_textures_in_array)
3554  {
3555  checkError( rtTextureSamplerSetArraySize( m_texturesampler, num_textures_in_array ) );
3556  }
3557 
3558  inline unsigned int TextureSamplerObj::getArraySize() const
3559  {
3560  unsigned int result;
3561  checkError( rtTextureSamplerGetArraySize( m_texturesampler, &result ) );
3562  return result;
3563  }
3564 
3565  inline void TextureSamplerObj::setWrapMode(unsigned int dim, RTwrapmode wrapmode)
3566  {
3567  checkError( rtTextureSamplerSetWrapMode( m_texturesampler, dim, wrapmode ) );
3568  }
3569 
3570  inline RTwrapmode TextureSamplerObj::getWrapMode(unsigned int dim) const
3571  {
3572  RTwrapmode wrapmode;
3573  checkError( rtTextureSamplerGetWrapMode( m_texturesampler, dim, &wrapmode ) );
3574  return wrapmode;
3575  }
3576 
3577  inline void TextureSamplerObj::setFilteringModes(RTfiltermode minification, RTfiltermode magnification, RTfiltermode mipmapping)
3578  {
3579  checkError( rtTextureSamplerSetFilteringModes( m_texturesampler, minification, magnification, mipmapping ) );
3580  }
3581 
3582  inline void TextureSamplerObj::getFilteringModes(RTfiltermode& minification, RTfiltermode& magnification, RTfiltermode& mipmapping) const
3583  {
3584  checkError( rtTextureSamplerGetFilteringModes( m_texturesampler, &minification, &magnification, &mipmapping ) );
3585  }
3586 
3587  inline void TextureSamplerObj::setMaxAnisotropy(float value)
3588  {
3589  checkError( rtTextureSamplerSetMaxAnisotropy(m_texturesampler, value ) );
3590  }
3591 
3593  {
3594  float result;
3595  checkError( rtTextureSamplerGetMaxAnisotropy( m_texturesampler, &result) );
3596  return result;
3597  }
3598 
3599  inline void TextureSamplerObj::setMipLevelClamp(float minLevel, float maxLevel)
3600  {
3601  checkError( rtTextureSamplerSetMipLevelClamp(m_texturesampler, minLevel, maxLevel ) );
3602  }
3603 
3604  inline void TextureSamplerObj::getMipLevelClamp(float &minLevel, float &maxLevel) const
3605  {
3606  checkError( rtTextureSamplerGetMipLevelClamp( m_texturesampler, &minLevel, &maxLevel) );
3607  }
3608 
3609  inline void TextureSamplerObj::setMipLevelBias(float value)
3610  {
3611  checkError( rtTextureSamplerSetMipLevelBias(m_texturesampler, value ) );
3612  }
3613 
3615  {
3616  float result;
3617  checkError( rtTextureSamplerGetMipLevelBias( m_texturesampler, &result) );
3618  return result;
3619  }
3620 
3621  inline int TextureSamplerObj::getId() const
3622  {
3623  int result;
3624  checkError( rtTextureSamplerGetId( m_texturesampler, &result) );
3625  return result;
3626  }
3627 
3629  {
3630  checkError( rtTextureSamplerSetReadMode( m_texturesampler, readmode ) );
3631  }
3632 
3634  {
3635  RTtexturereadmode result;
3636  checkError( rtTextureSamplerGetReadMode( m_texturesampler, &result) );
3637  return result;
3638  }
3639 
3641  {
3642  checkError( rtTextureSamplerSetIndexingMode( m_texturesampler, indexmode ) );
3643  }
3644 
3646  {
3647  RTtextureindexmode result;
3648  checkError( rtTextureSamplerGetIndexingMode( m_texturesampler, &result ) );
3649  return result;
3650  }
3651 
3652  inline void TextureSamplerObj::setBuffer(unsigned int texture_array_idx, unsigned int mip_level, Buffer buffer)
3653  {
3654  checkError( rtTextureSamplerSetBuffer( m_texturesampler, texture_array_idx, mip_level, buffer->get() ) );
3655  }
3656 
3657  inline Buffer TextureSamplerObj::getBuffer(unsigned int texture_array_idx, unsigned int mip_level) const
3658  {
3659  RTbuffer result;
3660  checkError( rtTextureSamplerGetBuffer(m_texturesampler, texture_array_idx, mip_level, &result ) );
3661  return Buffer::take(result);
3662  }
3663 
3665  {
3666  checkError( rtTextureSamplerSetBuffer( m_texturesampler, 0, 0, buffer->get() ) );
3667  }
3668 
3670  {
3671  RTbuffer result;
3672  checkError( rtTextureSamplerGetBuffer(m_texturesampler, 0, 0, &result ) );
3673  return Buffer::take(result);
3674  }
3675 
3677  {
3678  return m_texturesampler;
3679  }
3680 
3682  {
3683  checkError( rtTextureSamplerGLRegister( m_texturesampler ) );
3684  }
3685 
3687  {
3688  checkError( rtTextureSamplerGLUnregister( m_texturesampler ) );
3689  }
3690 
3691 #ifdef _WIN32
3692 
3694  {
3695  checkError( rtTextureSamplerD3D9Register( m_texturesampler ) );
3696  }
3697 
3699  {
3700  checkError( rtTextureSamplerD3D10Register( m_texturesampler ) );
3701  }
3702 
3704  {
3705  checkError( rtTextureSamplerD3D11Register( m_texturesampler ) );
3706  }
3707 
3709  {
3710  checkError( rtTextureSamplerD3D9Unregister( m_texturesampler ) );
3711  }
3712 
3714  {
3715  checkError( rtTextureSamplerD3D10Unregister( m_texturesampler ) );
3716  }
3717 
3719  {
3720  checkError( rtTextureSamplerD3D11Unregister( m_texturesampler ) );
3721  }
3722 
3723 #endif
3724 
3725  inline void BufferObj::destroy()
3726  {
3727  Context context = getContext();
3728  checkError( rtBufferDestroy( m_buffer ), context );
3729  m_buffer = 0;
3730  }
3731 
3732  inline void BufferObj::validate()
3733  {
3734  checkError( rtBufferValidate( m_buffer ) );
3735  }
3736 
3738  {
3739  RTcontext c;
3740  checkErrorNoGetContext( rtBufferGetContext( m_buffer, &c ) );
3741  return Context::take( c );
3742  }
3743 
3744  inline void BufferObj::setFormat(RTformat format)
3745  {
3746  checkError( rtBufferSetFormat( m_buffer, format ) );
3747  }
3748 
3750  {
3751  RTformat result;
3752  checkError( rtBufferGetFormat( m_buffer, &result ) );
3753  return result;
3754  }
3755 
3756  inline void BufferObj::setElementSize(RTsize size_of_element)
3757  {
3758  checkError( rtBufferSetElementSize ( m_buffer, size_of_element ) );
3759  }
3760 
3761  inline RTsize BufferObj::getElementSize() const
3762  {
3763  RTsize result;
3764  checkError( rtBufferGetElementSize ( m_buffer, &result) );
3765  return result;
3766  }
3767 
3768  inline void BufferObj::getDevicePointer(unsigned int optix_device_number, CUdeviceptr *device_pointer)
3769  {
3770  checkError( rtBufferGetDevicePointer( m_buffer, optix_device_number, (void**)device_pointer ) );
3771  }
3772 
3773  inline CUdeviceptr BufferObj::getDevicePointer( unsigned int optix_device_number )
3774  {
3775  CUdeviceptr dptr;
3776  getDevicePointer( optix_device_number, &dptr );
3777  return dptr;
3778  }
3779 
3780  inline void BufferObj::setDevicePointer(unsigned int optix_device_number, CUdeviceptr device_pointer)
3781  {
3782  checkError( rtBufferSetDevicePointer( m_buffer, optix_device_number, device_pointer ) );
3783  }
3784 
3785  inline void BufferObj::markDirty()
3786  {
3787  checkError( rtBufferMarkDirty( m_buffer ) );
3788  }
3789 
3790  inline void BufferObj::setSize(RTsize width)
3791  {
3792  checkError( rtBufferSetSize1D( m_buffer, width ) );
3793  }
3794 
3795  inline void BufferObj::getSize(RTsize& width) const
3796  {
3797  checkError( rtBufferGetSize1D( m_buffer, &width ) );
3798  }
3799 
3800  inline void BufferObj::getMipLevelSize(unsigned int level, RTsize& width) const
3801  {
3802  checkError( rtBufferGetMipLevelSize1D( m_buffer, level, &width ) );
3803  }
3804 
3805  inline void BufferObj::setSize(RTsize width, RTsize height)
3806  {
3807  checkError( rtBufferSetSize2D( m_buffer, width, height ) );
3808  }
3809 
3810  inline void BufferObj::getSize(RTsize& width, RTsize& height) const
3811  {
3812  checkError( rtBufferGetSize2D( m_buffer, &width, &height ) );
3813  }
3814 
3815  inline void BufferObj::getMipLevelSize(unsigned int level, RTsize& width, RTsize& height) const
3816  {
3817  checkError( rtBufferGetMipLevelSize2D( m_buffer, level, &width, &height ) );
3818  }
3819 
3820  inline void BufferObj::setSize(RTsize width, RTsize height, RTsize depth)
3821  {
3822  checkError( rtBufferSetSize3D( m_buffer, width, height, depth ) );
3823  }
3824 
3825  inline void BufferObj::getSize(RTsize& width, RTsize& height, RTsize& depth) const
3826  {
3827  checkError( rtBufferGetSize3D( m_buffer, &width, &height, &depth ) );
3828  }
3829 
3830  inline void BufferObj::getMipLevelSize(unsigned int level, RTsize& width, RTsize& height, RTsize& depth) const
3831  {
3832  checkError( rtBufferGetMipLevelSize3D( m_buffer, level, &width, &height, &depth ) );
3833  }
3834 
3835  inline void BufferObj::setSize(unsigned int dimensionality, const RTsize* dims)
3836  {
3837  checkError( rtBufferSetSizev( m_buffer, dimensionality, dims ) );
3838  }
3839 
3840  inline void BufferObj::getSize(unsigned int dimensionality, RTsize* dims) const
3841  {
3842  checkError( rtBufferGetSizev( m_buffer, dimensionality, dims ) );
3843  }
3844 
3845  inline unsigned int BufferObj::getDimensionality() const
3846  {
3847  unsigned int result;
3848  checkError( rtBufferGetDimensionality( m_buffer, &result ) );
3849  return result;
3850  }
3851 
3852  inline void BufferObj::setMipLevelCount(unsigned int levels)
3853  {
3854  checkError( rtBufferSetMipLevelCount( m_buffer, levels ) );
3855  }
3856 
3857  inline unsigned int BufferObj::getMipLevelCount() const
3858  {
3859  unsigned int result;
3860  checkError( rtBufferGetMipLevelCount( m_buffer, &result ) );
3861  return result;
3862  }
3863 
3864  inline int BufferObj::getId() const
3865  {
3866  int result;
3867  checkError( rtBufferGetId( m_buffer, &result ) );
3868  return result;
3869  }
3870 
3871  inline unsigned int BufferObj::getGLBOId() const
3872  {
3873  unsigned int result;
3874  checkError( rtBufferGetGLBOId( m_buffer, &result ) );
3875  return result;
3876  }
3877 
3879  {
3880  checkError( rtBufferGLRegister( m_buffer ) );
3881  }
3882 
3884  {
3885  checkError( rtBufferGLUnregister( m_buffer ) );
3886  }
3887 
3888 #ifdef _WIN32
3889 
3891  {
3892  checkError( rtBufferD3D9Register( m_buffer ) );
3893  }
3894 
3896  {
3897  checkError( rtBufferD3D10Register( m_buffer ) );
3898  }
3899 
3901  {
3902  checkError( rtBufferD3D11Register( m_buffer ) );
3903  }
3904 
3906  {
3907  checkError( rtBufferD3D9Unregister( m_buffer ) );
3908  }
3909 
3911  {
3912  checkError( rtBufferD3D10Unregister( m_buffer ) );
3913  }
3914 
3916  {
3917  checkError( rtBufferD3D11Unregister( m_buffer ) );
3918  }
3919 
3921  {
3922  IDirect3DResource9* result = NULL;
3923  checkError( rtBufferGetD3D9Resource( m_buffer, &result ) );
3924  return result;
3925  }
3926 
3927  inline ID3D10Resource* BufferObj::getD3D10Resource()
3928  {
3929  ID3D10Resource* result = NULL;
3930  checkError( rtBufferGetD3D10Resource( m_buffer, &result ) );
3931  return result;
3932  }
3933 
3934  inline ID3D11Resource* BufferObj::getD3D11Resource()
3935  {
3936  ID3D11Resource* result = NULL;
3937  checkError( rtBufferGetD3D11Resource( m_buffer, &result ) );
3938  return result;
3939  }
3940 
3941 #endif
3942 
3943  inline void* BufferObj::map()
3944  {
3945  void* result;
3946  checkError( rtBufferMap( m_buffer, &result ) );
3947  return result;
3948  }
3949 
3950  inline void BufferObj::unmap()
3951  {
3952  checkError( rtBufferUnmap( m_buffer ) );
3953  }
3954 
3955  inline void* BufferObj::map(unsigned int level)
3956  {
3957  void* result;
3958  checkError( rtBufferMapEx( m_buffer, RT_BUFFER_MAP_READ_WRITE, level, 0, &result ) );
3959  return result;
3960  }
3961 
3962  inline void BufferObj::unmap(unsigned int level)
3963  {
3964  checkError( rtBufferUnmapEx( m_buffer, level ) );
3965  }
3966 
3968  {
3969  checkError( rtBufferBindProgressiveStream( m_buffer, source->get() ) );
3970  }
3971 
3972  inline void BufferObj::getProgressiveUpdateReady( int* ready, unsigned int* subframe_count, unsigned int* max_subframes )
3973  {
3974  checkError( rtBufferGetProgressiveUpdateReady( m_buffer, ready, subframe_count, max_subframes ) );
3975  }
3976 
3978  {
3979  return m_buffer;
3980  }
3981 
3982  inline void BufferObj::setAttribute( RTbufferattribute attrib, RTsize size, void *p )
3983  {
3984  checkError( rtBufferSetAttribute( m_buffer, attrib, size, p ) );
3985  }
3986 
3987  inline void BufferObj::getAttribute( RTbufferattribute attrib, RTsize size, void *p )
3988  {
3989  checkError( rtBufferGetAttribute( m_buffer, attrib, size, p ) );
3990  }
3991 
3992  inline RemoteDevice RemoteDeviceObj::create( const std::string& url, const std::string& username, const std::string& password )
3993  {
3994  RTremotedevice rdev;
3995  if ( RTresult code = rtRemoteDeviceCreate( url.c_str(), username.c_str(), password.c_str(), &rdev) )
3996  throw Exception::makeException( code, 0 );
3997 
3998  return RemoteDevice::take(rdev);
3999  }
4000 
4001 
4002  inline Context RemoteDeviceObj::getContext() const
4003  {
4004  RTcontext ctx = 0;
4005  return Context::take( ctx );
4006  }
4007 
4008  inline void RemoteDeviceObj::destroy()
4009  {
4010  checkErrorNoGetContext( rtRemoteDeviceDestroy( m_rdev ) );
4011  m_rdev = 0;
4012  }
4013 
4014  inline void RemoteDeviceObj::reserve( unsigned int num_nodes, unsigned int configuration_idx )
4015  {
4016  checkErrorNoGetContext( rtRemoteDeviceReserve( m_rdev, num_nodes, configuration_idx ) );
4017  }
4018 
4019  inline void RemoteDeviceObj::release()
4020  {
4021  checkErrorNoGetContext( rtRemoteDeviceRelease( m_rdev ) );
4022  }
4023 
4024  inline void RemoteDeviceObj::getAttribute( RTremotedeviceattribute attrib, RTsize size, void *p )
4025  {
4026  checkErrorNoGetContext( rtRemoteDeviceGetAttribute( m_rdev, attrib, size, p ) );
4027  }
4028 
4029  inline std::string RemoteDeviceObj::getConfiguration( unsigned int config_index )
4030  {
4031  char tmp[256];
4032  checkErrorNoGetContext( rtRemoteDeviceGetAttribute( m_rdev, (RTremotedeviceattribute)(RT_REMOTEDEVICE_ATTRIBUTE_CONFIGURATIONS+config_index), 256, tmp ) );
4033  return std::string( tmp );
4034  }
4035 
4037  {
4038  return m_rdev;
4039  }
4040 
4042  {
4043  RTcontext c;
4044  checkErrorNoGetContext( rtVariableGetContext( m_variable, &c ) );
4045  return Context::take( c );
4046  }
4047 
4048  inline void VariableObj::setUint(unsigned int u1)
4049  {
4050  checkError( rtVariableSet1ui( m_variable, u1 ) );
4051  }
4052 
4053  inline void VariableObj::setUint(unsigned int u1, unsigned int u2)
4054  {
4055  checkError( rtVariableSet2ui( m_variable, u1, u2 ) );
4056  }
4057 
4058  inline void VariableObj::setUint(unsigned int u1, unsigned int u2, unsigned int u3)
4059  {
4060  checkError( rtVariableSet3ui( m_variable, u1, u2, u3 ) );
4061  }
4062 
4063  inline void VariableObj::setUint(unsigned int u1, unsigned int u2, unsigned int u3, unsigned int u4)
4064  {
4065  checkError( rtVariableSet4ui( m_variable, u1, u2, u3, u4 ) );
4066  }
4067 
4068  inline void VariableObj::setUint(optix::uint2 u)
4069  {
4070  checkError( rtVariableSet2uiv( m_variable, &u.x ) );
4071  }
4072 
4073  inline void VariableObj::setUint(optix::uint3 u)
4074  {
4075  checkError( rtVariableSet3uiv( m_variable, &u.x ) );
4076  }
4077 
4078  inline void VariableObj::setUint(optix::uint4 u)
4079  {
4080  checkError( rtVariableSet4uiv( m_variable, &u.x ) );
4081  }
4082 
4083  inline void VariableObj::set1uiv(const unsigned int* u)
4084  {
4085  checkError( rtVariableSet1uiv( m_variable, u ) );
4086  }
4087 
4088  inline void VariableObj::set2uiv(const unsigned int* u)
4089  {
4090  checkError( rtVariableSet2uiv( m_variable, u ) );
4091  }
4092 
4093  inline void VariableObj::set3uiv(const unsigned int* u)
4094  {
4095  checkError( rtVariableSet3uiv( m_variable, u ) );
4096  }
4097 
4098  inline void VariableObj::set4uiv(const unsigned int* u)
4099  {
4100  checkError( rtVariableSet4uiv( m_variable, u ) );
4101  }
4102 
4103  inline void VariableObj::setMatrix2x2fv(bool transpose, const float* m)
4104  {
4105  checkError( rtVariableSetMatrix2x2fv( m_variable, (int)transpose, m ) );
4106  }
4107 
4108  inline void VariableObj::setMatrix2x3fv(bool transpose, const float* m)
4109  {
4110  checkError( rtVariableSetMatrix2x3fv( m_variable, (int)transpose, m ) );
4111  }
4112 
4113  inline void VariableObj::setMatrix2x4fv(bool transpose, const float* m)
4114  {
4115  checkError( rtVariableSetMatrix2x4fv( m_variable, (int)transpose, m ) );
4116  }
4117 
4118  inline void VariableObj::setMatrix3x2fv(bool transpose, const float* m)
4119  {
4120  checkError( rtVariableSetMatrix3x2fv( m_variable, (int)transpose, m ) );
4121  }
4122 
4123  inline void VariableObj::setMatrix3x3fv(bool transpose, const float* m)
4124  {
4125  checkError( rtVariableSetMatrix3x3fv( m_variable, (int)transpose, m ) );
4126  }
4127 
4128  inline void VariableObj::setMatrix3x4fv(bool transpose, const float* m)
4129  {
4130  checkError( rtVariableSetMatrix3x4fv( m_variable, (int)transpose, m ) );
4131  }
4132 
4133  inline void VariableObj::setMatrix4x2fv(bool transpose, const float* m)
4134  {
4135  checkError( rtVariableSetMatrix4x2fv( m_variable, (int)transpose, m ) );
4136  }
4137 
4138  inline void VariableObj::setMatrix4x3fv(bool transpose, const float* m)
4139  {
4140  checkError( rtVariableSetMatrix4x3fv( m_variable, (int)transpose, m ) );
4141  }
4142 
4143  inline void VariableObj::setMatrix4x4fv(bool transpose, const float* m)
4144  {
4145  checkError( rtVariableSetMatrix4x4fv( m_variable, (int)transpose, m ) );
4146  }
4147 
4148  inline void VariableObj::setFloat(float f1)
4149  {
4150  checkError( rtVariableSet1f( m_variable, f1 ) );
4151  }
4152 
4153  inline void VariableObj::setFloat(optix::float2 f)
4154  {
4155  checkError( rtVariableSet2fv( m_variable, &f.x ) );
4156  }
4157 
4158  inline void VariableObj::setFloat(float f1, float f2)
4159  {
4160  checkError( rtVariableSet2f( m_variable, f1, f2 ) );
4161  }
4162 
4163  inline void VariableObj::setFloat(optix::float3 f)
4164  {
4165  checkError( rtVariableSet3fv( m_variable, &f.x ) );
4166  }
4167 
4168  inline void VariableObj::setFloat(float f1, float f2, float f3)
4169  {
4170  checkError( rtVariableSet3f( m_variable, f1, f2, f3 ) );
4171  }
4172 
4173  inline void VariableObj::setFloat(optix::float4 f)
4174  {
4175  checkError( rtVariableSet4fv( m_variable, &f.x ) );
4176  }
4177 
4178  inline void VariableObj::setFloat(float f1, float f2, float f3, float f4)
4179  {
4180  checkError( rtVariableSet4f( m_variable, f1, f2, f3, f4 ) );
4181  }
4182 
4183  inline void VariableObj::set1fv(const float* f)
4184  {
4185  checkError( rtVariableSet1fv( m_variable, f ) );
4186  }
4187 
4188  inline void VariableObj::set2fv(const float* f)
4189  {
4190  checkError( rtVariableSet2fv( m_variable, f ) );
4191  }
4192 
4193  inline void VariableObj::set3fv(const float* f)
4194  {
4195  checkError( rtVariableSet3fv( m_variable, f ) );
4196  }
4197 
4198  inline void VariableObj::set4fv(const float* f)
4199  {
4200  checkError( rtVariableSet4fv( m_variable, f ) );
4201  }
4202 
4204  inline void VariableObj::setInt(int i1)
4205  {
4206  checkError( rtVariableSet1i( m_variable, i1 ) );
4207  }
4208 
4209  inline void VariableObj::setInt(optix::int2 i)
4210  {
4211  checkError( rtVariableSet2iv( m_variable, &i.x ) );
4212  }
4213 
4214  inline void VariableObj::setInt(int i1, int i2)
4215  {
4216  checkError( rtVariableSet2i( m_variable, i1, i2 ) );
4217  }
4218 
4219  inline void VariableObj::setInt(optix::int3 i)
4220  {
4221  checkError( rtVariableSet3iv( m_variable, &i.x ) );
4222  }
4223 
4224  inline void VariableObj::setInt(int i1, int i2, int i3)
4225  {
4226  checkError( rtVariableSet3i( m_variable, i1, i2, i3 ) );
4227  }
4228 
4229  inline void VariableObj::setInt(optix::int4 i)
4230  {
4231  checkError( rtVariableSet4iv( m_variable, &i.x ) );
4232  }
4233 
4234  inline void VariableObj::setInt(int i1, int i2, int i3, int i4)
4235  {
4236  checkError( rtVariableSet4i( m_variable, i1, i2, i3, i4 ) );
4237  }
4238 
4239  inline void VariableObj::set1iv( const int* i )
4240  {
4241  checkError( rtVariableSet1iv( m_variable, i ) );
4242  }
4243 
4244  inline void VariableObj::set2iv( const int* i )
4245  {
4246  checkError( rtVariableSet2iv( m_variable, i ) );
4247  }
4248 
4249  inline void VariableObj::set3iv( const int* i )
4250  {
4251  checkError( rtVariableSet3iv( m_variable, i ) );
4252  }
4253 
4254  inline void VariableObj::set4iv( const int* i )
4255  {
4256  checkError( rtVariableSet4iv( m_variable, i ) );
4257  }
4258 
4259  inline void VariableObj::setBuffer(Buffer buffer)
4260  {
4261  checkError( rtVariableSetObject( m_variable, buffer->get() ) );
4262  }
4263 
4264  inline void VariableObj::set(Buffer buffer)
4265  {
4266  checkError( rtVariableSetObject( m_variable, buffer->get() ) );
4267  }
4268 
4269  inline void VariableObj::setUserData(RTsize size, const void* ptr)
4270  {
4271  checkError( rtVariableSetUserData( m_variable, size, ptr ) );
4272  }
4273 
4274  inline void VariableObj::getUserData(RTsize size, void* ptr) const
4275  {
4276  checkError( rtVariableGetUserData( m_variable, size, ptr ) );
4277  }
4278 
4279  inline void VariableObj::setTextureSampler(TextureSampler texturesampler)
4280  {
4281  checkError( rtVariableSetObject( m_variable, texturesampler->get() ) );
4282  }
4283 
4284  inline void VariableObj::set(TextureSampler texturesampler)
4285  {
4286  checkError( rtVariableSetObject( m_variable, texturesampler->get() ) );
4287  }
4288 
4289  inline void VariableObj::set(GeometryGroup group)
4290  {
4291  checkError( rtVariableSetObject( m_variable, group->get() ) );
4292  }
4293 
4294  inline void VariableObj::set(Group group)
4295  {
4296  checkError( rtVariableSetObject( m_variable, group->get() ) );
4297  }
4298 
4299  inline void VariableObj::set(Program program)
4300  {
4301  checkError( rtVariableSetObject( m_variable, program->get() ) );
4302  }
4303 
4304  inline void VariableObj::setProgramId(Program program)
4305  {
4306  int id = program->getId();
4307  setInt(id);
4308  }
4309 
4310  inline void VariableObj::set(Selector sel)
4311  {
4312  checkError( rtVariableSetObject( m_variable, sel->get() ) );
4313  }
4314 
4315  inline void VariableObj::set(Transform tran)
4316  {
4317  checkError( rtVariableSetObject( m_variable, tran->get() ) );
4318  }
4319 
4320  inline Buffer VariableObj::getBuffer() const
4321  {
4322  RTobject temp;
4323  checkError( rtVariableGetObject( m_variable, &temp ) );
4324  RTbuffer buffer = reinterpret_cast<RTbuffer>(temp);
4325  return Buffer::take(buffer);
4326  }
4327 
4328  inline std::string VariableObj::getName() const
4329  {
4330  const char* name;
4331  checkError( rtVariableGetName( m_variable, &name ) );
4332  return std::string(name);
4333  }
4334 
4335  inline std::string VariableObj::getAnnotation() const
4336  {
4337  const char* annotation;
4338  checkError( rtVariableGetAnnotation( m_variable, &annotation ) );
4339  return std::string(annotation);
4340  }
4341 
4343  {
4344  RTobjecttype type;
4345  checkError( rtVariableGetType( m_variable, &type ) );
4346  return type;
4347  }
4348 
4350  {
4351  return m_variable;
4352  }
4353 
4354  inline RTsize VariableObj::getSize() const
4355  {
4356  RTsize size;
4357  checkError( rtVariableGetSize( m_variable, &size ) );
4358  return size;
4359  }
4360 
4361  inline optix::GeometryGroup VariableObj::getGeometryGroup() const
4362  {
4363  RTobject temp;
4364  checkError( rtVariableGetObject( m_variable, &temp ) );
4365  RTgeometrygroup geometrygroup = reinterpret_cast<RTgeometrygroup>(temp);
4366  return GeometryGroup::take( geometrygroup );
4367  }
4368 
4369  inline optix::GeometryInstance VariableObj::getGeometryInstance() const
4370  {
4371  RTobject temp;
4372  checkError( rtVariableGetObject( m_variable, &temp ) );
4373  RTgeometryinstance geometryinstance =
4374  reinterpret_cast<RTgeometryinstance>(temp);
4375  return GeometryInstance::take( geometryinstance );
4376  }
4377 
4378  inline optix::Group VariableObj::getGroup() const
4379  {
4380  RTobject temp;
4381  checkError( rtVariableGetObject( m_variable, &temp ) );
4382  RTgroup group = reinterpret_cast<RTgroup>(temp);
4383  return Group::take( group );
4384  }
4385 
4386  inline optix::Program VariableObj::getProgram() const
4387  {
4388  RTobject temp;
4389  checkError( rtVariableGetObject( m_variable, &temp ) );
4390  RTprogram program = reinterpret_cast<RTprogram>(temp);
4391  return Program::take(program);
4392  }
4393 
4394  inline optix::Selector VariableObj::getSelector() const
4395  {
4396  RTobject temp;
4397  checkError( rtVariableGetObject( m_variable, &temp ) );
4398  RTselector selector = reinterpret_cast<RTselector>(temp);
4399  return Selector::take( selector );
4400  }
4401 
4402  inline optix::TextureSampler VariableObj::getTextureSampler() const
4403  {
4404  RTobject temp;
4405  checkError( rtVariableGetObject( m_variable, &temp ) );
4406  RTtexturesampler sampler = reinterpret_cast<RTtexturesampler>(temp);
4407  return TextureSampler::take(sampler);
4408  }
4409 
4410  inline optix::Transform VariableObj::getTransform() const
4411  {
4412  RTobject temp;
4413  checkError( rtVariableGetObject( m_variable, &temp ) );
4414  RTtransform transform = reinterpret_cast<RTtransform>(temp);
4415  return Transform::take( transform );
4416  }
4417 
4418  inline float VariableObj::getFloat() const
4419  {
4420  float f;
4421  checkError( rtVariableGet1f( m_variable, &f ) );
4422  return f;
4423  }
4424 
4425  inline optix::float2 VariableObj::getFloat2() const
4426  {
4427  optix::float2 f;
4428  checkError( rtVariableGet2f( m_variable, &f.x, &f.y ) );
4429  return f;
4430 
4431  }
4432 
4433  inline optix::float3 VariableObj::getFloat3() const
4434  {
4435  optix::float3 f;
4436  checkError( rtVariableGet3f( m_variable, &f.x, &f.y, &f.z ) );
4437  return f;
4438  }
4439 
4440  inline optix::float4 VariableObj::getFloat4() const
4441  {
4442  optix::float4 f;
4443  checkError( rtVariableGet4f( m_variable, &f.x, &f.y, &f.z, &f.w ) );
4444  return f;
4445  }
4446 
4447  inline void VariableObj::getFloat(float& f1) const
4448  {
4449  checkError( rtVariableGet1f( m_variable, &f1 ) );
4450  }
4451 
4452  inline void VariableObj::getFloat(float& f1, float& f2) const
4453  {
4454  checkError( rtVariableGet2f( m_variable, &f1, &f2 ) );
4455  }
4456 
4457  inline void VariableObj::getFloat(float& f1, float& f2, float& f3) const
4458  {
4459  checkError( rtVariableGet3f( m_variable, &f1, &f2, &f3 ) );
4460  }
4461 
4462  inline void VariableObj::getFloat(float& f1, float& f2, float& f3,
4463  float& f4) const
4464  {
4465  checkError( rtVariableGet4f( m_variable, &f1, &f2, &f3, &f4 ) );
4466  }
4467 
4468 
4469  inline unsigned VariableObj::getUint() const
4470  {
4471  unsigned u;
4472  checkError( rtVariableGet1ui( m_variable, &u ) );
4473  return u;
4474  }
4475 
4476  inline optix::uint2 VariableObj::getUint2() const
4477  {
4478  optix::uint2 u;
4479  checkError( rtVariableGet2ui( m_variable, &u.x, &u.y ) );
4480  return u;
4481  }
4482 
4483  inline optix::uint3 VariableObj::getUint3() const
4484  {
4485  optix::uint3 u;
4486  checkError( rtVariableGet3ui( m_variable, &u.x, &u.y, &u.z ) );
4487  return u;
4488  }
4489 
4490  inline optix::uint4 VariableObj::getUint4() const
4491  {
4492  optix::uint4 u;
4493  checkError( rtVariableGet4ui( m_variable, &u.x, &u.y, &u.z, &u.w ) );
4494  return u;
4495  }
4496 
4497  inline void VariableObj::getUint(unsigned& u1) const
4498  {
4499  checkError( rtVariableGet1ui( m_variable, &u1 ) );
4500  }
4501 
4502  inline void VariableObj::getUint(unsigned& u1, unsigned& u2) const
4503  {
4504  checkError( rtVariableGet2ui( m_variable, &u1, &u2 ) );
4505  }
4506 
4507  inline void VariableObj::getUint(unsigned& u1, unsigned& u2, unsigned& u3) const
4508  {
4509  checkError( rtVariableGet3ui( m_variable, &u1, &u2, &u3 ) );
4510  }
4511 
4512  inline void VariableObj::getUint(unsigned& u1, unsigned& u2, unsigned& u3,
4513  unsigned& u4) const
4514  {
4515  checkError( rtVariableGet4ui( m_variable, &u1, &u2, &u3, &u4 ) );
4516  }
4517 
4518  inline int VariableObj::getInt() const
4519  {
4520  int i;
4521  checkError( rtVariableGet1i( m_variable, &i ) );
4522  return i;
4523  }
4524 
4525  inline optix::int2 VariableObj::getInt2() const
4526  {
4527  optix::int2 i;
4528  checkError( rtVariableGet2i( m_variable, &i.x, &i.y ) );
4529  return i;
4530  }
4531 
4532  inline optix::int3 VariableObj::getInt3() const
4533  {
4534  optix::int3 i;
4535  checkError( rtVariableGet3i( m_variable, &i.x, &i.y, &i.z ) );
4536  return i;
4537  }
4538 
4539  inline optix::int4 VariableObj::getInt4() const
4540  {
4541  optix::int4 i;
4542  checkError( rtVariableGet4i( m_variable, &i.x, &i.y, &i.z, &i.w ) );
4543  return i;
4544  }
4545 
4546  inline void VariableObj::getInt(int& i1) const
4547  {
4548  checkError( rtVariableGet1i( m_variable, &i1 ) );
4549  }
4550 
4551  inline void VariableObj::getInt(int& i1, int& i2) const
4552  {
4553  checkError( rtVariableGet2i( m_variable, &i1, &i2 ) );
4554  }
4555 
4556  inline void VariableObj::getInt(int& i1, int& i2, int& i3) const
4557  {
4558  checkError( rtVariableGet3i( m_variable, &i1, &i2, &i3 ) );
4559  }
4560 
4561  inline void VariableObj::getInt(int& i1, int& i2, int& i3, int& i4) const
4562  {
4563  checkError( rtVariableGet4i( m_variable, &i1, &i2, &i3, &i4 ) );
4564  }
4565 
4566  inline void VariableObj::getMatrix2x2(bool transpose, float* m) const
4567  {
4568  checkError( rtVariableGetMatrix2x2fv( m_variable, transpose, m ) );
4569  }
4570 
4571  inline void VariableObj::getMatrix2x3(bool transpose, float* m) const
4572  {
4573  checkError( rtVariableGetMatrix2x3fv( m_variable, transpose, m ) );
4574  }
4575 
4576  inline void VariableObj::getMatrix2x4(bool transpose, float* m) const
4577  {
4578  checkError( rtVariableGetMatrix2x4fv( m_variable, transpose, m ) );
4579  }
4580 
4581  inline void VariableObj::getMatrix3x2(bool transpose, float* m) const
4582  {
4583  checkError( rtVariableGetMatrix3x2fv( m_variable, transpose, m ) );
4584  }
4585 
4586  inline void VariableObj::getMatrix3x3(bool transpose, float* m) const
4587  {
4588  checkError( rtVariableGetMatrix3x3fv( m_variable, transpose, m ) );
4589  }
4590 
4591  inline void VariableObj::getMatrix3x4(bool transpose, float* m) const
4592  {
4593  checkError( rtVariableGetMatrix3x4fv( m_variable, transpose, m ) );
4594  }
4595 
4596  inline void VariableObj::getMatrix4x2(bool transpose, float* m) const
4597  {
4598  checkError( rtVariableGetMatrix4x2fv( m_variable, transpose, m ) );
4599  }
4600 
4601  inline void VariableObj::getMatrix4x3(bool transpose, float* m) const
4602  {
4603  checkError( rtVariableGetMatrix4x3fv( m_variable, transpose, m ) );
4604  }
4605 
4606  inline void VariableObj::getMatrix4x4(bool transpose, float* m) const
4607  {
4608  checkError( rtVariableGetMatrix4x4fv( m_variable, transpose, m ) );
4609  }
4610 }
4611 
4612 #endif /* __optixu_optixpp_namespace_h__ */
RTresult RTAPI rtVariableGetMatrix2x2fv(RTvariable v, int transpose, float *m)
RTresult RTAPI rtGeometryGroupGetChild(RTgeometrygroup geometrygroup, unsigned int index, RTgeometryinstance *geometryinstance)
Returns a child node of a geometry group.
RTexception
Definition: optix_declarations.h:220
unsigned int addChild(GeometryInstance child)
Set a new child in this group and return its new index. See rtGeometryGroupSetChild.
Definition: optixpp_namespace.h:3022
RTresult RTAPI rtSelectorSetChild(RTselector selector, unsigned int index, RTobject child)
Attaches a child node to a Selector node.
void setData(const void *data, RTsize size)
Specify the acceleration structure via marshalled acceleration data. See rtAccelerationSetData.
Definition: optixpp_namespace.h:3212
RTresult RTAPI rtContextLaunch3D(RTcontext context, unsigned int entry_point_index, RTsize image_width, RTsize image_height, RTsize image_depth)
RTresult RTAPI rtContextGetDevices(RTcontext context, int *devices)
Retrieve a list of hardware devices being used by the kernel.
RTresult RTAPI rtTransformGetChildType(RTtransform transform, RTobjecttype *type)
Returns type information about a Transform child node.
RTtextureindexmode
Definition: optix_declarations.h:186
Program createProgramFromPTXFile(const std::string &ptx, const std::string &program_name)
See rtProgramCreateFromPTXFile.
Definition: optixpp_namespace.h:2295
RTresult RTAPI rtVariableSet3ui(RTvariable v, unsigned int u1, unsigned int u2, unsigned int u3)
struct RTvariable_api * RTvariable
Definition: optix_host.h:102
RTresult RTAPI rtSelectorGetVariable(RTselector selector, unsigned int index, RTvariable *v)
Returns a variable associated with a Selector node.
Variable declareVariable(const std::string &name)
Definition: optixpp_namespace.h:3286
RTresult RTAPI rtSelectorGetVariableCount(RTselector selector, unsigned int *count)
Returns the number of variables attached to a Selector node.
Definition: optix_declarations.h:206
IDirect3DResource9 * getD3D9Resource()
Queries the D3D9 resource associated with this buffer. See rtBufferGetD3D9Resource.
Definition: optixpp_namespace.h:3920
RTresult RTAPI rtContextGetPrintLaunchIndex(RTcontext context, int *x, int *y, int *z)
Gets the active print launch index.
void setStackSize(RTsize stack_size_bytes)
Definition: optixpp_namespace.h:2413
RTresult RTAPI rtVariableGet2i(RTvariable v, int *i1, int *i2)
RTresult RTAPI rtTextureSamplerCreateFromD3D10Resource(RTcontext context, ID3D10Resource *resource, RTtexturesampler *textureSampler)
Creates a new texture sampler object from a D3D10 resource.
unsigned int removeChild(GeometryInstance child)
Definition: optixpp_namespace.h:3031
RTresult RTAPI rtContextGetBufferFromId(RTcontext context, int buffer_id, RTbuffer *buffer)
Gets an RTbuffer corresponding to the buffer id.
RTresult RTAPI rtVariableGetMatrix3x2fv(RTvariable v, int transpose, float *m)
RTresult RTAPI rtGeometryInstanceCreate(RTcontext context, RTgeometryinstance *geometryinstance)
Creates a new geometry instance node.
RTresult RTAPI rtTextureSamplerD3D11Unregister(RTtexturesampler textureSampler)
Declares a D3D11 texture as mutable and inaccessible by OptiX.
RTresult RTAPI rtGroupGetContext(RTgroup group, RTcontext *context)
Returns the context associated with a group.
RTresult RTAPI rtDeviceGetAttribute(int ordinal, RTdeviceattribute attrib, RTsize size, void *p)
Returns an attribute specific to an OptiX device.
RTresult
Definition: optix_declarations.h:236
RTresult RTAPI rtGeometryInstanceSetMaterial(RTgeometryinstance geometryinstance, unsigned int index, RTmaterial material)
Sets a material.
RTresult RTAPI rtVariableSetUserData(RTvariable v, RTsize size, const void *ptr)
Defined.
RTsize getElementSize() const
Query the data element size for user format buffers. See rtBufferGetElementSize.
Definition: optixpp_namespace.h:3761
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:2708
Handle(T *ptr)
Takes a raw pointer to an API object and creates a handle.
Definition: optixpp_namespace.h:98
void markDirty()
Definition: optixpp_namespace.h:3424
RTresult RTAPI rtMaterialGetClosestHitProgram(RTmaterial material, unsigned int ray_type_index, RTprogram *program)
Returns the closest hit program associated with a (material, ray type) tuple.
void getDevicePointer(unsigned int optix_device_number, CUdeviceptr *device_pointer)
Get the pointer to buffer memory on a specific device. See rtBufferGetDevicePointer.
Definition: optixpp_namespace.h:3768
RTresult RTAPI rtBufferD3D9Unregister(RTbuffer buffer)
Declares a D3D9 buffer as mutable and inaccessible by OptiX.
void removeVariable(Variable v)
Remove a variable associated with this object.
Definition: optixpp_namespace.h:3405
Definition: optix_device.h:417
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:4041
unsigned int getArraySize() const
Deprecated in OptiX 4.0 Query the texture array size for this sampler. See rtTextureSamplerGetArraySi...
Definition: optixpp_namespace.h:3558
void setDevices(Iterator begin, Iterator end)
Definition: optixpp_namespace.h:2331
TextureSampler wraps the OptiX C API RTtexturesampler opaque type and its associated function set...
Definition: optixpp_namespace.h:1414
void registerD3D10Texture()
Declare the texture's buffer as immutable and accessible by OptiX. See rtTextureSamplerD3D10Register...
Definition: optixpp_namespace.h:3698
RTresult RTAPI rtBufferSetSize1D(RTbuffer buffer, RTsize width)
Sets the width and dimensionality of this buffer.
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:2625
Buffer createCubeBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, unsigned int levels)
Definition: optixpp_namespace.h:2052
RTresult RTAPI rtGroupGetChild(RTgroup group, unsigned int index, RTobject *child)
Returns a child node of a group.
RTresult RTAPI rtProgramGetId(RTprogram program, int *program_id)
Returns the ID for the Program object.
void setMaterialCount(unsigned int count)
Set the number of materials associated with this instance. See rtGeometryInstanceSetMaterialCount.
Definition: optixpp_namespace.h:3253
int getMaxTextureCount() const
Definition: optixpp_namespace.h:2353
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:3229
RTresult RTAPI rtVariableGetContext(RTvariable v, RTcontext *context)
Returns the context associated with a program variable.
void setRayTypeCount(unsigned int num_ray_types)
See rtContextSetRayTypeCount.
Definition: optixpp_namespace.h:2482
Variable getVariable(unsigned int index) const
Query variable by index. See rt[ObjectType]GetVariable.
Definition: optixpp_namespace.h:3312
T getChild() const
Set the child node of this transform. See rtTransformGetChild.
Definition: optixpp_namespace.h:3103
Variable getVariable(unsigned int index) const
Query variable by index. See rt[ObjectType]GetVariable.
Definition: optixpp_namespace.h:2670
RTresult RTAPI rtVariableGet4i(RTvariable v, int *i1, int *i2, int *i3, int *i4)
RTresult RTAPI rtGeometryGroupGetAcceleration(RTgeometrygroup geometrygroup, RTacceleration *acceleration)
Returns the acceleration structure attached to a geometry group.
RTresult RTAPI rtVariableSet2f(RTvariable v, float f1, float f2)
void set4fv(const float *f)
Set variable value to a float4.
Definition: optixpp_namespace.h:4198
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:3529
unsigned int getChildIndex(T child) const
Query a child in this group for its index. See rtSelectorGetChild.
Definition: optixpp_namespace.h:2813
void unmap()
Unmaps a buffer object. See rtBufferUnmap.
Definition: optixpp_namespace.h:3950
void stopProgressive()
See rtContextStopProgressive.
Definition: optixpp_namespace.h:2533
void setTimeoutCallback(RTtimeoutcallback callback, double min_polling_seconds)
Definition: optixpp_namespace.h:2425
void bindProgressiveStream(Buffer source)
Definition: optixpp_namespace.h:3967
RTresult RTAPI rtVariableSetMatrix3x3fv(RTvariable v, int transpose, const float *m)
RTresult RTAPI rtBufferGLRegister(RTbuffer buffer)
Declares an OpenGL buffer as immutable and accessible by OptiX.
RTtransform get()
Get the underlying OptiX C API RTtransform opaque pointer.
Definition: optixpp_namespace.h:3128
Base class for all objects which are OptiX variable containers.
Definition: optixpp_namespace.h:347
RTsize getUsedHostMemory() const
See rtContextGetAttribute.
Definition: optixpp_namespace.h:2367
RTresult RTAPI rtGeometrySetIntersectionProgram(RTgeometry geometry, RTprogram program)
Sets the intersection program.
struct RTgroup_api * RTgroup
Definition: optix_host.h:84
RTresult RTAPI rtGeometryInstanceGetMaterial(RTgeometryinstance geometryinstance, unsigned int index, RTmaterial *material)
Returns a material handle.
void removeVariable(Variable v)
Remove a variable associated with this object.
Definition: optixpp_namespace.h:3300
RTresult RTAPI rtContextSetD3D10Device(RTcontext context, ID3D10Device *device)
Binds a D3D10 device to a context and enables interop.
TextureSampler createTextureSamplerFromD3D10Resource(ID3D10Resource *pResource)
Create TextureSampler from D3D10 image. Windows only. See rtTextureSamplerCreateFromD3D10Resource.
Definition: optixpp_namespace.h:2151
RTresult RTAPI rtVariableGet3ui(RTvariable v, unsigned int *u1, unsigned int *u2, unsigned int *u3)
RTresult RTAPI rtSelectorGetChildCount(RTselector selector, unsigned int *count)
Returns the number of child node slots of a Selector node.
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:2689
Buffer create1DLayeredBuffer(unsigned int type, RTformat format, RTsize width, RTsize layers, unsigned int levels)
Definition: optixpp_namespace.h:2032
RTresult RTAPI rtVariableGetMatrix4x4fv(RTvariable v, int transpose, float *m)
RTresult RTAPI rtProgramGetVariableCount(RTprogram program, unsigned int *count)
Returns the number of variables attached to a program.
RTresult RTAPI rtContextGetExceptionEnabled(RTcontext context, RTexception exception, int *enabled)
Query whether a specified exception is enabled.
RTresult RTAPI rtBufferCreateFromD3D9Resource(RTcontext context, unsigned int bufferdesc, IDirect3DResource9 *resource, RTbuffer *buffer)
Creates a new buffer object from a D3D9 resource.
RTresult RTAPI rtGroupDestroy(RTgroup group)
Destroys a group node.
RTresult RTAPI rtGeometryCreate(RTcontext context, RTgeometry *geometry)
Creates a new geometry node.
void setCPUNumThreads(int cpu_num_threads)
Definition: optixpp_namespace.h:2397
RTresult RTAPI rtGeometryInstanceValidate(RTgeometryinstance geometryinstance)
Checks a GeometryInstance node for internal consistency.
unsigned int removeChild(T child)
Definition: optixpp_namespace.h:2783
bool isDirty() const
Query whether this geometry has been marked dirty. See rtGeometryIsDirty.
Definition: optixpp_namespace.h:3429
~Handle()
Decrements reference count on the handled object.
Definition: optixpp_namespace.h:121
Transform wraps the OptiX C API RTtransform opaque type and its associated function set...
Definition: optixpp_namespace.h:1075
TextureSampler createTextureSamplerFromD3D9Resource(IDirect3DResource9 *pResource)
Create TextureSampler from D3D9 image. Windows only. See rtTextureSamplerCreateFromD3D9Resource.
Definition: optixpp_namespace.h:2144
RTresult RTAPI rtGeometryInstanceGetGeometry(RTgeometryinstance geometryinstance, RTgeometry *geometry)
Returns the attached Geometry node.
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:3084
RTresult RTAPI rtMaterialGetAnyHitProgram(RTmaterial material, unsigned int ray_type_index, RTprogram *program)
Returns the any hit program associated with a (material, ray type) tuple.
RTresult RTAPI rtProgramQueryVariable(RTprogram program, const char *name, RTvariable *v)
Returns a handle to the named variable attached to a program.
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:3336
Exception class for error reporting from the OptiXpp API.
Definition: optixpp_namespace.h:212
RTresult RTAPI rtTextureSamplerGLUnregister(RTtexturesampler textureSampler)
Declares an OpenGL texture as mutable and inaccessible by OptiX.
void set3fv(const float *f)
Set variable value to a float3.
Definition: optixpp_namespace.h:4193
RTresult RTAPI rtBufferCreateForCUDA(RTcontext context, unsigned int bufferdesc, RTbuffer *buffer)
Creates a new buffer object that will later rely on user-side CUDA allocation.
Handle(const Handle< U > &copy)
Takes a handle of some other type and creates a handle.
Definition: optixpp_namespace.h:109
Variable queryVariable(const std::string &name) const
Definition: optixpp_namespace.h:3398
virtual void destroy()=0
call rt[ObjectType]Destroy on the underlying OptiX C object
RTresult RTAPI rtGeometryMarkDirty(RTgeometry geometry)
Sets the dirty flag.
Variable declareVariable(const std::string &name)
Definition: optixpp_namespace.h:2644
void setGPUPagingForcedOff(int gpu_paging_forced_off)
See rtContextSetAttribute.
Definition: optixpp_namespace.h:2402
void getData(void *data) const
Get the marshalled acceleration data. See rtAccelerationGetData.
Definition: optixpp_namespace.h:3207
virtual void validate()=0
call rt[ObjectType]Validate on the underlying OptiX C object
RTresult RTAPI rtVariableSet3fv(RTvariable v, const float *f)
ID3D10Resource * getD3D10Resource()
Queries the D3D10 resource associated with this buffer. See rtBufferGetD3D10Resource.
Definition: optixpp_namespace.h:3927
RTresult RTAPI rtGeometryGetPrimitiveCount(RTgeometry geometry, unsigned int *num_primitives)
Returns the number of primitives.
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:3732
RTresult RTAPI rtBufferDestroy(RTbuffer buffer)
Destroys a buffer object.
RTresult RTAPI rtBufferBindProgressiveStream(RTbuffer stream, RTbuffer source)
Bind a stream buffer to an output buffer source.
void setVisitProgram(Program program)
Definition: optixpp_namespace.h:2727
RTresult RTAPI rtTextureSamplerValidate(RTtexturesampler texturesampler)
Validates the state of a texture sampler.
Definition: optix_declarations.h:325
Buffer getBufferFromId(int buffer_id)
Definition: optixpp_namespace.h:2189
RTresult RTAPI rtContextLaunch1D(RTcontext context, unsigned int entry_point_index, RTsize image_width)
Executes the computation kernel for a given context.
static Handle< T > create()
Static object creation. Only valid for contexts.
Definition: optixpp_namespace.h:166
RTresult RTAPI rtGeometryGroupValidate(RTgeometrygroup geometrygroup)
Validates the state of the geometry group.
RTformat getFormat() const
Query the data format for the buffer. See rtBufferGetFormat.
Definition: optixpp_namespace.h:3749
RTresult RTAPI rtGeometryIsDirty(RTgeometry geometry, int *dirty)
Returns the dirty flag.
RTresult RTAPI rtBufferCreate(RTcontext context, unsigned int bufferdesc, RTbuffer *buffer)
Creates a new buffer object.
RTresult RTAPI rtBufferSetSizev(RTbuffer buffer, unsigned int dimensionality, const RTsize *dims)
Sets the dimensionality and dimensions of a buffer.
static unsigned int getDeviceCount()
Query the machine device count. Only valid for contexts.
Definition: optixpp_namespace.h:172
GeometryInstance createGeometryInstance()
See rtGeometryInstanceCreate.
Definition: optixpp_namespace.h:2217
RTresult RTAPI rtTextureSamplerGetId(RTtexturesampler texturesampler, int *texture_id)
Returns the texture ID of this texture sampler.
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:3145
bool isDirty() const
Query if the acceleration needs a rebuild. See rtAccelerationIsDirty.
Definition: optixpp_namespace.h:3157
RTresult RTAPI rtTransformGetMatrix(RTtransform transform, int transpose, float *matrix, float *inverse_matrix)
Returns the affine matrix and its inverse associated with a Transform node.
RTresult RTAPI rtTextureSamplerDestroy(RTtexturesampler texturesampler)
Destroys a texture sampler object.
RTresult RTAPI rtContextGetEntryPointCount(RTcontext context, unsigned int *num_entry_points)
Query the number of entry points for this context.
void setChild(unsigned int index, T child)
Set an indexed child within this group. See rtGroupSetChild.
Definition: optixpp_namespace.h:2889
RTresult RTAPI rtContextStopProgressive(RTcontext context)
Stops a Progressive Launch.
RTresult RTAPI rtTextureSamplerSetMipLevelClamp(RTtexturesampler texturesampler, float minLevel, float maxLevel)
Sets the minimum and the maximum MIP level access range of a texture sampler.
RTresult RTAPI rtMaterialCreate(RTcontext context, RTmaterial *material)
Creates a new material.
RTresult RTAPI rtContextDeclareVariable(RTcontext context, const char *name, RTvariable *v)
Declares a new named variable associated with this context.
void set2fv(const float *f)
Set variable value to a float2.
Definition: optixpp_namespace.h:4188
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:2701
RTresult RTAPI rtTransformSetMatrix(RTtransform transform, int transpose, const float *matrix, const float *inverse_matrix)
Associates an affine transformation matrix with a Transform node.
Base class for all wrapper objects which can be destroyed and validated.
Definition: optixpp_namespace.h:320
static void getDeviceAttribute(int ordinal, RTdeviceattribute attrib, RTsize size, void *p)
Call rtDeviceGetAttribute and return the desired attribute value.
Definition: optixpp_namespace.h:1924
unsigned int getVariableCount() const
Definition: optixpp_namespace.h:2663
RTresult RTAPI rtProgramGetVariable(RTprogram program, unsigned int index, RTvariable *v)
Returns a handle to a variable attached to a program by index.
RTresult RTAPI rtMaterialSetAnyHitProgram(RTmaterial material, unsigned int ray_type_index, RTprogram program)
Sets the any hit program associated with a (material, ray type) tuple.
Selector wraps the OptiX C API RTselector opaque type and its associated function set...
Definition: optixpp_namespace.h:1116
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:3441
Buffer createBufferFromGLBO(unsigned int type, unsigned int vbo)
Create buffer from GL buffer object. See rtBufferCreateFromGLBO.
Definition: optixpp_namespace.h:2114
unsigned int getDimensionality() const
Query dimensionality of buffer. See rtBufferGetDimensionality.
Definition: optixpp_namespace.h:3845
RTresult RTAPI rtGeometryInstanceSetMaterialCount(RTgeometryinstance geometryinstance, unsigned int count)
Sets the number of materials.
void setExceptionProgram(unsigned int entry_point_index, Program program)
See rtContextSetExceptionProgram.
Definition: optixpp_namespace.h:2456
unsigned int getChildCount() const
Query the number of children for this group. See rtGroupGetChildCount.
Definition: optixpp_namespace.h:2881
RTresult RTAPI rtBufferGetProgressiveUpdateReady(RTbuffer buffer, int *ready, unsigned int *subframe_count, unsigned int *max_subframes)
Check whether stream buffer content has been updated by a Progressive Launch.
RTresult RTAPI rtContextSetAttribute(RTcontext context, RTcontextattribute attrib, RTsize size, void *p)
Set an attribute specific to an OptiX context.
Group wraps the OptiX C API RTgroup opaque type and its associated function set.
Definition: optixpp_namespace.h:954
static std::string getDeviceName(int ordinal)
Call rtDeviceGetAttribute and return the name of the device.
Definition: optixpp_namespace.h:1914
void setPrimitiveIndexOffset(unsigned int index_offset)
Definition: optixpp_namespace.h:3355
RTresult RTAPI rtBufferGetContext(RTbuffer buffer, RTcontext *context)
Returns the context object that created this buffer.
Buffer createBufferForCUDA(unsigned int type)
Create a buffer for CUDA with given RTbuffertype. See rtBufferCreate.
Definition: optixpp_namespace.h:2072
RTresult RTAPI rtContextSetRayGenerationProgram(RTcontext context, unsigned int entry_point_index, RTprogram program)
Specifies the ray generation program for a given context entry point.
RTresult RTAPI rtAccelerationGetBuilder(RTacceleration acceleration, const char **return_string)
Query the current builder from an acceleration structure.
RTresult RTAPI rtProgramDeclareVariable(RTprogram program, const char *name, RTvariable *v)
Declares a new named variable associated with a program.
virtual ~Exception()
Definition: optixpp_namespace.h:220
Definition: optix_declarations.h:207
void destroy()
Destroy Context and all of its associated objects. See rtContextDestroy.
Definition: optixpp_namespace.h:1939
RTtextureindexmode getIndexingMode() const
Query texture indexing mode for this sampler. See rtTextureSamplerGetIndexingMode.
Definition: optixpp_namespace.h:3645
RTresult RTAPI rtBufferD3D11Register(RTbuffer buffer)
Declares a D3D11 buffer as immutable and accessible by OptiX.
Program getIntersectionProgram() const
Get the intersection program for this geometry. See rtGeometryGetIntersectionProgram.
Definition: optixpp_namespace.h:3384
RTcontext get()
Return the OptiX C API RTcontext object.
Definition: optixpp_namespace.h:2620
RTresult RTAPI rtVariableGetMatrix2x3fv(RTvariable v, int transpose, float *m)
Material getMaterial(unsigned int idx) const
Get the material at given index. See rtGeometryInstanceGetMaterial.
Definition: optixpp_namespace.h:3270
RTresult RTAPI rtBufferSetSize3D(RTbuffer buffer, RTsize width, RTsize height, RTsize depth)
Sets the width, height, depth and dimensionality of a buffer.
RTresult RTAPI rtTransformGetChild(RTtransform transform, RTobject *child)
Returns the child node that is attached to a Transform node.
Group createGroup()
See rtGroupCreate.
Definition: optixpp_namespace.h:2239
float getMaxAnisotropy() const
Query maximum anisotropy for this sampler. See rtTextureSamplerGetMaxAnisotropy.
Definition: optixpp_namespace.h:3592
bufferId is a host version of the device side bufferId.
Definition: optix_device.h:415
Variable queryVariable(const std::string &name) const
Definition: optixpp_namespace.h:2651
RTresult RTAPI rtContextGetMissProgram(RTcontext context, unsigned int ray_type_index, RTprogram *program)
Queries the miss program associated with the given context and ray type.
RTresult RTAPI rtContextGetVariable(RTcontext context, unsigned int index, RTvariable *v)
Queries an indexed variable associated with this context.
RTresult RTAPI rtAccelerationCreate(RTcontext context, RTacceleration *acceleration)
Creates a new acceleration structure.
RTresult RTAPI rtBufferGetDevicePointer(RTbuffer buffer, unsigned int optix_device_number, void **device_pointer)
Gets the pointer to the buffer's data on the given device.
RTresult RTAPI rtGeometryRemoveVariable(RTgeometry geometry, RTvariable v)
Removes a named variable from a geometry node.
void setFloat(float f1)
Set variable value to a scalar float.
Definition: optixpp_namespace.h:4148
void unregisterD3D10Buffer()
Unregister the buffer, re-enabling OptiX operations. See rtTextureSamplerD3D10Unregister.
Definition: optixpp_namespace.h:3910
RTresult RTAPI rtGeometryGroupDestroy(RTgeometrygroup geometrygroup)
Destroys a geometry group node.
unsigned int getMipLevelCount() const
Deprecated in OptiX 4.0 Query the number of mip levels for this sampler. See rtTextureSamplerGetMipLe...
Definition: optixpp_namespace.h:3546
unsigned int addMaterial(Material material)
Adds the provided material and returns the index to newly added material; increases material count by...
Definition: optixpp_namespace.h:3278
RTobjecttype getChildType() const
Query child's type. See rtTransformGetChildType.
Definition: optixpp_namespace.h:3110
RTresult RTAPI rtAccelerationSetData(RTacceleration acceleration, const void *data, RTsize size)
Sets the state of an acceleration structure.
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:3448
RTresult RTAPI rtGeometryGetVariable(RTgeometry geometry, unsigned int index, RTvariable *v)
Returns a handle to an indexed variable of a geometry node.
RTresult RTAPI rtGroupGetChildCount(RTgroup group, unsigned int *count)
Returns the number of child slots for a group.
RTresult RTAPI rtGeometryDeclareVariable(RTgeometry geometry, const char *name, RTvariable *v)
Declares a new named variable associated with a geometry instance.
RTresult RTAPI rtBufferD3D11Unregister(RTbuffer buffer)
Declares a D3D11 buffer as mutable and inaccessible by OptiX.
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:2720
RTresult RTAPI rtAccelerationSetTraverser(RTacceleration acceleration, const char *traverser)
Specifies the traverser to be used for an acceleration structure.
ID3D11Resource * getD3D11Resource()
Queries the D3D11 resource associated with this buffer. See rtBufferGetD3D11Resource.
Definition: optixpp_namespace.h:3934
unsigned int getPrimitiveCount() const
Definition: optixpp_namespace.h:3348
void setAnyHitProgram(unsigned int ray_type_index, Program program)
Set any hit program for this material at the given ray_type index. See rtMaterialSetAnyHitProgram.
Definition: optixpp_namespace.h:3472
struct RTacceleration_api * RTacceleration
Definition: optix_host.h:66
RTresult RTAPI rtVariableGetObject(RTvariable v, RTobject *object)
Returns the value of a OptiX object program variable.
RTresult RTAPI rtMaterialGetVariable(RTmaterial material, unsigned int index, RTvariable *v)
Returns a handle to an indexed variable of a material.
void getProgressiveUpdateReady(int *ready, unsigned int *subframe_count, unsigned int *max_subframes)
Query updates from a progressive stream. See rtBufferGetProgressiveUpdateReady.
Definition: optixpp_namespace.h:3972
RTresult RTAPI rtTransformCreate(RTcontext context, RTtransform *transform)
Creates a new Transform node.
void markDirty()
Definition: optixpp_namespace.h:3152
RTresult RTAPI rtBufferSetFormat(RTbuffer buffer, RTformat format)
Sets the format of this buffer.
RTwrapmode getWrapMode(unsigned int dim) const
Query the texture wrap mode for this sampler. See rtTextureSamplerGetWrapMode.
Definition: optixpp_namespace.h:3570
RTresult RTAPI rtContextGetProgramFromId(RTcontext context, int program_id, RTprogram *program)
Gets an RTprogram corresponding to the program id.
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:2632
void setIntersectionProgram(Program program)
Set the intersection program for this geometry. See rtGeometrySetIntersectionProgram.
Definition: optixpp_namespace.h:3379
void setReadMode(RTtexturereadmode readmode)
Set texture read mode for this sampler. See rtTextureSamplerSetReadMode.
Definition: optixpp_namespace.h:3628
std::string getName() const
Retrieve the name of the variable.
Definition: optixpp_namespace.h:4328
void setChildCount(unsigned int count)
Definition: optixpp_namespace.h:2876
Program getRayGenerationProgram(unsigned int entry_point_index) const
See rtContextGetRayGenerationProgram.
Definition: optixpp_namespace.h:2448
RTresult RTAPI rtTextureSamplerCreateFromD3D9Resource(RTcontext context, IDirect3DResource9 *resource, RTtexturesampler *textureSampler)
Creates a new texture sampler object from a D3D9 resource.
RTresult RTAPI rtContextSetPrintBufferSize(RTcontext context, RTsize buffer_size_bytes)
Set the size of the print buffer.
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:3725
RTresult RTAPI rtAccelerationGetContext(RTacceleration acceleration, RTcontext *context)
Returns the context associated with an acceleration structure.
RTtexturereadmode
Definition: optix_declarations.h:163
RTresult RTAPI rtVariableSet3i(RTvariable v, int i1, int i2, int i3)
Variable getVariable(unsigned int index) const
Query variable by index. See rt[ObjectType]GetVariable.
Definition: optixpp_namespace.h:3510
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:2967
Selector createSelector()
See rtSelectorCreate.
Definition: optixpp_namespace.h:2309
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:2979
RTresult RTAPI rtGeometryGroupSetChildCount(RTgeometrygroup geometrygroup, unsigned int count)
Sets the number of child nodes to be attached to the group.
void setElementSize(RTsize size_of_element)
Set the data element size for user format buffers. See rtBufferSetElementSize.
Definition: optixpp_namespace.h:3756
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:3234
Definition: optix_declarations.h:277
RTresult RTAPI rtGeometryQueryVariable(RTgeometry geometry, const char *name, RTvariable *v)
Returns a handle to a named variable of a geometry node.
struct IDirect3DDevice9 IDirect3DDevice9
Definition: optix_d3d9_interop.h:58
RTresult RTAPI rtContextGetExceptionProgram(RTcontext context, unsigned int entry_point_index, RTprogram *program)
Queries the exception program associated with the given context and entry point.
void setTraverser(const std::string &traverser)
Specify the acceleration structure traverser. See rtAccelerationSetTraverser.
Definition: optixpp_namespace.h:3188
virtual Variable queryVariable(const std::string &name) const =0
void setD3D9Device(IDirect3DDevice9 *device)
Set the D3D device assocaiated with this context (Windows only). See rtContextSetD3D9Device.
Definition: optixpp_namespace.h:2165
void setArraySize(unsigned int num_textures_in_array)
Deprecated in OptiX 4.0 Set the texture array size for this sampler. See rtTextureSamplerSetArraySize...
Definition: optixpp_namespace.h:3553
RTresult RTAPI rtVariableGet4f(RTvariable v, float *f1, float *f2, float *f3, float *f4)
RTresult RTAPI rtTextureSamplerGetContext(RTtexturesampler texturesampler, RTcontext *context)
Gets the context object that created this texture sampler.
RTresult RTAPI rtSelectorValidate(RTselector selector)
Checks a Selector node for internal consistency.
Acceleration getAcceleration() const
Query the Acceleration structure for this group. See rtGroupGetAcceleration.
Definition: optixpp_namespace.h:2869
Exception(const std::string &message, RTresult error_code=RT_ERROR_UNKNOWN)
Create exception.
Definition: optixpp_namespace.h:215
RTresult getErrorCode() const
Retrieve the error code.
Definition: optixpp_namespace.h:226
void getFilteringModes(RTfiltermode &minification, RTfiltermode &magnification, RTfiltermode &mipmapping) const
Query filtering modes for this sampler. See rtTextureSamplerGetFilteringModes.
Definition: optixpp_namespace.h:3582
RTresult RTAPI rtContextGetVariableCount(RTcontext context, unsigned int *count)
Returns the number of variables associated with this context.
RTresult RTAPI rtMaterialRemoveVariable(RTmaterial material, RTvariable v)
Removes a variable from a material.
Context getContext() const
Definition: optixpp_namespace.h:1894
static Handle< T > take(RTobject p)
Definition: optixpp_namespace.h:127
RTresult RTAPI rtTextureSamplerD3D11Register(RTtexturesampler textureSampler)
Declares a D3D11 texture as immutable and accessible by OptiX.
RTbufferattribute
Definition: optix_declarations.h:332
virtual void removeVariable(Variable v)=0
Remove a variable associated with this object.
Acceleration createAcceleration(const char *builder, const char *traverser)
Definition: optixpp_namespace.h:1950
void setAcceleration(Acceleration acceleration)
Definition: optixpp_namespace.h:2864
unsigned int getChildIndex(T child) const
Query a child in this group for its index. See rtGroupGetChild.
Definition: optixpp_namespace.h:2949
RTresult RTAPI rtContextCompile(RTcontext context)
Compiles a context object.
bool getExceptionEnabled(RTexception exception) const
See rtContextGetExceptionEnabled.
Definition: optixpp_namespace.h:2474
RTresult RTAPI rtTextureSamplerD3D10Register(RTtexturesampler textureSampler)
Declares a D3D10 texture as immutable and accessible by OptiX.
Buffer createCubeLayeredBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize faces, unsigned int levels)
Definition: optixpp_namespace.h:2062
RTresult RTAPI rtVariableGetSize(RTvariable v, RTsize *size)
Queries the size, in bytes, of a variable.
Definition: optix_declarations.h:328
RTresult RTAPI rtTextureSamplerSetMipLevelBias(RTtexturesampler texturesampler, float value)
Sets the mipmap offset of a texture sampler.
RTresult RTAPI rtVariableGetMatrix3x3fv(RTvariable v, int transpose, float *m)
struct RTmaterial_api * RTmaterial
Definition: optix_host.h:87
RTresult RTAPI rtVariableSet1iv(RTvariable v, const int *i)
RTresult RTAPI rtGeometryInstanceRemoveVariable(RTgeometryinstance geometryinstance, RTvariable v)
Removes a named variable from a geometry instance node.
RTresult RTAPI rtMaterialGetVariableCount(RTmaterial material, unsigned int *count)
Returns the number of variables attached to a material.
GeometryInstance getChild(unsigned int index) const
Query an indexed GeometryInstance within this group. See rtGeometryGroupGetChild. ...
Definition: optixpp_namespace.h:3015
unsigned int getEntryPointCount() const
See rtContextGetEntryPointCount.
Definition: optixpp_namespace.h:2435
RTresult RTAPI rtGeometryInstanceGetVariableCount(RTgeometryinstance geometryinstance, unsigned int *count)
Returns the number of attached variables.
void unregisterD3D11Texture()
Declare the texture's buffer as mutable and inaccessible by OptiX. See rtTextureSamplerD3D10Unregiste...
Definition: optixpp_namespace.h:3718
Acceleration wraps the OptiX C API RTacceleration opaque type and its associated function set...
Definition: optixpp_namespace.h:1187
RTresult RTAPI rtVariableSet2fv(RTvariable v, const float *f)
RTresult RTAPI rtVariableSet4ui(RTvariable v, unsigned int u1, unsigned int u2, unsigned int u3, unsigned int u4)
void registerD3D9Buffer()
Definition: optixpp_namespace.h:3890
RTresult RTAPI rtMaterialSetClosestHitProgram(RTmaterial material, unsigned int ray_type_index, RTprogram program)
Sets the closest hit program associated with a (material, ray type) tuple.
Definition: optix_declarations.h:327
RTresult RTAPI rtVariableGet1f(RTvariable v, float *f1)
Functions designed to modify the value of a program variable.
RTresult RTAPI rtTextureSamplerGetMaxAnisotropy(RTtexturesampler texturesampler, float *value)
Gets the maximum anisotropy level for a texture sampler.
void registerGLBuffer()
Declare the buffer as mutable and inaccessible by OptiX. See rtTextureSamplerGLRegister.
Definition: optixpp_namespace.h:3878
RTresult RTAPI rtVariableSet4f(RTvariable v, float f1, float f2, float f3, float f4)
RTresult RTAPI rtBufferGetMipLevelCount(RTbuffer buffer, unsigned int *level)
Gets the number of mipmap levels of this buffer object.
RTresult RTAPI rtSelectorDestroy(RTselector selector)
Destroys a selector node.
int getId() const
Definition: optixpp_namespace.h:3621
RTresult RTAPI rtAccelerationSetBuilder(RTacceleration acceleration, const char *builder)
Specifies the builder to be used for an acceleration structure.
RTresult RTAPI rtContextSetExceptionEnabled(RTcontext context, RTexception exception, int enabled)
Enable or disable an exception.
RTresult RTAPI rtGeometryGetIntersectionProgram(RTgeometry geometry, RTprogram *program)
Returns the attached intersection program.
T getChild(unsigned int index) const
Query an indexed child within this group. See rtGroupGetChild.
Definition: optixpp_namespace.h:2895
unsigned int getGLBOId() const
Definition: optixpp_namespace.h:3871
RTresult RTAPI rtTextureSamplerSetFilteringModes(RTtexturesampler texturesampler, RTfiltermode minification, RTfiltermode magnification, RTfiltermode mipmapping)
Sets the filtering modes of a texture sampler.
Definition: optix_declarations.h:240
Geometry getGeometry() const
Get the geometry object associated with this instance. See rtGeometryInstanceGetGeometry.
Definition: optixpp_namespace.h:3246
RTresult RTAPI rtContextGetRunningState(RTcontext context, int *running)
Query whether the given context is currently running.
RTresult RTAPI rtVariableGetMatrix4x2fv(RTvariable v, int transpose, float *m)
RTobjecttype getChildType(unsigned int index) const
Query indexed child's type. See rtGroupGetChildType.
Definition: optixpp_namespace.h:2902
RTresult RTAPI rtBufferGLUnregister(RTbuffer buffer)
Declares an OpenGL buffer as mutable and inaccessible by OptiX.
void setMipLevelBias(float value)
Set mipmap offset for this sampler. See rtTextureSamplerSetMipLevelBias.
Definition: optixpp_namespace.h:3609
RTresult RTAPI rtTransformValidate(RTtransform transform)
Checks a Transform node for internal consistency.
void setPrintLaunchIndex(int x, int y=-1, int z=-1)
See rtContextSetPrintLaunchIndex.
Definition: optixpp_namespace.h:2574
RTresult RTAPI rtGeometryGetBoundingBoxProgram(RTgeometry geometry, RTprogram *program)
Returns the attached bounding box program.
Definition: optix_declarations.h:326
void setAcceleration(Acceleration acceleration)
Definition: optixpp_namespace.h:2986
RTresult RTAPI rtVariableGet4ui(RTvariable v, unsigned int *u1, unsigned int *u2, unsigned int *u3, unsigned int *u4)
void setRemoteDevice(RemoteDevice remote_device)
See rtContextSetRemoteDevice.
Definition: optixpp_namespace.h:2538
RTresult RTAPI rtGeometryInstanceGetVariable(RTgeometryinstance geometryinstance, unsigned int index, RTvariable *v)
Returns a handle to an indexed variable of a geometry instance node.
RTresult RTAPI rtBufferCreateFromD3D11Resource(RTcontext context, unsigned int bufferdesc, ID3D11Resource *resource, RTbuffer *buffer)
Creates a new buffer object from a D3D11 resource.
RTresult RTAPI rtSelectorCreate(RTcontext context, RTselector *selector)
Creates a Selector node.
Variable declareVariable(const std::string &name)
Definition: optixpp_namespace.h:3391
RTresult RTAPI rtVariableSet1i(RTvariable v, int i1)
RTresult RTAPI rtGeometryGroupGetContext(RTgeometrygroup geometrygroup, RTcontext *context)
Returns the context associated with a geometry group.
RTresult RTAPI rtBufferGetSize3D(RTbuffer buffer, RTsize *width, RTsize *height, RTsize *depth)
Gets the width, height and depth of this buffer.
RTresult RTAPI rtGeometryValidate(RTgeometry geometry)
Validates the geometry nodes integrity.
void getUserData(RTsize size, void *ptr) const
Retrieve a user defined type given the sizeof the user object.
Definition: optixpp_namespace.h:4274
RTresult RTAPI rtContextCreate(RTcontext *context)
Creates a new context object.
RTresult RTAPI rtAccelerationGetProperty(RTacceleration acceleration, const char *name, const char **return_string)
Queries an acceleration structure property.
unsigned int getEnabledDeviceCount() const
Definition: optixpp_namespace.h:2346
RTresult RTAPI rtGeometryGroupGetChildCount(RTgeometrygroup geometrygroup, unsigned int *count)
Returns the number of child slots for a group.
Program getMissProgram(unsigned int ray_type_index) const
See rtContextGetMissProgram.
Definition: optixpp_namespace.h:2499
unsigned int getVariableCount() const
Definition: optixpp_namespace.h:2605
RTgltarget
Definition: optix_declarations.h:172
RTresult RTAPI rtBufferGetAttribute(RTbuffer buffer, RTbufferattribute attrib, RTsize size, void *p)
Query a buffer attribute.
RemoteDevice wraps the OptiX C API RTremotedevice opaque type and its associated function set...
Definition: optixpp_namespace.h:1841
unsigned int addChild(T child)
Set a new child in this group and returns its new index. See rtGroupSetChild.
Definition: optixpp_namespace.h:2910
RTmaterial get()
Get the underlying OptiX C API RTmaterial opaque pointer.
Definition: optixpp_namespace.h:3517
RTresult RTAPI rtGeometryGetPrimitiveIndexOffset(RTgeometry geometry, unsigned int *index_offset)
Returns the current primitive index offset.
RTresult RTAPI rtGeometryInstanceDeclareVariable(RTgeometryinstance geometryinstance, const char *name, RTvariable *v)
Declares a new named variable associated with a geometry node.
RTresult RTAPI rtBufferSetSize2D(RTbuffer buffer, RTsize width, RTsize height)
Sets the width, height and dimensionality of this buffer.
RTtexturesampler get()
Get the underlying OptiX C API RTtexturesampler opaque pointer.
Definition: optixpp_namespace.h:3676
void registerGLTexture()
Definition: optixpp_namespace.h:3681
unsigned int getChildCount() const
Query the number of children for this group. See rtSelectorGetChildCount.
Definition: optixpp_namespace.h:2744
TextureSampler getTextureSamplerFromId(int sampler_id)
Definition: optixpp_namespace.h:2203
void registerD3D11Buffer()
Declare the texture's buffer as mutable and inaccessible by OptiX. See rtBufferD3D11Register.
Definition: optixpp_namespace.h:3900
RTresult RTAPI rtBufferUnmapEx(RTbuffer buffer, unsigned int level)
Unmaps mipmap level storage from the host.
void unregisterD3D9Texture()
Declare the texture's buffer as mutable and inaccessible by OptiX. See rtTextureSamplerD3D9Unregister...
Definition: optixpp_namespace.h:3708
RTresult RTAPI rtGeometrySetPrimitiveIndexOffset(RTgeometry geometry, unsigned int index_offset)
Sets the primitive index offset.
int removeReference()
Decrement the reference count for this object.
Definition: optixpp_namespace.h:277
RTresult RTAPI rtSelectorSetVisitProgram(RTselector selector, RTprogram program)
Assigns a visit program to a Selector node.
RTresult RTAPI rtVariableSet2i(RTvariable v, int i1, int i2)
void setProperty(const std::string &name, const std::string &value)
Definition: optixpp_namespace.h:3164
void setWrapMode(unsigned int dim, RTwrapmode wrapmode)
Set the texture wrap mode for this sampler. See rtTextureSamplerSetWrapMode.
Definition: optixpp_namespace.h:3565
void setMipLevelCount(unsigned int num_mip_levels)
Definition: optixpp_namespace.h:3541
void setClosestHitProgram(unsigned int ray_type_index, Program program)
Definition: optixpp_namespace.h:3460
int getRunningState() const
See rtContextGetRunningState.
Definition: optixpp_namespace.h:2543
RTgroup get()
Get the underlying OptiX C API RTgroup opaque pointer.
Definition: optixpp_namespace.h:2962
RTresult RTAPI rtBufferGetFormat(RTbuffer buffer, RTformat *format)
Gets the format of this buffer.
Buffer createBuffer(unsigned int type)
Create a buffer with given RTbuffertype. See rtBufferCreate.
Definition: optixpp_namespace.h:1960
RTresult RTAPI rtBufferGetSizev(RTbuffer buffer, unsigned int dimensionality, RTsize *dims)
Gets the dimensions of this buffer.
RTresult RTAPI rtTextureSamplerD3D9Register(RTtexturesampler textureSampler)
Declares a D3D9 texture as immutable and accessible by OptiX.
unsigned int getMaterialCount() const
Query the number of materials associated with this instance. See rtGeometryInstanceGetMaterialCount.
Definition: optixpp_namespace.h:3258
RTresult RTAPI rtTextureSamplerGetIndexingMode(RTtexturesampler texturesampler, RTtextureindexmode *indexmode)
Gets the indexing mode of a texture sampler.
RTresult RTAPI rtSelectorQueryVariable(RTselector selector, const char *name, RTvariable *v)
Returns a variable associated with a Selector node.
std::vector< int > getEnabledDevices() const
See rtContextGetDevices. This returns the list of currently enabled devices.
Definition: optixpp_namespace.h:2338
RTresult RTAPI rtAccelerationGetDataSize(RTacceleration acceleration, RTsize *size)
Returns the size of the data to be retrieved from an acceleration structure.
RTsize getDataSize() const
Definition: optixpp_namespace.h:3200
RTresult RTAPI rtTransformSetChild(RTtransform transform, RTobject child)
Attaches a child node to a Transform node.
Context object wraps the OptiX C API RTcontext opaque type and its associated function set...
Definition: optixpp_namespace.h:593
void setMaterial(unsigned int idx, Material material)
Set the material at given index. See rtGeometryInstanceSetMaterial.
Definition: optixpp_namespace.h:3265
#define RT_INTERNAL_CALLABLE_PROGRAM_DEFS()
callableProgramId is a host version of the device side callableProgramId.
Definition: optixpp_namespace.h:1770
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:3133
Buffer create2DLayeredBuffer(unsigned int type, RTformat format, RTsize width, RTsize height, RTsize layers, unsigned int levels)
Definition: optixpp_namespace.h:2042
Material createMaterial()
See rtMaterialCreate.
Definition: optixpp_namespace.h:2288
RTresult RTAPI rtBufferGetSize2D(RTbuffer buffer, RTsize *width, RTsize *height)
Gets the width and height of this buffer.
std::string getBuilder() const
Query the acceleration structure builder. See rtAccelerationGetBuilder.
Definition: optixpp_namespace.h:3181
struct IDirect3DResource9 IDirect3DResource9
Definition: optix_d3d9_interop.h:60
Variable queryVariable(const std::string &name) const
Definition: optixpp_namespace.h:3491
unsigned int removeChild(T child)
Definition: optixpp_namespace.h:2920
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:2715
struct RTtexturesampler_api * RTtexturesampler
Definition: optix_host.h:96
Transform createTransform()
See rtTransformCreate.
Definition: optixpp_namespace.h:2281
void validate()
See rtContextValidate.
Definition: optixpp_namespace.h:1945
struct RTbuffer_api * RTbuffer
Definition: optix_host.h:69
RTresult RTAPI rtAccelerationGetData(RTacceleration acceleration, void *data)
Retrieves acceleration structure data.
RTresult RTAPI rtVariableGetAnnotation(RTvariable v, const char **annotation_return)
Queries the annotation string of a program variable.
RTacceleration get()
Get the underlying OptiX C API RTacceleration opaque pointer.
Definition: optixpp_namespace.h:3217
void setMipLevelCount(unsigned int levels)
Set buffer number of MIP levels. See rtBufferSetMipLevelCount.
Definition: optixpp_namespace.h:3852
Buffer createBufferFromD3D9Resource(unsigned int type, IDirect3DResource9 *pResource)
Create buffer from D3D9 buffer object. Windows only. See rtBufferCreateFromD3D9Resource.
Definition: optixpp_namespace.h:2123
void setBoundingBoxProgram(Program program)
Definition: optixpp_namespace.h:3367
RTresult RTAPI rtGroupSetChild(RTgroup group, unsigned int index, RTobject child)
Attaches a child node to a group.
RTresult RTAPI rtContextSetDevices(RTcontext context, unsigned int count, const int *devices)
Specify a list of hardware devices to be used by the kernel.
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:3522
void setAttribute(RTbufferattribute attrib, RTsize size, void *p)
Definition: optixpp_namespace.h:3982
unsigned int getChildIndex(GeometryInstance child) const
Query a child in this group for its index. See rtGeometryGroupGetChild.
Definition: optixpp_namespace.h:3059
int(* RTtimeoutcallback)(void)
Definition: optix_host.h:118
RTresult RTAPI rtVariableGet2ui(RTvariable v, unsigned int *u1, unsigned int *u2)
RTremotedevice get()
Return the OptiX C API RTremotedevice object.
Definition: optixpp_namespace.h:4036
void setSize(RTsize width)
Set buffer dimensionality to one and buffer width to specified width. See rtBufferSetSize1D.
Definition: optixpp_namespace.h:3790
const std::string & getErrorString() const
Retrieve the error message.
Definition: optixpp_namespace.h:223
RTresult RTAPI rtContextGetTextureSamplerFromId(RTcontext context, int sampler_id, RTtexturesampler *sampler)
Gets an RTtexturesampler corresponding to the texture id.
void getAttribute(RTbufferattribute attrib, RTsize size, void *p)
Get a Buffer Attribute. See rtBufferGetAttribute.
Definition: optixpp_namespace.h:3987
Definition: optix_declarations.h:308
RTresult RTAPI rtMaterialGetContext(RTmaterial material, RTcontext *context)
Returns the context associated with a material.
Program getProgramFromId(int program_id)
Definition: optixpp_namespace.h:2196
struct RTprogram_api * RTprogram
Definition: optix_host.h:90
Definition: optix_declarations.h:215
RTresult RTAPI rtVariableGet3f(RTvariable v, float *f1, float *f2, float *f3)
RTresult RTAPI rtProgramGetContext(RTprogram program, RTcontext *context)
Gets the context object that created a program.
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:3534
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:3140
RTresult RTAPI rtContextSetTimeoutCallback(RTcontext context, RTtimeoutcallback callback, double min_polling_seconds)
Side timeout callback function.
static Exception makeException(RTresult code, RTcontext context)
For backwards compatability. Use Exception::makeException instead.
Definition: optixpp_namespace.h:295
void setChild(unsigned int index, GeometryInstance geometryinstance)
Set an indexed GeometryInstance child of this group. See rtGeometryGroupSetChild. ...
Definition: optixpp_namespace.h:3010
void launch(unsigned int entry_point_index, RTsize image_width)
Definition: optixpp_namespace.h:2511
Variable queryVariable(const std::string &name) const
Definition: optixpp_namespace.h:2593
Material wraps the OptiX C API RTmaterial opaque type and its associated function set...
Definition: optixpp_namespace.h:1370
unsigned int getChildCount() const
Query the number of children for this group. See rtGeometryGroupGetChildCount.
Definition: optixpp_namespace.h:3003
RTresult RTAPI rtAccelerationMarkDirty(RTacceleration acceleration)
Marks an acceleration structure as dirty.
RTresult RTAPI rtTextureSamplerSetMipLevelCount(RTtexturesampler texturesampler, unsigned int num_mip_levels)
Sets the number of MIP levels in a texture sampler.
T * get()
Retrieve the handled object.
Definition: optixpp_namespace.h:134
RTresult RTAPI rtTextureSamplerGetReadMode(RTtexturesampler texturesampler, RTtexturereadmode *readmode)
Gets the read mode of a texture sampler.
RTresult RTAPI rtVariableSet4fv(RTvariable v, const float *f)
RTresult RTAPI rtBufferSetElementSize(RTbuffer buffer, RTsize size_of_element)
Modifies the size in bytes of a buffer's individual elements.
RTdeviceattribute
Definition: optix_declarations.h:281
RTresult RTAPI rtVariableGetType(RTvariable v, RTobjecttype *type_return)
Returns type information about a program variable.
RTresult RTAPI rtContextSetD3D11Device(RTcontext context, ID3D11Device *device)
Binds a D3D11 device to a context and enables interop.
RTresult RTAPI rtRemoteDeviceDestroy(RTremotedevice remote_dev)
Destroys a remote device.
Buffer createBufferFromD3D10Resource(unsigned int type, ID3D10Resource *pResource)
Create buffer from D3D10 buffer object. Windows only. See rtBufferCreateFromD3D10Resource.
Definition: optixpp_namespace.h:2130
void addReference()
Increment the reference count for this object.
Definition: optixpp_namespace.h:275
RTgeometrygroup get()
Get the underlying OptiX C API RTgeometrygroup opaque pointer.
Definition: optixpp_namespace.h:3072
RTresult RTAPI rtTextureSamplerGetBuffer(RTtexturesampler texturesampler, unsigned int deprecated0, unsigned int deprecated1, RTbuffer *buffer)
Gets a buffer object handle from a texture sampler.
int getId() const
Definition: optixpp_namespace.h:3864
RTresult RTAPI rtContextGetRayGenerationProgram(RTcontext context, unsigned int entry_point_index, RTprogram *program)
Queries the ray generation program associated with the given context and entry point.
RTgeometry get()
Get the underlying OptiX C API RTgeometry opaque pointer.
Definition: optixpp_namespace.h:3436
GeometryGroup wraps the OptiX C API RTgeometrygroup opaque type and its associated function set...
Definition: optixpp_namespace.h:1016
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:3324
void getMipLevelClamp(float &minLevel, float &maxLevel) const
Query minimum and maxnimum mipmap levels for this sampler. See rtTextureSamplerGetMipLevelClamp.
Definition: optixpp_namespace.h:3604
RTresult RTAPI rtVariableSetMatrix4x2fv(RTvariable v, int transpose, const float *m)
void setPrimitiveCount(unsigned int num_primitives)
Definition: optixpp_namespace.h:3343
RTgeometryinstance get()
Get the underlying OptiX C API RTgeometryinstance opaque pointer.
Definition: optixpp_namespace.h:3319
void setFilteringModes(RTfiltermode minification, RTfiltermode magnification, RTfiltermode mipmapping)
Set filtering modes for this sampler. See rtTextureSamplerSetFilteringModes.
Definition: optixpp_namespace.h:3577
RTresult RTAPI rtVariableSet3f(RTvariable v, float f1, float f2, float f3)
GeometryInstance wraps the OptiX C API RTgeometryinstance acceleration opaque type and its associated...
Definition: optixpp_namespace.h:1247
RTresult RTAPI rtContextValidate(RTcontext context)
Checks the given context for valid internal state.
RTresult RTAPI rtContextGetDeviceCount(RTcontext context, unsigned int *count)
Query the number of devices currently being used.
RTresult RTAPI rtVariableSet2uiv(RTvariable v, const unsigned int *u)
RTresult RTAPI rtVariableSetMatrix2x2fv(RTvariable v, int transpose, const float *m)
RTresult RTAPI rtDeviceGetDeviceCount(unsigned int *count)
Returns the number of OptiX capable devices.
RTresult RTAPI rtVariableSetMatrix4x3fv(RTvariable v, int transpose, const float *m)
Variable declareVariable(const std::string &name)
Definition: optixpp_namespace.h:2586
struct RTgeometryinstance_api * RTgeometryinstance
Definition: optix_host.h:78
void setDevicePointer(unsigned int optix_device_number, CUdeviceptr device_pointer)
Set the pointer to buffer memory on a specific device. See rtBufferSetDevicePointer.
Definition: optixpp_namespace.h:3780
Program getClosestHitProgram(unsigned int ray_type_index) const
Get closest hit program for this material at the given ray_type index. See rtMaterialGetClosestHitPro...
Definition: optixpp_namespace.h:3465
RTresult RTAPI rtTransformDestroy(RTtransform transform)
Destroys a transform node.
Handle< T > & operator=(const Handle< U > &copy)
Assignment of handle with different underlying object type.
Definition: optixpp_namespace.h:117
RTresult RTAPI rtGroupGetAcceleration(RTgroup group, RTacceleration *acceleration)
Returns the acceleration structure attached to a group.
RTvariable get()
Get the OptiX C API object wrapped by this instance.
Definition: optixpp_namespace.h:4349
RTobjecttype
Definition: optix_declarations.h:104
RTresult RTAPI rtBufferGetD3D10Resource(RTbuffer buffer, ID3D10Resource **resource)
Gets the D3D10 resource associated with this buffer.
void removeVariable(Variable v)
Remove a variable associated with this object.
Definition: optixpp_namespace.h:2658
RTresult RTAPI rtAccelerationDestroy(RTacceleration acceleration)
Destroys an acceleration structure object.
void setIndexingMode(RTtextureindexmode indexmode)
Set texture indexing mode for this sampler. See rtTextureSamplerSetIndexingMode.
Definition: optixpp_namespace.h:3640
Program object wraps the OptiX C API RTprogram opaque type and its associated function set...
Definition: optixpp_namespace.h:920
RTresult RTAPI rtContextQueryVariable(RTcontext context, const char *name, RTvariable *v)
Returns a named variable associated with this context.
RTresult RTAPI rtContextSetExceptionProgram(RTcontext context, unsigned int entry_point_index, RTprogram program)
Specifies the exception program for a given context entry point.
Variable getVariable(unsigned int index) const
Query variable by index. See rt[ObjectType]GetVariable.
Definition: optixpp_namespace.h:2612
float getMipLevelBias() const
Query mipmap offset for this sampler. See rtTextureSamplerGetMipLevelBias.
Definition: optixpp_namespace.h:3614
RTresult RTAPI rtVariableSet4uiv(RTvariable v, const unsigned int *u)
RTformat
Definition: optix_declarations.h:63
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:2637
RTresult RTAPI rtProgramCreateFromPTXString(RTcontext context, const char *ptx, const char *program_name, RTprogram *program)
Creates a new program object.
RTresult RTAPI rtBufferGetMipLevelSize3D(RTbuffer buffer, unsigned int level, RTsize *width, RTsize *height, RTsize *depth)
Gets the width, height and depth of buffer specific MIP level.
Definition: optix_declarations.h:323
RTresult RTAPI rtBufferGetD3D9Resource(RTbuffer buffer, IDirect3DResource9 **resource)
Gets the D3D9 resource associated with this buffer.
void setMissProgram(unsigned int ray_type_index, Program program)
See rtContextSetMissProgram.
Definition: optixpp_namespace.h:2494
bool getPrintEnabled() const
See rtContextGetPrintEnabled.
Definition: optixpp_namespace.h:2555
RTresult RTAPI rtVariableGetName(RTvariable v, const char **name_return)
Queries the name of a program variable.
T getChild(unsigned int index) const
Query an indexed child within this group. See rtSelectorGetChild.
Definition: optixpp_namespace.h:2758
struct RTgeometry_api * RTgeometry
Definition: optix_host.h:75
RTresult RTAPI rtMaterialDestroy(RTmaterial material)
Destroys a material object.
RTresult RTAPI rtProgramValidate(RTprogram program)
Validates the state of a program.
unsigned int getVariableCount() const
Definition: optixpp_namespace.h:3410
void getMatrix(bool transpose, float *matrix, float *inverse_matrix) const
Get the transform matrix for this node. See rtTransformGetMatrix.
Definition: optixpp_namespace.h:3123
static unsigned int getDeviceCount()
Call rtDeviceGetDeviceCount and returns number of valid devices.
Definition: optixpp_namespace.h:1905
void launchProgressive(unsigned int entry_point_index, RTsize image_width, RTsize image_height, unsigned int max_subframes)
Definition: optixpp_namespace.h:2528
RTresult RTAPI rtTextureSamplerD3D9Unregister(RTtexturesampler textureSampler)
Declares a D3D9 texture as mutable and inaccessible by OptiX.
void setUserData(RTsize size, const void *ptr)
Set the variable to a user defined type given the sizeof the user object.
Definition: optixpp_namespace.h:4269
RTresult RTAPI rtBufferD3D10Unregister(RTbuffer buffer)
Declares a D3D10 buffer as mutable and inaccessible by OptiX.
RTresult RTAPI rtBufferD3D9Register(RTbuffer buffer)
Declares a D3D9 buffer as immutable and accessible by OptiX.
RTresult RTAPI rtTextureSamplerSetReadMode(RTtexturesampler texturesampler, RTtexturereadmode readmode)
Sets the read mode of a texture sampler.
RTresult RTAPI rtGroupCreate(RTcontext context, RTgroup *group)
Creates a new group.
RTresult RTAPI rtTextureSamplerGetArraySize(RTtexturesampler texturesampler, unsigned int *num_textures_in_array)
Gets the number of array slices present in a texture sampler.
Program getExceptionProgram(unsigned int entry_point_index) const
See rtContextGetExceptionProgram.
Definition: optixpp_namespace.h:2461
RTresult RTAPI rtVariableSet2ui(RTvariable v, unsigned int u1, unsigned int u2)
RTresult RTAPI rtTextureSamplerCreate(RTcontext context, RTtexturesampler *texturesampler)
Creates a new texture sampler object.
void setD3D10Device(ID3D10Device *device)
Set the D3D device assocaiated with this context (Windows only). See rtContextSetD3D10Device.
Definition: optixpp_namespace.h:2170
std::string getAnnotation() const
Retrieve the annotation associated with the variable.
Definition: optixpp_namespace.h:4335
RTresult RTAPI rtVariableSetMatrix4x4fv(RTvariable v, int transpose, const float *m)
RTresult RTAPI rtGeometryDestroy(RTgeometry geometry)
Destroys a geometry node.
RTresult RTAPI rtBufferSetMipLevelCount(RTbuffer buffer, unsigned int levels)
Sets the MIP level count of a buffer.
GeometryGroup createGeometryGroup()
See rtGeometryGroupCreate.
Definition: optixpp_namespace.h:2260
Program getAnyHitProgram(unsigned int ray_type_index) const
Get any hit program for this material at the given ray_type index. See rtMaterialGetAnyHitProgram.
Definition: optixpp_namespace.h:3477
static Exception makeException(RTresult code, RTcontext context)
Definition: optixpp_namespace.h:239
RTresult RTAPI rtGeometryGetContext(RTgeometry geometry, RTcontext *context)
Returns the context associated with a geometry node.
Handle< T > & operator=(const Handle< T > &copy)
Assignment of handle with same underlying object type.
Definition: optixpp_namespace.h:112
void setBuffer(unsigned int texture_array_idx, unsigned int mip_level, Buffer buffer)
Definition: optixpp_namespace.h:3652
RTresult RTAPI rtBufferMarkDirty(RTbuffer buffer)
Sets a buffer as dirty.
RTresult RTAPI rtBufferSetDevicePointer(RTbuffer buffer, unsigned int optix_device_number, CUdeviceptr device_pointer)
Sets the pointer to the buffer's data on the given device.
static Handle< T > take(typename T::api_t p)
Takes a base optix api opaque type and creates a handle to optixpp wrapper type.
Definition: optixpp_namespace.h:124
void setMatrix(bool transpose, const float *matrix, const float *inverse_matrix)
Definition: optixpp_namespace.h:3118
RTresult RTAPI rtBufferUnmap(RTbuffer buffer)
Unmaps a buffer's storage from the host.
RTresult RTAPI rtSelectorDeclareVariable(RTselector selector, const char *name, RTvariable *v)
Declares a variable associated with a Selector node.
RTresult RTAPI rtVariableSet3uiv(RTvariable v, const unsigned int *u)
RTresult RTAPI rtAccelerationSetProperty(RTacceleration acceleration, const char *name, const char *value)
Sets an acceleration structure property.
RTsize getPrintBufferSize() const
See rtContextGetPrintBufferSize.
Definition: optixpp_namespace.h:2567
RTresult RTAPI rtVariableSetMatrix2x3fv(RTvariable v, int transpose, const float *m)
RTresult RTAPI rtContextGetRayTypeCount(RTcontext context, unsigned int *num_ray_types)
Query the number of ray types associated with this context.
RTresult RTAPI rtTextureSamplerGetFilteringModes(RTtexturesampler texturesampler, RTfiltermode *minification, RTfiltermode *magnification, RTfiltermode *mipmapping)
Gets the filtering modes of a texture sampler.
RTresult RTAPI rtTextureSamplerGetWrapMode(RTtexturesampler texturesampler, unsigned int dimension, RTwrapmode *wrapmode)
Gets the wrap mode of a texture sampler.
Variable declareVariable(const std::string &name)
Definition: optixpp_namespace.h:3484
void setChildCount(unsigned int count)
Definition: optixpp_namespace.h:2998
RTresult RTAPI rtContextLaunchProgressive2D(RTcontext context, unsigned int entry_index, RTsize width, RTsize height, unsigned int max_subframes)
Executes a Progressive Launch for a given context.
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:3331
int getGPUPagingActive() const
See rtContextGetAttribute.
Definition: optixpp_namespace.h:2374
RTresult RTAPI rtMaterialQueryVariable(RTmaterial material, const char *name, RTvariable *v)
Queries for the existence of a named variable of a material.
void removeVariable(Variable v)
Remove a variable associated with this object.
Definition: optixpp_namespace.h:2600
RTresult RTAPI rtVariableSetMatrix3x2fv(RTvariable v, int transpose, const float *m)
RTresult RTAPI rtGeometrySetBoundingBoxProgram(RTgeometry geometry, RTprogram program)
Sets the bounding box program.
std::string getProperty(const std::string &name) const
Definition: optixpp_namespace.h:3169
RTtexturereadmode getReadMode() const
Query texture read mode for this sampler. See rtTextureSamplerGetReadMode.
Definition: optixpp_namespace.h:3633
RTresult RTAPI rtGeometrySetPrimitiveCount(RTgeometry geometry, unsigned int num_primitives)
Sets the number of primitives.
RTresult RTAPI rtVariableSetObject(RTvariable v, RTobject object)
Sets a program variable value to a OptiX object.
Buffer wraps the OptiX C API RTbuffer opaque type and its associated function set.
Definition: optixpp_namespace.h:1529
RTresult RTAPI rtBufferGetGLBOId(RTbuffer buffer, unsigned int *glId)
Gets the OpenGL Buffer Object ID associated with this buffer.
RTresult RTAPI rtBufferMapEx(RTbuffer buffer, unsigned int map_flags, unsigned int level, void *user_owned, void **optix_owned)
Maps mipmap level of buffer object to the host.
unsigned int getVariableCount() const
Definition: optixpp_namespace.h:3503
virtual Context getContext() const =0
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
RTresult RTAPI rtVariableGetMatrix2x4fv(RTvariable v, int transpose, float *m)
RTresult RTAPI rtContextSetEntryPointCount(RTcontext context, unsigned int num_entry_points)
Set the number of entry points for a given context.
void compile()
See rtContextCompile.
Definition: optixpp_namespace.h:2506
void setAttribute(RTcontextattribute attribute, const T &val)
See rtContextSetAttribute.
Definition: optixpp_namespace.h:2408
virtual const char * what() const
From std::exception.
Definition: optixpp_namespace.h:233
RTresult RTAPI rtTextureSamplerCreateFromGLImage(RTcontext context, unsigned int glId, RTgltarget target, RTtexturesampler *textureSampler)
Creates a new texture sampler object from an OpenGL image.
unsigned int getPrimitiveIndexOffset() const
Definition: optixpp_namespace.h:3360
RTwrapmode
Definition: optix_declarations.h:146
RTresult RTAPI rtContextGetPrintBufferSize(RTcontext context, RTsize *buffer_size_bytes)
Get the current size of the print buffer.
unsigned int addChild(T child)
Set a new child in this group and returns its new index. See rtSelectorSetChild.
Definition: optixpp_namespace.h:2773
void setFormat(RTformat format)
Definition: optixpp_namespace.h:3744
std::string getErrorString(RTresult code) const
See rtContextGetErrorString.
Definition: optixpp_namespace.h:2323
RTresult RTAPI rtContextRemoveVariable(RTcontext context, RTvariable v)
Removes a variable from the given context.
void markDirty()
Mark the buffer dirty.
Definition: optixpp_namespace.h:3785
void RTAPI rtContextGetErrorString(RTcontext context, RTresult code, const char **return_string)
Returns the error string associated with a given error.
RTresult RTAPI rtGeometryInstanceQueryVariable(RTgeometryinstance geometryinstance, const char *name, RTvariable *v)
Returns a handle to a named variable of a geometry node.
struct RTselector_api * RTselector
Definition: optix_host.h:93
RTresult RTAPI rtMaterialDeclareVariable(RTmaterial material, const char *name, RTvariable *v)
Declares a new named variable to be associated with a material.
RTresult RTAPI rtContextSetPrintLaunchIndex(RTcontext context, int x, int y, int z)
Sets the active launch index to limit text output.
Variable queryVariable(const std::string &name) const
Definition: optixpp_namespace.h:3293
RTresult RTAPI rtAccelerationValidate(RTacceleration acceleration)
Validates the state of an acceleration structure.
TextureSampler createTextureSamplerFromGLImage(unsigned int id, RTgltarget target)
Create TextureSampler from GL image. See rtTextureSamplerCreateFromGLImage.
Definition: optixpp_namespace.h:2182
RTresult RTAPI rtVariableSet1uiv(RTvariable v, const unsigned int *u)
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:3222
RTresult RTAPI rtVariableSet4i(RTvariable v, int i1, int i2, int i3, int i4)
int getCPUNumThreads() const
See rtContextGetAttribute.
Definition: optixpp_namespace.h:2360
struct RTremotedevice_api * RTremotedevice
Definition: optix_host.h:108
void setBuilder(const std::string &builder)
Specify the acceleration structure builder. See rtAccelerationSetBuilder.
Definition: optixpp_namespace.h:3176
RTresult RTAPI rtProgramRemoveVariable(RTprogram program, RTvariable v)
Removes the named variable from a program.
RTresult RTAPI rtBufferCreateFromD3D10Resource(RTcontext context, unsigned int bufferdesc, ID3D10Resource *resource, RTbuffer *buffer)
Creates a new buffer object from a D3D10 resource.
RTresult RTAPI rtVariableGet2f(RTvariable v, float *f1, float *f2)
RTresult RTAPI rtGeometryGroupSetChild(RTgeometrygroup geometrygroup, unsigned int index, RTgeometryinstance geometryinstance)
Attaches a child node to a geometry group.
RTresult RTAPI rtGroupSetChildCount(RTgroup group, unsigned int count)
Sets the number of child nodes to be attached to the group.
void * RTobject
Definition: optix_host.h:105
Buffer getBuffer() const
Get the underlying buffer used for texture storage. See rtTextureSamplerGetBuffer.
Definition: optixpp_namespace.h:3669
RTresult RTAPI rtVariableGet1ui(RTvariable v, unsigned int *u1)
RTresult RTAPI rtContextSetRemoteDevice(RTcontext context, RTremotedevice remote_dev)
Enable rendering on a remote device.
RTresult RTAPI rtBufferGetId(RTbuffer buffer, int *buffer_id)
Gets an id suitable for use with buffers of buffers.
RTresult RTAPI rtTextureSamplerSetArraySize(RTtexturesampler texturesampler, unsigned int num_textures_in_array)
Sets the array size of a texture sampler.
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:2696
RTresult RTAPI rtVariableSet1f(RTvariable v, float f1)
Functions designed to modify the value of a program variable.
Definition: optix_declarations.h:324
Variable getVariable(unsigned int index) const
Query variable by index. See rt[ObjectType]GetVariable.
Definition: optixpp_namespace.h:3417
void setChild(T child)
Definition: optixpp_namespace.h:3097
RTresult RTAPI rtVariableGetMatrix4x3fv(RTvariable v, int transpose, float *m)
RTresult RTAPI rtSelectorGetContext(RTselector selector, RTcontext *context)
Returns the context of a Selector node.
RTresult RTAPI rtTextureSamplerGLRegister(RTtexturesampler textureSampler)
Declares an OpenGL texture as immutable and accessible by OptiX.
void set1fv(const float *f)
Set variable value to a scalar float.
Definition: optixpp_namespace.h:4183
RTresult RTAPI rtVariableSetMatrix3x4fv(RTvariable v, int transpose, const float *m)
The Handle class is a reference counted handle class used to manipulate API objects.
Definition: optixpp_namespace.h:92
Geometry wraps the OptiX C API RTgeometry opaque type and its associated function set...
Definition: optixpp_namespace.h:1300
RTresult RTAPI rtBufferCreateFromGLBO(RTcontext context, unsigned int bufferdesc, unsigned int glId, RTbuffer *buffer)
Creates a new buffer object from an OpenGL buffer object.
RTresult RTAPI rtBufferMap(RTbuffer buffer, void **user_pointer)
Maps a buffer object to the host.
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:3737
RTresult RTAPI rtRemoteDeviceRelease(RTremotedevice remote_dev)
Release reserved nodes on a remote device.
std::string getTraverser() const
Query the acceleration structure traverser. See rtAccelerationGetTraverser.
Definition: optixpp_namespace.h:3193
void setEntryPointCount(unsigned int num_entry_points)
See rtContextSetEntryPointCount.
Definition: optixpp_namespace.h:2430
RTresult RTAPI rtContextSetPrintEnabled(RTcontext context, int enabled)
Enable or disable text printing from programs.
static Context create()
Creates a Context object. See rtContextCreate.
Definition: optixpp_namespace.h:1930
RTresult RTAPI rtGroupSetAcceleration(RTgroup group, RTacceleration acceleration)
Set the acceleration structure for a group.
RTresult RTAPI rtContextLaunch2D(RTcontext context, unsigned int entry_point_index, RTsize image_width, RTsize image_height)
RTresult RTAPI rtProgramCreateFromPTXFile(RTcontext context, const char *filename, const char *program_name, RTprogram *program)
Creates a new program object.
RTresult RTAPI rtGeometryInstanceGetMaterialCount(RTgeometryinstance geometryinstance, unsigned int *count)
Returns the number of attached materials.
unsigned int getMipLevelCount() const
Query number of mipmap levels of buffer. See rtBufferGetMipLevelCount.
Definition: optixpp_namespace.h:3857
RTobjecttype getType() const
Query the object type of the variable.
Definition: optixpp_namespace.h:4342
RTresult RTAPI rtTransformGetContext(RTtransform transform, RTcontext *context)
Returns the context of a Transform node.
RTresult RTAPI rtContextSetStackSize(RTcontext context, RTsize stack_size_bytes)
Set the stack size for a given context.
TextureSampler createTextureSamplerFromD3D11Resource(ID3D11Resource *pResource)
Create TextureSampler from D3D11 image. Windows only. See rtTextureSamplerCreateFromD3D11Resource.
Definition: optixpp_namespace.h:2158
Buffer createBufferFromD3D11Resource(unsigned int type, ID3D11Resource *pResource)
Create buffer from D3D11 buffer object. Windows only. See rtBufferCreateFromD3D11Resource.
Definition: optixpp_namespace.h:2137
void removeVariable(Variable v)
Remove a variable associated with this object.
Definition: optixpp_namespace.h:3498
RTsize getSize() const
Get the size of the variable data in bytes (eg, float4 returns 4*sizeof(float) )
Definition: optixpp_namespace.h:4354
RTresult RTAPI rtTextureSamplerSetBuffer(RTtexturesampler texturesampler, unsigned int deprecated0, unsigned int deprecated1, RTbuffer buffer)
Attaches a buffer object to a texture sampler.
void registerD3D11Texture()
Declare the texture's buffer as immutable and accessible by OptiX. See rtTextureSamplerD3D11Register...
Definition: optixpp_namespace.h:3703
RTresult RTAPI rtAccelerationIsDirty(RTacceleration acceleration, int *dirty)
Returns the dirty flag of an acceleration structure.
void unregisterD3D9Buffer()
Unregister the buffer, re-enabling OptiX operations. See rtTextureSamplerD3D9Unregister.
Definition: optixpp_namespace.h:3905
Geometry createGeometry()
See rtGeometryCreate.
Definition: optixpp_namespace.h:2210
unsigned int getRayTypeCount() const
See rtContextGetRayTypeCount.
Definition: optixpp_namespace.h:2487
RTresult RTAPI rtRemoteDeviceReserve(RTremotedevice remote_dev, unsigned int num_nodes, unsigned int configuration)
Reserve nodes for rendering on a remote device.
RTresult RTAPI rtVariableSet3iv(RTvariable v, const int *i)
virtual void checkError(RTresult code) const
Definition: optixpp_namespace.h:1871
void unregisterGLBuffer()
Unregister the buffer, re-enabling OptiX operations. See rtTextureSamplerGLUnregister.
Definition: optixpp_namespace.h:3883
RTresult RTAPI rtProgramDestroy(RTprogram program)
Destroys a program object.
RTresult RTAPI rtTextureSamplerSetIndexingMode(RTtexturesampler texturesampler, RTtextureindexmode indexmode)
Sets whether texture coordinates for this texture sampler are normalized.
RTresult RTAPI rtSelectorGetChildType(RTselector selector, unsigned int index, RTobjecttype *type)
Returns type information about a Selector child node.
RTresult RTAPI rtAccelerationGetTraverser(RTacceleration acceleration, const char **return_string)
Query the current traverser from an acceleration structure.
virtual unsigned int getVariableCount() const =0
void setMipLevelClamp(float minLevel, float maxLevel)
Set minimum and maxnimum mipmap levels for this sampler. See rtTextureSamplerSetMipLevelClamp.
Definition: optixpp_namespace.h:3599
RTresult RTAPI rtTextureSamplerGetMipLevelBias(RTtexturesampler texturesampler, float *value)
Gets the mipmap offset for a texture sampler.
RTfiltermode
Definition: optix_declarations.h:155
void * map()
Definition: optixpp_namespace.h:3943
RTresult RTAPI rtBufferGetMipLevelSize1D(RTbuffer buffer, unsigned int level, RTsize *width)
Gets the width of buffer specific MIP level.
RTresult RTAPI rtBufferSetAttribute(RTbuffer buffer, RTbufferattribute attrib, RTsize size, void *p)
Set a buffer attribute.
void setMaxAnisotropy(float value)
Set maximum anisotropy for this sampler. See rtTextureSamplerSetMaxAnisotropy.
Definition: optixpp_namespace.h:3587
RTresult RTAPI rtTextureSamplerCreateFromD3D11Resource(RTcontext context, ID3D11Resource *resource, RTtexturesampler *textureSampler)
Creates a new texture sampler object from a D3D11 resource.
RTresult RTAPI rtContextGetStackSize(RTcontext context, RTsize *stack_size_bytes)
Query the stack size for this context.
void setExceptionEnabled(RTexception exception, bool enabled)
See rtContextSetExceptionEnabled.
Definition: optixpp_namespace.h:2469
Handle()
Default constructor initializes handle to null pointer.
Definition: optixpp_namespace.h:95
RTresult RTAPI rtTextureSamplerSetMaxAnisotropy(RTtexturesampler texturesampler, float value)
Sets the maximum anisotropy of a texture sampler.
RTresult RTAPI rtGeometryInstanceSetGeometry(RTgeometryinstance geometryinstance, RTgeometry geometry)
Attaches a Geometry node.
RTcontextattribute
Definition: optix_declarations.h:321
RTresult RTAPI rtBufferGetSize1D(RTbuffer buffer, RTsize *width)
Get the width of this buffer.
RTresult RTAPI rtContextSetMissProgram(RTcontext context, unsigned int ray_type_index, RTprogram program)
Specifies the miss program for a given context ray type.
RTresult RTAPI rtGroupGetChildType(RTgroup group, unsigned int index, RTobjecttype *type)
Get the type of a group child.
RTresult RTAPI rtGroupValidate(RTgroup group)
Verifies the state of the group.
RTresult RTAPI rtBufferGetMipLevelSize2D(RTbuffer buffer, unsigned int level, RTsize *width, RTsize *height)
Gets the width, height of buffer specific MIP level.
optix::int3 getPrintLaunchIndex() const
See rtContextGetPrintLaunchIndex.
Definition: optixpp_namespace.h:2579
void validate()
call rt[ObjectType]Validate on the underlying OptiX C object
Definition: optixpp_namespace.h:2974
Definition: optix_declarations.h:243
Definition: optix_declarations.h:288
Handle< VariableObj > operator[](const std::string &varname)
Definition: optixpp_namespace.h:571
RTresult RTAPI rtVariableSetMatrix2x4fv(RTvariable v, int transpose, const float *m)
RTresult RTAPI rtGeometryInstanceDestroy(RTgeometryinstance geometryinstance)
Destroys a geometry instance node.
void setChild(unsigned int index, T child)
Set an indexed child child of this group. See rtSelectorSetChild.
Definition: optixpp_namespace.h:2752
RTresult RTAPI rtVariableGet3i(RTvariable v, int *i1, int *i2, int *i3)
virtual Variable declareVariable(const std::string &name)=0
void unregisterD3D11Buffer()
Unregister the buffer, re-enabling OptiX operations. See rtTextureSamplerD3D11Unregister.
Definition: optixpp_namespace.h:3915
RTresult RTAPI rtContextDestroy(RTcontext context)
Destroys a context and frees all associated resources.
Acceleration getAcceleration() const
Query the Acceleration structure for this group. See rtGeometryGroupGetAcceleration.
Definition: optixpp_namespace.h:2991
RTremotedeviceattribute
Definition: optix_declarations.h:296
Variable object wraps OptiX C API RTvariable type and its related function set.
Definition: optixpp_namespace.h:387
RTobjecttype getChildType(unsigned int index) const
Query indexed child's type. See rtSelectorGetChildType.
Definition: optixpp_namespace.h:2765
virtual Variable getVariable(unsigned int index) const =0
Query variable by index. See rt[ObjectType]GetVariable.
RTresult RTAPI rtGeometryGetVariableCount(RTgeometry geometry, unsigned int *count)
Returns the number of attached variables.
RTresult RTAPI rtTextureSamplerGetMipLevelClamp(RTtexturesampler texturesampler, float *minLevel, float *maxLevel)
Gets the minimum and the maximum MIP level access range for a texture sampler.
RTsize getAvailableDeviceMemory(int ordinal) const
See rtContextGetAttribute.
Definition: optixpp_namespace.h:2388
Definition: optix_declarations.h:238
void setPrintEnabled(bool enabled)
Definition: optixpp_namespace.h:2550
T * operator->()
Dereferences the handle.
Definition: optixpp_namespace.h:130
void setRayGenerationProgram(unsigned int entry_point_index, Program program)
Definition: optixpp_namespace.h:2443
void unregisterGLTexture()
Declare the texture's buffer as mutable and inaccessible by OptiX. See rtTextureSamplerGLUnregister.
Definition: optixpp_namespace.h:3686
RTresult RTAPI rtTextureSamplerGetMipLevelCount(RTtexturesampler texturesampler, unsigned int *num_mip_levels)
Gets the number of MIP levels in a texture sampler.
void destroy()
call rt[ObjectType]Destroy on the underlying OptiX C object
Definition: optixpp_namespace.h:3077
struct RTtransform_api * RTtransform
Definition: optix_host.h:99
RTresult RTAPI rtTextureSamplerSetWrapMode(RTtexturesampler texturesampler, unsigned int dimension, RTwrapmode wrapmode)
Sets the wrapping mode of a texture sampler.
Program getBoundingBoxProgram() const
Get the bounding box program for this geometry. See rtGeometryGetBoundingBoxProgram.
Definition: optixpp_namespace.h:3372
RTresult RTAPI rtContextGetPrintEnabled(RTcontext context, int *enabled)
Query whether text printing from programs is enabled.
void getSize(RTsize &width) const
Query 1D buffer dimension. See rtBufferGetSize1D.
Definition: optixpp_namespace.h:3795
void setGeometry(Geometry geometry)
Definition: optixpp_namespace.h:3241
RTresult RTAPI rtBufferGetElementSize(RTbuffer buffer, RTsize *size_of_element)
Returns the size of a buffer's individual elements.
RTresult RTAPI rtRemoteDeviceCreate(const char *url, const char *username, const char *password, RTremotedevice *remote_dev)
Create a device for remote rendering on VCAs.
struct RTcontext_api * RTcontext
Definition: optix_host.h:72
RTresult RTAPI rtVariableSet1ui(RTvariable v, unsigned int u1)
void registerD3D10Buffer()
Declare the texture's buffer as mutable and inaccessible by OptiX. See rtBufferD3D10Register.
Definition: optixpp_namespace.h:3895
RTresult RTAPI rtVariableGet1i(RTvariable v, int *i1)
void registerD3D9Texture()
Definition: optixpp_namespace.h:3693
RTresult RTAPI rtSelectorGetChild(RTselector selector, unsigned int index, RTobject *child)
Returns a child node that is attached to a Selector node.
RTresult RTAPI rtGeometryInstanceGetContext(RTgeometryinstance geometryinstance, RTcontext *context)
Returns the context associated with a geometry instance node.
Buffer createMipmappedBuffer(unsigned int type, RTformat format, RTsize width, unsigned int levels)
Definition: optixpp_namespace.h:1984
RTresult RTAPI rtBufferD3D10Register(RTbuffer buffer)
Declares a D3D10 buffer as immutable and accessible by OptiX.
RTresult RTAPI rtVariableGetMatrix3x4fv(RTvariable v, int transpose, float *m)
int getGPUPagingForcedOff() const
See rtContextGetAttribute.
Definition: optixpp_namespace.h:2381
RTresult RTAPI rtVariableSet4iv(RTvariable v, const int *i)
RTresult RTAPI rtVariableSet1fv(RTvariable v, const float *f)
RTresult RTAPI rtMaterialValidate(RTmaterial material)
Verifies the state of a material.
RTresult RTAPI rtBufferGetD3D11Resource(RTbuffer buffer, ID3D11Resource **resource)
Gets the D3D11 resource associated with this buffer.
RTresult RTAPI rtVariableSet2iv(RTvariable v, const int *i)
void checkError(RTresult code) const
Definition: optixpp_namespace.h:1899
RTresult RTAPI rtContextSetRayTypeCount(RTcontext context, unsigned int num_ray_types)
Sets the number of ray types for a given context.
RTselector get()
Get the underlying OptiX C API RTselector opaque pointer.
Definition: optixpp_namespace.h:2859
RTsize getStackSize() const
See rtContextGetStackSize.
Definition: optixpp_namespace.h:2418
RTresult RTAPI rtSelectorSetChildCount(RTselector selector, unsigned int count)
Specifies the number of child nodes to be attached to a Selector node.
RTresult RTAPI rtBufferValidate(RTbuffer buffer)
Validates the state of a buffer.
struct RTgeometrygroup_api * RTgeometrygroup
Definition: optix_host.h:81
void getMipLevelSize(unsigned int level, RTsize &width) const
Query 1D buffer dimension of specific MIP level. See rtBufferGetMipLevelSize1D.
Definition: optixpp_namespace.h:3800
RTresult RTAPI rtSelectorGetVisitProgram(RTselector selector, RTprogram *program)
Returns the currently assigned visit program.
static Handle< T > create(const std::string &a, const std::string &b, const std::string &c)
Static RemoteDevice creation. Only valid for remote devices.
Definition: optixpp_namespace.h:169
RTresult RTAPI rtGeometryGroupSetAcceleration(RTgeometrygroup geometrygroup, RTacceleration acceleration)
Set the acceleration structure for a group.
Handle(const Handle< T > &copy)
Takes a handle of the same type and creates a handle.
Definition: optixpp_namespace.h:105
Base class for all reference counted wrappers around OptiX C API opaque types.
Definition: optixpp_namespace.h:269
void unregisterD3D10Texture()
Declare the texture's buffer as mutable and inaccessible by OptiX. See rtTextureSamplerD3D10Unregiste...
Definition: optixpp_namespace.h:3713
RTresult RTAPI rtSelectorRemoveVariable(RTselector selector, RTvariable v)
Removes a variable from a Selector node.
RTresult RTAPI rtContextGetAttribute(RTcontext context, RTcontextattribute attrib, RTsize size, void *p)
Returns an attribute specific to an OptiX context.
RTbuffer get()
Get the underlying OptiX C API RTbuffer opaque pointer.
Definition: optixpp_namespace.h:3977
void setChildCount(unsigned int count)
Definition: optixpp_namespace.h:2739
unsigned int getVariableCount() const
Definition: optixpp_namespace.h:3305
RTresult RTAPI rtTextureSamplerD3D10Unregister(RTtexturesampler textureSampler)
Declares a D3D10 texture as mutable and inaccessible by OptiX.
RTresult RTAPI rtRemoteDeviceGetAttribute(RTremotedevice remote_dev, RTremotedeviceattribute attrib, RTsize size, void *p)
Queries attributes of a remote device.
Program getVisitProgram() const
Get the visitor program for this selector. See rtSelectorGetVisitProgram.
Definition: optixpp_namespace.h:2732
RTresult RTAPI rtBufferGetDimensionality(RTbuffer buffer, unsigned int *dimensionality)
Gets the dimensionality of this buffer object.
Program createProgramFromPTXString(const std::string &ptx, const std::string &program_name)
See rtProgramCreateFromPTXString.
Definition: optixpp_namespace.h:2302
void setPrintBufferSize(RTsize buffer_size_bytes)
See rtContextSetPrintBufferSize.
Definition: optixpp_namespace.h:2562
Handle(U *ptr)
Takes a raw pointer of arbitrary type and creates a handle.
Definition: optixpp_namespace.h:102
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:3453
RTresult RTAPI rtContextSetD3D9Device(RTcontext context, IDirect3DDevice9 *device)
Binds a D3D9 device to a context and enables interop.
RTresult RTAPI rtVariableGetUserData(RTvariable v, RTsize size, void *ptr)
Defined.
void setD3D11Device(ID3D11Device *device)
Set the D3D device assocaiated with this context (Windows only). See rtContextSetD3D11Device.
Definition: optixpp_namespace.h:2175
RTresult RTAPI rtGeometryGroupCreate(RTcontext context, RTgeometrygroup *geometrygroup)
Creates a new geometry group.
TextureSampler createTextureSampler()
See rtTextureSamplerCreate.
Definition: optixpp_namespace.h:2316
Context getContext() const
Retrieve the context this object is associated with. See rt[ObjectType]GetContext.
Definition: optixpp_namespace.h:3089
int getId() const
Definition: optixpp_namespace.h:2677