~compiz-team/compiz/0.9.11

« back to all changes in this revision

Viewing changes to plugins/cube/include/cube/cube.h

  • Committer: Dennis Kasprzyk
  • Date: 2009-11-03 20:14:43 UTC
  • Revision ID: git-v1:15ec8bffb494bea174943a47a858591ab39e3ea0
Cube C++ port.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2007 Novell, Inc.
 
3
 *
 
4
 * Permission to use, copy, modify, distribute, and sell this software
 
5
 * and its documentation for any purpose is hereby granted without
 
6
 * fee, provided that the above copyright notice appear in all copies
 
7
 * and that both that copyright notice and this permission notice
 
8
 * appear in supporting documentation, and that the name of
 
9
 * Novell, Inc. not be used in advertising or publicity pertaining to
 
10
 * distribution of the software without specific, written prior permission.
 
11
 * Novell, Inc. makes no representations about the suitability of this
 
12
 * software for any purpose. It is provided "as is" without express or
 
13
 * implied warranty.
 
14
 *
 
15
 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
16
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
 
17
 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
18
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 
19
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 
20
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 
21
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
22
 *
 
23
 * Author: David Reveman <davidr@novell.com>
 
24
 */
 
25
 
 
26
#ifndef _COMPIZ_CUBE_H
 
27
#define _COMPIZ_CUBE_H
 
28
 
 
29
#include <core/core.h>
 
30
#include <core/pluginclasshandler.h>
 
31
 
 
32
#include <composite/composite.h>
 
33
#include <opengl/opengl.h>
 
34
#include <opengl/vector.h>
 
35
#include <opengl/texture.h>
 
36
 
 
37
#define COMPIZ_CUBE_ABI 1
 
38
 
 
39
typedef enum {
 
40
    BTF = 0,
 
41
    FTB
 
42
} PaintOrder;
 
43
 
 
44
class CubeScreen;
 
45
class PrivateCubeScreen;
 
46
 
 
47
class CubeScreenInterface :
 
48
    public WrapableInterface<CubeScreen, CubeScreenInterface>
 
49
{
 
50
    public:
 
51
        virtual void cubeGetRotation (float &x, float &v, float &progress);
 
52
        virtual void cubeClearTargetOutput (float xRotate, float vRotate);
 
53
        virtual void cubePaintTop (const GLScreenPaintAttrib &sAttrib,
 
54
                                   const GLMatrix            &transform,
 
55
                                   CompOutput                *output,
 
56
                                   int                       size);
 
57
        virtual void cubePaintBottom (const GLScreenPaintAttrib &sAttrib,
 
58
                                      const GLMatrix            &transform,
 
59
                                      CompOutput                *output,
 
60
                                      int                       size);
 
61
        virtual void cubePaintInside (const GLScreenPaintAttrib &sAttrib,
 
62
                                      const GLMatrix            &transform,
 
63
                                      CompOutput                *output,
 
64
                                      int                       size);
 
65
        virtual bool cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib,
 
66
                                           const GLMatrix            &transform,
 
67
                                           CompOutput                *output,
 
68
                                           std::vector<GLVector>     &points);
 
69
        virtual void cubePaintViewport (const GLScreenPaintAttrib &sAttrib,
 
70
                                        const GLMatrix            &transform,
 
71
                                        const CompRegion          &region,
 
72
                                        CompOutput                *output,
 
73
                                        unsigned int              mask);
 
74
        virtual bool cubeShouldPaintViewport (const GLScreenPaintAttrib &sAttrib,
 
75
                                              const GLMatrix            &transform,
 
76
                                              CompOutput                *output,
 
77
                                              PaintOrder                order);
 
78
 
 
79
};
 
80
 
 
81
class CubeScreen :
 
82
    public WrapableHandler<CubeScreenInterface, 8>,
 
83
    public PluginClassHandler<CubeScreen, CompScreen, COMPIZ_CUBE_ABI>,
 
84
    public CompOption::Class
 
85
{
 
86
    public:
 
87
 
 
88
        typedef enum {
 
89
            RotationNone = 0,
 
90
            RotationChange,
 
91
            RotationManual
 
92
        } RotationState;
 
93
 
 
94
        CubeScreen (CompScreen *s);
 
95
        ~CubeScreen ();
 
96
        
 
97
        CompOption::Vector & getOptions ();
 
98
        bool setOption (const CompString &name, CompOption::Value &value);
 
99
 
 
100
        WRAPABLE_HND (0, CubeScreenInterface, void, cubeGetRotation,
 
101
                      float &, float&, float&);
 
102
        WRAPABLE_HND (1, CubeScreenInterface, void, cubeClearTargetOutput,
 
103
                      float, float);
 
104
        WRAPABLE_HND (2, CubeScreenInterface, void, cubePaintTop,
 
105
                      const GLScreenPaintAttrib &, const GLMatrix &,
 
106
                      CompOutput *, int);
 
107
        WRAPABLE_HND (3, CubeScreenInterface, void, cubePaintBottom,
 
108
                      const GLScreenPaintAttrib &, const GLMatrix &,
 
109
                      CompOutput *, int);
 
110
        WRAPABLE_HND (4, CubeScreenInterface, void, cubePaintInside,
 
111
                      const GLScreenPaintAttrib &, const GLMatrix &,
 
112
                      CompOutput *, int);
 
113
        WRAPABLE_HND (5, CubeScreenInterface, bool, cubeCheckOrientation,
 
114
                      const GLScreenPaintAttrib &, const GLMatrix &,
 
115
                      CompOutput *, std::vector<GLVector> &);
 
116
        WRAPABLE_HND (6, CubeScreenInterface, void, cubePaintViewport,
 
117
                      const GLScreenPaintAttrib &, const GLMatrix &,
 
118
                      const CompRegion &, CompOutput *, unsigned int);
 
119
        WRAPABLE_HND (7, CubeScreenInterface, bool, cubeShouldPaintViewport,
 
120
                      const GLScreenPaintAttrib &, const GLMatrix &,
 
121
                      CompOutput *, PaintOrder);
 
122
        
 
123
        int invert () const;
 
124
        
 
125
        bool unfolded () const;
 
126
        
 
127
        RotationState rotationState () const;
 
128
        void rotationState (RotationState state);
 
129
 
 
130
        friend class PrivateCubeWindow;
 
131
        friend class PrivateCubeScreen;
 
132
 
 
133
    private:
 
134
        PrivateCubeScreen *priv;
 
135
};
 
136
 
 
137
#define CUBE_SCREEN(s) \
 
138
    CubeScreen *cs = CubeScreen::get (s)
 
139
 
 
140
#endif