46 #define IMGUI_DEFINE_MATH_OPERATORS
58 # include <Eigen/Dense>
70 [](
void* vec,
int idx,
const char** out_text)
73 if (idx < 0 || idx >= (
int)vector.size())
76 *out_text = vector.at((
SLuint)idx).c_str();
87 return ImGui::Combo(label,
103 ImGui::SetNextWindowSize(ImVec2(width, height), ImGuiCond_Always);
104 ImGui::SetNextWindowPos(ImVec2(offsetX, offsetY), ImGuiCond_Always);
145 Welcome to the SLProject demo app. It is developed at the Computer Science Department of the Bern University of Applied Sciences.
146 The app shows what you can learn in two semesters about 3D computer graphics in real time rendering and ray tracing.
147 The framework is developed in C++ with OpenGL ES so that it can run also on mobile devices.
148 Ray tracing and path tracing provide additional high quality transparencies, reflections and soft shadows.
149 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.
150 For more information please visit: https://github.com/cpvrlab/SLProject/wiki
154 Contributors since 2005 in alphabetic order:
155 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
157 Credits for external libraries:
158 - assimp: assimp.sourceforge.net
159 - eigen: eigen.tuxfamily.org
160 - emscripten: emscripten.org
161 - imgui: github.com/ocornut/imgui
162 - gl3w: https://github.com/skaslev/gl3w
164 - g2o: github.com/RainerKuemmerle/g2o
165 - ktx: khronos.org/ktx
166 - libigl: libigl.github.io
167 - mediapipe: developers.google.com/mediapipe
168 - ORB-SLAM2: github.com/raulmur/ORB_SLAM2
171 - OpenSSL: openssl.org
172 - spa: midcdmz.nrel.gov/spa
173 - stb: single file image library
178 Help for mouse or finger control:
179 - Use left mouse or your finger to rotate the scene
180 - Use mouse-wheel or pinch 2 fingers to go forward/backward
181 - Use middle-mouse or 2 fingers to move sidewards/up-down
182 - Double click or double tap to select object
183 - CTRL-mouse to select vertices of objects
184 - See keyboard shortcuts behind menu commands
185 - Check out the different test scenes under File > Load Test Scene
186 - You can open and dock additional windows from the menu Infos.
190 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:
191 https://github.com/cpvrlab/SLProject/tree/master/data/calibrations/
192 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
193 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
194 before taking the picture.
195 You can mirror the video image under Preferences > Video. You can check the distance to the chessboard in the dialog Stats. on Video.
196 After calibration the yellow wireframe cube should stick on the chessboard. Please close first this info dialog on the top-left.
208 int xferedPC = (int)((
float)xfered / (float)
ftpXferSizeMax * 100.0f);
213 cout <<
"Bytes transferred: " << xfered << endl;
214 return xfered ? 1 : 0;
238 ImGui::Begin(
"Loading",
240 ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoNavInputs);
243 float height =
static_cast<float>(
sv->
viewportH());
244 ImGui::SetWindowSize(ImVec2(width, height));
245 ImGui::SetWindowPos(ImVec2(0, 0));
247 ImVec2 center(0.5f * width, 0.5f * height);
249 ImDrawList* drawList = ImGui::GetWindowDrawList();
251 drawList->AddRectFilled(ImVec2(0, 0), ImVec2(width, height), IM_COL32(40, 40, 40, 255));
252 drawList->AddCircle(center, 50, IM_COL32(105, 125, 145, 255), 0, 10.0f);
254 float offset = 8.0f *
static_cast<float>(ImGui::GetTime());
255 drawList->PathArcTo(center, 50, offset, offset + 0.25f * 2 *
PI);
256 drawList->PathStroke(IM_COL32(250, 165, 0, 255), 0, 10.0f);
259 ImGui::SetCursorPosX(0.5f * (width - ImGui::CalcTextSize(text).x));
260 ImGui::SetCursorPosY(0.5f * height + 100.0f);
283 ImGui::Begin(
"Parallel Job in Progress",
285 ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoNavInputs);
286 ImGui::Text(
"Parallel Job in Progress:");
293 ImGui::ProgressBar(num / max);
297 ImGui::Text(
"Progress: %c",
"|/-\\"[(
int)(ImGui::GetTime() / 0.05f) & 3]);
301 ImGui::Text(
"Parallel Jobs to follow: %u",
303 ImGui::Text(
"Sequential Jobs to follow: %u",
312 static bool opt_fullscreen_persistant =
true;
313 bool opt_fullscreen = opt_fullscreen_persistant;
314 static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode;
318 ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNavInputs;
321 ImGuiViewport* viewport = ImGui::GetMainViewport();
322 ImGui::SetNextWindowPos(viewport->WorkPos);
323 ImGui::SetNextWindowSize(viewport->WorkSize);
324 ImGui::SetNextWindowViewport(viewport->ID);
325 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
326 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
327 window_flags |= ImGuiWindowFlags_NoTitleBar |
328 ImGuiWindowFlags_NoCollapse |
329 ImGuiWindowFlags_NoResize |
330 ImGuiWindowFlags_NoMove |
331 ImGuiWindowFlags_NoBringToFrontOnFocus |
332 ImGuiWindowFlags_NoNavFocus;
337 if (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode)
338 window_flags |= ImGuiWindowFlags_NoBackground;
345 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
346 ImGui::Begin(
"DockSpace Demo", &
showDockSpace, window_flags);
347 ImGui::PopStyleVar();
350 ImGui::PopStyleVar(2);
353 ImGuiIO& io = ImGui::GetIO();
354 if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
356 ImGuiID dockspace_id = ImGui::GetID(
"MyDockSpace");
357 ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
366 ImGui::Begin(
"About SLProject", &
showAbout, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNavInputs);
373 ImGui::TextWrapped(
"%s",
infoAbout.c_str());
381 ImGui::Begin(
"Help on Interaction", &
showHelp, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNavInputs);
382 ImGui::TextWrapped(
"%s",
infoHelp.c_str());
390 ImGui::Begin(
"Help on Camera Calibration", &
showHelpCalibration, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNavInputs);
399 ImGui::Begin(
"Credits for all Contributors and external Libraries", &
showCredits, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNavInputs);
427 #ifndef SL_EMSCRIPTEN
446 #ifndef SL_EMSCRIPTEN
460 snprintf(m + strlen(m),
sizeof(m),
"Renderer : OpenGL\n");
461 snprintf(m + strlen(m),
sizeof(m),
"Load time : %5.1f ms\n",
s->
loadTimeMS());
467 snprintf(m + strlen(m),
sizeof(m),
"FPS : %5.1f\n",
s->
fps());
468 snprintf(m + strlen(m),
sizeof(m),
"Frame time : %5.1f ms (100%%)\n", ft);
469 snprintf(m + strlen(m),
sizeof(m),
" Capture : %5.1f ms (%3d%%)\n", captureTime, (
SLint)captureTimePC);
470 snprintf(m + strlen(m),
sizeof(m),
" Update : %5.1f ms (%3d%%)\n", updateTime, (
SLint)updateTimePC);
471 #ifdef SL_USE_ENTITIES
474 snprintf(m + strlen(m),
sizeof(m),
" EntityWM : %5.1f ms (%3d%%)\n", updateDODTime, (
SLint)updateDODTimePC);
478 snprintf(m + strlen(m),
sizeof(m),
" Anim. : %5.1f ms (%3d%%)\n", updateAnimTime, (
SLint)updateAnimTimePC);
479 snprintf(m + strlen(m),
sizeof(m),
" AABB : %5.1f ms (%3d%%)\n", updateAABBTime, (
SLint)updateAABBTimePC);
482 #ifndef SL_EMSCRIPTEN
485 snprintf(m + strlen(m),
sizeof(m),
" Tracking : %5.1f ms (%3d%%)\n", trackingTime, (
SLint)trackingTimePC);
486 snprintf(m + strlen(m),
sizeof(m),
" Detect : %5.1f ms (%3d%%)\n", detectTime, (
SLint)detectTimePC);
487 snprintf(m + strlen(m),
sizeof(m),
" Det1 : %5.1f ms\n", detect1Time);
488 snprintf(m + strlen(m),
sizeof(m),
" Det2 : %5.1f ms\n", detect2Time);
489 snprintf(m + strlen(m),
sizeof(m),
" Match : %5.1f ms (%3d%%)\n", matchTime, (
SLint)matchTimePC);
490 snprintf(m + strlen(m),
sizeof(m),
" OptFlow : %5.1f ms (%3d%%)\n", optFlowTime, (
SLint)optFlowTimePC);
491 snprintf(m + strlen(m),
sizeof(m),
" Pose : %5.1f ms (%3d%%)\n", poseTime, (
SLint)poseTimePC);
494 snprintf(m + strlen(m),
sizeof(m),
" Shadows : %5.1f ms (%3d%%)\n", shadowMapTime, (
SLint)shadowMapTimePC);
495 snprintf(m + strlen(m),
sizeof(m),
" Culling : %5.1f ms (%3d%%)\n", cullTime, (
SLint)cullTimePC);
496 snprintf(m + strlen(m),
sizeof(m),
" Drawing 3D: %5.1f ms (%3d%%)\n", draw3DTime, (
SLint)draw3DTimePC);
497 snprintf(m + strlen(m),
sizeof(m),
" Drawing 2D: %5.1f ms (%3d%%)\n", draw2DTime, (
SLint)draw2DTimePC);
499 else if (rType ==
RT_rt)
509 snprintf(m + strlen(m),
sizeof(m),
"Renderer :Ray Tracer\n");
510 snprintf(m + strlen(m),
sizeof(m),
"Progress :%3d%%\n", rt->
progressPC());
511 snprintf(m + strlen(m),
sizeof(m),
"Frame size :%d x %d\n", rtWidth, rtHeight);
512 snprintf(m + strlen(m),
sizeof(m),
"FPS :%0.2f\n", fps);
513 snprintf(m + strlen(m),
sizeof(m),
"Frame Time :%0.3f sec.\n", renderSec);
514 snprintf(m + strlen(m),
sizeof(m),
"Rays per ms:%0.0f\n", rt->
raysPerMS());
516 snprintf(m + strlen(m),
sizeof(m),
"Threads :%d\n", rt->
numThreads());
517 snprintf(m + strlen(m),
sizeof(m),
"----------------------------\n");
518 snprintf(m + strlen(m),
sizeof(m),
"Total rays :%9d (%3d%%)\n", rayTotal, 100);
519 snprintf(m + strlen(m),
sizeof(m),
" Primary :%9d (%3d%%)\n", rayPrimaries, (
int)((
float)rayPrimaries / (
float)rayTotal * 100.0f));
525 snprintf(m + strlen(m),
sizeof(m),
"----------------------------\n");
527 snprintf(m + strlen(m),
sizeof(m),
"Avg. depth :%0.3f\n",
SLRay::avgDepth / (
float)rayPrimaries);
529 #if defined(SL_BUILD_WITH_OPTIX) && defined(SL_HAS_OPTIX)
532 SLOptixRaytracer* ort =
sv->optixRaytracer();
533 snprintf(m + strlen(m),
sizeof(m),
"Renderer :OptiX Ray Tracer\n");
534 snprintf(m + strlen(m),
sizeof(m),
"Frame size :%d x %d\n",
sv->
scrW(),
sv->
scrH());
535 snprintf(m + strlen(m),
sizeof(m),
"FPS :%5.1f\n",
s->
fps());
536 snprintf(m + strlen(m),
sizeof(m),
"Frame Time :%0.3f sec.\n", 1.0f /
s->
fps());
540 SLOptixPathtracer* opt =
sv->optixPathtracer();
541 snprintf(m + strlen(m),
sizeof(m),
"Renderer :OptiX Ray Tracer\n");
542 snprintf(m + strlen(m),
sizeof(m),
"Frame size :%d x %d\n",
sv->
scrW(),
sv->
scrH());
543 snprintf(m + strlen(m),
sizeof(m),
"Frame Time :%0.2f sec.\n", opt->renderSec());
544 snprintf(m + strlen(m),
sizeof(m),
"Denoiser Time :%0.0f ms.\n", opt->denoiserMS());
547 else if (rType ==
RT_pt)
554 snprintf(m + strlen(m),
sizeof(m),
"Renderer :Path Tracer\n");
555 snprintf(m + strlen(m),
sizeof(m),
"Progress :%3d%%\n", pt->
progressPC());
556 snprintf(m + strlen(m),
sizeof(m),
"Frame size :%d x %d\n", ptWidth, ptHeight);
557 snprintf(m + strlen(m),
sizeof(m),
"FPS :%0.2f\n", 1.0f / pt->
renderSec());
558 snprintf(m + strlen(m),
sizeof(m),
"Frame Time :%0.2f sec.\n", pt->
renderSec());
559 snprintf(m + strlen(m),
sizeof(m),
"Rays per ms:%0.0f\n", pt->
raysPerMS());
560 snprintf(m + strlen(m),
sizeof(m),
"Samples/pix:%d\n", pt->
aaSamples());
561 snprintf(m + strlen(m),
sizeof(m),
"Threads :%d\n", pt->
numThreads());
562 snprintf(m + strlen(m),
sizeof(m),
"---------------------------\n");
563 snprintf(m + strlen(m),
sizeof(m),
"Total rays :%8d (%3d%%)\n", rayTotal, 100);
566 snprintf(m + strlen(m),
sizeof(m),
" TIR :%8d\n",
SLRay::tirRays);
568 snprintf(m + strlen(m),
sizeof(m),
"---------------------------\n");
571 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
572 ImGui::Begin(
"Timing", &
showStatsTiming, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
573 ImGui::TextUnformatted(m);
586 SLfloat voxelsEmpty = vox > 0.0f ? voxEmpty / vox * 100.0f : 0.0f;
588 SLfloat avgTriPerVox = vox > 0.0f ? numRTTria / (vox - voxEmpty) : 0.0f;
602 for (
auto* i : t->images())
603 cpuMBTexture += (
float)i->bytesPerImage();
604 cpuMBTexture = cpuMBTexture / 1E6f;
608 SLfloat cpuMBTotal = cpuMBTexture + cpuMBMeshes + cpuMBVoxels;
609 SLint cpuMBTexturePC =
std::abs(cpuMBTotal) < 1E-5f ? 0 : (
SLint)(cpuMBTexture / cpuMBTotal * 100.0f);
610 SLint cpuMBMeshesPC =
std::abs(cpuMBTotal) < 1E-5f ? 0 : (
SLint)(cpuMBMeshes / cpuMBTotal * 100.0f);
611 SLint cpuMBVoxelsPC =
std::abs(cpuMBTotal) < 1E-5f ? 0 : (
SLint)(cpuMBVoxels / cpuMBTotal * 100.0f);
614 SLfloat gpuMBTotal = gpuMBTexture + gpuMBVbo;
615 SLint gpuMBTexturePC =
std::abs(gpuMBTotal) < 1E-5 ? 0 : (
SLint)(gpuMBTexture / gpuMBTotal * 100.0f);
616 SLint gpuMBVboPC =
std::abs(gpuMBTotal) < 1E-5 ? 0 : (
SLint)(gpuMBVbo / gpuMBTotal * 100.0f);
618 snprintf(m + strlen(m),
sizeof(m),
"No. of Nodes :%5d (100%%)\n", stats3D.
numNodes);
619 snprintf(m + strlen(m),
sizeof(m),
"- Group Nodes :%5d (%3d%%)\n", stats3D.
numNodesGroup, numGroupPC);
620 snprintf(m + strlen(m),
sizeof(m),
"- Leaf Nodes :%5d (%3d%%)\n", stats3D.
numNodesLeaf, numLeafPC);
621 snprintf(m + strlen(m),
sizeof(m),
"- Light Nodes :%5d (%3d%%)\n", stats3D.
numLights, numLightsPC);
622 snprintf(m + strlen(m),
sizeof(m),
"- Opaque Nodes:%5d (%3d%%)\n", stats3D.
numNodesOpaque, numOpaquePC);
623 snprintf(m + strlen(m),
sizeof(m),
"- Blend Nodes :%5d (%3d%%)\n", stats3D.
numNodesBlended, numBlendedPC);
624 snprintf(m + strlen(m),
sizeof(m),
"- Overdrawn N.:%5d (%3d%%)\n", numOverdrawnNodes, numOverdrawnPC);
625 snprintf(m + strlen(m),
sizeof(m),
"- Vis. Nodes :%5d (%3d%%)\n", numVisibleNodes, numVisiblePC);
627 snprintf(m + strlen(m),
sizeof(m),
"No. of Meshes :%5u\n", stats3D.
numMeshes);
628 snprintf(m + strlen(m),
sizeof(m),
"No. of Tri. :%5u\n", stats3D.
numTriangles);
629 snprintf(m + strlen(m),
sizeof(m),
"CPU MB Total :%6.2f (100%%)\n", cpuMBTotal);
630 snprintf(m + strlen(m),
sizeof(m),
"- MB Tex. :%6.2f (%3d%%)\n", cpuMBTexture, cpuMBTexturePC);
631 snprintf(m + strlen(m),
sizeof(m),
"- MB Meshes :%6.2f (%3d%%)\n", cpuMBMeshes, cpuMBMeshesPC);
632 snprintf(m + strlen(m),
sizeof(m),
"- MB Voxels :%6.2f (%3d%%)\n", cpuMBVoxels, cpuMBVoxelsPC);
633 snprintf(m + strlen(m),
sizeof(m),
"GPU MB Total :%6.2f (100%%)\n", gpuMBTotal);
634 snprintf(m + strlen(m),
sizeof(m),
"- MB Tex. :%6.2f (%3d%%)\n", gpuMBTexture, gpuMBTexturePC);
635 snprintf(m + strlen(m),
sizeof(m),
"- MB VBO :%6.2f (%3d%%)\n", gpuMBVbo, gpuMBVboPC);
636 snprintf(m + strlen(m),
sizeof(m),
"No. of Voxels :%d\n", stats3D.
numVoxels);
637 snprintf(m + strlen(m),
sizeof(m),
"-empty Voxels :%4.1f%%\n", voxelsEmpty);
638 snprintf(m + strlen(m),
sizeof(m),
"Avg.Tri/Voxel :%4.1f\n", avgTriPerVox);
639 snprintf(m + strlen(m),
sizeof(m),
"Max.Tri/Voxel :%d\n", stats3D.
numVoxMaxTria);
642 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
643 ImGui::Begin(
"Scene Statistics", &
showStatsScene, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
646 ImGui::TextUnformatted(m);
648 ImGui::Text(
"Global Resources:");
650 string label =
"Meshes (" + std::to_string(am->
meshes().size()) +
")";
651 if (am->
meshes().size() && ImGui::TreeNode(label.c_str()))
654 ImGui::Text(
"[%d] %s (%u v.)",
656 am->
meshes()[i]->name().c_str(),
662 label =
"Lights (" + std::to_string(
s->
lights().size()) +
")";
663 if (
s->
lights().size() && ImGui::TreeNode(label.c_str()))
668 ImGui::Text(
"[%u] %s", i, light->
name().c_str());
679 SLVNode& matNodes = mat->nodesVisible3D();
688 if (ImGui::TreeNode(m))
690 for (
auto* node : matNodes)
691 ImGui::Text(node->name().c_str());
703 label =
"Meshes (" + std::to_string(am->
textures().size()) +
")";
704 if (am->
textures().size() && ImGui::TreeNode(label.c_str()))
708 if (am->
textures()[i]->images().empty())
709 ImGui::Text(
"[%u] %s on GPU (%s)", i, am->
textures()[i]->name().c_str(), am->
textures()[i]->isTexture() ?
"ok" :
"not ok");
711 ImGui::Text(
"[%u] %s (%s)", i, am->
textures()[i]->name().c_str(), am->
textures()[i]->isTexture() ?
"ok" :
"not ok");
717 label =
"Programs in AM (" + std::to_string(am->
programs().size()) +
")";
718 if (am->
programs().size() && ImGui::TreeNode(label.c_str()))
723 ImGui::Text(
"[%u] %s", i, p->
name().c_str());
729 if (ImGui::TreeNode(label.c_str()))
752 mirrored =
"horizontally & vertically";
754 mirrored =
"horizontally";
756 mirrored =
"vertically";
758 snprintf(m + strlen(m),
sizeof(m),
"Video Type : %s\n", vt ==
VT_NONE ?
"None" : vt ==
VT_MAIN ?
"Main Camera"
760 :
"Secondary Camera");
762 snprintf(m + strlen(m),
sizeof(m),
"Capture size : %d x %d\n", capSize.width, capSize.height);
763 snprintf(m + strlen(m),
sizeof(m),
"Size Index : %d\n", ac->
camSizeIndex());
764 snprintf(m + strlen(m),
sizeof(m),
"Mirrored : %s\n", mirrored.c_str());
766 snprintf(m + strlen(m),
sizeof(m),
"Undistorted : %s\n", ac->
showUndistorted() ?
"Yes" :
"No");
769 snprintf(m + strlen(m),
sizeof(m),
"fx,fy : %4.1f,%4.1f\n", c->
fx(), c->
fy());
770 snprintf(m + strlen(m),
sizeof(m),
"cx,cy : %4.1f,%4.1f\n", c->
cx(), c->
cy());
773 const float f = 100.f;
774 snprintf(m + strlen(m),
sizeof(m),
"dist.(*10e-2):\n");
775 snprintf(m + strlen(m),
sizeof(m),
"k1,k2 : %4.2f,%4.2f\n", c->
k1() * f, c->
k2() * f);
776 snprintf(m + strlen(m),
sizeof(m),
"p1,p2 : %4.2f,%4.2f\n", c->
p1() * f, c->
p2() * f);
777 if (distortionSize >= 8)
778 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);
780 snprintf(m + strlen(m),
sizeof(m),
"k3 : %4.2f\n", c->
k3() * f);
782 if (distortionSize >= 12)
783 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);
784 if (distortionSize >= 14)
785 snprintf(m + strlen(m),
sizeof(m),
"tauX,tauY : %4.2f,%4.2f\n", c->
tauX() * f, c->
tauY() * f);
787 snprintf(m + strlen(m),
sizeof(m),
"Calib. time : %s\n", c->
calibrationTime().c_str());
788 snprintf(m + strlen(m),
sizeof(m),
"Calib. state : %s\n", c->
stateStr().c_str());
789 snprintf(m + strlen(m),
sizeof(m),
"Num. caps : %d\n", c->
numCapturedImgs());
793 snprintf(m + strlen(m),
sizeof(m),
"-------------:\n");
797 snprintf(m + strlen(m),
sizeof(m),
"Dist. to zero: %4.2f\n", cameraPos.
length());
803 SLVec3f camToObj = objectPos - cameraPos;
804 snprintf(m + strlen(m),
sizeof(m),
"Dist. to obj.: %4.2f\n", camToObj.
length());
809 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
810 ImGui::Begin(
"Video", &
showStatsVideo, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
811 ImGui::TextUnformatted(m);
818 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
819 ImGui::Begin(
"WAI Statistics", &
showStatsWAI, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
821 if (!AverageTiming::instance().empty())
826 AverageTiming::getTimingMessage(m);
829 ImGui::TextUnformatted(m);
838 ImGui::ShowMetricsWindow();
844 ImGuiWindowFlags window_flags = 0;
845 window_flags |= ImGuiWindowFlags_NoTitleBar;
846 window_flags |= ImGuiWindowFlags_NoResize;
847 window_flags |= ImGuiWindowFlags_NoScrollbar;
848 window_flags |= ImGuiWindowFlags_NoNavInputs;
850 ImVec2 size = ImGui::CalcTextSize(
s->
info().c_str(),
857 ImGui::SetNextWindowPos(ImVec2(0, (
float)
sv->
scrH() - h));
858 ImGui::SetNextWindowSize(ImVec2(w, h));
860 ImGui::SetCursorPosX((w - size.x) * 0.5f);
861 ImGui::TextWrapped(
"%s", info.c_str());
867 ImGuiWindowFlags window_flags = 0;
868 window_flags |= ImGuiWindowFlags_AlwaysAutoResize;
869 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
870 ImGui::Begin(
"Transform Selected Node", &
showTransform, window_flags);
876 SLfloat t1 = 0.1f, t2 = 1.0f, t3 = 10.0f;
877 SLfloat r1 = 1.0f, r2 = 5.0f, r3 = 15.0f;
878 SLfloat s1 = 1.01f, s2 = 1.1f, s3 = 1.5f;
881 ImGui::Text(
"Space:");
883 if (ImGui::RadioButton(
"World", (
int *) &tSpace, 0)) tSpace =
TS_world;
885 if (ImGui::RadioButton(
"Parent", (
int *) &tSpace, 1)) tSpace =
TS_parent;
887 if (ImGui::RadioButton(
"Object", (
int *) &tSpace, 2)) tSpace =
TS_object;
890 ImGui::Text(
"Transl. X :");
892 if (ImGui::Button(
"<<<##Tx")) selNode->
translate(-t3, 0, 0, tSpace);
894 if (ImGui::Button(
"<<##Tx")) selNode->
translate(-t2, 0, 0, tSpace);
896 if (ImGui::Button(
"<##Tx")) selNode->
translate(-t1, 0, 0, tSpace);
898 if (ImGui::Button(
">##Tx")) selNode->
translate(t1, 0, 0, tSpace);
900 if (ImGui::Button(
">>##Tx")) selNode->
translate(t2, 0, 0, tSpace);
902 if (ImGui::Button(
">>>##Tx")) selNode->
translate(t3, 0, 0, tSpace);
904 ImGui::Text(
"Transl. Y :");
906 if (ImGui::Button(
"<<<##Ty")) selNode->
translate(0, -t3, 0, tSpace);
908 if (ImGui::Button(
"<<##Ty")) selNode->
translate(0, -t2, 0, tSpace);
910 if (ImGui::Button(
"<##Ty")) selNode->
translate(0, -t1, 0, tSpace);
912 if (ImGui::Button(
">##Ty")) selNode->
translate(0, t1, 0, tSpace);
914 if (ImGui::Button(
">>##Ty")) selNode->
translate(0, t2, 0, tSpace);
916 if (ImGui::Button(
">>>##Ty")) selNode->
translate(0, t3, 0, tSpace);
918 ImGui::Text(
"Transl. Z :");
920 if (ImGui::Button(
"<<<##Tz")) selNode->
translate(0, 0, -t3, tSpace);
922 if (ImGui::Button(
"<<##Tz")) selNode->
translate(0, 0, -t2, tSpace);
924 if (ImGui::Button(
"<##Tz")) selNode->
translate(0, 0, -t1, tSpace);
926 if (ImGui::Button(
">##Tz")) selNode->
translate(0, 0, t1, tSpace);
928 if (ImGui::Button(
">>##Tz")) selNode->
translate(0, 0, t2, tSpace);
930 if (ImGui::Button(
">>>##Tz")) selNode->
translate(0, 0, t3, tSpace);
932 ImGui::Text(
"Rotation X:");
934 if (ImGui::Button(
"<<<##Rx")) selNode->
rotate(r3, 1, 0, 0, tSpace);
936 if (ImGui::Button(
"<<##Rx")) selNode->
rotate(r2, 1, 0, 0, tSpace);
938 if (ImGui::Button(
"<##Rx")) selNode->
rotate(r1, 1, 0, 0, tSpace);
940 if (ImGui::Button(
">##Rx")) selNode->
rotate(-r1, 1, 0, 0, tSpace);
942 if (ImGui::Button(
">>##Rx")) selNode->
rotate(-r2, 1, 0, 0, tSpace);
944 if (ImGui::Button(
">>>##Rx")) selNode->
rotate(-r3, 1, 0, 0, tSpace);
946 ImGui::Text(
"Rotation Y:");
948 if (ImGui::Button(
"<<<##Ry")) selNode->
rotate(r3, 0, 1, 0, tSpace);
950 if (ImGui::Button(
"<<##Ry")) selNode->
rotate(r2, 0, 1, 0, tSpace);
952 if (ImGui::Button(
"<##Ry")) selNode->
rotate(r1, 0, 1, 0, tSpace);
954 if (ImGui::Button(
">##Ry")) selNode->
rotate(-r1, 0, 1, 0, tSpace);
956 if (ImGui::Button(
">>##Ry")) selNode->
rotate(-r2, 0, 1, 0, tSpace);
958 if (ImGui::Button(
">>>##Ry")) selNode->
rotate(-r3, 0, 1, 0, tSpace);
960 ImGui::Text(
"Rotation Z:");
962 if (ImGui::Button(
"<<<##Rz")) selNode->
rotate(r3, 0, 0, 1, tSpace);
964 if (ImGui::Button(
"<<##Rz")) selNode->
rotate(r2, 0, 0, 1, tSpace);
966 if (ImGui::Button(
"<##Rz")) selNode->
rotate(r1, 0, 0, 1, tSpace);
968 if (ImGui::Button(
">##Rz")) selNode->
rotate(-r1, 0, 0, 1, tSpace);
970 if (ImGui::Button(
">>##Rz")) selNode->
rotate(-r2, 0, 0, 1, tSpace);
972 if (ImGui::Button(
">>>##Rz")) selNode->
rotate(-r3, 0, 0, 1, tSpace);
974 ImGui::Text(
"Scale :");
976 if (ImGui::Button(
"<<<##S")) selNode->
scale(s3);
978 if (ImGui::Button(
"<<##S")) selNode->
scale(s2);
980 if (ImGui::Button(
"<##S")) selNode->
scale(s1);
982 if (ImGui::Button(
">##S")) selNode->
scale(-s1);
984 if (ImGui::Button(
">>##S")) selNode->
scale(-s2);
986 if (ImGui::Button(
">>>##S")) selNode->
scale(-s3);
990 if (ImGui::Button(
"Reset"))
995 ImGui::Text(
"No node selected.");
996 ImGui::Text(
"Please select a node by double clicking it.");
1011 snprintf(m + strlen(m),
sizeof(m),
"SLProject Version: %s\n",
AppCommon::version.c_str());
1013 snprintf(m + strlen(m),
sizeof(m),
"Build Config. : Debug\n");
1015 snprintf(m + strlen(m),
sizeof(m),
"Build Config. : Release\n");
1017 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1025 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1026 snprintf(m + strlen(m),
sizeof(m),
"OpenGL Version : %s\n", stateGL->
glVersionNO().c_str());
1027 snprintf(m + strlen(m),
sizeof(m),
"OpenGL Vendor : %s\n", stateGL->
glVendor().c_str());
1028 snprintf(m + strlen(m),
sizeof(m),
"OpenGL Renderer : %s\n", stateGL->
glRenderer().c_str());
1029 snprintf(m + strlen(m),
sizeof(m),
"OpenGL GLSL Ver. : %s\n", stateGL->
glSLVersionNO().c_str());
1030 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1031 snprintf(m + strlen(m),
sizeof(m),
"OpenCV Version : %d.%d.%d\n", CV_MAJOR_VERSION, CV_MINOR_VERSION, CV_VERSION_REVISION);
1032 snprintf(m + strlen(m),
sizeof(m),
"OpenCV has OpenCL: %s\n", cv::ocl::haveOpenCL() ?
"yes" :
"no");
1033 snprintf(m + strlen(m),
sizeof(m),
"OpenCV has AVX : %s\n", cv::checkHardwareSupport(CV_AVX) ?
"yes" :
"no");
1034 snprintf(m + strlen(m),
sizeof(m),
"OpenCV has NEON : %s\n", cv::checkHardwareSupport(CV_NEON) ?
"yes" :
"no");
1035 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1037 snprintf(m + strlen(m),
sizeof(m),
"Eigen Version : %d.%d.%d\n", EIGEN_WORLD_VERSION, EIGEN_MAJOR_VERSION, EIGEN_MINOR_VERSION);
1038 # ifdef EIGEN_VECTORIZE
1039 snprintf(m + strlen(m),
sizeof(m),
"Eigen vectorize : yes\n");
1041 snprintf(m + strlen(m),
sizeof(m),
"Eigen vectorize : no\n");
1044 snprintf(m + strlen(m),
sizeof(m),
"-----------------:\n");
1045 snprintf(m + strlen(m),
sizeof(m),
"ImGui Version : %s\n", ImGui::GetVersion());
1048 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1049 ImGui::Begin(
"Device Informations", &
showInfosDevice, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1050 ImGui::TextUnformatted(m);
1060 snprintf(m + strlen(m),
sizeof(m),
"Uses IMU Senor : %s\n",
AppCommon::devRot.isUsed() ?
"yes" :
"no");
1061 snprintf(m + strlen(m),
sizeof(m),
"Pitch (deg) : %3.1f\n",
AppCommon::devRot.pitchDEG());
1062 snprintf(m + strlen(m),
sizeof(m),
"Yaw (deg) : %3.1f\n",
AppCommon::devRot.yawDEG());
1063 snprintf(m + strlen(m),
sizeof(m),
"Roll (deg) : %3.1f\n",
AppCommon::devRot.rollDEG());
1064 snprintf(m + strlen(m),
sizeof(m),
"No. averaged : %d\n",
AppCommon::devRot.numAveraged());
1067 snprintf(m + strlen(m),
sizeof(m),
"Rot. Offset mode : %s\n",
AppCommon::devRot.offsetModeStr().c_str());
1068 snprintf(m + strlen(m),
sizeof(m),
"------------------\n");
1069 snprintf(m + strlen(m),
sizeof(m),
"Uses GPS Sensor : %s\n",
AppCommon::devLoc.isUsed() ?
"yes" :
"no");
1070 snprintf(m + strlen(m),
sizeof(m),
"Latitude (deg) : %10.5f\n",
AppCommon::devLoc.locLatLonAlt().lat);
1071 snprintf(m + strlen(m),
sizeof(m),
"Longitude (deg) : %10.5f\n",
AppCommon::devLoc.locLatLonAlt().lon);
1072 snprintf(m + strlen(m),
sizeof(m),
"Alt. used (m) : %10.2f\n",
AppCommon::devLoc.locLatLonAlt().alt);
1073 snprintf(m + strlen(m),
sizeof(m),
"Alt. GPS (m) : %10.2f\n",
AppCommon::devLoc.altGpsM());
1074 snprintf(m + strlen(m),
sizeof(m),
"Alt. DEM (m) : %10.2f\n",
AppCommon::devLoc.altDemM());
1075 snprintf(m + strlen(m),
sizeof(m),
"Alt. origin (m) : %10.2f\n",
AppCommon::devLoc.altDemM());
1076 snprintf(m + strlen(m),
sizeof(m),
"Accuracy Rad.(m) : %6.1f\n",
AppCommon::devLoc.locAccuracyM());
1077 snprintf(m + strlen(m),
sizeof(m),
"Dist. Origin (m) : %6.1f\n", offsetToOrigin.
length());
1078 snprintf(m + strlen(m),
sizeof(m),
"Origin improve(s): %6.1f sec.\n",
AppCommon::devLoc.improveTime());
1079 snprintf(m + strlen(m),
sizeof(m),
"Loc. Offset mode : %s\n",
AppCommon::devLoc.offsetModeStr().c_str());
1083 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1084 ImGui::Begin(
"Sensor Information", &
showInfosSensors, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1085 ImGui::TextUnformatted(m);
1102 ImGuiWindowFlags window_flags = 0;
1103 window_flags |= ImGuiWindowFlags_AlwaysAutoResize;
1104 window_flags |= ImGuiWindowFlags_NoNavInputs;
1106 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1107 ImGui::Begin(
"User Interface Preferences", &
showUIPrefs, window_flags);
1108 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
1112 ImGuiStyle& style = ImGui::GetStyle();
1114 if (ImGui::SliderFloat(
"Item Spacing X", &style.ItemSpacing.x, 0.0f, 20.0f,
"%0.0f"))
1115 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = style.ItemSpacing.x;
1117 if (ImGui::SliderFloat(
"Item Spacing Y", &style.ItemSpacing.y, 0.0f, 20.0f,
"%0.0f"))
1119 style.FramePadding.y = style.ItemInnerSpacing.y = style.ItemSpacing.y;
1120 style.WindowPadding.y = style.ItemSpacing.y * 3;
1130 snprintf(reset,
sizeof(reset),
"Reset User Interface (DPI: %d)",
sv->
dpi());
1131 if (ImGui::MenuItem(reset))
1138 ImGui::PopItemWidth();
1148 ImGuiWindowFlags window_flags = 0;
1149 window_flags |= ImGuiWindowFlags_AlwaysAutoResize;
1150 window_flags |= ImGuiWindowFlags_NoNavInputs;
1152 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1153 ImGui::Begin(
"Date and Time Settings", &
showDateAndTime, window_flags);
1154 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
1158 memcpy(<, std::localtime(&
adjustedTime),
sizeof(tm));
1161 std::time_t now = std::time(
nullptr);
1162 memcpy(<, std::localtime(&now),
sizeof(tm));
1165 SLint month = lt.tm_mon + 1;
1166 if (ImGui::SliderInt(
"Month", &month, 1, 12))
1168 lt.tm_mon = month - 1;
1174 if (ImGui::SliderInt(
"Day", <.tm_mday, 1, 31))
1184 if (ImGui::SliderFloat(
"Hour", &nowF, SRh, SSh,
"%.2f"))
1186 lt.tm_hour = (int)nowF;
1187 lt.tm_min = (int)((nowF -
floor(nowF)) * 60.0f);
1194 std::time_t now = std::time(
nullptr);
1196 memcpy(&tnow, std::localtime(&now),
sizeof(tm));
1197 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);
1198 if (ImGui::MenuItem(strTime))
1201 memcpy(<, std::localtime(&now),
sizeof(tm));
1205 snprintf(strTime,
sizeof(strTime),
"Set highest noon (21.07.%02d 12:00)", lt.tm_year - 100);
1206 if (ImGui::MenuItem(strTime))
1218 snprintf(strTime,
sizeof(strTime),
"Set lowest noon (21.12.%02d 12:00)", lt.tm_year - 100);
1219 if (ImGui::MenuItem(strTime))
1239 float sum_aPdP = aP + dP;
1240 float ambiFraction = aP / sum_aPdP;
1242 if (ImGui::SliderFloat(
"Direct-Indirect", &ambiFraction, 0.0f, 1.0f,
"%.2f"))
1249 ImGui::PopItemWidth();
1259 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
1265 ImGui::Begin(
"Christoffel",
1267 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1280 if (ImGui::Checkbox(
"Christoffelturm 1500-1800", &chrAltIsOn))
1287 if (ImGui::Checkbox(
"Christoffelturm 1800-1865", &chrNeuIsOn))
1293 if (ImGui::Checkbox(
"Baldachin", &baldachin))
1301 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1303 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1306 lookAtPoint.
set(-21, 18, 6);
1309 bool namedLocIsActive = namedLocIndex == i;
1310 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1326 ImGui::Begin(
"Augst-Theatre-Temple",
1328 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1330 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1332 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1337 bool namedLocIsActive = namedLocIndex == i;
1338 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1346 ImGui::Begin(
"Avenche-Amphitheatre",
1348 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1350 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1352 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1357 bool namedLocIsActive = namedLocIndex == i;
1358 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1366 ImGui::Begin(
"Avenche-Cigognier",
1368 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1370 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1372 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1377 bool namedLocIsActive = namedLocIndex == i;
1378 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1385 ImGui::Begin(
"Avenche-Theatre",
1387 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1389 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1391 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1396 bool namedLocIsActive = namedLocIndex == i;
1397 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1405 ImGui::Begin(
"Sutz-Kirchrain18",
1407 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1409 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1411 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1416 bool namedLocIsActive = namedLocIndex == i;
1417 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1435 #ifndef SL_EMSCRIPTEN
1440 if (!strF.empty() && !strW.empty() && !strH.empty())
1442 float devF = strF.empty() ? 0.0f : stof(strF);
1443 float devW = strW.empty() ? 0.0f : stof(strW);
1444 float devH = strH.empty() ? 0.0f : stof(strH);
1492 static SLint curAnimIx = -1;
1493 if (!hasAnimations) curAnimIx = -1;
1499 if (ImGui::BeginMainMenuBar())
1501 if (ImGui::BeginMenu(
"File"))
1503 if (ImGui::BeginMenu(
"Load Test Scene"))
1505 if (ImGui::BeginMenu(
"General"))
1507 if (ImGui::MenuItem(
"Minimal Scene",
nullptr, sid ==
SID_Minimal))
1509 if (ImGui::MenuItem(
"Figure Scene",
nullptr, sid ==
SID_Figure))
1511 if (ImGui::MenuItem(
"Mesh Loader",
nullptr, sid ==
SID_MeshLoad))
1513 if (ImGui::MenuItem(
"Revolver Meshes",
nullptr, sid ==
SID_Revolver))
1519 #ifdef SL_BUILD_WITH_KTX
1523 if (ImGui::MenuItem(
"Frustum Culling",
nullptr, sid ==
SID_FrustumCull))
1525 if (ImGui::MenuItem(
"2D and 3D Text",
nullptr, sid ==
SID_2Dand3DText))
1529 if (ImGui::MenuItem(
"Z-Fighting",
nullptr, sid ==
SID_ZFighting))
1535 if (ImGui::BeginMenu(
"Shader"))
1543 if (ImGui::MenuItem(
"Image Based Lighting",
nullptr, sid ==
SID_ShaderIBL))
1545 if (ImGui::MenuItem(
"Per Vertex Wave",
nullptr, sid ==
SID_ShaderWave))
1558 if (ImGui::BeginMenu(
"Shadow Mapping"))
1578 if (ImGui::BeginMenu(
"Suzanne Lighting"))
1613 if (ImGui::BeginMenu(
"glTF Sample Models"))
1621 if (ImGui::MenuItem(
"Sponza Palace",
nullptr, sid ==
SID_glTF_Sponza))
1629 if (ImGui::BeginMenu(
"Robotics"))
1639 if (ImGui::BeginMenu(
"Volume Rendering"))
1702 if (ImGui::BeginMenu(
"Animation"))
1718 if (ImGui::BeginMenu(
"Video"))
1722 #ifndef SL_EMSCRIPTEN
1736 #ifndef SL_EMSCRIPTEN
1742 #ifdef SL_BUILD_WITH_MEDIAPIPE
1755 if (ImGui::BeginMenu(
"Ray Tracing"))
1757 if (ImGui::MenuItem(
"Spheres",
nullptr, sid ==
SID_RTSpheres))
1763 if (ImGui::MenuItem(
"Depth of Field",
nullptr, sid ==
SID_RTDoF))
1765 if (ImGui::MenuItem(
"Lens Test",
nullptr, sid ==
SID_RTLens))
1771 if (ImGui::BeginMenu(
"Path Tracing"))
1779 if (ImGui::BeginMenu(
"Particle Systems"))
1803 SLstring modelBR2 = erlebarPath +
"bern/bern-christoffel.gltf";
1804 SLstring modelBFH = erlebarPath +
"biel/Biel-BFH-Rolex.gltf";
1805 SLstring modelAR1 = erlebarPath +
"augst/augst-thtL1-tmpL2.gltf";
1806 SLstring modelAR2 = erlebarPath +
"augst/augst-thtL2-tmpL1.gltf";
1807 SLstring modelAR3 = erlebarPath +
"augst/augst-thtL1L2-tmpL1L2.gltf";
1808 SLstring modelAV1_AO = erlebarPath +
"avenches/avenches-amphitheater.gltf";
1809 SLstring modelAV2_AO = erlebarPath +
"avenches/avenches-cigognier.gltf";
1810 SLstring modelAV3 = erlebarPath +
"avenches/avenches-theater.gltf";
1811 SLstring modelSU1 = erlebarPath +
"sutz/Sutz-Kirchrain18.gltf";
1820 if (ImGui::BeginMenu(
"Erleb-AR"))
1854 if (ImGui::BeginMenu(
"Benchmarks"))
1856 #ifndef SL_EMSCRIPTEN
1961 if (ImGui::MenuItem(
"Empty Scene",
"Shift-Alt-0", sid ==
SID_Empty))
1964 if (ImGui::MenuItem(
"Next Scene",
1970 if (ImGui::MenuItem(
"Previous Scene",
1976 #ifndef SL_EMSCRIPTEN
1979 if (ImGui::MenuItem(
"Multi-threaded Jobs"))
1986 uint maxIter = 100000;
1989 for (uint i = 0; i < maxIter; ++i)
1992 int progressPC = (int)((
float)i / (float)maxIter * 100.0f);
2003 uint maxIter = 100000;
2006 for (uint i = 0; i < maxIter; ++i)
2009 int progressPC = (int)((
float)i / (float)maxIter * 100.0f);
2015 auto followUpJob1 = []()
2016 {
SL_LOG(
"followUpJob1"); };
2017 auto jobToFollow2 = []()
2018 {
SL_LOG(
"JobToFollow2"); };
2027 #if !defined(SL_OS_ANDROID) && !defined(SL_EMSCRIPTEN)
2030 if (ImGui::MenuItem(
"Quit & Save"))
2037 if (ImGui::BeginMenu(
"Preferences"))
2051 if (ImGui::MenuItem(
"Do Depth Test",
"T",
sv->
doDepthTest()))
2059 if (ImGui::BeginMenu(
"Viewport Aspect"))
2067 SLchar strSameAsVideo[256];
2068 snprintf(strSameAsVideo,
sizeof(strSameAsVideo),
"Same as Video (%d:%d)", videoAspect.
x, videoAspect.
y);
2098 #if defined(SL_OS_ANDROID) || defined(SL_OS_MACIOS)
2099 if (ImGui::BeginMenu(
"Rotation Sensor"))
2103 if (ImGui::MenuItem(
"Use Device Rotation (IMU)",
nullptr, devRot.
isUsed()))
2109 if (ImGui::SliderInt(
"Average length", &numAveraged, 1, 10))
2112 if (ImGui::BeginMenu(
"Offset Mode"))
2115 if (ImGui::MenuItem(
"None",
nullptr, om ==
ROM_none))
2117 if (ImGui::MenuItem(
"Finger rot. X",
nullptr, om ==
ROM_oneFingerX))
2119 if (ImGui::MenuItem(
"Finger rot. X and Y",
nullptr, om ==
ROM_oneFingerXY))
2125 if (ImGui::MenuItem(
"Zero Yaw at Start",
nullptr, devRot.
zeroYawAtStart()))
2128 if (ImGui::MenuItem(
"Reset Zero Yaw"))
2143 if (ImGui::BeginMenu(
"Location Sensor"))
2147 if (ImGui::MenuItem(
"Use Device Location (GPS)",
nullptr,
AppCommon::devLoc.isUsed()))
2151 if (ImGui::MenuItem(
"Use Origin Altitude",
nullptr,
AppCommon::devLoc.useOriginAltitude()))
2154 if (ImGui::MenuItem(
"Reset Origin to here"))
2157 if (ImGui::BeginMenu(
"Offset Mode"))
2160 if (ImGui::MenuItem(
"None",
nullptr, om ==
LOM_none))
2162 if (ImGui::MenuItem(
"Two Finger Y",
nullptr, om ==
LOM_twoFingerY))
2172 if (ImGui::BeginMenu(
"Video Sensor"))
2175 if (ImGui::BeginMenu(
"Mirror Camera"))
2177 if (ImGui::MenuItem(
"Horizontally",
nullptr, ac->
mirrorH()))
2184 if (ImGui::MenuItem(
"Vertically",
nullptr, ac->
mirrorV()))
2194 if (ImGui::BeginMenu(
"Resolution",
2198 for (
int i = 0; i < (int)capture->
camSizes.size(); ++i)
2205 capture->
camSizes[(uint)i].height);
2213 #ifndef SL_EMSCRIPTEN
2214 if (ImGui::BeginMenu(
"Calibration"))
2216 if (ImGui::MenuItem(
"Start Calibration (Main Camera)"))
2223 if (ImGui::MenuItem(
"Start Calibration (Scnd. Camera)",
nullptr,
false, capture->
hasSecondaryCamera))
2262 if (ImGui::BeginMenu(
"Feature Tracking", featureTracker !=
nullptr) && featureTracker !=
nullptr)
2264 if (ImGui::MenuItem(
"Force Relocation",
nullptr, featureTracker->
forceRelocation()))
2267 if (ImGui::BeginMenu(
"Detector/Descriptor", featureTracker !=
nullptr))
2271 if (ImGui::MenuItem(
"RAUL/RAUL",
nullptr, type ==
DDT_RAUL_RAUL))
2273 if (ImGui::MenuItem(
"ORB/ORB",
nullptr, type ==
DDT_ORB_ORB))
2275 if (ImGui::MenuItem(
"FAST/BRIEF",
nullptr, type ==
DDT_FAST_BRIEF))
2277 if (ImGui::MenuItem(
"SURF/SURF",
nullptr, type ==
DDT_SURF_SURF))
2279 if (ImGui::MenuItem(
"SIFT/SIFT",
nullptr, type ==
DDT_SIFT_SIFT))
2294 ImGui::MenuItem(
"UI Preferences",
nullptr, &
showUIPrefs);
2307 if (ImGui::MenuItem(
"Clear selection"))
2309 sv->
camera()->selectRect().setZero();
2310 sv->
camera()->deselectRect().setZero();
2317 if (ImGui::BeginMenu(
"Renderer"))
2319 if (ImGui::MenuItem(
"OpenGL",
"ESC", rType ==
RT_gl))
2322 if (ImGui::MenuItem(
"Ray Tracing",
"R", rType ==
RT_rt))
2325 if (ImGui::MenuItem(
"Path Tracing",
"P", rType ==
RT_pt))
2329 if (ImGui::MenuItem(
"Ray Tracing with OptiX",
"Shift-R", rType ==
RT_optix_rt))
2330 sv->startOptixRaytracing(5);
2332 if (ImGui::MenuItem(
"Path Tracing with OptiX",
"Shift-P", rType ==
RT_optix_pt))
2333 sv->startOptixPathtracing(5, 10);
2335 ImGui::MenuItem(
"Ray Tracing with OptiX",
nullptr,
false,
false);
2336 ImGui::MenuItem(
"Path Tracing with OptiX",
nullptr,
false,
false);
2343 if (ImGui::BeginMenu(
"GL"))
2378 if (ImGui::MenuItem(
"All off"))
2381 if (ImGui::MenuItem(
"All on"))
2395 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2397 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2399 ImGui::PopItemWidth();
2404 else if (rType ==
RT_rt)
2406 if (ImGui::BeginMenu(
"RT"))
2410 if (ImGui::BeginMenu(
"Resolution Factor"))
2431 if (ImGui::MenuItem(
"Parallel distributed",
nullptr, rt->
doDistributed()))
2437 if (ImGui::MenuItem(
"Continuously",
nullptr, rt->
doContinuous()))
2443 if (ImGui::MenuItem(
"Fresnel Reflection",
nullptr, rt->
doFresnel()))
2449 if (ImGui::BeginMenu(
"Max. Depth"))
2460 if (ImGui::BeginMenu(
"Anti-Aliasing Samples"))
2471 if (ImGui::MenuItem(
"Save Rendered Image"))
2474 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2476 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2481 ImGui::PopItemWidth();
2490 if (ImGui::BeginMenu(
"RT"))
2492 SLOptixRaytracer* rt_optix =
sv->optixRaytracer();
2494 if (ImGui::MenuItem(
"Parallel distributed",
nullptr, rt_optix->doDistributed()))
2496 rt_optix->doDistributed(!rt_optix->doDistributed());
2497 sv->startOptixRaytracing(rt_optix->maxDepth());
2506 if (ImGui::BeginMenu(
"Max. Depth"))
2508 if (ImGui::MenuItem(
"1",
nullptr, rt_optix->maxDepth() == 1))
2509 sv->startOptixRaytracing(1);
2510 if (ImGui::MenuItem(
"2",
nullptr, rt_optix->maxDepth() == 2))
2511 sv->startOptixRaytracing(2);
2512 if (ImGui::MenuItem(
"3",
nullptr, rt_optix->maxDepth() == 3))
2513 sv->startOptixRaytracing(3);
2514 if (ImGui::MenuItem(
"5",
nullptr, rt_optix->maxDepth() == 5))
2515 sv->startOptixRaytracing(5);
2516 if (ImGui::MenuItem(
"Max. Contribution",
nullptr, rt_optix->maxDepth() == 0))
2517 sv->startOptixRaytracing(0);
2538 if (ImGui::MenuItem(
"Save Rendered Image"))
2539 rt_optix->saveImage();
2545 else if (rType ==
RT_pt)
2547 if (ImGui::BeginMenu(
"PT"))
2551 if (ImGui::BeginMenu(
"Resolution Factor"))
2572 if (ImGui::BeginMenu(
"NO. of Samples"))
2583 if (ImGui::MenuItem(
"Direct illumination",
nullptr, pt->
calcDirect()))
2589 if (ImGui::MenuItem(
"Indirect illumination",
nullptr, pt->
calcIndirect()))
2595 if (ImGui::MenuItem(
"Save Rendered Image"))
2598 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2600 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2605 ImGui::PopItemWidth();
2614 if (ImGui::BeginMenu(
"PT"))
2616 SLOptixPathtracer* pt =
sv->optixPathtracer();
2618 if (ImGui::BeginMenu(
"NO. of Samples"))
2620 if (ImGui::MenuItem(
"1",
nullptr, pt->samples() == 1))
2621 sv->startOptixPathtracing(5, 1);
2622 if (ImGui::MenuItem(
"10",
nullptr, pt->samples() == 10))
2623 sv->startOptixPathtracing(5, 10);
2624 if (ImGui::MenuItem(
"100",
nullptr, pt->samples() == 100))
2625 sv->startOptixPathtracing(5, 100);
2626 if (ImGui::MenuItem(
"1000",
nullptr, pt->samples() == 1000))
2627 sv->startOptixPathtracing(5, 1000);
2628 if (ImGui::MenuItem(
"10000",
nullptr, pt->samples() == 10000))
2629 sv->startOptixPathtracing(5, 10000);
2634 if (ImGui::MenuItem(
"Denoiser",
nullptr, pt->getDenoiserEnabled()))
2636 pt->setDenoiserEnabled(!pt->getDenoiserEnabled());
2637 sv->startOptixPathtracing(5, pt->samples());
2640 if (ImGui::MenuItem(
"Save Rendered Image"))
2648 if (ImGui::BeginMenu(
"Camera"))
2653 if (ImGui::MenuItem(
"Reset"))
2660 if (ImGui::BeginMenu(
"Look from"))
2671 if (ImGui::MenuItem(
"Next camera in Scene",
"TAB"))
2674 if (ImGui::MenuItem(
"Sceneview Camera",
"TAB"))
2681 if (ImGui::BeginMenu(
"Projection"))
2688 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2706 if (ImGui::BeginMenu(
"Stereo"))
2711 if (ImGui::MenuItem(pStr.c_str(),
nullptr, proj == (
SLProjType)p))
2719 if (ImGui::SliderFloat(
"Eye Sep.", &eyeSepar, 0.0f, focalDist / 10.f))
2728 if (ImGui::SliderFloat(
"FOV (V)", &fov, 1.f, 179.f))
2731 ImGui::Text(
"FOV (H): %3.1f ", cam->
fovH());
2733 if (ImGui::SliderFloat(
"Near Clip", &clipN, 0.001f, 10.f))
2736 if (ImGui::SliderFloat(
"Focal Dist.", &focalDist, clipN, clipF))
2739 if (ImGui::SliderFloat(
"Far Clip", &clipF, clipN, std::min(clipF * 1.1f, 1000000.f)))
2742 ImGui::PopItemWidth();
2746 if (ImGui::BeginMenu(
"Animation"))
2750 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2752 if (ImGui::MenuItem(
"Turntable Y up",
nullptr, ca ==
CA_turntableYUp))
2755 if (ImGui::MenuItem(
"Turntable Z up",
nullptr, ca ==
CA_turntableZUp))
2758 if (ImGui::MenuItem(
"Trackball",
nullptr, ca ==
CA_trackball))
2761 if (ImGui::MenuItem(
"Walk Y up",
nullptr, ca ==
CA_walkingYUp))
2764 if (ImGui::MenuItem(
"Walk Z up",
nullptr, ca ==
CA_walkingZUp))
2767 float mouseRotFactor =
sv->
camera()->mouseRotationFactor();
2768 if (ImGui::SliderFloat(
"Mouse Sensibility", &mouseRotFactor, 0.1f, 2.0f,
"%2.1f"))
2769 sv->
camera()->mouseRotationFactor(mouseRotFactor);
2782 if (ImGui::SliderFloat(
"Walk Speed", &ms, 0.01f, std::min(ms * 1.1f, 10000.f)))
2786 ImGui::PopItemWidth();
2790 if (ImGui::BeginMenu(
"Fog"))
2792 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2794 if (ImGui::MenuItem(
"Fog is on",
nullptr, cam->
fogIsOn()))
2797 if (ImGui::BeginMenu(
"Mode"))
2801 if (ImGui::MenuItem(
"exp",
nullptr, cam->
fogMode() ==
FM_exp))
2811 if (ImGui::SliderFloat(
"Density", &fogDensity, 0.0f, 0.2f))
2815 ImGui::PopItemWidth();
2822 if (ImGui::BeginMenu(
"Animation", hasAnimations))
2831 if (curAnimIx == -1) curAnimIx = 0;
2834 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.8f);
2835 if (
myComboBox(
"##", &curAnimIx, animations))
2837 ImGui::PopItemWidth();
2845 if (ImGui::MenuItem(
"Pause",
nullptr, anim->
isPaused()))
2848 if (ImGui::MenuItem(
"Stop",
nullptr, anim->
isStopped()))
2851 if (ImGui::MenuItem(
"Skip to next keyfr.",
nullptr,
false))
2854 if (ImGui::MenuItem(
"Skip to prev. keyfr.",
nullptr,
false))
2857 if (ImGui::MenuItem(
"Skip to start",
nullptr,
false))
2860 if (ImGui::MenuItem(
"Skip to end",
nullptr,
false))
2863 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.6f);
2866 if (ImGui::SliderFloat(
"Speed", &speed, 0.f, 4.f))
2871 if (ImGui::SliderFloat(
"Time", &localTimeSec, 0.f, lenSec))
2875 const char* easings[] = {
"linear",
2896 if (ImGui::Combo(
"Easing", &curEasing, easings, IM_ARRAYSIZE(easings)))
2899 ImGui::PopItemWidth();
2903 if (ImGui::BeginMenu(
"Infos"))
2907 if (ImGui::BeginMenu(
"Statistics"))
2914 ImGui::MenuItem(
"Stats on WAI",
nullptr, &
showStatsWAI);
2926 ImGui::MenuItem(
"UI-Preferences",
nullptr, &
showUIPrefs);
2934 ImGui::MenuItem(
"ErlebAR Settings",
nullptr, &
showErlebAR);
2937 ImGui::MenuItem(
"Help on Interaction",
nullptr, &
showHelp);
2940 ImGui::MenuItem(
"Credits",
nullptr, &
showCredits);
2941 ImGui::MenuItem(
"About SLProject",
nullptr, &
showAbout);
2946 ImGui::EndMainMenuBar();
2953 if (ImGui::MenuItem(
"Deselect Node",
"ESC"))
2982 if (ImGui::BeginMenu(
"Node Flags"))
3016 if (ImGui::MenuItem(
"All off"))
3028 if (!ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) &&
3029 ImGui::IsMouseReleased(1))
3031 ImGui::OpenPopup(
"Context Menu");
3034 if (ImGui::BeginPopup(
"Context Menu"))
3044 if (ImGui::MenuItem(
"Show Properties"))
3050 if (ImGui::MenuItem(
"Show user interface"))
3054 if (ImGui::MenuItem(
"Hide user interface"))
3058 if (ImGui::MenuItem(
"Show root node"))
3062 if (ImGui::MenuItem(
"Hide root node"))
3065 if (ImGui::MenuItem(
"Capture Screen"))
3079 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
3080 ImGui::Begin(
"Scenegraph", &
showSceneGraph, ImGuiWindowFlags_NoNavInputs);
3104 ImGuiTreeNodeFlags nodeFlags = 0;
3106 nodeFlags |= ImGuiTreeNodeFlags_Leaf;
3108 nodeFlags |= ImGuiTreeNodeFlags_OpenOnArrow;
3111 nodeFlags |= ImGuiTreeNodeFlags_Selected;
3115 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 1.0f, 1.0f));
3116 nodeIsOpen = ImGui::TreeNodeEx(node->
name().c_str(), nodeFlags);
3117 ImGui::PopStyleColor();
3121 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 0.0f, 1.0f));
3122 nodeIsOpen = ImGui::TreeNodeEx(node->
name().c_str(), nodeFlags);
3123 ImGui::PopStyleColor();
3126 if (ImGui::IsItemClicked())
3137 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
3139 ImGuiTreeNodeFlags meshFlags = ImGuiTreeNodeFlags_Leaf;
3141 meshFlags |= ImGuiTreeNodeFlags_Selected;
3143 ImGui::TreeNodeEx(mesh, meshFlags,
"%s", mesh->
name().c_str());
3145 if (ImGui::IsItemClicked())
3152 ImGui::PopStyleColor();
3155 for (
auto* child : node->
children())
3173 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
3174 ImGui::Begin(
"Properties", &
showProperties, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoNavInputs);
3175 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 1.0f, 1.0f));
3177 if (ImGui::TreeNode(
"Scene Properties"))
3181 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3183 if (ImGui::ColorEdit3(
"Global Ambient Color", (
float*)&gAC, cef))
3184 s->
lights()[0]->globalAmbient = gAC;
3187 if (ImGui::TreeNode(
"Sky",
"Skybox"))
3196 if (ImGui::SliderFloat(
"Exposure", &exposure, 0.05f, 5.0f))
3210 ImGui::Text(
"No properties for skyboxes that are not used for lighting (HDR)");
3215 ImGui::Text(
"Skybox: None");
3222 ImGui::PopStyleColor();
3229 if (singleNode && !partialSelection)
3231 if (ImGui::TreeNode(
"Node Properties"))
3237 ImGui::Text(
"Node name : %s", singleNode->
name().c_str());
3238 ImGui::Text(
"# children : %u", c);
3239 ImGui::Text(
"# meshes : %u", m);
3240 if (ImGui::TreeNode(
"Drawing flags"))
3243 if (ImGui::Checkbox(
"Hide", &db))
3247 if (ImGui::Checkbox(
"Not selectable", &db))
3251 if (ImGui::Checkbox(
"Show wireframe", &db))
3255 if (ImGui::Checkbox(
"Show with hard edges", &db))
3259 if (ImGui::Checkbox(
"Show only hard edges", &db))
3263 if (ImGui::Checkbox(
"Show normals", &db))
3267 if (ImGui::Checkbox(
"Show voxels", &db))
3271 if (ImGui::Checkbox(
"Show bounding boxes", &db))
3275 if (ImGui::Checkbox(
"Show bounding rects", &db))
3279 if (ImGui::Checkbox(
"Show axis", &db))
3283 if (ImGui::Checkbox(
"Show back faces", &db))
3289 if (ImGui::TreeNode(
"Local transform"))
3296 ImGui::Text(
"Translation : %s", trn.
toString().c_str());
3297 ImGui::Text(
"Rotation : %s", rot.
toString().c_str());
3298 ImGui::Text(
"Scaling : %s", scl.
toString().c_str());
3303 if (ImGui::TreeNode(
"Shadow mapping"))
3306 if (ImGui::Checkbox(
"Casts shadows", &castsShadows))
3309 if (
auto* light =
dynamic_cast<SLLight*
>(singleNode))
3311 SLbool createsShadows = light->createsShadows();
3312 if (ImGui::Checkbox(
"Creates shadows", &createsShadows))
3313 light->createsShadows(createsShadows);
3319 if (shadowMap !=
nullptr)
3322 light->spotCutOffDEG() < 90.0f)
3325 if (ImGui::Checkbox(
"Uses Cubemap", &useCubemap))
3335 if (ImGui::SliderFloat(
"Near clipping plane", &clipNear, 0.01f, clipFar))
3338 if (ImGui::SliderFloat(
"Far clipping plane", &clipFar, clipNear, 200.0f))
3345 if (ImGui::SliderInt(
"Number of cascades", &numCascades, 1, maxCascades))
3347 if (ImGui::SliderFloat(
"Cascades factor", &factor, 1.0, 500.0f))
3352 if (ImGui::SliderInt2(
"Texture resolution", (
int*)&texSize, 32, 4096))
3357 SLfloat shadowMinBias = light->shadowMinBias();
3358 SLfloat shadowMaxBias = light->shadowMaxBias();
3359 if (ImGui::SliderFloat(
"Min. shadow bias", &shadowMinBias, 0.0f, shadowMaxBias,
"%.03f"))
3360 light->shadowMinBias(shadowMinBias);
3361 if (ImGui::SliderFloat(
"Max. shadow bias", &shadowMaxBias, shadowMinBias, 0.02f,
"%.03f"))
3362 light->shadowMaxBias(shadowMaxBias);
3367 if (ImGui::InputFloat2(
"Size", (
float*)&size))
3368 shadowMap->
size(size);
3373 SLbool doSmoothShadows = light->doSoftShadows();
3374 if (ImGui::Checkbox(
"Do smooth shadows", &doSmoothShadows))
3375 light->doSmoothShadows(doSmoothShadows);
3377 SLuint pcfLevel = light->softShadowLevel();
3378 if (ImGui::SliderInt(
"Smoothing level", (
SLint*)&pcfLevel, 1, 3))
3379 light->smoothShadowLevel(pcfLevel);
3383 if (ImGui::Checkbox(
"Do colored shadows", &doColoredShadows))
3387 if (ImGui::InputInt2(
"Visualization rays", (
int*)&rayCount))
3393 if (ImGui::TreeNode(
"Light cascade space matrices"))
3403 if (ImGui::TreeNode(shadowMap->
useCubemap() ?
"Light space matrices" :
"Light space matrix"))
3406 for (
SLint i = 0; i < 6; ++i)
3419 for (
int i = 0; i < shadowMap->
depthBuffers().size(); i++)
3421 ImGui::Text((
"Depth Buffer " + std::to_string(i) +
":").c_str());
3422 ImGui::Image((
void*)(intptr_t)shadowMap->
depthBuffers().at(i)->texID(),
3428 ImGui::Text(
"Depth Buffer:");
3441 if (
typeid(*singleNode) ==
typeid(
SLCamera))
3445 if (ImGui::TreeNode(
"Camera"))
3447 SLfloat clipN = cam->clipNear();
3448 SLfloat clipF = cam->clipFar();
3449 SLfloat focalDist = cam->focalDist();
3452 const char* projections[] = {
"Mono Perspective",
3453 "Mono Intrinsic Calibrated",
3454 "Mono Orthographic",
3455 "Stereo Side By Side",
3456 "Stereo Side By Side Prop.",
3457 "Stereo Side By Side Dist.",
3458 "Stereo Line By Line",
3459 "Stereo Column By Column",
3460 "Stereo Pixel By Pixel",
3461 "Stereo Color Red-Cyan",
3462 "Stereo Color Red-Green",
3463 "Stereo Color Red-Blue",
3464 "Stereo Color Yellow-Blue"};
3466 int proj = cam->projType();
3467 if (ImGui::Combo(
"Projection", &proj, projections, IM_ARRAYSIZE(projections)))
3472 SLfloat eyeSepar = cam->stereoEyeSeparation();
3473 if (ImGui::SliderFloat(
"Eye Sep.", &eyeSepar, 0.0f, focalDist / 10.f))
3474 cam->stereoEyeSeparation(eyeSepar);
3477 if (ImGui::SliderFloat(
"FOV", &fov, 1.f, 179.f))
3480 if (ImGui::SliderFloat(
"Near Clip", &clipN, 0.001f, 10.f))
3481 cam->clipNear(clipN);
3483 if (ImGui::SliderFloat(
"Far Clip", &clipF, clipN, std::min(clipF * 1.1f, 1000000.f)))
3484 cam->clipFar(clipF);
3486 if (ImGui::SliderFloat(
"Focal Dist.", &focalDist, clipN, clipF))
3487 cam->focalDist(focalDist);
3500 SLbool doSunPowerAdaptation =
false;
3504 typeName =
"Light (spot):";
3509 typeName =
"Light (rectangular):";
3514 typeName =
"Light (directional):";
3515 doSunPowerAdaptation = ((
SLLightDirect*)singleNode)->doSunPowerAdaptation();
3518 if (light && ImGui::TreeNode(typeName.c_str()))
3521 if (ImGui::Checkbox(
"Is on", &on))
3524 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3526 if (ImGui::ColorEdit3(
"Ambient color", (
float*)&aC, cef))
3531 if (doSunPowerAdaptation)
3533 float sum_aPdP = aP + dP;
3534 float ambiFraction = aP / sum_aPdP;
3535 if (ImGui::SliderFloat(
"Diffuse-Ambient-Mix", &ambiFraction, 0.0f, 1.0f,
"%.2f"))
3544 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dC, cef))
3548 if (ImGui::ColorEdit3(
"Specular color", (
float*)&sC, cef))
3552 if (ImGui::SliderFloat(
"Ambient power", &aP, 0.0f, 10.0f,
"%.2f"))
3555 if (ImGui::SliderFloat(
"Diffuse power", &dP, 0.0f, 10.0f,
"%.2f"))
3559 if (ImGui::SliderFloat(
"Specular power", &sP, 0.0f, 10.0f,
"%.2f"))
3563 if (ImGui::SliderFloat(
"Spot cut off angle", &cutoff, 0.0f, 180.0f,
"%.2f"))
3567 if (ImGui::SliderFloat(
"Spot attenuation", &spotExp, 0.0f, 128.0f,
"%.2f"))
3570 float kc = light->
kc();
3571 if (ImGui::SliderFloat(
"Constant attenuation", &kc, 0.0f, 1.0f,
"%.2f"))
3574 float kl = light->
kl();
3575 if (ImGui::SliderFloat(
"Linear attenuation", &kl, 0.0f, 1.0f,
"%.2f"))
3578 float kq = light->
kq();
3579 if (ImGui::SliderFloat(
"Quadratic attenuation", &kq, 0.0f, 1.0f,
"%.2f"))
3585 if (ImGui::Checkbox(
"Do Sun Power Adaptation", &doSunPowerAdaptation))
3588 if (doSunPowerAdaptation)
3591 if (ImGui::TreeNode(
"Sun Color LUT"))
3599 ImGui::GetWindowWidth() - 4 * ImGui::GetTreeNodeToLabelSpacing() - 10;
3600 void* tid = (ImTextureID)(uintptr_t)lut->
texID();
3602 ImVec2(texW, texW * 0.15f),
3606 ImVec4(1, 1, 1, 1));
3616 ImGui::Text(
"No single node selected.");
3621 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
3627 if (ImGui::TreeNode(
"Mesh Properties"))
3630 SLuint t = (
SLuint)(!singleFullMesh->
I16.empty() ? singleFullMesh->
I16.size() / 3 : singleFullMesh->
I32.size() / 3);
3631 SLuint e = (
SLuint)(!singleFullMesh->
IE16.empty() ? singleFullMesh->
IE16.size() / 2 : singleFullMesh->
IE32.size() / 2);
3633 ImGui::Text(
"Mesh name : %s", singleFullMesh->
name().c_str());
3637 ImGui::Text(
"# vertices : %u", ps->
amount() * 4);
3638 ImGui::Text(
"# triangles : %u", ps->
amount() * 2);
3642 ImGui::Text(
"# vertices : %u", v);
3643 ImGui::Text(
"# triangles : %u", t);
3644 ImGui::Text(
"# hard edges : %u", e);
3646 ImGui::Text(
"Material Name: %s", m->
name().c_str());
3650 if (ImGui::TreeNode(
"Reflection Model: Blinn-Phong"))
3652 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3654 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3656 if (ImGui::ColorEdit3(
"Ambient color", (
float*)&ac, cef))
3660 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dc, cef))
3664 if (ImGui::ColorEdit3(
"Specular color", (
float*)&sc, cef))
3668 if (ImGui::ColorEdit3(
"Emissive color", (
float*)&ec, cef))
3672 if (ImGui::SliderFloat(
"Shininess", &shine, 0.0f, 1000.0f))
3676 if (ImGui::SliderFloat(
"kr", &kr, 0.0f, 1.0f))
3680 if (ImGui::SliderFloat(
"kt", &kt, 0.0f, 1.0f))
3684 if (ImGui::SliderFloat(
"kn", &kn, 1.0f, 2.5f))
3688 if (ImGui::Checkbox(
"Receives shadows", &receivesShadows))
3691 ImGui::PopItemWidth();
3697 if (ImGui::TreeNode(
"Reflection Model: Cook-Torrance"))
3701 ImGui::Text(
"Controlled by textures");
3705 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3707 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3709 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dc, cef))
3713 if (ImGui::SliderFloat(
"Roughness", &rough, 0.0f, 1.0f))
3717 if (ImGui::SliderFloat(
"Metalness", &metal, 0.0f, 1.0f))
3720 ImGui::PopItemWidth();
3727 if (ImGui::TreeNode(
"Particle System"))
3730 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3736 if (ImGui::Checkbox(
"Instanced draw", &drawInstanced))
3747 if (ImGui::Button(
"Resume"))
3752 if (ImGui::Button(
"Pause"))
3756 if (ImGui::Button(
"Reset"))
3759 if (ImGui::CollapsingHeader(
"Emission"))
3764 int amount = ps->
amount();
3765 if (ImGui::InputInt(
"Amount of particles", &amount))
3774 if (ImGui::CollapsingHeader(
"Time to live"))
3779 if (ImGui::InputFloat(
"Time to live (s)", &timeToLive))
3787 if (ImGui::Checkbox(
"Counter lag/gap", &doCounterGap))
3793 ImGui::TextWrapped(
"Need to be enable by default but can create flickering with few particles, recommend to disable if few particles with no velocity ");
3800 if (ImGui::Combo(
"Billboard Type",
3802 "Camera Billboard\0Vertical Billboard\0Horizontal Billboard\0"))
3806 if (item_current == 2)
3820 if (ImGui::Checkbox(
"Shape", &shape_group))
3827 if (ImGui::CollapsingHeader(
"Shape", &shape_group))
3831 if (ImGui::Combo(
"Shape type",
3833 "Sphere\0Box\0Cone\0Pyramid\0"))
3843 if (ImGui::InputFloat(
"Radius of the sphere", &radiusSphere))
3850 if (item_current ==
ST_Box)
3853 if (ImGui::InputFloat3(
"Scale box XYZ", vec3fScaleBox))
3855 ps->
shapeScale(vec3fScaleBox[0], vec3fScaleBox[1], vec3fScaleBox[2]);
3863 if (ImGui::InputFloat(
"Radius", &radius))
3870 if (ImGui::InputFloat(
"Angle", &angle))
3877 if (ImGui::InputFloat(
"Height", &height))
3887 if (ImGui::InputFloat(
"Half side", &halfSide))
3894 if (ImGui::InputFloat(
"Angle", &angle))
3901 if (ImGui::InputFloat(
"Height", &height))
3910 if (ImGui::Checkbox(
"Spawn surface", &shapeSurf))
3915 if (item_current == 2 || item_current == 3)
3918 if (ImGui::Checkbox(
"Spawn base volume", &shapeSpawnBase))
3927 ImGui::BeginDisabled();
3928 ImGui::LabelText(
"Condition",
"Need to have direction and speed enabled");
3929 if (item_current == 2 || item_current == 3)
3932 if (ImGui::Checkbox(
"Follow shape direction (Override direction)",
3940 else if (item_current == 0 || item_current == 1)
3943 if (ImGui::Checkbox(
"Inverse center direction (Override direction)", &shapeOverride))
3952 ImGui::EndDisabled();
3960 if (ImGui::Checkbox(
"Flipbook texture", &flipbookTex_group))
3968 if (ImGui::CollapsingHeader(
"Flipbook texture", &flipbookTex_group))
3972 if (ImGui::InputInt(
"Frame rate (num update by s)", &fR))
3983 if (ImGui::CollapsingHeader(
"Size"))
3988 float radiusW = ps->
radiusW();
3989 if (ImGui::InputFloat(
"Radius width", &radiusW))
3994 float radiusH = ps->
radiusH();
3995 if (ImGui::InputFloat(
"Radius height", &radiusH))
4000 float scale = ps->
scale();
4001 if (ImGui::InputFloat(
"Scale", &scale))
4009 if (ImGui::Checkbox(
"Size over lifetime", &doSizeOverLT_group))
4015 if (ImGui::CollapsingHeader(
"Size over lifetime", &doSizeOverLT_group))
4019 if (ImGui::Checkbox(
"Custom curve (Unchecked --> Linear function)2", &doSizeOverLTCurve_group))
4024 if (ImGui::CollapsingHeader(
"Bezier curve size", &doSizeOverLTCurve_group))
4029 if (ImGui::Bezier(
"easeInExpo", vSize, staEndSize))
4039 if (ImGui::CollapsingHeader(
"Movement"))
4045 if (ImGui::Checkbox(
"World space", &doWorldSpace))
4050 if (ImGui::Checkbox(
"Gravity", &doGravity))
4057 if (ImGui::CollapsingHeader(
"Gravity", &doGravity))
4061 if (ImGui::InputFloat3(
"Gravity XYZ", vec3Gravity))
4063 ps->
gravity(vec3Gravity[0], vec3Gravity[1], vec3Gravity[2]);
4071 if (ImGui::Checkbox(
"Acceleration", &acc_group))
4078 if (ImGui::CollapsingHeader(
"Acceleration", &acc_group))
4082 ImGui::BeginDisabled();
4084 if (ImGui::InputFloat(
"Accelaration constant", &accConst))
4090 ImGui::EndDisabled();
4092 if (ImGui::Checkbox(
"Direction vector", &accDiffDirection_group))
4098 if (ImGui::CollapsingHeader(
"Direction vector", &accDiffDirection_group))
4101 ImGui::InputFloat3(
"input float3", vec3fAcc);
4102 ps->
acceleration(vec3fAcc[0], vec3fAcc[1], vec3fAcc[2]);
4110 ImGui::BeginDisabled();
4111 if (ImGui::CollapsingHeader(
"Velocity"))
4115 if (ImGui::Combo(
"Velocity type", &item_current,
"Random axes\0Constant axes\0"))
4121 if (item_current == 0)
4124 if (ImGui::InputFloat3(
"Min. random XYZ", vec3fVstart))
4126 ps->
velocityRndMin(vec3fVstart[0], vec3fVstart[1], vec3fVstart[2]);
4131 if (ImGui::InputFloat3(
"Max. random XYZ", vec3fVend))
4138 else if (item_current == 1)
4141 if (ImGui::InputFloat3(
"Constant XYZ", vec3fVelocity))
4143 ps->
velocityConst(vec3fVelocity[0], vec3fVelocity[1], vec3fVelocity[2]);
4151 ImGui::EndDisabled();
4155 if (ImGui::Checkbox(
"Direction and Speed", &directionSpeed_group))
4162 if (ImGui::CollapsingHeader(
"Direction and Speed", &directionSpeed_group))
4166 if (ImGui::InputFloat3(
"Constant XYZ", vec3fDirection))
4168 ps->
direction(vec3fDirection[0], vec3fDirection[1], vec3fDirection[2]);
4174 if (ImGui::Combo(
"Speed value",
4176 "Constant\0Random between two constants\0"))
4178 if (item_current == 1)
4188 float speed = ps->
speed();
4189 if (ImGui::InputFloat(
"Constant", &speed))
4199 if (ImGui::InputFloat2(
"Random range Speed", vec2fRange))
4201 ps->
speedRange(vec2fRange[0], vec2fRange[1]);
4209 if (ImGui::Checkbox(
"Rotation", &rot_group))
4216 if (ImGui::CollapsingHeader(
"Rotation", &rot_group))
4220 if (ImGui::Combo(
"Angular velocity value", &item_current,
"Constant\0Random between two constants\0"))
4222 if (item_current == 1)
4233 if (ImGui::InputFloat(
"Constant", &angularVelocityConst))
4241 if (ImGui::InputFloat2(
"Random range A.V", vec2fRange))
4256 if (ImGui::CollapsingHeader(
"Color"))
4262 if (ImGui::Checkbox(
"Color", &color_group))
4267 if (ImGui::CollapsingHeader(
"Color", &color_group))
4272 if (ImGui::Checkbox(
"Glow/Bright (blending effect)", &color_bright))
4279 ImGui::BeginDisabled();
4280 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
4282 if (ImGui::ColorEdit4(
"Particle color", (
float*)&c, cef))
4285 ImGui::EndDisabled();
4290 if (ImGui::Checkbox(
"Color over lifetime", &doColorOverLT_group))
4297 if (ImGui::CollapsingHeader(
"Color over lifetime", &doColorOverLT_group))
4299 ImGui::Text(
"Edit gradient colors in the texture section.");
4306 if (ImGui::Checkbox(
"Alpha over lifetime", &doAlphaOverL_group))
4311 if (ImGui::CollapsingHeader(
"Alpha over lifetime", &doAlphaOverL_group))
4315 if (ImGui::Checkbox(
"Custom curve (Unchecked --> Linear function)", &doAlphaOverLCurve_group))
4320 if (ImGui::CollapsingHeader(
"Bezier curve alpha", &doAlphaOverLCurve_group))
4325 if (ImGui::Bezier(
"easeInExpo", vAlpha, staEndAlpha))
4335 ImGui::PopItemWidth();
4351 size_t numShaders = m->
program() ? m->
program()->shaders().size() : 0;
4354 if (numShaders > 0 && ImGui::TreeNode(
"Shd",
"Shaders (%d)", (
int)numShaders))
4358 for (
auto* shd : m->
program()->shaders())
4360 if (ImGui::TreeNode(shd->name().c_str()))
4362 SLchar* text =
new char[shd->code().length() + 1];
4363 strcpy(text, shd->code().c_str());
4364 ImGui::InputTextMultiline(shd->name().c_str(),
4366 shd->code().length() + 1,
4367 ImVec2(-1.0f, -1.0f));
4375 for (
auto* shd : m->
programTF()->shaders())
4377 if (ImGui::TreeNode(shd->name().c_str()))
4379 SLchar* text =
new char[shd->code().length() + 1];
4380 strcpy(text, shd->code().c_str());
4381 ImGui::InputTextMultiline(shd->name().c_str(),
4383 shd->code().length() + 1,
4384 ImVec2(-1.0f, -1.0f));
4399 ImGui::Text(
"No single single mesh selected.");
4402 ImGui::PopStyleColor();
4407 ImGui::Begin(
"Properties of Selection", &
showProperties, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoNavInputs);
4411 if (selectedNode->mesh())
4413 ImGui::Text(
"Node: %s", selectedNode->name().c_str());
4414 SLMesh* selectedMesh = selectedNode->mesh();
4416 if (!selectedMesh->
IS32.empty())
4418 ImGui::Text(
" Mesh: %s {%u v.}",
4419 selectedMesh->
name().c_str(),
4423 if (ImGui::Button(delBtn.c_str()))
4436 ImGui::Text(
"There is nothing selected.");
4438 ImGui::Text(
"Select a single node by");
4439 ImGui::Text(
"double-clicking it or");
4440 ImGui::Text(
"select multiple nodes by");
4441 ImGui::Text(
"SHIFT-double-clicking them.");
4443 ImGui::Text(
"Select partial meshes by");
4444 ImGui::Text(
"CTRL-LMB rectangle drawing.");
4446 ImGui::Text(
"Press ESC to deselect all.");
4448 ImGui::Text(
"Be aware that a node may be");
4449 ImGui::Text(
"flagged as not selectable.");
4454 ImGui::Text(
"Node selection and the");
4455 ImGui::Text(
"properties of it can only");
4456 ImGui::Text(
"be shown in the OpenGL");
4457 ImGui::Text(
"renderer.");
4468 SLfloat texW = ImGui::GetWindowWidth() - 4 * ImGui::GetTreeNodeToLabelSpacing() - 10;
4469 void* tid = (ImTextureID)(intptr_t)tex->
texID();
4474 if (ImGui::TreeNode(tex->
name().c_str()))
4477 for (
auto img : tex->
images())
4478 mbCPU += (
float)img->bytesPerImage();
4486 ImGui::Text(
"Size(PX): %dx%dx%d", tex->
width(), tex->
height(), tex->
depth());
4487 ImGui::Text(
"Size(MB): GPU:%4.2f, CPU:%4.2f, DSK:%4.2f", mbGPU, mbCPU, mbDSK);
4488 ImGui::Text(
"TexID : %u (%s)", tex->
texID(), tex->
isTexture() ?
"ok" :
"not ok");
4489 ImGui::Text(
"Type : %s", tex->
typeName().c_str());
4491 ImGui::Text(
"Format : %s", tex->
images()[0]->formatString().c_str());
4493 ImGui::Text(
"Format : %s",
"n/a (GPU only)");
4494 #ifdef SL_BUILD_WITH_KTX
4495 ImGui::Text(
"Compr. : %s", tex->compressionFormatStr(tex->compressionFormat()).c_str());
4500 if (tex->
target() == GL_TEXTURE_2D)
4505 if (ImGui::TreeNode(
"Color Points in Gradient"))
4511 if (ImGui::TreeNode(
"Alpha Points in Gradient"))
4515 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.25f);
4518 snprintf(label,
sizeof(label),
"Alpha %lu", a);
4519 if (ImGui::SliderFloat(label, &alpha, 0.0f, 1.0f,
"%3.2f"))
4521 lut->
alphas()[a].alpha = alpha;
4525 snprintf(label,
sizeof(label),
"Pos. %lu", a);
4527 if (a > 0 && a < lut->alphas().size() - 1)
4533 if (ImGui::SliderFloat(label, &pos, min, max,
"%3.2f"))
4535 lut->
alphas()[a].pos = pos;
4540 ImGui::Text(
"%3.2f Pos. %lu", pos, a);
4542 ImGui::PopItemWidth();
4549 ImVec2(texW, texW * 0.15f),
4553 ImVec4(1, 1, 1, 1));
4556 ImGui::PlotLines(
"",
4558 (
SLint)allAlpha.size(),
4563 ImVec2(texW, texW * 0.25f));
4568 ImVec2(texW, texW * h_to_w),
4572 ImVec4(1, 1, 1, 1));
4577 if (tex->
target() == GL_TEXTURE_CUBE_MAP)
4578 ImGui::Text(
"Cube maps can not be displayed.");
4579 else if (tex->
target() == GL_TEXTURE_3D)
4580 ImGui::Text(
"3D textures can not be displayed.");
4590 ImGuiStyle& style = ImGui::GetStyle();
4596 SL_LOG(
"No config file %s: ", fullPathAndFilename.c_str());
4599 SLfloat dpiScaleProp = (float)dotsPerInch / 142.0f;
4600 SLfloat dpiScaleFixed = (float)dotsPerInch / 142.0f;
4620 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = std::max(8.0f * dpiScaleFixed, 8.0f);
4621 style.FramePadding.y = style.ItemInnerSpacing.y = std::max(4.0f * dpiScaleFixed, 4.0f);
4622 style.WindowPadding.y = style.ItemSpacing.y * 3;
4623 style.ScrollbarSize = std::max(16.0f * dpiScaleFixed, 16.0f);
4626 if (style.ScrollbarSize < 0.0f)
4627 style.ScrollbarSize = 16.0f;
4629 style.ScrollbarRounding =
std::floor(style.ScrollbarSize / 2);
4636 CVFileStorage fs(configString, CVFileStorage::READ | CVFileStorage::MEMORY);
4646 fs[
"ItemSpacingX"] >> i; style.ItemSpacing.x = (
SLfloat) i;
4647 fs[
"ItemSpacingY"] >> i; style.ItemSpacing.y = (
SLfloat) i;
4648 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = style.ItemSpacing.x;
4649 style.FramePadding.y = style.ItemInnerSpacing.y = style.ItemSpacing.y;
4650 style.WindowPadding.y = style.ItemSpacing.y * 3;
4651 fs[
"ScrollbarSize"] >> i; style.ScrollbarSize = (
SLfloat) i;
4653 if (style.ScrollbarSize < 0.0f)
4654 style.ScrollbarSize = 16.0f;
4656 fs[
"ScrollbarRounding"] >> i; style.ScrollbarRounding = (
SLfloat) i;
4675 SL_LOG(
"Config. loaded : %s", fullPathAndFilename.c_str());
4682 SL_LOG(
"****** Failed to open file for reading: %s", fullPathAndFilename.c_str());
4687 SL_LOG(
"****** Parsing of file failed: %s", fullPathAndFilename.c_str());
4691 if (dotsPerInch > 300)
4697 SLfloat dpiScaleProp = (float)dotsPerInch / 120.0f;
4698 SLfloat dpiScaleFixed = (float)dotsPerInch / 142.0f;
4707 #ifdef SL_EMSCRIPTEN
4710 int sceneId = EM_ASM_INT(
4711 let params =
new URL(
window.location).searchParams;
4712 return params.get(
"scene") ?? -1;
4724 ImGuiStyle& style = ImGui::GetStyle();
4729 SL_LOG(
"New config file will be written: %s",
4730 fullPathAndFilename.c_str());
4733 CVFileStorage::WRITE | CVFileStorage::MEMORY);
4737 SL_LOG(
"Failed to open file for writing: %s",
4738 fullPathAndFilename.c_str());
4750 fs <<
"ItemSpacingX" << (
SLint)style.ItemSpacing.x;
4751 fs <<
"ItemSpacingY" << (
SLint)style.ItemSpacing.y;
4752 fs <<
"ScrollbarSize" << (
SLfloat)style.ScrollbarSize;
4753 fs <<
"ScrollbarRounding" << (
SLfloat)style.ScrollbarRounding;
4769 std::string configString = fs.releaseAndGetString();
4773 SL_LOG(
"Config. saved : %s", fullPathAndFilename.c_str());
4818 assert(
s->
assetManager() &&
"No asset manager assigned to scene!");
4839 s->
root2D()->addChild(horizonNode);
4853 s->
root2D()->deleteChild(horizonNode);
4862 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
4867 snprintf(label,
sizeof(label),
"Color %lu", c);
4868 if (ImGui::ColorEdit3(label, (
float*)&color, cef))
4870 lut->
colors()[c].color = color;
4874 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
4875 snprintf(label,
sizeof(label),
"Pos. %lu", c);
4877 if (c > 0 && c < lut->colors().size() - 1)
4881 if (ImGui::SliderFloat(label, &pos, min, max,
"%3.2f"))
4883 lut->
colors()[c].pos = pos;
4888 ImGui::Text(
"%3.2f Pos. %lu", pos, c);
4889 ImGui::PopItemWidth();
4895 string downloadFilename,
4896 string filenameToLoad,
4899 SLstring pathSrc =
"https://pallas.ti.bfh.ch/data/SLProject/models/";
4902 #ifndef SL_EMSCRIPTEN
4915 string downloadFilename,
4918 string pathAndFileToLoad,
4921 #ifndef SL_EMSCRIPTEN
4922 assert(
s->
assetManager() &&
"No asset manager assigned to scene!");
4925 auto progressCallback = [](
size_t curr,
size_t filesize)
4929 int transferredPC = (int)((
float)curr / (float)filesize * 100.0f);
4933 cout <<
"Bytes transferred: " << curr << endl;
4938 auto downloadJobHTTP = [=]()
4941 string jobMsg =
"Downloading file via HTTPS: " + downloadFilename;
4944 string fileToDownload = urlFolder + downloadFilename;
4945 if (HttpUtils::download(fileToDownload, dstFolder, progressCallback) != 0)
4947 SL_LOG(
"*** Nothing downloaded from: %s ***", fileToDownload.c_str());
4948 SL_LOG(
"*** PLEASE RETRY DOWNLOAD ***", fileToDownload.c_str());
4953 auto unzipJob = [=]()
4955 string jobMsg =
"Decompressing file: " + downloadFilename;
4958 string zipFile = dstFolder + downloadFilename;
4962 if (extension ==
"zip")
4969 SL_LOG(
"*** File do decompress doesn't exist: %s ***",
4974 auto followUpJob1 = [=]()
4979 SL_LOG(
"*** File do load doesn't exist: %s ***",
4980 pathAndFileToLoad.c_str());
4996 #if !defined(SL_OS_MACIOS) && !defined(SL_OS_ANDROID)
5001 SLVec3f camToLookAt = pos_f - lookAtPoint;
5003 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)
vector< SLfloat > SLVfloat
vector< SLstring > SLVstring
#define SL_EXIT_MSG(message)
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.
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
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.
void calcDirect(SLbool di)
void calcIndirect(SLbool ii)
void saveImage()
Saves the current PT image as PNG image.
static SLuint tirRays
NO. of TIR refraction rays.
static SLuint reflectedRays
NO. of reflected rays.
static SLint maxDepthReached
max. depth reached for all rays
static SLuint refractedRays
NO. of refracted rays.
static SLuint subsampledPixels
NO. of of subsampled pixels.
static SLuint totalNumRays()
Total NO. of rays shot during RT.
static SLfloat avgDepth
average depth reached
static SLuint subsampledRays
NO. of of subsampled rays.
static SLuint shadowRays
NO. of shadow 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)
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)
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.