]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_statetreelightitem.cpp
Initial vogl checkin
[vogl] / src / vogleditor / vogleditor_statetreelightitem.cpp
1 #include "vogleditor_statetreelightitem.h"
2 #include "vogl_state_vector.h"
3
4 vogleditor_stateTreeLightItem::vogleditor_stateTreeLightItem(QString name, unsigned int lightIndex, vogleditor_stateTreeItem* parent, const vogl_state_vector* pState)
5     : vogleditor_stateTreeItem(name, "", parent),
6       m_lightIndex(lightIndex),
7       m_pState(pState),
8       m_pDiffBaseState(NULL)
9 {
10     float fVals[4];
11 #define GET_FLOAT(name, num) if (pState->get<float>(name, 0, fVals, num)) { vogleditor_stateTreeStateVecFloatItem* pItem = new vogleditor_stateTreeStateVecFloatItem(#name, name, 0, *pState, fVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
12     GET_FLOAT(GL_CONSTANT_ATTENUATION, 1);
13     GET_FLOAT(GL_LINEAR_ATTENUATION, 1);
14     GET_FLOAT(GL_QUADRATIC_ATTENUATION, 1);
15     GET_FLOAT(GL_SPOT_EXPONENT, 1);
16     GET_FLOAT(GL_SPOT_CUTOFF, 1);
17     GET_FLOAT(GL_AMBIENT, 4);
18     GET_FLOAT(GL_DIFFUSE, 4);
19     GET_FLOAT(GL_SPECULAR, 4);
20     GET_FLOAT(GL_POSITION, 4);
21     GET_FLOAT(GL_SPOT_DIRECTION, 3);
22 #undef GET_FLOAT
23 }
24
25 void vogleditor_stateTreeLightItem::set_diff_base_state(const vogl_state_vector* pBaseState)
26 {
27     m_pDiffBaseState = pBaseState;
28
29     for (vogleditor_stateTreeStateVecDiffableItem* const* iter = m_diffableItems.begin(); iter != m_diffableItems.end(); iter++)
30     {
31          (*iter)->set_diff_base_state(pBaseState);
32     }
33 }
34