]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_statetreesampleritem.cpp
Initial vogl checkin
[vogl] / src / vogleditor / vogleditor_statetreesampleritem.cpp
1 #include "vogleditor_statetreesampleritem.h"
2 #include "vogl_sampler_state.h"
3
4 vogleditor_stateTreeSamplerItem::vogleditor_stateTreeSamplerItem(QString name, QString value, vogleditor_stateTreeItem* parent, const vogl_sampler_state* pState, const vogl_context_info& info)
5     : vogleditor_stateTreeItem(name, value, parent),
6       m_pState(pState),
7       m_pDiffBaseState(NULL)
8 {
9     int iVals[4] = {0,0,0,0};
10     float fVals[4] = {0,0,0,0};
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_FLOAT(name, num) if (pState->get_params().get<float>(name, 0, fVals, num)) { vogleditor_stateTreeStateVecFloatItem* pItem = new vogleditor_stateTreeStateVecFloatItem(#name, name, 0, pState->get_params(), fVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
13
14                     GET_ENUM(GL_TEXTURE_MAG_FILTER, 1);
15                     GET_ENUM(GL_TEXTURE_MIN_FILTER, 1);
16                     GET_FLOAT(GL_TEXTURE_MIN_LOD, 1);
17                     GET_FLOAT(GL_TEXTURE_MAX_LOD, 1);
18                     GET_ENUM(GL_TEXTURE_WRAP_S, 1);
19                     GET_ENUM(GL_TEXTURE_WRAP_T, 1);
20                     GET_ENUM(GL_TEXTURE_WRAP_R, 1);
21                     GET_FLOAT(GL_TEXTURE_BORDER_COLOR, 4);
22                     GET_ENUM(GL_TEXTURE_COMPARE_MODE, 1);
23                     GET_ENUM(GL_TEXTURE_COMPARE_FUNC, 1);
24
25                     if (info.supports_extension("GL_EXT_texture_filter_anisotropic"))
26                     {
27                         GET_FLOAT(GL_TEXTURE_MAX_ANISOTROPY_EXT, 1);
28                     }
29
30                     if (info.supports_extension("GL_EXT_texture_sRGB_decode"))
31                     {
32                         GET_ENUM(GL_TEXTURE_SRGB_DECODE_EXT, 1);
33                     }
34 #undef GET_ENUM
35 #undef GET_FLOAT
36 }
37
38 void vogleditor_stateTreeSamplerItem::set_diff_base_state(const vogl_sampler_state* pBaseState)
39 {
40     m_pDiffBaseState = pBaseState;
41
42     for (vogleditor_stateTreeStateVecDiffableItem* const* iter = m_diffableItems.begin(); iter != m_diffableItems.end(); iter++)
43     {
44          (*iter)->set_diff_base_state(&(pBaseState->get_params()));
45     }
46 }