Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:03

0001 #pragma once
0002 /**
0003 Six : backward compatibility layer :  enabling new workflow CSGFoundry geometry to be used with OptiX < 7 
0004 ===========================================================================================================
0005 
0006 **/
0007 
0008 #include <map>
0009 #include <vector>
0010 #include <optixu/optixpp_namespace.h>
0011 
0012 struct qat4 ; 
0013 
0014 //class Opticks ; 
0015 
0016 struct CSGFoundry ; 
0017 struct CSGSolid ; 
0018 
0019 struct Params ; 
0020 struct Frame ; 
0021 
0022 struct Six
0023 {
0024     //const Opticks*          ok ; 
0025     //const std::vector<unsigned>&  solid_selection ; 
0026 
0027     std::vector<unsigned>   solid_selection ; 
0028     unsigned long long      emm ; 
0029 
0030     optix::Context     context ;
0031     optix::Material    material ;
0032 
0033     // note that output buffers cannot with replaced with plain CUDA buffers
0034     // so must create these optix::Buffer and then grab their CUDA pointers 
0035     optix::Buffer      pixel_buffer ;    // uchar4
0036     optix::Buffer      isect_buffer ;    // float4
0037     optix::Buffer      photon_buffer ;   // quad4
0038 
0039     uchar4* d_pixel ; 
0040     float4* d_isect ; 
0041     quad4*  d_photon ; 
0042 
0043     Params*           params ; 
0044     const char*       ptx_path ; 
0045     const char*       geo_ptx_path ; 
0046     unsigned          entry_point_index ; 
0047     unsigned          optix_device_ordinal ; 
0048     const CSGFoundry* foundry ; 
0049     int               pindex ; 
0050 
0051     std::map<unsigned, optix::Geometry> solids ; 
0052 
0053     std::vector<optix::Group>    groups ; 
0054 
0055     Six(const char* ptx_path, const char* geo_ptx_path, Params* params_);  
0056     void initContext();
0057     void initFrame(); 
0058 
0059     void updateContext();  // for changed params such as viewpoint 
0060     void initPipeline();
0061     void setFoundry(const CSGFoundry* foundry);
0062 
0063     void createGeom();
0064     void createContextInputBuffers();
0065     void createGAS();
0066     void createGAS_Standard();
0067     void createGAS_Selection();
0068     void createIAS();
0069     void createIAS_Standard();
0070     void createIAS_Selection();
0071 
0072     template<typename T> void createContextInputBuffer( T* d_ptr, unsigned num_item, const char* name ); 
0073     optix::Group              createIAS(unsigned ias_idx);
0074     optix::Group              createIAS(const std::vector<qat4>& inst );
0075     optix::Group              createSolidSelectionIAS(unsigned ias_idx, const std::vector<unsigned>& solid_selection);
0076 
0077     optix::GeometryInstance   createGeometryInstance(unsigned solid_idx, unsigned identity);
0078     optix::Geometry           createGeometry(unsigned solid_idx);
0079     optix::Geometry           getGeometry(unsigned solid_idx) const ;  
0080  
0081     void setTop(const char* spec);
0082     void launch(unsigned width, unsigned height, unsigned depth);
0083 
0084     //void snap(const char* path, const char* bottom_line, const char* top_line, unsigned line_height) ;
0085 
0086 };