~mc-return/compiz/compiz.merge-src-screen.cpp-improvements

« back to all changes in this revision

Viewing changes to include/opengl/vector.h

  • Committer: Dennis kasprzyk
  • Author(s): Dennis Kasprzyk
  • Date: 2009-03-15 05:09:18 UTC
  • Revision ID: git-v1:163f6b6f3c3b7764987cbdf8e03cc355edeaa499
New generalized build system.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2008 Danny Baumann
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
 
 * Dennis Kasprzyk not be used in advertising or publicity pertaining to
10
 
 * distribution of the software without specific, written prior permission.
11
 
 * Dennis Kasprzyk 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
 
 * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
 
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17
 
 * NO EVENT SHALL DENNIS KASPRZYK 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
 
 * Authors: Danny Baumann <maniac@compiz-fusion.org>
24
 
 */
25
 
 
26
 
#ifndef _GLVECTOR_H
27
 
#define _GLVECTOR_H
28
 
 
29
 
class GLVector {
30
 
    public:
31
 
        typedef enum {
32
 
            x,
33
 
            y,
34
 
            z,
35
 
            w
36
 
        } VectorCoordsEnum;
37
 
 
38
 
        GLVector ();
39
 
        GLVector (float x, float y, float z, float w);
40
 
 
41
 
        float& operator[] (int item);
42
 
        float& operator[] (VectorCoordsEnum coord);
43
 
 
44
 
        const float operator[] (int item) const;
45
 
        const float operator[] (VectorCoordsEnum coord) const;
46
 
 
47
 
        GLVector& operator+= (const GLVector& rhs);
48
 
        GLVector& operator-= (const GLVector& rhs);
49
 
        GLVector& operator*= (const float k);
50
 
        GLVector& operator/= (const float k);
51
 
        GLVector& operator^= (const GLVector& rhs);
52
 
 
53
 
        float norm ();
54
 
        GLVector& normalize ();
55
 
 
56
 
    private:
57
 
        friend GLVector operator+ (const GLVector& lhs,
58
 
                                   const GLVector& rhs);
59
 
        friend GLVector operator- (const GLVector& lhs,
60
 
                                   const GLVector& rhs);
61
 
        friend GLVector operator- (const GLVector& vector);
62
 
        friend float operator* (const GLVector& lhs,
63
 
                                const GLVector& rhs);
64
 
        friend GLVector operator* (const float       k,
65
 
                                   const GLVector& vector);
66
 
        friend GLVector operator* (const GLVector& vector,
67
 
                                   const float       k);
68
 
        friend GLVector operator/ (const GLVector& lhs,
69
 
                                   const GLVector& rhs);
70
 
        friend GLVector operator^ (const GLVector& lhs,
71
 
                                   const GLVector& rhs);
72
 
 
73
 
        float v[4];
74
 
};
75
 
 
76
 
#endif