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(
"Biel Campus Biel/Bienne",
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(
"Augst-Theatre-Temple",
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-Amphitheatre",
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))
1386 ImGui::Begin(
"Avenche-Cigognier",
1388 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1390 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1392 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1397 bool namedLocIsActive = namedLocIndex == i;
1398 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1405 ImGui::Begin(
"Avenche-Theatre",
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))
1425 ImGui::Begin(
"Sutz-Kirchrain18",
1427 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoNavInputs);
1429 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID)
1431 if (ImGui::Checkbox(
"Use GPS Location", &devLocIsUsed))
1436 bool namedLocIsActive = namedLocIndex == i;
1437 if (ImGui::Checkbox(
AppCommon::devLoc.nameLocations()[i].name.c_str(), &namedLocIsActive))
1455 #ifndef SL_EMSCRIPTEN
1460 if (!strF.empty() && !strW.empty() && !strH.empty())
1462 float devF = strF.empty() ? 0.0f : stof(strF);
1463 float devW = strW.empty() ? 0.0f : stof(strW);
1464 float devH = strH.empty() ? 0.0f : stof(strH);
1512 static SLint curAnimIx = -1;
1513 if (!hasAnimations) curAnimIx = -1;
1519 if (ImGui::BeginMainMenuBar())
1521 if (ImGui::BeginMenu(
"File"))
1523 if (ImGui::BeginMenu(
"Load Test Scene"))
1525 if (ImGui::BeginMenu(
"General"))
1527 if (ImGui::MenuItem(
"Minimal Scene",
nullptr, sid ==
SID_Minimal))
1529 if (ImGui::MenuItem(
"Figure Scene",
nullptr, sid ==
SID_Figure))
1531 if (ImGui::MenuItem(
"Mesh Loader",
nullptr, sid ==
SID_MeshLoad))
1533 if (ImGui::MenuItem(
"Revolver Meshes",
nullptr, sid ==
SID_Revolver))
1539 #ifdef SL_BUILD_WITH_KTX
1543 if (ImGui::MenuItem(
"Frustum Culling",
nullptr, sid ==
SID_FrustumCull))
1545 if (ImGui::MenuItem(
"2D and 3D Text",
nullptr, sid ==
SID_2Dand3DText))
1549 if (ImGui::MenuItem(
"Z-Fighting",
nullptr, sid ==
SID_ZFighting))
1555 if (ImGui::BeginMenu(
"Shader"))
1563 if (ImGui::MenuItem(
"Image Based Lighting",
nullptr, sid ==
SID_ShaderIBL))
1565 if (ImGui::MenuItem(
"Per Vertex Wave",
nullptr, sid ==
SID_ShaderWave))
1578 if (ImGui::BeginMenu(
"Shadow Mapping"))
1598 if (ImGui::BeginMenu(
"Suzanne Lighting"))
1633 if (ImGui::BeginMenu(
"glTF Sample Models"))
1641 if (ImGui::MenuItem(
"Sponza Palace",
nullptr, sid ==
SID_glTF_Sponza))
1649 if (ImGui::BeginMenu(
"Robotics"))
1659 if (ImGui::BeginMenu(
"Volume Rendering"))
1722 if (ImGui::BeginMenu(
"Animation"))
1738 if (ImGui::BeginMenu(
"Video"))
1742 #ifndef SL_EMSCRIPTEN
1756 #ifndef SL_EMSCRIPTEN
1762 #ifdef SL_BUILD_WITH_MEDIAPIPE
1775 if (ImGui::BeginMenu(
"Ray Tracing"))
1777 if (ImGui::MenuItem(
"Spheres",
nullptr, sid ==
SID_RTSpheres))
1783 if (ImGui::MenuItem(
"Depth of Field",
nullptr, sid ==
SID_RTDoF))
1785 if (ImGui::MenuItem(
"Lens Test",
nullptr, sid ==
SID_RTLens))
1791 if (ImGui::BeginMenu(
"Path Tracing"))
1799 if (ImGui::BeginMenu(
"Particle Systems"))
1823 SLstring modelBR2 = erlebarPath +
"bern/bern-christoffel.gltf";
1824 SLstring modelBFH = erlebarPath +
"biel/Biel-BFH-Rolex.gltf";
1825 SLstring modelCBB = erlebarPath +
"biel/Biel-CBB-AR.gltf";
1826 SLstring modelAR1 = erlebarPath +
"augst/augst-thtL1-tmpL2.gltf";
1827 SLstring modelAR2 = erlebarPath +
"augst/augst-thtL2-tmpL1.gltf";
1828 SLstring modelAR3 = erlebarPath +
"augst/augst-thtL1L2-tmpL1L2.gltf";
1829 SLstring modelAV1_AO = erlebarPath +
"avenches/avenches-amphitheater.gltf";
1830 SLstring modelAV2_AO = erlebarPath +
"avenches/avenches-cigognier.gltf";
1831 SLstring modelAV3 = erlebarPath +
"avenches/avenches-theater.gltf";
1832 SLstring modelSU1 = erlebarPath +
"sutz/Sutz-Kirchrain18.gltf";
1842 if (ImGui::BeginMenu(
"Erleb-AR"))
1880 if (ImGui::BeginMenu(
"Benchmarks"))
1882 #ifndef SL_EMSCRIPTEN
1987 if (ImGui::MenuItem(
"Empty Scene",
"Shift-Alt-0", sid ==
SID_Empty))
1990 if (ImGui::MenuItem(
"Next Scene",
1996 if (ImGui::MenuItem(
"Previous Scene",
2002 #ifndef SL_EMSCRIPTEN
2005 if (ImGui::MenuItem(
"Multi-threaded Jobs"))
2012 uint maxIter = 100000;
2015 for (uint i = 0; i < maxIter; ++i)
2018 int progressPC = (int)((
float)i / (float)maxIter * 100.0f);
2029 uint maxIter = 100000;
2032 for (uint i = 0; i < maxIter; ++i)
2035 int progressPC = (int)((
float)i / (float)maxIter * 100.0f);
2041 auto followUpJob1 = []()
2042 {
SL_LOG(
"followUpJob1"); };
2043 auto jobToFollow2 = []()
2044 {
SL_LOG(
"JobToFollow2"); };
2053 #if !defined(SL_OS_ANDROID) && !defined(SL_EMSCRIPTEN)
2056 if (ImGui::MenuItem(
"Quit & Save"))
2063 if (ImGui::BeginMenu(
"Preferences"))
2077 if (ImGui::MenuItem(
"Do Depth Test",
"T",
sv->
doDepthTest()))
2085 if (ImGui::BeginMenu(
"Viewport Aspect"))
2093 SLchar strSameAsVideo[256];
2094 snprintf(strSameAsVideo,
sizeof(strSameAsVideo),
"Same as Video (%d:%d)", videoAspect.
x, videoAspect.
y);
2124 #if defined(SL_OS_ANDROID) || defined(SL_OS_MACIOS)
2125 if (ImGui::BeginMenu(
"Rotation Sensor"))
2129 if (ImGui::MenuItem(
"Use Device Rotation (IMU)",
nullptr, devRot.
isUsed()))
2135 if (ImGui::SliderInt(
"Average length", &numAveraged, 1, 10))
2138 if (ImGui::BeginMenu(
"Offset Mode"))
2141 if (ImGui::MenuItem(
"None",
nullptr, om ==
ROM_none))
2143 if (ImGui::MenuItem(
"Finger rot. X",
nullptr, om ==
ROM_oneFingerX))
2145 if (ImGui::MenuItem(
"Finger rot. X and Y",
nullptr, om ==
ROM_oneFingerXY))
2151 if (ImGui::MenuItem(
"Zero Yaw at Start",
nullptr, devRot.
zeroYawAtStart()))
2154 if (ImGui::MenuItem(
"Reset Zero Yaw"))
2169 if (ImGui::BeginMenu(
"Location Sensor"))
2173 if (ImGui::MenuItem(
"Use Device Location (GPS)",
nullptr,
AppCommon::devLoc.isUsed()))
2177 if (ImGui::MenuItem(
"Use Origin Altitude",
nullptr,
AppCommon::devLoc.useOriginAltitude()))
2180 if (ImGui::MenuItem(
"Reset Origin to here"))
2183 if (ImGui::BeginMenu(
"Offset Mode"))
2186 if (ImGui::MenuItem(
"None",
nullptr, om ==
LOM_none))
2188 if (ImGui::MenuItem(
"Two Finger Y",
nullptr, om ==
LOM_twoFingerY))
2198 if (ImGui::BeginMenu(
"Video Sensor"))
2201 if (ImGui::BeginMenu(
"Mirror Camera"))
2203 if (ImGui::MenuItem(
"Horizontally",
nullptr, ac->
mirrorH()))
2210 if (ImGui::MenuItem(
"Vertically",
nullptr, ac->
mirrorV()))
2220 if (ImGui::BeginMenu(
"Resolution",
2224 for (
int i = 0; i < (int)capture->
camSizes.size(); ++i)
2231 capture->
camSizes[(uint)i].height);
2239 #ifndef SL_EMSCRIPTEN
2240 if (ImGui::BeginMenu(
"Calibration"))
2242 if (ImGui::MenuItem(
"Start Calibration (Main Camera)"))
2249 if (ImGui::MenuItem(
"Start Calibration (Scnd. Camera)",
nullptr,
false, capture->
hasSecondaryCamera))
2288 if (ImGui::BeginMenu(
"Feature Tracking", featureTracker !=
nullptr) && featureTracker !=
nullptr)
2290 if (ImGui::MenuItem(
"Force Relocation",
nullptr, featureTracker->
forceRelocation()))
2293 if (ImGui::BeginMenu(
"Detector/Descriptor", featureTracker !=
nullptr))
2297 if (ImGui::MenuItem(
"RAUL/RAUL",
nullptr, type ==
DDT_RAUL_RAUL))
2299 if (ImGui::MenuItem(
"ORB/ORB",
nullptr, type ==
DDT_ORB_ORB))
2301 if (ImGui::MenuItem(
"FAST/BRIEF",
nullptr, type ==
DDT_FAST_BRIEF))
2303 if (ImGui::MenuItem(
"SURF/SURF",
nullptr, type ==
DDT_SURF_SURF))
2305 if (ImGui::MenuItem(
"SIFT/SIFT",
nullptr, type ==
DDT_SIFT_SIFT))
2320 ImGui::MenuItem(
"UI Preferences",
nullptr, &
showUIPrefs);
2333 if (ImGui::MenuItem(
"Clear selection"))
2335 sv->
camera()->selectRect().setZero();
2336 sv->
camera()->deselectRect().setZero();
2343 if (ImGui::BeginMenu(
"Renderer"))
2345 if (ImGui::MenuItem(
"OpenGL",
"ESC", rType ==
RT_gl))
2348 if (ImGui::MenuItem(
"Ray Tracing",
"R", rType ==
RT_rt))
2351 if (ImGui::MenuItem(
"Path Tracing",
"P", rType ==
RT_pt))
2355 if (ImGui::MenuItem(
"Ray Tracing with OptiX",
"Shift-R", rType ==
RT_optix_rt))
2356 sv->startOptixRaytracing(5);
2358 if (ImGui::MenuItem(
"Path Tracing with OptiX",
"Shift-P", rType ==
RT_optix_pt))
2359 sv->startOptixPathtracing(5, 10);
2361 ImGui::MenuItem(
"Ray Tracing with OptiX",
nullptr,
false,
false);
2362 ImGui::MenuItem(
"Path Tracing with OptiX",
nullptr,
false,
false);
2369 if (ImGui::BeginMenu(
"GL"))
2404 if (ImGui::MenuItem(
"All off"))
2407 if (ImGui::MenuItem(
"All on"))
2421 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2423 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2425 ImGui::PopItemWidth();
2430 else if (rType ==
RT_rt)
2432 if (ImGui::BeginMenu(
"RT"))
2436 if (ImGui::BeginMenu(
"Resolution Factor"))
2457 if (ImGui::MenuItem(
"Parallel distributed",
nullptr, rt->
doDistributed()))
2463 if (ImGui::MenuItem(
"Continuously",
nullptr, rt->
doContinuous()))
2469 if (ImGui::MenuItem(
"Fresnel Reflection",
nullptr, rt->
doFresnel()))
2475 if (ImGui::BeginMenu(
"Max. Depth"))
2486 if (ImGui::BeginMenu(
"Anti-Aliasing Samples"))
2497 if (ImGui::MenuItem(
"Save Rendered Image"))
2500 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2502 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2507 ImGui::PopItemWidth();
2516 if (ImGui::BeginMenu(
"RT"))
2518 SLOptixRaytracer* rt_optix =
sv->optixRaytracer();
2520 if (ImGui::MenuItem(
"Parallel distributed",
nullptr, rt_optix->doDistributed()))
2522 rt_optix->doDistributed(!rt_optix->doDistributed());
2523 sv->startOptixRaytracing(rt_optix->maxDepth());
2532 if (ImGui::BeginMenu(
"Max. Depth"))
2534 if (ImGui::MenuItem(
"1",
nullptr, rt_optix->maxDepth() == 1))
2535 sv->startOptixRaytracing(1);
2536 if (ImGui::MenuItem(
"2",
nullptr, rt_optix->maxDepth() == 2))
2537 sv->startOptixRaytracing(2);
2538 if (ImGui::MenuItem(
"3",
nullptr, rt_optix->maxDepth() == 3))
2539 sv->startOptixRaytracing(3);
2540 if (ImGui::MenuItem(
"5",
nullptr, rt_optix->maxDepth() == 5))
2541 sv->startOptixRaytracing(5);
2542 if (ImGui::MenuItem(
"Max. Contribution",
nullptr, rt_optix->maxDepth() == 0))
2543 sv->startOptixRaytracing(0);
2564 if (ImGui::MenuItem(
"Save Rendered Image"))
2565 rt_optix->saveImage();
2571 else if (rType ==
RT_pt)
2573 if (ImGui::BeginMenu(
"PT"))
2577 if (ImGui::BeginMenu(
"Resolution Factor"))
2598 if (ImGui::BeginMenu(
"NO. of Samples"))
2609 if (ImGui::MenuItem(
"Direct illumination",
nullptr, pt->
calcDirect()))
2615 if (ImGui::MenuItem(
"Indirect illumination",
nullptr, pt->
calcIndirect()))
2621 if (ImGui::MenuItem(
"Save Rendered Image"))
2624 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f);
2626 if (ImGui::SliderFloat(
"Gamma", &gamma, 0.1f, 3.0f,
"%.1f"))
2631 ImGui::PopItemWidth();
2640 if (ImGui::BeginMenu(
"PT"))
2642 SLOptixPathtracer* pt =
sv->optixPathtracer();
2644 if (ImGui::BeginMenu(
"NO. of Samples"))
2646 if (ImGui::MenuItem(
"1",
nullptr, pt->samples() == 1))
2647 sv->startOptixPathtracing(5, 1);
2648 if (ImGui::MenuItem(
"10",
nullptr, pt->samples() == 10))
2649 sv->startOptixPathtracing(5, 10);
2650 if (ImGui::MenuItem(
"100",
nullptr, pt->samples() == 100))
2651 sv->startOptixPathtracing(5, 100);
2652 if (ImGui::MenuItem(
"1000",
nullptr, pt->samples() == 1000))
2653 sv->startOptixPathtracing(5, 1000);
2654 if (ImGui::MenuItem(
"10000",
nullptr, pt->samples() == 10000))
2655 sv->startOptixPathtracing(5, 10000);
2660 if (ImGui::MenuItem(
"Denoiser",
nullptr, pt->getDenoiserEnabled()))
2662 pt->setDenoiserEnabled(!pt->getDenoiserEnabled());
2663 sv->startOptixPathtracing(5, pt->samples());
2666 if (ImGui::MenuItem(
"Save Rendered Image"))
2674 if (ImGui::BeginMenu(
"Camera"))
2679 if (ImGui::MenuItem(
"Reset"))
2686 if (ImGui::BeginMenu(
"Look from"))
2697 if (ImGui::MenuItem(
"Next camera in Scene",
"TAB"))
2700 if (ImGui::MenuItem(
"Sceneview Camera",
"TAB"))
2707 if (ImGui::BeginMenu(
"Projection"))
2714 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2732 if (ImGui::BeginMenu(
"Stereo"))
2737 if (ImGui::MenuItem(pStr.c_str(),
nullptr, proj == (
SLProjType)p))
2745 if (ImGui::SliderFloat(
"Eye Sep.", &eyeSepar, 0.0f, focalDist / 10.f))
2754 if (ImGui::SliderFloat(
"FOV (V)", &fov, 1.f, 179.f))
2757 ImGui::Text(
"FOV (H): %3.1f ", cam->
fovH());
2759 if (ImGui::SliderFloat(
"Near Clip", &clipN, 0.001f, 10.f))
2762 if (ImGui::SliderFloat(
"Focal Dist.", &focalDist, clipN, clipF))
2765 if (ImGui::SliderFloat(
"Far Clip", &clipF, clipN, std::min(clipF * 1.1f, 1000000.f)))
2768 ImGui::PopItemWidth();
2772 if (ImGui::BeginMenu(
"Animation"))
2776 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2778 if (ImGui::MenuItem(
"Turntable Y up",
nullptr, ca ==
CA_turntableYUp))
2781 if (ImGui::MenuItem(
"Turntable Z up",
nullptr, ca ==
CA_turntableZUp))
2784 if (ImGui::MenuItem(
"Trackball",
nullptr, ca ==
CA_trackball))
2787 if (ImGui::MenuItem(
"Walk Y up",
nullptr, ca ==
CA_walkingYUp))
2790 if (ImGui::MenuItem(
"Walk Z up",
nullptr, ca ==
CA_walkingZUp))
2793 float mouseRotFactor =
sv->
camera()->mouseRotationFactor();
2794 if (ImGui::SliderFloat(
"Mouse Sensibility", &mouseRotFactor, 0.1f, 2.0f,
"%2.1f"))
2795 sv->
camera()->mouseRotationFactor(mouseRotFactor);
2808 if (ImGui::SliderFloat(
"Walk Speed", &ms, 0.01f, std::min(ms * 1.1f, 10000.f)))
2812 ImGui::PopItemWidth();
2816 if (ImGui::BeginMenu(
"Fog"))
2818 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.66f);
2820 if (ImGui::MenuItem(
"Fog is on",
nullptr, cam->
fogIsOn()))
2823 if (ImGui::BeginMenu(
"Mode"))
2827 if (ImGui::MenuItem(
"exp",
nullptr, cam->
fogMode() ==
FM_exp))
2837 if (ImGui::SliderFloat(
"Density", &fogDensity, 0.0f, 0.2f))
2841 ImGui::PopItemWidth();
2848 if (ImGui::BeginMenu(
"Animation", hasAnimations))
2857 if (curAnimIx == -1) curAnimIx = 0;
2860 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.8f);
2861 if (
myComboBox(
"##", &curAnimIx, animations))
2863 ImGui::PopItemWidth();
2871 if (ImGui::MenuItem(
"Pause",
nullptr, anim->
isPaused()))
2874 if (ImGui::MenuItem(
"Stop",
nullptr, anim->
isStopped()))
2877 if (ImGui::MenuItem(
"Skip to next keyfr.",
nullptr,
false))
2880 if (ImGui::MenuItem(
"Skip to prev. keyfr.",
nullptr,
false))
2883 if (ImGui::MenuItem(
"Skip to start",
nullptr,
false))
2886 if (ImGui::MenuItem(
"Skip to end",
nullptr,
false))
2889 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.6f);
2892 if (ImGui::SliderFloat(
"Speed", &speed, 0.f, 4.f))
2897 if (ImGui::SliderFloat(
"Time", &localTimeSec, 0.f, lenSec))
2901 const char* easings[] = {
"linear",
2922 if (ImGui::Combo(
"Easing", &curEasing, easings, IM_ARRAYSIZE(easings)))
2925 ImGui::PopItemWidth();
2929 if (ImGui::BeginMenu(
"Infos"))
2933 if (ImGui::BeginMenu(
"Statistics"))
2940 ImGui::MenuItem(
"Stats on WAI",
nullptr, &
showStatsWAI);
2952 ImGui::MenuItem(
"UI-Preferences",
nullptr, &
showUIPrefs);
2960 ImGui::MenuItem(
"ErlebAR Settings",
nullptr, &
showErlebAR);
2963 ImGui::MenuItem(
"Help on Interaction",
nullptr, &
showHelp);
2966 ImGui::MenuItem(
"Credits",
nullptr, &
showCredits);
2967 ImGui::MenuItem(
"About SLProject",
nullptr, &
showAbout);
2972 ImGui::EndMainMenuBar();
2979 if (ImGui::MenuItem(
"Deselect Node",
"ESC"))
3008 if (ImGui::BeginMenu(
"Node Flags"))
3042 if (ImGui::MenuItem(
"All off"))
3054 if (!ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) &&
3055 ImGui::IsMouseReleased(1))
3057 ImGui::OpenPopup(
"Context Menu");
3060 if (ImGui::BeginPopup(
"Context Menu"))
3070 if (ImGui::MenuItem(
"Show Properties"))
3076 if (ImGui::MenuItem(
"Show user interface"))
3080 if (ImGui::MenuItem(
"Hide user interface"))
3084 if (ImGui::MenuItem(
"Show root node"))
3088 if (ImGui::MenuItem(
"Hide root node"))
3091 if (ImGui::MenuItem(
"Capture Screen"))
3105 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
3106 ImGui::Begin(
"Scenegraph", &
showSceneGraph, ImGuiWindowFlags_NoNavInputs);
3130 ImGuiTreeNodeFlags nodeFlags = 0;
3132 nodeFlags |= ImGuiTreeNodeFlags_Leaf;
3134 nodeFlags |= ImGuiTreeNodeFlags_OpenOnArrow;
3137 nodeFlags |= ImGuiTreeNodeFlags_Selected;
3141 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 1.0f, 1.0f));
3142 nodeIsOpen = ImGui::TreeNodeEx(node->
name().c_str(), nodeFlags);
3143 ImGui::PopStyleColor();
3147 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 0.0f, 1.0f));
3148 nodeIsOpen = ImGui::TreeNodeEx(node->
name().c_str(), nodeFlags);
3149 ImGui::PopStyleColor();
3152 if (ImGui::IsItemClicked())
3163 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
3165 ImGuiTreeNodeFlags meshFlags = ImGuiTreeNodeFlags_Leaf;
3167 meshFlags |= ImGuiTreeNodeFlags_Selected;
3169 ImGui::TreeNodeEx(mesh, meshFlags,
"%s", mesh->
name().c_str());
3171 if (ImGui::IsItemClicked())
3178 ImGui::PopStyleColor();
3181 for (
auto* child : node->
children())
3199 ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
3200 ImGui::Begin(
"Properties", &
showProperties, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoNavInputs);
3201 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 1.0f, 1.0f));
3203 if (ImGui::TreeNode(
"Scene Properties"))
3207 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3209 if (ImGui::ColorEdit3(
"Global Ambient Color", (
float*)&gAC, cef))
3210 s->
lights()[0]->globalAmbient = gAC;
3213 if (ImGui::TreeNode(
"Sky",
"Skybox"))
3222 if (ImGui::SliderFloat(
"Exposure", &exposure, 0.05f, 5.0f))
3236 ImGui::Text(
"No properties for skyboxes that are not used for lighting (HDR)");
3241 ImGui::Text(
"Skybox: None");
3248 ImGui::PopStyleColor();
3255 if (singleNode && !partialSelection)
3257 if (ImGui::TreeNode(
"Node Properties"))
3263 ImGui::Text(
"Node name : %s", singleNode->
name().c_str());
3264 ImGui::Text(
"# children : %u", c);
3265 ImGui::Text(
"# meshes : %u", m);
3266 if (ImGui::TreeNode(
"Drawing flags"))
3269 if (ImGui::Checkbox(
"Hide", &db))
3273 if (ImGui::Checkbox(
"Not selectable", &db))
3277 if (ImGui::Checkbox(
"Show wireframe", &db))
3281 if (ImGui::Checkbox(
"Show with hard edges", &db))
3285 if (ImGui::Checkbox(
"Show only hard edges", &db))
3289 if (ImGui::Checkbox(
"Show normals", &db))
3293 if (ImGui::Checkbox(
"Show voxels", &db))
3297 if (ImGui::Checkbox(
"Show bounding boxes", &db))
3301 if (ImGui::Checkbox(
"Show bounding rects", &db))
3305 if (ImGui::Checkbox(
"Show axis", &db))
3309 if (ImGui::Checkbox(
"Show back faces", &db))
3315 if (ImGui::TreeNode(
"Local transform"))
3322 ImGui::Text(
"Translation : %s", trn.
toString().c_str());
3323 ImGui::Text(
"Rotation : %s", rot.
toString().c_str());
3324 ImGui::Text(
"Scaling : %s", scl.
toString().c_str());
3329 if (ImGui::TreeNode(
"Shadow mapping"))
3332 if (ImGui::Checkbox(
"Casts shadows", &castsShadows))
3335 if (
auto* light =
dynamic_cast<SLLight*
>(singleNode))
3337 SLbool createsShadows = light->createsShadows();
3338 if (ImGui::Checkbox(
"Creates shadows", &createsShadows))
3339 light->createsShadows(createsShadows);
3345 if (shadowMap !=
nullptr)
3348 light->spotCutOffDEG() < 90.0f)
3351 if (ImGui::Checkbox(
"Uses Cubemap", &useCubemap))
3361 if (ImGui::SliderFloat(
"Near clipping plane", &clipNear, 0.01f, clipFar))
3364 if (ImGui::SliderFloat(
"Far clipping plane", &clipFar, clipNear, 200.0f))
3371 if (ImGui::SliderInt(
"Number of cascades", &numCascades, 1, maxCascades))
3373 if (ImGui::SliderFloat(
"Cascades factor", &factor, 1.0, 500.0f))
3378 if (ImGui::SliderInt2(
"Texture resolution", (
int*)&texSize, 32, 4096))
3383 SLfloat shadowMinBias = light->shadowMinBias();
3384 SLfloat shadowMaxBias = light->shadowMaxBias();
3385 if (ImGui::SliderFloat(
"Min. shadow bias", &shadowMinBias, 0.0f, shadowMaxBias,
"%.03f"))
3386 light->shadowMinBias(shadowMinBias);
3387 if (ImGui::SliderFloat(
"Max. shadow bias", &shadowMaxBias, shadowMinBias, 0.02f,
"%.03f"))
3388 light->shadowMaxBias(shadowMaxBias);
3393 if (ImGui::InputFloat2(
"Size", (
float*)&size))
3394 shadowMap->
size(size);
3399 SLbool doSmoothShadows = light->doSoftShadows();
3400 if (ImGui::Checkbox(
"Do smooth shadows", &doSmoothShadows))
3401 light->doSmoothShadows(doSmoothShadows);
3403 SLuint pcfLevel = light->softShadowLevel();
3404 if (ImGui::SliderInt(
"Smoothing level", (
SLint*)&pcfLevel, 1, 3))
3405 light->smoothShadowLevel(pcfLevel);
3409 if (ImGui::Checkbox(
"Do colored shadows", &doColoredShadows))
3413 if (ImGui::InputInt2(
"Visualization rays", (
int*)&rayCount))
3419 if (ImGui::TreeNode(
"Light cascade space matrices"))
3429 if (ImGui::TreeNode(shadowMap->
useCubemap() ?
"Light space matrices" :
"Light space matrix"))
3432 for (
SLint i = 0; i < 6; ++i)
3445 for (
int i = 0; i < shadowMap->
depthBuffers().size(); i++)
3447 ImGui::Text((
"Depth Buffer " + std::to_string(i) +
":").c_str());
3448 ImGui::Image((
void*)(intptr_t)shadowMap->
depthBuffers().at(i)->texID(),
3454 ImGui::Text(
"Depth Buffer:");
3467 if (
typeid(*singleNode) ==
typeid(
SLCamera))
3471 if (ImGui::TreeNode(
"Camera"))
3473 SLfloat clipN = cam->clipNear();
3474 SLfloat clipF = cam->clipFar();
3475 SLfloat focalDist = cam->focalDist();
3478 const char* projections[] = {
"Mono Perspective",
3479 "Mono Intrinsic Calibrated",
3480 "Mono Orthographic",
3481 "Stereo Side By Side",
3482 "Stereo Side By Side Prop.",
3483 "Stereo Side By Side Dist.",
3484 "Stereo Line By Line",
3485 "Stereo Column By Column",
3486 "Stereo Pixel By Pixel",
3487 "Stereo Color Red-Cyan",
3488 "Stereo Color Red-Green",
3489 "Stereo Color Red-Blue",
3490 "Stereo Color Yellow-Blue"};
3492 int proj = cam->projType();
3493 if (ImGui::Combo(
"Projection", &proj, projections, IM_ARRAYSIZE(projections)))
3498 SLfloat eyeSepar = cam->stereoEyeSeparation();
3499 if (ImGui::SliderFloat(
"Eye Sep.", &eyeSepar, 0.0f, focalDist / 10.f))
3500 cam->stereoEyeSeparation(eyeSepar);
3503 if (ImGui::SliderFloat(
"FOV", &fov, 1.f, 179.f))
3506 if (ImGui::SliderFloat(
"Near Clip", &clipN, 0.001f, 10.f))
3507 cam->clipNear(clipN);
3509 if (ImGui::SliderFloat(
"Far Clip", &clipF, clipN, std::min(clipF * 1.1f, 1000000.f)))
3510 cam->clipFar(clipF);
3512 if (ImGui::SliderFloat(
"Focal Dist.", &focalDist, clipN, clipF))
3513 cam->focalDist(focalDist);
3526 SLbool doSunPowerAdaptation =
false;
3530 typeName =
"Light (spot):";
3535 typeName =
"Light (rectangular):";
3540 typeName =
"Light (directional):";
3541 doSunPowerAdaptation = ((
SLLightDirect*)singleNode)->doSunPowerAdaptation();
3544 if (light && ImGui::TreeNode(typeName.c_str()))
3547 if (ImGui::Checkbox(
"Is on", &on))
3550 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3552 if (ImGui::ColorEdit3(
"Ambient color", (
float*)&aC, cef))
3557 if (doSunPowerAdaptation)
3559 float sum_aPdP = aP + dP;
3560 float ambiFraction = aP / sum_aPdP;
3561 if (ImGui::SliderFloat(
"Diffuse-Ambient-Mix", &ambiFraction, 0.0f, 1.0f,
"%.2f"))
3570 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dC, cef))
3574 if (ImGui::ColorEdit3(
"Specular color", (
float*)&sC, cef))
3578 if (ImGui::SliderFloat(
"Ambient power", &aP, 0.0f, 10.0f,
"%.2f"))
3581 if (ImGui::SliderFloat(
"Diffuse power", &dP, 0.0f, 10.0f,
"%.2f"))
3585 if (ImGui::SliderFloat(
"Specular power", &sP, 0.0f, 10.0f,
"%.2f"))
3589 if (ImGui::SliderFloat(
"Spot cut off angle", &cutoff, 0.0f, 180.0f,
"%.2f"))
3593 if (ImGui::SliderFloat(
"Spot attenuation", &spotExp, 0.0f, 128.0f,
"%.2f"))
3596 float kc = light->
kc();
3597 if (ImGui::SliderFloat(
"Constant attenuation", &kc, 0.0f, 1.0f,
"%.2f"))
3600 float kl = light->
kl();
3601 if (ImGui::SliderFloat(
"Linear attenuation", &kl, 0.0f, 1.0f,
"%.2f"))
3604 float kq = light->
kq();
3605 if (ImGui::SliderFloat(
"Quadratic attenuation", &kq, 0.0f, 1.0f,
"%.2f"))
3611 if (ImGui::Checkbox(
"Do Sun Power Adaptation", &doSunPowerAdaptation))
3614 if (doSunPowerAdaptation)
3617 if (ImGui::TreeNode(
"Sun Color LUT"))
3625 ImGui::GetWindowWidth() - 4 * ImGui::GetTreeNodeToLabelSpacing() - 10;
3626 void* tid = (ImTextureID)(uintptr_t)lut->
texID();
3628 ImVec2(texW, texW * 0.15f),
3632 ImVec4(1, 1, 1, 1));
3642 ImGui::Text(
"No single node selected.");
3647 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
3653 if (ImGui::TreeNode(
"Mesh Properties"))
3656 SLuint t = (
SLuint)(!singleFullMesh->
I16.empty() ? singleFullMesh->
I16.size() / 3 : singleFullMesh->
I32.size() / 3);
3657 SLuint e = (
SLuint)(!singleFullMesh->
IE16.empty() ? singleFullMesh->
IE16.size() / 2 : singleFullMesh->
IE32.size() / 2);
3659 ImGui::Text(
"Mesh name : %s", singleFullMesh->
name().c_str());
3663 ImGui::Text(
"# vertices : %u", ps->
amount() * 4);
3664 ImGui::Text(
"# triangles : %u", ps->
amount() * 2);
3668 ImGui::Text(
"# vertices : %u", v);
3669 ImGui::Text(
"# triangles : %u", t);
3670 ImGui::Text(
"# hard edges : %u", e);
3672 ImGui::Text(
"Material Name: %s", m->
name().c_str());
3676 if (ImGui::TreeNode(
"Reflection Model: Blinn-Phong"))
3678 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3680 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3682 if (ImGui::ColorEdit3(
"Ambient color", (
float*)&ac, cef))
3686 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dc, cef))
3690 if (ImGui::ColorEdit3(
"Specular color", (
float*)&sc, cef))
3694 if (ImGui::ColorEdit3(
"Emissive color", (
float*)&ec, cef))
3698 if (ImGui::SliderFloat(
"Shininess", &shine, 0.0f, 1000.0f))
3702 if (ImGui::SliderFloat(
"kr", &kr, 0.0f, 1.0f))
3706 if (ImGui::SliderFloat(
"kt", &kt, 0.0f, 1.0f))
3710 if (ImGui::SliderFloat(
"kn", &kn, 1.0f, 2.5f))
3714 if (ImGui::Checkbox(
"Receives shadows", &receivesShadows))
3717 ImGui::PopItemWidth();
3723 if (ImGui::TreeNode(
"Reflection Model: Cook-Torrance"))
3727 ImGui::Text(
"Controlled by textures");
3731 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3733 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
3735 if (ImGui::ColorEdit3(
"Diffuse color", (
float*)&dc, cef))
3739 if (ImGui::SliderFloat(
"Roughness", &rough, 0.0f, 1.0f))
3743 if (ImGui::SliderFloat(
"Metalness", &metal, 0.0f, 1.0f))
3746 ImGui::PopItemWidth();
3753 if (ImGui::TreeNode(
"Particle System"))
3756 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
3762 if (ImGui::Checkbox(
"Instanced draw", &drawInstanced))
3773 if (ImGui::Button(
"Resume"))
3778 if (ImGui::Button(
"Pause"))
3782 if (ImGui::Button(
"Reset"))
3785 if (ImGui::CollapsingHeader(
"Emission"))
3790 int amount = ps->
amount();
3791 if (ImGui::InputInt(
"Amount of particles", &amount))
3800 if (ImGui::CollapsingHeader(
"Time to live"))
3805 if (ImGui::InputFloat(
"Time to live (s)", &timeToLive))
3813 if (ImGui::Checkbox(
"Counter lag/gap", &doCounterGap))
3819 ImGui::TextWrapped(
"Need to be enable by default but can create flickering with few particles, recommend to disable if few particles with no velocity ");
3826 if (ImGui::Combo(
"Billboard Type",
3828 "Camera Billboard\0Vertical Billboard\0Horizontal Billboard\0"))
3832 if (item_current == 2)
3846 if (ImGui::Checkbox(
"Shape", &shape_group))
3853 if (ImGui::CollapsingHeader(
"Shape", &shape_group))
3857 if (ImGui::Combo(
"Shape type",
3859 "Sphere\0Box\0Cone\0Pyramid\0"))
3869 if (ImGui::InputFloat(
"Radius of the sphere", &radiusSphere))
3876 if (item_current ==
ST_Box)
3879 if (ImGui::InputFloat3(
"Scale box XYZ", vec3fScaleBox))
3881 ps->
shapeScale(vec3fScaleBox[0], vec3fScaleBox[1], vec3fScaleBox[2]);
3889 if (ImGui::InputFloat(
"Radius", &radius))
3896 if (ImGui::InputFloat(
"Angle", &angle))
3903 if (ImGui::InputFloat(
"Height", &height))
3913 if (ImGui::InputFloat(
"Half side", &halfSide))
3920 if (ImGui::InputFloat(
"Angle", &angle))
3927 if (ImGui::InputFloat(
"Height", &height))
3936 if (ImGui::Checkbox(
"Spawn surface", &shapeSurf))
3941 if (item_current == 2 || item_current == 3)
3944 if (ImGui::Checkbox(
"Spawn base volume", &shapeSpawnBase))
3953 ImGui::BeginDisabled();
3954 ImGui::LabelText(
"Condition",
"Need to have direction and speed enabled");
3955 if (item_current == 2 || item_current == 3)
3958 if (ImGui::Checkbox(
"Follow shape direction (Override direction)",
3966 else if (item_current == 0 || item_current == 1)
3969 if (ImGui::Checkbox(
"Inverse center direction (Override direction)", &shapeOverride))
3978 ImGui::EndDisabled();
3986 if (ImGui::Checkbox(
"Flipbook texture", &flipbookTex_group))
3994 if (ImGui::CollapsingHeader(
"Flipbook texture", &flipbookTex_group))
3998 if (ImGui::InputInt(
"Frame rate (num update by s)", &fR))
4009 if (ImGui::CollapsingHeader(
"Size"))
4014 float radiusW = ps->
radiusW();
4015 if (ImGui::InputFloat(
"Radius width", &radiusW))
4020 float radiusH = ps->
radiusH();
4021 if (ImGui::InputFloat(
"Radius height", &radiusH))
4026 float scale = ps->
scale();
4027 if (ImGui::InputFloat(
"Scale", &scale))
4035 if (ImGui::Checkbox(
"Size over lifetime", &doSizeOverLT_group))
4041 if (ImGui::CollapsingHeader(
"Size over lifetime", &doSizeOverLT_group))
4045 if (ImGui::Checkbox(
"Custom curve (Unchecked --> Linear function)2", &doSizeOverLTCurve_group))
4050 if (ImGui::CollapsingHeader(
"Bezier curve size", &doSizeOverLTCurve_group))
4055 if (ImGui::Bezier(
"easeInExpo", vSize, staEndSize))
4065 if (ImGui::CollapsingHeader(
"Movement"))
4071 if (ImGui::Checkbox(
"World space", &doWorldSpace))
4076 if (ImGui::Checkbox(
"Gravity", &doGravity))
4083 if (ImGui::CollapsingHeader(
"Gravity", &doGravity))
4087 if (ImGui::InputFloat3(
"Gravity XYZ", vec3Gravity))
4089 ps->
gravity(vec3Gravity[0], vec3Gravity[1], vec3Gravity[2]);
4097 if (ImGui::Checkbox(
"Acceleration", &acc_group))
4104 if (ImGui::CollapsingHeader(
"Acceleration", &acc_group))
4108 ImGui::BeginDisabled();
4110 if (ImGui::InputFloat(
"Accelaration constant", &accConst))
4116 ImGui::EndDisabled();
4118 if (ImGui::Checkbox(
"Direction vector", &accDiffDirection_group))
4124 if (ImGui::CollapsingHeader(
"Direction vector", &accDiffDirection_group))
4127 ImGui::InputFloat3(
"input float3", vec3fAcc);
4128 ps->
acceleration(vec3fAcc[0], vec3fAcc[1], vec3fAcc[2]);
4136 ImGui::BeginDisabled();
4137 if (ImGui::CollapsingHeader(
"Velocity"))
4141 if (ImGui::Combo(
"Velocity type", &item_current,
"Random axes\0Constant axes\0"))
4147 if (item_current == 0)
4150 if (ImGui::InputFloat3(
"Min. random XYZ", vec3fVstart))
4152 ps->
velocityRndMin(vec3fVstart[0], vec3fVstart[1], vec3fVstart[2]);
4157 if (ImGui::InputFloat3(
"Max. random XYZ", vec3fVend))
4164 else if (item_current == 1)
4167 if (ImGui::InputFloat3(
"Constant XYZ", vec3fVelocity))
4169 ps->
velocityConst(vec3fVelocity[0], vec3fVelocity[1], vec3fVelocity[2]);
4177 ImGui::EndDisabled();
4181 if (ImGui::Checkbox(
"Direction and Speed", &directionSpeed_group))
4188 if (ImGui::CollapsingHeader(
"Direction and Speed", &directionSpeed_group))
4192 if (ImGui::InputFloat3(
"Constant XYZ", vec3fDirection))
4194 ps->
direction(vec3fDirection[0], vec3fDirection[1], vec3fDirection[2]);
4200 if (ImGui::Combo(
"Speed value",
4202 "Constant\0Random between two constants\0"))
4204 if (item_current == 1)
4214 float speed = ps->
speed();
4215 if (ImGui::InputFloat(
"Constant", &speed))
4225 if (ImGui::InputFloat2(
"Random range Speed", vec2fRange))
4227 ps->
speedRange(vec2fRange[0], vec2fRange[1]);
4235 if (ImGui::Checkbox(
"Rotation", &rot_group))
4242 if (ImGui::CollapsingHeader(
"Rotation", &rot_group))
4246 if (ImGui::Combo(
"Angular velocity value", &item_current,
"Constant\0Random between two constants\0"))
4248 if (item_current == 1)
4259 if (ImGui::InputFloat(
"Constant", &angularVelocityConst))
4267 if (ImGui::InputFloat2(
"Random range A.V", vec2fRange))
4282 if (ImGui::CollapsingHeader(
"Color"))
4288 if (ImGui::Checkbox(
"Color", &color_group))
4293 if (ImGui::CollapsingHeader(
"Color", &color_group))
4298 if (ImGui::Checkbox(
"Glow/Bright (blending effect)", &color_bright))
4305 ImGui::BeginDisabled();
4306 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
4308 if (ImGui::ColorEdit4(
"Particle color", (
float*)&c, cef))
4311 ImGui::EndDisabled();
4316 if (ImGui::Checkbox(
"Color over lifetime", &doColorOverLT_group))
4323 if (ImGui::CollapsingHeader(
"Color over lifetime", &doColorOverLT_group))
4325 ImGui::Text(
"Edit gradient colors in the texture section.");
4332 if (ImGui::Checkbox(
"Alpha over lifetime", &doAlphaOverL_group))
4337 if (ImGui::CollapsingHeader(
"Alpha over lifetime", &doAlphaOverL_group))
4341 if (ImGui::Checkbox(
"Custom curve (Unchecked --> Linear function)", &doAlphaOverLCurve_group))
4346 if (ImGui::CollapsingHeader(
"Bezier curve alpha", &doAlphaOverLCurve_group))
4351 if (ImGui::Bezier(
"easeInExpo", vAlpha, staEndAlpha))
4361 ImGui::PopItemWidth();
4377 size_t numShaders = m->
program() ? m->
program()->shaders().size() : 0;
4380 if (numShaders > 0 && ImGui::TreeNode(
"Shd",
"Shaders (%d)", (
int)numShaders))
4384 for (
auto* shd : m->
program()->shaders())
4386 if (ImGui::TreeNode(shd->name().c_str()))
4388 SLchar* text =
new char[shd->code().length() + 1];
4389 strcpy(text, shd->code().c_str());
4390 ImGui::InputTextMultiline(shd->name().c_str(),
4392 shd->code().length() + 1,
4393 ImVec2(-1.0f, -1.0f));
4401 for (
auto* shd : m->
programTF()->shaders())
4403 if (ImGui::TreeNode(shd->name().c_str()))
4405 SLchar* text =
new char[shd->code().length() + 1];
4406 strcpy(text, shd->code().c_str());
4407 ImGui::InputTextMultiline(shd->name().c_str(),
4409 shd->code().length() + 1,
4410 ImVec2(-1.0f, -1.0f));
4425 ImGui::Text(
"No single single mesh selected.");
4428 ImGui::PopStyleColor();
4433 ImGui::Begin(
"Properties of Selection", &
showProperties, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoNavInputs);
4437 if (selectedNode->mesh())
4439 ImGui::Text(
"Node: %s", selectedNode->name().c_str());
4440 SLMesh* selectedMesh = selectedNode->mesh();
4442 if (!selectedMesh->
IS32.empty())
4444 ImGui::Text(
" Mesh: %s {%u v.}",
4445 selectedMesh->
name().c_str(),
4449 if (ImGui::Button(delBtn.c_str()))
4462 ImGui::Text(
"There is nothing selected.");
4464 ImGui::Text(
"Select a single node by");
4465 ImGui::Text(
"double-clicking it or");
4466 ImGui::Text(
"select multiple nodes by");
4467 ImGui::Text(
"SHIFT-double-clicking them.");
4469 ImGui::Text(
"Select partial meshes by");
4470 ImGui::Text(
"CTRL-LMB rectangle drawing.");
4472 ImGui::Text(
"Press ESC to deselect all.");
4474 ImGui::Text(
"Be aware that a node may be");
4475 ImGui::Text(
"flagged as not selectable.");
4480 ImGui::Text(
"Node selection and the");
4481 ImGui::Text(
"properties of it can only");
4482 ImGui::Text(
"be shown in the OpenGL");
4483 ImGui::Text(
"renderer.");
4494 SLfloat texW = ImGui::GetWindowWidth() - 4 * ImGui::GetTreeNodeToLabelSpacing() - 10;
4495 void* tid = (ImTextureID)(intptr_t)tex->
texID();
4500 if (ImGui::TreeNode(tex->
name().c_str()))
4503 for (
auto img : tex->
images())
4504 mbCPU += (
float)img->bytesPerImage();
4512 ImGui::Text(
"Size(PX): %dx%dx%d", tex->
width(), tex->
height(), tex->
depth());
4513 ImGui::Text(
"Size(MB): GPU:%4.2f, CPU:%4.2f, DSK:%4.2f", mbGPU, mbCPU, mbDSK);
4514 ImGui::Text(
"TexID : %u (%s)", tex->
texID(), tex->
isTexture() ?
"ok" :
"not ok");
4515 ImGui::Text(
"Type : %s", tex->
typeName().c_str());
4517 ImGui::Text(
"Format : %s", tex->
images()[0]->formatString().c_str());
4519 ImGui::Text(
"Format : %s",
"n/a (GPU only)");
4520 #ifdef SL_BUILD_WITH_KTX
4521 ImGui::Text(
"Compr. : %s", tex->compressionFormatStr(tex->compressionFormat()).c_str());
4526 if (tex->
target() == GL_TEXTURE_2D)
4531 if (ImGui::TreeNode(
"Color Points in Gradient"))
4537 if (ImGui::TreeNode(
"Alpha Points in Gradient"))
4541 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.25f);
4544 snprintf(label,
sizeof(label),
"Alpha %lu", a);
4545 if (ImGui::SliderFloat(label, &alpha, 0.0f, 1.0f,
"%3.2f"))
4547 lut->
alphas()[a].alpha = alpha;
4551 snprintf(label,
sizeof(label),
"Pos. %lu", a);
4553 if (a > 0 && a < lut->alphas().size() - 1)
4559 if (ImGui::SliderFloat(label, &pos, min, max,
"%3.2f"))
4561 lut->
alphas()[a].pos = pos;
4566 ImGui::Text(
"%3.2f Pos. %lu", pos, a);
4568 ImGui::PopItemWidth();
4575 ImVec2(texW, texW * 0.15f),
4579 ImVec4(1, 1, 1, 1));
4582 ImGui::PlotLines(
"",
4584 (
SLint)allAlpha.size(),
4589 ImVec2(texW, texW * 0.25f));
4594 ImVec2(texW, texW * h_to_w),
4598 ImVec4(1, 1, 1, 1));
4603 if (tex->
target() == GL_TEXTURE_CUBE_MAP)
4604 ImGui::Text(
"Cube maps can not be displayed.");
4605 else if (tex->
target() == GL_TEXTURE_3D)
4606 ImGui::Text(
"3D textures can not be displayed.");
4616 ImGuiStyle& style = ImGui::GetStyle();
4622 SL_LOG(
"No config file %s: ", fullPathAndFilename.c_str());
4625 SLfloat dpiScaleProp = (float)dotsPerInch / 142.0f;
4626 SLfloat dpiScaleFixed = (float)dotsPerInch / 142.0f;
4646 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = std::max(8.0f * dpiScaleFixed, 8.0f);
4647 style.FramePadding.y = style.ItemInnerSpacing.y = std::max(4.0f * dpiScaleFixed, 4.0f);
4648 style.WindowPadding.y = style.ItemSpacing.y * 3;
4649 style.ScrollbarSize = std::max(16.0f * dpiScaleFixed, 16.0f);
4652 if (style.ScrollbarSize < 0.0f)
4653 style.ScrollbarSize = 16.0f;
4655 style.ScrollbarRounding =
std::floor(style.ScrollbarSize / 2);
4662 CVFileStorage fs(configString, CVFileStorage::READ | CVFileStorage::MEMORY);
4672 fs[
"ItemSpacingX"] >> i; style.ItemSpacing.x = (
SLfloat) i;
4673 fs[
"ItemSpacingY"] >> i; style.ItemSpacing.y = (
SLfloat) i;
4674 style.WindowPadding.x = style.FramePadding.x = style.ItemInnerSpacing.x = style.ItemSpacing.x;
4675 style.FramePadding.y = style.ItemInnerSpacing.y = style.ItemSpacing.y;
4676 style.WindowPadding.y = style.ItemSpacing.y * 3;
4677 fs[
"ScrollbarSize"] >> i; style.ScrollbarSize = (
SLfloat) i;
4679 if (style.ScrollbarSize < 0.0f)
4680 style.ScrollbarSize = 16.0f;
4682 fs[
"ScrollbarRounding"] >> i; style.ScrollbarRounding = (
SLfloat) i;
4701 SL_LOG(
"Config. loaded : %s", fullPathAndFilename.c_str());
4708 SL_LOG(
"****** Failed to open file for reading: %s", fullPathAndFilename.c_str());
4713 SL_LOG(
"****** Parsing of file failed: %s", fullPathAndFilename.c_str());
4717 if (dotsPerInch > 300)
4723 SLfloat dpiScaleProp = (float)dotsPerInch / 120.0f;
4724 SLfloat dpiScaleFixed = (float)dotsPerInch / 142.0f;
4733 #ifdef SL_EMSCRIPTEN
4736 int sceneId = EM_ASM_INT(
4737 let params =
new URL(
window.location).searchParams;
4738 return params.get(
"scene") ?? -1;
4750 ImGuiStyle& style = ImGui::GetStyle();
4755 SL_LOG(
"New config file will be written: %s",
4756 fullPathAndFilename.c_str());
4759 CVFileStorage::WRITE | CVFileStorage::MEMORY);
4763 SL_LOG(
"Failed to open file for writing: %s",
4764 fullPathAndFilename.c_str());
4776 fs <<
"ItemSpacingX" << (
SLint)style.ItemSpacing.x;
4777 fs <<
"ItemSpacingY" << (
SLint)style.ItemSpacing.y;
4778 fs <<
"ScrollbarSize" << (
SLfloat)style.ScrollbarSize;
4779 fs <<
"ScrollbarRounding" << (
SLfloat)style.ScrollbarRounding;
4795 std::string configString = fs.releaseAndGetString();
4799 SL_LOG(
"Config. saved : %s", fullPathAndFilename.c_str());
4844 assert(
s->
assetManager() &&
"No asset manager assigned to scene!");
4865 s->
root2D()->addChild(horizonNode);
4879 s->
root2D()->deleteChild(horizonNode);
4888 ImGuiColorEditFlags cef = ImGuiColorEditFlags_NoInputs;
4893 snprintf(label,
sizeof(label),
"Color %lu", c);
4894 if (ImGui::ColorEdit3(label, (
float*)&color, cef))
4896 lut->
colors()[c].color = color;
4900 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
4901 snprintf(label,
sizeof(label),
"Pos. %lu", c);
4903 if (c > 0 && c < lut->colors().size() - 1)
4907 if (ImGui::SliderFloat(label, &pos, min, max,
"%3.2f"))
4909 lut->
colors()[c].pos = pos;
4914 ImGui::Text(
"%3.2f Pos. %lu", pos, c);
4915 ImGui::PopItemWidth();
4921 string downloadFilename,
4922 string filenameToLoad,
4925 SLstring pathSrc =
"https://pallas.ti.bfh.ch/data/SLProject/models/";
4928 #ifndef SL_EMSCRIPTEN
4941 string downloadFilename,
4944 string pathAndFileToLoad,
4947 #ifndef SL_EMSCRIPTEN
4948 assert(
s->
assetManager() &&
"No asset manager assigned to scene!");
4951 auto progressCallback = [](
size_t curr,
size_t filesize)
4955 int transferredPC = (int)((
float)curr / (float)filesize * 100.0f);
4959 cout <<
"Bytes transferred: " << curr << endl;
4964 auto downloadJobHTTP = [=]()
4967 string jobMsg =
"Downloading file via HTTPS: " + downloadFilename;
4970 string fileToDownload = urlFolder + downloadFilename;
4971 if (HttpUtils::download(fileToDownload, dstFolder, progressCallback) != 0)
4973 SL_LOG(
"*** Nothing downloaded from: %s ***", fileToDownload.c_str());
4974 SL_LOG(
"*** PLEASE RETRY DOWNLOAD ***", fileToDownload.c_str());
4979 auto unzipJob = [=]()
4981 string jobMsg =
"Decompressing file: " + downloadFilename;
4984 string zipFile = dstFolder + downloadFilename;
4988 if (extension ==
"zip")
4995 SL_LOG(
"*** File do decompress doesn't exist: %s ***",
5000 auto followUpJob1 = [=]()
5005 SL_LOG(
"*** File do load doesn't exist: %s ***",
5006 pathAndFileToLoad.c_str());
5022 #if !defined(SL_OS_MACIOS) && !defined(SL_OS_ANDROID)
5027 SLVec3f camToLookAt = pos_f - lookAtPoint;
5029 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.