Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #include "NP.hh"
0002 #include "QTex.hh"
0003 #include "QTexMaker.hh"
0004 #include "OPTICKS_LOG.hh"
0005 
0006 //struct QTex<float4> ; 
0007 
0008 
0009 NP* make_array(unsigned ni, unsigned nj, unsigned nk)
0010 {
0011     std::vector<float> src ; 
0012     for(unsigned i=0 ; i < ni ; i++)
0013     for(unsigned j=0 ; j < nj ; j++)
0014     for(unsigned k=0 ; k < nk ; k++)
0015     {
0016         float val = float(i*100 + j*10 + k) ;  
0017         src.push_back(val); 
0018     }
0019 
0020     NP* a = NP::Make<float>( ni, nj, nk ); 
0021     a->read(src.data()) ; 
0022     a->set_meta<unsigned>("hd_factor", 10); 
0023 
0024     return a ; 
0025 }
0026 
0027 int main(int argc, char** argv)
0028 {
0029     OPTICKS_LOG(argc, argv); 
0030 
0031     const NP* a = make_array( 5, 10, 4 ); 
0032     char filterMode = 'P' ;  // <-- P:Point with interpolation disabled,   L:linear interpolation
0033     unsigned hd_factor = a->get_meta<unsigned>("hd_factor"); 
0034     assert( hd_factor > 0 ); 
0035     bool normalizedCoords = false ;  
0036 
0037     QTex<float4>* tex = QTexMaker::Make2d_f4(a, filterMode, normalizedCoords ); 
0038     assert(tex); 
0039 
0040     tex->setHDFactor(hd_factor); 
0041     tex->uploadMeta(); 
0042 
0043     // TODO: lookup checks on the GPU texture, like QScint 
0044 
0045 
0046     return 0 ; 
0047 }
0048 
0049