]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_statetreematrixitem.h
Initial vogl checkin
[vogl] / src / vogleditor / vogleditor_statetreematrixitem.h
1 #ifndef VOGLEDITOR_STATETREEMATRIXITEM_H
2 #define VOGLEDITOR_STATETREEMATRIXITEM_H
3
4 #include "vogleditor_statetreeitem.h"
5 #include "vogl_matrix_state.h"
6
7 class vogleditor_stateTreeMatrixRowItem: public vogleditor_stateTreeItem
8 {
9 public:
10     vogleditor_stateTreeMatrixRowItem(QString name, unsigned int rowIndex, vogleditor_stateTreeItem* parent, const matrix44D& matrix);
11
12     virtual ~vogleditor_stateTreeMatrixRowItem()
13     {
14         m_pState = NULL;
15         m_pDiffBaseState = NULL;
16     }
17
18     void set_diff_base_state(const matrix44D* pBaseState) { m_pDiffBaseState = pBaseState; }
19
20     virtual bool hasChanged() const;
21     virtual QString getDiffedValue() const;
22
23 private:
24     unsigned int m_rowIndex;
25     const matrix44D* m_pState;
26     const matrix44D* m_pDiffBaseState;
27 };
28
29 class vogleditor_stateTreeMatrixItem: public vogleditor_stateTreeItem
30 {
31 public:
32     vogleditor_stateTreeMatrixItem(QString name, vogleditor_stateTreeItem* parent, const matrix44D& matrix, unsigned int stackIndex);
33
34     virtual ~vogleditor_stateTreeMatrixItem()
35     {
36         m_pState = NULL;
37         m_pDiffBaseState = NULL;
38     }
39
40     void set_diff_base_state(const matrix44D* pBaseState)
41     {
42         m_pDiffBaseState = pBaseState;
43
44         for (vogleditor_stateTreeMatrixRowItem** iter = m_rowItems.begin(); iter != m_rowItems.end(); iter++)
45         {
46             (*iter)->set_diff_base_state(pBaseState);
47         }
48     }
49
50     unsigned int get_stack_index() const { return m_stackIndex; }
51
52 private:
53     unsigned int m_stackIndex;
54     const matrix44D* m_pState;
55     const matrix44D* m_pDiffBaseState;
56     vogl::vector<vogleditor_stateTreeMatrixRowItem*> m_rowItems;
57 };
58
59 class vogleditor_stateTreeMatrixStackItem: public vogleditor_stateTreeItem
60 {
61 public:
62     vogleditor_stateTreeMatrixStackItem(QString name, GLenum target, unsigned int index, vogleditor_stateTreeItem* parent, const vogl_matrix_state& state);
63
64     virtual ~vogleditor_stateTreeMatrixStackItem()
65     {
66         m_pState = NULL;
67         m_pDiffBaseState = NULL;
68     }
69
70     void set_diff_base_state(const vogl_matrix_state* pBaseState)
71     {
72         m_pDiffBaseState = pBaseState;
73
74         for (vogleditor_stateTreeMatrixItem** iter = m_matrixItems.begin(); iter != m_matrixItems.end(); iter++)
75         {
76             const matrix44D* pMatrix = m_pDiffBaseState->get_matrix(m_target, m_index, (*iter)->get_stack_index());
77             (*iter)->set_diff_base_state(pMatrix);
78         }
79     }
80
81     GLenum get_target() const { return m_target; }
82
83 private:
84     GLenum m_target;
85     unsigned int m_index;
86     const vogl_matrix_state* m_pState;
87     const vogl_matrix_state* m_pDiffBaseState;
88     vogl::vector<vogleditor_stateTreeMatrixItem*> m_matrixItems;
89 };
90
91 #endif // VOGLEDITOR_STATETREEMATRIXITEM_H