// During initialization
ImGuiTextureManager textureManager(device, descriptorPool);
// Register textures (e.g., after loading a model or rendering to a texture)
ImTextureID albedoTexId = textureManager.registerTexture(
"albedo",
albedoImageView,
textureSampler,
albedoWidth,
albedoHeight
);
ImTextureID normalMapId = textureManager.registerTexture(
"normalMap",
normalMapImageView,
textureSampler,
normalMapWidth,
normalMapHeight
);
// In your GUI rendering code
void drawMaterialEditor() {
ImGui::Begin("Material Editor");
// Display textures
ImGui::Text("Albedo Texture:");
ImGui::Image(textureManager.getTexture("albedo"),
ImVec2(200, 200));
ImGui::Text("Normal Map:");
ImGui::Image(textureManager.getTexture("normalMap"),
ImVec2(200, 200));
// Material properties
static float roughness = 0.5f;
if (ImGui::SliderFloat("Roughness", &roughness, 0.0f, 1.0f)) {
updateMaterialProperty("roughness", roughness);
}
static float metallic = 0.0f;
if (ImGui::SliderFloat("Metallic", &metallic, 0.0f, 1.0f)) {
updateMaterialProperty("metallic", metallic);
}
ImGui::End();
}