-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplayInterfaceBlock.cpp
More file actions
31 lines (24 loc) · 888 Bytes
/
Copy pathDisplayInterfaceBlock.cpp
File metadata and controls
31 lines (24 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// Created by Simon Cros on 08/02/2025.
//
#include "DisplayInterfaceBlock.h"
#include "Engine/Object.h"
constexpr const char* displayModes[] = {
"Fill", "Line", "Point",
};
constexpr int displayModeToPolygonMode[] = {
GL_FILL, GL_LINE, GL_POINT,
};
DisplayInterfaceBlock::DisplayInterfaceBlock(UserInterface& interface)
{
m_meshRenderer = &interface.object().getComponent<MeshRenderer>()->get();
}
auto DisplayInterfaceBlock::onDrawUI(uint16_t blockId, Engine& engine, UserInterface& interface) -> void
{
ImGui::Text("Display");
if (ImGui::Checkbox("##displayed", &m_displayed))
m_meshRenderer->setDisplay(m_displayed);
ImGui::SameLine();
if (ImGui::Combo("##display mode", &m_selectedDisplayMode, displayModes, IM_ARRAYSIZE(displayModes)))
m_meshRenderer->setPolygoneMode(engine, displayModeToPolygonMode[m_selectedDisplayMode]);
}