Added Vec4Property to imgui

This commit is contained in:
Alexander Bock
2015-01-21 15:12:54 +01:00
parent d6a02140ea
commit f752221772
2 changed files with 19 additions and 1 deletions
+1
View File
@@ -91,6 +91,7 @@ private:
std::set<properties::Property*> _floatProperties;
std::set<properties::Property*> _vec2Properties;
std::set<properties::Property*> _vec3Properties;
std::set<properties::Property*> _vec4Properties;
std::set<properties::Property*> _stringProperties;
std::set<properties::Property*> _optionProperty;
std::set<properties::Property*> _selectionProperty;
+18 -1
View File
@@ -213,7 +213,6 @@ void renderVec2Property(Property* prop, const std::string& ownerName) {
p->set(value);
}
void renderVec3Property(Property* prop, const std::string& ownerName) {
Vec3Property* p = static_cast<Vec3Property*>(prop);
std::string name = p->guiName();
@@ -224,6 +223,16 @@ void renderVec3Property(Property* prop, const std::string& ownerName) {
p->set(value);
}
void renderVec4Property(Property* prop, const std::string& ownerName) {
Vec4Property* p = static_cast<Vec4Property*>(prop);
std::string name = p->guiName();
Vec4Property::ValueType value = *p;
ImGui::SliderFloat4((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
p->set(value);
}
void renderTriggerProperty(Property* prop, const std::string& ownerName) {
std::string name = prop->guiName();
bool pressed = ImGui::Button((ownerName + "." + name).c_str());
@@ -238,6 +247,7 @@ namespace openspace {
GUI::GUI()
: _isEnabled(false)
, _showPropertyWindow(false)
, _showPerformanceWindow(false)
, _showHelp(false)
, _performanceMemory(nullptr)
{
@@ -430,6 +440,8 @@ void GUI::registerProperty(properties::Property* prop) {
_vec2Properties.insert(prop);
else if (className == "Vec3Property")
_vec3Properties.insert(prop);
else if (className == "Vec4Property")
_vec4Properties.insert(prop);
else if (className == "OptionProperty")
_optionProperty.insert(prop);
else if (className == "TriggerProperty")
@@ -505,6 +517,11 @@ void GUI::renderPropertyWindow() {
continue;
}
if (_vec4Properties.find(prop) != _vec4Properties.end()) {
renderVec4Property(prop, p.first);
continue;
}
if (_optionProperty.find(prop) != _optionProperty.end()) {
renderOptionProperty(prop, p.first);
continue;