]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_statetreebufferitem.cpp
Initial vogl checkin
[vogl] / src / vogleditor / vogleditor_statetreebufferitem.cpp
1 #include "vogleditor_statetreebufferitem.h"
2 #include "vogl_buffer_state.h"
3
4 vogleditor_stateTreeBufferItem::vogleditor_stateTreeBufferItem(QString name, QString value, vogleditor_stateTreeItem* parent, const vogl_buffer_state* pState)
5     : vogleditor_stateTreeItem(name, value, parent),
6       m_pState(pState),
7       m_pDiffBaseState(NULL)
8 {
9     int iVals[4] = {0,0,0,0};
10 #define GET_INT(name, num) if (pState->get_params().get<int>(name, 0, iVals, num)) { vogleditor_stateTreeStateVecIntItem* pItem = new vogleditor_stateTreeStateVecIntItem(#name, name, 0, pState->get_params(), iVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
11 #define GET_ENUM(name, num) if (pState->get_params().get<int>(name, 0, iVals, num)) { vogleditor_stateTreeStateVecEnumItem* pItem = new vogleditor_stateTreeStateVecEnumItem(#name, name, 0, pState->get_params(), iVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
12 #define GET_BOOL(name, num) if (pState->get_params().get<int>(name, 0, iVals, num)) { vogleditor_stateTreeStateVecBoolItem* pItem = new vogleditor_stateTreeStateVecBoolItem(#name, name, 0, pState->get_params(), iVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
13 #define GET_PTR(name, num) if (pState->get_params().get<int>(name, 0, iVals, num)) { vogleditor_stateTreeStateVecPtrItem* pItem = new vogleditor_stateTreeStateVecPtrItem(#name, name, 0, pState->get_params(), iVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
14                     GET_ENUM(GL_BUFFER_ACCESS, 1);
15                     GET_BOOL(GL_BUFFER_MAPPED, 1);
16                     GET_INT(GL_BUFFER_SIZE, 1);
17                     GET_ENUM(GL_BUFFER_USAGE, 1);
18                     GET_PTR(GL_BUFFER_MAP_POINTER, 1);
19 #undef GET_INT
20 #undef GET_ENUM
21 #undef GET_BOOL
22 #undef GET_PTR
23
24 }
25
26 void vogleditor_stateTreeBufferItem::set_diff_base_state(const vogl_buffer_state* pBaseState)
27 {
28     m_pDiffBaseState = pBaseState;
29
30     for (vogleditor_stateTreeStateVecDiffableItem* const* iter = m_diffableItems.begin(); iter != m_diffableItems.end(); iter++)
31     {
32          (*iter)->set_diff_base_state(&(pBaseState->get_params()));
33     }
34 }