463 {
465
467
468 material->GetConstantParams().for_each([&](const std::string& k, ConstantParams& v){
470 if(v.value.paramType == "float")
471 {
472 if (ImGuiH::DrawMaterialConstParams<float>(material, ImGuiDataType_Float, 1, "%.3f", v))
473 {
474 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
475 }
476 }
477 else if(v.value.paramType == "float2")
478 {
479 if (ImGuiH::DrawMaterialConstParams<glm::vec2>(material, ImGuiDataType_Float, 2, "%.3f", v))
480 {
481 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
482 }
483 }
484 else if(v.value.paramType == "float3")
485 {
486 if (ImGuiH::DrawMaterialConstParams<glm::vec3>(material, ImGuiDataType_Float, 3, "%.3f", v))
487 {
488 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
489 }
490 }
491 else if(v.value.paramType == "float4")
492 {
493 if (ImGuiH::DrawMaterialConstParams<glm::vec4>(material, ImGuiDataType_Float, 4, "%.3f", v))
494 {
495 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
496 }
497 }
498 else if(v.value.paramType == "int")
499 {
500 if (ImGuiH::DrawMaterialConstParams<int>(material, ImGuiDataType_S32, 1, "%d", v))
501 {
502 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
503 }
504 }
505 else if (v.value.paramType == "bool")
506 {
507 bool f = std::any_cast<bool>(v.value.paramValue);
508 bool nf = f;
509 bool df = std::any_cast<bool>(v.defaultValue.paramValue);
510
511 const float seperatorWidthS = ImGuiH::GetLineItemSize().x - 3.0f * ImGui::GetStyle().IndentSpacing;
512 ImGuiH::Checkbox(&nf);
513 if (nf != f)
514 {
515 v.value.paramValue = nf;
516 material->UpdateMaterial();
517 }
518 ImGui::SameLine();
519 ImGui::PushItemWidth(100.0f);
520 ImGui::SeparatorText("##");
521 ImGui::PopItemWidth();
522 ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.x);
524 {
525 v.value.paramValue = df;
526 material->UpdateMaterial();
527 }
528 }
529 });
530 return false;
531 });
532 });
533 }
#define SPICES_PROFILE_ZONE
static bool DrawResetIcon(const bool &isMove)
Draw Reset Icon.
static void DrawPropertyItem(const std::string &itemName, float columeWidth, std::function< void()> nameFunc, std::function< void()> valFunc)
Draw a single property.
static void DrawTreeTitle(const std::string &treeName, std::function< void()> optionFunc, std::function< void()> treeFunc)
Draw a stylized tree title bar.