SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLInterface.cpp File Reference

Implementation of the main Scene Library C-Interface. More...

#include <SLInterface.h>
#include <AppCommon.h>
#include <SLAssimpImporter.h>
#include <SLAssetManager.h>
#include <SLAssetLoader.h>
#include <SLInputManager.h>
#include <SLScene.h>
#include <SLSceneView.h>
#include <SLImGui.h>
#include <Profiler.h>
#include <ZipUtils.h>
Include dependency graph for SLInterface.cpp:

Go to the source code of this file.

Functions

void slCreateApp (SLVstring &cmdLineArgs, const SLstring &dataPath, const SLstring &shaderPath, const SLstring &modelPath, const SLstring &texturePath, const SLstring &fontPath, const SLstring &videoPath, const SLstring &configPath, const SLstring &applicationName)
 
SLint slCreateSceneView (SLAssetManager *am, SLScene *scene, int screenWidth, int screenHeight, int dotsPerInch, SLSceneID initScene, void *onWndUpdateCallback, void *onSelectNodeMeshCallback, void *onNewSceneViewCallback, void *onImGuiBuild, void *onImGuiLoadConfig, void *onImGuiSaveConfig)
 
void slLoadCoreAssetsSync ()
 
void slLoadCoreAssetsAsync ()
 
void slSwitchScene (SLSceneView *sv, SLSceneID sceneID)
 
SLSceneViewslNewSceneView (SLScene *s, int dotsPerInch, SLInputManager &inputManager)
 
bool slShouldClose ()
 
void slShouldClose (bool val)
 
void slTerminate ()
 
bool slUpdateParallelJob ()
 
bool slPaintAllViews ()
 
void slResize (int sceneViewIndex, int width, int height)
 
void slMouseDown (int sceneViewIndex, SLMouseButton button, int xpos, int ypos, SLKey modifier)
 
void slMouseMove (int sceneViewIndex, int x, int y)
 
void slMouseUp (int sceneViewIndex, SLMouseButton button, int xpos, int ypos, SLKey modifier)
 
void slDoubleClick (int sceneViewIndex, SLMouseButton button, int xpos, int ypos, SLKey modifier)
 
void slTouch2Down (int sceneViewIndex, int xpos1, int ypos1, int xpos2, int ypos2)
 
void slTouch2Move (int sceneViewIndex, int xpos1, int ypos1, int xpos2, int ypos2)
 
void slTouch2Up (int sceneViewIndex, int xpos1, int ypos1, int xpos2, int ypos2)
 
void slMouseWheel (int sceneViewIndex, int pos, SLKey modifier)
 
void slKeyPress (int sceneViewIndex, SLKey key, SLKey modifier)
 
void slKeyRelease (int sceneViewIndex, SLKey key, SLKey modifier)
 
void slCharInput (int sceneViewIndex, unsigned int character)
 
bool slUsesRotation ()
 
void slRotationQUAT (float quatX, float quatY, float quatZ, float quatW)
 
bool slUsesLocation ()
 
void slLocationLatLonAlt (double latitudeDEG, double longitudeDEG, double altitudeM, float accuracyM)
 
string slGetWindowTitle (int sceneViewIndex)
 Global function to retrieve a window title generated by the scene library. More...
 
void slSetupExternalDir (const SLstring &externalPath)
 
void slSetDeviceParameter (const SLstring &parameter, SLstring value)
 Adds a value to the applications device parameter map. More...
 

Variables

bool gShouldClose = false
 global flag that determines if the application should be closed More...
 

Detailed Description

Implementation of the main Scene Library C-Interface.

The SLInterface.cpp has all implementations of the SLProject C-Interface. Only these functions should called by the OS-dependent GUI applications. These functions can be called from any C, C++ or ObjectiveC GUI framework or by a native API such as Java Native Interface (JNI). For more info on how to create a new app with SLProject see: https://github.com/cpvrlab/SLProject4/wiki/Creating-a-New-App For more info about App framework see: https://cpvrlab.github.io/SLProject4/app-framework.html

Date
July 2014
Authors
Marcus Hudritsch
Remarks
Please use clangformat to format the code. See more code style on https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style

Definition in file SLInterface.cpp.

Function Documentation

◆ slCharInput()

void slCharInput ( int  sceneViewIndex,
unsigned int  character 
)

Global event handler for unicode character input.

Definition at line 486 of file SLInterface.cpp.

488 {
490  e->svIndex = sceneViewIndex;
491  e->character = character;
493 }
static SLInputManager inputManager
Input events manager.
Definition: AppCommon.h:58
Specialized SLInput class for unicode character input.
Definition: SLInputEvent.h:116
SLint svIndex
index of the receiving scene view for this event
Definition: SLInputEvent.h:46
void queueEvent(const SLInputEvent *e)

◆ slCreateApp()

void slCreateApp ( SLVstring cmdLineArgs,
const SLstring dataPath,
const SLstring shaderPath,
const SLstring modelPath,
const SLstring texturePath,
const SLstring fontPath,
const SLstring videoPath,
const SLstring configPath,
const SLstring applicationName 
)

Global creation function for a app instance. This function should be called only once per application. The SLScene constructor call is delayed until the first SLSceneView is created to guarantee, that the OpenGL context is present.
/param cmdLineArgs Command line arguments (not used yet) /param shaderPath Path to the shader files (readonly) /param modelPath Path to the 3D model files (readonly) /param texturePath Path to the texture image files (readonly) /param fontPath Path to the font image files (readonly) /param calibrationPath Path to the calibration ini files (readonly) /param configPath Path where the config files are stored (read-write) /param applicationName The apps name /param onSceneLoadCallback C Callback function as void* pointer for the scene creation.
See examples usages in:

Definition at line 57 of file SLInterface.cpp.

66 {
67  assert(AppCommon::scene == nullptr && "SLScene is already created!");
68 
69  // For more info on PROFILING read Utils/lib-utils/source/Profiler.h
70 #if PROFILING
72  {
73  SLstring computerInfo = Utils::ComputerInfos::get();
74  SLstring profileFile = AppCommon::externalPath + "Profile_" + computerInfo + ".slt";
75  BEGIN_PROFILING_SESSION(profileFile);
76  PROFILE_THREAD("Main Thread");
77  }
78 #endif
79 
80  // Default paths for all loaded resources
81  SLstring exe = Utils::unifySlashes(cmdLineArgs.size() ? cmdLineArgs[0] : "", false);
84  AppCommon::shaderPath = shaderPath;
85  AppCommon::modelPath = modelPath;
86  AppCommon::texturePath = texturePath;
87  AppCommon::fontPath = fontPath;
88  AppCommon::videoPath = videoPath;
89  AppCommon::configPath = configPath;
90 
91  SLGLState* stateGL = SLGLState::instance();
92  SL_LOG("Path to exe : %s", AppCommon::exePath.c_str());
93  SL_LOG("Path to Models : %s", modelPath.c_str());
94  SL_LOG("Path to Shaders : %s", shaderPath.c_str());
95  SL_LOG("Path to Textures : %s", texturePath.c_str());
96  SL_LOG("Path to Fonts : %s", fontPath.c_str());
97  SL_LOG("Path to Config. : %s", configPath.c_str());
98  SL_LOG("Path to Documents: %s", AppCommon::externalPath.c_str());
99  SL_LOG("OpenCV Version : %d.%d.%d", CV_MAJOR_VERSION, CV_MINOR_VERSION, CV_VERSION_REVISION);
100  SL_LOG("OpenCV has OpenCL: %s", cv::ocl::haveOpenCL() ? "yes" : "no");
101  SL_LOG("OpenGL Ver. Str. : %s", stateGL->glVersion().c_str());
102  SL_LOG("OpenGL Ver. No. : %s", stateGL->glVersionNO().c_str());
103  SL_LOG("OpenGL Vendor : %s", stateGL->glVendor().c_str());
104  SL_LOG("OpenGL Renderer : %s", stateGL->glRenderer().c_str());
105  SL_LOG("OpenGL GLSL Ver. : %s (%s) ", stateGL->glSLVersion().c_str(), stateGL->getSLVersionNO().c_str());
106  SL_LOG("------------------------------------------------------------------");
107 
108  AppCommon::createApp(applicationName);
109 }
#define BEGIN_PROFILING_SESSION(name, storeInMemory, outputPath)
Definition: Instrumentor.h:38
#define PROFILE_THREAD(name)
Definition: Profiler.h:38
#define SL_LOG(...)
Definition: SL.h:233
string SLstring
Definition: SL.h:158
static SLstring fontPath
Path to font images.
Definition: AppCommon.h:87
static SLstring configPath
Default path for calibration files.
Definition: AppCommon.h:81
static SLstring exePath
executable root path
Definition: AppCommon.h:80
static SLstring modelPath
Path to 3D models.
Definition: AppCommon.h:85
static SLstring texturePath
Path to texture images.
Definition: AppCommon.h:86
static SLstring videoPath
Path to video files.
Definition: AppCommon.h:88
static void createApp(SLstring appName)
Application creation function.
Definition: AppCommon.cpp:111
static SLstring shaderPath
Path to GLSL shader programs.
Definition: AppCommon.h:84
static SLstring externalPath
Default path for external file storage.
Definition: AppCommon.h:82
static SLScene * scene
Pointer to the one and only SLScene instance.
Definition: AppCommon.h:61
static SLstring dataPath
Path to data directory (it is set platform dependent)
Definition: AppCommon.h:83
Singleton class holding all OpenGL states.
Definition: SLGLState.h:71
SLstring glVersionNO()
Definition: SLGLState.h:128
static SLGLState * instance()
Public static instance getter for singleton pattern.
Definition: SLGLState.h:74
SLstring glVersion()
Definition: SLGLState.h:127
SLstring getSLVersionNO()
Returns the OpenGL Shading Language version number as a string.
Definition: SLGLState.cpp:575
SLstring glRenderer()
Definition: SLGLState.h:131
SLstring glVendor()
Definition: SLGLState.h:130
SLstring glSLVersion()
Definition: SLGLState.h:132
static std::string get()
Definition: Utils.cpp:1261
string unifySlashes(const string &inputDir, bool withTrailingSlash)
Returns the inputDir string with unified forward slashes, e.g.: "dirA/dirB/".
Definition: Utils.cpp:368
bool dirExists(const string &path)
Returns true if a directory exists.
Definition: Utils.cpp:790
string getDirName(const string &pathFilename)
Strip last component from file name.
Definition: Utils.cpp:598

◆ slCreateSceneView()

SLint slCreateSceneView ( SLAssetManager am,
SLScene scene,
int  screenWidth,
int  screenHeight,
int  dotsPerInch,
SLSceneID  initScene,
void onWndUpdateCallback,
void onSelectNodeMeshCallback,
void onNewSceneViewCallback,
void onImGuiBuild,
void onImGuiLoadConfig,
void onImGuiSaveConfig 
)

Global creation function for a SLSceneview instance returning the index of the sceneview. It creates the new SLSceneView instance by calling the callback function slNewSceneView. If you have a custom SLSceneView inherited class you have to provide a similar function and pass it function pointer to slCreateSceneView. You can create multiple sceneview per application.

See examples usages in:

  • app_demo_slproject/glfw: AppDemoMainGLFW.cpp in function main()
  • app-demo/android: AppDemoAndroidJNI.cpp in Java_ch_fhnw_comgr_GLES3Lib_onInit()
  • app_demo_slproject/ios: ViewController.m in viewDidLoad()

Definition at line 122 of file SLInterface.cpp.

134 {
135  // assert(scene && "No valid scene!");
136 
137  // Use our own sceneview creator callback or the passed one.
138  cbOnNewSceneView newSVCallback;
139  if (onNewSceneViewCallback == nullptr)
140  newSVCallback = &slNewSceneView;
141  else
142  newSVCallback = (cbOnNewSceneView)onNewSceneViewCallback;
143 
144  // Create the sceneview & get the pointer with the sceneview index
145  SLSceneView* sv = newSVCallback(scene, dotsPerInch, AppCommon::inputManager);
146 
147  // maintain multiple scene views in AppCommon
148  AppCommon::sceneViews.push_back(sv);
149 
150  // Scale for proportional and fixed size fonts
151  SLfloat dpiScaleProp = (float)dotsPerInch / 120.0f;
152  SLfloat dpiScaleFixed = (float)dotsPerInch / 142.0f;
153 
154  // Default settings for the first time
155  SLImGui::fontPropDots = std::max(16.0f * dpiScaleProp, 16.0f);
156  SLImGui::fontFixedDots = std::max(13.0f * dpiScaleFixed, 13.0f);
157 
158  // Create gui renderer
159  AppCommon::gui = new SLImGui((cbOnImGuiBuild)onImGuiBuild,
160  (cbOnImGuiLoadConfig)onImGuiLoadConfig,
161  (cbOnImGuiSaveConfig)onImGuiSaveConfig,
162  dotsPerInch,
165 
166  sv->init("SceneView",
167  screenWidth,
168  screenHeight,
169  onWndUpdateCallback,
170  onSelectNodeMeshCallback,
173 
174  // Set active sceneview and load scene. This is done for the first sceneview
175  if (!scene)
176  {
178  AppCommon::sceneToLoad = initScene;
179  else
181  }
182  else
183  sv->onInitialize();
184 
185  // return the identifier index
186  return (SLint)AppCommon::sceneViews.size() - 1;
187 }
float SLfloat
Definition: SL.h:173
int SLint
Definition: SL.h:170
constexpr SLSceneID SL_EMPTY_SCENE_ID
SLSceneID for an empty scene.
Definition: SLEnums.h:94
void(SL_STDCALL * cbOnImGuiSaveConfig)()
Callback function typedef for ImGui save config function.
Definition: SLGLImGui.h:34
void(SL_STDCALL * cbOnImGuiLoadConfig)(int dpi)
Callback function typedef for ImGui load config function.
Definition: SLGLImGui.h:31
SLSceneView * slNewSceneView(SLScene *s, int dotsPerInch, SLInputManager &inputManager)
SLSceneView *SL_STDCALL * cbOnNewSceneView(SLScene *s, int dotsPerInch, SLInputManager &inputManager)
Callback function typedef for custom SLSceneView derived creator function.
Definition: SLSceneView.h:43
static SLIOBuffer fontDataProp
Definition: AppCommon.h:111
static optional< SLSceneID > sceneToLoad
Scene id to load at start up.
Definition: AppCommon.h:90
static SLUiInterface * gui
Pointer to the GUI.
Definition: AppCommon.h:63
static SLVSceneView sceneViews
Vector of sceneview pointers.
Definition: AppCommon.h:62
static SLIOBuffer fontDataFixed
Definition: AppCommon.h:112
static SLSceneID sceneID
ID of currently loaded scene.
Definition: AppCommon.h:89
ImGui Interface class for forwarding all events to the original ImGui Handlers.
Definition: SLImGui.h:62
static SLfloat fontPropDots
Default font size of proportional font.
Definition: SLImGui.h:91
static SLfloat fontFixedDots
Default font size of fixed size font.
Definition: SLImGui.h:92
SceneView class represents a dynamic real time 3D view onto the scene.
Definition: SLSceneView.h:69
void init(SLstring name, SLint screenWidth, SLint screenHeight, void *onWndUpdateCallback, void *onSelectNodeMeshCallback, SLUiInterface *gui, const string &configPath)
Definition: SLSceneView.cpp:64
void onInitialize()

◆ slDoubleClick()

void slDoubleClick ( int  sceneViewIndex,
SLMouseButton  button,
int  xpos,
int  ypos,
SLKey  modifier 
)

Global event handler for double click events.

Definition at line 375 of file SLInterface.cpp.

380 {
382  e->svIndex = sceneViewIndex;
383  e->button = button;
384  e->x = xpos;
385  e->y = ypos;
386  e->modifier = modifier;
388 }
Specialized SLInput class for all mouse related input events.
Definition: SLInputEvent.h:54
SLKey modifier
Definition: SLInputEvent.h:59
SLMouseButton button
Definition: SLInputEvent.h:58

◆ slGetWindowTitle()

string slGetWindowTitle ( int  sceneViewIndex)

Global function to retrieve a window title generated by the scene library.

Definition at line 534 of file SLInterface.cpp.

535 {
536  SLSceneView* sv = AppCommon::sceneViews[(SLuint)sceneViewIndex];
537  return sv->windowTitle();
538 }
unsigned int SLuint
Definition: SL.h:171
SLstring windowTitle()

◆ slKeyPress()

void slKeyPress ( int  sceneViewIndex,
SLKey  key,
SLKey  modifier 
)

Global event handler for keyboard key press events.

Definition at line 459 of file SLInterface.cpp.

462 {
464  e->svIndex = sceneViewIndex;
465  e->key = key;
466  e->modifier = modifier;
468 }
Specialized SLInput class for all keypress related input events.
Definition: SLInputEvent.h:67
SLKey modifier
Definition: SLInputEvent.h:70

◆ slKeyRelease()

void slKeyRelease ( int  sceneViewIndex,
SLKey  key,
SLKey  modifier 
)

Global event handler for keyboard key release events.

Definition at line 472 of file SLInterface.cpp.

475 {
477  e->svIndex = sceneViewIndex;
478  e->key = key;
479  e->modifier = modifier;
481 }

◆ slLoadCoreAssetsAsync()

void slLoadCoreAssetsAsync ( )

Global C function for asynchronous asset loading used on emscripten platform.

Definition at line 201 of file SLInterface.cpp.

202 {
205 }
static void registerCoreAssetsLoad()
Definition: AppCommon.cpp:143
static SLAssetLoader * assetLoader
Asset-loader for async asset loading.
Definition: AppCommon.h:60
void loadAssetsAsync(function< void()> onDone)

◆ slLoadCoreAssetsSync()

void slLoadCoreAssetsSync ( )

Global C function for synchronous asset loading used by all platforms except on emscripten where slLoadCoreAssetsAsync is used.

Definition at line 192 of file SLInterface.cpp.

◆ slLocationLatLonAlt()

void slLocationLatLonAlt ( double  latitudeDEG,
double  longitudeDEG,
double  altitudeM,
float  accuracyM 
)

Global event handler for device GPS location with longitude and latitude in degrees and altitude in meters. This location uses the World Geodetic System 1984 (WGS 84). The accuracy in meters is a radius in which the location is with a probability of 68% (2 sigma).

Definition at line 522 of file SLInterface.cpp.

526 {
528  longitudeDEG,
529  altitudeM,
530  accuracyM);
531 }
static SLDeviceLocation devLoc
Mobile device location from GPS.
Definition: AppCommon.h:65
void onLocationLatLonAlt(SLdouble latDEG, SLdouble lonDEG, SLdouble altM, SLfloat accuracyM)
Event handler for mobile device location update.

◆ slMouseDown()

void slMouseDown ( int  sceneViewIndex,
SLMouseButton  button,
int  xpos,
int  ypos,
SLKey  modifier 
)

Global event handler for mouse button down events.

Definition at line 328 of file SLInterface.cpp.

333 {
335  e->svIndex = sceneViewIndex;
336  e->button = button;
337  e->x = xpos;
338  e->y = ypos;
339  e->modifier = modifier;
341 }

◆ slMouseMove()

void slMouseMove ( int  sceneViewIndex,
int  x,
int  y 
)

Global event handler for mouse move events.

Definition at line 345 of file SLInterface.cpp.

348 {
350  e->svIndex = sceneViewIndex;
351  e->x = x;
352  e->y = y;
354 }

◆ slMouseUp()

void slMouseUp ( int  sceneViewIndex,
SLMouseButton  button,
int  xpos,
int  ypos,
SLKey  modifier 
)

Global event handler for mouse button up events.

Definition at line 358 of file SLInterface.cpp.

363 {
365  e->svIndex = sceneViewIndex;
366  e->button = button;
367  e->x = xpos;
368  e->y = ypos;
369  e->modifier = modifier;
371 }

◆ slMouseWheel()

void slMouseWheel ( int  sceneViewIndex,
int  pos,
SLKey  modifier 
)

Global event handler for mouse wheel events.

Definition at line 446 of file SLInterface.cpp.

449 {
451  e->svIndex = sceneViewIndex;
452  e->y = pos;
453  e->modifier = modifier;
455 }

◆ slNewSceneView()

SLSceneView* slNewSceneView ( SLScene s,
int  dotsPerInch,
SLInputManager inputManager 
)

Global sceneview construction function returning the index of the created sceneview instance. If you have a custom SLSceneView inherited class you have to provide a similar function and pass it function pointer to slCreateSceneView.

Definition at line 219 of file SLInterface.cpp.

222 {
223  return new SLSceneView(s, dotsPerInch, inputManager);
224 }
The SLScene class represents the top level instance holding the scene structure.
Definition: SLScene.h:47

◆ slPaintAllViews()

bool slPaintAllViews ( )

Draws all scene views

Returns
return true if another repaint is needed.

Definition at line 290 of file SLInterface.cpp.

291 {
292  bool needUpdate = false;
293 
294  for (auto sv : AppCommon::sceneViews)
295  {
296  // Save previous frame as image
298  {
299  SLstring path = AppCommon::externalPath + "screenshots/";
300  Utils::makeDirRecurse(path);
301  SLstring filename = "Screenshot_" +
302  Utils::getDateTime2String() + ".png";
303  SLstring pathFilename = path + filename;
304  sv->saveFrameBufferAsImage(pathFilename);
305  }
306 
307  if (sv->onPaint() && !needUpdate)
308  needUpdate = true;
309  }
310 
311  return needUpdate;
312 }
void saveFrameBufferAsImage(SLstring pathFilename, cv::Size targetSize=cv::Size(-1, -1))
Saves after n wait frames the front frame buffer as a PNG image.
SLbool onPaint()
void screenCaptureIsRequested(bool doScreenCap)
Definition: SLSceneView.h:156
string getDateTime2String()
Returns local time as string like "20190213-154611".
Definition: Utils.cpp:289
bool makeDirRecurse(std::string path)
Definition: Utils.cpp:826

◆ slResize()

void slResize ( int  sceneViewIndex,
int  width,
int  height 
)

Global resize function that must be called whenever the OpenGL frame changes it's size.

Definition at line 317 of file SLInterface.cpp.

318 {
319  SLResizeEvent* e = new SLResizeEvent;
320  e->svIndex = sceneViewIndex;
321  e->width = width;
322  e->height = height;
324 }
Specialized SLInput class for window resize events.
Definition: SLInputEvent.h:101

◆ slRotationQUAT()

void slRotationQUAT ( float  quatX,
float  quatY,
float  quatZ,
float  quatW 
)

Global event handler for device rotation change with angle & and axis.

Definition at line 504 of file SLInterface.cpp.

508 {
509  AppCommon::devRot.onRotationQUAT(quatX, quatY, quatZ, quatW);
510 }
static SLDeviceRotation devRot
Mobile device rotation from IMU.
Definition: AppCommon.h:64
void onRotationQUAT(SLfloat quatX, SLfloat quatY, SLfloat quatZ, SLfloat quatW)

◆ slSetDeviceParameter()

void slSetDeviceParameter ( const SLstring parameter,
SLstring  value 
)

Adds a value to the applications device parameter map.

Definition at line 555 of file SLInterface.cpp.

557 {
558  AppCommon::deviceParameter[parameter] = std::move(value);
559 }
static map< string, string > deviceParameter
Generic device parameter.
Definition: AppCommon.h:101

◆ slSetupExternalDir()

void slSetupExternalDir ( const SLstring externalPath)

Definition at line 541 of file SLInterface.cpp.

542 {
543  if (Utils::dirExists(externalPath))
544  {
545  SL_LOG("Ext. directory : %s", externalPath.c_str());
546  AppCommon::externalPath = Utils::trimRightString(externalPath, "/") + "/";
547  }
548  else
549  {
550  SL_LOG("ERROR: external directory does not exists: %s", externalPath.c_str());
551  }
552 }
string trimRightString(const string &s, const string &drop)
trims a string at the right end
Definition: Utils.cpp:136

◆ slShouldClose() [1/2]

bool slShouldClose ( )

Global closing function that deallocates the sceneview and scene instances. All the scenegraph deallocation is started from here and has to be done before the GUI app terminates.

Definition at line 230 of file SLInterface.cpp.

231 {
232  return gShouldClose;
233 }
bool gShouldClose
global flag that determines if the application should be closed
Definition: SLInterface.cpp:34

◆ slShouldClose() [2/2]

void slShouldClose ( bool  val)

Global closing function that sets our global running flag. This lets the windowing system know that we want to terminate.

Definition at line 238 of file SLInterface.cpp.

239 {
240  gShouldClose = val;
241 }

◆ slSwitchScene()

void slSwitchScene ( SLSceneView sv,
SLSceneID  sceneID 
)

Global C function for scene switching with a sceneID

Definition at line 209 of file SLInterface.cpp.

210 {
212 }
SLScene SLSceneView SLint sceneID
Definition: SLScene.h:33
static void switchScene(SLSceneView *sv, SLSceneID sceneID)
Definition: AppCommon.cpp:175

◆ slTerminate()

void slTerminate ( )

Global closing function that deallocates the sceneview and scene instances. All the scenegraph deallocation is started from here and has to be done before the GUI app terminates.

Definition at line 247 of file SLInterface.cpp.

248 {
249  SL_LOG("Begin of Terminate");
250 
251  // Deletes all remaining sceneviews and the current scene instance
253 
254  // For more info on PROFILING read Utils/lib-utils/source/Profiler.h
255 #if PROFILING
256  SLstring filePathName = PROFILER_TRACE_FILE_PATH;
257 
258  SL_LOG("Before END_PROFILING_SESSION");
260  SL_LOG("After END_PROFILING_SESSION");
261 
263 
264  if (Utils::fileExists(filePathName))
265  SL_LOG("Profile written : %s", filePathName.c_str());
266  else
267  SL_LOG("No Profile written: %s", filePathName.c_str());
268 #else
269  SL_LOG("No Profiling");
270 #endif
271 
272  SL_LOG("End of Terminate");
273  SL_LOG("------------------------------------------------------------------");
274 }
#define END_PROFILING_SESSION
Definition: Instrumentor.h:39
#define PROFILER_TRACE_FILE_PATH
Definition: Profiler.h:39
static void deleteApp()
Calls the destructor of the single scene instance.
Definition: AppCommon.cpp:298
void endSession()
Definition: Profiler.cpp:57
static Profiler & instance()
Definition: Profiler.h:70
bool fileExists(const string &pathfilename)
Returns true if a file exists.
Definition: Utils.cpp:897

◆ slTouch2Down()

void slTouch2Down ( int  sceneViewIndex,
int  xpos1,
int  ypos1,
int  xpos2,
int  ypos2 
)

Global event handler for the two finger touch down events of touchscreen devices.

Definition at line 393 of file SLInterface.cpp.

398 {
400  e->svIndex = sceneViewIndex;
401  e->x1 = xpos1;
402  e->y1 = ypos1;
403  e->x2 = xpos2;
404  e->y2 = ypos2;
405 
407 }
Specialized SLInput class for touch related input events.
Definition: SLInputEvent.h:78

◆ slTouch2Move()

void slTouch2Move ( int  sceneViewIndex,
int  xpos1,
int  ypos1,
int  xpos2,
int  ypos2 
)

Global event handler for the two finger move events of touchscreen devices.

Definition at line 411 of file SLInterface.cpp.

416 {
418  e->svIndex = sceneViewIndex;
419  e->x1 = xpos1;
420  e->y1 = ypos1;
421  e->x2 = xpos2;
422  e->y2 = ypos2;
424 }

◆ slTouch2Up()

void slTouch2Up ( int  sceneViewIndex,
int  xpos1,
int  ypos1,
int  xpos2,
int  ypos2 
)

Global event handler for the two finger touch up events of touchscreen devices.

Definition at line 429 of file SLInterface.cpp.

434 {
436  e->svIndex = sceneViewIndex;
437  e->x1 = xpos1;
438  e->y1 = ypos1;
439  e->x2 = xpos2;
440  e->y2 = ypos2;
442 }

◆ slUpdateParallelJob()

bool slUpdateParallelJob ( )

Updates the parallel running job an allowes the update of a progress bar.

Returns
Returns true if parallel jobs are still running.

Definition at line 280 of file SLInterface.cpp.

281 {
284 }
static void handleParallelJob()
Starts parallel job if one is queued.
Definition: AppCommon.cpp:359
static atomic< bool > jobIsRunning
True if a parallel job is running.
Definition: AppCommon.h:104

◆ slUsesLocation()

bool slUsesLocation ( )

Definition at line 512 of file SLInterface.cpp.

513 {
514  return AppCommon::devLoc.isUsed();
515 }
void isUsed(SLbool isUsed)
Setter that turns on the device rotation sensor.

◆ slUsesRotation()

bool slUsesRotation ( )

Definition at line 495 of file SLInterface.cpp.

496 {
497  if (AppCommon::scene)
498  return AppCommon::devRot.isUsed();
499  return false;
500 }
void isUsed(SLbool isUsed)
Setter that turns on the device rotation sensor.

Variable Documentation

◆ gShouldClose

bool gShouldClose = false

global flag that determines if the application should be closed

Definition at line 34 of file SLInterface.cpp.