OpenSceneGraph 3.6.5
Vec4ui
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_VEC4UI
15#define OSG_VEC4UI 1
16
17namespace osg {
18
21class Vec4ui
22{
23 public:
24
26 typedef unsigned int value_type;
27
29 enum { num_components = 4 };
30
33
34 Vec4ui() { _v[0]=0; _v[1]=0; _v[2]=0; _v[3]=0; }
35
37 {
38 _v[0]=x;
39 _v[1]=y;
40 _v[2]=z;
41 _v[3]=w;
42 }
43
44 inline bool operator == (const Vec4ui& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2] && _v[3]==v._v[3]; }
45 inline bool operator != (const Vec4ui& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1] || _v[2]!=v._v[2] || _v[3]!=v._v[3]; }
46 inline bool operator < (const Vec4ui& v) const
47 {
48 if (_v[0]<v._v[0]) return true;
49 else if (_v[0]>v._v[0]) return false;
50 else if (_v[1]<v._v[1]) return true;
51 else if (_v[1]>v._v[1]) return false;
52 else if (_v[2]<v._v[2]) return true;
53 else if (_v[2]>v._v[2]) return false;
54 else return (_v[3]<v._v[3]);
55 }
56
57 inline value_type* ptr() { return _v; }
58 inline const value_type* ptr() const { return _v; }
59
61 {
62 _v[0]=x; _v[1]=y; _v[2]=z; _v[3]=w;
63 }
64
65 inline value_type& operator [] (unsigned int i) { return _v[i]; }
66 inline value_type operator [] (unsigned int i) const { return _v[i]; }
67
68 inline value_type& x() { return _v[0]; }
69 inline value_type& y() { return _v[1]; }
70 inline value_type& z() { return _v[2]; }
71 inline value_type& w() { return _v[3]; }
72
73 inline value_type x() const { return _v[0]; }
74 inline value_type y() const { return _v[1]; }
75 inline value_type z() const { return _v[2]; }
76 inline value_type w() const { return _v[3]; }
77
78 inline value_type& r() { return _v[0]; }
79 inline value_type& g() { return _v[1]; }
80 inline value_type& b() { return _v[2]; }
81 inline value_type& a() { return _v[3]; }
82
83 inline value_type r() const { return _v[0]; }
84 inline value_type g() const { return _v[1]; }
85 inline value_type b() const { return _v[2]; }
86 inline value_type a() const { return _v[3]; }
87
88 inline Vec4ui operator * (value_type rhs) const
89 {
90 return Vec4ui(_v[0]*rhs, _v[1]*rhs, _v[2]*rhs, _v[3]*rhs);
91 }
92
93 inline Vec4ui operator / (value_type rhs) const
94 {
95 return Vec4ui(_v[0]/rhs, _v[1]/rhs, _v[2]/rhs, _v[3]/rhs);
96 }
97
98 inline Vec4ui operator + (value_type rhs) const
99 {
100 return Vec4ui(_v[0]+rhs, _v[1]+rhs, _v[2]+rhs, _v[3]+rhs);
101 }
102
103 inline Vec4ui operator - (value_type rhs) const
104 {
105 return Vec4ui(_v[0]-rhs, _v[1]-rhs, _v[2]-rhs, _v[3]-rhs);
106 }
107
108 inline Vec4ui operator + (const Vec4ui& rhs) const
109 {
110 return Vec4ui(_v[0]+rhs._v[0], _v[1]+rhs._v[1], _v[2]+rhs._v[2], _v[3]+rhs._v[3]);
111 }
112
113 inline Vec4ui operator - (const Vec4ui& rhs) const
114 {
115 return Vec4ui(_v[0]-rhs._v[0], _v[1]-rhs._v[1], _v[2]-rhs._v[2], _v[3]-rhs._v[3]);
116 }
117
118 inline Vec4ui operator * (const Vec4ui& rhs) const
119 {
120 return Vec4ui(_v[0]*rhs._v[0], _v[1]*rhs._v[1], _v[2]*rhs._v[2], _v[3]*rhs._v[3]);
121 }
122};
123
124}
125
126#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
bool operator!=(const Vec4ui &v) const
Definition Vec4ui:45
const value_type * ptr() const
Definition Vec4ui:58
value_type w() const
Definition Vec4ui:76
value_type g() const
Definition Vec4ui:84
value_type x() const
Definition Vec4ui:73
value_type y() const
Definition Vec4ui:74
Vec4ui operator*(value_type rhs) const
Definition Vec4ui:88
value_type & x()
Definition Vec4ui:68
value_type & r()
Definition Vec4ui:78
bool operator==(const Vec4ui &v) const
Definition Vec4ui:44
value_type & operator[](unsigned int i)
Definition Vec4ui:65
void set(value_type x, value_type y, value_type z, value_type w)
Definition Vec4ui:60
value_type & g()
Definition Vec4ui:79
Vec4ui operator-(value_type rhs) const
Definition Vec4ui:103
value_type b() const
Definition Vec4ui:85
value_type & b()
Definition Vec4ui:80
Vec4ui()
Definition Vec4ui:34
bool operator<(const Vec4ui &v) const
Definition Vec4ui:46
value_type & a()
Definition Vec4ui:81
Vec4ui operator+(value_type rhs) const
Definition Vec4ui:98
value_type * ptr()
Definition Vec4ui:57
Vec4ui operator/(value_type rhs) const
Definition Vec4ui:93
@ num_components
Definition Vec4ui:29
unsigned int value_type
Type of Vec class.
Definition Vec4ui:26
value_type _v[4]
Vec member variable.
Definition Vec4ui:32
value_type r() const
Definition Vec4ui:83
value_type a() const
Definition Vec4ui:86
value_type & y()
Definition Vec4ui:69
Vec4ui(value_type x, value_type y, value_type z, value_type w)
Definition Vec4ui:36
value_type & w()
Definition Vec4ui:71
value_type z() const
Definition Vec4ui:75
value_type & z()
Definition Vec4ui:70

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.