|
|
|||
File indexing completed on 2026-04-10 07:49:32
0001 /** 0002 CSGOptiXSimtraceTest : used from cxs.sh 0003 =========================================== 0004 0005 Using as much as possible the CSGOptiX rendering machinery 0006 to do simulation. Using CSGOptiX raygen mode 1 which flips the case statement 0007 in the __raygen__rg program. 0008 0009 The idea is to minimize code divergence between ray trace rendering and 0010 ray trace enabled simulation. Because after all the point of the rendering 0011 is to be able to see the exact same geometry that the simulation is using. 0012 0013 :: 0014 0015 MOI=Hama CEGS=5:0:5:1000 CSGOptiXSimtraceTest 0016 MOI=Hama CEGS=10:0:10:1000 CSGOptiXSimtraceTest 0017 0018 TODO: 0019 find way to get sdf distances for all intersects GPU side 0020 using GPU side buffer of positions 0021 0022 just need to run the distance function for all points and with 0023 the appropriate CSGNode root and num_node 0024 0025 does not need OptiX, just CUDA (or it can be done CPU side also) 0026 0027 **/ 0028 0029 #include <cuda_runtime.h> 0030 0031 #include "scuda.h" 0032 #include "sqat4.h" 0033 0034 #ifdef WITH_OLD_FRAME 0035 #include "sframe.h" 0036 #else 0037 #include "sfr.h" 0038 #include "stree.h" 0039 #endif 0040 0041 0042 #include "SSim.hh" 0043 #include "SOpticks.hh" 0044 #include "SEvt.hh" 0045 #include "SFrameGenstep.hh" 0046 #include "SEventConfig.hh" 0047 0048 #include "OPTICKS_LOG.hh" 0049 #include "CSGFoundry.h" 0050 #include "CSGOptiX.h" 0051 #include "QSim.hh" 0052 0053 int main(int argc, char** argv) 0054 { 0055 OPTICKS_LOG(argc, argv); 0056 SEventConfig::SetRGModeSimtrace(); 0057 0058 const char* comp = "genstep,simtrace" ; 0059 SEventConfig::SetGatherComp(comp); 0060 SEventConfig::SetSaveComp(comp); 0061 // TODO: this config is automated now, check that and remove 0062 0063 SOpticks::WriteOutputDirScript() ; // writes CSGOptiXSimtraceTest_OUTPUT_DIR.sh in PWD 0064 0065 SEvt* evt = SEvt::Create(SEvt::EGPU) ; 0066 0067 CSGFoundry* fd = CSGFoundry::Load(); 0068 stree* tree = fd->getTree(); 0069 0070 #ifdef WITH_OLD_FRAME 0071 sframe fr = fd->getFrame() ; // depends on MOI, fr.ce fr.m2w fr.w2m set by CSGTarget::getFrame 0072 std::cout << "[ main fr" << std::endl << fr << std::endl << "] main fr" << std::endl ; 0073 evt->setFrame(fr); // formerly this added CE gensteps, now need to SEvt::BeginOfEvent ? 0074 #else 0075 sfr fr = tree->get_frame_moi(); 0076 evt->setFr(fr); 0077 #endif 0078 0079 0080 CSGOptiX* cx = CSGOptiX::Create(fd); 0081 0082 //sfr lfr = fr.spawn_lite(); 0083 //cx->setFrame(lfr); 0084 0085 0086 // This seems funny as cx has fd which is the source of the fr : so could be automatic ? 0087 // Not so easy as which frame to use depends on running mode and user input 0088 // so best to not hide it. 0089 0090 cx->simtrace(0); 0091 0092 cudaDeviceSynchronize(); 0093 0094 evt->save(); // uses SGeo::LastUploadCFBase_OutDir to place outputs into CFBase/ExecutableName folder sibling to CSGFoundry 0095 0096 0097 return 0 ; 0098 }
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|