vogleditor_stateTreeArbProgramIntItem::vogleditor_stateTreeArbProgramIntItem(QString name, GLint (vogl_arb_program_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state) : vogleditor_stateTreeArbProgramDiffableItem(name, "", parent, state), m_pFunc(func) { GLint val = (state.*func)(); setValue(getValueFromInts(&val, 1)); }
QString vogleditor_stateTreeArbProgramIntItem::getDiffedValue() const { if (m_pDiffBaseState == NULL) return ""; int val = (m_pDiffBaseState->*m_pFunc)(); return getValueFromInts(&val, 1); }
QString vogleditor_stateTreeRenderbufferIntItem::getDiffedValue() const { if (m_pDiffBaseState == NULL) return ""; int baseVal = 0; if (m_pDiffBaseState->get_desc().get_int(m_enum, &baseVal) == false) { return "non-existent"; } return getValueFromInts(&baseVal, 1); }
QString vogleditor_stateTreeStateVecIntItem::getDiffedValue() const { static int baseValues[4]; VOGL_ASSERT(m_numComponents <= 4); QString result = ""; if (m_pDiffBaseState->get<int>(m_name, m_index, baseValues, m_numComponents, m_isIndexed)) { result = getValueFromInts(baseValues, m_numComponents); } return result; }
QString vogleditor_stateTreeItem::getValueFromInts(const int* values, uint count) const { QString tmp; if (count == 0 || values == NULL) { return ""; } else if (count == 1) { tmp = tmp.sprintf("%d", *values); } else { tmp = tmp.sprintf("%s, %s", getValueFromInts(values, 1).toStdString().c_str(), getValueFromInts(&(values[1]), count-1).toStdString().c_str()); } return tmp; }
QString vogleditor_stateTreeVertexArrayIntItem::getDiffedValue() const { if (m_pDiffBaseState == NULL) return ""; if (m_arrayIndex >= m_pDiffBaseState->get_vertex_attrib_count()) { // the current node does not exist in the base snapshot, so it must be new and different. return "non-existent"; } else { const vogl_vertex_attrib_desc& baseDesc = m_pDiffBaseState->get_vertex_attrib_desc(m_arrayIndex); int value = baseDesc.*m_pVal; return getValueFromInts(&value, 1); } return ""; }
vogleditor_stateTreeStateVecIntItem::vogleditor_stateTreeStateVecIntItem(QString glenumName, GLenum name, unsigned int index, const vogl_state_vector& stateVec, int* values, unsigned int numComponents, bool isIndexed, vogleditor_stateTreeItem* parent) : vogleditor_stateTreeDatatypeItem<int>(glenumName, name, index, stateVec, numComponents, isIndexed, parent) { setValue(getValueFromInts(values, numComponents)); }