2
3
4
5
17
18
21 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2.0f, 4.0f));
24
25
26 static std::string searchString;
27 static bool isEnableSearch =
false;
30
31
36 ImGui::PushItemWidth(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 2.0f - ImGui::GetStyle().WindowPadding.x);
37 static char search[256] = {};
38 if (ImGui::InputTextWithHint(
"##",
ICON_TEXT(ICON_MD_SEARCH, Search), search, 128))
40 searchString = std::string(search);
41 if (searchString.size() == 0) isEnableSearch =
false;
42 else isEnableSearch =
true;
44 ImGui::PopItemWidth();
46 ImGui::SameLine(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 2.0f);
47 ImGui::Button(ICON_MD_FILTER_ALT, ImGuiH::GetLineItemSize());
48 ImGui::SameLine(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 1.0f);
49 ImGui::Button(ICON_MD_REORDER, ImGuiH::GetLineItemSize());
71 if(!meshComp.GetMesh()->GetPacks().has_key(materialIndex))
78 float columeWidth = ImGuiH::GetLineItemSize().x * 6.5f;
79 ImGuiTreeNodeFlags treeNodeFlags =
80 ImGuiTreeNodeFlags_DefaultOpen |
81 ImGuiTreeNodeFlags_AllowItemOverlap |
82 ImGuiTreeNodeFlags_Framed |
83 ImGuiTreeNodeFlags_FramePadding ;
86 const std::shared_ptr<
MeshPack>& meshPack = *meshComp.GetMesh()->GetPacks().find_value(materialIndex);
87 std::shared_ptr<
Material> material = meshPack->GetMaterial();
90
91
103
104
109 ImGui::PushID(
"ImguiMaterialPanel::Add");
111 ImGui::Columns(2, 0,
false);
112 ImGui::SetColumnWidth(0, ImGuiH::GetLineItemSize().x * 4.0f);
113 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.16f, 0.16f, 0.16f, 1.0f));
114 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.619f, 0.619f, 0.619f, 1.0f));
115 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.408f, 0.451f, 0.18f, 1.0f));
116 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.341f, 0.486f, 0.353f, 1.0f));
117 ImGui::Button(
ICON_TEXT(ICON_MD_ADD, Add));
118 ImGui::PopStyleColor(4);
121 ImGui::PushItemWidth(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 4.0f);
123 if (ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", material->GetName().c_str()), text, 128)) {}
124 ImGui::PopItemWidth();
131 ImGui::PushID(
"ImguiMaterialPanel::Prim Path");
132 ImGui::Columns(2, 0,
false);
133 ImGui::SetColumnWidth(0, ImGuiH::GetLineItemSize().x * 4.0f);
134 ImGui::Text(
"Prim Path");
137 std::stringstream ss;
138 ss <<
"/" << material->GetName();
139 ImGui::PushItemWidth(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 4.0f);
140 char textpath[128] =
"";
141 if (ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", ss.str().c_str()), textpath, 128)) {}
142 ImGui::PopItemWidth();
149 ImGui::PushID(
"ImguiMaterialPanel::Instanceable");
150 ImGui::Columns(2, 0,
false);
151 ImGui::SetColumnWidth(0, ImGuiH::GetLineItemSize().x * 4.0f);
152 ImGui::Text(
"Instanceable");
155 static bool isChecked;
164
165
173 for(
auto& pair : material->GetShaderPath())
175 ImGuiH::DrawPropertyItem(pair.first, columeWidth,
nullptr, [&](){
177 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
178 char buffer[128] = {};
179 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", pair.second[0].c_str()), buffer,
sizeof(buffer));
180 ImGui::PopItemWidth();
183 ImGuiH::DrawResetIcon(
false);
193 material->GetTextureParams().for_each([&](
const auto& k,
const auto& v) {
195 ImGuiH::DrawPropertyItem(k, columeWidth,
nullptr, [&](){
197 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
198 char buffer[128] = {};
199 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", v.texturePath.c_str()), buffer,
sizeof(buffer));
200 ImGui::PopItemWidth();
203 ImGuiH::DrawResetIcon(
false);
214 material->GetConstantParams().for_each([&](
const std::string& k, ConstantParams& v){
215 ImGuiH::DrawPropertyItem(k, columeWidth,
nullptr, [&](){
216 if (v.value.paramType ==
"float")
218 if (ImGuiH::DrawMaterialConstParams<
float>(material, ImGuiDataType_Float, 1,
"%.3f", v))
220 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
223 else if (v.value.paramType ==
"float2")
225 if (ImGuiH::DrawMaterialConstParams<glm::vec2>(material, ImGuiDataType_Float, 2,
"%.3f", v))
227 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
230 else if (v.value.paramType ==
"float3")
232 if (ImGuiH::DrawMaterialConstParams<glm::vec3>(material, ImGuiDataType_Float, 3,
"%.3f", v))
234 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
237 else if (v.value.paramType ==
"float4")
239 if (ImGuiH::DrawMaterialConstParams<glm::vec4>(material, ImGuiDataType_Float, 4,
"%.3f", v))
241 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
244 else if (v.value.paramType ==
"int")
246 if (ImGuiH::DrawMaterialConstParams<
int>(material, ImGuiDataType_S32, 1,
"%d", v))
248 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
251 else if (v.value.paramType ==
"bool")
269
270
271 ImGui::PopStyleVar();
#define ICON_TEXT(icon, text)
#define ICON_TEXT_ROW(icon, text)
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
Entity Class. This class defines the specific behaves of Entity.
uint32_t m_PickMaterial
Identify of selected material.
static FrameInfo & Get()
Get FrameInfo.
FrameInfo Class. This class defines the FrameInfo data.
static void Checkbox(bool *isChecked)
ImGuiHelper Style Checkbox.
static void DrawTreeTitle(const std::string &treeName, std::function< void()> optionFunc, std::function< void()> treeFunc)
Draw a stylized tree title bar.
The ImGuiH Class. This class defines helper function for slate render.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
The ImguiMaterialPanel Class. This class defines how to render a Material Property.
FrameInfo & m_FrameInfo
The FrameData reference.
Material Class. This class contains a branch of parameter and shader, also descriptor.
MeshComponent Class. This class defines the specific behaves of MeshComponent.
MeshPack Class. This class defines some basic behaves and variables. This class need to be inherited ...