SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
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>
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) |
SLSceneView * | slNewSceneView (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 ¶meter, 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... | |
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
Definition in file SLInterface.cpp.
void slCharInput | ( | int | sceneViewIndex, |
unsigned int | character | ||
) |
Global event handler for unicode character input.
Definition at line 486 of file SLInterface.cpp.
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.
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:
Definition at line 122 of file SLInterface.cpp.
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.
string slGetWindowTitle | ( | int | sceneViewIndex | ) |
Global function to retrieve a window title generated by the scene library.
Definition at line 534 of file SLInterface.cpp.
Global event handler for keyboard key press events.
Definition at line 459 of file SLInterface.cpp.
Global event handler for keyboard key release events.
Definition at line 472 of file SLInterface.cpp.
void slLoadCoreAssetsAsync | ( | ) |
Global C function for asynchronous asset loading used on emscripten platform.
Definition at line 201 of file SLInterface.cpp.
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.
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.
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 | ||
) |
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.
bool slPaintAllViews | ( | ) |
Draws all scene views
Definition at line 290 of file SLInterface.cpp.
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.
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.
Adds a value to the applications device parameter map.
Definition at line 555 of file SLInterface.cpp.
Definition at line 541 of file SLInterface.cpp.
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.
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.
void slSwitchScene | ( | SLSceneView * | sv, |
SLSceneID | sceneID | ||
) |
Global C function for scene switching with a sceneID
Definition at line 209 of file SLInterface.cpp.
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.
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.
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.
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.
bool slUpdateParallelJob | ( | ) |
Updates the parallel running job an allowes the update of a progress bar.
Definition at line 280 of file SLInterface.cpp.
bool slUsesLocation | ( | ) |
Definition at line 512 of file SLInterface.cpp.
bool slUsesRotation | ( | ) |
Definition at line 495 of file SLInterface.cpp.
bool gShouldClose = false |
global flag that determines if the application should be closed
Definition at line 34 of file SLInterface.cpp.