Skip to content

Commit

Permalink
Renamed Apps and class AppDemo
Browse files Browse the repository at this point in the history
- app-Demo-SLProject > app-demo
- app-Demo-Node > app-node
- app-Demo-Minimal > app-minimal
- app-Demo-WebGPU > app-webgpu
- class AppDemo > AppCommon
  • Loading branch information
hudrima1 committed Jun 30, 2024
1 parent bda970e commit e013226
Show file tree
Hide file tree
Showing 187 changed files with 1,156 additions and 1,150 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-wasm-emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
run: emcmake cmake -B ${{ github.workspace }}/build -DSL_BUILD_WAI=OFF -DSL_BUILD_WITH_OPENSSL=OFF -DSL_DOWNLOAD_DATA=OFF

- name: Build
run: cmake --build ${{ github.workspace }}/build --target app-Demo-SLProject -j $(nproc)
run: cmake --build ${{ github.workspace }}/build --target app-demo -j $(nproc)
12 changes: 6 additions & 6 deletions .github/workflows/deploy-wasm-emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
-DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build ${{ github.workspace }}/build --target app-Demo-SLProject -j $(nproc)
run: cmake --build ${{ github.workspace }}/build --target app-demo -j $(nproc)

- name: Upload
working-directory: ${{ github.workspace }}/build
run: |
sshpass -p "${{ secrets.EMSCRIPTEN_DEPLOY_PASSWORD }}" sftp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "${{ secrets.EMSCRIPTEN_DEPLOY_REMOTE }}" << EOF
put app-Demo-SLProject.html public/www/app-Demo-SLProject.html
put app-Demo-SLProject.js public/www/app-Demo-SLProject.js
put app-Demo-SLProject.wasm public/www/app-Demo-SLProject.wasm
put app-Demo-SLProject.worker.js public/www/app-Demo-SLProject.worker.js
put app-Demo-SLProject.ww.js public/www/app-Demo-SLProject.ww.js
put app-demo.html public/www/app-demo.html
put app-demo.js public/www/app-demo.js
put app-demo.wasm public/www/app-demo.wasm
put app-demo.worker.js public/www/app-demo.worker.js
put app-demo.ww.js public/www/app-demo.ww.js
EOF
14 changes: 7 additions & 7 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function(sl_add_app)
file(GLOB COMMON_HEADERS
${SL_PROJECT_ROOT}/apps/source/App.h
${SL_PROJECT_ROOT}/apps/source/CVCapture.h
${SL_PROJECT_ROOT}/apps/source/AppDemo.h
${SL_PROJECT_ROOT}/apps/source/AppCommon.h
${SL_PROJECT_ROOT}/apps/source/AppLoad.h
${SL_PROJECT_ROOT}/apps/source/SLScene.h
${SL_PROJECT_ROOT}/apps/source/SLInterface.h
Expand All @@ -53,7 +53,7 @@ function(sl_add_app)

file(GLOB COMMON_SOURCES
${SL_PROJECT_ROOT}/apps/source/CVCapture.cpp
${SL_PROJECT_ROOT}/apps/source/AppDemo.cpp
${SL_PROJECT_ROOT}/apps/source/AppCommon.cpp
${SL_PROJECT_ROOT}/apps/source/AppLoad.cpp
${SL_PROJECT_ROOT}/apps/source/SLInterface.cpp
${SL_PROJECT_ROOT}/apps/source/SLProjectScene.cpp
Expand Down Expand Up @@ -363,18 +363,18 @@ function(sl_add_app)
)
endfunction()

add_subdirectory(app_demo_slproject)
add_subdirectory(app_demo_node)
add_subdirectory(app_demo_minimal)
add_subdirectory(app_demo)
add_subdirectory(app_node)
add_subdirectory(app_minimal)

if(NOT SYSTEM_NAME_UPPER MATCHES "^(ANDROID|IOS)$")
if (SL_BUILD_EXERCISES)
add_subdirectory(exercises)
endif()

add_subdirectory(app_demo_imgui)
add_subdirectory(app_imgui)

if (SL_BUILD_WEBGPU_DEMO AND NOT ("${SYSTEM_NAME_UPPER}" MATCHES "EMSCRIPTEN"))
add_subdirectory(app_demo_webgpu)
add_subdirectory(app_webgpu)
endif ()
endif()
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sl_add_app(
TARGET "app-Demo-SLProject"
TARGET "app-demo"

PLATFORMS
"GLFW"
Expand Down
File renamed without changes.

Large diffs are not rendered by default.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
* https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
*/

#include <App.h>
#include <AppCommon.h>
#include <AppDemoGui.h>
#include <AppDemoSceneView.h>

#include <SLGLState.h>
#include <SLEnums.h>
#include <AppDemo.h>
#include <CVCapture.h>
#include <AppDemoGui.h>
#include <AppDemoSceneView.h>
#include <App.h>

#include <AppDemoScene2Dand3DText.h>
#include <AppDemoSceneAnimNode.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <AppDemoSceneView.h>
#include <AppDemo.h>
#include <AppCommon.h>
#include <AppDemoGui.h>

//-----------------------------------------------------------------------------
Expand All @@ -24,20 +24,20 @@ SLbool AppDemoSceneView::onKeyPress(SLKey key, SLKey mod)
// Keyboard shortcuts for next or previous sceneID loading
if (mod & K_alt && mod & K_shift)
{
SLSceneView* sv = AppDemo::sceneViews[0];
SLSceneView* sv = AppCommon::sceneViews[0];
if (key == '0' && sv)
{
AppDemo::sceneToLoad = SID_Empty;
AppCommon::sceneToLoad = SID_Empty;
return true;
}
else if (key == K_left && sv && AppDemo::sceneID > 0)
else if (key == K_left && sv && AppCommon::sceneID > 0)
{
AppDemo::sceneToLoad = static_cast<SLSceneID>(AppDemo::sceneID - 1);
AppCommon::sceneToLoad = static_cast<SLSceneID>(AppCommon::sceneID - 1);
return true;
}
else if (key == K_right && sv && AppDemo::sceneID < SID_MaxNoBenchmarks - 1)
else if (key == K_right && sv && AppCommon::sceneID < SID_MaxNoBenchmarks - 1)
{
AppDemo::sceneToLoad = static_cast<SLSceneID>(AppDemo::sceneID + 1);
AppCommon::sceneToLoad = static_cast<SLSceneID>(AppCommon::sceneID + 1);
return true;
}
}
Expand Down Expand Up @@ -74,8 +74,8 @@ SLbool AppDemoSceneView::onMouseDown(SLMouseButton button,
bool baseClassResult = SLSceneView::onMouseDown(button, x, y, mod);

// Grab image during calibration if calibration stream is running
if (AppDemo::sceneID == SID_VideoCalibrateMain ||
AppDemo::sceneID == SID_VideoCalibrateScnd)
if (AppCommon::sceneID == SID_VideoCalibrateMain ||
AppCommon::sceneID == SID_VideoCalibrateScnd)
{
grab = true;
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <SLGLTexture.h>
#include <CVCalibrationEstimator.h>
#include <AppDemoSceneView.h>
#include <AppDemo.h>
#include <AppCommon.h>
#include <GlobalTimer.h>
#include <Profiler.h>

Expand Down Expand Up @@ -65,76 +65,76 @@ void runCalibrationEstimator(CVCamera* ac, SLScene* s, SLSceneView* sv)
static bool processedCalibResult = false;
try
{
if (!AppDemo::calibrationEstimator)
if (!AppCommon::calibrationEstimator)
{
AppDemo::calibrationEstimator = new CVCalibrationEstimator(AppDemo::calibrationEstimatorParams,
AppCommon::calibrationEstimator = new CVCalibrationEstimator(AppCommon::calibrationEstimatorParams,
CVCapture::instance()->activeCamSizeIndex,
ac->mirrorH(),
ac->mirrorV(),
ac->type(),
Utils::ComputerInfos::get(),
AppDemo::calibIniPath,
AppDemo::externalPath,
AppDemo::exePath);
AppCommon::calibIniPath,
AppCommon::externalPath,
AppCommon::exePath);

// clear grab request from sceneview
adSv->grab = false;
processedCalibResult = false;
}

if (AppDemo::calibrationEstimator->isStreaming())
if (AppCommon::calibrationEstimator->isStreaming())
{
AppDemo::calibrationEstimator->updateAndDecorate(CVCapture::instance()->lastFrame,
AppCommon::calibrationEstimator->updateAndDecorate(CVCapture::instance()->lastFrame,
CVCapture::instance()->lastFrameGray,
adSv->grab);
// reset grabbing switch
adSv->grab = false;

stringstream ss;
ss << "Click on the screen to create a calibration photo. Created "
<< AppDemo::calibrationEstimator->numCapturedImgs()
<< " of " << AppDemo::calibrationEstimator->numImgsToCapture();
<< AppCommon::calibrationEstimator->numCapturedImgs()
<< " of " << AppCommon::calibrationEstimator->numImgsToCapture();
s->info(ss.str());
}
else if (AppDemo::calibrationEstimator->isBusyExtracting())
else if (AppCommon::calibrationEstimator->isBusyExtracting())
{
// also reset grabbing, user has to click again
adSv->grab = false;
AppDemo::calibrationEstimator->updateAndDecorate(CVCapture::instance()->lastFrame,
AppCommon::calibrationEstimator->updateAndDecorate(CVCapture::instance()->lastFrame,
CVCapture::instance()->lastFrameGray,
false);
s->info("Busy extracting corners, please wait with grabbing ...");
}
else if (AppDemo::calibrationEstimator->isCalculating())
else if (AppCommon::calibrationEstimator->isCalculating())
{
AppDemo::calibrationEstimator->updateAndDecorate(CVCapture::instance()->lastFrame,
AppCommon::calibrationEstimator->updateAndDecorate(CVCapture::instance()->lastFrame,
CVCapture::instance()->lastFrameGray,
false);
s->info("Calculating calibration, please wait ...");
}
else if (AppDemo::calibrationEstimator->isDone())
else if (AppCommon::calibrationEstimator->isDone())
{
if (!processedCalibResult)
{
if (AppDemo::calibrationEstimator->calibrationSuccessful())
if (AppCommon::calibrationEstimator->calibrationSuccessful())
{
processedCalibResult = true;
ac->calibration = AppDemo::calibrationEstimator->getCalibration();
ac->calibration = AppCommon::calibrationEstimator->getCalibration();

std::string computerInfo = Utils::ComputerInfos::get();
string mainCalibFilename = "camCalib_" + computerInfo + "_main.xml";
string scndCalibFilename = "camCalib_" + computerInfo + "_scnd.xml";
std::string errorMsg;
if (ac->calibration.save(AppDemo::calibFilePath, mainCalibFilename))
if (ac->calibration.save(AppCommon::calibFilePath, mainCalibFilename))
{

#ifndef SL_EMSCRIPTEN
if (!FtpUtils::uploadFile(AppDemo::calibFilePath,
if (!FtpUtils::uploadFile(AppCommon::calibFilePath,
mainCalibFilename,
AppDemo::CALIB_FTP_HOST,
AppDemo::CALIB_FTP_USER,
AppDemo::CALIB_FTP_PWD,
AppDemo::CALIB_FTP_DIR,
AppCommon::CALIB_FTP_HOST,
AppCommon::CALIB_FTP_USER,
AppCommon::CALIB_FTP_PWD,
AppCommon::CALIB_FTP_DIR,
errorMsg))
{
Utils::log("WAIApp", errorMsg.c_str());
Expand All @@ -154,7 +154,7 @@ void runCalibrationEstimator(CVCamera* ac, SLScene* s, SLSceneView* sv)
}
}
}
else if (AppDemo::calibrationEstimator->isDoneCaptureAndSave())
else if (AppCommon::calibrationEstimator->isDoneCaptureAndSave())
{
s->info(("Capturing done!"));
}
Expand All @@ -173,18 +173,18 @@ void ensureValidCalibration(CVCamera* ac, SLSceneView* sv)
PROFILE_FUNCTION();

// we have to make sure calibration process is stopped if someone stops calibrating
if (AppDemo::calibrationEstimator)
if (AppCommon::calibrationEstimator)
{
delete AppDemo::calibrationEstimator;
AppDemo::calibrationEstimator = nullptr;
delete AppCommon::calibrationEstimator;
AppCommon::calibrationEstimator = nullptr;
}

if (ac->calibration.state() == CS_uncalibrated)
{
// Try to read device lens and sensor information
string strF = AppDemo::deviceParameter["DeviceLensFocalLength"];
string strW = AppDemo::deviceParameter["DeviceSensorPhysicalSizeW"];
string strH = AppDemo::deviceParameter["DeviceSensorPhysicalSizeH"];
string strF = AppCommon::deviceParameter["DeviceLensFocalLength"];
string strW = AppCommon::deviceParameter["DeviceSensorPhysicalSizeW"];
string strH = AppCommon::deviceParameter["DeviceSensorPhysicalSizeH"];
if (!strF.empty() && !strW.empty() && !strH.empty())
{
float devF = strF.empty() ? 0.0f : stof(strF);
Expand Down Expand Up @@ -225,11 +225,11 @@ bool onUpdateVideo()
{
PROFILE_FUNCTION();

if (AppDemo::sceneViews.empty())
if (AppCommon::sceneViews.empty())
return false;

SLScene* s = AppDemo::scene;
SLSceneView* sv = AppDemo::sceneViews[0];
SLScene* s = AppCommon::scene;
SLSceneView* sv = AppCommon::sceneViews[0];

if (CVCapture::instance()->videoType() != VT_NONE &&
!CVCapture::instance()->lastFrame.empty())
Expand All @@ -238,8 +238,8 @@ bool onUpdateVideo()

CVCamera* ac = CVCapture::instance()->activeCamera;

if (AppDemo::sceneID == SID_VideoCalibrateMain ||
AppDemo::sceneID == SID_VideoCalibrateScnd)
if (AppCommon::sceneID == SID_VideoCalibrateMain ||
AppCommon::sceneID == SID_VideoCalibrateScnd)
{
runCalibrationEstimator(ac, s, sv);
}
Expand Down Expand Up @@ -287,10 +287,10 @@ bool onUpdateVideo()
}

// Update info text only for chessboard scene
if (AppDemo::sceneID == SID_VideoCalibrateMain ||
AppDemo::sceneID == SID_VideoCalibrateScnd ||
AppDemo::sceneID == SID_VideoTrackChessMain ||
AppDemo::sceneID == SID_VideoTrackChessScnd)
if (AppCommon::sceneID == SID_VideoCalibrateMain ||
AppCommon::sceneID == SID_VideoCalibrateScnd ||
AppCommon::sceneID == SID_VideoTrackChessMain ||
AppCommon::sceneID == SID_VideoTrackChessScnd)
{
SLfloat fovH = ac->calibration.cameraFovHDeg();
SLfloat err = ac->calibration.reprojectionError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
*/

#include <AppDemoScene2Dand3DText.h>
#include <AppCommon.h>
#include <SLAssetManager.h>
#include <SLLightSpot.h>
#include <SLText.h>
#include <SLSphere.h>
#include <AppDemo.h>

//-----------------------------------------------------------------------------
AppDemoScene2Dand3DText::AppDemoScene2Dand3DText() : SLScene("2D and 3D Text Scene")
Expand All @@ -43,7 +43,7 @@ void AppDemoScene2Dand3DText::assemble(SLAssetManager* am, SLSceneView* sv)
cam1->focalDist(5);
cam1->background().colors(SLCol4f(0.1f, 0.1f, 0.1f));
cam1->setInitialState();
cam1->devRotLoc(&AppDemo::devRot, &AppDemo::devLoc);
cam1->devRotLoc(&AppCommon::devRot, &AppCommon::devLoc);

SLLightSpot* light1 = new SLLightSpot(am,
this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
*/

#include <AppCommon.h>
#include <AppDemoSceneAnimNode.h>
#include <AppDemoSceneFigure.h>
#include <AppDemo.h>
#include <SLAssetLoader.h>
#include <SLLightSpot.h>
#include <SLRectangle.h>
Expand All @@ -30,7 +30,7 @@ AppDemoSceneAnimNode::AppDemoSceneAnimNode()
void AppDemoSceneAnimNode::registerAssetsToLoad(SLAssetLoader& al)
{
al.addTextureToLoad(_tex1,
AppDemo::texturePath + "Checkerboard0512_C.png");
AppCommon::texturePath + "Checkerboard0512_C.png");
}
//-----------------------------------------------------------------------------
//! After parallel loading of the assets the scene gets assembled in here.
Expand Down Expand Up @@ -76,7 +76,7 @@ void AppDemoSceneAnimNode::assemble(SLAssetManager* am, SLSceneView* sv)
cam1->lookAt(0, 0, 0);
cam1->focalDist(22);
cam1->setInitialState();
cam1->devRotLoc(&AppDemo::devRot, &AppDemo::devLoc);
cam1->devRotLoc(&AppCommon::devRot, &AppCommon::devLoc);

SLCamera* cam2 = new SLCamera("Camera 2");
cam2->translation(5, 0, 0);
Expand All @@ -85,7 +85,7 @@ void AppDemoSceneAnimNode::assemble(SLAssetManager* am, SLSceneView* sv)
cam2->clipFar(10);
cam2->background().colors(SLCol4f(0, 0, 0.6f), SLCol4f(0, 0, 0.3f));
cam2->setInitialState();
cam2->devRotLoc(&AppDemo::devRot, &AppDemo::devLoc);
cam2->devRotLoc(&AppCommon::devRot, &AppCommon::devLoc);

SLCamera* cam3 = new SLCamera("Camera 3");
cam3->translation(-5, -2, 0);
Expand All @@ -94,7 +94,7 @@ void AppDemoSceneAnimNode::assemble(SLAssetManager* am, SLSceneView* sv)
cam3->clipFar(10);
cam3->background().colors(SLCol4f(0.6f, 0, 0), SLCol4f(0.3f, 0, 0));
cam3->setInitialState();
cam3->devRotLoc(&AppDemo::devRot, &AppDemo::devLoc);
cam3->devRotLoc(&AppCommon::devRot, &AppCommon::devLoc);

SLLightSpot* light1 = new SLLightSpot(am, this, 0, 2, 0, 0.5f);
light1->powers(0.2f, 1.0f, 1.0f);
Expand Down
Loading

0 comments on commit e013226

Please sign in to comment.