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 modelCBB = erlebarPath +
"biel/Biel-CBB-AR.gltf";
1806 SLstring modelAR1 = erlebarPath +
"augst/augst-thtL1-tmpL2.gltf";
1807 SLstring modelAR2 = erlebarPath +
"augst/augst-thtL2-tmpL1.gltf";
1808 SLstring modelAR3 = erlebarPath +
"augst/augst-thtL1L2-tmpL1L2.gltf";
1809 SLstring modelAV1_AO = erlebarPath +
"avenches/avenches-amphitheater.gltf";
1810 SLstring modelAV2_AO = erlebarPath +
"avenches/avenches-cigognier.gltf";
1811 SLstring modelAV3 = erlebarPath +
"avenches/avenches-theater.gltf";
1812 SLstring modelSU1 = erlebarPath +
"sutz/Sutz-Kirchrain18.gltf";
1822 if (ImGui::BeginMenu(
"Erleb-AR"))
1860 if (ImGui::BeginMenu(
"Benchmarks"))
1862 #ifndef SL_EMSCRIPTEN
1967 if (ImGui::MenuItem(
"Empty Scene",
"Shift-Alt-0", sid ==
SID_Empty))
1970 if (ImGui::MenuItem(
"Next Scene",
1976 if (ImGui::MenuItem(
"Previous Scene",
1982 #ifndef SL_EMSCRIPTEN
1985 if (ImGui::MenuItem(
"Multi-threaded Jobs"))
1992 uint maxIter = 100000;
1995 for (uint i = 0; i < maxIter; ++i)
1998 int progressPC = (int)((
float)i / (float)maxIter * 100.0f);
2009 uint maxIter = 100000;
2012 for (uint i = 0; i < maxIter; ++i)
2015 int progressPC = (int)((
float)i / (float)maxIter * 100.0f);
2021 auto followUpJob1 = []()
2022 {
SL_LOG(
"followUpJob1"); };
2023 auto jobToFollow2 = []()
2024 {
SL_LOG(
"JobToFollow2"); };
2033 #if !defined(SL_OS_ANDROID) && !defined(SL_EMSCRIPTEN)
2036 if (ImGui::MenuItem(
"Quit & Save"))
2043 if (ImGui::BeginMenu(
"Preferences"))
2057 if (ImGui::MenuItem(
"Do Depth Test",
"T",
sv->
doDepthTest()))
2065 if (ImGui::BeginMenu(
"Viewport Aspect"))
2073 SLchar strSameAsVideo[256];
2074 snprintf(strSameAsVideo,
sizeof(strSameAsVideo),
"Same as Video (%d:%d)", videoAspect.
x, videoAspect.
y);
2104 #if defined(SL_OS_ANDROID) || defined(SL_OS_MACIOS)
2105 if (ImGui::BeginMenu(
"Rotation Sensor"))
2109 if (ImGui::MenuItem(
"Use Device Rotation (IMU)",
nullptr, devRot.
isUsed()))
2115 if (ImGui::SliderInt(
"Average length", &numAveraged, 1, 10))
2118 if (ImGui::BeginMenu(
"Offset Mode"))
2121 if (ImGui::MenuItem(
"None",
nullptr, om ==
ROM_none))
2123 if (ImGui::MenuItem(
"Finger rot. X",
nullptr, om ==
ROM_oneFingerX))
2125 if (ImGui::MenuItem(
"Finger rot. X and Y",
nullptr, om ==
ROM_oneFingerXY))
2131 if (ImGui::MenuItem(
"Zero Yaw at Start",
nullptr, devRot.
zeroYawAtStart()))
2134 if (ImGui::MenuItem(
"Reset Zero Yaw"))
2149 if (ImGui::BeginMenu(
"Location Sensor"))
2153 if (ImGui::MenuItem(
"Use Device Location (GPS)",
nullptr,
AppCommon::devLoc.isUsed()))
2157 if (ImGui::MenuItem(
"Use Origin Altitude",
nullptr,
AppCommon::devLoc.useOriginAltitude()))
2160 if (ImGui::MenuItem(
"Reset Origin to here"))
2163 if (ImGui::BeginMenu(
"Offset Mode"))
2166 if (ImGui::MenuItem(
"None",
nullptr, om ==
LOM_none))
2168 if (ImGui::MenuItem(
"Two Finger Y",
nullptr, om ==
LOM_twoFingerY))
2178 if (ImGui::BeginMenu(
"Video Sensor"))
2181 if (ImGui::BeginMenu(
"Mirror Camera"))
2183 if (ImGui::MenuItem(
"Horizontally",
nullptr, ac->
mirrorH()))
2190 if (ImGui::MenuItem(
"Vertically",
nullptr, ac->
mirrorV()))
2200 if (ImGui::BeginMenu(
"Resolution",
2204 for (
int i = 0; i < (int)capture->
camSizes.size(); ++i)
2211 capture->
camSizes[(uint)i].height);
2219 #ifndef SL_EMSCRIPTEN
2220 if (ImGui::BeginMenu(
"Calibration"))
2222 if (ImGui::MenuItem(
"Start Calibration (Main Camera)"))
2229 if (ImGui::MenuItem(
"Start Calibration (Scnd. Camera)",
nullptr,
false, capture->
hasSecondaryCamera))
2268 if (ImGui::BeginMenu(
"Feature Tracking", featureTracker !=
nullptr) && featureTracker !=
nullptr)
2270 if (ImGui::MenuItem(
"Force Relocation",
nullptr, featureTracker->
forceRelocation()))
2273 if (ImGui::BeginMenu(
"Detector/Descriptor", featureTracker !=
nullptr))
2277 if (ImGui::MenuItem(
"RAUL/RAUL",
nullptr, type ==
DDT_RAUL_RAUL))
2279 if (ImGui::MenuItem(
"ORB/ORB",
nullptr, type ==
DDT_ORB_ORB))
2281 if (ImGui::MenuItem(
"FAST/BRIEF",
nullptr, type ==
DDT_FAST_BRIEF))
2283 if (ImGui::MenuItem(
"SURF/SURF",
nullptr, type ==
DDT_SURF_SURF))
2285 if (ImGui::MenuItem(
"SIFT/SIFT",
nullptr, type ==
DDT_SIFT_SIFT))
2300 ImGui::MenuItem(
"UI Preferences",
nullptr, &
showUIPrefs);
2313 if (ImGui::MenuItem(
"Clear selection"))
2315 sv->
camera()->selectRect().setZero();
2316 sv->
camera()->deselectRect().setZero();
2323 if (ImGui::BeginMenu(
"Renderer"))
2325 if (ImGui::MenuItem(
"OpenGL",
"ESC", rType ==
RT_gl))
2328 if (ImGui::MenuItem(
"Ray Tracing",
"R", rType ==
RT_rt))
2331 if (ImGui::MenuItem(
"Path Tracing",
"P", rType ==
RT_pt))
2335 if (ImGui::MenuItem(
"Ray Tracing with OptiX",
"Shift-R", rType ==
RT_optix_rt))
2336 sv->startOptixRaytracing(5);
2338 if (ImGui::MenuItem(
"Path Tracing with OptiX",
"Shift-P", rType ==
RT_optix_pt))
2339 sv->startOptixPathtracing(5, 10);
2341 ImGui::MenuItem(
"Ray Tracing with OptiX",
nullptr,
false,
false);
2342 ImGui::MenuItem(
"Path Tracing with OptiX",
nullptr,
false,
false);
2349 if (ImGui::BeginMenu(
"GL"))
2384 if (ImGui::MenuItem(
"All off"))
2387 if (ImGui::MenuItem(
"All on"))
2401 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2403 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2405 ImGui::PopItemWidth();
2410 else if (rType ==
RT_rt)
2412 if (ImGui::BeginMenu(
"RT"))
2416 if (ImGui::BeginMenu(
"Resolution Factor"))
2437 if (ImGui::MenuItem(
"Parallel distributed",
nullptr, rt->
doDistributed()))
2443 if (ImGui::MenuItem(
"Continuously",
nullptr, rt->
doContinuous()))
2449 if (ImGui::MenuItem(
"Fresnel Reflection",
nullptr, rt->
doFresnel()))
2455 if (ImGui::BeginMenu(
"Max. Depth"))
2466 if (ImGui::BeginMenu(
"Anti-Aliasing Samples"))
2477 if (ImGui::MenuItem(
"Save Rendered Image"))
2480 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2482 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2487 ImGui::PopItemWidth();
2496 if (ImGui::BeginMenu(
"RT"))
2498 SLOptixRaytracer* rt_optix =
sv->optixRaytracer();
2500 if (ImGui::MenuItem(
"Parallel distributed",
nullptr, rt_optix->doDistributed()))
2502 rt_optix->doDistributed(!rt_optix->doDistributed());
2503 sv->startOptixRaytracing(rt_optix->maxDepth());
2512 if (ImGui::BeginMenu(
"Max. Depth"))
2514 if (ImGui::MenuItem(
"1",
nullptr, rt_optix->maxDepth() == 1))
2515 sv->startOptixRaytracing(1);
2516 if (ImGui::MenuItem(
"2",
nullptr, rt_optix->maxDepth() == 2))
2517 sv->startOptixRaytracing(2);
2518 if (ImGui::MenuItem(
"3",
nullptr, rt_optix->maxDepth() == 3))
2519 sv->startOptixRaytracing(3);
2520 if (ImGui::MenuItem(
"5",
nullptr, rt_optix->maxDepth() == 5))
2521 sv->startOptixRaytracing(5);
2522 if (ImGui::MenuItem(
"Max. Contribution",
nullptr, rt_optix->maxDepth() == 0))
2523 sv->startOptixRaytracing(0);
2544 if (ImGui::MenuItem(
"Save Rendered Image"))
2545 rt_optix->saveImage();
2551 else if (rType ==
RT_pt)
2553 if (ImGui::BeginMenu(
"PT"))
2557 if (ImGui::BeginMenu(
"Resolution Factor"))
2578 if (ImGui::BeginMenu(
"NO. of Samples"))
2589 if (ImGui::MenuItem(
"Direct illumination",
nullptr, pt->
calcDirect()))
2595 if (ImGui::MenuItem(
"Indirect illumination",
nullptr, pt->
calcIndirect()))
2601 if (ImGui::MenuItem(
"Save Rendered Image"))
2604 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2606 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2611 ImGui::PopItemWidth();
2620 if (ImGui::BeginMenu(
"PT"))
2622 SLOptixPathtracer* pt =
sv->optixPathtracer();
2624 if (ImGui::BeginMenu(
"NO. of Samples"))
2626 if (ImGui::MenuItem(
"1",
nullptr, pt->samples() == 1))
2627 sv->startOptixPathtracing(5, 1);
2628 if (ImGui::MenuItem(
"10",
nullptr, pt->samples() == 10))
2629 sv->startOptixPathtracing(5, 10);
2630 if (ImGui::MenuItem(
"100",
nullptr, pt->samples() == 100))
2631 sv->startOptixPathtracing(5, 100);
2632 if (ImGui::MenuItem(
"1000",
nullptr, pt->samples() == 1000))
2633 sv->startOptixPathtracing(5, 1000);
2634 if (ImGui::MenuItem(
"10000",
nullptr, pt->samples() == 10000))
2635 sv->startOptixPathtracing(5, 10000);
2640 if (ImGui::MenuItem(
"Denoiser",
nullptr, pt->getDenoiserEnabled()))
2642 pt->setDenoiserEnabled(!pt->getDenoiserEnabled());
2643 sv->startOptixPathtracing(5, pt->samples());
2646 if (ImGui::MenuItem(
"Save Rendered Image"))
2654 if (ImGui::BeginMenu(
"Camera"))
2659 if (ImGui::MenuItem(
"Reset"))
2666 if (ImGui::BeginMenu(
"Look from"))
2677 if (ImGui::MenuItem(
"Next camera in Scene",
"TAB"))
2680 if (ImGui::MenuItem(
"Sceneview Camera",
"TAB"))
2687 if (ImGui::BeginMenu(
"Projection"))
2694 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2712 if (ImGui::BeginMenu(
"Stereo"))
2717 if (ImGui::MenuItem(pStr.c_str(),
nullptr, proj == (
SLProjType)p))
2725 if (ImGui::SliderFloat(
"Eye Sep.", &eyeSepar, 0.0f, focalDist / 10.f))
2734 if (ImGui::SliderFloat(
"FOV (V)", &fov, 1.f, 179.f))
2737 ImGui::Text(
"FOV (H): %3.1f ", cam->
fovH());
2739 if (ImGui::SliderFloat(
"Near Clip", &clipN, 0.001f, 10.f))
2742 if (ImGui::SliderFloat(
"Focal Dist.", &focalDist, clipN, clipF))
2745 if (ImGui::SliderFloat(
"Far Clip", &clipF, clipN, std::min(clipF * 1.1f, 1000000.f)))
2748 ImGui::PopItemWidth();
2752 if (ImGui::BeginMenu(
"Animation"))
2756 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2758 if (ImGui::MenuItem(
"Turntable Y up",
nullptr, ca ==
CA_turntableYUp))
2761 if (ImGui::MenuItem(
"Turntable Z up",
nullptr, ca ==
CA_turntableZUp))
2764 if (ImGui::MenuItem(
"Trackball",
nullptr, ca ==
CA_trackball))
2767 if (ImGui::MenuItem(
"Walk Y up",
nullptr, ca ==
CA_walkingYUp))
2770 if (ImGui::MenuItem(
"Walk Z up",
nullptr, ca ==
CA_walkingZUp))
2773 float mouseRotFactor =
sv->
camera()->mouseRotationFactor();
2774 if (ImGui::SliderFloat(
"Mouse Sensibility", &mouseRotFactor, 0.1f, 2.0f,
"%2.1f"))
2775 sv->
camera()->mouseRotationFactor(mouseRotFactor);
2788 if (ImGui::SliderFloat(
"Walk Speed", &ms, 0.01f, std::min(ms * 1.1f, 10000.f)))
2792 ImGui::PopItemWidth();
2796 if (ImGui::BeginMenu(
"Fog"))
2798 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2800 if (ImGui::MenuItem(
"Fog is on",
nullptr, cam->
fogIsOn()))
2803 if (ImGui::BeginMenu(
"Mode"))
2807 if (ImGui::MenuItem(
"exp",
nullptr, cam->
fogMode() ==
FM_exp))
2817 if (ImGui::SliderFloat(
"Density", &fogDensity, 0.0f, 0.2f))
2821 ImGui::PopItemWidth();
2828 if (ImGui::BeginMenu(
"Animation", hasAnimations))
2837 if (curAnimIx == -1) curAnimIx = 0;
2840 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.8f);
2841 if (
myComboBox(
"##", &curAnimIx, animations))
2843 ImGui::PopItemWidth();
2851 if (ImGui::MenuItem(
"Pause",
nullptr, anim->
isPaused()))
2854 if (ImGui::MenuItem(
"Stop",
nullptr, anim->
isStopped()))
2857 if (ImGui::MenuItem(
"Skip to next keyfr.",
nullptr,
false))
2860 if (ImGui::MenuItem(
"Skip to prev. keyfr.",
nullptr,
false))
2863 if (ImGui::MenuItem(
"Skip to start",
nullptr,
false))
2866 if (ImGui::MenuItem(
"Skip to end",
nullptr,
false))
2869 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.6f);
2872 if (ImGui::SliderFloat(
"Speed", &speed, 0.f, 4.f))
2877 if (ImGui::SliderFloat(
"Time", &localTimeSec, 0.f, lenSec))
2881 const char* easings[] = {
"linear",
2902 if (ImGui::Combo(
"Easing", &curEasing, easings, IM_ARRAYSIZE(easings)))
2905 ImGui::PopItemWidth();
2909 if (ImGui::BeginMenu(
"Infos"))
2913 if (ImGui::BeginMenu(
"Statistics"))
2920 ImGui::MenuItem(
"Stats on WAI",
nullptr, &
showStatsWAI);
2932 ImGui::MenuItem(
"UI-Preferences",
nullptr, &
showUIPrefs);
2940 ImGui::MenuItem(
"ErlebAR Settings",
nullptr, &
showErlebAR);
2943 ImGui::MenuItem(
"Help on Interaction",
nullptr, &
showHelp);
2946 ImGui::MenuItem(
"Credits",
nullptr, &
showCredits);
2947 ImGui::MenuItem(
"About SLProject",
nullptr, &
showAbout);
2952 ImGui::EndMainMenuBar();
2959 if (ImGui::MenuItem(
"Deselect Node",
"ESC"))
2988 if (ImGui::BeginMenu(
"Node Flags"))
3022 if (ImGui::MenuItem(
"All off"))
3034 if (!ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) &&
3035 ImGui::IsMouseReleased(1))
3037 ImGui::OpenPopup(
"Context Menu");
3040 if (ImGui::BeginPopup(
"Context Menu"))
3050 if (ImGui::MenuItem(
"Show Properties"))
3056 if (ImGui::MenuItem(
"Show user interface"))
3060 if (ImGui::MenuItem(
"Hide user interface"))
3064 if (ImGui::MenuItem(
"Show root node"))
3068 if (ImGui::MenuItem(
"Hide root node"))
3071 if (ImGui::MenuItem(
"Capture Screen"))
3085 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
3086 ImGui::Begin(
"Scenegraph", &
showSceneGraph, ImGuiWindowFlags_NoNavInputs);
3110 ImGuiTreeNodeFlags nodeFlags = 0;
3112 nodeFlags |= ImGuiTreeNodeFlags_Leaf;
3114 nodeFlags |= ImGuiTreeNodeFlags_OpenOnArrow;
3117 nodeFlags |= ImGuiTreeNodeFlags_Selected;
3121 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 1.0f, 1.0f));
3122 nodeIsOpen = ImGui::TreeNodeEx(node->
name().c_str(), nodeFlags);
3123 ImGui::PopStyleColor();
3127 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 0.0f, 1.0f));
3128 nodeIsOpen = ImGui::TreeNodeEx(node->
name().c_str(), nodeFlags);
3129 ImGui::PopStyleColor();
3132 if (ImGui::IsItemClicked())
3143 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
3145 ImGuiTreeNodeFlags meshFlags = ImGuiTreeNodeFlags_Leaf;
3147 meshFlags |= ImGuiTreeNodeFlags_Selected;
3149 ImGui::TreeNodeEx(mesh, meshFlags,
"%s", mesh->
name().c_str());
3151 if (ImGui::IsItemClicked())
3158 ImGui::PopStyleColor();
3161 for (
auto* child : node->
children())
3179 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
3180 ImGui::Begin(
"Properties", &
showProperties, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoNavInputs);
3181 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 1.0f, 1.0f));
3183 if (ImGui::TreeNode(
"Scene Properties"))
3187 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3189 if (ImGui::ColorEdit3(
"Global Ambient Color", (
float*)&gAC, cef))
3190 s->
lights()[0]->globalAmbient = gAC;
3193 if (ImGui::TreeNode(
"Sky",
"Skybox"))
3202 if (ImGui::SliderFloat(
"Exposure", &exposure, 0.05f, 5.0f))
3216 ImGui::Text(
"No properties for skyboxes that are not used for lighting (HDR)");
3221 ImGui::Text(
"Skybox: None");
3228 ImGui::PopStyleColor();
3235 if (singleNode && !partialSelection)
3237 if (ImGui::TreeNode(
"Node Properties"))
3243 ImGui::Text(
"Node name : %s", singleNode->
name().c_str());
3244 ImGui::Text(
"# children : %u", c);
3245 ImGui::Text(
"# meshes : %u", m);
3246 if (ImGui::TreeNode(
"Drawing flags"))
3249 if (ImGui::Checkbox(
"Hide", &db))
3253 if (ImGui::Checkbox(
"Not selectable", &db))
3257 if (ImGui::Checkbox(
"Show wireframe", &db))
3261 if (ImGui::Checkbox(
"Show with hard edges", &db))
3265 if (ImGui::Checkbox(
"Show only hard edges", &db))
3269 if (ImGui::Checkbox(
"Show normals", &db))
3273 if (ImGui::Checkbox(
"Show voxels", &db))
3277 if (ImGui::Checkbox(
"Show bounding boxes", &db))
3281 if (ImGui::Checkbox(
"Show bounding rects", &db))
3285 if (ImGui::Checkbox(
"Show axis", &db))
3289 if (ImGui::Checkbox(
"Show back faces", &db))
3295 if (ImGui::TreeNode(
"Local transform"))
3302 ImGui::Text(
"Translation : %s", trn.
toString().c_str());
3303 ImGui::Text(
"Rotation : %s", rot.
toString().c_str());
3304 ImGui::Text(
"Scaling : %s", scl.
toString().c_str());
3309 if (ImGui::TreeNode(
"Shadow mapping"))
3312 if (ImGui::Checkbox(
"Casts shadows", &castsShadows))
3315 if (
auto* light =
dynamic_cast<SLLight*
>(singleNode))
3317 SLbool createsShadows = light->createsShadows();
3318 if (ImGui::Checkbox(
"Creates shadows", &createsShadows))
3319 light->createsShadows(createsShadows);
3325 if (shadowMap !=
nullptr)
3328 light->spotCutOffDEG() < 90.0f)
3331 if (ImGui::Checkbox(
"Uses Cubemap", &useCubemap))
3341 if (ImGui::SliderFloat(
"Near clipping plane", &clipNear, 0.01f, clipFar))
3344 if (ImGui::SliderFloat(
"Far clipping plane", &clipFar, clipNear, 200.0f))
3351 if (ImGui::SliderInt(
"Number of cascades", &numCascades, 1, maxCascades))
3353 if (ImGui::SliderFloat(
"Cascades factor", &factor, 1.0, 500.0f))
3358 if (ImGui::SliderInt2(
"Texture resolution", (
int*)&texSize, 32, 4096))
3363 SLfloat shadowMinBias = light->shadowMinBias();
3364 SLfloat shadowMaxBias = light->shadowMaxBias();
3365 if (ImGui::SliderFloat(
"Min. shadow bias", &shadowMinBias, 0.0f, shadowMaxBias,
"%.03f"))
3366 light->shadowMinBias(shadowMinBias);
3367 if (ImGui::SliderFloat(
"Max. shadow bias", &shadowMaxBias, shadowMinBias, 0.02f,
"%.03f"))
3368 light->shadowMaxBias(shadowMaxBias);
3373 if (ImGui::InputFloat2(
"Size", (
float*)&size))
3374 shadowMap->
size(size);
3379 SLbool doSmoothShadows = light->doSoftShadows();
3380 if (ImGui::Checkbox(
"Do smooth shadows", &doSmoothShadows))
3381 light->doSmoothShadows(doSmoothShadows);
3383 SLuint pcfLevel = light->softShadowLevel();
3384 if (ImGui::SliderInt(
"Smoothing level", (
SLint*)&pcfLevel, 1, 3))
3385 light->smoothShadowLevel(pcfLevel);
3389 if (ImGui::Checkbox(
"Do colored shadows", &doColoredShadows))
3393 if (ImGui::InputInt2(
"Visualization rays", (
int*)&rayCount))
3399 if (ImGui::TreeNode(
"Light cascade space matrices"))
3409 if (ImGui::TreeNode(shadowMap->
useCubemap() ?
"Light space matrices" :
"Light space matrix"))
3412 for (
SLint i = 0; i < 6; ++i)
3425 for (
int i = 0; i < shadowMap->
depthBuffers().size(); i++)
3427 ImGui::Text((
"Depth Buffer " + std::to_string(i) +
":").c_str());
3428 ImGui::Image((
void*)(intptr_t)shadowMap->
depthBuffers().at(i)->texID(),
3434 ImGui::Text(
"Depth Buffer:");
3447 if (
typeid(*singleNode) ==
typeid(
SLCamera))
3451 if (ImGui::TreeNode(
"Camera"))
3453 SLfloat clipN = cam->clipNear();
3454 SLfloat clipF = cam->clipFar();
3455 SLfloat focalDist = cam->focalDist();
3458 const char* projections[] = {
"Mono Perspective",
3459 "Mono Intrinsic Calibrated",
3460 "Mono Orthographic",
3461 "Stereo Side By Side",
3462 "Stereo Side By Side Prop.",
3463 "Stereo Side By Side Dist.",
3464 "Stereo Line By Line",
3465 "Stereo Column By Column",
3466 "Stereo Pixel By Pixel",
3467 "Stereo Color Red-Cyan",
3468 "Stereo Color Red-Green",
3469 "Stereo Color Red-Blue",
3470 "Stereo Color Yellow-Blue"};
3472 int proj = cam->projType();
3473 if (ImGui::Combo(
"Projection", &proj, projections, IM_ARRAYSIZE(projections)))
3478 SLfloat eyeSepar = cam->stereoEyeSeparation();
3479 if (ImGui::SliderFloat(
"Eye Sep.", &eyeSepar, 0.0f, focalDist / 10.f))
3480 cam->stereoEyeSeparation(eyeSepar);
3483 if (ImGui::SliderFloat(
"FOV", &fov, 1.f, 179.f))
3486 if (ImGui::SliderFloat(
"Near Clip", &clipN, 0.001f, 10.f))
3487 cam->clipNear(clipN);
3489 if (ImGui::SliderFloat(
"Far Clip", &clipF, clipN, std::min(clipF * 1.1f, 1000000.f)))
3490 cam->clipFar(clipF);
3492 if (ImGui::SliderFloat(
"Focal Dist.", &focalDist, clipN, clipF))
3493 cam->focalDist(focalDist);
3506 SLbool doSunPowerAdaptation =
false;
3510 typeName =
"Light (spot):";
3515 typeName =
"Light (rectangular):";
3520 typeName =
"Light (directional):";
3521 doSunPowerAdaptation = ((
SLLightDirect*)singleNode)->doSunPowerAdaptation();
3524 if (light && ImGui::TreeNode(typeName.c_str()))
3527 if (ImGui::Checkbox(
"Is on", &on))
3530 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3532 if (ImGui::ColorEdit3(
"Ambient color", (
float*)&aC, cef))
3537 if (doSunPowerAdaptation)
3539 float sum_aPdP = aP + dP;
3540 float ambiFraction = aP / sum_aPdP;
3541 if (ImGui::SliderFloat(
"Diffuse-Ambient-Mix", &ambiFraction, 0.0f, 1.0f,
"%.2f"))
3550 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dC, cef))
3554 if (ImGui::ColorEdit3(
"Specular color", (
float*)&sC, cef))
3558 if (ImGui::SliderFloat(
"Ambient power", &aP, 0.0f, 10.0f,
"%.2f"))
3561 if (ImGui::SliderFloat(
"Diffuse power", &dP, 0.0f, 10.0f,
"%.2f"))
3565 if (ImGui::SliderFloat(
"Specular power", &sP, 0.0f, 10.0f,
"%.2f"))
3569 if (ImGui::SliderFloat(
"Spot cut off angle", &cutoff, 0.0f, 180.0f,
"%.2f"))
3573 if (ImGui::SliderFloat(
"Spot attenuation", &spotExp, 0.0f, 128.0f,
"%.2f"))
3576 float kc = light->
kc();
3577 if (ImGui::SliderFloat(
"Constant attenuation", &kc, 0.0f, 1.0f,
"%.2f"))
3580 float kl = light->
kl();
3581 if (ImGui::SliderFloat(
"Linear attenuation", &kl, 0.0f, 1.0f,
"%.2f"))
3584 float kq = light->
kq();
3585 if (ImGui::SliderFloat(
"Quadratic attenuation", &kq, 0.0f, 1.0f,
"%.2f"))
3591 if (ImGui::Checkbox(
"Do Sun Power Adaptation", &doSunPowerAdaptation))
3594 if (doSunPowerAdaptation)
3597 if (ImGui::TreeNode(
"Sun Color LUT"))
3605 ImGui::GetWindowWidth() - 4 * ImGui::GetTreeNodeToLabelSpacing() - 10;
3606 void* tid = (ImTextureID)(uintptr_t)lut->
texID();
3608 ImVec2(texW, texW * 0.15f),
3612 ImVec4(1, 1, 1, 1));
3622 ImGui::Text(
"No single node selected.");
3627 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
3633 if (ImGui::TreeNode(
"Mesh Properties"))
3636 SLuint t = (
SLuint)(!singleFullMesh->
I16.empty() ? singleFullMesh->
I16.size() / 3 : singleFullMesh->
I32.size() / 3);
3637 SLuint e = (
SLuint)(!singleFullMesh->
IE16.empty() ? singleFullMesh->
IE16.size() / 2 : singleFullMesh->
IE32.size() / 2);
3639 ImGui::Text(
"Mesh name : %s", singleFullMesh->
name().c_str());
3643 ImGui::Text(
"# vertices : %u", ps->
amount() * 4);
3644 ImGui::Text(
"# triangles : %u", ps->
amount() * 2);
3648 ImGui::Text(
"# vertices : %u", v);
3649 ImGui::Text(
"# triangles : %u", t);
3650 ImGui::Text(
"# hard edges : %u", e);
3652 ImGui::Text(
"Material Name: %s", m->
name().c_str());
3656 if (ImGui::TreeNode(
"Reflection Model: Blinn-Phong"))
3658 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3660 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3662 if (ImGui::ColorEdit3(
"Ambient color", (
float*)&ac, cef))
3666 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dc, cef))
3670 if (ImGui::ColorEdit3(
"Specular color", (
float*)&sc, cef))
3674 if (ImGui::ColorEdit3(
"Emissive color", (
float*)&ec, cef))
3678 if (ImGui::SliderFloat(
"Shininess", &shine, 0.0f, 1000.0f))
3682 if (ImGui::SliderFloat(
"kr", &kr, 0.0f, 1.0f))
3686 if (ImGui::SliderFloat(
"kt", &kt, 0.0f, 1.0f))
3690 if (ImGui::SliderFloat(
"kn", &kn, 1.0f, 2.5f))
3694 if (ImGui::Checkbox(
"Receives shadows", &receivesShadows))
3697 ImGui::PopItemWidth();
3703 if (ImGui::TreeNode(
"Reflection Model: Cook-Torrance"))
3707 ImGui::Text(
"Controlled by textures");
3711 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3713 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3715 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dc, cef))
3719 if (ImGui::SliderFloat(
"Roughness", &rough, 0.0f, 1.0f))
3723 if (ImGui::SliderFloat(
"Metalness", &metal, 0.0f, 1.0f))
3726 ImGui::PopItemWidth();
3733 if (ImGui::TreeNode(
"Particle System"))
3736 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3742 if (ImGui::Checkbox(
"Instanced draw", &drawInstanced))
3753 if (ImGui::Button(
"Resume"))
3758 if (ImGui::Button(
"Pause"))
3762 if (ImGui::Button(
"Reset"))
3765 if (ImGui::CollapsingHeader(
"Emission"))
3770 int amount = ps->
amount();
3771 if (ImGui::InputInt(
"Amount of particles", &amount))
3780 if (ImGui::CollapsingHeader(
"Time to live"))
3785 if (ImGui::InputFloat(
"Time to live (s)", &timeToLive))
3793 if (ImGui::Checkbox(
"Counter lag/gap", &doCounterGap))
3799 ImGui::TextWrapped(
"Need to be enable by default but can create flickering with few particles, recommend to disable if few particles with no velocity ");
3806 if (ImGui::Combo(
"Billboard Type",
3808 "Camera Billboard\0Vertical Billboard\0Horizontal Billboard\0"))
3812 if (item_current == 2)
3826 if (ImGui::Checkbox(
"Shape", &shape_group))
3833 if (ImGui::CollapsingHeader(
"Shape", &shape_group))
3837 if (ImGui::Combo(
"Shape type",
3839 "Sphere\0Box\0Cone\0Pyramid\0"))
3849 if (ImGui::InputFloat(
"Radius of the sphere", &radiusSphere))
3856 if (item_current ==
ST_Box)
3859 if (ImGui::InputFloat3(
"Scale box XYZ", vec3fScaleBox))
3861 ps->
shapeScale(vec3fScaleBox[0], vec3fScaleBox[1], vec3fScaleBox[2]);
3869 if (ImGui::InputFloat(
"Radius", &radius))
3876 if (ImGui::InputFloat(
"Angle", &angle))
3883 if (ImGui::InputFloat(
"Height", &height))
3893 if (ImGui::InputFloat(
"Half side", &halfSide))
3900 if (ImGui::InputFloat(
"Angle", &angle))
3907 if (ImGui::InputFloat(
"Height", &height))
3916 if (ImGui::Checkbox(
"Spawn surface", &shapeSurf))
3921 if (item_current == 2 || item_current == 3)
3924 if (ImGui::Checkbox(
"Spawn base volume", &shapeSpawnBase))
3933 ImGui::BeginDisabled();
3934 ImGui::LabelText(
"Condition",
"Need to have direction and speed enabled");
3935 if (item_current == 2 || item_current == 3)
3938 if (ImGui::Checkbox(
"Follow shape direction (Override direction)",
3946 else if (item_current == 0 || item_current == 1)
3949 if (ImGui::Checkbox(
"Inverse center direction (Override direction)", &shapeOverride))
3958 ImGui::EndDisabled();
3966 if (ImGui::Checkbox(
"Flipbook texture", &flipbookTex_group))
3974 if (ImGui::CollapsingHeader(
"Flipbook texture", &flipbookTex_group))
3978 if (ImGui::InputInt(
"Frame rate (num update by s)", &fR))
3989 if (ImGui::CollapsingHeader(
"Size"))
3994 float radiusW = ps->
radiusW();
3995 if (ImGui::InputFloat(
"Radius width", &radiusW))
4000 float radiusH = ps->
radiusH();
4001 if (ImGui::InputFloat(
"Radius height", &radiusH))
4006 float scale = ps->
scale();
4007 if (ImGui::InputFloat(
"Scale", &scale))
4015 if (ImGui::Checkbox(
"Size over lifetime", &doSizeOverLT_group))
4021 if (ImGui::CollapsingHeader(
"Size over lifetime", &doSizeOverLT_group))
4025 if (ImGui::Checkbox(
"Custom curve (Unchecked --> Linear function)2", &doSizeOverLTCurve_group))
4030 if (ImGui::CollapsingHeader(
"Bezier curve size", &doSizeOverLTCurve_group))
4035 if (ImGui::Bezier(
"easeInExpo", vSize, staEndSize))
4045 if (ImGui::CollapsingHeader(
"Movement"))
4051 if (ImGui::Checkbox(
"World space", &doWorldSpace))
4056 if (ImGui::Checkbox(
"Gravity", &doGravity))
4063 if (ImGui::CollapsingHeader(
"Gravity", &doGravity))
4067 if (ImGui::InputFloat3(
"Gravity XYZ", vec3Gravity))
4069 ps->
gravity(vec3Gravity[0], vec3Gravity[1], vec3Gravity[2]);
4077 if (ImGui::Checkbox(
"Acceleration", &acc_group))
4084 if (ImGui::CollapsingHeader(
"Acceleration", &acc_group))
4088 ImGui::BeginDisabled();
4090 if (ImGui::InputFloat(
"Accelaration constant", &accConst))
4096 ImGui::EndDisabled();
4098 if (ImGui::Checkbox(
"Direction vector", &accDiffDirection_group))
4104 if (ImGui::CollapsingHeader(
"Direction vector", &accDiffDirection_group))
4107 ImGui::InputFloat3(
"input float3", vec3fAcc);
4108 ps->
acceleration(vec3fAcc[0], vec3fAcc[1], vec3fAcc[2]);
4116 ImGui::BeginDisabled();
4117 if (ImGui::CollapsingHeader(
"Velocity"))
4121 if (ImGui::Combo(
"Velocity type", &item_current,
"Random axes\0Constant axes\0"))
4127 if (item_current == 0)
4130 if (ImGui::InputFloat3(
"Min. random XYZ", vec3fVstart))
4132 ps->
velocityRndMin(vec3fVstart[0], vec3fVstart[1], vec3fVstart[2]);
4137 if (ImGui::InputFloat3(
"Max. random XYZ", vec3fVend))
4144 else if (item_current == 1)
4147 if (ImGui::InputFloat3(
"Constant XYZ", vec3fVelocity))
4149 ps->
velocityConst(vec3fVelocity[0], vec3fVelocity[1], vec3fVelocity[2]);
4157 ImGui::EndDisabled();
4161 if (ImGui::Checkbox(
"Direction and Speed", &directionSpeed_group))
4168 if (ImGui::CollapsingHeader(
"Direction and Speed", &directionSpeed_group))
4172 if (ImGui::InputFloat3(
"Constant XYZ", vec3fDirection))
4174 ps->
direction(vec3fDirection[0], vec3fDirection[1], vec3fDirection[2]);
4180 if (ImGui::Combo(
"Speed value",
4182 "Constant\0Random between two constants\0"))
4184 if (item_current == 1)
4194 float speed = ps->
speed();
4195 if (ImGui::InputFloat(
"Constant", &speed))
4205 if (ImGui::InputFloat2(
"Random range Speed", vec2fRange))
4207 ps->
speedRange(vec2fRange[0], vec2fRange[1]);
4215 if (ImGui::Checkbox(
"Rotation", &rot_group))
4222 if (ImGui::CollapsingHeader(
"Rotation", &rot_group))
4226 if (ImGui::Combo(
"Angular velocity value", &item_current,
"Constant\0Random between two constants\0"))
4228 if (item_current == 1)
4239 if (ImGui::InputFloat(
"Constant", &angularVelocityConst))
4247 if (ImGui::InputFloat2(
"Random range A.V", vec2fRange))
4262 if (ImGui::CollapsingHeader(
"Color"))
4268 if (ImGui::Checkbox(
"Color", &color_group))
4273 if (ImGui::CollapsingHeader(
"Color", &color_group))
4278 if (ImGui::Checkbox(
"Glow/Bright (blending effect)", &color_bright))
4285 ImGui::BeginDisabled();
4286 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
4288 if (ImGui::ColorEdit4(
"Particle color", (
float*)&c, cef))
4291 ImGui::EndDisabled();
4296 if (ImGui::Checkbox(
"Color over lifetime", &doColorOverLT_group))
4303 if (ImGui::CollapsingHeader(
"Color over lifetime", &doColorOverLT_group))
4305 ImGui::Text(
"Edit gradient colors in the texture section.");
4312 if (ImGui::Checkbox(
"Alpha over lifetime", &doAlphaOverL_group))
4317 if (ImGui::CollapsingHeader(
"Alpha over lifetime", &doAlphaOverL_group))
4321 if (ImGui::Checkbox(
"Custom curve (Unchecked --> Linear function)", &doAlphaOverLCurve_group))
4326 if (ImGui::CollapsingHeader(
"Bezier curve alpha", &doAlphaOverLCurve_group))
4331 if (ImGui::Bezier(
"easeInExpo", vAlpha, staEndAlpha))
4341 ImGui::PopItemWidth();
4357 size_t numShaders = m->
program() ? m->
program()->shaders().size() : 0;
4360 if (numShaders > 0 && ImGui::TreeNode(
"Shd",
"Shaders (%d)", (
int)numShaders))
4364 for (
auto* shd : m->
program()->shaders())
4366 if (ImGui::TreeNode(shd->name().c_str()))
4368 SLchar* text =
new char[shd->code().length() + 1];
4369 strcpy(text, shd->code().c_str());
4370 ImGui::InputTextMultiline(shd->name().c_str(),
4372 shd->code().length() + 1,
4373 ImVec2(-1.0f, -1.0f));
4381 for (
auto* shd : m->
programTF()->shaders())
4383 if (ImGui::TreeNode(shd->name().c_str()))
4385 SLchar* text =
new char[shd->code().length() + 1];
4386 strcpy(text, shd->code().c_str());
4387 ImGui::InputTextMultiline(shd->name().c_str(),
4389 shd->code().length() + 1,
4390 ImVec2(-1.0f, -1.0f));
4405 ImGui::Text(
"No single single mesh selected.");
4408 ImGui::PopStyleColor();
4413 ImGui::Begin(
"Properties of Selection", &
showProperties, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoNavInputs);
4417 if (selectedNode->mesh())
4419 ImGui::Text(
"Node: %s", selectedNode->name().c_str());
4420 SLMesh* selectedMesh = selectedNode->mesh();
4422 if (!selectedMesh->
IS32.empty())
4424 ImGui::Text(
" Mesh: %s {%u v.}",
4425 selectedMesh->
name().c_str(),
4429 if (ImGui::Button(delBtn.c_str()))
4442 ImGui::Text(
"There is nothing selected.");
4444 ImGui::Text(
"Select a single node by");
4445 ImGui::Text(
"double-clicking it or");
4446 ImGui::Text(
"select multiple nodes by");
4447 ImGui::Text(
"SHIFT-double-clicking them.");
4449 ImGui::Text(
"Select partial meshes by");
4450 ImGui::Text(
"CTRL-LMB rectangle drawing.");
4452 ImGui::Text(
"Press ESC to deselect all.");
4454 ImGui::Text(
"Be aware that a node may be");
4455 ImGui::Text(
"flagged as not selectable.");
4460 ImGui::Text(
"Node selection and the");
4461 ImGui::Text(
"properties of it can only");
4462 ImGui::Text(
"be shown in the OpenGL");
4463 ImGui::Text(
"renderer.");
4474 SLfloat texW = ImGui::GetWindowWidth() - 4 * ImGui::GetTreeNodeToLabelSpacing() - 10;
4475 void* tid = (ImTextureID)(intptr_t)tex->
texID();
4480 if (ImGui::TreeNode(tex->
name().c_str()))
4483 for (
auto img : tex->
images())
4484 mbCPU += (
float)img->bytesPerImage();
4492 ImGui::Text(
"Size(PX): %dx%dx%d", tex->
width(), tex->
height(), tex->
depth());
4493 ImGui::Text(
"Size(MB): GPU:%4.2f, CPU:%4.2f, DSK:%4.2f", mbGPU, mbCPU, mbDSK);
4494 ImGui::Text(
"TexID : %u (%s)", tex->
texID(), tex->
isTexture() ?
"ok" :
"not ok");
4495 ImGui::Text(
"Type : %s", tex->
typeName().c_str());
4497 ImGui::Text(
"Format : %s", tex->
images()[0]->formatString().c_str());
4499 ImGui::Text(
"Format : %s",
"n/a (GPU only)");
4500 #ifdef SL_BUILD_WITH_KTX
4501 ImGui::Text(
"Compr. : %s", tex->compressionFormatStr(tex->compressionFormat()).c_str());
4506 if (tex->
target() == GL_TEXTURE_2D)
4511 if (ImGui::TreeNode(
"Color Points in Gradient"))
4517 if (ImGui::TreeNode(
"Alpha Points in Gradient"))
4521 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.25f);
4524 snprintf(label,
sizeof(label),
"Alpha %lu", a);
4525 if (ImGui::SliderFloat(label, &alpha, 0.0f, 1.0f,
"%3.2f"))
4527 lut->
alphas()[a].alpha = alpha;
4531 snprintf(label,
sizeof(label),
"Pos. %lu", a);
4533 if (a > 0 && a < lut->alphas().size() - 1)
4539 if (ImGui::SliderFloat(label, &pos, min, max,
"%3.2f"))
4541 lut->
alphas()[a].pos = pos;
4546 ImGui::Text(
"%3.2f Pos. %lu", pos, a);
4548 ImGui::PopItemWidth();
4555 ImVec2(texW, texW * 0.15f),
4559 ImVec4(1, 1, 1, 1));
4562 ImGui::PlotLines(
"",
4564 (
SLint)allAlpha.size(),
4569 ImVec2(texW, texW * 0.25f));
4574 ImVec2(texW, texW * h_to_w),
4578 ImVec4(1, 1, 1, 1));
4583 if (tex->
target() == GL_TEXTURE_CUBE_MAP)
4584 ImGui::Text(
"Cube maps can not be displayed.");
4585 else if (tex->
target() == GL_TEXTURE_3D)
4586 ImGui::Text(
"3D textures can not be displayed.");
4596 ImGuiStyle& style = ImGui::GetStyle();
4602 SL_LOG(
"No config file %s: ", fullPathAndFilename.c_str());
4605 SLfloat dpiScaleProp = (float)dotsPerInch / 142.0f;
4606 SLfloat dpiScaleFixed = (float)dotsPerInch / 142.0f;
4626 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = std::max(8.0f * dpiScaleFixed, 8.0f);
4627 style.FramePadding.y = style.ItemInnerSpacing.y = std::max(4.0f * dpiScaleFixed, 4.0f);
4628 style.WindowPadding.y = style.ItemSpacing.y * 3;
4629 style.ScrollbarSize = std::max(16.0f * dpiScaleFixed, 16.0f);
4632 if (style.ScrollbarSize < 0.0f)
4633 style.ScrollbarSize = 16.0f;
4635 style.ScrollbarRounding =
std::floor(style.ScrollbarSize / 2);
4642 CVFileStorage fs(configString, CVFileStorage::READ | CVFileStorage::MEMORY);
4652 fs[
"ItemSpacingX"] >> i; style.ItemSpacing.x = (
SLfloat) i;
4653 fs[
"ItemSpacingY"] >> i; style.ItemSpacing.y = (
SLfloat) i;
4654 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = style.ItemSpacing.x;
4655 style.FramePadding.y = style.ItemInnerSpacing.y = style.ItemSpacing.y;
4656 style.WindowPadding.y = style.ItemSpacing.y * 3;
4657 fs[
"ScrollbarSize"] >> i; style.ScrollbarSize = (
SLfloat) i;
4659 if (style.ScrollbarSize < 0.0f)
4660 style.ScrollbarSize = 16.0f;
4662 fs[
"ScrollbarRounding"] >> i; style.ScrollbarRounding = (
SLfloat) i;
4681 SL_LOG(
"Config. loaded : %s", fullPathAndFilename.c_str());
4688 SL_LOG(
"****** Failed to open file for reading: %s", fullPathAndFilename.c_str());
4693 SL_LOG(
"****** Parsing of file failed: %s", fullPathAndFilename.c_str());
4697 if (dotsPerInch > 300)
4703 SLfloat dpiScaleProp = (float)dotsPerInch / 120.0f;
4704 SLfloat dpiScaleFixed = (float)dotsPerInch / 142.0f;
4713 #ifdef SL_EMSCRIPTEN
4716 int sceneId = EM_ASM_INT(
4717 let params =
new URL(
window.location).searchParams;
4718 return params.get(
"scene") ?? -1;
4730 ImGuiStyle& style = ImGui::GetStyle();
4735 SL_LOG(
"New config file will be written: %s",
4736 fullPathAndFilename.c_str());
4739 CVFileStorage::WRITE | CVFileStorage::MEMORY);
4743 SL_LOG(
"Failed to open file for writing: %s",
4744 fullPathAndFilename.c_str());
4756 fs <<
"ItemSpacingX" << (
SLint)style.ItemSpacing.x;
4757 fs <<
"ItemSpacingY" << (
SLint)style.ItemSpacing.y;
4758 fs <<
"ScrollbarSize" << (
SLfloat)style.ScrollbarSize;
4759 fs <<
"ScrollbarRounding" << (
SLfloat)style.ScrollbarRounding;
4775 std::string configString = fs.releaseAndGetString();
4779 SL_LOG(
"Config. saved : %s", fullPathAndFilename.c_str());
4824 assert(
s->
assetManager() &&
"No asset manager assigned to scene!");
4845 s->
root2D()->addChild(horizonNode);
4859 s->
root2D()->deleteChild(horizonNode);
4868 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
4873 snprintf(label,
sizeof(label),
"Color %lu", c);
4874 if (ImGui::ColorEdit3(label, (
float*)&color, cef))
4876 lut->
colors()[c].color = color;
4880 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
4881 snprintf(label,
sizeof(label),
"Pos. %lu", c);
4883 if (c > 0 && c < lut->colors().size() - 1)
4887 if (ImGui::SliderFloat(label, &pos, min, max,
"%3.2f"))
4889 lut->
colors()[c].pos = pos;
4894 ImGui::Text(
"%3.2f Pos. %lu", pos, c);
4895 ImGui::PopItemWidth();
4901 string downloadFilename,
4902 string filenameToLoad,
4905 SLstring pathSrc =
"https://pallas.ti.bfh.ch/data/SLProject/models/";
4908 #ifndef SL_EMSCRIPTEN
4921 string downloadFilename,
4924 string pathAndFileToLoad,
4927 #ifndef SL_EMSCRIPTEN
4928 assert(
s->
assetManager() &&
"No asset manager assigned to scene!");
4931 auto progressCallback = [](
size_t curr,
size_t filesize)
4935 int transferredPC = (int)((
float)curr / (float)filesize * 100.0f);
4939 cout <<
"Bytes transferred: " << curr << endl;
4944 auto downloadJobHTTP = [=]()
4947 string jobMsg =
"Downloading file via HTTPS: " + downloadFilename;
4950 string fileToDownload = urlFolder + downloadFilename;
4951 if (HttpUtils::download(fileToDownload, dstFolder, progressCallback) != 0)
4953 SL_LOG(
"*** Nothing downloaded from: %s ***", fileToDownload.c_str());
4954 SL_LOG(
"*** PLEASE RETRY DOWNLOAD ***", fileToDownload.c_str());
4959 auto unzipJob = [=]()
4961 string jobMsg =
"Decompressing file: " + downloadFilename;
4964 string zipFile = dstFolder + downloadFilename;
4968 if (extension ==
"zip")
4975 SL_LOG(
"*** File do decompress doesn't exist: %s ***",
4980 auto followUpJob1 = [=]()
4985 SL_LOG(
"*** File do load doesn't exist: %s ***",
4986 pathAndFileToLoad.c_str());
5002 #if !defined(SL_OS_MACIOS) && !defined(SL_OS_ANDROID)
5007 SLVec3f camToLookAt = pos_f - lookAtPoint;
5009 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.