MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / UpdateUI

Method UpdateUI

Components/src/CoordinateGridRenderer.cpp:104–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104bool CoordinateGridRenderer::UpdateUI(HLSL::CoordinateGridAttribs& Attribs, CoordinateGridRenderer::FEATURE_FLAGS& FeatureFlags)
105{
106 bool ActiveAxisX = (FeatureFlags & FEATURE_FLAG_RENDER_AXIS_X) != 0;
107 bool ActiveAxisY = (FeatureFlags & FEATURE_FLAG_RENDER_AXIS_Y) != 0;
108 bool ActiveAxisZ = (FeatureFlags & FEATURE_FLAG_RENDER_AXIS_Z) != 0;
109
110 bool ActivePlaneYZ = (FeatureFlags & FEATURE_FLAG_RENDER_PLANE_YZ) != 0;
111 bool ActivePlaneXZ = (FeatureFlags & FEATURE_FLAG_RENDER_PLANE_XZ) != 0;
112 bool ActivePlaneXY = (FeatureFlags & FEATURE_FLAG_RENDER_PLANE_XY) != 0;
113
114 bool AttribsChanged = false;
115
116 ImGui::Text("Axes");
117 ImGui::SameLine();
118
119 if (ImGui::Checkbox("X", &ActiveAxisX))
120 AttribsChanged = true;
121
122 ImGui::SameLine();
123 if (ImGui::Checkbox("Y", &ActiveAxisY))
124 AttribsChanged = true;
125
126 ImGui::SameLine();
127 if (ImGui::Checkbox("Z", &ActiveAxisZ))
128 AttribsChanged = true;
129
130 ImGui::Text("Planes");
131 ImGui::SameLine();
132
133 if (ImGui::Checkbox("YZ", &ActivePlaneYZ))
134 AttribsChanged = true;
135
136 ImGui::SameLine();
137 if (ImGui::Checkbox("XZ", &ActivePlaneXZ))
138 AttribsChanged = true;
139
140 ImGui::SameLine();
141 if (ImGui::Checkbox("XY", &ActivePlaneXY))
142 AttribsChanged = true;
143
144 if (ImGui::SliderFloat("YZ Scale", &Attribs.GridScale[0], 0.01f, 10.0))
145 AttribsChanged = true;
146 if (ImGui::SliderFloat("XZ Scale", &Attribs.GridScale[1], 0.01f, 10.0))
147 AttribsChanged = true;
148 if (ImGui::SliderFloat("XY Scale", &Attribs.GridScale[2], 0.01f, 10.0))
149 AttribsChanged = true;
150
151
152 auto SubdivisionSlider = [](const char* Name, float& Subdivision) {
153 int SubdivisionInt = static_cast<int>(Subdivision);
154 if (ImGui::SliderInt(Name, &SubdivisionInt, 2, 10))
155 {
156 Subdivision = static_cast<float>(SubdivisionInt);
157 return true;
158 }
159 return false;
160 };
161 if (SubdivisionSlider("YZ Subdivision", Attribs.GridSubdivision[0]))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected