1 #include "vogleditor_statetreecontextinfoitem.h"
3 vogleditor_stateTreeContextInfoBoolItem::vogleditor_stateTreeContextInfoBoolItem(QString name, bool (vogl_context_info::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_context_info& info)
4 : vogleditor_stateTreeContextInfoDiffableItem(name, "", parent),
8 bool val = (info.*func)();
9 setValue(getValueFromBools(&val, 1));
12 bool vogleditor_stateTreeContextInfoBoolItem::hasChanged() const
14 if (m_pDiffBaseState == NULL)
17 return (m_pState->*m_pFunc)() != (m_pDiffBaseState->*m_pFunc)();
20 QString vogleditor_stateTreeContextInfoBoolItem::getDiffedValue() const
22 if (m_pDiffBaseState == NULL)
25 bool val = (m_pDiffBaseState->*m_pFunc)();
26 return getValueFromBools(&val, 1);
29 //=============================================================================
31 vogleditor_stateTreeContextInfoUIntItem::vogleditor_stateTreeContextInfoUIntItem(QString name, uint (vogl_context_info::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_context_info& info)
32 : vogleditor_stateTreeContextInfoDiffableItem(name, "", parent),
36 uint val = (info.*func)();
37 setValue(getValueFromUints(&val, 1));
40 bool vogleditor_stateTreeContextInfoUIntItem::hasChanged() const
42 if (m_pDiffBaseState == NULL)
45 return (m_pState->*m_pFunc)() != (m_pDiffBaseState->*m_pFunc)();
48 QString vogleditor_stateTreeContextInfoUIntItem::getDiffedValue() const
50 if (m_pDiffBaseState == NULL)
53 uint val = (m_pDiffBaseState->*m_pFunc)();
54 return getValueFromUints(&val, 1);
57 //=============================================================================
59 vogleditor_stateTreeContextInfoStringItem::vogleditor_stateTreeContextInfoStringItem(QString name, const vogl::dynamic_string& (vogl_context_info::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_context_info& info)
60 : vogleditor_stateTreeContextInfoDiffableItem(name, "", parent),
64 m_value = (info.*func)();
65 setValue(m_value.c_str());
68 bool vogleditor_stateTreeContextInfoStringItem::hasChanged() const
70 if (m_pDiffBaseState == NULL)
76 return (m_pState->*m_pFunc)() != (m_pDiffBaseState->*m_pFunc)();
80 QString vogleditor_stateTreeContextInfoStringItem::getDiffedValue() const
82 if (m_pDiffBaseState == NULL)
85 vogl::dynamic_string val = (m_pDiffBaseState->*m_pFunc)();
86 return QString(val.c_str());
89 //=============================================================================
91 bool vogleditor_stateTreeContextInfoItem::hasChanged() const
93 if (m_pDiffBaseState == NULL)
96 for (vogleditor_stateTreeContextInfoDiffableItem* const * iter = m_diffableItems.begin(); iter != m_diffableItems.end(); iter++)
98 if ((*iter)->hasChanged())
107 vogleditor_stateTreeContextInfoItem::vogleditor_stateTreeContextInfoItem(QString name, QString value, vogleditor_stateTreeItem* parent, const vogl_context_info& info)
108 : vogleditor_stateTreeItem(name, value, parent),
110 m_pDiffBaseState(NULL)
120 tmp = "Never made current";
127 { vogleditor_stateTreeContextInfoBoolItem* pItem = new vogleditor_stateTreeContextInfoBoolItem("Forward compatible", &vogl_context_info::is_forward_compatible, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
128 { vogleditor_stateTreeContextInfoBoolItem* pItem = new vogleditor_stateTreeContextInfoBoolItem("Core profile", &vogl_context_info::is_core_profile, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
129 { vogleditor_stateTreeContextInfoBoolItem* pItem = new vogleditor_stateTreeContextInfoBoolItem("Compatibility Profile", &vogl_context_info::is_compatibility_profile, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
130 { vogleditor_stateTreeContextInfoBoolItem* pItem = new vogleditor_stateTreeContextInfoBoolItem("Debug context", &vogl_context_info::is_debug_context, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
132 { vogleditor_stateTreeContextInfoStringItem* pItem = new vogleditor_stateTreeContextInfoStringItem("GL_RENDERER", &vogl_context_info::get_renderer_str, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
133 { vogleditor_stateTreeContextInfoStringItem* pItem = new vogleditor_stateTreeContextInfoStringItem("GL_VENDOR", &vogl_context_info::get_vendor_str, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
134 { vogleditor_stateTreeContextInfoStringItem* pItem = new vogleditor_stateTreeContextInfoStringItem("GL_VERSION", &vogl_context_info::get_version_str, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
135 { vogleditor_stateTreeContextInfoStringItem* pItem = new vogleditor_stateTreeContextInfoStringItem("GL_SHADING_LANGUAGE_VERSION", &vogl_context_info::get_glsl_version_str, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
137 vogleditor_stateTreeItem* pExtNode = new vogleditor_stateTreeItem("GL_EXTENSIONS", "", this);
138 this->appendChild(pExtNode);
139 const dynamic_string_array& extList = info.get_extensions();
140 for (uint e = 0; e < extList.size(); e++)
142 vogleditor_stateTreeContextInfoExtensionItem* pItem = new vogleditor_stateTreeContextInfoExtensionItem(tmp.sprintf("%d", e), extList[e].c_str(), pExtNode, info);
143 m_diffableItems.push_back(pItem);
144 pExtNode->appendChild(pItem);
146 pExtNode->setValue(tmp.sprintf("[%d]", pExtNode->childCount()));
148 { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_PROGRAM_ENV_PARAMETERS_ARB GL_VERTEX_PROGRAM_ARB", &vogl_context_info::get_max_arb_vertex_program_env_params, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
149 { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_PROGRAM_ENV_PARAMETERS_ARB GL_FRAGMENT_PROGRAM_ARB", &vogl_context_info::get_max_arb_fragment_program_env_params, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
150 { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_PROGRAM_MATRICES_ARB", &vogl_context_info::get_max_arb_program_matrices, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
151 { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_COMBINED_TEXTURE_COORDS", &vogl_context_info::get_max_combined_texture_coords, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
152 { vogleditor_stateTreeContextInfoUIntItem* pItem = new vogleditor_stateTreeContextInfoUIntItem("GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", &vogl_context_info::get_max_transform_feedback_separate_attribs, this, info); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
155 // this->appendChild(new vogleditor_stateTreeItem("GL_MAX_DRAW_BUFFERS", STR_INT(info.get_max_draw_buffers()), this));
156 // this->appendChild(new vogleditor_stateTreeItem("GL_MAX_LIGHTS", STR_INT(info.get_max_lights()), this));
157 // this->appendChild(new vogleditor_stateTreeItem("GL_MAX_TEXTURE_COORDS", STR_INT(info.get_max_texture_coords()), this));
158 // this->appendChild(new vogleditor_stateTreeItem("GL_MAX_TEXTURE_IMAGE_UNITS", STR_INT(info.get_max_texture_image_units()), this));
159 // this->appendChild(new vogleditor_stateTreeItem("GL_MAX_TEXTURE_UNITS", STR_INT(info.get_max_texture_units()), this));
160 // this->appendChild(new vogleditor_stateTreeItem("GL_MAX_UNIFORM_BUFFER_BINDINGS", STR_INT(info.get_max_uniform_buffer_bindings()), this));
161 // this->appendChild(new vogleditor_stateTreeItem("GL_MAX_VERTEX_ATTRIBS", STR_INT(info.get_max_vertex_attribs()), this));