49 #define IMGUI_DEFINE_MATH_OPERATORS
61 # include <Eigen/Dense>
73 [](
void* vec,
int idx,
const char** out_text)
76 if (idx < 0 || idx >= (
int)vector.size())
79 *out_text = vector.at((
SLuint)idx).c_str();
90 return ImGui::Combo(label,
106 ImGui::SetNextWindowSize(ImVec2(width, height), ImGuiCond_Always);
107 ImGui::SetNextWindowPos(ImVec2(offsetX, offsetY), ImGuiCond_Always);
148 Welcome to the SLProject demo app. It is developed at the Computer Science Department of the Bern University of Applied Sciences.
149 The app shows what you can learn in two semesters about 3D computer graphics in real time rendering and ray tracing.
150 The framework is developed in C++ with OpenGL ES so that it can run also on mobile devices.
151 Ray tracing and path tracing provide additional high quality transparencies, reflections and soft shadows.
152 Click the X to close and use the menu File > Load Demo Scenes to choose other scenes that each show-case a specific feature of SLProject.
153 For more information please visit: https://github.com/cpvrlab/SLProject/wiki
157 Contributors since 2005 in alphabetic order:
158 Marc Affolter, Martin Christen, Jan Dellsperger, Manuel Frischknecht, Luc Girod, Michael Goettlicher, Michael Schertenleib, Thomas Schneiter, Stefan Thoeni, Timo Tschanz, Marino von Wattenwyl, Marc Wacker, Pascal Zingg
160 Credits for external libraries:
161 - assimp: assimp.sourceforge.net
162 - eigen: eigen.tuxfamily.org
163 - emscripten: emscripten.org
164 - imgui: github.com/ocornut/imgui
165 - gl3w: https://github.com/skaslev/gl3w
167 - g2o: github.com/RainerKuemmerle/g2o
168 - ktx: khronos.org/ktx
169 - libigl: libigl.github.io
170 - mediapipe: developers.google.com/mediapipe
171 - ORB-SLAM2: github.com/raulmur/ORB_SLAM2
174 - OpenSSL: openssl.org
175 - spa: midcdmz.nrel.gov/spa
176 - stb: single file image library
181 Help for mouse or finger control:
182 - Use left mouse or your finger to rotate the scene
183 - Use mouse-wheel or pinch 2 fingers to go forward/backward
184 - Use middle-mouse or 2 fingers to move sidewards/up-down
185 - Double click or double tap to select object
186 - CTRL-mouse to select vertices of objects
187 - See keyboard shortcuts behind menu commands
188 - Check out the different test scenes under File > Load Test Scene
189 - You can open and dock additional windows from the menu Infos.
193 The calibration process requires a chessboard image to be printed and glued on a flat board. You can find the PDF with the chessboard image on:
194 https://github.com/cpvrlab/SLProject/tree/master/data/calibrations/
195 For a calibration you have to take 20 images with detected inner chessboard corners. To take an image you have to click with the mouse
196 or tap with finger into the screen. View the chessboard from the side so that the inner corners cover the full image. Hold the camera or board really still
197 before taking the picture.
198 You can mirror the video image under Preferences > Video. You can check the distance to the chessboard in the dialog Stats. on Video.
199 After calibration the yellow wireframe cube should stick on the chessboard. Please close first this info dialog on the top-left.
211 int xferedPC = (int)((
float)xfered / (float)
ftpXferSizeMax * 100.0f);
216 cout <<
"Bytes transferred: " << xfered << endl;
217 return xfered ? 1 : 0;
241 ImGui::Begin(
"Loading",
243 ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoNavInputs);
246 float height =
static_cast<float>(
sv->
viewportH());
247 ImGui::SetWindowSize(ImVec2(width, height));
248 ImGui::SetWindowPos(ImVec2(0, 0));
250 ImVec2 center(0.5f * width, 0.5f * height);
252 ImDrawList* drawList = ImGui::GetWindowDrawList();
254 drawList->AddRectFilled(ImVec2(0, 0), ImVec2(width, height), IM_COL32(40, 40, 40, 255));
255 drawList->AddCircle(center, 50, IM_COL32(105, 125, 145, 255), 0, 10.0f);
257 float offset = 8.0f *
static_cast<float>(ImGui::GetTime());
258 drawList->PathArcTo(center, 50, offset, offset + 0.25f * 2 *
PI);
259 drawList->PathStroke(IM_COL32(250, 165, 0, 255), 0, 10.0f);
262 ImGui::SetCursorPosX(0.5f * (width - ImGui::CalcTextSize(text).x));
263 ImGui::SetCursorPosY(0.5f * height + 100.0f);
286 ImGui::Begin(
"Parallel Job in Progress",
288 ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoNavInputs);
289 ImGui::Text(
"Parallel Job in Progress:");
296 ImGui::ProgressBar(num / max);
300 ImGui::Text(
"Progress: %c",
"|/-\\"[(
int)(ImGui::GetTime() / 0.05f) & 3]);
304 ImGui::Text(
"Parallel Jobs to follow: %u",
306 ImGui::Text(
"Sequential Jobs to follow: %u",
315 static bool opt_fullscreen_persistant =
true;
316 bool opt_fullscreen = opt_fullscreen_persistant;
317 static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode;
321 ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNavInputs;
324 ImGuiViewport* viewport = ImGui::GetMainViewport();
325 ImGui::SetNextWindowPos(viewport->WorkPos);
326 ImGui::SetNextWindowSize(viewport->WorkSize);
327 ImGui::SetNextWindowViewport(viewport->ID);
328 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
329 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
330 window_flags |= ImGuiWindowFlags_NoTitleBar |
331 ImGuiWindowFlags_NoCollapse |
332 ImGuiWindowFlags_NoResize |
333 ImGuiWindowFlags_NoMove |
334 ImGuiWindowFlags_NoBringToFrontOnFocus |
335 ImGuiWindowFlags_NoNavFocus;
340 if (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode)
341 window_flags |= ImGuiWindowFlags_NoBackground;
348 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
349 ImGui::Begin(
"DockSpace Demo", &
showDockSpace, window_flags);
350 ImGui::PopStyleVar();
353 ImGui::PopStyleVar(2);
356 ImGuiIO& io = ImGui::GetIO();
357 if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
359 ImGuiID dockspace_id = ImGui::GetID(
"MyDockSpace");
360 ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
369 ImGui::Begin(
"About SLProject", &
showAbout, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNavInputs);
376 ImGui::TextWrapped(
"%s",
infoAbout.c_str());
384 ImGui::Begin(
"Help on Interaction", &
showHelp, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNavInputs);
385 ImGui::TextWrapped(
"%s",
infoHelp.c_str());
393 ImGui::Begin(
"Help on Camera Calibration", &
showHelpCalibration, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNavInputs);
402 ImGui::Begin(
"Credits for all Contributors and external Libraries", &
showCredits, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNavInputs);
430 #ifndef SL_EMSCRIPTEN
449 #ifndef SL_EMSCRIPTEN
463 snprintf(m + strlen(m),
sizeof(m),
"Renderer : OpenGL\n");
464 snprintf(m + strlen(m),
sizeof(m),
"Load time : %5.1f ms\n",
s->
loadTimeMS());
470 snprintf(m + strlen(m),
sizeof(m),
"FPS : %5.1f\n",
s->
fps());
471 snprintf(m + strlen(m),
sizeof(m),
"Frame time : %5.1f ms (100%%)\n", ft);
472 snprintf(m + strlen(m),
sizeof(m),
" Capture : %5.1f ms (%3d%%)\n", captureTime, (
SLint)captureTimePC);
473 snprintf(m + strlen(m),
sizeof(m),
" Update : %5.1f ms (%3d%%)\n", updateTime, (
SLint)updateTimePC);
474 #ifdef SL_USE_ENTITIES
477 snprintf(m + strlen(m),
sizeof(m),
" EntityWM : %5.1f ms (%3d%%)\n", updateDODTime, (
SLint)updateDODTimePC);
481 snprintf(m + strlen(m),
sizeof(m),
" Anim. : %5.1f ms (%3d%%)\n", updateAnimTime, (
SLint)updateAnimTimePC);
482 snprintf(m + strlen(m),
sizeof(m),
" AABB : %5.1f ms (%3d%%)\n", updateAABBTime, (
SLint)updateAABBTimePC);
485 #ifndef SL_EMSCRIPTEN
488 snprintf(m + strlen(m),
sizeof(m),
" Tracking : %5.1f ms (%3d%%)\n", trackingTime, (
SLint)trackingTimePC);
489 snprintf(m + strlen(m),
sizeof(m),
" Detect : %5.1f ms (%3d%%)\n", detectTime, (
SLint)detectTimePC);
490 snprintf(m + strlen(m),
sizeof(m),
" Det1 : %5.1f ms\n", detect1Time);
491 snprintf(m + strlen(m),
sizeof(m),
" Det2 : %5.1f ms\n", detect2Time);
492 snprintf(m + strlen(m),
sizeof(m),
" Match : %5.1f ms (%3d%%)\n", matchTime, (
SLint)matchTimePC);
493 snprintf(m + strlen(m),
sizeof(m),
" OptFlow : %5.1f ms (%3d%%)\n", optFlowTime, (
SLint)optFlowTimePC);
494 snprintf(m + strlen(m),
sizeof(m),
" Pose : %5.1f ms (%3d%%)\n", poseTime, (
SLint)poseTimePC);
497 snprintf(m + strlen(m),
sizeof(m),
" Shadows : %5.1f ms (%3d%%)\n", shadowMapTime, (
SLint)shadowMapTimePC);
498 snprintf(m + strlen(m),
sizeof(m),
" Culling : %5.1f ms (%3d%%)\n", cullTime, (
SLint)cullTimePC);
499 snprintf(m + strlen(m),
sizeof(m),
" Drawing 3D: %5.1f ms (%3d%%)\n", draw3DTime, (
SLint)draw3DTimePC);
500 snprintf(m + strlen(m),
sizeof(m),
" Drawing 2D: %5.1f ms (%3d%%)\n", draw2DTime, (
SLint)draw2DTimePC);
502 else if (rType ==
RT_rt)
512 snprintf(m + strlen(m),
sizeof(m),
"Renderer :Ray Tracer\n");
513 snprintf(m + strlen(m),
sizeof(m),
"Progress :%3d%%\n", rt->
progressPC());
514 snprintf(m + strlen(m),
sizeof(m),
"Frame size :%d x %d\n", rtWidth, rtHeight);
515 snprintf(m + strlen(m),
sizeof(m),
"FPS :%0.2f\n", fps);
516 snprintf(m + strlen(m),
sizeof(m),
"Frame Time :%0.3f sec.\n", renderSec);
517 snprintf(m + strlen(m),
sizeof(m),
"Rays per ms:%0.0f\n", rt->
raysPerMS());
519 snprintf(m + strlen(m),
sizeof(m),
"Threads :%d\n", rt->
numThreads());
520 snprintf(m + strlen(m),
sizeof(m),
"-----------------------------\n");
521 snprintf(m + strlen(m),
sizeof(m),
"Total rays :%10u (%3d%%)\n", rayTotal, 100);
522 snprintf(m + strlen(m),
sizeof(m),
" Primary :%10u (%3d%%)\n", rayPrimaries, (
int)((
float)rayPrimaries / (
float)rayTotal * 100.0f));
528 snprintf(m + strlen(m),
sizeof(m),
"-----------------------------\n");
530 snprintf(m + strlen(m),
sizeof(m),
"Avg. depth :%0.3f\n",
SLRay::avgDepth / (
float)rayPrimaries);
532 #if defined(SL_BUILD_WITH_OPTIX) && defined(SL_HAS_OPTIX)
535 SLOptixRaytracer* ort =
sv->optixRaytracer();
536 snprintf(m + strlen(m),
sizeof(m),
"Renderer :OptiX Ray Tracer\n");
537 snprintf(m + strlen(m),
sizeof(m),
"Frame size :%d x %d\n",
sv->
scrW(),
sv->
scrH());
538 snprintf(m + strlen(m),
sizeof(m),
"FPS :%5.1f\n",
s->
fps());
539 snprintf(m + strlen(m),
sizeof(m),
"Frame Time :%0.3f sec.\n", 1.0f /
s->
fps());
543 SLOptixPathtracer* opt =
sv->optixPathtracer();
544 snprintf(m + strlen(m),
sizeof(m),
"Renderer :OptiX Ray Tracer\n");
545 snprintf(m + strlen(m),
sizeof(m),
"Frame size :%d x %d\n",
sv->
scrW(),
sv->
scrH());
546 snprintf(m + strlen(m),
sizeof(m),
"Frame Time :%0.2f sec.\n", opt->renderSec());
547 snprintf(m + strlen(m),
sizeof(m),
"Denoiser Time :%0.0f ms.\n", opt->denoiserMS());
550 else if (rType ==
RT_pt)
565 snprintf(m + strlen(m),
sizeof(m),
"Renderer :Path Tracer\n");
566 snprintf(m + strlen(m),
sizeof(m),
"Progress :%3d%%\n", pt->
progressPC());
567 snprintf(m + strlen(m),
sizeof(m),
"Frame size :%d x %d\n", ptWidth, ptHeight);
568 snprintf(m + strlen(m),
sizeof(m),
"FPS :%0.2f\n", 1.0f / pt->
renderSec());
569 snprintf(m + strlen(m),
sizeof(m),
"Frame Time :%0.2f sec.\n", pt->
renderSec());
570 snprintf(m + strlen(m),
sizeof(m),
"Rays per ms :%0.0f\n", pt->
raysPerMS());
571 snprintf(m + strlen(m),
sizeof(m),
"Noise RSE :%0.4f\n", pt->
noiseRSE());
572 snprintf(m + strlen(m),
sizeof(m),
"Noise p99.9 :%0.4f\n", pt->
noiseRSE999());
573 snprintf(m + strlen(m),
sizeof(m),
"Efficiency :%0.2f\n", pt->
efficiency());
574 snprintf(m + strlen(m),
sizeof(m),
"Firefly Clamp:%s\n",
clamp);
575 snprintf(m + strlen(m),
sizeof(m),
"Samples/pix :%d\n", pt->
aaSamples());
576 snprintf(m + strlen(m),
sizeof(m),
"Threads :%d\n", pt->
numThreads());
577 snprintf(m + strlen(m),
sizeof(m),
"-------------------------------\n");
578 snprintf(m + strlen(m),
sizeof(m),
"Total rays :%10u (%3d%%)\n", rayTotal, 100);
581 snprintf(m + strlen(m),
sizeof(m),
" TIR :%10u\n",
SLRay::tirRays);
583 snprintf(m + strlen(m),
sizeof(m),
"-------------------------------\n");
586 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
587 ImGui::Begin(
"Timing", &
showStatsTiming, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
588 ImGui::TextUnformatted(m);
601 SLfloat voxelsEmpty = vox > 0.0f ? voxEmpty / vox * 100.0f : 0.0f;
603 SLfloat avgTriPerVox = vox > 0.0f ? numRTTria / (vox - voxEmpty) : 0.0f;
617 for (
auto* i : t->images())
618 cpuMBTexture += (
float)i->bytesPerImage();
619 cpuMBTexture = cpuMBTexture / 1E6f;
623 SLfloat cpuMBTotal = cpuMBTexture + cpuMBMeshes + cpuMBVoxels;
624 SLint cpuMBTexturePC =
std::abs(cpuMBTotal) < 1E-5f ? 0 : (
SLint)(cpuMBTexture / cpuMBTotal * 100.0f);
625 SLint cpuMBMeshesPC =
std::abs(cpuMBTotal) < 1E-5f ? 0 : (
SLint)(cpuMBMeshes / cpuMBTotal * 100.0f);
626 SLint cpuMBVoxelsPC =
std::abs(cpuMBTotal) < 1E-5f ? 0 : (
SLint)(cpuMBVoxels / cpuMBTotal * 100.0f);
629 SLfloat gpuMBTotal = gpuMBTexture + gpuMBVbo;
630 SLint gpuMBTexturePC =
std::abs(gpuMBTotal) < 1E-5 ? 0 : (
SLint)(gpuMBTexture / gpuMBTotal * 100.0f);
631 SLint gpuMBVboPC =
std::abs(gpuMBTotal) < 1E-5 ? 0 : (
SLint)(gpuMBVbo / gpuMBTotal * 100.0f);
633 snprintf(m + strlen(m),
sizeof(m),
"No. of Nodes :%5d (100%%)\n", stats3D.
numNodes);
634 snprintf(m + strlen(m),
sizeof(m),
"- Group Nodes :%5d (%3d%%)\n", stats3D.
numNodesGroup, numGroupPC);
635 snprintf(m + strlen(m),
sizeof(m),
"- Leaf Nodes :%5d (%3d%%)\n", stats3D.
numNodesLeaf, numLeafPC);
636 snprintf(m + strlen(m),
sizeof(m),
"- Light Nodes :%5d (%3d%%)\n", stats3D.
numLights, numLightsPC);
637 snprintf(m + strlen(m),
sizeof(m),
"- Opaque Nodes:%5d (%3d%%)\n", stats3D.
numNodesOpaque, numOpaquePC);
638 snprintf(m + strlen(m),
sizeof(m),
"- Blend Nodes :%5d (%3d%%)\n", stats3D.
numNodesBlended, numBlendedPC);
639 snprintf(m + strlen(m),
sizeof(m),
"- Overdrawn N.:%5d (%3d%%)\n", numOverdrawnNodes, numOverdrawnPC);
640 snprintf(m + strlen(m),
sizeof(m),
"- Vis. Nodes :%5d (%3d%%)\n", numVisibleNodes, numVisiblePC);
642 snprintf(m + strlen(m),
sizeof(m),
"No. of Meshes :%5u\n", stats3D.
numMeshes);
643 snprintf(m + strlen(m),
sizeof(m),
"No. of Tri. :%5u\n", stats3D.
numTriangles);
644 snprintf(m + strlen(m),
sizeof(m),
"CPU MB Total :%6.2f (100%%)\n", cpuMBTotal);
645 snprintf(m + strlen(m),
sizeof(m),
"- MB Tex. :%6.2f (%3d%%)\n", cpuMBTexture, cpuMBTexturePC);
646 snprintf(m + strlen(m),
sizeof(m),
"- MB Meshes :%6.2f (%3d%%)\n", cpuMBMeshes, cpuMBMeshesPC);
647 snprintf(m + strlen(m),
sizeof(m),
"- MB Voxels :%6.2f (%3d%%)\n", cpuMBVoxels, cpuMBVoxelsPC);
648 snprintf(m + strlen(m),
sizeof(m),
"GPU MB Total :%6.2f (100%%)\n", gpuMBTotal);
649 snprintf(m + strlen(m),
sizeof(m),
"- MB Tex. :%6.2f (%3d%%)\n", gpuMBTexture, gpuMBTexturePC);
650 snprintf(m + strlen(m),
sizeof(m),
"- MB VBO :%6.2f (%3d%%)\n", gpuMBVbo, gpuMBVboPC);
651 snprintf(m + strlen(m),
sizeof(m),
"No. of Voxels :%d\n", stats3D.
numVoxels);
652 snprintf(m + strlen(m),
sizeof(m),
"-empty Voxels :%4.1f%%\n", voxelsEmpty);
653 snprintf(m + strlen(m),
sizeof(m),
"Avg.Tri/Voxel :%4.1f\n", avgTriPerVox);
654 snprintf(m + strlen(m),
sizeof(m),
"Max.Tri/Voxel :%d\n", stats3D.
numVoxMaxTria);
657 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
658 ImGui::Begin(
"Scene Statistics", &
showStatsScene, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
661 ImGui::TextUnformatted(m);
663 ImGui::Text(
"Global Resources:");
665 string label =
"Meshes (" + std::to_string(am->
meshes().size()) +
")";
666 if (am->
meshes().size() && ImGui::TreeNode(label.c_str()))
669 ImGui::Text(
"[%d] %s (%u v.)",
671 am->
meshes()[i]->name().c_str(),
677 label =
"Lights (" + std::to_string(
s->
lights().size()) +
")";
678 if (
s->
lights().size() && ImGui::TreeNode(label.c_str()))
683 ImGui::Text(
"[%u] %s", i, light->
name().c_str());
694 SLVNode& matNodes = mat->nodesVisible3D();
703 if (ImGui::TreeNode(m))
705 for (
auto* node : matNodes)
706 ImGui::Text(node->name().c_str());
718 label =
"Meshes (" + std::to_string(am->
textures().size()) +
")";
719 if (am->
textures().size() && ImGui::TreeNode(label.c_str()))
723 if (am->
textures()[i]->images().empty())
724 ImGui::Text(
"[%u] %s on GPU (%s)", i, am->
textures()[i]->name().c_str(), am->
textures()[i]->isTexture() ?
"ok" :
"not ok");
726 ImGui::Text(
"[%u] %s (%s)", i, am->
textures()[i]->name().c_str(), am->
textures()[i]->isTexture() ?
"ok" :
"not ok");
732 label =
"Programs in AM (" + std::to_string(am->
programs().size()) +
")";
733 if (am->
programs().size() && ImGui::TreeNode(label.c_str()))
738 ImGui::Text(
"[%u] %s", i, p->
name().c_str());
744 if (ImGui::TreeNode(label.c_str()))
767 mirrored =
"horizontally & vertically";
769 mirrored =
"horizontally";
771 mirrored =
"vertically";
773 snprintf(m + strlen(m),
sizeof(m),
"Video Type : %s\n", vt ==
VT_NONE ?
"None" : vt ==
VT_MAIN ?
"Main Camera"
775 :
"Secondary Camera");
777 snprintf(m + strlen(m),
sizeof(m),
"Capture size : %d x %d\n", capSize.width, capSize.height);
778 snprintf(m + strlen(m),
sizeof(m),
"Size Index : %d\n", ac->
camSizeIndex());
779 snprintf(m + strlen(m),
sizeof(m),
"Mirrored : %s\n", mirrored.c_str());
781 snprintf(m + strlen(m),
sizeof(m),
"Undistorted : %s\n", ac->
showUndistorted() ?
"Yes" :
"No");
784 snprintf(m + strlen(m),
sizeof(m),
"fx,fy : %4.1f,%4.1f\n", c->
fx(), c->
fy());
785 snprintf(m + strlen(m),
sizeof(m),
"cx,cy : %4.1f,%4.1f\n", c->
cx(), c->
cy());
788 const float f = 100.f;
789 snprintf(m + strlen(m),
sizeof(m),
"dist.(*10e-2):\n");
790 snprintf(m + strlen(m),
sizeof(m),
"k1,k2 : %4.2f,%4.2f\n", c->
k1() * f, c->
k2() * f);
791 snprintf(m + strlen(m),
sizeof(m),
"p1,p2 : %4.2f,%4.2f\n", c->
p1() * f, c->
p2() * f);
792 if (distortionSize >= 8)
793 snprintf(m + strlen(m),
sizeof(m),
"k3,k4,k5,k6 : %4.2f,%4.2f,%4.2f,%4.2f\n", c->
k3() * f, c->
k4() * f, c->
k5() * f, c->
k6() * f);
795 snprintf(m + strlen(m),
sizeof(m),
"k3 : %4.2f\n", c->
k3() * f);
797 if (distortionSize >= 12)
798 snprintf(m + strlen(m),
sizeof(m),
"s1,s2,s3,s4 : %4.2f,%4.2f,%4.2f,%4.2f\n", c->
s1() * f, c->
s2() * f, c->
s3() * f, c->
s4() * f);
799 if (distortionSize >= 14)
800 snprintf(m + strlen(m),
sizeof(m),
"tauX,tauY : %4.2f,%4.2f\n", c->
tauX() * f, c->
tauY() * f);
802 snprintf(m + strlen(m),
sizeof(m),
"Calib. time : %s\n", c->
calibrationTime().c_str());
803 snprintf(m + strlen(m),
sizeof(m),
"Calib. state : %s\n", c->
stateStr().c_str());
804 snprintf(m + strlen(m),
sizeof(m),
"Num. caps : %d\n", c->
numCapturedImgs());
808 snprintf(m + strlen(m),
sizeof(m),
"-------------:\n");
812 snprintf(m + strlen(m),
sizeof(m),
"Dist. to zero: %4.2f\n", cameraPos.
length());
818 SLVec3f camToObj = objectPos - cameraPos;
819 snprintf(m + strlen(m),
sizeof(m),
"Dist. to obj.: %4.2f\n", camToObj.
length());
824 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
825 ImGui::Begin(
"Video", &
showStatsVideo, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
826 ImGui::TextUnformatted(m);
833 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
834 ImGui::Begin(
"WAI Statistics", &
showStatsWAI, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
836 if (!AverageTiming::instance().empty())
841 AverageTiming::getTimingMessage(m);
844 ImGui::TextUnformatted(m);
853 ImGui::ShowMetricsWindow();
859 ImGuiWindowFlags window_flags = 0;
860 window_flags |= ImGuiWindowFlags_NoTitleBar;
861 window_flags |= ImGuiWindowFlags_NoResize;
862 window_flags |= ImGuiWindowFlags_NoScrollbar;
863 window_flags |= ImGuiWindowFlags_NoNavInputs;
865 ImVec2 size = ImGui::CalcTextSize(
s->
info().c_str(),
872 ImGui::SetNextWindowPos(ImVec2(0, (
float)
sv->
scrH() - h));
873 ImGui::SetNextWindowSize(ImVec2(w, h));
875 ImGui::SetCursorPosX((w - size.x) * 0.5f);
876 ImGui::TextWrapped(
"%s", info.c_str());
882 ImGuiWindowFlags window_flags = 0;
883 window_flags |= ImGuiWindowFlags_AlwaysAutoResize;
884 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
885 ImGui::Begin(
"Transform Selected Node", &
showTransform, window_flags);
891 SLfloat t1 = 0.1f, t2 = 1.0f, t3 = 10.0f;
892 SLfloat r1 = 1.0f, r2 = 5.0f, r3 = 15.0f;
893 SLfloat s1 = 1.01f, s2 = 1.1f, s3 = 1.5f;
896 ImGui::Text(
"Space:");
898 if (ImGui::RadioButton(
"World", (
int *) &tSpace, 0)) tSpace =
TS_world;
900 if (ImGui::RadioButton(
"Parent", (
int *) &tSpace, 1)) tSpace =
TS_parent;
902 if (ImGui::RadioButton(
"Object", (
int *) &tSpace, 2)) tSpace =
TS_object;
905 ImGui::Text(
"Transl. X :");
907 if (ImGui::Button(
"<<<##Tx")) selNode->
translate(-t3, 0, 0, tSpace);
909 if (ImGui::Button(
"<<##Tx")) selNode->
translate(-t2, 0, 0, tSpace);
911 if (ImGui::Button(
"<##Tx")) selNode->
translate(-t1, 0, 0, tSpace);
913 if (ImGui::Button(
">##Tx")) selNode->
translate(t1, 0, 0, tSpace);
915 if (ImGui::Button(
">>##Tx")) selNode->
translate(t2, 0, 0, tSpace);
917 if (ImGui::Button(
">>>##Tx")) selNode->
translate(t3, 0, 0, tSpace);
919 ImGui::Text(
"Transl. Y :");
921 if (ImGui::Button(
"<<<##Ty")) selNode->
translate(0, -t3, 0, tSpace);
923 if (ImGui::Button(
"<<##Ty")) selNode->
translate(0, -t2, 0, tSpace);
925 if (ImGui::Button(
"<##Ty")) selNode->
translate(0, -t1, 0, tSpace);
927 if (ImGui::Button(
">##Ty")) selNode->
translate(0, t1, 0, tSpace);
929 if (ImGui::Button(
">>##Ty")) selNode->
translate(0, t2, 0, tSpace);
931 if (ImGui::Button(
">>>##Ty")) selNode->
translate(0, t3, 0, tSpace);
933 ImGui::Text(
"Transl. Z :");
935 if (ImGui::Button(
"<<<##Tz")) selNode->
translate(0, 0, -t3, tSpace);
937 if (ImGui::Button(
"<<##Tz")) selNode->
translate(0, 0, -t2, tSpace);
939 if (ImGui::Button(
"<##Tz")) selNode->
translate(0, 0, -t1, tSpace);
941 if (ImGui::Button(
">##Tz")) selNode->
translate(0, 0, t1, tSpace);
943 if (ImGui::Button(
">>##Tz")) selNode->
translate(0, 0, t2, tSpace);
945 if (ImGui::Button(
">>>##Tz")) selNode->
translate(0, 0, t3, tSpace);
947 ImGui::Text(
"Rotation X:");
949 if (ImGui::Button(
"<<<##Rx")) selNode->
rotate(r3, 1, 0, 0, tSpace);
951 if (ImGui::Button(
"<<##Rx")) selNode->
rotate(r2, 1, 0, 0, tSpace);
953 if (ImGui::Button(
"<##Rx")) selNode->
rotate(r1, 1, 0, 0, tSpace);
955 if (ImGui::Button(
">##Rx")) selNode->
rotate(-r1, 1, 0, 0, tSpace);
957 if (ImGui::Button(
">>##Rx")) selNode->
rotate(-r2, 1, 0, 0, tSpace);
959 if (ImGui::Button(
">>>##Rx")) selNode->
rotate(-r3, 1, 0, 0, tSpace);
961 ImGui::Text(
"Rotation Y:");
963 if (ImGui::Button(
"<<<##Ry")) selNode->
rotate(r3, 0, 1, 0, tSpace);
965 if (ImGui::Button(
"<<##Ry")) selNode->
rotate(r2, 0, 1, 0, tSpace);
967 if (ImGui::Button(
"<##Ry")) selNode->
rotate(r1, 0, 1, 0, tSpace);
969 if (ImGui::Button(
">##Ry")) selNode->
rotate(-r1, 0, 1, 0, tSpace);
971 if (ImGui::Button(
">>##Ry")) selNode->
rotate(-r2, 0, 1, 0, tSpace);
973 if (ImGui::Button(
">>>##Ry")) selNode->
rotate(-r3, 0, 1, 0, tSpace);
975 ImGui::Text(
"Rotation Z:");
977 if (ImGui::Button(
"<<<##Rz")) selNode->
rotate(r3, 0, 0, 1, tSpace);
979 if (ImGui::Button(
"<<##Rz")) selNode->
rotate(r2, 0, 0, 1, tSpace);
981 if (ImGui::Button(
"<##Rz")) selNode->
rotate(r1, 0, 0, 1, tSpace);
983 if (ImGui::Button(
">##Rz")) selNode->
rotate(-r1, 0, 0, 1, tSpace);
985 if (ImGui::Button(
">>##Rz")) selNode->
rotate(-r2, 0, 0, 1, tSpace);
987 if (ImGui::Button(
">>>##Rz")) selNode->
rotate(-r3, 0, 0, 1, tSpace);
989 ImGui::Text(
"Scale :");
991 if (ImGui::Button(
"<<<##S")) selNode->
scale(s3);
993 if (ImGui::Button(
"<<##S")) selNode->
scale(s2);
995 if (ImGui::Button(
"<##S")) selNode->
scale(s1);
997 if (ImGui::Button(
">##S")) selNode->
scale(-s1);
999 if (ImGui::Button(
">>##S")) selNode->
scale(-s2);
1001 if (ImGui::Button(
">>>##S")) selNode->
scale(-s3);
1005 if (ImGui::Button(
"Reset"))
1010 ImGui::Text(
"No node selected.");
1011 ImGui::Text(
"Please select a node by double clicking it.");
1026 snprintf(m + strlen(m),
sizeof(m),
"SLProject Version: %s\n",
AppCommon::version.c_str());
1028 snprintf(m + strlen(m),
sizeof(m),
"Build Config. : Debug\n");
1030 snprintf(m + strlen(m),
sizeof(m),
"Build Config. : Release\n");
1032 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1040 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1041 snprintf(m + strlen(m),
sizeof(m),
"OpenGL Version : %s\n", stateGL->
glVersionNO().c_str());
1042 snprintf(m + strlen(m),
sizeof(m),
"OpenGL Vendor : %s\n", stateGL->
glVendor().c_str());
1043 snprintf(m + strlen(m),
sizeof(m),
"OpenGL Renderer : %s\n", stateGL->
glRenderer().c_str());
1044 snprintf(m + strlen(m),
sizeof(m),
"OpenGL GLSL Ver. : %s\n", stateGL->
glSLVersionNO().c_str());
1045 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1046 snprintf(m + strlen(m),
sizeof(m),
"OpenCV Version : %d.%d.%d\n", CV_MAJOR_VERSION, CV_MINOR_VERSION, CV_VERSION_REVISION);
1047 snprintf(m + strlen(m),
sizeof(m),
"OpenCV has OpenCL: %s\n", cv::ocl::haveOpenCL() ?
"yes" :
"no");
1048 snprintf(m + strlen(m),
sizeof(m),
"OpenCV has AVX : %s\n", cv::checkHardwareSupport(CV_AVX) ?
"yes" :
"no");
1049 snprintf(m + strlen(m),
sizeof(m),
"OpenCV has NEON : %s\n", cv::checkHardwareSupport(CV_NEON) ?
"yes" :
"no");
1050 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1052 snprintf(m + strlen(m),
sizeof(m),
"Eigen Version : %d.%d.%d\n", EIGEN_WORLD_VERSION, EIGEN_MAJOR_VERSION, EIGEN_MINOR_VERSION);
1053 # ifdef EIGEN_VECTORIZE
1054 snprintf(m + strlen(m),
sizeof(m),
"Eigen vectorize : yes\n");
1056 snprintf(m + strlen(m),
sizeof(m),
"Eigen vectorize : no\n");
1059 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1060 snprintf(m + strlen(m),
sizeof(m),
"ImGui Version : %s\n", ImGui::GetVersion());
1063 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1064 ImGui::Begin(
"Device Informations", &
showInfosDevice, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1065 ImGui::TextUnformatted(m);
1075 snprintf(m + strlen(m),
sizeof(m),
"Uses IMU Senor : %s\n",
AppCommon::devRot.isUsed() ?
"yes" :
"no");
1076 snprintf(m + strlen(m),
sizeof(m),
"Pitch (deg) : %3.1f\n",
AppCommon::devRot.pitchDEG());
1077 snprintf(m + strlen(m),
sizeof(m),
"Yaw (deg) : %3.1f\n",
AppCommon::devRot.yawDEG());
1078 snprintf(m + strlen(m),
sizeof(m),
"Roll (deg) : %3.1f\n",
AppCommon::devRot.rollDEG());
1079 snprintf(m + strlen(m),
sizeof(m),
"No. averaged : %d\n",
AppCommon::devRot.numAveraged());
1082 snprintf(m + strlen(m),
sizeof(m),
"Rot. Offset mode : %s\n",
AppCommon::devRot.offsetModeStr().c_str());
1083 snprintf(m + strlen(m),
sizeof(m),
"------------------\n");
1084 snprintf(m + strlen(m),
sizeof(m),
"Uses GPS Sensor : %s\n",
AppCommon::devLoc.isUsed() ?
"yes" :
"no");
1085 snprintf(m + strlen(m),
sizeof(m),
"Latitude (deg) : %10.5f\n",
AppCommon::devLoc.locLatLonAlt().lat);
1086 snprintf(m + strlen(m),
sizeof(m),
"Longitude (deg) : %10.5f\n",
AppCommon::devLoc.locLatLonAlt().lon);
1087 snprintf(m + strlen(m),
sizeof(m),
"Alt. used (m) : %10.2f\n",
AppCommon::devLoc.locLatLonAlt().alt);
1088 snprintf(m + strlen(m),
sizeof(m),
"Alt. GPS (m) : %10.2f\n",
AppCommon::devLoc.altGpsM());
1089 snprintf(m + strlen(m),
sizeof(m),
"Alt. DEM (m) : %10.2f\n",
AppCommon::devLoc.altDemM());
1090 snprintf(m + strlen(m),
sizeof(m),
"Alt. origin (m) : %10.2f\n",
AppCommon::devLoc.altDemM());
1091 snprintf(m + strlen(m),
sizeof(m),
"Accuracy Rad.(m) : %6.1f\n",
AppCommon::devLoc.locAccuracyM());
1092 snprintf(m + strlen(m),
sizeof(m),
"Dist. Origin (m) : %6.1f\n", offsetToOrigin.
length());
1093 snprintf(m + strlen(m),
sizeof(m),
"Origin improve(s): %6.1f sec.\n",
AppCommon::devLoc.improveTime());
1094 snprintf(m + strlen(m),
sizeof(m),
"Loc. Offset mode : %s\n",
AppCommon::devLoc.offsetModeStr().c_str());
1098 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1099 ImGui::Begin(
"Sensor Information", &
showInfosSensors, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1100 ImGui::TextUnformatted(m);
1117 ImGuiWindowFlags window_flags = 0;
1118 window_flags |= ImGuiWindowFlags_AlwaysAutoResize;
1119 window_flags |= ImGuiWindowFlags_NoNavInputs;
1121 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1122 ImGui::Begin(
"User Interface Preferences", &
showUIPrefs, window_flags);
1123 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
1127 ImGuiStyle& style = ImGui::GetStyle();
1129 if (ImGui::SliderFloat(
"Item Spacing X", &style.ItemSpacing.x, 0.0f, 20.0f,
"%0.0f"))
1130 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = style.ItemSpacing.x;
1132 if (ImGui::SliderFloat(
"Item Spacing Y", &style.ItemSpacing.y, 0.0f, 20.0f,
"%0.0f"))
1134 style.FramePadding.y = style.ItemInnerSpacing.y = style.ItemSpacing.y;
1135 style.WindowPadding.y = style.ItemSpacing.y * 3;
1145 snprintf(reset,
sizeof(reset),
"Reset User Interface (DPI: %d)",
sv->
dpi());
1146 if (ImGui::MenuItem(reset))
1153 ImGui::PopItemWidth();
1163 ImGuiWindowFlags window_flags = 0;
1164 window_flags |= ImGuiWindowFlags_AlwaysAutoResize;
1165 window_flags |= ImGuiWindowFlags_NoNavInputs;
1167 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1168 ImGui::Begin(
"Date and Time Settings", &
showDateAndTime, window_flags);
1169 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
1173 memcpy(<, std::localtime(&
adjustedTime),
sizeof(tm));
1176 std::time_t now = std::time(
nullptr);
1177 memcpy(<, std::localtime(&now),
sizeof(tm));
1180 SLint month = lt.tm_mon + 1;
1181 if (ImGui::SliderInt(
"Month", &month, 1, 12))
1183 lt.tm_mon = month - 1;
1189 if (ImGui::SliderInt(
"Day", <.tm_mday, 1, 31))
1199 if (ImGui::SliderFloat(
"Hour", &nowF, SRh, SSh,
"%.2f"))
1201 lt.tm_hour = (int)nowF;
1202 lt.tm_min = (int)((nowF -
floor(nowF)) * 60.0f);
1209 std::time_t now = std::time(
nullptr);
1211 memcpy(&tnow, std::localtime(&now),
sizeof(tm));
1212 snprintf(strTime,
sizeof(strTime),
"Set now (%02d.%02d.%02d %02d:%02d)", tnow.tm_mday, tnow.tm_mon + 1, tnow.tm_year + 1900, tnow.tm_hour, tnow.tm_min);
1213 if (ImGui::MenuItem(strTime))
1216 memcpy(<, std::localtime(&now),
sizeof(tm));
1220 snprintf(strTime,
sizeof(strTime),
"Set highest noon (21.07.%02d 12:00)", lt.tm_year - 100);
1221 if (ImGui::MenuItem(strTime))
1233 snprintf(strTime,
sizeof(strTime),
"Set lowest noon (21.12.%02d 12:00)", lt.tm_year - 100);
1234 if (ImGui::MenuItem(strTime))
1254 float sum_aPdP = aP + dP;
1255 float ambiFraction = aP / sum_aPdP;
1257 if (ImGui::SliderFloat(
"Direct-Indirect", &ambiFraction, 0.0f, 1.0f,
"%.2f"))
1264 ImGui::PopItemWidth();
1274 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1280 ImGui::Begin(
"Christoffel",
1282 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1295 if (ImGui::Checkbox(
"Christoffelturm 1500-1800", &chrAltIsOn))
1302 if (ImGui::Checkbox(
"Christoffelturm 1800-1865", &chrNeuIsOn))
1308 if (ImGui::Checkbox(
"Baldachin", &baldachin))
1316 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1318 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1321 lookAtPoint.
set(-21, 18, 6);
1324 bool namedLocIsActive = namedLocIndex == i;
1325 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1341 ImGui::Begin(
"Biel Campus Biel/Bienne",
1343 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1345 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1347 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1352 bool namedLocIsActive = namedLocIndex == i;
1353 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1361 ImGui::Begin(
"Augst-Theatre-Temple",
1363 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1365 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1367 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1372 bool namedLocIsActive = namedLocIndex == i;
1373 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1381 ImGui::Begin(
"Avenche-Amphitheatre",
1383 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1385 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1387 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1392 bool namedLocIsActive = namedLocIndex == i;
1393 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1401 ImGui::Begin(
"Avenche-Cigognier",
1403 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1405 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1407 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1412 bool namedLocIsActive = namedLocIndex == i;
1413 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1420 ImGui::Begin(
"Avenche-Theatre",
1422 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1424 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1426 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1431 bool namedLocIsActive = namedLocIndex == i;
1432 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1440 ImGui::Begin(
"Sutz-Kirchrain18",
1442 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1444 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1446 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1451 bool namedLocIsActive = namedLocIndex == i;
1452 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1470 #ifndef SL_EMSCRIPTEN
1475 if (!strF.empty() && !strW.empty() && !strH.empty())
1477 float devF = strF.empty() ? 0.0f : stof(strF);
1478 float devW = strW.empty() ? 0.0f : stof(strW);
1479 float devH = strH.empty() ? 0.0f : stof(strH);
1527 static SLint curAnimIx = -1;
1528 if (!hasAnimations) curAnimIx = -1;
1534 if (ImGui::BeginMainMenuBar())
1536 if (ImGui::BeginMenu(
"File"))
1538 if (ImGui::BeginMenu(
"Load Test Scene"))
1540 if (ImGui::BeginMenu(
"General"))
1542 if (ImGui::MenuItem(
"Minimal Scene",
nullptr, sid ==
SID_Minimal))
1544 if (ImGui::MenuItem(
"Figure Scene",
nullptr, sid ==
SID_Figure))
1546 if (ImGui::MenuItem(
"Mesh Loader",
nullptr, sid ==
SID_MeshLoad))
1548 if (ImGui::MenuItem(
"Revolver Meshes",
nullptr, sid ==
SID_Revolver))
1554 #ifdef SL_BUILD_WITH_KTX
1558 if (ImGui::MenuItem(
"Frustum Culling",
nullptr, sid ==
SID_FrustumCull))
1560 if (ImGui::MenuItem(
"2D and 3D Text",
nullptr, sid ==
SID_2Dand3DText))
1564 if (ImGui::MenuItem(
"Z-Fighting",
nullptr, sid ==
SID_ZFighting))
1570 if (ImGui::BeginMenu(
"Shader"))
1578 if (ImGui::MenuItem(
"Image Based Lighting",
nullptr, sid ==
SID_ShaderIBL))
1580 if (ImGui::MenuItem(
"Per Vertex Wave",
nullptr, sid ==
SID_ShaderWave))
1593 if (ImGui::BeginMenu(
"Shadow Mapping"))
1613 if (ImGui::BeginMenu(
"Suzanne Lighting"))
1648 if (ImGui::BeginMenu(
"glTF Sample Models"))
1656 if (ImGui::MenuItem(
"Sponza Palace",
nullptr, sid ==
SID_glTF_Sponza))
1664 if (ImGui::BeginMenu(
"Robotics"))
1674 if (ImGui::BeginMenu(
"Volume Rendering"))
1737 if (ImGui::BeginMenu(
"Animation"))
1753 if (ImGui::BeginMenu(
"Video"))
1757 #ifndef SL_EMSCRIPTEN
1771 #ifndef SL_EMSCRIPTEN
1777 #ifdef SL_BUILD_WITH_MEDIAPIPE
1790 if (ImGui::BeginMenu(
"Ray Tracing"))
1792 if (ImGui::MenuItem(
"Spheres",
nullptr, sid ==
SID_RTSpheres))
1796 if (ImGui::MenuItem(
"Depth of Field",
nullptr, sid ==
SID_RTDoF))
1798 if (ImGui::MenuItem(
"Lens Test",
nullptr, sid ==
SID_RTLens))
1804 if (ImGui::BeginMenu(
"Path Tracing"))
1814 if (ImGui::BeginMenu(
"Particle Systems"))
1838 SLstring modelBR2 = erlebarPath +
"bern/bern-christoffel.gltf";
1839 SLstring modelBFH = erlebarPath +
"biel/Biel-BFH-Rolex.gltf";
1840 SLstring modelCBB = erlebarPath +
"biel/Biel-CBB-AR.gltf";
1841 SLstring modelAR1 = erlebarPath +
"augst/augst-thtL1-tmpL2.gltf";
1842 SLstring modelAR2 = erlebarPath +
"augst/augst-thtL2-tmpL1.gltf";
1843 SLstring modelAR3 = erlebarPath +
"augst/augst-thtL1L2-tmpL1L2.gltf";
1844 SLstring modelAV1_AO = erlebarPath +
"avenches/avenches-amphitheater.gltf";
1845 SLstring modelAV2_AO = erlebarPath +
"avenches/avenches-cigognier.gltf";
1846 SLstring modelAV3 = erlebarPath +
"avenches/avenches-theater.gltf";
1847 SLstring modelSU1 = erlebarPath +
"sutz/Sutz-Kirchrain18.gltf";
1857 if (ImGui::BeginMenu(
"Erleb-AR"))
1895 if (ImGui::BeginMenu(
"Benchmarks"))
1897 #ifndef SL_EMSCRIPTEN
2002 if (ImGui::MenuItem(
"Empty Scene",
"Shift-Alt-0", sid ==
SID_Empty))
2005 if (ImGui::MenuItem(
"Next Scene",
2011 if (ImGui::MenuItem(
"Previous Scene",
2017 #ifndef SL_EMSCRIPTEN
2020 if (ImGui::MenuItem(
"Multi-threaded Jobs"))
2027 uint maxIter = 100000;
2030 for (uint i = 0; i < maxIter; ++i)
2033 int progressPC = (int)((
float)i / (float)maxIter * 100.0f);
2044 uint maxIter = 100000;
2047 for (uint i = 0; i < maxIter; ++i)
2050 int progressPC = (int)((
float)i / (float)maxIter * 100.0f);
2056 auto followUpJob1 = []()
2057 {
SL_LOG(
"followUpJob1"); };
2058 auto jobToFollow2 = []()
2059 {
SL_LOG(
"JobToFollow2"); };
2068 #if !defined(SL_OS_ANDROID) && !defined(SL_EMSCRIPTEN)
2071 if (ImGui::MenuItem(
"Quit & Save"))
2078 if (ImGui::BeginMenu(
"Preferences"))
2092 if (ImGui::MenuItem(
"Do Depth Test",
"T",
sv->
doDepthTest()))
2100 if (ImGui::BeginMenu(
"Viewport Aspect"))
2108 SLchar strSameAsVideo[256];
2109 snprintf(strSameAsVideo,
sizeof(strSameAsVideo),
"Same as Video (%d:%d)", videoAspect.
x, videoAspect.
y);
2139 #if defined(SL_OS_ANDROID) || defined(SL_OS_MACIOS)
2140 if (ImGui::BeginMenu(
"Rotation Sensor"))
2144 if (ImGui::MenuItem(
"Use Device Rotation (IMU)",
nullptr, devRot.
isUsed()))
2150 if (ImGui::SliderInt(
"Average length", &numAveraged, 1, 10))
2153 if (ImGui::BeginMenu(
"Offset Mode"))
2156 if (ImGui::MenuItem(
"None",
nullptr, om ==
ROM_none))
2158 if (ImGui::MenuItem(
"Finger rot. X",
nullptr, om ==
ROM_oneFingerX))
2160 if (ImGui::MenuItem(
"Finger rot. X and Y",
nullptr, om ==
ROM_oneFingerXY))
2166 if (ImGui::MenuItem(
"Zero Yaw at Start",
nullptr, devRot.
zeroYawAtStart()))
2169 if (ImGui::MenuItem(
"Reset Zero Yaw"))
2184 if (ImGui::BeginMenu(
"Location Sensor"))
2188 if (ImGui::MenuItem(
"Use Device Location (GPS)",
nullptr,
AppCommon::devLoc.isUsed()))
2192 if (ImGui::MenuItem(
"Use Origin Altitude",
nullptr,
AppCommon::devLoc.useOriginAltitude()))
2195 if (ImGui::MenuItem(
"Reset Origin to here"))
2198 if (ImGui::BeginMenu(
"Offset Mode"))
2201 if (ImGui::MenuItem(
"None",
nullptr, om ==
LOM_none))
2203 if (ImGui::MenuItem(
"Two Finger Y",
nullptr, om ==
LOM_twoFingerY))
2213 if (ImGui::BeginMenu(
"Video Sensor"))
2216 if (ImGui::BeginMenu(
"Mirror Camera"))
2218 if (ImGui::MenuItem(
"Horizontally",
nullptr, ac->
mirrorH()))
2225 if (ImGui::MenuItem(
"Vertically",
nullptr, ac->
mirrorV()))
2235 if (ImGui::BeginMenu(
"Resolution",
2239 for (
int i = 0; i < (int)capture->
camSizes.size(); ++i)
2246 capture->
camSizes[(uint)i].height);
2254 #ifndef SL_EMSCRIPTEN
2255 if (ImGui::BeginMenu(
"Calibration"))
2257 if (ImGui::MenuItem(
"Start Calibration (Main Camera)"))
2264 if (ImGui::MenuItem(
"Start Calibration (Scnd. Camera)",
nullptr,
false, capture->
hasSecondaryCamera))
2303 if (ImGui::BeginMenu(
"Feature Tracking", featureTracker !=
nullptr) && featureTracker !=
nullptr)
2305 if (ImGui::MenuItem(
"Force Relocation",
nullptr, featureTracker->
forceRelocation()))
2308 if (ImGui::BeginMenu(
"Detector/Descriptor", featureTracker !=
nullptr))
2312 if (ImGui::MenuItem(
"RAUL/RAUL",
nullptr, type ==
DDT_RAUL_RAUL))
2314 if (ImGui::MenuItem(
"ORB/ORB",
nullptr, type ==
DDT_ORB_ORB))
2316 if (ImGui::MenuItem(
"FAST/BRIEF",
nullptr, type ==
DDT_FAST_BRIEF))
2318 if (ImGui::MenuItem(
"SURF/SURF",
nullptr, type ==
DDT_SURF_SURF))
2320 if (ImGui::MenuItem(
"SIFT/SIFT",
nullptr, type ==
DDT_SIFT_SIFT))
2335 ImGui::MenuItem(
"UI Preferences",
nullptr, &
showUIPrefs);
2348 if (ImGui::MenuItem(
"Clear selection"))
2350 sv->
camera()->selectRect().setZero();
2351 sv->
camera()->deselectRect().setZero();
2358 if (ImGui::BeginMenu(
"Renderer"))
2360 if (ImGui::MenuItem(
"OpenGL",
"ESC", rType ==
RT_gl))
2363 if (ImGui::MenuItem(
"Ray Tracing",
"R", rType ==
RT_rt))
2366 if (ImGui::MenuItem(
"Path Tracing",
"P", rType ==
RT_pt))
2374 if (ImGui::MenuItem(
"Ray Tracing with OptiX",
2377 SLOptix::available))
2378 sv->startOptixRaytracing(5);
2380 if (ImGui::MenuItem(
"Path Tracing with OptiX",
2383 SLOptix::available))
2384 sv->startOptixPathtracing(5, 10);
2386 ImGui::MenuItem(
"Ray Tracing with OptiX",
nullptr,
false,
false);
2387 ImGui::MenuItem(
"Path Tracing with OptiX",
nullptr,
false,
false);
2394 if (ImGui::BeginMenu(
"GL"))
2429 if (ImGui::MenuItem(
"All off"))
2432 if (ImGui::MenuItem(
"All on"))
2446 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2448 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2450 ImGui::PopItemWidth();
2455 else if (rType ==
RT_rt)
2457 if (ImGui::BeginMenu(
"RT"))
2461 if (ImGui::BeginMenu(
"Resolution Factor"))
2482 if (ImGui::MenuItem(
"Parallel distributed",
nullptr, rt->
doDistributed()))
2488 if (ImGui::MenuItem(
"Continuously",
nullptr, rt->
doContinuous()))
2494 if (ImGui::MenuItem(
"Fresnel Reflection",
nullptr, rt->
doFresnel()))
2500 if (ImGui::BeginMenu(
"Max. Depth"))
2511 if (ImGui::BeginMenu(
"Anti-Aliasing Samples"))
2522 if (ImGui::MenuItem(
"Save Rendered Image"))
2525 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2527 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2532 ImGui::PopItemWidth();
2541 if (ImGui::BeginMenu(
"RT"))
2543 SLOptixRaytracer* rt_optix =
sv->optixRaytracer();
2545 if (ImGui::MenuItem(
"Parallel distributed",
nullptr, rt_optix->doDistributed()))
2547 rt_optix->doDistributed(!rt_optix->doDistributed());
2548 sv->startOptixRaytracing(rt_optix->maxDepth());
2557 if (ImGui::BeginMenu(
"Max. Depth"))
2559 if (ImGui::MenuItem(
"1",
nullptr, rt_optix->maxDepth() == 1))
2560 sv->startOptixRaytracing(1);
2561 if (ImGui::MenuItem(
"2",
nullptr, rt_optix->maxDepth() == 2))
2562 sv->startOptixRaytracing(2);
2563 if (ImGui::MenuItem(
"3",
nullptr, rt_optix->maxDepth() == 3))
2564 sv->startOptixRaytracing(3);
2565 if (ImGui::MenuItem(
"5",
nullptr, rt_optix->maxDepth() == 5))
2566 sv->startOptixRaytracing(5);
2567 if (ImGui::MenuItem(
"Max. Contribution",
nullptr, rt_optix->maxDepth() == 0))
2568 sv->startOptixRaytracing(0);
2589 if (ImGui::MenuItem(
"Save Rendered Image"))
2590 rt_optix->saveImage();
2596 else if (rType ==
RT_pt)
2598 if (ImGui::BeginMenu(
"PT"))
2602 if (ImGui::BeginMenu(
"Resolution Factor"))
2623 if (ImGui::BeginMenu(
"NO. of Samples"))
2634 if (ImGui::BeginMenu(
"Firefly Clamp"))
2641 if (ImGui::MenuItem(
"Off (unbiased)",
nullptr, pt->
sampleClamp() == 0.0f))
2646 if (ImGui::MenuItem(
"10",
nullptr, pt->
sampleClamp() == 10.0f))
2651 if (ImGui::MenuItem(
"5",
nullptr, pt->
sampleClamp() == 5.0f))
2656 if (ImGui::MenuItem(
"3",
nullptr, pt->
sampleClamp() == 3.0f))
2665 if (ImGui::MenuItem(
"Direct illumination",
nullptr, pt->
calcDirect()))
2671 if (ImGui::MenuItem(
"Indirect illumination",
nullptr, pt->
calcIndirect()))
2677 if (ImGui::MenuItem(
"Save Rendered Image"))
2680 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2682 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2687 ImGui::PopItemWidth();
2696 if (ImGui::BeginMenu(
"PT"))
2698 SLOptixPathtracer* pt =
sv->optixPathtracer();
2700 if (ImGui::BeginMenu(
"NO. of Samples"))
2702 if (ImGui::MenuItem(
"1",
nullptr, pt->samples() == 1))
2703 sv->startOptixPathtracing(5, 1);
2704 if (ImGui::MenuItem(
"10",
nullptr, pt->samples() == 10))
2705 sv->startOptixPathtracing(5, 10);
2706 if (ImGui::MenuItem(
"100",
nullptr, pt->samples() == 100))
2707 sv->startOptixPathtracing(5, 100);
2708 if (ImGui::MenuItem(
"1000",
nullptr, pt->samples() == 1000))
2709 sv->startOptixPathtracing(5, 1000);
2710 if (ImGui::MenuItem(
"10000",
nullptr, pt->samples() == 10000))
2711 sv->startOptixPathtracing(5, 10000);
2716 if (ImGui::MenuItem(
"Denoiser",
nullptr, pt->getDenoiserEnabled()))
2718 pt->setDenoiserEnabled(!pt->getDenoiserEnabled());
2719 sv->startOptixPathtracing(5, pt->samples());
2722 if (ImGui::MenuItem(
"Save Rendered Image"))
2730 if (ImGui::BeginMenu(
"Camera"))
2735 if (ImGui::MenuItem(
"Reset"))
2742 if (ImGui::BeginMenu(
"Look from"))
2753 if (ImGui::MenuItem(
"Next camera in Scene",
"TAB"))
2756 if (ImGui::MenuItem(
"Sceneview Camera",
"TAB"))
2763 if (ImGui::BeginMenu(
"Projection"))
2770 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2788 if (ImGui::BeginMenu(
"Stereo"))
2793 if (ImGui::MenuItem(pStr.c_str(),
nullptr, proj == (
SLProjType)p))
2801 if (ImGui::SliderFloat(
"Eye Sep.", &eyeSepar, 0.0f, focalDist / 10.f))
2810 if (ImGui::SliderFloat(
"FOV (V)", &fov, 1.f, 179.f))
2813 ImGui::Text(
"FOV (H): %3.1f ", cam->
fovH());
2815 if (ImGui::SliderFloat(
"Near Clip", &clipN, 0.001f, 10.f))
2818 if (ImGui::SliderFloat(
"Focal Dist.", &focalDist, clipN, clipF))
2821 if (ImGui::SliderFloat(
"Far Clip", &clipF, clipN, std::min(clipF * 1.1f, 1000000.f)))
2824 ImGui::PopItemWidth();
2828 if (ImGui::BeginMenu(
"Animation"))
2832 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2834 if (ImGui::MenuItem(
"Turntable Y up",
nullptr, ca ==
CA_turntableYUp))
2837 if (ImGui::MenuItem(
"Turntable Z up",
nullptr, ca ==
CA_turntableZUp))
2840 if (ImGui::MenuItem(
"Trackball",
nullptr, ca ==
CA_trackball))
2843 if (ImGui::MenuItem(
"Walk Y up",
nullptr, ca ==
CA_walkingYUp))
2846 if (ImGui::MenuItem(
"Walk Z up",
nullptr, ca ==
CA_walkingZUp))
2849 float mouseRotFactor =
sv->
camera()->mouseRotationFactor();
2850 if (ImGui::SliderFloat(
"Mouse Sensibility", &mouseRotFactor, 0.1f, 2.0f,
"%2.1f"))
2851 sv->
camera()->mouseRotationFactor(mouseRotFactor);
2864 if (ImGui::SliderFloat(
"Walk Speed", &ms, 0.01f, std::min(ms * 1.1f, 10000.f)))
2868 ImGui::PopItemWidth();
2872 if (ImGui::BeginMenu(
"Fog"))
2874 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2876 if (ImGui::MenuItem(
"Fog is on",
nullptr, cam->
fogIsOn()))
2879 if (ImGui::BeginMenu(
"Mode"))
2883 if (ImGui::MenuItem(
"exp",
nullptr, cam->
fogMode() ==
FM_exp))
2893 if (ImGui::SliderFloat(
"Density", &fogDensity, 0.0f, 0.2f))
2897 ImGui::PopItemWidth();
2904 if (ImGui::BeginMenu(
"Animation", hasAnimations))
2913 if (curAnimIx == -1) curAnimIx = 0;
2916 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.8f);
2917 if (
myComboBox(
"##", &curAnimIx, animations))
2919 ImGui::PopItemWidth();
2927 if (ImGui::MenuItem(
"Pause",
nullptr, anim->
isPaused()))
2930 if (ImGui::MenuItem(
"Stop",
nullptr, anim->
isStopped()))
2933 if (ImGui::MenuItem(
"Skip to next keyfr.",
nullptr,
false))
2936 if (ImGui::MenuItem(
"Skip to prev. keyfr.",
nullptr,
false))
2939 if (ImGui::MenuItem(
"Skip to start",
nullptr,
false))
2942 if (ImGui::MenuItem(
"Skip to end",
nullptr,
false))
2945 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.6f);
2948 if (ImGui::SliderFloat(
"Speed", &speed, 0.f, 4.f))
2953 if (ImGui::SliderFloat(
"Time", &localTimeSec, 0.f, lenSec))
2957 const char* easings[] = {
"linear",
2978 if (ImGui::Combo(
"Easing", &curEasing, easings, IM_ARRAYSIZE(easings)))
2981 ImGui::PopItemWidth();
2985 if (ImGui::BeginMenu(
"Infos"))
2989 if (ImGui::BeginMenu(
"Statistics"))
2996 ImGui::MenuItem(
"Stats on WAI",
nullptr, &
showStatsWAI);
3008 ImGui::MenuItem(
"UI-Preferences",
nullptr, &
showUIPrefs);
3016 ImGui::MenuItem(
"ErlebAR Settings",
nullptr, &
showErlebAR);
3019 ImGui::MenuItem(
"Help on Interaction",
nullptr, &
showHelp);
3022 ImGui::MenuItem(
"Credits",
nullptr, &
showCredits);
3023 ImGui::MenuItem(
"About SLProject",
nullptr, &
showAbout);
3028 ImGui::EndMainMenuBar();
3035 if (ImGui::MenuItem(
"Deselect Node",
"ESC"))
3064 if (ImGui::BeginMenu(
"Node Flags"))
3098 if (ImGui::MenuItem(
"All off"))
3110 if (!ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) &&
3111 ImGui::IsMouseReleased(1))
3113 ImGui::OpenPopup(
"Context Menu");
3116 if (ImGui::BeginPopup(
"Context Menu"))
3126 if (ImGui::MenuItem(
"Show Properties"))
3132 if (ImGui::MenuItem(
"Show user interface"))
3136 if (ImGui::MenuItem(
"Hide user interface"))
3140 if (ImGui::MenuItem(
"Show root node"))
3144 if (ImGui::MenuItem(
"Hide root node"))
3147 if (ImGui::MenuItem(
"Capture Screen"))
3161 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
3162 ImGui::Begin(
"Scenegraph", &
showSceneGraph, ImGuiWindowFlags_NoNavInputs);
3186 ImGuiTreeNodeFlags nodeFlags = 0;
3188 nodeFlags |= ImGuiTreeNodeFlags_Leaf;
3190 nodeFlags |= ImGuiTreeNodeFlags_OpenOnArrow;
3193 nodeFlags |= ImGuiTreeNodeFlags_Selected;
3197 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 1.0f, 1.0f));
3198 nodeIsOpen = ImGui::TreeNodeEx(node->
name().c_str(), nodeFlags);
3199 ImGui::PopStyleColor();
3203 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 0.0f, 1.0f));
3204 nodeIsOpen = ImGui::TreeNodeEx(node->
name().c_str(), nodeFlags);
3205 ImGui::PopStyleColor();
3208 if (ImGui::IsItemClicked())
3219 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
3221 ImGuiTreeNodeFlags meshFlags = ImGuiTreeNodeFlags_Leaf;
3223 meshFlags |= ImGuiTreeNodeFlags_Selected;
3225 ImGui::TreeNodeEx(mesh, meshFlags,
"%s", mesh->
name().c_str());
3227 if (ImGui::IsItemClicked())
3234 ImGui::PopStyleColor();
3237 for (
auto* child : node->
children())
3255 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
3256 ImGui::Begin(
"Properties", &
showProperties, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoNavInputs);
3257 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 1.0f, 1.0f));
3259 if (ImGui::TreeNode(
"Scene Properties"))
3263 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3265 if (ImGui::ColorEdit3(
"Global Ambient Color", (
float*)&gAC, cef))
3266 s->
lights()[0]->globalAmbient = gAC;
3269 if (ImGui::TreeNode(
"Sky",
"Skybox"))
3278 if (ImGui::SliderFloat(
"Exposure", &exposure, 0.05f, 5.0f))
3292 ImGui::Text(
"No properties for skyboxes that are not used for lighting (HDR)");
3297 ImGui::Text(
"Skybox: None");
3304 ImGui::PopStyleColor();
3311 if (singleNode && !partialSelection)
3313 if (ImGui::TreeNode(
"Node Properties"))
3319 ImGui::Text(
"Node name : %s", singleNode->
name().c_str());
3320 ImGui::Text(
"# children : %u", c);
3321 ImGui::Text(
"# meshes : %u", m);
3322 if (ImGui::TreeNode(
"Drawing flags"))
3325 if (ImGui::Checkbox(
"Hide", &db))
3329 if (ImGui::Checkbox(
"Not selectable", &db))
3333 if (ImGui::Checkbox(
"Show wireframe", &db))
3337 if (ImGui::Checkbox(
"Show with hard edges", &db))
3341 if (ImGui::Checkbox(
"Show only hard edges", &db))
3345 if (ImGui::Checkbox(
"Show normals", &db))
3349 if (ImGui::Checkbox(
"Show voxels", &db))
3353 if (ImGui::Checkbox(
"Show bounding boxes", &db))
3357 if (ImGui::Checkbox(
"Show bounding rects", &db))
3361 if (ImGui::Checkbox(
"Show axis", &db))
3365 if (ImGui::Checkbox(
"Show back faces", &db))
3371 if (ImGui::TreeNode(
"Local transform"))
3378 ImGui::Text(
"Translation : %s", trn.
toString().c_str());
3379 ImGui::Text(
"Rotation : %s", rot.
toString().c_str());
3380 ImGui::Text(
"Scaling : %s", scl.
toString().c_str());
3385 if (ImGui::TreeNode(
"Shadow mapping"))
3388 if (ImGui::Checkbox(
"Casts shadows", &castsShadows))
3391 if (
auto* light =
dynamic_cast<SLLight*
>(singleNode))
3393 SLbool createsShadows = light->createsShadows();
3394 if (ImGui::Checkbox(
"Creates shadows", &createsShadows))
3395 light->createsShadows(createsShadows);
3401 if (shadowMap !=
nullptr)
3404 light->spotCutOffDEG() < 90.0f)
3407 if (ImGui::Checkbox(
"Uses Cubemap", &useCubemap))
3417 if (ImGui::SliderFloat(
"Near clipping plane", &clipNear, 0.01f, clipFar))
3420 if (ImGui::SliderFloat(
"Far clipping plane", &clipFar, clipNear, 200.0f))
3427 if (ImGui::SliderInt(
"Number of cascades", &numCascades, 1, maxCascades))
3429 if (ImGui::SliderFloat(
"Cascades factor", &factor, 1.0, 500.0f))
3434 if (ImGui::SliderInt2(
"Texture resolution", (
int*)&texSize, 32, 4096))
3439 SLfloat shadowMinBias = light->shadowMinBias();
3440 SLfloat shadowMaxBias = light->shadowMaxBias();
3441 if (ImGui::SliderFloat(
"Min. shadow bias", &shadowMinBias, 0.0f, shadowMaxBias,
"%.03f"))
3442 light->shadowMinBias(shadowMinBias);
3443 if (ImGui::SliderFloat(
"Max. shadow bias", &shadowMaxBias, shadowMinBias, 0.02f,
"%.03f"))
3444 light->shadowMaxBias(shadowMaxBias);
3449 if (ImGui::InputFloat2(
"Size", (
float*)&size))
3450 shadowMap->
size(size);
3455 SLbool doSmoothShadows = light->doSoftShadows();
3456 if (ImGui::Checkbox(
"Do smooth shadows", &doSmoothShadows))
3457 light->doSmoothShadows(doSmoothShadows);
3459 SLuint pcfLevel = light->softShadowLevel();
3460 if (ImGui::SliderInt(
"Smoothing level", (
SLint*)&pcfLevel, 1, 3))
3461 light->smoothShadowLevel(pcfLevel);
3465 if (ImGui::Checkbox(
"Do colored shadows", &doColoredShadows))
3469 if (ImGui::InputInt2(
"Visualization rays", (
int*)&rayCount))
3475 if (ImGui::TreeNode(
"Light cascade space matrices"))
3485 if (ImGui::TreeNode(shadowMap->
useCubemap() ?
"Light space matrices" :
"Light space matrix"))
3488 for (
SLint i = 0; i < 6; ++i)
3501 for (
int i = 0; i < shadowMap->
depthBuffers().size(); i++)
3503 ImGui::Text((
"Depth Buffer " + std::to_string(i) +
":").c_str());
3504 ImGui::Image((
void*)(intptr_t)shadowMap->
depthBuffers().at(i)->texID(),
3510 ImGui::Text(
"Depth Buffer:");
3523 if (
typeid(*singleNode) ==
typeid(
SLCamera))
3527 if (ImGui::TreeNode(
"Camera"))
3529 SLfloat clipN = cam->clipNear();
3530 SLfloat clipF = cam->clipFar();
3531 SLfloat focalDist = cam->focalDist();
3534 const char* projections[] = {
"Mono Perspective",
3535 "Mono Intrinsic Calibrated",
3536 "Mono Orthographic",
3537 "Stereo Side By Side",
3538 "Stereo Side By Side Prop.",
3539 "Stereo Side By Side Dist.",
3540 "Stereo Line By Line",
3541 "Stereo Column By Column",
3542 "Stereo Pixel By Pixel",
3543 "Stereo Color Red-Cyan",
3544 "Stereo Color Red-Green",
3545 "Stereo Color Red-Blue",
3546 "Stereo Color Yellow-Blue"};
3548 int proj = cam->projType();
3549 if (ImGui::Combo(
"Projection", &proj, projections, IM_ARRAYSIZE(projections)))
3554 SLfloat eyeSepar = cam->stereoEyeSeparation();
3555 if (ImGui::SliderFloat(
"Eye Sep.", &eyeSepar, 0.0f, focalDist / 10.f))
3556 cam->stereoEyeSeparation(eyeSepar);
3559 if (ImGui::SliderFloat(
"FOV", &fov, 1.f, 179.f))
3562 if (ImGui::SliderFloat(
"Near Clip", &clipN, 0.001f, 10.f))
3563 cam->clipNear(clipN);
3565 if (ImGui::SliderFloat(
"Far Clip", &clipF, clipN, std::min(clipF * 1.1f, 1000000.f)))
3566 cam->clipFar(clipF);
3568 if (ImGui::SliderFloat(
"Focal Dist.", &focalDist, clipN, clipF))
3569 cam->focalDist(focalDist);
3582 SLbool doSunPowerAdaptation =
false;
3586 typeName =
"Light (spot):";
3591 typeName =
"Light (rectangular):";
3596 typeName =
"Light (directional):";
3597 doSunPowerAdaptation = ((
SLLightDirect*)singleNode)->doSunPowerAdaptation();
3600 if (light && ImGui::TreeNode(typeName.c_str()))
3603 if (ImGui::Checkbox(
"Is on", &on))
3606 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3608 if (ImGui::ColorEdit3(
"Ambient color", (
float*)&aC, cef))
3613 if (doSunPowerAdaptation)
3615 float sum_aPdP = aP + dP;
3616 float ambiFraction = aP / sum_aPdP;
3617 if (ImGui::SliderFloat(
"Diffuse-Ambient-Mix", &ambiFraction, 0.0f, 1.0f,
"%.2f"))
3626 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dC, cef))
3630 if (ImGui::ColorEdit3(
"Specular color", (
float*)&sC, cef))
3634 if (ImGui::SliderFloat(
"Ambient power", &aP, 0.0f, 10.0f,
"%.2f"))
3637 if (ImGui::SliderFloat(
"Diffuse power", &dP, 0.0f, 10.0f,
"%.2f"))
3641 if (ImGui::SliderFloat(
"Specular power", &sP, 0.0f, 10.0f,
"%.2f"))
3645 if (ImGui::SliderFloat(
"Spot cut off angle", &cutoff, 0.0f, 180.0f,
"%.2f"))
3649 if (ImGui::SliderFloat(
"Spot attenuation", &spotExp, 0.0f, 128.0f,
"%.2f"))
3652 float kc = light->
kc();
3653 if (ImGui::SliderFloat(
"Constant attenuation", &kc, 0.0f, 1.0f,
"%.2f"))
3656 float kl = light->
kl();
3657 if (ImGui::SliderFloat(
"Linear attenuation", &kl, 0.0f, 1.0f,
"%.2f"))
3660 float kq = light->
kq();
3661 if (ImGui::SliderFloat(
"Quadratic attenuation", &kq, 0.0f, 1.0f,
"%.2f"))
3667 if (ImGui::Checkbox(
"Do Sun Power Adaptation", &doSunPowerAdaptation))
3670 if (doSunPowerAdaptation)
3673 if (ImGui::TreeNode(
"Sun Color LUT"))
3681 ImGui::GetWindowWidth() - 4 * ImGui::GetTreeNodeToLabelSpacing() - 10;
3682 void* tid = (ImTextureID)(uintptr_t)lut->
texID();
3684 ImVec2(texW, texW * 0.15f),
3688 ImVec4(1, 1, 1, 1));
3698 ImGui::Text(
"No single node selected.");
3703 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
3709 if (ImGui::TreeNode(
"Mesh Properties"))
3712 SLuint t = (
SLuint)(!singleFullMesh->
I16.empty() ? singleFullMesh->
I16.size() / 3 : singleFullMesh->
I32.size() / 3);
3713 SLuint e = (
SLuint)(!singleFullMesh->
IE16.empty() ? singleFullMesh->
IE16.size() / 2 : singleFullMesh->
IE32.size() / 2);
3715 ImGui::Text(
"Mesh name : %s", singleFullMesh->
name().c_str());
3719 ImGui::Text(
"# vertices : %u", ps->
amount() * 4);
3720 ImGui::Text(
"# triangles : %u", ps->
amount() * 2);
3724 ImGui::Text(
"# vertices : %u", v);
3725 ImGui::Text(
"# triangles : %u", t);
3726 ImGui::Text(
"# hard edges : %u", e);
3728 ImGui::Text(
"Material Name: %s", m->
name().c_str());
3732 if (ImGui::TreeNode(
"Reflection Model: Blinn-Phong"))
3734 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3736 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3738 if (ImGui::ColorEdit3(
"Ambient color", (
float*)&ac, cef))
3742 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dc, cef))
3746 if (ImGui::ColorEdit3(
"Specular color", (
float*)&sc, cef))
3750 if (ImGui::ColorEdit3(
"Emissive color", (
float*)&ec, cef))
3754 if (ImGui::SliderFloat(
"Shininess", &shine, 0.0f, 1000.0f))
3758 if (ImGui::SliderFloat(
"kr", &kr, 0.0f, 1.0f))
3762 if (ImGui::SliderFloat(
"kt", &kt, 0.0f, 1.0f))
3766 if (ImGui::SliderFloat(
"kn", &kn, 1.0f, 2.5f))
3770 if (ImGui::Checkbox(
"Receives shadows", &receivesShadows))
3773 ImGui::PopItemWidth();
3779 if (ImGui::TreeNode(
"Reflection Model: Cook-Torrance"))
3783 ImGui::Text(
"Controlled by textures");
3787 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3789 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3791 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dc, cef))
3795 if (ImGui::SliderFloat(
"Roughness", &rough, 0.0f, 1.0f))
3799 if (ImGui::SliderFloat(
"Metalness", &metal, 0.0f, 1.0f))
3802 ImGui::PopItemWidth();
3809 if (ImGui::TreeNode(
"Particle System"))
3812 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3818 if (ImGui::Checkbox(
"Instanced draw", &drawInstanced))
3829 if (ImGui::Button(
"Resume"))
3834 if (ImGui::Button(
"Pause"))
3838 if (ImGui::Button(
"Reset"))
3841 if (ImGui::CollapsingHeader(
"Emission"))
3846 int amount = ps->
amount();
3847 if (ImGui::InputInt(
"Amount of particles", &amount))
3856 if (ImGui::CollapsingHeader(
"Time to live"))
3861 if (ImGui::InputFloat(
"Time to live (s)", &timeToLive))
3869 if (ImGui::Checkbox(
"Counter lag/gap", &doCounterGap))
3875 ImGui::TextWrapped(
"Need to be enable by default but can create flickering with few particles, recommend to disable if few particles with no velocity ");
3882 if (ImGui::Combo(
"Billboard Type",
3884 "Camera Billboard\0Vertical Billboard\0Horizontal Billboard\0"))
3888 if (item_current == 2)
3902 if (ImGui::Checkbox(
"Shape", &shape_group))
3909 if (ImGui::CollapsingHeader(
"Shape", &shape_group))
3913 if (ImGui::Combo(
"Shape type",
3915 "Sphere\0Box\0Cone\0Pyramid\0"))
3925 if (ImGui::InputFloat(
"Radius of the sphere", &radiusSphere))
3932 if (item_current ==
ST_Box)
3935 if (ImGui::InputFloat3(
"Scale box XYZ", vec3fScaleBox))
3937 ps->
shapeScale(vec3fScaleBox[0], vec3fScaleBox[1], vec3fScaleBox[2]);
3945 if (ImGui::InputFloat(
"Radius", &radius))
3952 if (ImGui::InputFloat(
"Angle", &angle))
3959 if (ImGui::InputFloat(
"Height", &height))
3969 if (ImGui::InputFloat(
"Half side", &halfSide))
3976 if (ImGui::InputFloat(
"Angle", &angle))
3983 if (ImGui::InputFloat(
"Height", &height))
3992 if (ImGui::Checkbox(
"Spawn surface", &shapeSurf))
3997 if (item_current == 2 || item_current == 3)
4000 if (ImGui::Checkbox(
"Spawn base volume", &shapeSpawnBase))
4009 ImGui::BeginDisabled();
4010 ImGui::LabelText(
"Condition",
"Need to have direction and speed enabled");
4011 if (item_current == 2 || item_current == 3)
4014 if (ImGui::Checkbox(
"Follow shape direction (Override direction)",
4022 else if (item_current == 0 || item_current == 1)
4025 if (ImGui::Checkbox(
"Inverse center direction (Override direction)", &shapeOverride))
4034 ImGui::EndDisabled();
4042 if (ImGui::Checkbox(
"Flipbook texture", &flipbookTex_group))
4050 if (ImGui::CollapsingHeader(
"Flipbook texture", &flipbookTex_group))
4054 if (ImGui::InputInt(
"Frame rate (num update by s)", &fR))
4065 if (ImGui::CollapsingHeader(
"Size"))
4070 float radiusW = ps->
radiusW();
4071 if (ImGui::InputFloat(
"Radius width", &radiusW))
4076 float radiusH = ps->
radiusH();
4077 if (ImGui::InputFloat(
"Radius height", &radiusH))
4082 float scale = ps->
scale();
4083 if (ImGui::InputFloat(
"Scale", &scale))
4091 if (ImGui::Checkbox(
"Size over lifetime", &doSizeOverLT_group))
4097 if (ImGui::CollapsingHeader(
"Size over lifetime", &doSizeOverLT_group))
4101 if (ImGui::Checkbox(
"Custom curve (Unchecked --> Linear function)2", &doSizeOverLTCurve_group))
4106 if (ImGui::CollapsingHeader(
"Bezier curve size", &doSizeOverLTCurve_group))
4111 if (ImGui::Bezier(
"easeInExpo", vSize, staEndSize))
4121 if (ImGui::CollapsingHeader(
"Movement"))
4127 if (ImGui::Checkbox(
"World space", &doWorldSpace))
4132 if (ImGui::Checkbox(
"Gravity", &doGravity))
4139 if (ImGui::CollapsingHeader(
"Gravity", &doGravity))
4143 if (ImGui::InputFloat3(
"Gravity XYZ", vec3Gravity))
4145 ps->
gravity(vec3Gravity[0], vec3Gravity[1], vec3Gravity[2]);
4153 if (ImGui::Checkbox(
"Acceleration", &acc_group))
4160 if (ImGui::CollapsingHeader(
"Acceleration", &acc_group))
4164 ImGui::BeginDisabled();
4166 if (ImGui::InputFloat(
"Accelaration constant", &accConst))
4172 ImGui::EndDisabled();
4174 if (ImGui::Checkbox(
"Direction vector", &accDiffDirection_group))
4180 if (ImGui::CollapsingHeader(
"Direction vector", &accDiffDirection_group))
4183 ImGui::InputFloat3(
"input float3", vec3fAcc);
4184 ps->
acceleration(vec3fAcc[0], vec3fAcc[1], vec3fAcc[2]);
4192 ImGui::BeginDisabled();
4193 if (ImGui::CollapsingHeader(
"Velocity"))
4197 if (ImGui::Combo(
"Velocity type", &item_current,
"Random axes\0Constant axes\0"))
4203 if (item_current == 0)
4206 if (ImGui::InputFloat3(
"Min. random XYZ", vec3fVstart))
4208 ps->
velocityRndMin(vec3fVstart[0], vec3fVstart[1], vec3fVstart[2]);
4213 if (ImGui::InputFloat3(
"Max. random XYZ", vec3fVend))
4220 else if (item_current == 1)
4223 if (ImGui::InputFloat3(
"Constant XYZ", vec3fVelocity))
4225 ps->
velocityConst(vec3fVelocity[0], vec3fVelocity[1], vec3fVelocity[2]);
4233 ImGui::EndDisabled();
4237 if (ImGui::Checkbox(
"Direction and Speed", &directionSpeed_group))
4244 if (ImGui::CollapsingHeader(
"Direction and Speed", &directionSpeed_group))
4248 if (ImGui::InputFloat3(
"Constant XYZ", vec3fDirection))
4250 ps->
direction(vec3fDirection[0], vec3fDirection[1], vec3fDirection[2]);
4256 if (ImGui::Combo(
"Speed value",
4258 "Constant\0Random between two constants\0"))
4260 if (item_current == 1)
4270 float speed = ps->
speed();
4271 if (ImGui::InputFloat(
"Constant", &speed))
4281 if (ImGui::InputFloat2(
"Random range Speed", vec2fRange))
4283 ps->
speedRange(vec2fRange[0], vec2fRange[1]);
4291 if (ImGui::Checkbox(
"Rotation", &rot_group))
4298 if (ImGui::CollapsingHeader(
"Rotation", &rot_group))
4302 if (ImGui::Combo(
"Angular velocity value", &item_current,
"Constant\0Random between two constants\0"))
4304 if (item_current == 1)
4315 if (ImGui::InputFloat(
"Constant", &angularVelocityConst))
4323 if (ImGui::InputFloat2(
"Random range A.V", vec2fRange))
4338 if (ImGui::CollapsingHeader(
"Color"))
4344 if (ImGui::Checkbox(
"Color", &color_group))
4349 if (ImGui::CollapsingHeader(
"Color", &color_group))
4354 if (ImGui::Checkbox(
"Glow/Bright (blending effect)", &color_bright))
4361 ImGui::BeginDisabled();
4362 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
4364 if (ImGui::ColorEdit4(
"Particle color", (
float*)&c, cef))
4367 ImGui::EndDisabled();
4372 if (ImGui::Checkbox(
"Color over lifetime", &doColorOverLT_group))
4379 if (ImGui::CollapsingHeader(
"Color over lifetime", &doColorOverLT_group))
4381 ImGui::Text(
"Edit gradient colors in the texture section.");
4388 if (ImGui::Checkbox(
"Alpha over lifetime", &doAlphaOverL_group))
4393 if (ImGui::CollapsingHeader(
"Alpha over lifetime", &doAlphaOverL_group))
4397 if (ImGui::Checkbox(
"Custom curve (Unchecked --> Linear function)", &doAlphaOverLCurve_group))
4402 if (ImGui::CollapsingHeader(
"Bezier curve alpha", &doAlphaOverLCurve_group))
4407 if (ImGui::Bezier(
"easeInExpo", vAlpha, staEndAlpha))
4417 ImGui::PopItemWidth();
4433 size_t numShaders = m->
program() ? m->
program()->shaders().size() : 0;
4436 if (numShaders > 0 && ImGui::TreeNode(
"Shd",
"Shaders (%d)", (
int)numShaders))
4440 for (
auto* shd : m->
program()->shaders())
4442 if (ImGui::TreeNode(shd->name().c_str()))
4444 SLchar* text =
new char[shd->code().length() + 1];
4445 strcpy(text, shd->code().c_str());
4446 ImGui::InputTextMultiline(shd->name().c_str(),
4448 shd->code().length() + 1,
4449 ImVec2(-1.0f, -1.0f));
4457 for (
auto* shd : m->
programTF()->shaders())
4459 if (ImGui::TreeNode(shd->name().c_str()))
4461 SLchar* text =
new char[shd->code().length() + 1];
4462 strcpy(text, shd->code().c_str());
4463 ImGui::InputTextMultiline(shd->name().c_str(),
4465 shd->code().length() + 1,
4466 ImVec2(-1.0f, -1.0f));
4481 ImGui::Text(
"No single single mesh selected.");
4484 ImGui::PopStyleColor();
4489 ImGui::Begin(
"Properties of Selection", &
showProperties, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoNavInputs);
4493 if (selectedNode->mesh())
4495 ImGui::Text(
"Node: %s", selectedNode->name().c_str());
4496 SLMesh* selectedMesh = selectedNode->mesh();
4498 if (!selectedMesh->
IS32.empty())
4500 ImGui::Text(
" Mesh: %s {%u v.}",
4501 selectedMesh->
name().c_str(),
4505 if (ImGui::Button(delBtn.c_str()))
4518 ImGui::Text(
"There is nothing selected.");
4520 ImGui::Text(
"Select a single node by");
4521 ImGui::Text(
"double-clicking it or");
4522 ImGui::Text(
"select multiple nodes by");
4523 ImGui::Text(
"SHIFT-double-clicking them.");
4525 ImGui::Text(
"Select partial meshes by");
4526 ImGui::Text(
"CTRL-LMB rectangle drawing.");
4528 ImGui::Text(
"Press ESC to deselect all.");
4530 ImGui::Text(
"Be aware that a node may be");
4531 ImGui::Text(
"flagged as not selectable.");
4536 ImGui::Text(
"Node selection and the");
4537 ImGui::Text(
"properties of it can only");
4538 ImGui::Text(
"be shown in the OpenGL");
4539 ImGui::Text(
"renderer.");
4550 SLfloat texW = ImGui::GetWindowWidth() - 4 * ImGui::GetTreeNodeToLabelSpacing() - 10;
4551 void* tid = (ImTextureID)(intptr_t)tex->
texID();
4556 if (ImGui::TreeNode(tex->
name().c_str()))
4559 for (
auto img : tex->
images())
4560 mbCPU += (
float)img->bytesPerImage();
4568 ImGui::Text(
"Size(PX): %dx%dx%d", tex->
width(), tex->
height(), tex->
depth());
4569 ImGui::Text(
"Size(MB): GPU:%4.2f, CPU:%4.2f, DSK:%4.2f", mbGPU, mbCPU, mbDSK);
4570 ImGui::Text(
"TexID : %u (%s)", tex->
texID(), tex->
isTexture() ?
"ok" :
"not ok");
4571 ImGui::Text(
"Type : %s", tex->
typeName().c_str());
4573 ImGui::Text(
"Format : %s", tex->
images()[0]->formatString().c_str());
4575 ImGui::Text(
"Format : %s",
"n/a (GPU only)");
4576 #ifdef SL_BUILD_WITH_KTX
4577 ImGui::Text(
"Compr. : %s", tex->compressionFormatStr(tex->compressionFormat()).c_str());
4582 if (tex->
target() == GL_TEXTURE_2D)
4587 if (ImGui::TreeNode(
"Color Points in Gradient"))
4593 if (ImGui::TreeNode(
"Alpha Points in Gradient"))
4597 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.25f);
4600 snprintf(label,
sizeof(label),
"Alpha %lu", a);
4601 if (ImGui::SliderFloat(label, &alpha, 0.0f, 1.0f,
"%3.2f"))
4603 lut->
alphas()[a].alpha = alpha;
4607 snprintf(label,
sizeof(label),
"Pos. %lu", a);
4609 if (a > 0 && a < lut->alphas().size() - 1)
4615 if (ImGui::SliderFloat(label, &pos, min, max,
"%3.2f"))
4617 lut->
alphas()[a].pos = pos;
4622 ImGui::Text(
"%3.2f Pos. %lu", pos, a);
4624 ImGui::PopItemWidth();
4631 ImVec2(texW, texW * 0.15f),
4635 ImVec4(1, 1, 1, 1));
4638 ImGui::PlotLines(
"",
4640 (
SLint)allAlpha.size(),
4645 ImVec2(texW, texW * 0.25f));
4650 ImVec2(texW, texW * h_to_w),
4654 ImVec4(1, 1, 1, 1));
4659 if (tex->
target() == GL_TEXTURE_CUBE_MAP)
4660 ImGui::Text(
"Cube maps can not be displayed.");
4661 else if (tex->
target() == GL_TEXTURE_3D)
4662 ImGui::Text(
"3D textures can not be displayed.");
4672 ImGuiStyle& style = ImGui::GetStyle();
4678 SL_LOG(
"No config file %s: ", fullPathAndFilename.c_str());
4681 SLfloat dpiScaleProp = (float)dotsPerInch / 142.0f;
4682 SLfloat dpiScaleFixed = (float)dotsPerInch / 142.0f;
4702 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = std::max(8.0f * dpiScaleFixed, 8.0f);
4703 style.FramePadding.y = style.ItemInnerSpacing.y = std::max(4.0f * dpiScaleFixed, 4.0f);
4704 style.WindowPadding.y = style.ItemSpacing.y * 3;
4705 style.ScrollbarSize = std::max(16.0f * dpiScaleFixed, 16.0f);
4708 if (style.ScrollbarSize < 0.0f)
4709 style.ScrollbarSize = 16.0f;
4711 style.ScrollbarRounding =
std::floor(style.ScrollbarSize / 2);
4718 CVFileStorage fs(configString, CVFileStorage::READ | CVFileStorage::MEMORY);
4728 fs[
"ItemSpacingX"] >> i; style.ItemSpacing.x = (
SLfloat) i;
4729 fs[
"ItemSpacingY"] >> i; style.ItemSpacing.y = (
SLfloat) i;
4730 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = style.ItemSpacing.x;
4731 style.FramePadding.y = style.ItemInnerSpacing.y = style.ItemSpacing.y;
4732 style.WindowPadding.y = style.ItemSpacing.y * 3;
4733 fs[
"ScrollbarSize"] >> i; style.ScrollbarSize = (
SLfloat) i;
4735 if (style.ScrollbarSize < 0.0f)
4736 style.ScrollbarSize = 16.0f;
4738 fs[
"ScrollbarRounding"] >> i; style.ScrollbarRounding = (
SLfloat) i;
4757 SL_LOG(
"Config. loaded : %s", fullPathAndFilename.c_str());
4764 SL_LOG(
"****** Failed to open file for reading: %s", fullPathAndFilename.c_str());
4769 SL_LOG(
"****** Parsing of file failed: %s", fullPathAndFilename.c_str());
4773 if (dotsPerInch > 300)
4779 SLfloat dpiScaleProp = (float)dotsPerInch / 120.0f;
4780 SLfloat dpiScaleFixed = (float)dotsPerInch / 142.0f;
4789 #ifdef SL_EMSCRIPTEN
4792 int sceneId = EM_ASM_INT(
4793 let params =
new URL(
window.location).searchParams;
4794 return params.get(
"scene") ?? -1;
4806 ImGuiStyle& style = ImGui::GetStyle();
4811 SL_LOG(
"New config file will be written: %s",
4812 fullPathAndFilename.c_str());
4815 CVFileStorage::WRITE | CVFileStorage::MEMORY);
4819 SL_LOG(
"Failed to open file for writing: %s",
4820 fullPathAndFilename.c_str());
4832 fs <<
"ItemSpacingX" << (
SLint)style.ItemSpacing.x;
4833 fs <<
"ItemSpacingY" << (
SLint)style.ItemSpacing.y;
4834 fs <<
"ScrollbarSize" << (
SLfloat)style.ScrollbarSize;
4835 fs <<
"ScrollbarRounding" << (
SLfloat)style.ScrollbarRounding;
4851 std::string configString = fs.releaseAndGetString();
4855 SL_LOG(
"Config. saved : %s", fullPathAndFilename.c_str());
4900 assert(
s->
assetManager() &&
"No asset manager assigned to scene!");
4921 s->
root2D()->addChild(horizonNode);
4935 s->
root2D()->deleteChild(horizonNode);
4944 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
4949 snprintf(label,
sizeof(label),
"Color %lu", c);
4950 if (ImGui::ColorEdit3(label, (
float*)&color, cef))
4952 lut->
colors()[c].color = color;
4956 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
4957 snprintf(label,
sizeof(label),
"Pos. %lu", c);
4959 if (c > 0 && c < lut->colors().size() - 1)
4963 if (ImGui::SliderFloat(label, &pos, min, max,
"%3.2f"))
4965 lut->
colors()[c].pos = pos;
4970 ImGui::Text(
"%3.2f Pos. %lu", pos, c);
4971 ImGui::PopItemWidth();
4977 string downloadFilename,
4978 string filenameToLoad,
4981 SLstring pathSrc =
"https://pallas.ti.bfh.ch/data/SLProject/models/";
4984 #ifndef SL_EMSCRIPTEN
4997 string downloadFilename,
5000 string pathAndFileToLoad,
5003 #ifndef SL_EMSCRIPTEN
5004 assert(
s->
assetManager() &&
"No asset manager assigned to scene!");
5007 auto progressCallback = [](
size_t curr,
size_t filesize)
5011 int transferredPC = (int)((
float)curr / (float)filesize * 100.0f);
5015 cout <<
"Bytes transferred: " << curr << endl;
5020 auto downloadJobHTTP = [=]()
5023 string jobMsg =
"Downloading file via HTTPS: " + downloadFilename;
5026 string fileToDownload = urlFolder + downloadFilename;
5027 if (HttpUtils::download(fileToDownload, dstFolder, progressCallback) != 0)
5029 SL_LOG(
"*** Nothing downloaded from: %s ***", fileToDownload.c_str());
5030 SL_LOG(
"*** PLEASE RETRY DOWNLOAD ***", fileToDownload.c_str());
5035 auto unzipJob = [=]()
5037 string jobMsg =
"Decompressing file: " + downloadFilename;
5040 string zipFile = dstFolder + downloadFilename;
5044 if (extension ==
"zip")
5051 SL_LOG(
"*** File do decompress doesn't exist: %s ***",
5056 auto followUpJob1 = [=]()
5061 SL_LOG(
"*** File do load doesn't exist: %s ***",
5062 pathAndFileToLoad.c_str());
5078 #if !defined(SL_OS_MACIOS) && !defined(SL_OS_ANDROID)
5083 SLVec3f camToLookAt = pos_f - lookAtPoint;
5085 cam->
lookAt(lookAtPoint);
The AppCommon class holds the top-level instances of the app-demo.
void centerNextWindow(SLSceneView *sv, SLfloat widthPC=0.9f, SLfloat heightPC=0.9f)
Centers the next ImGui window in the parent.
bool myComboBox(const char *label, int *currIndex, SLVstring &values)
Combobox that allows to pass the items as a string vector.
CVCalibration guessCalibration(bool mirroredH, bool mirroredV, CVCameraType camType)
int ftpCallbackXfer(off64_t xfered, void *arg)
static SLNode * balda_stahl
static auto vectorGetter
Vector getter callback for combo and listbox with std::vector<std::string>
static SLNode * balda_glas
SLNode * gVideoTrackedNode
static SLTransformNode * transformNode
CVTracked * gVideoTracker
C++ Header file for the class AppDemoGui.h.
Definition of scene IDs in the demo app.
@ SID_SuzannePerPixBlinnNmSm
@ SID_Benchmark_SkinnedAnimations
@ SID_VideoTrackChessScnd
@ SID_ParticleSystem_Many
@ SID_SuzannePerPixBlinnTmAo
@ SID_VideoTrackMediaPipeHandsMain
@ SID_Benchmark_LargeModel
@ SID_SuzannePerPixBlinnTmSm
@ SID_SuzannePerPixBlinnAoSm
@ SID_ParticleSystem_ComplexFire
@ SID_ParticleSystem_RingOfFire
@ SID_SuzannePerPixBlinnNm
@ SID_ShadowMappingSpotLights
@ SID_ErlebAR_BernChristoffel
@ SID_ParticleSystem_DustStorm
@ SID_SuzannePerPixBlinnNmAo
@ SID_ParticleSystem_Simple
@ SID_Benchmark_JansUniverse
@ SID_Benchmark_ColumnsNoLOD
@ SID_ParticleSystem_Fountain
@ SID_SuzannePerPixBlinnSm
@ SID_ShadowMappingLightTypes
@ SID_AnimationSkinnedMass
@ SID_SuzannePerPixBlinnTmNmSm
@ SID_ShaderPerPixelBlinn
@ SID_SuzannePerPixBlinnTm
@ SID_ErlebAR_AventicumAmphiteatre
@ SID_Benchmark_NodeAnimations
@ SID_Benchmark_ColumnsLOD
@ SID_ShadowMappingCascaded
@ SID_SuzannePerPixBlinnTmNmAoSm
@ SID_SuzannePerPixCookTmNmAoSmEm
@ SID_ErlebAR_AventicumCigognier
@ SID_ShadowMappingPointLights
@ SID_VideoTrackArucoMain
@ SID_Benchmark_ParticleSystemComplexFire
@ SID_Benchmark_LotsOfNodes
@ SID_VideoTrackArucoScnd
@ SID_SuzannePerPixBlinnTmNmAo
@ SID_VideoTrackFeature2DMain
@ SID_VolumeRayCastLighted
@ SID_ErlebAR_AventicumTheatre
@ SID_ShadowMappingBasicScene
@ SID_VideoTrackChessMain
@ SID_SuzannePerPixBlinnAo
@ SID_SuzannePerPixBlinnTmNm
@ SID_ErlebAR_AugustaRauricaTmpTht
@ SID_ErlebAR_SutzKirchrain18
@ SID_Robotics_FanucCRX_FK
@ SID_ShaderPerVertexBlinn
static GLFWwindow * window
The global glfw window handle.
static SLbool fixAspectRatio
Flag if wnd aspect ratio should be fixed.
@ CS_calibrated
The camera is calibrated.
CVVideoType
Video type if multiple exist on mobile devices.
@ VT_SCND
Selfie camera on mobile devices.
@ VT_FILE
Loads a video from file with OpenCV.
@ VT_NONE
No camera needed.
@ VT_MAIN
Main camera on all on all all devices.
CVDetectDescribeType
Feature detector-decriptor types.
cv::FileStorage CVFileStorage
#define PROFILE_SCOPE(name)
#define PROFILE_FUNCTION()
#define PROFILE_THREAD(name)
float SLfloat
analog to GLfloat
#define SL_LOG(...)
Some debugging and error handling macros.
unsigned long SLulong
analog to GLulong
unsigned int SLuint
analog to GLuint
char SLchar
analog to GLchar (char is signed [-128 ... 127]!)
bool SLbool
analog to GLbool
vector< SLfloat > SLVfloat
vector< SLstring > SLVstring
#define SL_EXIT_MSG(message)
string SLstring
Redefinition of standard types for platform independence.
SLLocOffsetMode
Device location offset mode.
Mobile device rotation class declaration.
SLRotOffsetMode
Device rotation offset mode.
#define SL_DB_ONLYEDGES
Draw only hard edges.
#define SL_DB_NORMALS
Draw the vertex normals.
#define SL_DB_SKELETON
Draw the skeletons joints.
#define SL_DB_WITHEDGES
Draw faces with hard edges.
#define SL_DB_AXIS
Draw the coordinate axis of a node.
#define SL_DB_NOTSELECTABLE
Flags an object as selected.
#define SL_DB_BRECT
Draw the bounding rectangle of a node.
#define SL_DB_VOXELS
Draw the voxels of the uniform grid.
#define SL_DB_GPU_SKINNING
Perform skinning on the GPU.
#define SL_DB_CULLOFF
Turn off face culling.
#define SL_DB_MESHWIRED
Draw polygons as wired mesh.
#define SL_DB_BBOX
Draw the bounding boxes of a node.
#define SL_DB_HIDDEN
Flags an object as hidden.
SLCamAnim
Enumeration for available camera animation types.
@ CA_turntableYUp
Orbiting around central object w. turntable rotation around y & right axis.
@ CA_walkingYUp
Walk translation with AWSD and look around rotation around y & right axis.
@ CA_deviceRotLocYUp
The device rotation controls the camera rotation and the GPS controls the Camera Translation.
@ CA_trackball
Orbiting around central object w. one rotation around one axis.
@ CA_deviceRotYUp
The device rotation controls the camera rotation.
@ CA_turntableZUp
Orbiting around central object w. turntable rotation around z & right axis.
@ CA_walkingZUp
Walk translation with AWSD and look around rotation around z & right axis.
SLProjType
Enumeration for different camera projections.
@ P_monoPerspective
standard mono pinhole perspective projection
@ P_stereoSideBySideD
side-by-side distorted for Oculus Rift like glasses
@ P_stereoSideBySide
side-by-side
@ P_stereoColorYB
color masking for yellow-blue anaglyphs (ColorCode 3D)
@ P_monoOrthographic
standard mono orthographic projection
int SLSceneID
Scene identifier.
SLRenderType
Rendering type enumeration.
@ RT_optix_pt
Path Tracing with OptiX.
@ RT_optix_rt
Ray Tracing with OptiX.
SLEasingCurve
Enumeration for animation easing curves.
SLTransformSpace
Describes the relative space a transformation is applied in.
SLShapeType
Particle system shape type.
SLBillboardType
Billboard type for its orientation used in SLParticleSystem.
Uses an OpenGL framebuffer object as a depth-buffer.
SLStdShaderProg
Enumeration for standard shader programs.
SLTextureType
Texture type enumeration & their filename appendix for auto type detection.
Scene node that draws the device's horizon line and tilt angle.
Wrapper Class around the external ImGui GUI-framework.
Declaration of the main Scene Library C-Interface.
deque< SLNode * > SLVNode
SLVNode typedef for a vector of SLNodes.
Declares a color look up table functionality.
static SLstring version
SLProject version string.
static SLDeviceRotation devRot
Mobile device rotation from IMU.
static int jobProgressMax()
static SLstring name
Application name.
static deque< function< void(void)> > jobsToBeThreaded
Queue of functions to be executed in a thread.
static SLstring configPath
Default path for calibration files.
static optional< SLSceneID > sceneToLoad
Scene id to load at start up.
static string jobProgressMsg()
Thread-safe getter of the progress message.
static SLAssetManager * assetManager
asset manager is the owner of all assets
static SLstring gitCommit
Current GIT commit short hash id.
static atomic< bool > jobIsRunning
True if a parallel job is running.
static SLDeviceLocation devLoc
Mobile device location from GPS.
static SLstring gitBranch
Current GIT branch.
static int jobProgressNum()
static deque< function< void(void)> > jobsToFollowInMain
Queue of function to follow in the main thread.
static CVCalibrationEstimatorParams calibrationEstimatorParams
static SLstring gitDate
Current GIT commit date.
static SLstring configuration
Debug or Release configuration.
static SLstring shaderPath
Path to GLSL shader programs.
static SLSceneID sceneID
ID of currently loaded scene.
static SLScene * scene
Pointer to the one and only SLScene instance.
static map< string, string > deviceParameter
Generic device parameter.
static SLstring dataPath
Path to data directory (it is set platform dependent)
static void loadConfig(SLint dotsPerInch)
Loads the UI configuration.
static SLbool showImGuiMetrics
Flag if imgui metrics infor should be shown.
static SLstring infoCalibrate
Calibration info string.
static void showTexInfos(SLGLTexture *tex)
Shows UI infos for a texture.
static void downloadModelAndLoadScene(SLScene *s, SLSceneView *sv, string downloadFilename, string urlFolder, string dstFolder, string filenameToLoad, SLSceneID sceneIDToLoad)
Parallel HTTP download, unzip and load scene job scheduling.
static SLbool hideUI
Flag if menubar should be shown.
static SLbool showHelpCalibration
Flag if calibration info should be shown.
static void saveConfig()
Stores the UI configuration.
static void loadSceneWithLargeModel(SLScene *s, SLSceneView *sv, string downloadFilename, string filenameToLoad, SLSceneID sceneIDToLoad)
static SLbool showCredits
Flag if credits info should be shown.
static SLbool showDateAndTime
Flag if date-time dialog should be shown.
static SLbool showStatsTiming
Flag if timing info should be shown.
static SLbool showSceneGraph
Flag if scene graph should be shown.
static SLbool _horizonVisuEnabled
static SLbool showUIPrefs
Flag if UI preferences.
static void showHorizon(SLScene *s, SLSceneView *sv)
Enables calculation and visualization of horizon line (using rotation sensors)
static SLbool showProperties
Flag if properties should be shown.
static SLbool showErlebAR
Flag if Christoffel infos should be shown.
static void build(SLScene *s, SLSceneView *sv)
This is the main building function for the GUI of the Demo apps.
static void addSceneGraphNode(SLScene *s, SLNode *node)
Builds the node information once per frame.
static SLbool showTransform
Flag if transform dialog should be shown.
static void buildSceneGraph(SLScene *s)
Builds the scenegraph dialog once per frame.
static SLstring infoCredits
Credits info string.
static void setActiveNamedLocation(int locIndex, SLSceneView *sv, SLVec3f lookAtPoint=SLVec3f::ZERO)
Set the a new active named location from SLDeviceLocation.
static void removeTransformNode(SLScene *s)
Searches and removes the transform node.
static void buildMenuEdit(SLScene *s, SLSceneView *sv)
Builds the edit menu that can be in the menu bar and the context menu.
static SLstring loadingString
String shown during loading screens.
static SLbool showProgress
Flag if about info should be shown.
static SLbool showInfosSensors
Flag if device sensors info should be shown.
static SLbool showInfosDevice
Flag if device info should be shown.
static SLbool showStatsScene
Flag if scene info should be shown.
static void buildMenuBar(SLScene *s, SLSceneView *sv)
Builds the entire menu bar once per frame.
static void showLUTColors(SLTexColorLUT *lut)
Displays a editable color lookup table wit ImGui widgets.
static SLbool showInfosScene
Flag if scene info should be shown.
static SLstring infoHelp
Help info string.
static void hideHorizon(SLScene *s)
Disables calculation and visualization of horizon line.
static void buildProperties(SLScene *s, SLSceneView *sv)
Builds the properties dialog once per frame.
static SLstring configTime
Time of stored configuration.
static SLstring infoAbout
About info string.
static std::time_t adjustedTime
Adjusted GUI time for sun setting (default 0)
static void setTransformEditMode(SLScene *s, SLSceneView *sv, SLNodeEditMode editMode)
Adds a transform node for the selected node and toggles the edit mode.
static SLbool showStatsWAI
Flag if WAI info should be shown.
static SLbool showHelp
Flag if help info should be shown.
static SLbool showStatsVideo
Flag if video info should be shown.
static void buildMenuContext(SLScene *s, SLSceneView *sv)
Builds context menu if right mouse click is over non-imgui area.
static SLbool showAbout
Flag if about info should be shown.
static SLbool showDockSpace
Flag if dock space should be enabled.
void toggleFixPrincipalPoint()
void toggleThinPrismModel()
void toggleZeroTangentDist()
void toggleRationalModel()
void toggleFixAspectRatio()
Live video camera calibration class with OpenCV an OpenCV calibration.
float boardSquareMM() const
const CVMat & distortion() const
CVSize imageSizeOriginal() const
int numCapturedImgs() const
float cameraFovHDeg() const
float cameraFovVDeg() const
string calibrationTime() const
CVCalibState state() const
CVCalibration calibration
void showUndistorted(bool su)
Encapsulation of the OpenCV Capture Device and holder of the last frame.
bool hasSecondaryCamera
flag if device has secondary camera
CVVSize camSizes
All possible camera sizes.
CVCamera * activeCamera
Pointer to the active camera.
CVSize captureSize
size of captured frame
void videoType(CVVideoType vt)
Setter for video type also sets the active calibration.
CVMat lastFrame
last frame grabbed in BGR
int activeCamSizeIndex
Currently active camera size index.
static CVCapture * instance()
Public static instance getter for singleton pattern.
AvgFloat & captureTimesMS()
get number of frames in video
CVTrackedFeatures is the main part of the AR Christoffelturm scene.
CVDetectDescribeType type()
CVTracked is the pure virtual base class for tracking features in video.
static AvgFloat trackingTimesMS
Averaged time for video tracking in ms.
static AvgFloat optFlowTimesMS
Averaged time for video feature optical flow tracking in ms.
static AvgFloat detectTimesMS
Averaged time for video feature detection & description in ms.
static AvgFloat detect1TimesMS
Averaged time for video feature detection subpart 1 in ms.
static AvgFloat detect2TimesMS
Averaged time for video feature detection subpart 2 in ms.
static AvgFloat matchTimesMS
Averaged time for video feature matching in ms.
static AvgFloat poseTimesMS
Averaged time for video feature pose estimation in ms.
void drawDetection(bool draw)
SLVstring & animationNames()
SLAnimPlayback * animPlaybackByIndex(SLuint ix)
Manages the playback of an SLAnimation.
void skipToPrevKeyframe()
SLfloat localTime() const
SLbool isPlayingBackward() const
SLbool isPlayingForward() const
SLEasingCurve easing() const
SLfloat playbackRate() const
void skipToNextKeyframe()
SLAnimation * parentAnimation()
SLfloat lengthSec() const
Toplevel holder of the assets meshes, materials, textures and shaders.
SLVGLProgram & programs()
static SLTexFont * font16
16 pixel high fixed size font
SLVGLTexture & textures()
Active or visible camera node class.
void stereoEyeSeparation(const SLfloat es)
SLfloat fovV() const
Vertical field of view.
void clipFar(const SLfloat cFar)
SLfloat fovH() const
Horizontal field of view.
void clipNear(const SLfloat cNear)
void focalDist(const SLfloat f)
void maxSpeed(const SLfloat ms)
void fogMode(const SLFogMode mode)
void projType(SLProjType p)
static SLstring projTypeToStr(SLProjType pt)
Returns the projection type as string.
void fogIsOn(const bool isOn)
void fov(const SLfloat fov)
vertical field of view
void lookFrom(const SLVec3f &fromDir, const SLVec3f &upDir=SLVec3f::AXISY)
Sets the view to look from a direction towards the current focal point.
void fogDensity(const float density)
void camAnim(SLCamAnim ca)
Encapsulation of a mobile device location set by the device's GPS sensor.
void useOriginAltitude(SLbool useGLA)
SLbool calculateSolarAngles(SLVec3d locationLatLonAlt, std::time_t time)
Calculates the solar angles at origin at local time.
SLfloat originSolarSunset() const
SLVec3d defaultENU() const
void activeNamedLocation(SLint locIndex)
void sunLightNode(SLLightDirect *sln)
void isUsed(SLbool isUsed)
Setter that turns on the device rotation sensor.
SLVec3d originENU() const
SLVLocation & nameLocations()
void offsetMode(SLLocOffsetMode lom)
SLfloat originSolarSunrise() const
void hasOrigin(SLbool hasOL)
Encapsulation of a mobile device rotation set by the device's IMU sensor.
void hasStarted(SLbool started)
void numAveraged(SLint numAvg)
Returns the device rotation averaged over multple frames.
void offsetMode(SLRotOffsetMode rom)
void zeroYawAtStart(SLbool zeroYaw)
void isUsed(SLbool isUsed)
Setter that turns on the device rotation sensor.
SLbool get(SLuint bit)
Returns the specified bit.
void set(SLuint bit, SLbool state)
Sets the specified bit to the passed state.
void toggle(SLuint bit)
Toggles the specified bit.
void allOff()
Turns all bits off.
void on(SLuint bit)
Turns the specified bit on.
Encapsulation of an OpenGL shader program object.
static size_t size()
Returns the size of the program map.
static SLGLProgramGeneric * get(SLStdShaderProg id)
Get program reference for given id.
Singleton class holding all OpenGL states.
static SLGLState * instance()
Public static instance getter for singleton pattern.
void currentMaterial(SLMaterial *mat)
Texture object for OpenGL texturing.
SLstring minificationFilterName()
SLstring typeName()
Returns the texture type as string.
SLstring magnificationFilterName()
static SLuint totalNumBytesOnGPU
Total NO. of bytes used for textures on GPU.
void bindActive(SLuint texUnit=0)
static SLuint totalDrawCalls
static SLuint totalPrimitivesRendered
static total no. of draw calls
static SLuint totalBufferSize
static total no. of buffers in use
Scene node that visualises the horizon estimated from the device rotation.
static SLfloat fontPropDots
Default font size of proportional font.
static SLfloat fontFixedDots
Default font size of fixed size font.
SLLightDirect class for a directional light source.
void doSunPowerAdaptation(SLbool enabled)
SLTexColorLUT * sunLightColorLUT()
Abstract Light class for OpenGL light sources.
void ambientColor(const SLCol4f &ambi)
static SLfloat gamma
final output gamma value
static SLbool doColoredShadows
flag if shadows should be displayed with colors for debugging
void ambientPower(const SLfloat ambPow)
void specularPower(const SLfloat specPow)
void isOn(const SLbool on)
void spotCutOffDEG(SLfloat cutOffAngleDEG)
void diffusePower(const SLfloat diffPow)
void diffuseColor(const SLCol4f &diff)
void specularColor(const SLCol4f &spec)
void spotExponent(const SLfloat exp)
Light node class for a rectangular light source.
SLLightSpot class for a spot light source.
SLVec3< T > translation() const
void decompose(SLVec3f &trans, SLVec4f &rotQuat, SLVec3f &scale)
SLstring toString() const
Defines a standard CG material with textures and a shader program.
void reflectionModel(SLReflectionModel rm)
void specular(const SLCol4f &spec)
void programTF(SLGLProgram *sp)
void diffuse(const SLCol4f &diff)
void shininess(SLfloat shin)
void ambient(const SLCol4f &ambi)
SLVGLTexture & textures(SLTextureType type)
void roughness(SLfloat r)
void emissive(const SLCol4f &emis)
void metalness(SLfloat m)
void program(SLGLProgram *sp)
void getsShadows(SLbool receivesShadows)
An SLMesh object is a triangulated mesh, drawn with one draw call.
SLVuint IS32
Vector of rectangle selected vertex indices 32 bit.
SLVuint I32
Vector of vertex indices 32 bit.
SLVushort I16
Vector of vertex indices 16 bit.
SLVuint IE32
Vector of hard edges vertex indices 32 bit (see computeHardEdgesIndices)
void deleteSelected(SLNode *node)
Deletes the rectangle selected vertices and the dependent triangles.
SLVushort IE16
Vector of hard edges vertex indices 16 bit (see computeHardEdgesIndices)
SLVVec3f P
Vector for vertex positions layout (location = 0)
SLNode represents a node in a hierarchical scene graph.
void resetToInitialState()
SLbool drawBit(SLuint bit)
void translation(const SLVec3f &pos, SLTransformSpace relativeTo=TS_parent)
void rotate(const SLQuat4f &rot, SLTransformSpace relativeTo=TS_object)
const SLMat4f & updateAndGetWM() const
static SLuint numWMUpdates
NO. of calls to updateWMRec per frame.
void castsShadows(SLbool castsShadows)
T * findChild(const SLstring &name="", SLbool findRecursive=true)
SLVec3f translationOS() const
void om(const SLMat4f &mat)
void lookAt(SLfloat targetX, SLfloat targetY, SLfloat targetZ, SLfloat upX=0, SLfloat upY=1, SLfloat upZ=0, SLTransformSpace relativeTo=TS_world)
const SLMat4f & initialOM()
void translate(const SLVec3f &vec, SLTransformSpace relativeTo=TS_object)
void name(const SLstring &Name)
SLParticleSystem creates a particle meshes from a point primitive buffer.
void generateBernsteinPSize()
SLbool doShapeSpawnBase()
SLGLTexture * texFlipbook()
float * bezierControlPointSize()
float * bezierControlPointAlpha()
SLbool doFlipBookTexture()
SLbool doDirectionSpeed()
SLfloat angularVelocityConst()
float * bezierStartEndPointSize()
SLBillboardType billboardType()
float * bezierStartEndPointAlpha()
SLbool doAlphaOverLTCurve()
SLbool doBlendBrightness()
void doAcceleration(SLbool b)
SLbool doSizeOverLTCurve()
SLVec2f angularVelocityRange()
SLfloat accelerationConst()
void generateBernsteinPAlpha()
SLbool doInstancedDrawing()
Classic Monte Carlo Pathtracing algorithm for real global illumination.
SLfloat noiseRSE() const
Mean relative standard error of the pixels of the last render.
void calcDirect(SLbool di)
void sampleClamp(SLfloat max)
void calcIndirect(SLbool ii)
SLfloat efficiency() const
Monte Carlo efficiency, the inverse of variance times time.
void saveImage()
Saves the current PT image as PNG image.
SLfloat noiseRSE999() const
Relative standard error of the noisiest 0.1% of the pixels.
static SLuint shadowRays
NO. of shadow rays.
static SLuint tirRays
NO. of TIR refraction rays.
static SLint maxDepthReached
max. depth reached for all rays
static SLuint subsampledPixels
NO. of of subsampled pixels.
static SLuint totalNumRays()
Total NO. of rays shot during RT.
static SLuint reflectedRays
NO. of reflected rays.
static SLfloat avgDepth
average depth reached
static SLuint refractedRays
NO. of refracted rays.
static SLuint subsampledRays
NO. of of subsampled rays.
SLRaytracer hold all the methods for Whitted style Ray Tracing.
SLint resolutionFactorPC() const
SLfloat renderSec() const
void doContinuous(SLbool cont)
void state(SLRTState state)
static SLuint numThreads()
void doFresnel(SLbool fresnel)
void maxDepth(SLint depth)
void resolutionFactor(SLfloat rf)
void aaSamples(SLint samples)
SLfloat raysPerMS()
Rays per ms of the last completed render, for comparing machines.
virtual void saveImage()
Saves the current RT image as PNG image.
void doDistributed(SLbool distrib)
The SLScene class represents the top level instance holding the scene structure.
AvgFloat & frameTimesMS()
void deselectAllNodesAndMeshes()
Deselects all nodes and its meshes.
AvgFloat & updateAABBTimesMS()
SLMesh * singleMeshFullSelected()
Returns the node if only one is selected. See also SLMesh::selectNodeMesh.
SLVEventHandler & eventHandlers()
AvgFloat & updateAnimTimesMS()
SLAssetManager * assetManager()
SLint numSceneCameras()
Returns the number of camera nodes in the scene.
AvgFloat & updateTimesMS()
SLVMesh & selectedMeshes()
void root2D(SLNode *root2D)
SLAnimManager & animManager()
void selectNodeMesh(SLNode *nodeToSelect, SLMesh *meshToSelect)
Handles the full mesh selection from double-clicks.
void skybox(SLSkybox *skybox)
void root3D(SLNode *root3D)
SLNode * singleNodeSelected()
Returns the node if only one is selected. See also SLMesh::selectNodeMesh.
SLVNode & selectedNodes()
AvgFloat & updateDODTimesMS()
void loadTimeMS(SLfloat loadTimeMS)
void stopAnimations(SLbool stop)
SceneView class represents a dynamic real time 3D view onto the scene.
AvgFloat & shadowMapTimeMS()
void switchToNextCameraInScene()
Sets the active camera to the next in the scene.
AvgFloat & draw3DTimesMS()
void doMultiSampling(SLbool doMS)
void doDepthTest(SLbool doDT)
void startPathtracing(SLint maxDepth, SLint samples)
Starts the path tracer. maxDepth is only a safety net against an.
void switchToSceneViewCamera()
std::unordered_set< SLMaterial * > & visibleMaterials3D()
AvgFloat & draw2DTimesMS()
void camera(SLCamera *camera)
SLPathtracer * pathtracer()
void viewportSameAsVideo(bool sameAsVideo)
void startRaytracing(SLint maxDepth)
void renderType(SLRenderType rt)
void doAlphaSorting(SLbool doAS)
SLVec2i viewportRatio() const
SLRaytracer * raytracer()
SLVNode & nodesOverdrawn()
void setViewportFromRatio(const SLVec2i &vpRatio, SLViewportAlign vpAlignment, SLbool vpSameAsVideo)
Sets the viewport ratio and the viewport rectangle.
SLViewportAlign viewportAlign() const
void doFrustumCulling(SLbool doFC)
void doWaitOnIdle(SLbool doWI)
void screenCaptureIsRequested(bool doScreenCap)
Class for standard and cascaded shadow mapping.
void numCascades(int numCascades)
SLbool useCascaded() const
SLGLVDepthBuffer depthBuffers()
SLGLDepthBuffer * depthBuffer()
void rayCount(const SLVec2i &rayCount)
static SLuint drawCalls
NO. of draw calls for shadow mapping.
void useCubemap(SLbool useCubemap)
void clipNear(SLfloat clipNear)
void size(const SLVec2f &size)
void textureSize(const SLVec2i &textureSize)
void clipFar(SLfloat clipFar)
void cascadesFactor(float factor)
Skybox node class with a SLBox mesh.
SLGLTexture * irradianceCubemap()
SLGLTexture * brdfLutTexture()
SLGLTexture * roughnessCubemap()
SLGLTexture * environmentCubemap()
SLTexColorLUT defines a lookup table as an 1D texture of (256) RGBA values.
void colors(SLColorLUTType lut)
Colors setter function by predefined color LUT.
SLVfloat allAlphas()
Returns all alpha values of the transfer function as a float vector.
void generateTexture()
Generates the full 256 value LUT as 1x256 RGBA texture.
SLVAlphaLUTPoint & alphas()
SLstring toString(SLstring delimiter=", ", int decimals=2)
Conversion to string.
void set(const T X, const T Y, const T Z)
bool exists(std::string path, SLIOStreamKind kind)
Checks whether a given file exists.
std::string readIntoString(std::string path, SLIOStreamKind kind)
Reads an entire file into a string.
void writeString(std::string path, SLIOStreamKind kind, const std::string &string)
Writes a string to a file.
bool fileExists(const string &pathfilename)
Returns true if a file exists.
T clamp(T a, T min, T max)
string getPath(const string &pathFilename)
Returns the path w. '\' of path-filename string.
static const float RAD2DEG
unsigned closestPowerOf2(unsigned num)
Returns the closest power of 2 to a passed number.
string getLocalTimeString()
Returns local time as string like "Wed Feb 13 15:46:11 2019".
string toString(float f, int roundedDecimals)
Returns a string from a float with max. one trailing zero.
bool deleteFile(string &pathfilename)
Deletes a file on the filesystem.
string getFileExt(const string &filename)
Returns the file extension without dot in lower case.
bool zip(string path, string zipname)
bool unzip(string zipfile, function< bool(string path, string filename)> processFile, function< bool(const char *data, size_t len)> writeChunk, function< bool(string path)> processDir, function< int(int currentFile, int totalFiles)> progress=nullptr)
Struct for scene graph statistics.
SLuint numVoxMaxTria
Max. no. of triangles per voxel.
SLuint numBytesAccel
NO. of bytes in accel. structs.
SLuint numNodesOpaque
NO. of visible opaque nodes.
SLuint numMeshes
NO. of meshes in node.
SLuint numNodes
NO. of children nodes.
SLuint numLights
NO. of lights in mesh.
SLuint numTriangles
NO. of triangles in mesh.
SLuint numNodesBlended
NO. of visible blended nodes.
SLuint numNodesLeaf
NO. of leaf nodes.
SLuint numVoxels
NO. of voxels.
SLuint numNodesGroup
NO. of group nodes.
SLuint numBytes
NO. of bytes allocated.
SLfloat numVoxEmpty
NO. of empty voxels.