vogleditor_stateTreeArbProgramUIntItem::vogleditor_stateTreeArbProgramUIntItem(QString name, uint (vogl_arb_program_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state)
    : vogleditor_stateTreeArbProgramDiffableItem(name, "", parent, state),
      m_pFunc(func)
{
    uint val = (state.*func)();
    setValue(getValueFromUints(&val, 1));
}
QString vogleditor_stateTreeProgramUIntItem::getDiffedValue() const
{
    if (m_pDiffBaseState == NULL)
        return "";

    uint value = (m_pDiffBaseState->*m_pFunc)();
    return getValueFromUints(&value, 1);
}
QString vogleditor_stateTreeElementArrayUIntItem::getDiffedValue() const
{
    if (m_pDiffBaseState == NULL)
        return "";

    uint value = (m_pDiffBaseState->*m_pVal)();
    return getValueFromUints(&value, 1);
}
vogleditor_stateTreeContextInfoUIntItem::vogleditor_stateTreeContextInfoUIntItem(QString name, uint (vogl_context_info::*func)(void) const, vogleditor_stateTreeItem *parent, const vogl_context_info &info)
    : vogleditor_stateTreeContextInfoDiffableItem(name, "", parent),
      m_pState(&info),
      m_pFunc(func)
{
    uint val = (info.*func)();
    setValue(getValueFromUints(&val, 1));
}
示例#5
0
QString vogleditor_stateTreeItem::getValueFromUints(const uint* 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", getValueFromUints(values, 1).toStdString().c_str(), getValueFromUints(&(values[1]), count-1).toStdString().c_str());
    }

    return tmp;
}
QString vogleditor_stateTreeVertexArrayUIntItem::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);

        uint value = baseDesc.*m_pVal;
        return getValueFromUints(&value, 1);
    }

    return "";
}