changeset 1389:5c83be3a6be5

split SDL / common + RtViewer rename + html test file
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 28 Apr 2020 08:58:41 +0200
parents 240531afdd2d
children 57e06087d357
files Samples/Common/RtViewer.cpp Samples/Sdl/RtViewer/RtViewerSdl.cpp Samples/WebAssembly/RtViewer/CMakeLists.txt Samples/WebAssembly/RtViewer/RtViewerWasm.html
diffstat 4 files changed, 16 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Samples/Common/RtViewer.cpp	Tue Apr 28 08:57:39 2020 +0200
+++ b/Samples/Common/RtViewer.cpp	Tue Apr 28 08:58:41 2020 +0200
@@ -334,6 +334,7 @@
     }
     else if (viewport_->IsRefreshEvent(event))
     {
+      // the viewport has been invalidated and requires repaint
       viewport_->Paint();
     }
   }
--- a/Samples/Sdl/RtViewer/RtViewerSdl.cpp	Tue Apr 28 08:57:39 2020 +0200
+++ b/Samples/Sdl/RtViewer/RtViewerSdl.cpp	Tue Apr 28 08:58:41 2020 +0200
@@ -52,11 +52,6 @@
     namespace po = boost::program_options;
     po::options_description desc("Usage:");
 
-    //ctLoader->LoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa");  // CT
-    //doseLoader->LoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb");  // RT-DOSE
-    //rtstructLoader->LoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9");  // RT-STRUCT
-
-
     desc.add_options()
       ("loglevel", po::value<std::string>()->default_value("WARNING"),
        "You can choose WARNING, INFO or TRACE for the logging level: Errors and warnings will always be displayed. (default: WARNING)")
@@ -123,8 +118,8 @@
       Scene2D& scene = controller.GetScene();
       ICompositor& compositor = lock->GetCompositor();
 
-      // False means we do NOT let Windows treat this as a legacy application
-      // that needs to be scaled
+      // False means we do NOT let a hi-DPI aware desktop managedr treat this as a legacy application that requires
+      // scaling.
       controller.FitContent(compositor.GetCanvasWidth(), compositor.GetCanvasHeight());
 
       glEnable(GL_DEBUG_OUTPUT);
@@ -141,7 +136,7 @@
     loadersContext_->StartOracle();
 
     /**
-    It is very important that the Oracle (responsible for network I/O be started before creating and firing the 
+    It is very important that the Oracle (responsible for network I/O) be started before creating and firing the 
     loaders, for any command scheduled by the loader before the oracle is started will be lost.
     */
     PrepareLoadersAndSlicers();
@@ -150,8 +145,6 @@
 
     while (!stopApplication)
     {
-      //compositor.Refresh(scene);
-
       SDL_Event event;
       while (!stopApplication && SDL_PollEvent(&event))
       {
@@ -163,7 +156,7 @@
         else if (event.type == SDL_WINDOWEVENT &&
                  event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
         {
-          DisableTracker(); // was: tracker.reset(NULL);
+          DisableTracker();
         }
         else if (event.type == SDL_KEYDOWN &&
                  event.key.repeat == 0 /* Ignore key bounce */)
@@ -171,8 +164,8 @@
           switch (event.key.keysym.sym)
           {
           case SDLK_f:
-            // TODO: implement GetWindow!!!
-            // viewport_->GetContext()->GetWindow().ToggleMaximize();
+            // TODO: implement GetWindow to be able to do:
+            // viewport_->GetWindow().ToggleMaximize();
             ORTHANC_ASSERT(false, "Please implement GetWindow()");
             break;
           case SDLK_q:
@@ -182,6 +175,8 @@
             break;
           }
         }
+        // the code above is rather application-neutral.
+        // the following call handles events specific to the application
         HandleApplicationEvent(event);
       }
       SDL_Delay(1);
--- a/Samples/WebAssembly/RtViewer/CMakeLists.txt	Tue Apr 28 08:57:39 2020 +0200
+++ b/Samples/WebAssembly/RtViewer/CMakeLists.txt	Tue Apr 28 08:58:41 2020 +0200
@@ -59,20 +59,21 @@
 # Declare installation files for the module
 # ---------------------------------------------------------------
 install(
-  TARGETS CtDoseStructViewerWasm
+  TARGETS RtViewerWasm
   RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
   )
 
 # Declare installation files for the companion files (web scaffolding)
-# please note that ${CMAKE_CURRENT_BINARY_DIR}/SingleFrameViewerWasm.js 
+# please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js
 # (the generated JS loader for the WASM module) is handled by the `install1`
-# section above
+# section above: it is considered to be the binary output of 
+# the linker.
 # ---------------------------------------------------------------
 install(
   FILES
-  ${CMAKE_SOURCE_DIR}/CtDoseStructViewerApp.js
+  ${CMAKE_SOURCE_DIR}/RtViewerApp.js
   ${CMAKE_SOURCE_DIR}/index.html
-  ${CMAKE_CURRENT_BINARY_DIR}/CtDoseStructViewerWasm.wasm
+  ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.wasm
   ${CMAKE_SOURCE_DIR}/WasmWrapper.js
   DESTINATION ${CMAKE_INSTALL_PREFIX}
   )
--- a/Samples/WebAssembly/RtViewer/RtViewerWasm.html	Tue Apr 28 08:57:39 2020 +0200
+++ b/Samples/WebAssembly/RtViewer/RtViewerWasm.html	Tue Apr 28 08:58:41 2020 +0200
@@ -54,7 +54,6 @@
     <canvas id="mycanvas2" oncontextmenu="return false;"></canvas>
     <canvas id="mycanvas3" oncontextmenu="return false;"></canvas>
 
-    <script type="text/javascript" src="app.js"></script>
-    <script type="text/javascript" async src="CtDoseStructViewer.js"></script>
+    <script src="RtViewerWasmApp.js"></script>
   </body>
 </html>