Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002 SGLFW_Evt_test.cc
0003 ============================
0004 
0005 Started from SOPTIX_Scene_test.cc, a pure CUDA ppm render of optix triangles,
0006 added OpenGL interop viz for interactive view and parameter changing.
0007 
0008 Usage and impl::
0009 
0010     ~/o/sysrap/tests/SGLFW_Evt_test.sh
0011     ~/o/sysrap/tests/SGLFW_Evt_test.cc
0012 
0013 For a simpler non-encapsulated non-interactive OptiX only ppm render test, see::
0014 
0015     ~/o/sysrap/tests/SOPTIX_Scene_test.sh
0016     ~/o/sysrap/tests/SOPTIX_Scene_test.cc
0017 
0018 DONE: view maths for raytrace and rasterized now match each other quite closely
0019 
0020 **/
0021 
0022 #include "ssys.h"
0023 #include "spath.h"
0024 #include "SGLM.h"
0025 #include "stree.h"
0026 #include "SScene.h"
0027 #include "SRecord.h"
0028 #include "SGLFW.h"
0029 #include "SGLFW_Scene.h"
0030 #include "SGLFW_Evt.h"
0031 
0032 int main()
0033 {
0034     bool DUMP = ssys::getenvbool("SGLFW_Evt_test_DUMP");
0035 
0036     const char* ss = spath::Resolve("$CFBaseFromGEOM/CSGFoundry/SSim") ;
0037     SScene* scene = SScene::Load(ss) ;
0038     stree* tree = stree::Load(ss);
0039     if(DUMP) std::cout << scene->desc() ;
0040 
0041     SRecord* ar = SRecord::Load("$AFOLD") ;
0042     SRecord* br = SRecord::Load("$BFOLD") ;
0043 
0044     if(DUMP) std::cout
0045          << " ar " << ( ar ? ar->desc() : "-" ) << "\n"
0046          << " br " << ( br ? br->desc() : "-" ) << "\n"
0047          ;
0048 
0049 
0050     SGLM gm ;
0051     gm.setTreeScene(tree, scene);
0052     gm.setRecord( ar, br );
0053 
0054     SGLFW gl(gm);
0055     SGLFW_Evt   ev(gl);
0056     SGLFW_Scene sc(gl);
0057 
0058     while(gl.renderloop_proceed())
0059     {
0060         gl.renderloop_head();
0061         gl.handle_frame_hop();
0062 
0063         if(gm.option.M) sc.render();
0064         ev.render();
0065 
0066         gl.renderloop_tail();
0067     }
0068     return 0 ;
0069 }
0070