SpiecsEngine
 
Loading...
Searching...
No Matches

◆ DrawMaterialConstParams()

template<typename T >
bool Spices::ImGuiH::DrawMaterialConstParams ( std::shared_ptr< Material > material,
ImGuiDataType data_type,
int components,
const char * format,
ConstantParams & value )
inlinestatic

Draw ConstantParams.

Parameters
[in]material.
[in]data_typeImGuiDataType.
[in]componentsDetermined by ConstantParams Type(float: 1, float2: 2 ...).
[in]formatfloat/int.
[in]valueConstantParams.
Returns
Returns true if value moved.

Definition at line 216 of file ImguiHelper.h.

223 {
225
226 T f = std::any_cast<T>(value.value.paramValue);
227 T df = std::any_cast<T>(value.defaultValue.paramValue);
228
229 T minf = T();
230 if (value.hasMinValue) minf = std::any_cast<T>(value.min.paramValue);
231 T maxf = T();
232 if (value.hasMaxValue) maxf = std::any_cast<T>(value.max.paramValue);
233
234 bool moved = false;
235 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
237 "##",
238 data_type,
239 &f,
240 components,
241 0.01f,
242 (const void*)&minf,
243 (const void*)&maxf,
244 format
245 ))
246 {
247 value.value.paramValue = f;
248 material->UpdateMaterial();
249 moved = true;
250 }
251
252 ImGui::PopItemWidth();
253 ImGui::SameLine();
254 if (ImGuiH::DrawResetIcon(f != df))
255 {
256 value.value.paramValue = df;
257 material->UpdateMaterial();
258 moved = true;
259 }
260
261 return moved;
262 }
#define SPICES_PROFILE_ZONE
static bool S_DragScalarN(const char *label, ImGuiDataType data_type, void *p_data, int components, float v_speed=1.0f, const void *p_min=NULL, const void *p_max=NULL, const char *format=NULL, ImGuiSliderFlags flags=0)
Draw Drag Scale with different p_min p_max.
static ImVec2 GetLineItemSize()
Get Line Width's Square Size.
static bool DrawResetIcon(const bool &isMove)
Draw Reset Icon.

References DrawResetIcon().