SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
Top level class for the major global instances off an SLProject app. More...
#include <AppCommon.h>
Static Public Member Functions | |
static void | createApp (SLstring appName) |
Application creation function. More... | |
static void | registerCoreAssetsLoad () |
static void | switchScene (SLSceneView *sv, SLSceneID sceneID) |
static void | deleteApp () |
Calls the destructor of the single scene instance. More... | |
static void | handleParallelJob () |
Starts parallel job if one is queued. More... | |
static void | jobProgressMsg (string msg) |
Thread-safe setter of the progress message. More... | |
static void | jobProgressNum (int num) |
static void | jobProgressMax (int max) |
static string | jobProgressMsg () |
Thread-safe getter of the progress message. More... | |
static int | jobProgressNum () |
static int | jobProgressMax () |
Static Public Attributes | |
static SLInputManager | inputManager |
Input events manager. More... | |
static SLAssetManager * | assetManager = nullptr |
asset manager is the owner of all assets More... | |
static SLAssetLoader * | assetLoader = nullptr |
Asset-loader for async asset loading. More... | |
static SLScene * | scene = nullptr |
Pointer to the one and only SLScene instance. More... | |
static SLVSceneView | sceneViews |
Vector of sceneview pointers. More... | |
static SLUiInterface * | gui = nullptr |
Pointer to the GUI. More... | |
static SLDeviceRotation | devRot |
Mobile device rotation from IMU. More... | |
static SLDeviceLocation | devLoc |
Mobile device location from GPS. More... | |
static SLstring | name = "SLProjectApp" |
Application name. More... | |
static SLstring | appTag = "SLProject" |
Tag string used in logging. More... | |
static SLstring | version = "4.2.001" |
SLProject version string. More... | |
static SLstring | asciiLabel |
SLProject ascii label string. More... | |
static SLstring | configuration = "Release" |
Debug or Release configuration. More... | |
static SLstring | gitBranch = SL_GIT_BRANCH |
Current GIT branch. More... | |
static SLstring | gitCommit = SL_GIT_COMMIT |
Current GIT commit short hash id. More... | |
static SLstring | gitDate = SL_GIT_DATE |
Current GIT commit date. More... | |
static SLstring | exePath |
executable root path More... | |
static SLstring | configPath |
Default path for calibration files. More... | |
static SLstring | externalPath |
Default path for external file storage. More... | |
static SLstring | dataPath |
Path to data directory (it is set platform dependent) More... | |
static SLstring | shaderPath |
Path to GLSL shader programs. More... | |
static SLstring | modelPath |
Path to 3D models. More... | |
static SLstring | texturePath |
Path to texture images. More... | |
static SLstring | fontPath |
Path to font images. More... | |
static SLstring | videoPath |
Path to video files. More... | |
static SLSceneID | sceneID = SL_EMPTY_SCENE_ID |
ID of currently loaded scene. More... | |
static optional< SLSceneID > | sceneToLoad |
Scene id to load at start up. More... | |
static map< string, string > | deviceParameter |
Generic device parameter. More... | |
static deque< function< void(void)> > | jobsToBeThreaded |
Queue of functions to be executed in a thread. More... | |
static deque< function< void(void)> > | jobsToFollowInMain |
Queue of function to follow in the main thread. More... | |
static atomic< bool > | jobIsRunning |
True if a parallel job is running. More... | |
static CVCalibrationEstimatorParams | calibrationEstimatorParams |
static CVCalibrationEstimator * | calibrationEstimator = nullptr |
static SLstring | calibIniPath |
That's where data/calibrations folder is located. More... | |
static SLstring | calibFilePath |
That's where calibrations are stored and loaded from. More... | |
static SLIOBuffer | fontDataProp |
static SLIOBuffer | fontDataFixed |
static const string | CALIB_FTP_HOST = "pallas.ti.bfh.ch:21" |
ftp host for calibration up and download More... | |
static const string | CALIB_FTP_USER = "upload" |
ftp login user for calibration up and download More... | |
static const string | CALIB_FTP_PWD = "FaAdbD3F2a" |
ftp login pwd for calibration up and download More... | |
static const string | CALIB_FTP_DIR = "calibrations" |
ftp directory for calibration up and download More... | |
static const string | PROFILE_FTP_DIR = "profiles" |
ftp directory for profiles upload More... | |
Static Private Member Functions | |
static void | onDoneLoading (SLSceneView *sv, SLScene *s, SLfloat startLoadMS) |
static void | onDoneAssembling (SLSceneView *sv, SLScene *s, SLfloat startLoadMS) |
Static Private Attributes | |
static string | _jobProgressMsg = "" |
Text message to show during progress. More... | |
static atomic< int > | _jobProgressNum |
Integer value to show progress. More... | |
static atomic< int > | _jobProgressMax |
Max. integer progress value. More... | |
static mutex | _jobMutex |
Mutex to protect parallel access. More... | |
Top level class for the major global instances off an SLProject app.
The AppCommon holds static instances of top-level items such as the asset manager, the scene pointer, the vector of all sceneviews, the gui pointer, the camera calibration objects and the device rotation and location information.
The static function createApp is called by the C-interface functions slCreateApp and the function deleteApp by slTerminate. At the moment only one scene can be open at the time.
AppCommon holds two static video camera calibrations, one for a main camera (mainCam) and one for the selfie camera on mobile devices (scndCam). The pointer activeCamera points to the active one.
Definition at line 54 of file AppCommon.h.
Application creation function.
Writes and inits the static application information and create the single instances of SLGLState, SLAssetManager and SLAssetLoader. Gets called by the C-interface function slCreateApp.
See examples usages in:
Definition at line 111 of file AppCommon.cpp.
|
static |
Calls the destructor of the single scene instance.
Destroys all data by calling the destructor of the single scene instance. All other date gets destroyed from there. This function gets called by the SLProject C-Interface function slTerminate that should be called at the end of any SLProject application.
Definition at line 298 of file AppCommon.cpp.
|
static |
Starts parallel job if one is queued.
Parallel executed job can be queued in jobsToBeThreaded. Only functions are allowed that do not call any OpenGL functions. So no scenegraph changes are allowed because they involve mostly OpenGL state and context changes. Only one parallel job is executed at once parallel to the main rendering thread. The function in jobsToFollowInMain will be executed in the main tread after the parallel are finished.
The handleParallelJob function gets called in slUpdateAndPaint before a new frame gets started. See an example parallel job definition in AppDemoGui. If a parallel job is running the jobProgressMsg can be shown during execution. If jobProgressMax is 0 the jobProgressNum value can be shown an number. If jobProgressMax is not 0 the fraction of jobProgressNum/jobProgressMax can be shown within a progress bar. See the example in AppDemoGui::build.
Definition at line 359 of file AppCommon.cpp.
|
inlinestatic |
Definition at line 99 of file AppCommon.h.
|
inlinestatic |
Definition at line 96 of file AppCommon.h.
|
static |
Thread-safe getter of the progress message.
Definition at line 392 of file AppCommon.cpp.
|
static |
|
inlinestatic |
Definition at line 98 of file AppCommon.h.
|
inlinestatic |
Definition at line 95 of file AppCommon.h.
|
staticprivate |
Definition at line 267 of file AppCommon.cpp.
|
staticprivate |
OnDoneLoading is called when the asyn asset loading is finished and the async scene assembly can be started.
Definition at line 248 of file AppCommon.cpp.
|
static |
Registers core assets to load async by all apps. Scene specific assets have to be loaded async by overriding SLScene::registerAssetsToLoad and SLScene::assemble. Async loading and assembling means that it happens in a parallel thread and that inthere are no OpenGL calls allowed. OpenGL calls are only allowed in the main thread.
Definition at line 143 of file AppCommon.cpp.
|
static |
Deletes the current scene and creates a new one identified by the sceneID. All assets get registered for async loading while Imgui shows a progress spinner in the UI. After the parallel loading the scene gets assembled back in the main thread.
sv | Pointer to the sceneview |
sceneID | Scene identifier defined in SLEnum |
Definition at line 175 of file AppCommon.cpp.
|
staticprivate |
Mutex to protect parallel access.
Definition at line 127 of file AppCommon.h.
|
staticprivate |
Max. integer progress value.
Definition at line 126 of file AppCommon.h.
|
staticprivate |
Text message to show during progress.
Definition at line 124 of file AppCommon.h.
|
staticprivate |
Integer value to show progress.
Definition at line 125 of file AppCommon.h.
|
static |
Tag string used in logging.
Definition at line 73 of file AppCommon.h.
|
static |
SLProject ascii label string.
ASCII Label: https://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=SLProject%204.2.
Definition at line 75 of file AppCommon.h.
|
static |
Asset-loader for async asset loading.
Definition at line 60 of file AppCommon.h.
|
static |
asset manager is the owner of all assets
Definition at line 59 of file AppCommon.h.
|
static |
ftp directory for calibration up and download
Definition at line 117 of file AppCommon.h.
|
static |
ftp host for calibration up and download
Definition at line 114 of file AppCommon.h.
|
static |
ftp login pwd for calibration up and download
Definition at line 116 of file AppCommon.h.
|
static |
ftp login user for calibration up and download
Definition at line 115 of file AppCommon.h.
|
static |
That's where calibrations are stored and loaded from.
Definition at line 109 of file AppCommon.h.
|
static |
That's where data/calibrations folder is located.
Definition at line 108 of file AppCommon.h.
|
static |
Definition at line 107 of file AppCommon.h.
|
static |
Definition at line 106 of file AppCommon.h.
|
static |
Default path for calibration files.
Definition at line 81 of file AppCommon.h.
|
static |
Debug or Release configuration.
Definition at line 76 of file AppCommon.h.
|
static |
Path to data directory (it is set platform dependent)
Definition at line 83 of file AppCommon.h.
|
static |
Generic device parameter.
Definition at line 101 of file AppCommon.h.
|
static |
Mobile device location from GPS.
Definition at line 65 of file AppCommon.h.
|
static |
Mobile device rotation from IMU.
Definition at line 64 of file AppCommon.h.
|
static |
executable root path
Definition at line 80 of file AppCommon.h.
|
static |
Default path for external file storage.
Definition at line 82 of file AppCommon.h.
|
static |
Definition at line 112 of file AppCommon.h.
|
static |
Definition at line 111 of file AppCommon.h.
|
static |
Path to font images.
Definition at line 87 of file AppCommon.h.
|
static |
Current GIT branch.
Definition at line 77 of file AppCommon.h.
|
static |
Current GIT commit short hash id.
Definition at line 78 of file AppCommon.h.
|
static |
Current GIT commit date.
Definition at line 79 of file AppCommon.h.
|
static |
Pointer to the GUI.
Definition at line 63 of file AppCommon.h.
|
static |
|
static |
True if a parallel job is running.
Definition at line 104 of file AppCommon.h.
Queue of functions to be executed in a thread.
Definition at line 102 of file AppCommon.h.
Queue of function to follow in the main thread.
Definition at line 103 of file AppCommon.h.
|
static |
Path to 3D models.
Definition at line 85 of file AppCommon.h.
|
static |
Application name.
Definition at line 72 of file AppCommon.h.
|
static |
ftp directory for profiles upload
Definition at line 118 of file AppCommon.h.
|
static |
Pointer to the one and only SLScene instance.
Definition at line 61 of file AppCommon.h.
|
static |
ID of currently loaded scene.
Definition at line 89 of file AppCommon.h.
|
static |
Scene id to load at start up.
Definition at line 90 of file AppCommon.h.
|
static |
Vector of sceneview pointers.
Definition at line 62 of file AppCommon.h.
|
static |
Path to GLSL shader programs.
Definition at line 84 of file AppCommon.h.
|
static |
Path to texture images.
Definition at line 86 of file AppCommon.h.
|
static |
SLProject version string.
Definition at line 74 of file AppCommon.h.
|
static |
Path to video files.
Definition at line 88 of file AppCommon.h.