1 #ifndef VOGLEDITOR_STATETREESHADERITEM_H
2 #define VOGLEDITOR_STATETREESHADERITEM_H
4 #include "vogleditor_statetreeitem.h"
6 class vogl_shader_state;
9 class vogleditor_stateTreeShaderDiffableItem : public vogleditor_stateTreeItem
12 vogleditor_stateTreeShaderDiffableItem(QString name, QString value, vogleditor_stateTreeItem* parent, const vogl_shader_state& state)
13 : vogleditor_stateTreeItem(name, value, parent),
15 m_pDiffBaseState(NULL)
19 void set_diff_base_state(const vogl_shader_state* pBaseState)
21 m_pDiffBaseState = pBaseState;
24 const vogl_shader_state* get_current_state() const { return m_pState; }
25 const vogl_shader_state* get_base_state() const { return m_pDiffBaseState; }
27 virtual bool hasChanged() const = 0;
30 const vogl_shader_state* m_pState;
31 const vogl_shader_state* m_pDiffBaseState;
34 class vogleditor_stateTreeShaderBoolItem : public vogleditor_stateTreeShaderDiffableItem
37 vogleditor_stateTreeShaderBoolItem(QString name, bool (vogl_shader_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_shader_state& state);
38 virtual ~vogleditor_stateTreeShaderBoolItem() { m_pState = NULL; }
40 virtual bool hasChanged() const;
41 virtual QString getDiffedValue() const;
44 bool (vogl_shader_state::* m_pFunc)(void) const;
47 class vogleditor_stateTreeShaderLogItem : public vogleditor_stateTreeShaderDiffableItem
50 vogleditor_stateTreeShaderLogItem(QString name, const vogl::dynamic_string& (vogl_shader_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_shader_state& state);
51 virtual ~vogleditor_stateTreeShaderLogItem() { m_pState = NULL; }
53 virtual bool hasChanged() const;
54 virtual QString getDiffedValue() const;
57 const vogl::dynamic_string& (vogl_shader_state::* m_pFunc)(void) const;
60 class vogleditor_stateTreeShaderSourceLengthItem : public vogleditor_stateTreeShaderDiffableItem
63 vogleditor_stateTreeShaderSourceLengthItem(QString name, vogleditor_stateTreeItem* parent, const vogl_shader_state& state);
64 virtual ~vogleditor_stateTreeShaderSourceLengthItem() { m_pState = NULL; }
66 virtual bool hasChanged() const;
67 virtual QString getDiffedValue() const;
72 class vogleditor_stateTreeShaderStringItem : public vogleditor_stateTreeShaderDiffableItem
75 vogleditor_stateTreeShaderStringItem(QString name, const vogl::dynamic_string& (vogl_shader_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_shader_state& state);
76 virtual ~vogleditor_stateTreeShaderStringItem() { m_pState = NULL; }
78 virtual bool hasChanged() const;
79 virtual QString getDiffedValue() const;
82 dynamic_string m_value;
83 const vogl::dynamic_string& (vogl_shader_state::* m_pFunc)(void) const;
86 class vogleditor_stateTreeShaderItem : public vogleditor_stateTreeItem
89 vogleditor_stateTreeShaderItem(QString name, QString value, vogleditor_stateTreeItem* parent, vogl_shader_state& state);
90 virtual ~vogleditor_stateTreeShaderItem() { m_pState = NULL; m_pDiffBaseState = NULL; }
91 virtual state_tree_type getStateType() const { return vogleditor_stateTreeItem::cSHADER; }
93 vogl_shader_state* get_current_state() const { return m_pState; }
94 const vogl_shader_state* get_base_state() const { return m_pDiffBaseState; }
96 void add_diffable_child(vogleditor_stateTreeShaderDiffableItem* pItem);
98 void set_diff_base_state(const vogl_shader_state* pBaseState)
100 m_pDiffBaseState = pBaseState;
101 for (vogleditor_stateTreeShaderDiffableItem** iter = m_diffableItems.begin(); iter != m_diffableItems.end(); iter++)
103 (*iter)->set_diff_base_state(pBaseState);
108 vogl_shader_state* m_pState;
109 const vogl_shader_state* m_pDiffBaseState;
110 vogl::vector<vogleditor_stateTreeShaderDiffableItem*> m_diffableItems;
112 #endif // VOGLEDITOR_STATETREESHADERITEM_H