QString vogleditor_stateTreeVertexArrayBoolItem::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); if (m_pVal != NULL) { bool value = baseDesc.*m_pVal; return getValueFromBools(&value, 1); } if (m_pIntVal != NULL) { bool value = (baseDesc.*m_pVal != 0); return getValueFromBools(&value, 1); } } return ""; }
QString vogleditor_stateTreeItem::getValueFromBools(const bool* values, uint count) const { if (count == 0 || values == NULL) { return ""; } else if (count == 1) { return (values[0]) ? "GL_TRUE" : "GL_FALSE"; } QString tmp; tmp = tmp.sprintf("%s, %s", getValueFromBools(values, 1).toStdString().c_str(), getValueFromBools(&(values[1]), count-1).toStdString().c_str()); return tmp; }
vogleditor_stateTreeArbProgramBoolItem::vogleditor_stateTreeArbProgramBoolItem(QString name, bool (vogl_arb_program_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state) : vogleditor_stateTreeArbProgramDiffableItem(name, "", parent, state), m_pFunc(func) { bool val = (state.*func)(); setValue(getValueFromBools(&val, 1)); }
QString vogleditor_stateTreeProgramBoolItem::getDiffedValue() const { if (m_pDiffBaseState == NULL) return ""; bool value = (m_pDiffBaseState->*m_pFunc)(); return getValueFromBools(&value, 1); }
vogleditor_stateTreeContextInfoBoolItem::vogleditor_stateTreeContextInfoBoolItem(QString name, bool (vogl_context_info::*func)(void) const, vogleditor_stateTreeItem *parent, const vogl_context_info &info) : vogleditor_stateTreeContextInfoDiffableItem(name, "", parent), m_pState(&info), m_pFunc(func) { bool val = (info.*func)(); setValue(getValueFromBools(&val, 1)); }
QString vogleditor_stateTreeStateVecBoolItem::getDiffedValue() const { static bool baseValues[4]; VOGL_ASSERT(m_numComponents <= 4); QString result = ""; if (m_pDiffBaseState->get<bool>(m_name, m_index, baseValues, m_numComponents, m_isIndexed)) { result = getValueFromBools(baseValues, m_numComponents); } return result; }
vogleditor_stateTreeStateVecBoolItem::vogleditor_stateTreeStateVecBoolItem(QString glenumName, GLenum name, unsigned int index, const vogl_state_vector& stateVec, int* values, unsigned int numComponents, bool isIndexed, vogleditor_stateTreeItem* parent) : vogleditor_stateTreeDatatypeItem<bool>(glenumName, name, index, stateVec, numComponents, isIndexed, parent) { bool bVals[4] = {values[0] != 0, values[1] != 0, values[2] != 0, values[3] != 0 }; setValue(getValueFromBools(bVals, numComponents)); }
//============================================================================= vogleditor_stateTreeStateVecBoolItem::vogleditor_stateTreeStateVecBoolItem(QString glenumName, GLenum name, unsigned int index, const vogl_state_vector& stateVec, bool* values, unsigned int numComponents, bool isIndexed, vogleditor_stateTreeItem* parent) : vogleditor_stateTreeDatatypeItem<bool>(glenumName, name, index, stateVec, numComponents, isIndexed, parent) { setValue(getValueFromBools(values, numComponents)); }